Skip to content

Commit cd00c36

Browse files
feat: Add local inventory ingestion APIs to product service in alpha channel (#112)
* feat: Add local inventory ingestion APIs to product service in alpha channel PiperOrigin-RevId: 406273138 Source-Link: googleapis/googleapis@148d29d Source-Link: googleapis/googleapis-gen@9e96961 Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiOWU5Njk2MTgzYTNmMmQwNWJjZjZjYTExODA2MGUxMjU2MmY5MGY1NSJ9 * 🦉 Updates from OwlBot See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
1 parent a7885f5 commit cd00c36

11 files changed

Lines changed: 3619 additions & 0 deletions

File tree

packages/google-cloud-retail/protos/google/cloud/retail/v2alpha/common.proto

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -432,3 +432,29 @@ message Promotion {
432432
// [promotion](https://support.google.com/merchants/answer/7050148).
433433
string promotion_id = 1;
434434
}
435+
436+
// The inventory information at a place (e.g. a store) identified
437+
// by a place ID.
438+
message LocalInventory {
439+
// The place ID for the current set of inventory information.
440+
string place_id = 1;
441+
442+
// Product price and cost information.
443+
//
444+
// Google Merchant Center property
445+
// [price](https://support.google.com/merchants/answer/6324371).
446+
PriceInfo price_info = 2;
447+
448+
// Additional local inventory attributes, for example, store name, promotion
449+
// tags, etc.
450+
// * At most 5 values are allowed. Otherwise, an INVALID_ARGUMENT error is
451+
// returned.
452+
// * The key must be a UTF-8 encoded string with a length limit of 10
453+
// characters.
454+
// * The key must match the pattern: `[a-zA-Z0-9][a-zA-Z0-9_]*`. For example,
455+
// key0LikeThis or KEY_1_LIKE_THIS.
456+
// * The attribute values must be of the same type (text or number).
457+
// * The max number of values per attribute is 10.
458+
// * For text values, the length limit is 10 UTF-8 characters.
459+
map<string, CustomAttribute> attributes = 3;
460+
}

packages/google-cloud-retail/protos/google/cloud/retail/v2alpha/product_service.proto

Lines changed: 171 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -216,6 +216,74 @@ service ProductService {
216216
metadata_type: "google.cloud.retail.v2alpha.RemoveFulfillmentPlacesMetadata"
217217
};
218218
}
219+
220+
// Updates local inventory information for a
221+
// [Product][google.cloud.retail.v2alpha.Product] at a list of places, while
222+
// respecting the last update timestamps of each inventory field.
223+
//
224+
// This process is asynchronous and does not require the
225+
// [Product][google.cloud.retail.v2alpha.Product] to exist before updating
226+
// inventory information. If the request is valid, the update will be enqueued
227+
// and processed downstream. As a consequence, when a response is returned,
228+
// updates are not immediately manifested in the
229+
// [Product][google.cloud.retail.v2alpha.Product] queried by
230+
// [GetProduct][google.cloud.retail.v2alpha.ProductService.GetProduct] or
231+
// [ListProducts][google.cloud.retail.v2alpha.ProductService.ListProducts].
232+
//
233+
// Store inventory information can only be modified using this method.
234+
// [CreateProduct][google.cloud.retail.v2alpha.ProductService.CreateProduct]
235+
// and
236+
// [UpdateProduct][google.cloud.retail.v2alpha.ProductService.UpdateProduct]
237+
// has no effect on local inventories.
238+
//
239+
// This feature is only available for users who have Retail Search enabled.
240+
// Please submit a form [here](https://cloud.google.com/contact) to contact
241+
// Cloud sales if you are interested in using Retail Search.
242+
rpc AddLocalInventories(AddLocalInventoriesRequest)
243+
returns (google.longrunning.Operation) {
244+
option (google.api.http) = {
245+
post: "/v2alpha/{product=projects/*/locations/*/catalogs/*/branches/*/products/**}:addLocalInventories"
246+
body: "*"
247+
};
248+
option (google.api.method_signature) = "product";
249+
option (google.longrunning.operation_info) = {
250+
response_type: "google.cloud.retail.v2alpha.AddLocalInventoriesResponse"
251+
metadata_type: "google.cloud.retail.v2alpha.AddLocalInventoriesMetadata"
252+
};
253+
}
254+
255+
// Remove local inventory information for a
256+
// [Product][google.cloud.retail.v2alpha.Product] at a list of places at a
257+
// removal timestamp.
258+
//
259+
// This process is asynchronous. If the request is valid, the removal will be
260+
// enqueued and processed downstream. As a consequence, when a response is
261+
// returned, removals are not immediately manifested in the
262+
// [Product][google.cloud.retail.v2alpha.Product] queried by
263+
// [GetProduct][google.cloud.retail.v2alpha.ProductService.GetProduct] or
264+
// [ListProducts][google.cloud.retail.v2alpha.ProductService.ListProducts].
265+
//
266+
// Store inventory information can only be removed using this method.
267+
// [CreateProduct][google.cloud.retail.v2alpha.ProductService.CreateProduct]
268+
// and
269+
// [UpdateProduct][google.cloud.retail.v2alpha.ProductService.UpdateProduct]
270+
// has no effect on local inventories.
271+
//
272+
// This feature is only available for users who have Retail Search enabled.
273+
// Please submit a form [here](https://cloud.google.com/contact) to contact
274+
// Cloud sales if you are interested in using Retail Search.
275+
rpc RemoveLocalInventories(RemoveLocalInventoriesRequest)
276+
returns (google.longrunning.Operation) {
277+
option (google.api.http) = {
278+
post: "/v2alpha/{product=projects/*/locations/*/catalogs/*/branches/*/products/**}:removeLocalInventories"
279+
body: "*"
280+
};
281+
option (google.api.method_signature) = "product";
282+
option (google.longrunning.operation_info) = {
283+
response_type: "google.cloud.retail.v2alpha.RemoveLocalInventoriesResponse"
284+
metadata_type: "google.cloud.retail.v2alpha.RemoveLocalInventoriesMetadata"
285+
};
286+
}
219287
}
220288

