diff --git a/packages/google-shopping-css/README.md b/packages/google-shopping-css/README.md index 50f58da142d..6b659046226 100644 --- a/packages/google-shopping-css/README.md +++ b/packages/google-shopping-css/README.md @@ -132,6 +132,7 @@ Samples are in the [`samples/`](https://github.com/googleapis/google-cloud-node/ | Accounts_service.update_labels | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-shopping-css/samples/generated/v1/accounts_service.update_labels.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-shopping-css/samples/generated/v1/accounts_service.update_labels.js,packages/google-shopping-css/samples/README.md) | | Css_product_inputs_service.delete_css_product_input | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-shopping-css/samples/generated/v1/css_product_inputs_service.delete_css_product_input.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-shopping-css/samples/generated/v1/css_product_inputs_service.delete_css_product_input.js,packages/google-shopping-css/samples/README.md) | | Css_product_inputs_service.insert_css_product_input | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-shopping-css/samples/generated/v1/css_product_inputs_service.insert_css_product_input.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-shopping-css/samples/generated/v1/css_product_inputs_service.insert_css_product_input.js,packages/google-shopping-css/samples/README.md) | +| Css_product_inputs_service.update_css_product_input | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-shopping-css/samples/generated/v1/css_product_inputs_service.update_css_product_input.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-shopping-css/samples/generated/v1/css_product_inputs_service.update_css_product_input.js,packages/google-shopping-css/samples/README.md) | | Css_products_service.get_css_product | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-shopping-css/samples/generated/v1/css_products_service.get_css_product.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-shopping-css/samples/generated/v1/css_products_service.get_css_product.js,packages/google-shopping-css/samples/README.md) | | Css_products_service.list_css_products | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-shopping-css/samples/generated/v1/css_products_service.list_css_products.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-shopping-css/samples/generated/v1/css_products_service.list_css_products.js,packages/google-shopping-css/samples/README.md) | | Quickstart | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-shopping-css/samples/quickstart.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-shopping-css/samples/quickstart.js,packages/google-shopping-css/samples/README.md) | diff --git a/packages/google-shopping-css/protos/google/shopping/css/v1/accounts.proto b/packages/google-shopping-css/protos/google/shopping/css/v1/accounts.proto index 0f35cd3fdef..91c596b2053 100644 --- a/packages/google-shopping-css/protos/google/shopping/css/v1/accounts.proto +++ b/packages/google-shopping-css/protos/google/shopping/css/v1/accounts.proto @@ -80,8 +80,8 @@ message ListChildAccountsRequest { // Optional. The maximum number of accounts to return. The service may return // fewer than this value. If unspecified, at most 50 accounts will be - // returned. The maximum value is 1000; values above 1000 will be coerced to - // 1000. + // returned. The maximum value is 100; values above 100 will be coerced to + // 100. int32 page_size = 4 [(google.api.field_behavior) = OPTIONAL]; // Optional. A page token, received from a previous `ListChildAccounts` call. diff --git a/packages/google-shopping-css/protos/google/shopping/css/v1/css_product_common.proto b/packages/google-shopping-css/protos/google/shopping/css/v1/css_product_common.proto index 4cb460f2d0e..f5a9fbe844b 100644 --- a/packages/google-shopping-css/protos/google/shopping/css/v1/css_product_common.proto +++ b/packages/google-shopping-css/protos/google/shopping/css/v1/css_product_common.proto @@ -40,19 +40,19 @@ message Attributes { // within the context of Product Ads. optional string cpp_ads_redirect = 42; - // Low Price of the aggregate offer. + // Low Price of the CSS Product. google.shopping.type.Price low_price = 3; - // High Price of the aggregate offer. + // High Price of the CSS Product. google.shopping.type.Price high_price = 4; - // The number of aggregate offers. + // The number of CSS Products. optional int64 number_of_offers = 5; // Condition of the headline offer. optional string headline_offer_condition = 6; - // Headline Price of the aggregate offer. + // Headline Price of the CSS Product. google.shopping.type.Price headline_offer_price = 7; // Link to the headline offer. @@ -61,7 +61,7 @@ message Attributes { // Mobile Link to the headline offer. optional string headline_offer_mobile_link = 9; - // Headline Price of the aggregate offer. + // Headline Price of the CSS Product. google.shopping.type.Price headline_offer_shipping_price = 41; // Title of the item. @@ -281,15 +281,15 @@ message CssProductStatus { // The name of the destination string destination = 1; - // List of country codes (ISO 3166-1 alpha-2) where the aggregate offer is + // List of country codes (ISO 3166-1 alpha-2) where the CSS Product is // approved. repeated string approved_countries = 2; - // List of country codes (ISO 3166-1 alpha-2) where the aggregate offer is + // List of country codes (ISO 3166-1 alpha-2) where the CSS Product is // pending approval. repeated string pending_countries = 3; - // List of country codes (ISO 3166-1 alpha-2) where the aggregate offer is + // List of country codes (ISO 3166-1 alpha-2) where the CSS Product is // disapproved. repeated string disapproved_countries = 4; } @@ -299,7 +299,7 @@ message CssProductStatus { // The error code of the issue. string code = 1; - // How this issue affects serving of the aggregate offer. + // How this issue affects serving of the CSS Product. string servability = 2; // Whether the issue can be resolved by the merchant. @@ -321,7 +321,7 @@ message CssProductStatus { string documentation = 8; // List of country codes (ISO 3166-1 alpha-2) where issue applies to the - // aggregate offer. + // CSS Product. repeated string applicable_countries = 9; } diff --git a/packages/google-shopping-css/protos/google/shopping/css/v1/css_product_inputs.proto b/packages/google-shopping-css/protos/google/shopping/css/v1/css_product_inputs.proto index fb70a96884d..b2ebc6f6c1d 100644 --- a/packages/google-shopping-css/protos/google/shopping/css/v1/css_product_inputs.proto +++ b/packages/google-shopping-css/protos/google/shopping/css/v1/css_product_inputs.proto @@ -21,6 +21,7 @@ import "google/api/client.proto"; import "google/api/field_behavior.proto"; import "google/api/resource.proto"; import "google/protobuf/empty.proto"; +import "google/protobuf/field_mask.proto"; import "google/protobuf/timestamp.proto"; import "google/shopping/css/v1/css_product_common.proto"; import "google/shopping/type/types.proto"; @@ -53,6 +54,19 @@ service CssProductInputsService { }; } + // Updates the existing Css Product input in your CSS Center account. + // + // After inserting, updating, or deleting a CSS Product input, it may take + // several minutes before the processed Css Product can be retrieved. + rpc UpdateCssProductInput(UpdateCssProductInputRequest) + returns (CssProductInput) { + option (google.api.http) = { + patch: "/v1/{css_product_input.name=accounts/*/cssProductInputs/*}" + body: "css_product_input" + }; + option (google.api.method_signature) = "css_product_input,update_mask"; + } + // Deletes a CSS Product input from your CSS Center account. // // After a delete it may take several minutes until the input is no longer @@ -105,6 +119,7 @@ message CssProductInput { // valid region code. For example: 'DE' for Germany, 'FR' for France. string feed_label = 5 [(google.api.field_behavior) = REQUIRED]; + // DEPRECATED. Use expiration_date instead. // Represents the existing version (freshness) of the CSS Product, which // can be used to preserve the right order when multiple updates are done at // the same time. @@ -122,7 +137,7 @@ message CssProductInput { // // If the operation is prevented, the aborted exception will be // thrown. - google.protobuf.Timestamp freshness_time = 6; + google.protobuf.Timestamp freshness_time = 6 [deprecated = true]; // A list of CSS Product attributes. Attributes attributes = 7; @@ -151,12 +166,40 @@ message InsertCssProductInputRequest { CssProductInput css_product_input = 2 [(google.api.field_behavior) = REQUIRED]; - // Required. The primary or supplemental feed id. If CSS Product already - // exists and feed id provided is different, then the CSS Product will be - // moved to a new feed. Note: For now, CSSs do not need to provide feed ids as - // we create feeds on the fly. We do not have supplemental feed support for - // CSS Products yet. - int64 feed_id = 3 [(google.api.field_behavior) = REQUIRED]; + // Optional. DEPRECATED. Feed id is not required for CSS Products. + // The primary or supplemental feed id. If CSS Product already exists and + // feed id provided is different, then the CSS Product will be moved to a + // new feed. + // Note: For now, CSSs do not need to provide feed ids as we create + // feeds on the fly. + // We do not have supplemental feed support for CSS Products yet. + int64 feed_id = 3 [deprecated = true, (google.api.field_behavior) = OPTIONAL]; +} + +// Request message for the UpdateCssProductInput method. +message UpdateCssProductInputRequest { + // Required. The CSS product input resource to update. Information you submit + // will be applied to the processed CSS product as well. + CssProductInput css_product_input = 1 + [(google.api.field_behavior) = REQUIRED]; + + // The list of CSS product attributes to be updated. + // + // If the update mask is omitted, then it is treated as implied field mask + // equivalent to all fields that are populated (have a non-empty value). + // + // Attributes specified in the update mask without a value specified in the + // body will be deleted from the CSS product. + // + // Update mask can only be specified for top level fields in + // attributes and custom attributes. + // + // To specify the update mask for custom attributes you need to add the + // `custom_attribute.` prefix. + // + // Providing special "*" value for full CSS product replacement is not + // supported. + google.protobuf.FieldMask update_mask = 2; } // Request message for the DeleteCssProductInput method. diff --git a/packages/google-shopping-css/protos/google/shopping/css/v1/css_products.proto b/packages/google-shopping-css/protos/google/shopping/css/v1/css_products.proto index ea7fc0dffca..d0c30aa06c8 100644 --- a/packages/google-shopping-css/protos/google/shopping/css/v1/css_products.proto +++ b/packages/google-shopping-css/protos/google/shopping/css/v1/css_products.proto @@ -72,7 +72,7 @@ message GetCssProductRequest { ]; } -// The processed CSS Product(a.k.a Aggregate Offer internally). +// The processed CSS Product. message CssProduct { option (google.api.resource) = { type: "css.googleapis.com/CssProduct" diff --git a/packages/google-shopping-css/protos/protos.d.ts b/packages/google-shopping-css/protos/protos.d.ts index dfca014e3ff..1d38e683d10 100644 --- a/packages/google-shopping-css/protos/protos.d.ts +++ b/packages/google-shopping-css/protos/protos.d.ts @@ -3036,6 +3036,20 @@ export namespace google { */ public insertCssProductInput(request: google.shopping.css.v1.IInsertCssProductInputRequest): Promise; + /** + * Calls UpdateCssProductInput. + * @param request UpdateCssProductInputRequest message or plain object + * @param callback Node-style callback called with the error, if any, and CssProductInput + */ + public updateCssProductInput(request: google.shopping.css.v1.IUpdateCssProductInputRequest, callback: google.shopping.css.v1.CssProductInputsService.UpdateCssProductInputCallback): void; + + /** + * Calls UpdateCssProductInput. + * @param request UpdateCssProductInputRequest message or plain object + * @returns Promise + */ + public updateCssProductInput(request: google.shopping.css.v1.IUpdateCssProductInputRequest): Promise; + /** * Calls DeleteCssProductInput. * @param request DeleteCssProductInputRequest message or plain object @@ -3060,6 +3074,13 @@ export namespace google { */ type InsertCssProductInputCallback = (error: (Error|null), response?: google.shopping.css.v1.CssProductInput) => void; + /** + * Callback as used by {@link google.shopping.css.v1.CssProductInputsService|updateCssProductInput}. + * @param error Error, if any + * @param [response] CssProductInput + */ + type UpdateCssProductInputCallback = (error: (Error|null), response?: google.shopping.css.v1.CssProductInput) => void; + /** * Callback as used by {@link google.shopping.css.v1.CssProductInputsService|deleteCssProductInput}. * @param error Error, if any @@ -3316,6 +3337,109 @@ export namespace google { public static getTypeUrl(typeUrlPrefix?: string): string; } + /** Properties of an UpdateCssProductInputRequest. */ + interface IUpdateCssProductInputRequest { + + /** UpdateCssProductInputRequest cssProductInput */ + cssProductInput?: (google.shopping.css.v1.ICssProductInput|null); + + /** UpdateCssProductInputRequest updateMask */ + updateMask?: (google.protobuf.IFieldMask|null); + } + + /** Represents an UpdateCssProductInputRequest. */ + class UpdateCssProductInputRequest implements IUpdateCssProductInputRequest { + + /** + * Constructs a new UpdateCssProductInputRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.shopping.css.v1.IUpdateCssProductInputRequest); + + /** UpdateCssProductInputRequest cssProductInput. */ + public cssProductInput?: (google.shopping.css.v1.ICssProductInput|null); + + /** UpdateCssProductInputRequest updateMask. */ + public updateMask?: (google.protobuf.IFieldMask|null); + + /** + * Creates a new UpdateCssProductInputRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns UpdateCssProductInputRequest instance + */ + public static create(properties?: google.shopping.css.v1.IUpdateCssProductInputRequest): google.shopping.css.v1.UpdateCssProductInputRequest; + + /** + * Encodes the specified UpdateCssProductInputRequest message. Does not implicitly {@link google.shopping.css.v1.UpdateCssProductInputRequest.verify|verify} messages. + * @param message UpdateCssProductInputRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.shopping.css.v1.IUpdateCssProductInputRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified UpdateCssProductInputRequest message, length delimited. Does not implicitly {@link google.shopping.css.v1.UpdateCssProductInputRequest.verify|verify} messages. + * @param message UpdateCssProductInputRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.shopping.css.v1.IUpdateCssProductInputRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an UpdateCssProductInputRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns UpdateCssProductInputRequest + * @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.shopping.css.v1.UpdateCssProductInputRequest; + + /** + * Decodes an UpdateCssProductInputRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns UpdateCssProductInputRequest + * @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.shopping.css.v1.UpdateCssProductInputRequest; + + /** + * Verifies an UpdateCssProductInputRequest 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 UpdateCssProductInputRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns UpdateCssProductInputRequest + */ + public static fromObject(object: { [k: string]: any }): google.shopping.css.v1.UpdateCssProductInputRequest; + + /** + * Creates a plain object from an UpdateCssProductInputRequest message. Also converts values to other types if specified. + * @param message UpdateCssProductInputRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.shopping.css.v1.UpdateCssProductInputRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this UpdateCssProductInputRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for UpdateCssProductInputRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + /** Properties of a DeleteCssProductInputRequest. */ interface IDeleteCssProductInputRequest { @@ -11113,5 +11237,102 @@ export namespace google { */ public static getTypeUrl(typeUrlPrefix?: string): string; } + + /** Properties of a FieldMask. */ + interface IFieldMask { + + /** FieldMask paths */ + paths?: (string[]|null); + } + + /** Represents a FieldMask. */ + class FieldMask implements IFieldMask { + + /** + * Constructs a new FieldMask. + * @param [properties] Properties to set + */ + constructor(properties?: google.protobuf.IFieldMask); + + /** FieldMask paths. */ + public paths: string[]; + + /** + * Creates a new FieldMask instance using the specified properties. + * @param [properties] Properties to set + * @returns FieldMask instance + */ + public static create(properties?: google.protobuf.IFieldMask): google.protobuf.FieldMask; + + /** + * Encodes the specified FieldMask message. Does not implicitly {@link google.protobuf.FieldMask.verify|verify} messages. + * @param message FieldMask message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.protobuf.IFieldMask, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified FieldMask message, length delimited. Does not implicitly {@link google.protobuf.FieldMask.verify|verify} messages. + * @param message FieldMask message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.protobuf.IFieldMask, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a FieldMask message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns FieldMask + * @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.protobuf.FieldMask; + + /** + * Decodes a FieldMask message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns FieldMask + * @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.protobuf.FieldMask; + + /** + * Verifies a FieldMask 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 FieldMask message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns FieldMask + */ + public static fromObject(object: { [k: string]: any }): google.protobuf.FieldMask; + + /** + * Creates a plain object from a FieldMask message. Also converts values to other types if specified. + * @param message FieldMask + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.protobuf.FieldMask, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this FieldMask to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for FieldMask + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } } } diff --git a/packages/google-shopping-css/protos/protos.js b/packages/google-shopping-css/protos/protos.js index 18a24fdeab8..f987374af08 100644 --- a/packages/google-shopping-css/protos/protos.js +++ b/packages/google-shopping-css/protos/protos.js @@ -8330,6 +8330,39 @@ * @variation 2 */ + /** + * Callback as used by {@link google.shopping.css.v1.CssProductInputsService|updateCssProductInput}. + * @memberof google.shopping.css.v1.CssProductInputsService + * @typedef UpdateCssProductInputCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.shopping.css.v1.CssProductInput} [response] CssProductInput + */ + + /** + * Calls UpdateCssProductInput. + * @function updateCssProductInput + * @memberof google.shopping.css.v1.CssProductInputsService + * @instance + * @param {google.shopping.css.v1.IUpdateCssProductInputRequest} request UpdateCssProductInputRequest message or plain object + * @param {google.shopping.css.v1.CssProductInputsService.UpdateCssProductInputCallback} callback Node-style callback called with the error, if any, and CssProductInput + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(CssProductInputsService.prototype.updateCssProductInput = function updateCssProductInput(request, callback) { + return this.rpcCall(updateCssProductInput, $root.google.shopping.css.v1.UpdateCssProductInputRequest, $root.google.shopping.css.v1.CssProductInput, request, callback); + }, "name", { value: "UpdateCssProductInput" }); + + /** + * Calls UpdateCssProductInput. + * @function updateCssProductInput + * @memberof google.shopping.css.v1.CssProductInputsService + * @instance + * @param {google.shopping.css.v1.IUpdateCssProductInputRequest} request UpdateCssProductInputRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + /** * Callback as used by {@link google.shopping.css.v1.CssProductInputsService|deleteCssProductInput}. * @memberof google.shopping.css.v1.CssProductInputsService @@ -9032,6 +9065,243 @@ return InsertCssProductInputRequest; })(); + v1.UpdateCssProductInputRequest = (function() { + + /** + * Properties of an UpdateCssProductInputRequest. + * @memberof google.shopping.css.v1 + * @interface IUpdateCssProductInputRequest + * @property {google.shopping.css.v1.ICssProductInput|null} [cssProductInput] UpdateCssProductInputRequest cssProductInput + * @property {google.protobuf.IFieldMask|null} [updateMask] UpdateCssProductInputRequest updateMask + */ + + /** + * Constructs a new UpdateCssProductInputRequest. + * @memberof google.shopping.css.v1 + * @classdesc Represents an UpdateCssProductInputRequest. + * @implements IUpdateCssProductInputRequest + * @constructor + * @param {google.shopping.css.v1.IUpdateCssProductInputRequest=} [properties] Properties to set + */ + function UpdateCssProductInputRequest(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]]; + } + + /** + * UpdateCssProductInputRequest cssProductInput. + * @member {google.shopping.css.v1.ICssProductInput|null|undefined} cssProductInput + * @memberof google.shopping.css.v1.UpdateCssProductInputRequest + * @instance + */ + UpdateCssProductInputRequest.prototype.cssProductInput = null; + + /** + * UpdateCssProductInputRequest updateMask. + * @member {google.protobuf.IFieldMask|null|undefined} updateMask + * @memberof google.shopping.css.v1.UpdateCssProductInputRequest + * @instance + */ + UpdateCssProductInputRequest.prototype.updateMask = null; + + /** + * Creates a new UpdateCssProductInputRequest instance using the specified properties. + * @function create + * @memberof google.shopping.css.v1.UpdateCssProductInputRequest + * @static + * @param {google.shopping.css.v1.IUpdateCssProductInputRequest=} [properties] Properties to set + * @returns {google.shopping.css.v1.UpdateCssProductInputRequest} UpdateCssProductInputRequest instance + */ + UpdateCssProductInputRequest.create = function create(properties) { + return new UpdateCssProductInputRequest(properties); + }; + + /** + * Encodes the specified UpdateCssProductInputRequest message. Does not implicitly {@link google.shopping.css.v1.UpdateCssProductInputRequest.verify|verify} messages. + * @function encode + * @memberof google.shopping.css.v1.UpdateCssProductInputRequest + * @static + * @param {google.shopping.css.v1.IUpdateCssProductInputRequest} message UpdateCssProductInputRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + UpdateCssProductInputRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.cssProductInput != null && Object.hasOwnProperty.call(message, "cssProductInput")) + $root.google.shopping.css.v1.CssProductInput.encode(message.cssProductInput, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.updateMask != null && Object.hasOwnProperty.call(message, "updateMask")) + $root.google.protobuf.FieldMask.encode(message.updateMask, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified UpdateCssProductInputRequest message, length delimited. Does not implicitly {@link google.shopping.css.v1.UpdateCssProductInputRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.shopping.css.v1.UpdateCssProductInputRequest + * @static + * @param {google.shopping.css.v1.IUpdateCssProductInputRequest} message UpdateCssProductInputRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + UpdateCssProductInputRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an UpdateCssProductInputRequest message from the specified reader or buffer. + * @function decode + * @memberof google.shopping.css.v1.UpdateCssProductInputRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.shopping.css.v1.UpdateCssProductInputRequest} UpdateCssProductInputRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + UpdateCssProductInputRequest.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.shopping.css.v1.UpdateCssProductInputRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.cssProductInput = $root.google.shopping.css.v1.CssProductInput.decode(reader, reader.uint32()); + break; + } + case 2: { + message.updateMask = $root.google.protobuf.FieldMask.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an UpdateCssProductInputRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.shopping.css.v1.UpdateCssProductInputRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.shopping.css.v1.UpdateCssProductInputRequest} UpdateCssProductInputRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + UpdateCssProductInputRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an UpdateCssProductInputRequest message. + * @function verify + * @memberof google.shopping.css.v1.UpdateCssProductInputRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + UpdateCssProductInputRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.cssProductInput != null && message.hasOwnProperty("cssProductInput")) { + var error = $root.google.shopping.css.v1.CssProductInput.verify(message.cssProductInput); + if (error) + return "cssProductInput." + error; + } + if (message.updateMask != null && message.hasOwnProperty("updateMask")) { + var error = $root.google.protobuf.FieldMask.verify(message.updateMask); + if (error) + return "updateMask." + error; + } + return null; + }; + + /** + * Creates an UpdateCssProductInputRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.shopping.css.v1.UpdateCssProductInputRequest + * @static + * @param {Object.} object Plain object + * @returns {google.shopping.css.v1.UpdateCssProductInputRequest} UpdateCssProductInputRequest + */ + UpdateCssProductInputRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.shopping.css.v1.UpdateCssProductInputRequest) + return object; + var message = new $root.google.shopping.css.v1.UpdateCssProductInputRequest(); + if (object.cssProductInput != null) { + if (typeof object.cssProductInput !== "object") + throw TypeError(".google.shopping.css.v1.UpdateCssProductInputRequest.cssProductInput: object expected"); + message.cssProductInput = $root.google.shopping.css.v1.CssProductInput.fromObject(object.cssProductInput); + } + if (object.updateMask != null) { + if (typeof object.updateMask !== "object") + throw TypeError(".google.shopping.css.v1.UpdateCssProductInputRequest.updateMask: object expected"); + message.updateMask = $root.google.protobuf.FieldMask.fromObject(object.updateMask); + } + return message; + }; + + /** + * Creates a plain object from an UpdateCssProductInputRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.shopping.css.v1.UpdateCssProductInputRequest + * @static + * @param {google.shopping.css.v1.UpdateCssProductInputRequest} message UpdateCssProductInputRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + UpdateCssProductInputRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.cssProductInput = null; + object.updateMask = null; + } + if (message.cssProductInput != null && message.hasOwnProperty("cssProductInput")) + object.cssProductInput = $root.google.shopping.css.v1.CssProductInput.toObject(message.cssProductInput, options); + if (message.updateMask != null && message.hasOwnProperty("updateMask")) + object.updateMask = $root.google.protobuf.FieldMask.toObject(message.updateMask, options); + return object; + }; + + /** + * Converts this UpdateCssProductInputRequest to JSON. + * @function toJSON + * @memberof google.shopping.css.v1.UpdateCssProductInputRequest + * @instance + * @returns {Object.} JSON object + */ + UpdateCssProductInputRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for UpdateCssProductInputRequest + * @function getTypeUrl + * @memberof google.shopping.css.v1.UpdateCssProductInputRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + UpdateCssProductInputRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.shopping.css.v1.UpdateCssProductInputRequest"; + }; + + return UpdateCssProductInputRequest; + })(); + v1.DeleteCssProductInputRequest = (function() { /** @@ -30227,6 +30497,225 @@ return Timestamp; })(); + protobuf.FieldMask = (function() { + + /** + * Properties of a FieldMask. + * @memberof google.protobuf + * @interface IFieldMask + * @property {Array.|null} [paths] FieldMask paths + */ + + /** + * Constructs a new FieldMask. + * @memberof google.protobuf + * @classdesc Represents a FieldMask. + * @implements IFieldMask + * @constructor + * @param {google.protobuf.IFieldMask=} [properties] Properties to set + */ + function FieldMask(properties) { + this.paths = []; + 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]]; + } + + /** + * FieldMask paths. + * @member {Array.} paths + * @memberof google.protobuf.FieldMask + * @instance + */ + FieldMask.prototype.paths = $util.emptyArray; + + /** + * Creates a new FieldMask instance using the specified properties. + * @function create + * @memberof google.protobuf.FieldMask + * @static + * @param {google.protobuf.IFieldMask=} [properties] Properties to set + * @returns {google.protobuf.FieldMask} FieldMask instance + */ + FieldMask.create = function create(properties) { + return new FieldMask(properties); + }; + + /** + * Encodes the specified FieldMask message. Does not implicitly {@link google.protobuf.FieldMask.verify|verify} messages. + * @function encode + * @memberof google.protobuf.FieldMask + * @static + * @param {google.protobuf.IFieldMask} message FieldMask message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + FieldMask.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.paths != null && message.paths.length) + for (var i = 0; i < message.paths.length; ++i) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.paths[i]); + return writer; + }; + + /** + * Encodes the specified FieldMask message, length delimited. Does not implicitly {@link google.protobuf.FieldMask.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.FieldMask + * @static + * @param {google.protobuf.IFieldMask} message FieldMask message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + FieldMask.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a FieldMask message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.FieldMask + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.FieldMask} FieldMask + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + FieldMask.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.protobuf.FieldMask(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (!(message.paths && message.paths.length)) + message.paths = []; + message.paths.push(reader.string()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a FieldMask message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.FieldMask + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.FieldMask} FieldMask + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + FieldMask.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a FieldMask message. + * @function verify + * @memberof google.protobuf.FieldMask + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + FieldMask.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.paths != null && message.hasOwnProperty("paths")) { + if (!Array.isArray(message.paths)) + return "paths: array expected"; + for (var i = 0; i < message.paths.length; ++i) + if (!$util.isString(message.paths[i])) + return "paths: string[] expected"; + } + return null; + }; + + /** + * Creates a FieldMask message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.FieldMask + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.FieldMask} FieldMask + */ + FieldMask.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.FieldMask) + return object; + var message = new $root.google.protobuf.FieldMask(); + if (object.paths) { + if (!Array.isArray(object.paths)) + throw TypeError(".google.protobuf.FieldMask.paths: array expected"); + message.paths = []; + for (var i = 0; i < object.paths.length; ++i) + message.paths[i] = String(object.paths[i]); + } + return message; + }; + + /** + * Creates a plain object from a FieldMask message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.FieldMask + * @static + * @param {google.protobuf.FieldMask} message FieldMask + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + FieldMask.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.paths = []; + if (message.paths && message.paths.length) { + object.paths = []; + for (var j = 0; j < message.paths.length; ++j) + object.paths[j] = message.paths[j]; + } + return object; + }; + + /** + * Converts this FieldMask to JSON. + * @function toJSON + * @memberof google.protobuf.FieldMask + * @instance + * @returns {Object.} JSON object + */ + FieldMask.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for FieldMask + * @function getTypeUrl + * @memberof google.protobuf.FieldMask + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + FieldMask.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.protobuf.FieldMask"; + }; + + return FieldMask; + })(); + return protobuf; })(); diff --git a/packages/google-shopping-css/protos/protos.json b/packages/google-shopping-css/protos/protos.json index 95d11d44441..382278c10ae 100644 --- a/packages/google-shopping-css/protos/protos.json +++ b/packages/google-shopping-css/protos/protos.json @@ -1214,6 +1214,26 @@ } ] }, + "UpdateCssProductInput": { + "requestType": "UpdateCssProductInputRequest", + "responseType": "CssProductInput", + "options": { + "(google.api.http).patch": "/v1/{css_product_input.name=accounts/*/cssProductInputs/*}", + "(google.api.http).body": "css_product_input", + "(google.api.method_signature)": "css_product_input,update_mask" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "patch": "/v1/{css_product_input.name=accounts/*/cssProductInputs/*}", + "body": "css_product_input" + } + }, + { + "(google.api.method_signature)": "css_product_input,update_mask" + } + ] + }, "DeleteCssProductInput": { "requestType": "DeleteCssProductInputRequest", "responseType": "google.protobuf.Empty", @@ -1274,7 +1294,10 @@ }, "freshnessTime": { "type": "google.protobuf.Timestamp", - "id": 6 + "id": 6, + "options": { + "deprecated": true + } }, "attributes": { "type": "Attributes", @@ -1307,9 +1330,25 @@ "feedId": { "type": "int64", "id": 3, + "options": { + "deprecated": true, + "(google.api.field_behavior)": "OPTIONAL" + } + } + } + }, + "UpdateCssProductInputRequest": { + "fields": { + "cssProductInput": { + "type": "CssProductInput", + "id": 1, "options": { "(google.api.field_behavior)": "REQUIRED" } + }, + "updateMask": { + "type": "google.protobuf.FieldMask", + "id": 2 } } }, @@ -3446,6 +3485,15 @@ "id": 2 } } + }, + "FieldMask": { + "fields": { + "paths": { + "rule": "repeated", + "type": "string", + "id": 1 + } + } } } } diff --git a/packages/google-shopping-css/samples/README.md b/packages/google-shopping-css/samples/README.md index bf991de2d08..b1687e302a0 100644 --- a/packages/google-shopping-css/samples/README.md +++ b/packages/google-shopping-css/samples/README.md @@ -21,6 +21,7 @@ * [Accounts_service.update_labels](#accounts_service.update_labels) * [Css_product_inputs_service.delete_css_product_input](#css_product_inputs_service.delete_css_product_input) * [Css_product_inputs_service.insert_css_product_input](#css_product_inputs_service.insert_css_product_input) + * [Css_product_inputs_service.update_css_product_input](#css_product_inputs_service.update_css_product_input) * [Css_products_service.get_css_product](#css_products_service.get_css_product) * [Css_products_service.list_css_products](#css_products_service.list_css_products) * [Quickstart](#quickstart) @@ -193,6 +194,23 @@ __Usage:__ +### Css_product_inputs_service.update_css_product_input + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-shopping-css/samples/generated/v1/css_product_inputs_service.update_css_product_input.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-shopping-css/samples/generated/v1/css_product_inputs_service.update_css_product_input.js,samples/README.md) + +__Usage:__ + + +`node packages/google-shopping-css/samples/generated/v1/css_product_inputs_service.update_css_product_input.js` + + +----- + + + + ### Css_products_service.get_css_product View the [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-shopping-css/samples/generated/v1/css_products_service.get_css_product.js). diff --git a/packages/google-shopping-css/samples/generated/v1/accounts_service.list_child_accounts.js b/packages/google-shopping-css/samples/generated/v1/accounts_service.list_child_accounts.js index e9ce9116ac5..980ee7a7e81 100644 --- a/packages/google-shopping-css/samples/generated/v1/accounts_service.list_child_accounts.js +++ b/packages/google-shopping-css/samples/generated/v1/accounts_service.list_child_accounts.js @@ -45,8 +45,8 @@ function main(parent) { /** * Optional. The maximum number of accounts to return. The service may return * fewer than this value. If unspecified, at most 50 accounts will be - * returned. The maximum value is 1000; values above 1000 will be coerced to - * 1000. + * returned. The maximum value is 100; values above 100 will be coerced to + * 100. */ // const pageSize = 1234 /** diff --git a/packages/google-shopping-css/samples/generated/v1/css_product_inputs_service.insert_css_product_input.js b/packages/google-shopping-css/samples/generated/v1/css_product_inputs_service.insert_css_product_input.js index 4a98df503ab..31a23e571d2 100644 --- a/packages/google-shopping-css/samples/generated/v1/css_product_inputs_service.insert_css_product_input.js +++ b/packages/google-shopping-css/samples/generated/v1/css_product_inputs_service.insert_css_product_input.js @@ -20,7 +20,7 @@ 'use strict'; -function main(parent, cssProductInput, feedId) { +function main(parent, cssProductInput) { // [START css_v1_generated_CssProductInputsService_InsertCssProductInput_async] /** * This snippet has been automatically generated and should be regarded as a code template only. @@ -38,11 +38,13 @@ function main(parent, cssProductInput, feedId) { */ // const cssProductInput = {} /** - * Required. The primary or supplemental feed id. If CSS Product already - * exists and feed id provided is different, then the CSS Product will be - * moved to a new feed. Note: For now, CSSs do not need to provide feed ids as - * we create feeds on the fly. We do not have supplemental feed support for - * CSS Products yet. + * Optional. DEPRECATED. Feed id is not required for CSS Products. + * The primary or supplemental feed id. If CSS Product already exists and + * feed id provided is different, then the CSS Product will be moved to a + * new feed. + * Note: For now, CSSs do not need to provide feed ids as we create + * feeds on the fly. + * We do not have supplemental feed support for CSS Products yet. */ // const feedId = 1234 @@ -57,7 +59,6 @@ function main(parent, cssProductInput, feedId) { const request = { parent, cssProductInput, - feedId, }; // Run request diff --git a/packages/google-shopping-css/samples/generated/v1/css_product_inputs_service.update_css_product_input.js b/packages/google-shopping-css/samples/generated/v1/css_product_inputs_service.update_css_product_input.js new file mode 100644 index 00000000000..31dc81d895a --- /dev/null +++ b/packages/google-shopping-css/samples/generated/v1/css_product_inputs_service.update_css_product_input.js @@ -0,0 +1,76 @@ +// Copyright 2024 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 +// +// https://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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(cssProductInput) { + // [START css_v1_generated_CssProductInputsService_UpdateCssProductInput_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The CSS product input resource to update. Information you submit + * will be applied to the processed CSS product as well. + */ + // const cssProductInput = {} + /** + * The list of CSS product attributes to be updated. + * If the update mask is omitted, then it is treated as implied field mask + * equivalent to all fields that are populated (have a non-empty value). + * Attributes specified in the update mask without a value specified in the + * body will be deleted from the CSS product. + * Update mask can only be specified for top level fields in + * attributes and custom attributes. + * To specify the update mask for custom attributes you need to add the + * `custom_attribute.` prefix. + * Providing special "*" value for full CSS product replacement is not + * supported. + */ + // const updateMask = {} + + // Imports the Css library + const {CssProductInputsServiceClient} = require('@google-shopping/css').v1; + + // Instantiates a client + const cssClient = new CssProductInputsServiceClient(); + + async function callUpdateCssProductInput() { + // Construct request + const request = { + cssProductInput, + }; + + // Run request + const response = await cssClient.updateCssProductInput(request); + console.log(response); + } + + callUpdateCssProductInput(); + // [END css_v1_generated_CssProductInputsService_UpdateCssProductInput_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-shopping-css/samples/generated/v1/snippet_metadata_google.shopping.css.v1.json b/packages/google-shopping-css/samples/generated/v1/snippet_metadata_google.shopping.css.v1.json index b25d4ca9195..a7fa3ff125e 100644 --- a/packages/google-shopping-css/samples/generated/v1/snippet_metadata_google.shopping.css.v1.json +++ b/packages/google-shopping-css/samples/generated/v1/snippet_metadata_google.shopping.css.v1.json @@ -342,7 +342,7 @@ "segments": [ { "start": 25, - "end": 68, + "end": 69, "type": "FULL" } ], @@ -379,6 +379,50 @@ } } }, + { + "regionTag": "css_v1_generated_CssProductInputsService_UpdateCssProductInput_async", + "title": "AccountLabelsService updateCssProductInput Sample", + "origin": "API_DEFINITION", + "description": " Updates the existing Css Product input in your CSS Center account. After inserting, updating, or deleting a CSS Product input, it may take several minutes before the processed Css Product can be retrieved.", + "canonical": true, + "file": "css_product_inputs_service.update_css_product_input.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 68, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "UpdateCssProductInput", + "fullName": "google.shopping.css.v1.CssProductInputsService.UpdateCssProductInput", + "async": true, + "parameters": [ + { + "name": "css_product_input", + "type": ".google.shopping.css.v1.CssProductInput" + }, + { + "name": "update_mask", + "type": ".google.protobuf.FieldMask" + } + ], + "resultType": ".google.shopping.css.v1.CssProductInput", + "client": { + "shortName": "CssProductInputsServiceClient", + "fullName": "google.shopping.css.v1.CssProductInputsServiceClient" + }, + "method": { + "shortName": "UpdateCssProductInput", + "fullName": "google.shopping.css.v1.CssProductInputsService.UpdateCssProductInput", + "service": { + "shortName": "CssProductInputsService", + "fullName": "google.shopping.css.v1.CssProductInputsService" + } + } + } + }, { "regionTag": "css_v1_generated_CssProductInputsService_DeleteCssProductInput_async", "title": "AccountLabelsService deleteCssProductInput Sample", diff --git a/packages/google-shopping-css/src/v1/accounts_service_client.ts b/packages/google-shopping-css/src/v1/accounts_service_client.ts index cb6595519e5..8459097d5e3 100644 --- a/packages/google-shopping-css/src/v1/accounts_service_client.ts +++ b/packages/google-shopping-css/src/v1/accounts_service_client.ts @@ -594,8 +594,8 @@ export class AccountsServiceClient { * @param {number} [request.pageSize] * Optional. The maximum number of accounts to return. The service may return * fewer than this value. If unspecified, at most 50 accounts will be - * returned. The maximum value is 1000; values above 1000 will be coerced to - * 1000. + * returned. The maximum value is 100; values above 100 will be coerced to + * 100. * @param {string} [request.pageToken] * Optional. A page token, received from a previous `ListChildAccounts` call. * Provide this to retrieve the subsequent page. @@ -704,8 +704,8 @@ export class AccountsServiceClient { * @param {number} [request.pageSize] * Optional. The maximum number of accounts to return. The service may return * fewer than this value. If unspecified, at most 50 accounts will be - * returned. The maximum value is 1000; values above 1000 will be coerced to - * 1000. + * returned. The maximum value is 100; values above 100 will be coerced to + * 100. * @param {string} [request.pageToken] * Optional. A page token, received from a previous `ListChildAccounts` call. * Provide this to retrieve the subsequent page. @@ -762,8 +762,8 @@ export class AccountsServiceClient { * @param {number} [request.pageSize] * Optional. The maximum number of accounts to return. The service may return * fewer than this value. If unspecified, at most 50 accounts will be - * returned. The maximum value is 1000; values above 1000 will be coerced to - * 1000. + * returned. The maximum value is 100; values above 100 will be coerced to + * 100. * @param {string} [request.pageToken] * Optional. A page token, received from a previous `ListChildAccounts` call. * Provide this to retrieve the subsequent page. diff --git a/packages/google-shopping-css/src/v1/css_product_inputs_service_client.ts b/packages/google-shopping-css/src/v1/css_product_inputs_service_client.ts index b2039e8e9f9..1c9138ee095 100644 --- a/packages/google-shopping-css/src/v1/css_product_inputs_service_client.ts +++ b/packages/google-shopping-css/src/v1/css_product_inputs_service_client.ts @@ -264,6 +264,7 @@ export class CssProductInputsServiceClient { // and create an API call method for each. const cssProductInputsServiceStubMethods = [ 'insertCssProductInput', + 'updateCssProductInput', 'deleteCssProductInput', ]; for (const methodName of cssProductInputsServiceStubMethods) { @@ -394,12 +395,14 @@ export class CssProductInputsServiceClient { * Format: accounts/{account} * @param {google.shopping.css.v1.CssProductInput} request.cssProductInput * Required. The CSS Product Input to insert. - * @param {number} request.feedId - * Required. The primary or supplemental feed id. If CSS Product already - * exists and feed id provided is different, then the CSS Product will be - * moved to a new feed. Note: For now, CSSs do not need to provide feed ids as - * we create feeds on the fly. We do not have supplemental feed support for - * CSS Products yet. + * @param {number} [request.feedId] + * Optional. DEPRECATED. Feed id is not required for CSS Products. + * The primary or supplemental feed id. If CSS Product already exists and + * feed id provided is different, then the CSS Product will be moved to a + * new feed. + * Note: For now, CSSs do not need to provide feed ids as we create + * feeds on the fly. + * We do not have supplemental feed support for CSS Products yet. * @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. @@ -483,6 +486,117 @@ export class CssProductInputsServiceClient { this.initialize(); return this.innerApiCalls.insertCssProductInput(request, options, callback); } + /** + * Updates the existing Css Product input in your CSS Center account. + * + * After inserting, updating, or deleting a CSS Product input, it may take + * several minutes before the processed Css Product can be retrieved. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.shopping.css.v1.CssProductInput} request.cssProductInput + * Required. The CSS product input resource to update. Information you submit + * will be applied to the processed CSS product as well. + * @param {google.protobuf.FieldMask} request.updateMask + * The list of CSS product attributes to be updated. + * + * If the update mask is omitted, then it is treated as implied field mask + * equivalent to all fields that are populated (have a non-empty value). + * + * Attributes specified in the update mask without a value specified in the + * body will be deleted from the CSS product. + * + * Update mask can only be specified for top level fields in + * attributes and custom attributes. + * + * To specify the update mask for custom attributes you need to add the + * `custom_attribute.` prefix. + * + * Providing special "*" value for full CSS product replacement is not + * supported. + * @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 {@link protos.google.shopping.css.v1.CssProductInput|CssProductInput}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/css_product_inputs_service.update_css_product_input.js + * region_tag:css_v1_generated_CssProductInputsService_UpdateCssProductInput_async + */ + updateCssProductInput( + request?: protos.google.shopping.css.v1.IUpdateCssProductInputRequest, + options?: CallOptions + ): Promise< + [ + protos.google.shopping.css.v1.ICssProductInput, + protos.google.shopping.css.v1.IUpdateCssProductInputRequest | undefined, + {} | undefined, + ] + >; + updateCssProductInput( + request: protos.google.shopping.css.v1.IUpdateCssProductInputRequest, + options: CallOptions, + callback: Callback< + protos.google.shopping.css.v1.ICssProductInput, + | protos.google.shopping.css.v1.IUpdateCssProductInputRequest + | null + | undefined, + {} | null | undefined + > + ): void; + updateCssProductInput( + request: protos.google.shopping.css.v1.IUpdateCssProductInputRequest, + callback: Callback< + protos.google.shopping.css.v1.ICssProductInput, + | protos.google.shopping.css.v1.IUpdateCssProductInputRequest + | null + | undefined, + {} | null | undefined + > + ): void; + updateCssProductInput( + request?: protos.google.shopping.css.v1.IUpdateCssProductInputRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.shopping.css.v1.ICssProductInput, + | protos.google.shopping.css.v1.IUpdateCssProductInputRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.shopping.css.v1.ICssProductInput, + | protos.google.shopping.css.v1.IUpdateCssProductInputRequest + | null + | undefined, + {} | null | undefined + > + ): Promise< + [ + protos.google.shopping.css.v1.ICssProductInput, + protos.google.shopping.css.v1.IUpdateCssProductInputRequest | 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'] = + this._gaxModule.routingHeader.fromParams({ + 'css_product_input.name': request.cssProductInput!.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.updateCssProductInput(request, options, callback); + } /** * Deletes a CSS Product input from your CSS Center account. * diff --git a/packages/google-shopping-css/src/v1/css_product_inputs_service_client_config.json b/packages/google-shopping-css/src/v1/css_product_inputs_service_client_config.json index a82a35eb3f5..ea39a70de80 100644 --- a/packages/google-shopping-css/src/v1/css_product_inputs_service_client_config.json +++ b/packages/google-shopping-css/src/v1/css_product_inputs_service_client_config.json @@ -25,6 +25,11 @@ "retry_codes_name": "non_idempotent", "retry_params_name": "default" }, + "UpdateCssProductInput": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, "DeleteCssProductInput": { "timeout_millis": 60000, "retry_codes_name": "non_idempotent", diff --git a/packages/google-shopping-css/src/v1/gapic_metadata.json b/packages/google-shopping-css/src/v1/gapic_metadata.json index 7981a05b77e..17c8d82aa3b 100644 --- a/packages/google-shopping-css/src/v1/gapic_metadata.json +++ b/packages/google-shopping-css/src/v1/gapic_metadata.json @@ -121,6 +121,11 @@ "insertCssProductInput" ] }, + "UpdateCssProductInput": { + "methods": [ + "updateCssProductInput" + ] + }, "DeleteCssProductInput": { "methods": [ "deleteCssProductInput" @@ -136,6 +141,11 @@ "insertCssProductInput" ] }, + "UpdateCssProductInput": { + "methods": [ + "updateCssProductInput" + ] + }, "DeleteCssProductInput": { "methods": [ "deleteCssProductInput" diff --git a/packages/google-shopping-css/test/gapic_css_product_inputs_service_v1.ts b/packages/google-shopping-css/test/gapic_css_product_inputs_service_v1.ts index 5d23c6d5856..07f4f2538ad 100644 --- a/packages/google-shopping-css/test/gapic_css_product_inputs_service_v1.ts +++ b/packages/google-shopping-css/test/gapic_css_product_inputs_service_v1.ts @@ -399,6 +399,151 @@ describe('v1.CssProductInputsServiceClient', () => { }); }); + describe('updateCssProductInput', () => { + it('invokes updateCssProductInput without error', async () => { + const client = + new cssproductinputsserviceModule.v1.CssProductInputsServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.shopping.css.v1.UpdateCssProductInputRequest() + ); + request.cssProductInput ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.shopping.css.v1.UpdateCssProductInputRequest', + ['cssProductInput', 'name'] + ); + request.cssProductInput.name = defaultValue1; + const expectedHeaderRequestParams = `css_product_input.name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.shopping.css.v1.CssProductInput() + ); + client.innerApiCalls.updateCssProductInput = + stubSimpleCall(expectedResponse); + const [response] = await client.updateCssProductInput(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.updateCssProductInput as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateCssProductInput as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateCssProductInput without error using callback', async () => { + const client = + new cssproductinputsserviceModule.v1.CssProductInputsServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.shopping.css.v1.UpdateCssProductInputRequest() + ); + request.cssProductInput ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.shopping.css.v1.UpdateCssProductInputRequest', + ['cssProductInput', 'name'] + ); + request.cssProductInput.name = defaultValue1; + const expectedHeaderRequestParams = `css_product_input.name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.shopping.css.v1.CssProductInput() + ); + client.innerApiCalls.updateCssProductInput = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateCssProductInput( + request, + ( + err?: Error | null, + result?: protos.google.shopping.css.v1.ICssProductInput | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.updateCssProductInput as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateCssProductInput as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateCssProductInput with error', async () => { + const client = + new cssproductinputsserviceModule.v1.CssProductInputsServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.shopping.css.v1.UpdateCssProductInputRequest() + ); + request.cssProductInput ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.shopping.css.v1.UpdateCssProductInputRequest', + ['cssProductInput', 'name'] + ); + request.cssProductInput.name = defaultValue1; + const expectedHeaderRequestParams = `css_product_input.name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateCssProductInput = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects( + client.updateCssProductInput(request), + expectedError + ); + const actualRequest = ( + client.innerApiCalls.updateCssProductInput as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateCssProductInput as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateCssProductInput with closed client', async () => { + const client = + new cssproductinputsserviceModule.v1.CssProductInputsServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.shopping.css.v1.UpdateCssProductInputRequest() + ); + request.cssProductInput ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.shopping.css.v1.UpdateCssProductInputRequest', + ['cssProductInput', 'name'] + ); + request.cssProductInput.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects( + client.updateCssProductInput(request), + expectedError + ); + }); + }); + describe('deleteCssProductInput', () => { it('invokes deleteCssProductInput without error', async () => { const client =