diff --git a/protos/google/cloud/retail/v2alpha/common.proto b/protos/google/cloud/retail/v2alpha/common.proto index b0d443dd..71d57b0b 100644 --- a/protos/google/cloud/retail/v2alpha/common.proto +++ b/protos/google/cloud/retail/v2alpha/common.proto @@ -432,3 +432,29 @@ message Promotion { // [promotion](https://support.google.com/merchants/answer/7050148). string promotion_id = 1; } + +// The inventory information at a place (e.g. a store) identified +// by a place ID. +message LocalInventory { + // The place ID for the current set of inventory information. + string place_id = 1; + + // Product price and cost information. + // + // Google Merchant Center property + // [price](https://support.google.com/merchants/answer/6324371). + PriceInfo price_info = 2; + + // Additional local inventory attributes, for example, store name, promotion + // tags, etc. + // * At most 5 values are allowed. Otherwise, an INVALID_ARGUMENT error is + // returned. + // * The key must be a UTF-8 encoded string with a length limit of 10 + // characters. + // * The key must match the pattern: `[a-zA-Z0-9][a-zA-Z0-9_]*`. For example, + // key0LikeThis or KEY_1_LIKE_THIS. + // * The attribute values must be of the same type (text or number). + // * The max number of values per attribute is 10. + // * For text values, the length limit is 10 UTF-8 characters. + map attributes = 3; +} diff --git a/protos/google/cloud/retail/v2alpha/product_service.proto b/protos/google/cloud/retail/v2alpha/product_service.proto index f3f22964..4d7ad5a5 100644 --- a/protos/google/cloud/retail/v2alpha/product_service.proto +++ b/protos/google/cloud/retail/v2alpha/product_service.proto @@ -216,6 +216,74 @@ service ProductService { metadata_type: "google.cloud.retail.v2alpha.RemoveFulfillmentPlacesMetadata" }; } + + // Updates local inventory information for a + // [Product][google.cloud.retail.v2alpha.Product] at a list of places, while + // respecting the last update timestamps of each inventory field. + // + // This process is asynchronous and does not require the + // [Product][google.cloud.retail.v2alpha.Product] to exist before updating + // inventory information. If the request is valid, the update will be enqueued + // and processed downstream. As a consequence, when a response is returned, + // updates are not immediately manifested in the + // [Product][google.cloud.retail.v2alpha.Product] queried by + // [GetProduct][google.cloud.retail.v2alpha.ProductService.GetProduct] or + // [ListProducts][google.cloud.retail.v2alpha.ProductService.ListProducts]. + // + // Store inventory information can only be modified using this method. + // [CreateProduct][google.cloud.retail.v2alpha.ProductService.CreateProduct] + // and + // [UpdateProduct][google.cloud.retail.v2alpha.ProductService.UpdateProduct] + // has no effect on local inventories. + // + // This feature is only available for users who have Retail Search enabled. + // Please submit a form [here](https://cloud.google.com/contact) to contact + // Cloud sales if you are interested in using Retail Search. + rpc AddLocalInventories(AddLocalInventoriesRequest) + returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v2alpha/{product=projects/*/locations/*/catalogs/*/branches/*/products/**}:addLocalInventories" + body: "*" + }; + option (google.api.method_signature) = "product"; + option (google.longrunning.operation_info) = { + response_type: "google.cloud.retail.v2alpha.AddLocalInventoriesResponse" + metadata_type: "google.cloud.retail.v2alpha.AddLocalInventoriesMetadata" + }; + } + + // Remove local inventory information for a + // [Product][google.cloud.retail.v2alpha.Product] at a list of places at a + // removal timestamp. + // + // This process is asynchronous. If the request is valid, the removal will be + // enqueued and processed downstream. As a consequence, when a response is + // returned, removals are not immediately manifested in the + // [Product][google.cloud.retail.v2alpha.Product] queried by + // [GetProduct][google.cloud.retail.v2alpha.ProductService.GetProduct] or + // [ListProducts][google.cloud.retail.v2alpha.ProductService.ListProducts]. + // + // Store inventory information can only be removed using this method. + // [CreateProduct][google.cloud.retail.v2alpha.ProductService.CreateProduct] + // and + // [UpdateProduct][google.cloud.retail.v2alpha.ProductService.UpdateProduct] + // has no effect on local inventories. + // + // This feature is only available for users who have Retail Search enabled. + // Please submit a form [here](https://cloud.google.com/contact) to contact + // Cloud sales if you are interested in using Retail Search. + rpc RemoveLocalInventories(RemoveLocalInventoriesRequest) + returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v2alpha/{product=projects/*/locations/*/catalogs/*/branches/*/products/**}:removeLocalInventories" + body: "*" + }; + option (google.api.method_signature) = "product"; + option (google.longrunning.operation_info) = { + response_type: "google.cloud.retail.v2alpha.RemoveLocalInventoriesResponse" + metadata_type: "google.cloud.retail.v2alpha.RemoveLocalInventoriesMetadata" + }; + } } // Request message for [CreateProduct][] method. @@ -597,6 +665,109 @@ message AddFulfillmentPlacesMetadata {} // method. message AddFulfillmentPlacesResponse {} +// Request message for [AddLocalInventories][] method. +message AddLocalInventoriesRequest { + // Required. Full resource name of + // [Product][google.cloud.retail.v2alpha.Product], such as + // `projects/*/locations/global/catalogs/default_catalog/branches/default_branch/products/some_product_id`. + // + // If the caller does not have permission to access the + // [Product][google.cloud.retail.v2alpha.Product], regardless of whether or + // not it exists, a PERMISSION_DENIED error is returned. + string product = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { type: "retail.googleapis.com/Product" } + ]; + + // Required. A list of inventory information at difference places. Each place + // is identified by its place ID. At most 1000 inventories are allowed per + // request. + repeated LocalInventory local_inventories = 2 + [(google.api.field_behavior) = REQUIRED]; + + // Indicates which inventory fields in the provided list of + // [LocalInventory][google.cloud.retail.v2alpha.LocalInventory] to update. The + // field is updated to the provided value. + // + // If a field is set while the place does not have a previous local inventory, + // the local inventory at that store is created. + // + // If a field is set while the value of that field is not provided, the + // original field value, if it exists, is deleted. + // + // If the mask is not set or set with empty paths, all inventory fields will + // be updated. + // + // If an unsupported or unknown field is provided, an INVALID_ARGUMENT error + // is returned and the entire update will be ignored. + google.protobuf.FieldMask add_mask = 4; + + // The time when the inventory updates are issued. Used to prevent + // out-of-order updates on local inventory fields. If not provided, the + // internal system time will be used. + google.protobuf.Timestamp add_time = 5; + + // If set to true, and the [Product][google.cloud.retail.v2alpha.Product] is + // not found, the local inventory will still be processed and retained for at + // most 1 day and processed once the + // [Product][google.cloud.retail.v2alpha.Product] is created. If set to false, + // an INVALID_ARGUMENT error is returned if the + // [Product][google.cloud.retail.v2alpha.Product] is not found. + bool allow_missing = 6; +} + +// Metadata related to the progress of the AddLocalInventories operation. +// Currently empty because there is no meaningful metadata populated from the +// [AddLocalInventories][] method. +message AddLocalInventoriesMetadata {} + +// Response of the [AddLocalInventories][] API. Currently empty because +// there is no meaningful response populated from the [AddLocalInventories][] +// method. +message AddLocalInventoriesResponse {} + +// Request message for [RemoveLocalInventories][] method. +message RemoveLocalInventoriesRequest { + // Required. Full resource name of + // [Product][google.cloud.retail.v2alpha.Product], such as + // `projects/*/locations/global/catalogs/default_catalog/branches/default_branch/products/some_product_id`. + // + // If the caller does not have permission to access the + // [Product][google.cloud.retail.v2alpha.Product], regardless of whether or + // not it exists, a PERMISSION_DENIED error is returned. + string product = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { type: "retail.googleapis.com/Product" } + ]; + + // Required. A list of place IDs to have their inventory deleted. + // At most 1000 place IDs are allowed per request. + repeated string place_ids = 2 [(google.api.field_behavior) = REQUIRED]; + + // The time when the inventory deletions are issued. Used to prevent + // out-of-order updates and deletions on local inventory fields. If not + // provided, the internal system time will be used. + google.protobuf.Timestamp remove_time = 5; + + // If set to true, and the [Product][google.cloud.retail.v2alpha.Product] is + // not found, the local inventory removal request will still be processed and + // retained for at most 1 day and processed once the + // [Product][google.cloud.retail.v2alpha.Product] is created. If set to false, + // a NOT_FOUND error is returned if the + // [Product][google.cloud.retail.v2alpha.Product] is not found. + bool allow_missing = 3; +} + +// Metadata related to the progress of the RemoveLocalInventories operation. +// Currently empty because there is no meaningful metadata populated from the +// [RemoveLocalInventories][] method. +message RemoveLocalInventoriesMetadata {} + +// Response of the [RemoveLocalInventories][] API. Currently empty because +// there is no meaningful response populated from the [RemoveLocalInventories][] +// method. +message RemoveLocalInventoriesResponse {} + // Request message for [RemoveFulfillmentPlaces][] method. message RemoveFulfillmentPlacesRequest { // Required. Full resource name of diff --git a/protos/protos.d.ts b/protos/protos.d.ts index 07e4bdad..a15bce01 100644 --- a/protos/protos.d.ts +++ b/protos/protos.d.ts @@ -10903,6 +10903,108 @@ export namespace google { public toJSON(): { [k: string]: any }; } + /** Properties of a LocalInventory. */ + interface ILocalInventory { + + /** LocalInventory placeId */ + placeId?: (string|null); + + /** LocalInventory priceInfo */ + priceInfo?: (google.cloud.retail.v2alpha.IPriceInfo|null); + + /** LocalInventory attributes */ + attributes?: ({ [k: string]: google.cloud.retail.v2alpha.ICustomAttribute }|null); + } + + /** Represents a LocalInventory. */ + class LocalInventory implements ILocalInventory { + + /** + * Constructs a new LocalInventory. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2alpha.ILocalInventory); + + /** LocalInventory placeId. */ + public placeId: string; + + /** LocalInventory priceInfo. */ + public priceInfo?: (google.cloud.retail.v2alpha.IPriceInfo|null); + + /** LocalInventory attributes. */ + public attributes: { [k: string]: google.cloud.retail.v2alpha.ICustomAttribute }; + + /** + * Creates a new LocalInventory instance using the specified properties. + * @param [properties] Properties to set + * @returns LocalInventory instance + */ + public static create(properties?: google.cloud.retail.v2alpha.ILocalInventory): google.cloud.retail.v2alpha.LocalInventory; + + /** + * Encodes the specified LocalInventory message. Does not implicitly {@link google.cloud.retail.v2alpha.LocalInventory.verify|verify} messages. + * @param message LocalInventory message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2alpha.ILocalInventory, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified LocalInventory message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.LocalInventory.verify|verify} messages. + * @param message LocalInventory message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2alpha.ILocalInventory, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a LocalInventory message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns LocalInventory + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.LocalInventory; + + /** + * Decodes a LocalInventory message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns LocalInventory + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.LocalInventory; + + /** + * Verifies a LocalInventory message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a LocalInventory message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns LocalInventory + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.LocalInventory; + + /** + * Creates a plain object from a LocalInventory message. Also converts values to other types if specified. + * @param message LocalInventory + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2alpha.LocalInventory, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this LocalInventory to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + /** Properties of a GcsSource. */ interface IGcsSource { @@ -15452,6 +15554,34 @@ export namespace google { * @returns Promise */ public removeFulfillmentPlaces(request: google.cloud.retail.v2alpha.IRemoveFulfillmentPlacesRequest): Promise; + + /** + * Calls AddLocalInventories. + * @param request AddLocalInventoriesRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Operation + */ + public addLocalInventories(request: google.cloud.retail.v2alpha.IAddLocalInventoriesRequest, callback: google.cloud.retail.v2alpha.ProductService.AddLocalInventoriesCallback): void; + + /** + * Calls AddLocalInventories. + * @param request AddLocalInventoriesRequest message or plain object + * @returns Promise + */ + public addLocalInventories(request: google.cloud.retail.v2alpha.IAddLocalInventoriesRequest): Promise; + + /** + * Calls RemoveLocalInventories. + * @param request RemoveLocalInventoriesRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Operation + */ + public removeLocalInventories(request: google.cloud.retail.v2alpha.IRemoveLocalInventoriesRequest, callback: google.cloud.retail.v2alpha.ProductService.RemoveLocalInventoriesCallback): void; + + /** + * Calls RemoveLocalInventories. + * @param request RemoveLocalInventoriesRequest message or plain object + * @returns Promise + */ + public removeLocalInventories(request: google.cloud.retail.v2alpha.IRemoveLocalInventoriesRequest): Promise; } namespace ProductService { @@ -15518,6 +15648,20 @@ export namespace google { * @param [response] Operation */ type RemoveFulfillmentPlacesCallback = (error: (Error|null), response?: google.longrunning.Operation) => void; + + /** + * Callback as used by {@link google.cloud.retail.v2alpha.ProductService#addLocalInventories}. + * @param error Error, if any + * @param [response] Operation + */ + type AddLocalInventoriesCallback = (error: (Error|null), response?: google.longrunning.Operation) => void; + + /** + * Callback as used by {@link google.cloud.retail.v2alpha.ProductService#removeLocalInventories}. + * @param error Error, if any + * @param [response] Operation + */ + type RemoveLocalInventoriesCallback = (error: (Error|null), response?: google.longrunning.Operation) => void; } /** Properties of a CreateProductRequest. */ @@ -16684,6 +16828,564 @@ export namespace google { public toJSON(): { [k: string]: any }; } + /** Properties of an AddLocalInventoriesRequest. */ + interface IAddLocalInventoriesRequest { + + /** AddLocalInventoriesRequest product */ + product?: (string|null); + + /** AddLocalInventoriesRequest localInventories */ + localInventories?: (google.cloud.retail.v2alpha.ILocalInventory[]|null); + + /** AddLocalInventoriesRequest addMask */ + addMask?: (google.protobuf.IFieldMask|null); + + /** AddLocalInventoriesRequest addTime */ + addTime?: (google.protobuf.ITimestamp|null); + + /** AddLocalInventoriesRequest allowMissing */ + allowMissing?: (boolean|null); + } + + /** Represents an AddLocalInventoriesRequest. */ + class AddLocalInventoriesRequest implements IAddLocalInventoriesRequest { + + /** + * Constructs a new AddLocalInventoriesRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2alpha.IAddLocalInventoriesRequest); + + /** AddLocalInventoriesRequest product. */ + public product: string; + + /** AddLocalInventoriesRequest localInventories. */ + public localInventories: google.cloud.retail.v2alpha.ILocalInventory[]; + + /** AddLocalInventoriesRequest addMask. */ + public addMask?: (google.protobuf.IFieldMask|null); + + /** AddLocalInventoriesRequest addTime. */ + public addTime?: (google.protobuf.ITimestamp|null); + + /** AddLocalInventoriesRequest allowMissing. */ + public allowMissing: boolean; + + /** + * Creates a new AddLocalInventoriesRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns AddLocalInventoriesRequest instance + */ + public static create(properties?: google.cloud.retail.v2alpha.IAddLocalInventoriesRequest): google.cloud.retail.v2alpha.AddLocalInventoriesRequest; + + /** + * Encodes the specified AddLocalInventoriesRequest message. Does not implicitly {@link google.cloud.retail.v2alpha.AddLocalInventoriesRequest.verify|verify} messages. + * @param message AddLocalInventoriesRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2alpha.IAddLocalInventoriesRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified AddLocalInventoriesRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.AddLocalInventoriesRequest.verify|verify} messages. + * @param message AddLocalInventoriesRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2alpha.IAddLocalInventoriesRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an AddLocalInventoriesRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns AddLocalInventoriesRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.AddLocalInventoriesRequest; + + /** + * Decodes an AddLocalInventoriesRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns AddLocalInventoriesRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.AddLocalInventoriesRequest; + + /** + * Verifies an AddLocalInventoriesRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an AddLocalInventoriesRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns AddLocalInventoriesRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.AddLocalInventoriesRequest; + + /** + * Creates a plain object from an AddLocalInventoriesRequest message. Also converts values to other types if specified. + * @param message AddLocalInventoriesRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2alpha.AddLocalInventoriesRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this AddLocalInventoriesRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of an AddLocalInventoriesMetadata. */ + interface IAddLocalInventoriesMetadata { + } + + /** Represents an AddLocalInventoriesMetadata. */ + class AddLocalInventoriesMetadata implements IAddLocalInventoriesMetadata { + + /** + * Constructs a new AddLocalInventoriesMetadata. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2alpha.IAddLocalInventoriesMetadata); + + /** + * Creates a new AddLocalInventoriesMetadata instance using the specified properties. + * @param [properties] Properties to set + * @returns AddLocalInventoriesMetadata instance + */ + public static create(properties?: google.cloud.retail.v2alpha.IAddLocalInventoriesMetadata): google.cloud.retail.v2alpha.AddLocalInventoriesMetadata; + + /** + * Encodes the specified AddLocalInventoriesMetadata message. Does not implicitly {@link google.cloud.retail.v2alpha.AddLocalInventoriesMetadata.verify|verify} messages. + * @param message AddLocalInventoriesMetadata message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2alpha.IAddLocalInventoriesMetadata, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified AddLocalInventoriesMetadata message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.AddLocalInventoriesMetadata.verify|verify} messages. + * @param message AddLocalInventoriesMetadata message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2alpha.IAddLocalInventoriesMetadata, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an AddLocalInventoriesMetadata message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns AddLocalInventoriesMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.AddLocalInventoriesMetadata; + + /** + * Decodes an AddLocalInventoriesMetadata message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns AddLocalInventoriesMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.AddLocalInventoriesMetadata; + + /** + * Verifies an AddLocalInventoriesMetadata message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an AddLocalInventoriesMetadata message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns AddLocalInventoriesMetadata + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.AddLocalInventoriesMetadata; + + /** + * Creates a plain object from an AddLocalInventoriesMetadata message. Also converts values to other types if specified. + * @param message AddLocalInventoriesMetadata + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2alpha.AddLocalInventoriesMetadata, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this AddLocalInventoriesMetadata to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of an AddLocalInventoriesResponse. */ + interface IAddLocalInventoriesResponse { + } + + /** Represents an AddLocalInventoriesResponse. */ + class AddLocalInventoriesResponse implements IAddLocalInventoriesResponse { + + /** + * Constructs a new AddLocalInventoriesResponse. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2alpha.IAddLocalInventoriesResponse); + + /** + * Creates a new AddLocalInventoriesResponse instance using the specified properties. + * @param [properties] Properties to set + * @returns AddLocalInventoriesResponse instance + */ + public static create(properties?: google.cloud.retail.v2alpha.IAddLocalInventoriesResponse): google.cloud.retail.v2alpha.AddLocalInventoriesResponse; + + /** + * Encodes the specified AddLocalInventoriesResponse message. Does not implicitly {@link google.cloud.retail.v2alpha.AddLocalInventoriesResponse.verify|verify} messages. + * @param message AddLocalInventoriesResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2alpha.IAddLocalInventoriesResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified AddLocalInventoriesResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.AddLocalInventoriesResponse.verify|verify} messages. + * @param message AddLocalInventoriesResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2alpha.IAddLocalInventoriesResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an AddLocalInventoriesResponse message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns AddLocalInventoriesResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.AddLocalInventoriesResponse; + + /** + * Decodes an AddLocalInventoriesResponse message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns AddLocalInventoriesResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.AddLocalInventoriesResponse; + + /** + * Verifies an AddLocalInventoriesResponse message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an AddLocalInventoriesResponse message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns AddLocalInventoriesResponse + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.AddLocalInventoriesResponse; + + /** + * Creates a plain object from an AddLocalInventoriesResponse message. Also converts values to other types if specified. + * @param message AddLocalInventoriesResponse + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2alpha.AddLocalInventoriesResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this AddLocalInventoriesResponse to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a RemoveLocalInventoriesRequest. */ + interface IRemoveLocalInventoriesRequest { + + /** RemoveLocalInventoriesRequest product */ + product?: (string|null); + + /** RemoveLocalInventoriesRequest placeIds */ + placeIds?: (string[]|null); + + /** RemoveLocalInventoriesRequest removeTime */ + removeTime?: (google.protobuf.ITimestamp|null); + + /** RemoveLocalInventoriesRequest allowMissing */ + allowMissing?: (boolean|null); + } + + /** Represents a RemoveLocalInventoriesRequest. */ + class RemoveLocalInventoriesRequest implements IRemoveLocalInventoriesRequest { + + /** + * Constructs a new RemoveLocalInventoriesRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2alpha.IRemoveLocalInventoriesRequest); + + /** RemoveLocalInventoriesRequest product. */ + public product: string; + + /** RemoveLocalInventoriesRequest placeIds. */ + public placeIds: string[]; + + /** RemoveLocalInventoriesRequest removeTime. */ + public removeTime?: (google.protobuf.ITimestamp|null); + + /** RemoveLocalInventoriesRequest allowMissing. */ + public allowMissing: boolean; + + /** + * Creates a new RemoveLocalInventoriesRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns RemoveLocalInventoriesRequest instance + */ + public static create(properties?: google.cloud.retail.v2alpha.IRemoveLocalInventoriesRequest): google.cloud.retail.v2alpha.RemoveLocalInventoriesRequest; + + /** + * Encodes the specified RemoveLocalInventoriesRequest message. Does not implicitly {@link google.cloud.retail.v2alpha.RemoveLocalInventoriesRequest.verify|verify} messages. + * @param message RemoveLocalInventoriesRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2alpha.IRemoveLocalInventoriesRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified RemoveLocalInventoriesRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.RemoveLocalInventoriesRequest.verify|verify} messages. + * @param message RemoveLocalInventoriesRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2alpha.IRemoveLocalInventoriesRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a RemoveLocalInventoriesRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns RemoveLocalInventoriesRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.RemoveLocalInventoriesRequest; + + /** + * Decodes a RemoveLocalInventoriesRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns RemoveLocalInventoriesRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.RemoveLocalInventoriesRequest; + + /** + * Verifies a RemoveLocalInventoriesRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a RemoveLocalInventoriesRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns RemoveLocalInventoriesRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.RemoveLocalInventoriesRequest; + + /** + * Creates a plain object from a RemoveLocalInventoriesRequest message. Also converts values to other types if specified. + * @param message RemoveLocalInventoriesRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2alpha.RemoveLocalInventoriesRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this RemoveLocalInventoriesRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a RemoveLocalInventoriesMetadata. */ + interface IRemoveLocalInventoriesMetadata { + } + + /** Represents a RemoveLocalInventoriesMetadata. */ + class RemoveLocalInventoriesMetadata implements IRemoveLocalInventoriesMetadata { + + /** + * Constructs a new RemoveLocalInventoriesMetadata. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2alpha.IRemoveLocalInventoriesMetadata); + + /** + * Creates a new RemoveLocalInventoriesMetadata instance using the specified properties. + * @param [properties] Properties to set + * @returns RemoveLocalInventoriesMetadata instance + */ + public static create(properties?: google.cloud.retail.v2alpha.IRemoveLocalInventoriesMetadata): google.cloud.retail.v2alpha.RemoveLocalInventoriesMetadata; + + /** + * Encodes the specified RemoveLocalInventoriesMetadata message. Does not implicitly {@link google.cloud.retail.v2alpha.RemoveLocalInventoriesMetadata.verify|verify} messages. + * @param message RemoveLocalInventoriesMetadata message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2alpha.IRemoveLocalInventoriesMetadata, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified RemoveLocalInventoriesMetadata message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.RemoveLocalInventoriesMetadata.verify|verify} messages. + * @param message RemoveLocalInventoriesMetadata message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2alpha.IRemoveLocalInventoriesMetadata, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a RemoveLocalInventoriesMetadata message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns RemoveLocalInventoriesMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.RemoveLocalInventoriesMetadata; + + /** + * Decodes a RemoveLocalInventoriesMetadata message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns RemoveLocalInventoriesMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.RemoveLocalInventoriesMetadata; + + /** + * Verifies a RemoveLocalInventoriesMetadata message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a RemoveLocalInventoriesMetadata message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns RemoveLocalInventoriesMetadata + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.RemoveLocalInventoriesMetadata; + + /** + * Creates a plain object from a RemoveLocalInventoriesMetadata message. Also converts values to other types if specified. + * @param message RemoveLocalInventoriesMetadata + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2alpha.RemoveLocalInventoriesMetadata, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this RemoveLocalInventoriesMetadata to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a RemoveLocalInventoriesResponse. */ + interface IRemoveLocalInventoriesResponse { + } + + /** Represents a RemoveLocalInventoriesResponse. */ + class RemoveLocalInventoriesResponse implements IRemoveLocalInventoriesResponse { + + /** + * Constructs a new RemoveLocalInventoriesResponse. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2alpha.IRemoveLocalInventoriesResponse); + + /** + * Creates a new RemoveLocalInventoriesResponse instance using the specified properties. + * @param [properties] Properties to set + * @returns RemoveLocalInventoriesResponse instance + */ + public static create(properties?: google.cloud.retail.v2alpha.IRemoveLocalInventoriesResponse): google.cloud.retail.v2alpha.RemoveLocalInventoriesResponse; + + /** + * Encodes the specified RemoveLocalInventoriesResponse message. Does not implicitly {@link google.cloud.retail.v2alpha.RemoveLocalInventoriesResponse.verify|verify} messages. + * @param message RemoveLocalInventoriesResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2alpha.IRemoveLocalInventoriesResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified RemoveLocalInventoriesResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.RemoveLocalInventoriesResponse.verify|verify} messages. + * @param message RemoveLocalInventoriesResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2alpha.IRemoveLocalInventoriesResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a RemoveLocalInventoriesResponse message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns RemoveLocalInventoriesResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.RemoveLocalInventoriesResponse; + + /** + * Decodes a RemoveLocalInventoriesResponse message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns RemoveLocalInventoriesResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.RemoveLocalInventoriesResponse; + + /** + * Verifies a RemoveLocalInventoriesResponse message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a RemoveLocalInventoriesResponse message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns RemoveLocalInventoriesResponse + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.RemoveLocalInventoriesResponse; + + /** + * Creates a plain object from a RemoveLocalInventoriesResponse message. Also converts values to other types if specified. + * @param message RemoveLocalInventoriesResponse + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2alpha.RemoveLocalInventoriesResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this RemoveLocalInventoriesResponse to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + /** Properties of a RemoveFulfillmentPlacesRequest. */ interface IRemoveFulfillmentPlacesRequest { diff --git a/protos/protos.js b/protos/protos.js index 2f6524a6..c53d1763 100644 --- a/protos/protos.js +++ b/protos/protos.js @@ -26847,6 +26847,286 @@ return Promotion; })(); + v2alpha.LocalInventory = (function() { + + /** + * Properties of a LocalInventory. + * @memberof google.cloud.retail.v2alpha + * @interface ILocalInventory + * @property {string|null} [placeId] LocalInventory placeId + * @property {google.cloud.retail.v2alpha.IPriceInfo|null} [priceInfo] LocalInventory priceInfo + * @property {Object.|null} [attributes] LocalInventory attributes + */ + + /** + * Constructs a new LocalInventory. + * @memberof google.cloud.retail.v2alpha + * @classdesc Represents a LocalInventory. + * @implements ILocalInventory + * @constructor + * @param {google.cloud.retail.v2alpha.ILocalInventory=} [properties] Properties to set + */ + function LocalInventory(properties) { + this.attributes = {}; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * LocalInventory placeId. + * @member {string} placeId + * @memberof google.cloud.retail.v2alpha.LocalInventory + * @instance + */ + LocalInventory.prototype.placeId = ""; + + /** + * LocalInventory priceInfo. + * @member {google.cloud.retail.v2alpha.IPriceInfo|null|undefined} priceInfo + * @memberof google.cloud.retail.v2alpha.LocalInventory + * @instance + */ + LocalInventory.prototype.priceInfo = null; + + /** + * LocalInventory attributes. + * @member {Object.} attributes + * @memberof google.cloud.retail.v2alpha.LocalInventory + * @instance + */ + LocalInventory.prototype.attributes = $util.emptyObject; + + /** + * Creates a new LocalInventory instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2alpha.LocalInventory + * @static + * @param {google.cloud.retail.v2alpha.ILocalInventory=} [properties] Properties to set + * @returns {google.cloud.retail.v2alpha.LocalInventory} LocalInventory instance + */ + LocalInventory.create = function create(properties) { + return new LocalInventory(properties); + }; + + /** + * Encodes the specified LocalInventory message. Does not implicitly {@link google.cloud.retail.v2alpha.LocalInventory.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2alpha.LocalInventory + * @static + * @param {google.cloud.retail.v2alpha.ILocalInventory} message LocalInventory message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + LocalInventory.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.placeId != null && Object.hasOwnProperty.call(message, "placeId")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.placeId); + if (message.priceInfo != null && Object.hasOwnProperty.call(message, "priceInfo")) + $root.google.cloud.retail.v2alpha.PriceInfo.encode(message.priceInfo, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.attributes != null && Object.hasOwnProperty.call(message, "attributes")) + for (var keys = Object.keys(message.attributes), i = 0; i < keys.length; ++i) { + writer.uint32(/* id 3, wireType 2 =*/26).fork().uint32(/* id 1, wireType 2 =*/10).string(keys[i]); + $root.google.cloud.retail.v2alpha.CustomAttribute.encode(message.attributes[keys[i]], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim().ldelim(); + } + return writer; + }; + + /** + * Encodes the specified LocalInventory message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.LocalInventory.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2alpha.LocalInventory + * @static + * @param {google.cloud.retail.v2alpha.ILocalInventory} message LocalInventory message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + LocalInventory.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a LocalInventory message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2alpha.LocalInventory + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2alpha.LocalInventory} LocalInventory + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + LocalInventory.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.LocalInventory(), key, value; + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.placeId = reader.string(); + break; + case 2: + message.priceInfo = $root.google.cloud.retail.v2alpha.PriceInfo.decode(reader, reader.uint32()); + break; + case 3: + if (message.attributes === $util.emptyObject) + message.attributes = {}; + var end2 = reader.uint32() + reader.pos; + key = ""; + value = null; + while (reader.pos < end2) { + var tag2 = reader.uint32(); + switch (tag2 >>> 3) { + case 1: + key = reader.string(); + break; + case 2: + value = $root.google.cloud.retail.v2alpha.CustomAttribute.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag2 & 7); + break; + } + } + message.attributes[key] = value; + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a LocalInventory message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2alpha.LocalInventory + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2alpha.LocalInventory} LocalInventory + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + LocalInventory.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a LocalInventory message. + * @function verify + * @memberof google.cloud.retail.v2alpha.LocalInventory + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + LocalInventory.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.placeId != null && message.hasOwnProperty("placeId")) + if (!$util.isString(message.placeId)) + return "placeId: string expected"; + if (message.priceInfo != null && message.hasOwnProperty("priceInfo")) { + var error = $root.google.cloud.retail.v2alpha.PriceInfo.verify(message.priceInfo); + if (error) + return "priceInfo." + error; + } + if (message.attributes != null && message.hasOwnProperty("attributes")) { + if (!$util.isObject(message.attributes)) + return "attributes: object expected"; + var key = Object.keys(message.attributes); + for (var i = 0; i < key.length; ++i) { + var error = $root.google.cloud.retail.v2alpha.CustomAttribute.verify(message.attributes[key[i]]); + if (error) + return "attributes." + error; + } + } + return null; + }; + + /** + * Creates a LocalInventory message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2alpha.LocalInventory + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2alpha.LocalInventory} LocalInventory + */ + LocalInventory.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2alpha.LocalInventory) + return object; + var message = new $root.google.cloud.retail.v2alpha.LocalInventory(); + if (object.placeId != null) + message.placeId = String(object.placeId); + if (object.priceInfo != null) { + if (typeof object.priceInfo !== "object") + throw TypeError(".google.cloud.retail.v2alpha.LocalInventory.priceInfo: object expected"); + message.priceInfo = $root.google.cloud.retail.v2alpha.PriceInfo.fromObject(object.priceInfo); + } + if (object.attributes) { + if (typeof object.attributes !== "object") + throw TypeError(".google.cloud.retail.v2alpha.LocalInventory.attributes: object expected"); + message.attributes = {}; + for (var keys = Object.keys(object.attributes), i = 0; i < keys.length; ++i) { + if (typeof object.attributes[keys[i]] !== "object") + throw TypeError(".google.cloud.retail.v2alpha.LocalInventory.attributes: object expected"); + message.attributes[keys[i]] = $root.google.cloud.retail.v2alpha.CustomAttribute.fromObject(object.attributes[keys[i]]); + } + } + return message; + }; + + /** + * Creates a plain object from a LocalInventory message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2alpha.LocalInventory + * @static + * @param {google.cloud.retail.v2alpha.LocalInventory} message LocalInventory + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + LocalInventory.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.objects || options.defaults) + object.attributes = {}; + if (options.defaults) { + object.placeId = ""; + object.priceInfo = null; + } + if (message.placeId != null && message.hasOwnProperty("placeId")) + object.placeId = message.placeId; + if (message.priceInfo != null && message.hasOwnProperty("priceInfo")) + object.priceInfo = $root.google.cloud.retail.v2alpha.PriceInfo.toObject(message.priceInfo, options); + var keys2; + if (message.attributes && (keys2 = Object.keys(message.attributes)).length) { + object.attributes = {}; + for (var j = 0; j < keys2.length; ++j) + object.attributes[keys2[j]] = $root.google.cloud.retail.v2alpha.CustomAttribute.toObject(message.attributes[keys2[j]], options); + } + return object; + }; + + /** + * Converts this LocalInventory to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2alpha.LocalInventory + * @instance + * @returns {Object.} JSON object + */ + LocalInventory.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return LocalInventory; + })(); + v2alpha.GcsSource = (function() { /** @@ -38605,6 +38885,72 @@ * @variation 2 */ + /** + * Callback as used by {@link google.cloud.retail.v2alpha.ProductService#addLocalInventories}. + * @memberof google.cloud.retail.v2alpha.ProductService + * @typedef AddLocalInventoriesCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.longrunning.Operation} [response] Operation + */ + + /** + * Calls AddLocalInventories. + * @function addLocalInventories + * @memberof google.cloud.retail.v2alpha.ProductService + * @instance + * @param {google.cloud.retail.v2alpha.IAddLocalInventoriesRequest} request AddLocalInventoriesRequest message or plain object + * @param {google.cloud.retail.v2alpha.ProductService.AddLocalInventoriesCallback} callback Node-style callback called with the error, if any, and Operation + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(ProductService.prototype.addLocalInventories = function addLocalInventories(request, callback) { + return this.rpcCall(addLocalInventories, $root.google.cloud.retail.v2alpha.AddLocalInventoriesRequest, $root.google.longrunning.Operation, request, callback); + }, "name", { value: "AddLocalInventories" }); + + /** + * Calls AddLocalInventories. + * @function addLocalInventories + * @memberof google.cloud.retail.v2alpha.ProductService + * @instance + * @param {google.cloud.retail.v2alpha.IAddLocalInventoriesRequest} request AddLocalInventoriesRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.retail.v2alpha.ProductService#removeLocalInventories}. + * @memberof google.cloud.retail.v2alpha.ProductService + * @typedef RemoveLocalInventoriesCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.longrunning.Operation} [response] Operation + */ + + /** + * Calls RemoveLocalInventories. + * @function removeLocalInventories + * @memberof google.cloud.retail.v2alpha.ProductService + * @instance + * @param {google.cloud.retail.v2alpha.IRemoveLocalInventoriesRequest} request RemoveLocalInventoriesRequest message or plain object + * @param {google.cloud.retail.v2alpha.ProductService.RemoveLocalInventoriesCallback} callback Node-style callback called with the error, if any, and Operation + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(ProductService.prototype.removeLocalInventories = function removeLocalInventories(request, callback) { + return this.rpcCall(removeLocalInventories, $root.google.cloud.retail.v2alpha.RemoveLocalInventoriesRequest, $root.google.longrunning.Operation, request, callback); + }, "name", { value: "RemoveLocalInventories" }); + + /** + * Calls RemoveLocalInventories. + * @function removeLocalInventories + * @memberof google.cloud.retail.v2alpha.ProductService + * @instance + * @param {google.cloud.retail.v2alpha.IRemoveLocalInventoriesRequest} request RemoveLocalInventoriesRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + return ProductService; })(); @@ -41225,6 +41571,1230 @@ return AddFulfillmentPlacesResponse; })(); + v2alpha.AddLocalInventoriesRequest = (function() { + + /** + * Properties of an AddLocalInventoriesRequest. + * @memberof google.cloud.retail.v2alpha + * @interface IAddLocalInventoriesRequest + * @property {string|null} [product] AddLocalInventoriesRequest product + * @property {Array.|null} [localInventories] AddLocalInventoriesRequest localInventories + * @property {google.protobuf.IFieldMask|null} [addMask] AddLocalInventoriesRequest addMask + * @property {google.protobuf.ITimestamp|null} [addTime] AddLocalInventoriesRequest addTime + * @property {boolean|null} [allowMissing] AddLocalInventoriesRequest allowMissing + */ + + /** + * Constructs a new AddLocalInventoriesRequest. + * @memberof google.cloud.retail.v2alpha + * @classdesc Represents an AddLocalInventoriesRequest. + * @implements IAddLocalInventoriesRequest + * @constructor + * @param {google.cloud.retail.v2alpha.IAddLocalInventoriesRequest=} [properties] Properties to set + */ + function AddLocalInventoriesRequest(properties) { + this.localInventories = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * AddLocalInventoriesRequest product. + * @member {string} product + * @memberof google.cloud.retail.v2alpha.AddLocalInventoriesRequest + * @instance + */ + AddLocalInventoriesRequest.prototype.product = ""; + + /** + * AddLocalInventoriesRequest localInventories. + * @member {Array.} localInventories + * @memberof google.cloud.retail.v2alpha.AddLocalInventoriesRequest + * @instance + */ + AddLocalInventoriesRequest.prototype.localInventories = $util.emptyArray; + + /** + * AddLocalInventoriesRequest addMask. + * @member {google.protobuf.IFieldMask|null|undefined} addMask + * @memberof google.cloud.retail.v2alpha.AddLocalInventoriesRequest + * @instance + */ + AddLocalInventoriesRequest.prototype.addMask = null; + + /** + * AddLocalInventoriesRequest addTime. + * @member {google.protobuf.ITimestamp|null|undefined} addTime + * @memberof google.cloud.retail.v2alpha.AddLocalInventoriesRequest + * @instance + */ + AddLocalInventoriesRequest.prototype.addTime = null; + + /** + * AddLocalInventoriesRequest allowMissing. + * @member {boolean} allowMissing + * @memberof google.cloud.retail.v2alpha.AddLocalInventoriesRequest + * @instance + */ + AddLocalInventoriesRequest.prototype.allowMissing = false; + + /** + * Creates a new AddLocalInventoriesRequest instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2alpha.AddLocalInventoriesRequest + * @static + * @param {google.cloud.retail.v2alpha.IAddLocalInventoriesRequest=} [properties] Properties to set + * @returns {google.cloud.retail.v2alpha.AddLocalInventoriesRequest} AddLocalInventoriesRequest instance + */ + AddLocalInventoriesRequest.create = function create(properties) { + return new AddLocalInventoriesRequest(properties); + }; + + /** + * Encodes the specified AddLocalInventoriesRequest message. Does not implicitly {@link google.cloud.retail.v2alpha.AddLocalInventoriesRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2alpha.AddLocalInventoriesRequest + * @static + * @param {google.cloud.retail.v2alpha.IAddLocalInventoriesRequest} message AddLocalInventoriesRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + AddLocalInventoriesRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.product != null && Object.hasOwnProperty.call(message, "product")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.product); + if (message.localInventories != null && message.localInventories.length) + for (var i = 0; i < message.localInventories.length; ++i) + $root.google.cloud.retail.v2alpha.LocalInventory.encode(message.localInventories[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.addMask != null && Object.hasOwnProperty.call(message, "addMask")) + $root.google.protobuf.FieldMask.encode(message.addMask, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + if (message.addTime != null && Object.hasOwnProperty.call(message, "addTime")) + $root.google.protobuf.Timestamp.encode(message.addTime, writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); + if (message.allowMissing != null && Object.hasOwnProperty.call(message, "allowMissing")) + writer.uint32(/* id 6, wireType 0 =*/48).bool(message.allowMissing); + return writer; + }; + + /** + * Encodes the specified AddLocalInventoriesRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.AddLocalInventoriesRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2alpha.AddLocalInventoriesRequest + * @static + * @param {google.cloud.retail.v2alpha.IAddLocalInventoriesRequest} message AddLocalInventoriesRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + AddLocalInventoriesRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an AddLocalInventoriesRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2alpha.AddLocalInventoriesRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2alpha.AddLocalInventoriesRequest} AddLocalInventoriesRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + AddLocalInventoriesRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.AddLocalInventoriesRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.product = reader.string(); + break; + case 2: + if (!(message.localInventories && message.localInventories.length)) + message.localInventories = []; + message.localInventories.push($root.google.cloud.retail.v2alpha.LocalInventory.decode(reader, reader.uint32())); + break; + case 4: + message.addMask = $root.google.protobuf.FieldMask.decode(reader, reader.uint32()); + break; + case 5: + message.addTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + case 6: + message.allowMissing = reader.bool(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an AddLocalInventoriesRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2alpha.AddLocalInventoriesRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2alpha.AddLocalInventoriesRequest} AddLocalInventoriesRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + AddLocalInventoriesRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an AddLocalInventoriesRequest message. + * @function verify + * @memberof google.cloud.retail.v2alpha.AddLocalInventoriesRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + AddLocalInventoriesRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.product != null && message.hasOwnProperty("product")) + if (!$util.isString(message.product)) + return "product: string expected"; + if (message.localInventories != null && message.hasOwnProperty("localInventories")) { + if (!Array.isArray(message.localInventories)) + return "localInventories: array expected"; + for (var i = 0; i < message.localInventories.length; ++i) { + var error = $root.google.cloud.retail.v2alpha.LocalInventory.verify(message.localInventories[i]); + if (error) + return "localInventories." + error; + } + } + if (message.addMask != null && message.hasOwnProperty("addMask")) { + var error = $root.google.protobuf.FieldMask.verify(message.addMask); + if (error) + return "addMask." + error; + } + if (message.addTime != null && message.hasOwnProperty("addTime")) { + var error = $root.google.protobuf.Timestamp.verify(message.addTime); + if (error) + return "addTime." + error; + } + if (message.allowMissing != null && message.hasOwnProperty("allowMissing")) + if (typeof message.allowMissing !== "boolean") + return "allowMissing: boolean expected"; + return null; + }; + + /** + * Creates an AddLocalInventoriesRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2alpha.AddLocalInventoriesRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2alpha.AddLocalInventoriesRequest} AddLocalInventoriesRequest + */ + AddLocalInventoriesRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2alpha.AddLocalInventoriesRequest) + return object; + var message = new $root.google.cloud.retail.v2alpha.AddLocalInventoriesRequest(); + if (object.product != null) + message.product = String(object.product); + if (object.localInventories) { + if (!Array.isArray(object.localInventories)) + throw TypeError(".google.cloud.retail.v2alpha.AddLocalInventoriesRequest.localInventories: array expected"); + message.localInventories = []; + for (var i = 0; i < object.localInventories.length; ++i) { + if (typeof object.localInventories[i] !== "object") + throw TypeError(".google.cloud.retail.v2alpha.AddLocalInventoriesRequest.localInventories: object expected"); + message.localInventories[i] = $root.google.cloud.retail.v2alpha.LocalInventory.fromObject(object.localInventories[i]); + } + } + if (object.addMask != null) { + if (typeof object.addMask !== "object") + throw TypeError(".google.cloud.retail.v2alpha.AddLocalInventoriesRequest.addMask: object expected"); + message.addMask = $root.google.protobuf.FieldMask.fromObject(object.addMask); + } + if (object.addTime != null) { + if (typeof object.addTime !== "object") + throw TypeError(".google.cloud.retail.v2alpha.AddLocalInventoriesRequest.addTime: object expected"); + message.addTime = $root.google.protobuf.Timestamp.fromObject(object.addTime); + } + if (object.allowMissing != null) + message.allowMissing = Boolean(object.allowMissing); + return message; + }; + + /** + * Creates a plain object from an AddLocalInventoriesRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2alpha.AddLocalInventoriesRequest + * @static + * @param {google.cloud.retail.v2alpha.AddLocalInventoriesRequest} message AddLocalInventoriesRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + AddLocalInventoriesRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.localInventories = []; + if (options.defaults) { + object.product = ""; + object.addMask = null; + object.addTime = null; + object.allowMissing = false; + } + if (message.product != null && message.hasOwnProperty("product")) + object.product = message.product; + if (message.localInventories && message.localInventories.length) { + object.localInventories = []; + for (var j = 0; j < message.localInventories.length; ++j) + object.localInventories[j] = $root.google.cloud.retail.v2alpha.LocalInventory.toObject(message.localInventories[j], options); + } + if (message.addMask != null && message.hasOwnProperty("addMask")) + object.addMask = $root.google.protobuf.FieldMask.toObject(message.addMask, options); + if (message.addTime != null && message.hasOwnProperty("addTime")) + object.addTime = $root.google.protobuf.Timestamp.toObject(message.addTime, options); + if (message.allowMissing != null && message.hasOwnProperty("allowMissing")) + object.allowMissing = message.allowMissing; + return object; + }; + + /** + * Converts this AddLocalInventoriesRequest to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2alpha.AddLocalInventoriesRequest + * @instance + * @returns {Object.} JSON object + */ + AddLocalInventoriesRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return AddLocalInventoriesRequest; + })(); + + v2alpha.AddLocalInventoriesMetadata = (function() { + + /** + * Properties of an AddLocalInventoriesMetadata. + * @memberof google.cloud.retail.v2alpha + * @interface IAddLocalInventoriesMetadata + */ + + /** + * Constructs a new AddLocalInventoriesMetadata. + * @memberof google.cloud.retail.v2alpha + * @classdesc Represents an AddLocalInventoriesMetadata. + * @implements IAddLocalInventoriesMetadata + * @constructor + * @param {google.cloud.retail.v2alpha.IAddLocalInventoriesMetadata=} [properties] Properties to set + */ + function AddLocalInventoriesMetadata(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Creates a new AddLocalInventoriesMetadata instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2alpha.AddLocalInventoriesMetadata + * @static + * @param {google.cloud.retail.v2alpha.IAddLocalInventoriesMetadata=} [properties] Properties to set + * @returns {google.cloud.retail.v2alpha.AddLocalInventoriesMetadata} AddLocalInventoriesMetadata instance + */ + AddLocalInventoriesMetadata.create = function create(properties) { + return new AddLocalInventoriesMetadata(properties); + }; + + /** + * Encodes the specified AddLocalInventoriesMetadata message. Does not implicitly {@link google.cloud.retail.v2alpha.AddLocalInventoriesMetadata.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2alpha.AddLocalInventoriesMetadata + * @static + * @param {google.cloud.retail.v2alpha.IAddLocalInventoriesMetadata} message AddLocalInventoriesMetadata message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + AddLocalInventoriesMetadata.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + return writer; + }; + + /** + * Encodes the specified AddLocalInventoriesMetadata message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.AddLocalInventoriesMetadata.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2alpha.AddLocalInventoriesMetadata + * @static + * @param {google.cloud.retail.v2alpha.IAddLocalInventoriesMetadata} message AddLocalInventoriesMetadata message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + AddLocalInventoriesMetadata.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an AddLocalInventoriesMetadata message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2alpha.AddLocalInventoriesMetadata + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2alpha.AddLocalInventoriesMetadata} AddLocalInventoriesMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + AddLocalInventoriesMetadata.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.AddLocalInventoriesMetadata(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an AddLocalInventoriesMetadata message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2alpha.AddLocalInventoriesMetadata + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2alpha.AddLocalInventoriesMetadata} AddLocalInventoriesMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + AddLocalInventoriesMetadata.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an AddLocalInventoriesMetadata message. + * @function verify + * @memberof google.cloud.retail.v2alpha.AddLocalInventoriesMetadata + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + AddLocalInventoriesMetadata.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + return null; + }; + + /** + * Creates an AddLocalInventoriesMetadata message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2alpha.AddLocalInventoriesMetadata + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2alpha.AddLocalInventoriesMetadata} AddLocalInventoriesMetadata + */ + AddLocalInventoriesMetadata.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2alpha.AddLocalInventoriesMetadata) + return object; + return new $root.google.cloud.retail.v2alpha.AddLocalInventoriesMetadata(); + }; + + /** + * Creates a plain object from an AddLocalInventoriesMetadata message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2alpha.AddLocalInventoriesMetadata + * @static + * @param {google.cloud.retail.v2alpha.AddLocalInventoriesMetadata} message AddLocalInventoriesMetadata + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + AddLocalInventoriesMetadata.toObject = function toObject() { + return {}; + }; + + /** + * Converts this AddLocalInventoriesMetadata to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2alpha.AddLocalInventoriesMetadata + * @instance + * @returns {Object.} JSON object + */ + AddLocalInventoriesMetadata.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return AddLocalInventoriesMetadata; + })(); + + v2alpha.AddLocalInventoriesResponse = (function() { + + /** + * Properties of an AddLocalInventoriesResponse. + * @memberof google.cloud.retail.v2alpha + * @interface IAddLocalInventoriesResponse + */ + + /** + * Constructs a new AddLocalInventoriesResponse. + * @memberof google.cloud.retail.v2alpha + * @classdesc Represents an AddLocalInventoriesResponse. + * @implements IAddLocalInventoriesResponse + * @constructor + * @param {google.cloud.retail.v2alpha.IAddLocalInventoriesResponse=} [properties] Properties to set + */ + function AddLocalInventoriesResponse(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Creates a new AddLocalInventoriesResponse instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2alpha.AddLocalInventoriesResponse + * @static + * @param {google.cloud.retail.v2alpha.IAddLocalInventoriesResponse=} [properties] Properties to set + * @returns {google.cloud.retail.v2alpha.AddLocalInventoriesResponse} AddLocalInventoriesResponse instance + */ + AddLocalInventoriesResponse.create = function create(properties) { + return new AddLocalInventoriesResponse(properties); + }; + + /** + * Encodes the specified AddLocalInventoriesResponse message. Does not implicitly {@link google.cloud.retail.v2alpha.AddLocalInventoriesResponse.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2alpha.AddLocalInventoriesResponse + * @static + * @param {google.cloud.retail.v2alpha.IAddLocalInventoriesResponse} message AddLocalInventoriesResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + AddLocalInventoriesResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + return writer; + }; + + /** + * Encodes the specified AddLocalInventoriesResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.AddLocalInventoriesResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2alpha.AddLocalInventoriesResponse + * @static + * @param {google.cloud.retail.v2alpha.IAddLocalInventoriesResponse} message AddLocalInventoriesResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + AddLocalInventoriesResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an AddLocalInventoriesResponse message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2alpha.AddLocalInventoriesResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2alpha.AddLocalInventoriesResponse} AddLocalInventoriesResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + AddLocalInventoriesResponse.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.AddLocalInventoriesResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an AddLocalInventoriesResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2alpha.AddLocalInventoriesResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2alpha.AddLocalInventoriesResponse} AddLocalInventoriesResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + AddLocalInventoriesResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an AddLocalInventoriesResponse message. + * @function verify + * @memberof google.cloud.retail.v2alpha.AddLocalInventoriesResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + AddLocalInventoriesResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + return null; + }; + + /** + * Creates an AddLocalInventoriesResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2alpha.AddLocalInventoriesResponse + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2alpha.AddLocalInventoriesResponse} AddLocalInventoriesResponse + */ + AddLocalInventoriesResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2alpha.AddLocalInventoriesResponse) + return object; + return new $root.google.cloud.retail.v2alpha.AddLocalInventoriesResponse(); + }; + + /** + * Creates a plain object from an AddLocalInventoriesResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2alpha.AddLocalInventoriesResponse + * @static + * @param {google.cloud.retail.v2alpha.AddLocalInventoriesResponse} message AddLocalInventoriesResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + AddLocalInventoriesResponse.toObject = function toObject() { + return {}; + }; + + /** + * Converts this AddLocalInventoriesResponse to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2alpha.AddLocalInventoriesResponse + * @instance + * @returns {Object.} JSON object + */ + AddLocalInventoriesResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return AddLocalInventoriesResponse; + })(); + + v2alpha.RemoveLocalInventoriesRequest = (function() { + + /** + * Properties of a RemoveLocalInventoriesRequest. + * @memberof google.cloud.retail.v2alpha + * @interface IRemoveLocalInventoriesRequest + * @property {string|null} [product] RemoveLocalInventoriesRequest product + * @property {Array.|null} [placeIds] RemoveLocalInventoriesRequest placeIds + * @property {google.protobuf.ITimestamp|null} [removeTime] RemoveLocalInventoriesRequest removeTime + * @property {boolean|null} [allowMissing] RemoveLocalInventoriesRequest allowMissing + */ + + /** + * Constructs a new RemoveLocalInventoriesRequest. + * @memberof google.cloud.retail.v2alpha + * @classdesc Represents a RemoveLocalInventoriesRequest. + * @implements IRemoveLocalInventoriesRequest + * @constructor + * @param {google.cloud.retail.v2alpha.IRemoveLocalInventoriesRequest=} [properties] Properties to set + */ + function RemoveLocalInventoriesRequest(properties) { + this.placeIds = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * RemoveLocalInventoriesRequest product. + * @member {string} product + * @memberof google.cloud.retail.v2alpha.RemoveLocalInventoriesRequest + * @instance + */ + RemoveLocalInventoriesRequest.prototype.product = ""; + + /** + * RemoveLocalInventoriesRequest placeIds. + * @member {Array.} placeIds + * @memberof google.cloud.retail.v2alpha.RemoveLocalInventoriesRequest + * @instance + */ + RemoveLocalInventoriesRequest.prototype.placeIds = $util.emptyArray; + + /** + * RemoveLocalInventoriesRequest removeTime. + * @member {google.protobuf.ITimestamp|null|undefined} removeTime + * @memberof google.cloud.retail.v2alpha.RemoveLocalInventoriesRequest + * @instance + */ + RemoveLocalInventoriesRequest.prototype.removeTime = null; + + /** + * RemoveLocalInventoriesRequest allowMissing. + * @member {boolean} allowMissing + * @memberof google.cloud.retail.v2alpha.RemoveLocalInventoriesRequest + * @instance + */ + RemoveLocalInventoriesRequest.prototype.allowMissing = false; + + /** + * Creates a new RemoveLocalInventoriesRequest instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2alpha.RemoveLocalInventoriesRequest + * @static + * @param {google.cloud.retail.v2alpha.IRemoveLocalInventoriesRequest=} [properties] Properties to set + * @returns {google.cloud.retail.v2alpha.RemoveLocalInventoriesRequest} RemoveLocalInventoriesRequest instance + */ + RemoveLocalInventoriesRequest.create = function create(properties) { + return new RemoveLocalInventoriesRequest(properties); + }; + + /** + * Encodes the specified RemoveLocalInventoriesRequest message. Does not implicitly {@link google.cloud.retail.v2alpha.RemoveLocalInventoriesRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2alpha.RemoveLocalInventoriesRequest + * @static + * @param {google.cloud.retail.v2alpha.IRemoveLocalInventoriesRequest} message RemoveLocalInventoriesRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + RemoveLocalInventoriesRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.product != null && Object.hasOwnProperty.call(message, "product")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.product); + if (message.placeIds != null && message.placeIds.length) + for (var i = 0; i < message.placeIds.length; ++i) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.placeIds[i]); + if (message.allowMissing != null && Object.hasOwnProperty.call(message, "allowMissing")) + writer.uint32(/* id 3, wireType 0 =*/24).bool(message.allowMissing); + if (message.removeTime != null && Object.hasOwnProperty.call(message, "removeTime")) + $root.google.protobuf.Timestamp.encode(message.removeTime, writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified RemoveLocalInventoriesRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.RemoveLocalInventoriesRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2alpha.RemoveLocalInventoriesRequest + * @static + * @param {google.cloud.retail.v2alpha.IRemoveLocalInventoriesRequest} message RemoveLocalInventoriesRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + RemoveLocalInventoriesRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a RemoveLocalInventoriesRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2alpha.RemoveLocalInventoriesRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2alpha.RemoveLocalInventoriesRequest} RemoveLocalInventoriesRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + RemoveLocalInventoriesRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.RemoveLocalInventoriesRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.product = reader.string(); + break; + case 2: + if (!(message.placeIds && message.placeIds.length)) + message.placeIds = []; + message.placeIds.push(reader.string()); + break; + case 5: + message.removeTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + case 3: + message.allowMissing = reader.bool(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a RemoveLocalInventoriesRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2alpha.RemoveLocalInventoriesRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2alpha.RemoveLocalInventoriesRequest} RemoveLocalInventoriesRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + RemoveLocalInventoriesRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a RemoveLocalInventoriesRequest message. + * @function verify + * @memberof google.cloud.retail.v2alpha.RemoveLocalInventoriesRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + RemoveLocalInventoriesRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.product != null && message.hasOwnProperty("product")) + if (!$util.isString(message.product)) + return "product: string expected"; + if (message.placeIds != null && message.hasOwnProperty("placeIds")) { + if (!Array.isArray(message.placeIds)) + return "placeIds: array expected"; + for (var i = 0; i < message.placeIds.length; ++i) + if (!$util.isString(message.placeIds[i])) + return "placeIds: string[] expected"; + } + if (message.removeTime != null && message.hasOwnProperty("removeTime")) { + var error = $root.google.protobuf.Timestamp.verify(message.removeTime); + if (error) + return "removeTime." + error; + } + if (message.allowMissing != null && message.hasOwnProperty("allowMissing")) + if (typeof message.allowMissing !== "boolean") + return "allowMissing: boolean expected"; + return null; + }; + + /** + * Creates a RemoveLocalInventoriesRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2alpha.RemoveLocalInventoriesRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2alpha.RemoveLocalInventoriesRequest} RemoveLocalInventoriesRequest + */ + RemoveLocalInventoriesRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2alpha.RemoveLocalInventoriesRequest) + return object; + var message = new $root.google.cloud.retail.v2alpha.RemoveLocalInventoriesRequest(); + if (object.product != null) + message.product = String(object.product); + if (object.placeIds) { + if (!Array.isArray(object.placeIds)) + throw TypeError(".google.cloud.retail.v2alpha.RemoveLocalInventoriesRequest.placeIds: array expected"); + message.placeIds = []; + for (var i = 0; i < object.placeIds.length; ++i) + message.placeIds[i] = String(object.placeIds[i]); + } + if (object.removeTime != null) { + if (typeof object.removeTime !== "object") + throw TypeError(".google.cloud.retail.v2alpha.RemoveLocalInventoriesRequest.removeTime: object expected"); + message.removeTime = $root.google.protobuf.Timestamp.fromObject(object.removeTime); + } + if (object.allowMissing != null) + message.allowMissing = Boolean(object.allowMissing); + return message; + }; + + /** + * Creates a plain object from a RemoveLocalInventoriesRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2alpha.RemoveLocalInventoriesRequest + * @static + * @param {google.cloud.retail.v2alpha.RemoveLocalInventoriesRequest} message RemoveLocalInventoriesRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + RemoveLocalInventoriesRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.placeIds = []; + if (options.defaults) { + object.product = ""; + object.allowMissing = false; + object.removeTime = null; + } + if (message.product != null && message.hasOwnProperty("product")) + object.product = message.product; + if (message.placeIds && message.placeIds.length) { + object.placeIds = []; + for (var j = 0; j < message.placeIds.length; ++j) + object.placeIds[j] = message.placeIds[j]; + } + if (message.allowMissing != null && message.hasOwnProperty("allowMissing")) + object.allowMissing = message.allowMissing; + if (message.removeTime != null && message.hasOwnProperty("removeTime")) + object.removeTime = $root.google.protobuf.Timestamp.toObject(message.removeTime, options); + return object; + }; + + /** + * Converts this RemoveLocalInventoriesRequest to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2alpha.RemoveLocalInventoriesRequest + * @instance + * @returns {Object.} JSON object + */ + RemoveLocalInventoriesRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return RemoveLocalInventoriesRequest; + })(); + + v2alpha.RemoveLocalInventoriesMetadata = (function() { + + /** + * Properties of a RemoveLocalInventoriesMetadata. + * @memberof google.cloud.retail.v2alpha + * @interface IRemoveLocalInventoriesMetadata + */ + + /** + * Constructs a new RemoveLocalInventoriesMetadata. + * @memberof google.cloud.retail.v2alpha + * @classdesc Represents a RemoveLocalInventoriesMetadata. + * @implements IRemoveLocalInventoriesMetadata + * @constructor + * @param {google.cloud.retail.v2alpha.IRemoveLocalInventoriesMetadata=} [properties] Properties to set + */ + function RemoveLocalInventoriesMetadata(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Creates a new RemoveLocalInventoriesMetadata instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2alpha.RemoveLocalInventoriesMetadata + * @static + * @param {google.cloud.retail.v2alpha.IRemoveLocalInventoriesMetadata=} [properties] Properties to set + * @returns {google.cloud.retail.v2alpha.RemoveLocalInventoriesMetadata} RemoveLocalInventoriesMetadata instance + */ + RemoveLocalInventoriesMetadata.create = function create(properties) { + return new RemoveLocalInventoriesMetadata(properties); + }; + + /** + * Encodes the specified RemoveLocalInventoriesMetadata message. Does not implicitly {@link google.cloud.retail.v2alpha.RemoveLocalInventoriesMetadata.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2alpha.RemoveLocalInventoriesMetadata + * @static + * @param {google.cloud.retail.v2alpha.IRemoveLocalInventoriesMetadata} message RemoveLocalInventoriesMetadata message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + RemoveLocalInventoriesMetadata.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + return writer; + }; + + /** + * Encodes the specified RemoveLocalInventoriesMetadata message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.RemoveLocalInventoriesMetadata.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2alpha.RemoveLocalInventoriesMetadata + * @static + * @param {google.cloud.retail.v2alpha.IRemoveLocalInventoriesMetadata} message RemoveLocalInventoriesMetadata message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + RemoveLocalInventoriesMetadata.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a RemoveLocalInventoriesMetadata message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2alpha.RemoveLocalInventoriesMetadata + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2alpha.RemoveLocalInventoriesMetadata} RemoveLocalInventoriesMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + RemoveLocalInventoriesMetadata.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.RemoveLocalInventoriesMetadata(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a RemoveLocalInventoriesMetadata message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2alpha.RemoveLocalInventoriesMetadata + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2alpha.RemoveLocalInventoriesMetadata} RemoveLocalInventoriesMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + RemoveLocalInventoriesMetadata.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a RemoveLocalInventoriesMetadata message. + * @function verify + * @memberof google.cloud.retail.v2alpha.RemoveLocalInventoriesMetadata + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + RemoveLocalInventoriesMetadata.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + return null; + }; + + /** + * Creates a RemoveLocalInventoriesMetadata message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2alpha.RemoveLocalInventoriesMetadata + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2alpha.RemoveLocalInventoriesMetadata} RemoveLocalInventoriesMetadata + */ + RemoveLocalInventoriesMetadata.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2alpha.RemoveLocalInventoriesMetadata) + return object; + return new $root.google.cloud.retail.v2alpha.RemoveLocalInventoriesMetadata(); + }; + + /** + * Creates a plain object from a RemoveLocalInventoriesMetadata message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2alpha.RemoveLocalInventoriesMetadata + * @static + * @param {google.cloud.retail.v2alpha.RemoveLocalInventoriesMetadata} message RemoveLocalInventoriesMetadata + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + RemoveLocalInventoriesMetadata.toObject = function toObject() { + return {}; + }; + + /** + * Converts this RemoveLocalInventoriesMetadata to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2alpha.RemoveLocalInventoriesMetadata + * @instance + * @returns {Object.} JSON object + */ + RemoveLocalInventoriesMetadata.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return RemoveLocalInventoriesMetadata; + })(); + + v2alpha.RemoveLocalInventoriesResponse = (function() { + + /** + * Properties of a RemoveLocalInventoriesResponse. + * @memberof google.cloud.retail.v2alpha + * @interface IRemoveLocalInventoriesResponse + */ + + /** + * Constructs a new RemoveLocalInventoriesResponse. + * @memberof google.cloud.retail.v2alpha + * @classdesc Represents a RemoveLocalInventoriesResponse. + * @implements IRemoveLocalInventoriesResponse + * @constructor + * @param {google.cloud.retail.v2alpha.IRemoveLocalInventoriesResponse=} [properties] Properties to set + */ + function RemoveLocalInventoriesResponse(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Creates a new RemoveLocalInventoriesResponse instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2alpha.RemoveLocalInventoriesResponse + * @static + * @param {google.cloud.retail.v2alpha.IRemoveLocalInventoriesResponse=} [properties] Properties to set + * @returns {google.cloud.retail.v2alpha.RemoveLocalInventoriesResponse} RemoveLocalInventoriesResponse instance + */ + RemoveLocalInventoriesResponse.create = function create(properties) { + return new RemoveLocalInventoriesResponse(properties); + }; + + /** + * Encodes the specified RemoveLocalInventoriesResponse message. Does not implicitly {@link google.cloud.retail.v2alpha.RemoveLocalInventoriesResponse.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2alpha.RemoveLocalInventoriesResponse + * @static + * @param {google.cloud.retail.v2alpha.IRemoveLocalInventoriesResponse} message RemoveLocalInventoriesResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + RemoveLocalInventoriesResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + return writer; + }; + + /** + * Encodes the specified RemoveLocalInventoriesResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.RemoveLocalInventoriesResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2alpha.RemoveLocalInventoriesResponse + * @static + * @param {google.cloud.retail.v2alpha.IRemoveLocalInventoriesResponse} message RemoveLocalInventoriesResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + RemoveLocalInventoriesResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a RemoveLocalInventoriesResponse message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2alpha.RemoveLocalInventoriesResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2alpha.RemoveLocalInventoriesResponse} RemoveLocalInventoriesResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + RemoveLocalInventoriesResponse.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.RemoveLocalInventoriesResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a RemoveLocalInventoriesResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2alpha.RemoveLocalInventoriesResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2alpha.RemoveLocalInventoriesResponse} RemoveLocalInventoriesResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + RemoveLocalInventoriesResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a RemoveLocalInventoriesResponse message. + * @function verify + * @memberof google.cloud.retail.v2alpha.RemoveLocalInventoriesResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + RemoveLocalInventoriesResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + return null; + }; + + /** + * Creates a RemoveLocalInventoriesResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2alpha.RemoveLocalInventoriesResponse + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2alpha.RemoveLocalInventoriesResponse} RemoveLocalInventoriesResponse + */ + RemoveLocalInventoriesResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2alpha.RemoveLocalInventoriesResponse) + return object; + return new $root.google.cloud.retail.v2alpha.RemoveLocalInventoriesResponse(); + }; + + /** + * Creates a plain object from a RemoveLocalInventoriesResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2alpha.RemoveLocalInventoriesResponse + * @static + * @param {google.cloud.retail.v2alpha.RemoveLocalInventoriesResponse} message RemoveLocalInventoriesResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + RemoveLocalInventoriesResponse.toObject = function toObject() { + return {}; + }; + + /** + * Converts this RemoveLocalInventoriesResponse to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2alpha.RemoveLocalInventoriesResponse + * @instance + * @returns {Object.} JSON object + */ + RemoveLocalInventoriesResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return RemoveLocalInventoriesResponse; + })(); + v2alpha.RemoveFulfillmentPlacesRequest = (function() { /** diff --git a/protos/protos.json b/protos/protos.json index b9fd9503..0e3d2cf1 100644 --- a/protos/protos.json +++ b/protos/protos.json @@ -2743,6 +2743,23 @@ } } }, + "LocalInventory": { + "fields": { + "placeId": { + "type": "string", + "id": 1 + }, + "priceInfo": { + "type": "PriceInfo", + "id": 2 + }, + "attributes": { + "keyType": "string", + "type": "CustomAttribute", + "id": 3 + } + } + }, "GcsSource": { "fields": { "inputUris": { @@ -4118,6 +4135,62 @@ } } ] + }, + "AddLocalInventories": { + "requestType": "AddLocalInventoriesRequest", + "responseType": "google.longrunning.Operation", + "options": { + "(google.api.http).post": "/v2alpha/{product=projects/*/locations/*/catalogs/*/branches/*/products/**}:addLocalInventories", + "(google.api.http).body": "*", + "(google.api.method_signature)": "product", + "(google.longrunning.operation_info).response_type": "google.cloud.retail.v2alpha.AddLocalInventoriesResponse", + "(google.longrunning.operation_info).metadata_type": "google.cloud.retail.v2alpha.AddLocalInventoriesMetadata" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v2alpha/{product=projects/*/locations/*/catalogs/*/branches/*/products/**}:addLocalInventories", + "body": "*" + } + }, + { + "(google.api.method_signature)": "product" + }, + { + "(google.longrunning.operation_info)": { + "response_type": "google.cloud.retail.v2alpha.AddLocalInventoriesResponse", + "metadata_type": "google.cloud.retail.v2alpha.AddLocalInventoriesMetadata" + } + } + ] + }, + "RemoveLocalInventories": { + "requestType": "RemoveLocalInventoriesRequest", + "responseType": "google.longrunning.Operation", + "options": { + "(google.api.http).post": "/v2alpha/{product=projects/*/locations/*/catalogs/*/branches/*/products/**}:removeLocalInventories", + "(google.api.http).body": "*", + "(google.api.method_signature)": "product", + "(google.longrunning.operation_info).response_type": "google.cloud.retail.v2alpha.RemoveLocalInventoriesResponse", + "(google.longrunning.operation_info).metadata_type": "google.cloud.retail.v2alpha.RemoveLocalInventoriesMetadata" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v2alpha/{product=projects/*/locations/*/catalogs/*/branches/*/products/**}:removeLocalInventories", + "body": "*" + } + }, + { + "(google.api.method_signature)": "product" + }, + { + "(google.longrunning.operation_info)": { + "response_type": "google.cloud.retail.v2alpha.RemoveLocalInventoriesResponse", + "metadata_type": "google.cloud.retail.v2alpha.RemoveLocalInventoriesMetadata" + } + } + ] } } }, @@ -4309,6 +4382,78 @@ "AddFulfillmentPlacesResponse": { "fields": {} }, + "AddLocalInventoriesRequest": { + "fields": { + "product": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "retail.googleapis.com/Product" + } + }, + "localInventories": { + "rule": "repeated", + "type": "LocalInventory", + "id": 2, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "addMask": { + "type": "google.protobuf.FieldMask", + "id": 4 + }, + "addTime": { + "type": "google.protobuf.Timestamp", + "id": 5 + }, + "allowMissing": { + "type": "bool", + "id": 6 + } + } + }, + "AddLocalInventoriesMetadata": { + "fields": {} + }, + "AddLocalInventoriesResponse": { + "fields": {} + }, + "RemoveLocalInventoriesRequest": { + "fields": { + "product": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "retail.googleapis.com/Product" + } + }, + "placeIds": { + "rule": "repeated", + "type": "string", + "id": 2, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "removeTime": { + "type": "google.protobuf.Timestamp", + "id": 5 + }, + "allowMissing": { + "type": "bool", + "id": 3 + } + } + }, + "RemoveLocalInventoriesMetadata": { + "fields": {} + }, + "RemoveLocalInventoriesResponse": { + "fields": {} + }, "RemoveFulfillmentPlacesRequest": { "fields": { "product": { diff --git a/samples/generated/v2alpha/product_service.add_local_inventories.js b/samples/generated/v2alpha/product_service.add_local_inventories.js new file mode 100644 index 00000000..efb10e41 --- /dev/null +++ b/samples/generated/v2alpha/product_service.add_local_inventories.js @@ -0,0 +1,94 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +'use strict'; + +function main(product, localInventories) { + // [START retail_v2alpha_generated_ProductService_AddLocalInventories_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. Full resource name of + * [Product][google.cloud.retail.v2alpha.Product], such as + * `projects/* /locations/global/catalogs/default_catalog/branches/default_branch/products/some_product_id`. + * If the caller does not have permission to access the + * [Product][google.cloud.retail.v2alpha.Product], regardless of whether or + * not it exists, a PERMISSION_DENIED error is returned. + */ + // const product = 'abc123' + /** + * Required. A list of inventory information at difference places. Each place + * is identified by its place ID. At most 1000 inventories are allowed per + * request. + */ + // const localInventories = 1234 + /** + * Indicates which inventory fields in the provided list of + * [LocalInventory][google.cloud.retail.v2alpha.LocalInventory] to update. The + * field is updated to the provided value. + * If a field is set while the place does not have a previous local inventory, + * the local inventory at that store is created. + * If a field is set while the value of that field is not provided, the + * original field value, if it exists, is deleted. + * If the mask is not set or set with empty paths, all inventory fields will + * be updated. + * If an unsupported or unknown field is provided, an INVALID_ARGUMENT error + * is returned and the entire update will be ignored. + */ + // const addMask = '' + /** + * The time when the inventory updates are issued. Used to prevent + * out-of-order updates on local inventory fields. If not provided, the + * internal system time will be used. + */ + // const addTime = '' + /** + * If set to true, and the [Product][google.cloud.retail.v2alpha.Product] is + * not found, the local inventory will still be processed and retained for at + * most 1 day and processed once the + * [Product][google.cloud.retail.v2alpha.Product] is created. If set to false, + * an INVALID_ARGUMENT error is returned if the + * [Product][google.cloud.retail.v2alpha.Product] is not found. + */ + // const allowMissing = true + + // Imports the Retail library + const {ProductServiceClient} = require('@google-cloud/retail').v2alpha; + + // Instantiates a client + const retailClient = new ProductServiceClient(); + + async function addLocalInventories() { + // Construct request + const request = { + product, + localInventories, + }; + + // Run request + const [operation] = await retailClient.addLocalInventories(request); + const [response] = await operation.promise(); + console.log(response); + } + + addLocalInventories(); + // [END retail_v2alpha_generated_ProductService_AddLocalInventories_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/samples/generated/v2alpha/product_service.remove_local_inventories.js b/samples/generated/v2alpha/product_service.remove_local_inventories.js new file mode 100644 index 00000000..e3d7d059 --- /dev/null +++ b/samples/generated/v2alpha/product_service.remove_local_inventories.js @@ -0,0 +1,79 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +'use strict'; + +function main(product, placeIds) { + // [START retail_v2alpha_generated_ProductService_RemoveLocalInventories_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. Full resource name of + * [Product][google.cloud.retail.v2alpha.Product], such as + * `projects/* /locations/global/catalogs/default_catalog/branches/default_branch/products/some_product_id`. + * If the caller does not have permission to access the + * [Product][google.cloud.retail.v2alpha.Product], regardless of whether or + * not it exists, a PERMISSION_DENIED error is returned. + */ + // const product = 'abc123' + /** + * Required. A list of place IDs to have their inventory deleted. + * At most 1000 place IDs are allowed per request. + */ + // const placeIds = 'abc123' + /** + * The time when the inventory deletions are issued. Used to prevent + * out-of-order updates and deletions on local inventory fields. If not + * provided, the internal system time will be used. + */ + // const removeTime = '' + /** + * If set to true, and the [Product][google.cloud.retail.v2alpha.Product] is + * not found, the local inventory removal request will still be processed and + * retained for at most 1 day and processed once the + * [Product][google.cloud.retail.v2alpha.Product] is created. If set to false, + * a NOT_FOUND error is returned if the + * [Product][google.cloud.retail.v2alpha.Product] is not found. + */ + // const allowMissing = true + + // Imports the Retail library + const {ProductServiceClient} = require('@google-cloud/retail').v2alpha; + + // Instantiates a client + const retailClient = new ProductServiceClient(); + + async function removeLocalInventories() { + // Construct request + const request = { + product, + placeIds, + }; + + // Run request + const [operation] = await retailClient.removeLocalInventories(request); + const [response] = await operation.promise(); + console.log(response); + } + + removeLocalInventories(); + // [END retail_v2alpha_generated_ProductService_RemoveLocalInventories_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/src/v2alpha/gapic_metadata.json b/src/v2alpha/gapic_metadata.json index 5c5b0b48..194f361b 100644 --- a/src/v2alpha/gapic_metadata.json +++ b/src/v2alpha/gapic_metadata.json @@ -166,6 +166,16 @@ "removeFulfillmentPlaces" ] }, + "AddLocalInventories": { + "methods": [ + "addLocalInventories" + ] + }, + "RemoveLocalInventories": { + "methods": [ + "removeLocalInventories" + ] + }, "ListProducts": { "methods": [ "listProducts", @@ -218,6 +228,16 @@ "removeFulfillmentPlaces" ] }, + "AddLocalInventories": { + "methods": [ + "addLocalInventories" + ] + }, + "RemoveLocalInventories": { + "methods": [ + "removeLocalInventories" + ] + }, "ListProducts": { "methods": [ "listProducts", diff --git a/src/v2alpha/product_service_client.ts b/src/v2alpha/product_service_client.ts index 51897149..f9dca659 100644 --- a/src/v2alpha/product_service_client.ts +++ b/src/v2alpha/product_service_client.ts @@ -225,6 +225,18 @@ export class ProductServiceClient { const removeFulfillmentPlacesMetadata = protoFilesRoot.lookup( '.google.cloud.retail.v2alpha.RemoveFulfillmentPlacesMetadata' ) as gax.protobuf.Type; + const addLocalInventoriesResponse = protoFilesRoot.lookup( + '.google.cloud.retail.v2alpha.AddLocalInventoriesResponse' + ) as gax.protobuf.Type; + const addLocalInventoriesMetadata = protoFilesRoot.lookup( + '.google.cloud.retail.v2alpha.AddLocalInventoriesMetadata' + ) as gax.protobuf.Type; + const removeLocalInventoriesResponse = protoFilesRoot.lookup( + '.google.cloud.retail.v2alpha.RemoveLocalInventoriesResponse' + ) as gax.protobuf.Type; + const removeLocalInventoriesMetadata = protoFilesRoot.lookup( + '.google.cloud.retail.v2alpha.RemoveLocalInventoriesMetadata' + ) as gax.protobuf.Type; this.descriptors.longrunning = { importProducts: new this._gaxModule.LongrunningDescriptor( @@ -251,6 +263,20 @@ export class ProductServiceClient { removeFulfillmentPlacesMetadata ) ), + addLocalInventories: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + addLocalInventoriesResponse.decode.bind(addLocalInventoriesResponse), + addLocalInventoriesMetadata.decode.bind(addLocalInventoriesMetadata) + ), + removeLocalInventories: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + removeLocalInventoriesResponse.decode.bind( + removeLocalInventoriesResponse + ), + removeLocalInventoriesMetadata.decode.bind( + removeLocalInventoriesMetadata + ) + ), }; // Put together the default options sent with requests. @@ -312,6 +338,8 @@ export class ProductServiceClient { 'setInventory', 'addFulfillmentPlaces', 'removeFulfillmentPlaces', + 'addLocalInventories', + 'removeLocalInventories', ]; for (const methodName of productServiceStubMethods) { const callPromise = this.productServiceStub.then( @@ -1657,6 +1685,389 @@ export class ProductServiceClient { protos.google.cloud.retail.v2alpha.RemoveFulfillmentPlacesMetadata >; } + addLocalInventories( + request?: protos.google.cloud.retail.v2alpha.IAddLocalInventoriesRequest, + options?: CallOptions + ): Promise< + [ + LROperation< + protos.google.cloud.retail.v2alpha.IAddLocalInventoriesResponse, + protos.google.cloud.retail.v2alpha.IAddLocalInventoriesMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined + ] + >; + addLocalInventories( + request: protos.google.cloud.retail.v2alpha.IAddLocalInventoriesRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.cloud.retail.v2alpha.IAddLocalInventoriesResponse, + protos.google.cloud.retail.v2alpha.IAddLocalInventoriesMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): void; + addLocalInventories( + request: protos.google.cloud.retail.v2alpha.IAddLocalInventoriesRequest, + callback: Callback< + LROperation< + protos.google.cloud.retail.v2alpha.IAddLocalInventoriesResponse, + protos.google.cloud.retail.v2alpha.IAddLocalInventoriesMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): void; + /** + * Updates local inventory information for a + * {@link google.cloud.retail.v2alpha.Product|Product} at a list of places, while + * respecting the last update timestamps of each inventory field. + * + * This process is asynchronous and does not require the + * {@link google.cloud.retail.v2alpha.Product|Product} to exist before updating + * inventory information. If the request is valid, the update will be enqueued + * and processed downstream. As a consequence, when a response is returned, + * updates are not immediately manifested in the + * {@link google.cloud.retail.v2alpha.Product|Product} queried by + * {@link google.cloud.retail.v2alpha.ProductService.GetProduct|GetProduct} or + * {@link google.cloud.retail.v2alpha.ProductService.ListProducts|ListProducts}. + * + * Store inventory information can only be modified using this method. + * {@link google.cloud.retail.v2alpha.ProductService.CreateProduct|CreateProduct} + * and + * {@link google.cloud.retail.v2alpha.ProductService.UpdateProduct|UpdateProduct} + * has no effect on local inventories. + * + * This feature is only available for users who have Retail Search enabled. + * Please submit a form [here](https://cloud.google.com/contact) to contact + * Cloud sales if you are interested in using Retail Search. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.product + * Required. Full resource name of + * {@link google.cloud.retail.v2alpha.Product|Product}, such as + * `projects/* /locations/global/catalogs/default_catalog/branches/default_branch/products/some_product_id`. + * + * If the caller does not have permission to access the + * {@link google.cloud.retail.v2alpha.Product|Product}, regardless of whether or + * not it exists, a PERMISSION_DENIED error is returned. + * @param {number[]} request.localInventories + * Required. A list of inventory information at difference places. Each place + * is identified by its place ID. At most 1000 inventories are allowed per + * request. + * @param {google.protobuf.FieldMask} request.addMask + * Indicates which inventory fields in the provided list of + * {@link google.cloud.retail.v2alpha.LocalInventory|LocalInventory} to update. The + * field is updated to the provided value. + * + * If a field is set while the place does not have a previous local inventory, + * the local inventory at that store is created. + * + * If a field is set while the value of that field is not provided, the + * original field value, if it exists, is deleted. + * + * If the mask is not set or set with empty paths, all inventory fields will + * be updated. + * + * If an unsupported or unknown field is provided, an INVALID_ARGUMENT error + * is returned and the entire update will be ignored. + * @param {google.protobuf.Timestamp} request.addTime + * The time when the inventory updates are issued. Used to prevent + * out-of-order updates on local inventory fields. If not provided, the + * internal system time will be used. + * @param {boolean} request.allowMissing + * If set to true, and the {@link google.cloud.retail.v2alpha.Product|Product} is + * not found, the local inventory will still be processed and retained for at + * most 1 day and processed once the + * {@link google.cloud.retail.v2alpha.Product|Product} is created. If set to false, + * an INVALID_ARGUMENT error is returned if the + * {@link google.cloud.retail.v2alpha.Product|Product} is not found. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example + * const [operation] = await client.addLocalInventories(request); + * const [response] = await operation.promise(); + */ + addLocalInventories( + request?: protos.google.cloud.retail.v2alpha.IAddLocalInventoriesRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.cloud.retail.v2alpha.IAddLocalInventoriesResponse, + protos.google.cloud.retail.v2alpha.IAddLocalInventoriesMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.cloud.retail.v2alpha.IAddLocalInventoriesResponse, + protos.google.cloud.retail.v2alpha.IAddLocalInventoriesMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): Promise< + [ + LROperation< + protos.google.cloud.retail.v2alpha.IAddLocalInventoriesResponse, + protos.google.cloud.retail.v2alpha.IAddLocalInventoriesMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + gax.routingHeader.fromParams({ + product: request.product || '', + }); + this.initialize(); + return this.innerApiCalls.addLocalInventories(request, options, callback); + } + /** + * Check the status of the long running operation returned by `addLocalInventories()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example + * const decodedOperation = await checkAddLocalInventoriesProgress(name); + * console.log(decodedOperation.result); + * console.log(decodedOperation.done); + * console.log(decodedOperation.metadata); + */ + async checkAddLocalInventoriesProgress( + name: string + ): Promise< + LROperation< + protos.google.cloud.retail.v2alpha.AddLocalInventoriesResponse, + protos.google.cloud.retail.v2alpha.AddLocalInventoriesMetadata + > + > { + const request = new operationsProtos.google.longrunning.GetOperationRequest( + {name} + ); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new gax.Operation( + operation, + this.descriptors.longrunning.addLocalInventories, + gax.createDefaultBackoffSettings() + ); + return decodeOperation as LROperation< + protos.google.cloud.retail.v2alpha.AddLocalInventoriesResponse, + protos.google.cloud.retail.v2alpha.AddLocalInventoriesMetadata + >; + } + removeLocalInventories( + request?: protos.google.cloud.retail.v2alpha.IRemoveLocalInventoriesRequest, + options?: CallOptions + ): Promise< + [ + LROperation< + protos.google.cloud.retail.v2alpha.IRemoveLocalInventoriesResponse, + protos.google.cloud.retail.v2alpha.IRemoveLocalInventoriesMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined + ] + >; + removeLocalInventories( + request: protos.google.cloud.retail.v2alpha.IRemoveLocalInventoriesRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.cloud.retail.v2alpha.IRemoveLocalInventoriesResponse, + protos.google.cloud.retail.v2alpha.IRemoveLocalInventoriesMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): void; + removeLocalInventories( + request: protos.google.cloud.retail.v2alpha.IRemoveLocalInventoriesRequest, + callback: Callback< + LROperation< + protos.google.cloud.retail.v2alpha.IRemoveLocalInventoriesResponse, + protos.google.cloud.retail.v2alpha.IRemoveLocalInventoriesMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): void; + /** + * Remove local inventory information for a + * {@link google.cloud.retail.v2alpha.Product|Product} at a list of places at a + * removal timestamp. + * + * This process is asynchronous. If the request is valid, the removal will be + * enqueued and processed downstream. As a consequence, when a response is + * returned, removals are not immediately manifested in the + * {@link google.cloud.retail.v2alpha.Product|Product} queried by + * {@link google.cloud.retail.v2alpha.ProductService.GetProduct|GetProduct} or + * {@link google.cloud.retail.v2alpha.ProductService.ListProducts|ListProducts}. + * + * Store inventory information can only be removed using this method. + * {@link google.cloud.retail.v2alpha.ProductService.CreateProduct|CreateProduct} + * and + * {@link google.cloud.retail.v2alpha.ProductService.UpdateProduct|UpdateProduct} + * has no effect on local inventories. + * + * This feature is only available for users who have Retail Search enabled. + * Please submit a form [here](https://cloud.google.com/contact) to contact + * Cloud sales if you are interested in using Retail Search. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.product + * Required. Full resource name of + * {@link google.cloud.retail.v2alpha.Product|Product}, such as + * `projects/* /locations/global/catalogs/default_catalog/branches/default_branch/products/some_product_id`. + * + * If the caller does not have permission to access the + * {@link google.cloud.retail.v2alpha.Product|Product}, regardless of whether or + * not it exists, a PERMISSION_DENIED error is returned. + * @param {string[]} request.placeIds + * Required. A list of place IDs to have their inventory deleted. + * At most 1000 place IDs are allowed per request. + * @param {google.protobuf.Timestamp} request.removeTime + * The time when the inventory deletions are issued. Used to prevent + * out-of-order updates and deletions on local inventory fields. If not + * provided, the internal system time will be used. + * @param {boolean} request.allowMissing + * If set to true, and the {@link google.cloud.retail.v2alpha.Product|Product} is + * not found, the local inventory removal request will still be processed and + * retained for at most 1 day and processed once the + * {@link google.cloud.retail.v2alpha.Product|Product} is created. If set to false, + * a NOT_FOUND error is returned if the + * {@link google.cloud.retail.v2alpha.Product|Product} is not found. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example + * const [operation] = await client.removeLocalInventories(request); + * const [response] = await operation.promise(); + */ + removeLocalInventories( + request?: protos.google.cloud.retail.v2alpha.IRemoveLocalInventoriesRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.cloud.retail.v2alpha.IRemoveLocalInventoriesResponse, + protos.google.cloud.retail.v2alpha.IRemoveLocalInventoriesMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.cloud.retail.v2alpha.IRemoveLocalInventoriesResponse, + protos.google.cloud.retail.v2alpha.IRemoveLocalInventoriesMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): Promise< + [ + LROperation< + protos.google.cloud.retail.v2alpha.IRemoveLocalInventoriesResponse, + protos.google.cloud.retail.v2alpha.IRemoveLocalInventoriesMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + gax.routingHeader.fromParams({ + product: request.product || '', + }); + this.initialize(); + return this.innerApiCalls.removeLocalInventories( + request, + options, + callback + ); + } + /** + * Check the status of the long running operation returned by `removeLocalInventories()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example + * const decodedOperation = await checkRemoveLocalInventoriesProgress(name); + * console.log(decodedOperation.result); + * console.log(decodedOperation.done); + * console.log(decodedOperation.metadata); + */ + async checkRemoveLocalInventoriesProgress( + name: string + ): Promise< + LROperation< + protos.google.cloud.retail.v2alpha.RemoveLocalInventoriesResponse, + protos.google.cloud.retail.v2alpha.RemoveLocalInventoriesMetadata + > + > { + const request = new operationsProtos.google.longrunning.GetOperationRequest( + {name} + ); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new gax.Operation( + operation, + this.descriptors.longrunning.removeLocalInventories, + gax.createDefaultBackoffSettings() + ); + return decodeOperation as LROperation< + protos.google.cloud.retail.v2alpha.RemoveLocalInventoriesResponse, + protos.google.cloud.retail.v2alpha.RemoveLocalInventoriesMetadata + >; + } listProducts( request?: protos.google.cloud.retail.v2alpha.IListProductsRequest, options?: CallOptions diff --git a/src/v2alpha/product_service_client_config.json b/src/v2alpha/product_service_client_config.json index 541657ac..60238d93 100644 --- a/src/v2alpha/product_service_client_config.json +++ b/src/v2alpha/product_service_client_config.json @@ -82,6 +82,16 @@ "timeout_millis": 30000, "retry_codes_name": "idempotent", "retry_params_name": "71ca22c74d2828b200f9ff1cc285a8beb96cc2af" + }, + "AddLocalInventories": { + "timeout_millis": 30000, + "retry_codes_name": "idempotent", + "retry_params_name": "71ca22c74d2828b200f9ff1cc285a8beb96cc2af" + }, + "RemoveLocalInventories": { + "timeout_millis": 30000, + "retry_codes_name": "idempotent", + "retry_params_name": "71ca22c74d2828b200f9ff1cc285a8beb96cc2af" } } } diff --git a/test/gapic_product_service_v2alpha.ts b/test/gapic_product_service_v2alpha.ts index ea5b795e..d4a3fe2f 100644 --- a/test/gapic_product_service_v2alpha.ts +++ b/test/gapic_product_service_v2alpha.ts @@ -1454,6 +1454,397 @@ describe('v2alpha.ProductServiceClient', () => { }); }); + describe('addLocalInventories', () => { + it('invokes addLocalInventories without error', async () => { + const client = new productserviceModule.v2alpha.ProductServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2alpha.AddLocalInventoriesRequest() + ); + request.product = ''; + const expectedHeaderRequestParams = 'product='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.addLocalInventories = + stubLongRunningCall(expectedResponse); + const [operation] = await client.addLocalInventories(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.addLocalInventories as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes addLocalInventories without error using callback', async () => { + const client = new productserviceModule.v2alpha.ProductServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2alpha.AddLocalInventoriesRequest() + ); + request.product = ''; + const expectedHeaderRequestParams = 'product='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.addLocalInventories = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.addLocalInventories( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.cloud.retail.v2alpha.IAddLocalInventoriesResponse, + protos.google.cloud.retail.v2alpha.IAddLocalInventoriesMetadata + > | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const operation = (await promise) as LROperation< + protos.google.cloud.retail.v2alpha.IAddLocalInventoriesResponse, + protos.google.cloud.retail.v2alpha.IAddLocalInventoriesMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.addLocalInventories as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions /*, callback defined above */) + ); + }); + + it('invokes addLocalInventories with call error', async () => { + const client = new productserviceModule.v2alpha.ProductServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2alpha.AddLocalInventoriesRequest() + ); + request.product = ''; + const expectedHeaderRequestParams = 'product='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.addLocalInventories = stubLongRunningCall( + undefined, + expectedError + ); + await assert.rejects(client.addLocalInventories(request), expectedError); + assert( + (client.innerApiCalls.addLocalInventories as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes addLocalInventories with LRO error', async () => { + const client = new productserviceModule.v2alpha.ProductServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2alpha.AddLocalInventoriesRequest() + ); + request.product = ''; + const expectedHeaderRequestParams = 'product='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.addLocalInventories = stubLongRunningCall( + undefined, + undefined, + expectedError + ); + const [operation] = await client.addLocalInventories(request); + await assert.rejects(operation.promise(), expectedError); + assert( + (client.innerApiCalls.addLocalInventories as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes checkAddLocalInventoriesProgress without error', async () => { + const client = new productserviceModule.v2alpha.ProductServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')}; + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkAddLocalInventoriesProgress( + expectedResponse.name + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkAddLocalInventoriesProgress with error', async () => { + const client = new productserviceModule.v2alpha.ProductServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects( + client.checkAddLocalInventoriesProgress(''), + expectedError + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('removeLocalInventories', () => { + it('invokes removeLocalInventories without error', async () => { + const client = new productserviceModule.v2alpha.ProductServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2alpha.RemoveLocalInventoriesRequest() + ); + request.product = ''; + const expectedHeaderRequestParams = 'product='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.removeLocalInventories = + stubLongRunningCall(expectedResponse); + const [operation] = await client.removeLocalInventories(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.removeLocalInventories as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes removeLocalInventories without error using callback', async () => { + const client = new productserviceModule.v2alpha.ProductServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2alpha.RemoveLocalInventoriesRequest() + ); + request.product = ''; + const expectedHeaderRequestParams = 'product='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.removeLocalInventories = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.removeLocalInventories( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.cloud.retail.v2alpha.IRemoveLocalInventoriesResponse, + protos.google.cloud.retail.v2alpha.IRemoveLocalInventoriesMetadata + > | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const operation = (await promise) as LROperation< + protos.google.cloud.retail.v2alpha.IRemoveLocalInventoriesResponse, + protos.google.cloud.retail.v2alpha.IRemoveLocalInventoriesMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.removeLocalInventories as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions /*, callback defined above */) + ); + }); + + it('invokes removeLocalInventories with call error', async () => { + const client = new productserviceModule.v2alpha.ProductServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2alpha.RemoveLocalInventoriesRequest() + ); + request.product = ''; + const expectedHeaderRequestParams = 'product='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.removeLocalInventories = stubLongRunningCall( + undefined, + expectedError + ); + await assert.rejects( + client.removeLocalInventories(request), + expectedError + ); + assert( + (client.innerApiCalls.removeLocalInventories as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes removeLocalInventories with LRO error', async () => { + const client = new productserviceModule.v2alpha.ProductServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2alpha.RemoveLocalInventoriesRequest() + ); + request.product = ''; + const expectedHeaderRequestParams = 'product='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.removeLocalInventories = stubLongRunningCall( + undefined, + undefined, + expectedError + ); + const [operation] = await client.removeLocalInventories(request); + await assert.rejects(operation.promise(), expectedError); + assert( + (client.innerApiCalls.removeLocalInventories as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes checkRemoveLocalInventoriesProgress without error', async () => { + const client = new productserviceModule.v2alpha.ProductServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')}; + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkRemoveLocalInventoriesProgress( + expectedResponse.name + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkRemoveLocalInventoriesProgress with error', async () => { + const client = new productserviceModule.v2alpha.ProductServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects( + client.checkRemoveLocalInventoriesProgress(''), + expectedError + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + describe('listProducts', () => { it('invokes listProducts without error', async () => { const client = new productserviceModule.v2alpha.ProductServiceClient({