221289
// Request message for [CreateProduct][] method.
@@ -597,6 +665,109 @@ message AddFulfillmentPlacesMetadata {}
597665
// method.
598666
message AddFulfillmentPlacesResponse {}
599667

668+
// Request message for [AddLocalInventories][] method.
669+
message AddLocalInventoriesRequest {
670+
// Required. Full resource name of
671+
// [Product][google.cloud.retail.v2alpha.Product], such as
672+
// `projects/*/locations/global/catalogs/default_catalog/branches/default_branch/products/some_product_id`.
673+
//
674+
// If the caller does not have permission to access the
675+
// [Product][google.cloud.retail.v2alpha.Product], regardless of whether or
676+
// not it exists, a PERMISSION_DENIED error is returned.
677+
string product = 1 [
678+
(google.api.field_behavior) = REQUIRED,
679+
(google.api.resource_reference) = { type: "retail.googleapis.com/Product" }
680+
];
681+
682+
// Required. A list of inventory information at difference places. Each place
683+
// is identified by its place ID. At most 1000 inventories are allowed per
684+
// request.
685+
repeated LocalInventory local_inventories = 2
686+
[(google.api.field_behavior) = REQUIRED];
687+
688+
// Indicates which inventory fields in the provided list of
689+
// [LocalInventory][google.cloud.retail.v2alpha.LocalInventory] to update. The
690+
// field is updated to the provided value.
691+
//
692+
// If a field is set while the place does not have a previous local inventory,
693+
// the local inventory at that store is created.
694+
//
695+
// If a field is set while the value of that field is not provided, the
696+
// original field value, if it exists, is deleted.
697+
//
698+
// If the mask is not set or set with empty paths, all inventory fields will
699+
// be updated.
700+
//
701+
// If an unsupported or unknown field is provided, an INVALID_ARGUMENT error
702+
// is returned and the entire update will be ignored.
703+
google.protobuf.FieldMask add_mask = 4;
704+
705+
// The time when the inventory updates are issued. Used to prevent
706+
// out-of-order updates on local inventory fields. If not provided, the
707+
// internal system time will be used.
708+
google.protobuf.Timestamp add_time = 5;
709+
710+
// If set to true, and the [Product][google.cloud.retail.v2alpha.Product] is
711+
// not found, the local inventory will still be processed and retained for at
712+
// most 1 day and processed once the
713+
// [Product][google.cloud.retail.v2alpha.Product] is created. If set to false,
714+
// an INVALID_ARGUMENT error is returned if the
715+
// [Product][google.cloud.retail.v2alpha.Product] is not found.
716+
bool allow_missing = 6;
717+
}
718+
719+
// Metadata related to the progress of the AddLocalInventories operation.
720+
// Currently empty because there is no meaningful metadata populated from the
721+
// [AddLocalInventories][] method.
722+
message AddLocalInventoriesMetadata {}
723+
724+
// Response of the [AddLocalInventories][] API. Currently empty because
725+
// there is no meaningful response populated from the [AddLocalInventories][]
726+
// method.
727+
message AddLocalInventoriesResponse {}
728+
729+
// Request message for [RemoveLocalInventories][] method.
730+
message RemoveLocalInventoriesRequest {
731+
// Required. Full resource name of
732+
// [Product][google.cloud.retail.v2alpha.Product], such as
733+
// `projects/*/locations/global/catalogs/default_catalog/branches/default_branch/products/some_product_id`.
734+
//
735+
// If the caller does not have permission to access the
736+
// [Product][google.cloud.retail.v2alpha.Product], regardless of whether or
737+
// not it exists, a PERMISSION_DENIED error is returned.
738+
string product = 1 [
739+
(google.api.field_behavior) = REQUIRED,
740+
(google.api.resource_reference) = { type: "retail.googleapis.com/Product" }
741+
];
742+
743+
// Required. A list of place IDs to have their inventory deleted.
744+
// At most 1000 place IDs are allowed per request.
745+
repeated string place_ids = 2 [(google.api.field_behavior) = REQUIRED];
746+
747+
// The time when the inventory deletions are issued. Used to prevent
748+
// out-of-order updates and deletions on local inventory fields. If not
749+
// provided, the internal system time will be used.
750+
google.protobuf.Timestamp remove_time = 5;
751+
752+
// If set to true, and the [Product][google.cloud.retail.v2alpha.Product] is
753+
// not found, the local inventory removal request will still be processed and
754+
// retained for at most 1 day and processed once the
755+
// [Product][google.cloud.retail.v2alpha.Product] is created. If set to false,
756+
// a NOT_FOUND error is returned if the
757+
// [Product][google.cloud.retail.v2alpha.Product] is not found.
758+
bool allow_missing = 3;
759+
}
760+
761+
// Metadata related to the progress of the RemoveLocalInventories operation.
762+
// Currently empty because there is no meaningful metadata populated from the
763+
// [RemoveLocalInventories][] method.
764+
message RemoveLocalInventoriesMetadata {}
765+
766+
// Response of the [RemoveLocalInventories][] API. Currently empty because
767+
// there is no meaningful response populated from the [RemoveLocalInventories][]
768+
// method.
769+
message RemoveLocalInventoriesResponse {}
770+
600771
// Request message for [RemoveFulfillmentPlaces][] method.
601772
message RemoveFulfillmentPlacesRequest {
602773
// Required. Full resource name of

0 commit comments

Comments
 (0)