Service to use ProductInput resource. v1
Package
@google-shopping/productsConstructors
(constructor)(opts, gaxInstance)
constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback);Construct an instance of ProductInputsServiceClient.
| Parameters | |
|---|---|
| Name | Description |
opts |
ClientOptions
|
gaxInstance |
typeof gax | typeof fallback
: loaded instance of |
Properties
apiEndpoint
get apiEndpoint(): string;The DNS address for this API service.
apiEndpoint
static get apiEndpoint(): string;The DNS address for this API service - same as servicePath.
auth
auth: gax.GoogleAuth;descriptors
descriptors: Descriptors;innerApiCalls
innerApiCalls: {
[name: string]: Function;
};pathTemplates
pathTemplates: {
[name: string]: gax.PathTemplate;
};port
static get port(): number;The port for this API service.
productInputsServiceStub
productInputsServiceStub?: Promise<{
[name: string]: Function;
}>;scopes
static get scopes(): string[];The scopes needed to make gRPC calls for every method defined in this service.
servicePath
static get servicePath(): string;The DNS address for this API service.
universeDomain
get universeDomain(): string;warn
warn: (code: string, message: string, warnType?: string) => void;Methods
accountPath(account)
accountPath(account: string): string;Return a fully-qualified account resource name string.
| Parameter | |
|---|---|
| Name | Description |
account |
string
|
| Returns | |
|---|---|
| Type | Description |
string |
{string} Resource name string. |
close()
close(): Promise<void>;Terminate the gRPC channel and close the client.
The client will no longer be usable and all future behavior is undefined.
| Returns | |
|---|---|
| Type | Description |
Promise<void> |
{Promise} A promise that resolves when the client is closed. |
deleteProductInput(request, options)
deleteProductInput(request?: protos.google.shopping.merchant.products.v1.IDeleteProductInputRequest, options?: CallOptions): Promise<[
protos.google.protobuf.IEmpty,
(protos.google.shopping.merchant.products.v1.IDeleteProductInputRequest | undefined),
{} | undefined
]>;Deletes a product input from your Merchant Center account.
After inserting, updating, or deleting a product input, it may take several minutes before the processed product can be retrieved.
| Parameters | |
|---|---|
| Name | Description |
request |
IDeleteProductInputRequest
The request object that will be sent. |
options |
CallOptions
Call options. See CallOptions for more details. |
| Returns | |
|---|---|
| Type | Description |
Promise<[
protos.google.protobuf.IEmpty,
(protos.google.shopping.merchant.products.v1.IDeleteProductInputRequest | undefined),
{} | undefined
]> |
{Promise} - The promise which resolves to an array. The first element of the array is an object representing Empty. Please see the documentation for more details and examples. |
/**
* 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 name of the product input to delete.
* Format: `accounts/{account}/productInputs/{productInput}`
* The {productInput} segment is a unique identifier for the product.
* This identifier must be unique within a merchant account and generally
* follows the structure: `content_language~feed_label~offer_id`. Example:
* `en~US~sku123` For legacy local products, the structure is:
* `local~content_language~feed_label~offer_id`. Example: `local~en~US~sku123`
* The format of the {productInput} segment in the URL is automatically
* detected by the server, supporting two options:
* 1. **Encoded Format**: The `{productInput}` segment is an unpadded
* base64url
* encoded string (RFC 4648 Section 5). The decoded string must result
* in the `content_language~feed_label~offer_id` structure. This encoding
* MUST be used if any part of the product identifier (like `offer_id`)
* contains characters such as `/`, `%`, or `~`.
* * Example: To represent the product ID `en~US~sku/123`, the
* `{productInput}` segment must be the unpadded base64url encoding of
* this string, which is `ZW5-VVN-c2t1LzEyMw`. The full resource name
* for the product would be
* `accounts/123/productInputs/ZW5-VVN-c2t1LzEyMw`.
* 2. **Plain Format**: The `{productInput}` segment is the tilde-separated
* string
* `content_language~feed_label~offer_id`. This format is suitable only
* when `content_language`, `feed_label`, and `offer_id` do not contain
* URL-problematic characters like `/`, `%`, or `~`.
* We recommend using the **Encoded Format** for all product IDs to ensure
* correct parsing, especially those containing special characters. The
* presence of tilde (`~`) characters in the `{productInput}` segment is used
* to differentiate between the two formats.
*/
// const name = 'abc123'
/**
* Required. The primary or supplemental data source from which the product
* input should be deleted. Format:
* `accounts/{account}/dataSources/{datasource}`. For example,
* `accounts/123456/dataSources/104628`.
*/
// const dataSource = 'abc123'
// Imports the Products library
const {ProductInputsServiceClient} = require('@google-shopping/products').v1;
// Instantiates a client
const productsClient = new ProductInputsServiceClient();
async function callDeleteProductInput() {
// Construct request
const request = {
name,
dataSource,
};
// Run request
const response = await productsClient.deleteProductInput(request);
console.log(response);
}
callDeleteProductInput();
deleteProductInput(request, options, callback)
deleteProductInput(request: protos.google.shopping.merchant.products.v1.IDeleteProductInputRequest, options: CallOptions, callback: Callback<protos.google.protobuf.IEmpty, protos.google.shopping.merchant.products.v1.IDeleteProductInputRequest | null | undefined, {} | null | undefined>): void;| Parameters | |
|---|---|
| Name | Description |
request |
IDeleteProductInputRequest
|
options |
CallOptions
|
callback |
Callback<protos.google.protobuf.IEmpty, protos.google.shopping.merchant.products.v1.IDeleteProductInputRequest | null | undefined, {} | null | undefined>
|
| Returns | |
|---|---|
| Type | Description |
void |
|
deleteProductInput(request, callback)
deleteProductInput(request: protos.google.shopping.merchant.products.v1.IDeleteProductInputRequest, callback: Callback<protos.google.protobuf.IEmpty, protos.google.shopping.merchant.products.v1.IDeleteProductInputRequest | null | undefined, {} | null | undefined>): void;| Parameters | |
|---|---|
| Name | Description |
request |
IDeleteProductInputRequest
|
callback |
Callback<protos.google.protobuf.IEmpty, protos.google.shopping.merchant.products.v1.IDeleteProductInputRequest | null | undefined, {} | null | undefined>
|
| Returns | |
|---|---|
| Type | Description |
void |
|
getProjectId()
getProjectId(): Promise<string>;| Returns | |
|---|---|
| Type | Description |
Promise<string> |
|
getProjectId(callback)
getProjectId(callback: Callback<string, undefined, undefined>): void;| Parameter | |
|---|---|
| Name | Description |
callback |
Callback<string, undefined, undefined>
|
| Returns | |
|---|---|
| Type | Description |
void |
|
initialize()
initialize(): Promise<{
[name: string]: Function;
}>;Initialize the client. Performs asynchronous operations (such as authentication) and prepares the client. This function will be called automatically when any class method is called for the first time, but if you need to initialize it before calling an actual method, feel free to call initialize() directly.
You can await on this method if you want to make sure the client is initialized.
| Returns | |
|---|---|
| Type | Description |
Promise<{
[name: string]: Function;
}> |
{Promise} A promise that resolves to an authenticated service stub. |
insertProductInput(request, options)
insertProductInput(request?: protos.google.shopping.merchant.products.v1.IInsertProductInputRequest, options?: CallOptions): Promise<[
protos.google.shopping.merchant.products.v1.IProductInput,
(protos.google.shopping.merchant.products.v1.IInsertProductInputRequest | undefined),
{} | undefined
]>;[Uploads a product input to your Merchant Center account](/merchant/api/guides/products/add-manage#add_a_product). You must have a products [data source](/merchant/api/guides/data-sources/api-sources#create-primary-data-source) to be able to insert a product. The unique identifier of the data source is passed as a query parameter in the request URL.
If a product input with the same contentLanguage, offerId, and dataSource already exists, then the product input inserted by this method replaces that entry.
After inserting, updating, or deleting a product input, it may take several minutes before the processed product can be retrieved.
| Parameters | |
|---|---|
| Name | Description |
request |
IInsertProductInputRequest
The request object that will be sent. |
options |
CallOptions
Call options. See CallOptions for more details. |
| Returns | |
|---|---|
| Type | Description |
Promise<[
protos.google.shopping.merchant.products.v1.IProductInput,
(protos.google.shopping.merchant.products.v1.IInsertProductInputRequest | undefined),
{} | undefined
]> |
{Promise} - The promise which resolves to an array. The first element of the array is an object representing ProductInput. Please see the documentation for more details and examples. |
/**
* 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 account where this product will be inserted.
* Format: `accounts/{account}`
*/
// const parent = 'abc123'
/**
* Required. The product input to insert.
*/
// const productInput = {}
/**
* Required. The primary or supplemental product data source name. If the
* product already exists and data source provided is different, then the
* product will be moved to a new data source. For more information, see
* Create a primary data
* source (/merchant/api/guides/data-sources/api-sources#create-primary-data-source).
* Only API data sources are supported.
* Format: `accounts/{account}/dataSources/{datasource}`. For example,
* `accounts/123456/dataSources/104628`.
*/
// const dataSource = 'abc123'
// Imports the Products library
const {ProductInputsServiceClient} = require('@google-shopping/products').v1;
// Instantiates a client
const productsClient = new ProductInputsServiceClient();
async function callInsertProductInput() {
// Construct request
const request = {
parent,
productInput,
dataSource,
};
// Run request
const response = await productsClient.insertProductInput(request);
console.log(response);
}
callInsertProductInput();
insertProductInput(request, options, callback)
insertProductInput(request: protos.google.shopping.merchant.products.v1.IInsertProductInputRequest, options: CallOptions, callback: Callback<protos.google.shopping.merchant.products.v1.IProductInput, protos.google.shopping.merchant.products.v1.IInsertProductInputRequest | null | undefined, {} | null | undefined>): void;| Parameters | |
|---|---|
| Name | Description |
request |
IInsertProductInputRequest
|
options |
CallOptions
|
callback |
Callback<protos.google.shopping.merchant.products.v1.IProductInput, protos.google.shopping.merchant.products.v1.IInsertProductInputRequest | null | undefined, {} | null | undefined>
|
| Returns | |
|---|---|
| Type | Description |
void |
|
insertProductInput(request, callback)
insertProductInput(request: protos.google.shopping.merchant.products.v1.IInsertProductInputRequest, callback: Callback<protos.google.shopping.merchant.products.v1.IProductInput, protos.google.shopping.merchant.products.v1.IInsertProductInputRequest | null | undefined, {} | null | undefined>): void;| Parameters | |
|---|---|
| Name | Description |
request |
IInsertProductInputRequest
|
callback |
Callback<protos.google.shopping.merchant.products.v1.IProductInput, protos.google.shopping.merchant.products.v1.IInsertProductInputRequest | null | undefined, {} | null | undefined>
|
| Returns | |
|---|---|
| Type | Description |
void |
|
matchAccountFromAccountName(accountName)
matchAccountFromAccountName(accountName: string): string | number;Parse the account from Account resource.
| Parameter | |
|---|---|
| Name | Description |
accountName |
string
A fully-qualified path representing Account resource. |
| Returns | |
|---|---|
| Type | Description |
string | number |
{string} A string representing the account. |
matchAccountFromProductInputName(productInputName)
matchAccountFromProductInputName(productInputName: string): string | number;Parse the account from ProductInput resource.
| Parameter | |
|---|---|
| Name | Description |
productInputName |
string
A fully-qualified path representing ProductInput resource. |
| Returns | |
|---|---|
| Type | Description |
string | number |
{string} A string representing the account. |
matchAccountFromProductName(productName)
matchAccountFromProductName(productName: string): string | number;Parse the account from Product resource.
| Parameter | |
|---|---|
| Name | Description |
productName |
string
A fully-qualified path representing Product resource. |
| Returns | |
|---|---|
| Type | Description |
string | number |
{string} A string representing the account. |
matchProductFromProductName(productName)
matchProductFromProductName(productName: string): string | number;Parse the product from Product resource.
| Parameter | |
|---|---|
| Name | Description |
productName |
string
A fully-qualified path representing Product resource. |
| Returns | |
|---|---|
| Type | Description |
string | number |
{string} A string representing the product. |
matchProductinputFromProductInputName(productInputName)
matchProductinputFromProductInputName(productInputName: string): string | number;Parse the productinput from ProductInput resource.
| Parameter | |
|---|---|
| Name | Description |
productInputName |
string
A fully-qualified path representing ProductInput resource. |
| Returns | |
|---|---|
| Type | Description |
string | number |
{string} A string representing the productinput. |
productInputPath(account, productinput)
productInputPath(account: string, productinput: string): string;Return a fully-qualified productInput resource name string.
| Parameters | |
|---|---|
| Name | Description |
account |
string
|
productinput |
string
|
| Returns | |
|---|---|
| Type | Description |
string |
{string} Resource name string. |
productPath(account, product)
productPath(account: string, product: string): string;Return a fully-qualified product resource name string.
| Parameters | |
|---|---|
| Name | Description |
account |
string
|
product |
string
|
| Returns | |
|---|---|
| Type | Description |
string |
{string} Resource name string. |
updateProductInput(request, options)
updateProductInput(request?: protos.google.shopping.merchant.products.v1.IUpdateProductInputRequest, options?: CallOptions): Promise<[
protos.google.shopping.merchant.products.v1.IProductInput,
(protos.google.shopping.merchant.products.v1.IUpdateProductInputRequest | undefined),
{} | undefined
]>;Updates the existing product input in your Merchant Center account. The name of the product input to update is taken from the name field within the ProductInput resource.
After inserting, updating, or deleting a product input, it may take several minutes before the processed product can be retrieved.
| Parameters | |
|---|---|
| Name | Description |
request |
IUpdateProductInputRequest
The request object that will be sent. |
options |
CallOptions
Call options. See CallOptions for more details. |
| Returns | |
|---|---|
| Type | Description |
Promise<[
protos.google.shopping.merchant.products.v1.IProductInput,
(protos.google.shopping.merchant.products.v1.IUpdateProductInputRequest | undefined),
{} | undefined
]> |
{Promise} - The promise which resolves to an array. The first element of the array is an object representing ProductInput. Please see the documentation for more details and examples. |
/**
* 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 product input resource to update. Information you submit will
* be applied to the processed product as well. The `name` field within this
* resource identifies the product input to be updated.
*/
// const productInput = {}
/**
* Optional. The list of 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 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 product replacement is not supported.
*/
// const updateMask = {}
/**
* Required. The primary or supplemental product data source where
* `data_source` name identifies the product input to be updated.
* Only API data sources are supported.
* Format: `accounts/{account}/dataSources/{datasource}`. For example,
* `accounts/123456/dataSources/104628`.
*/
// const dataSource = 'abc123'
// Imports the Products library
const {ProductInputsServiceClient} = require('@google-shopping/products').v1;
// Instantiates a client
const productsClient = new ProductInputsServiceClient();
async function callUpdateProductInput() {
// Construct request
const request = {
productInput,
dataSource,
};
// Run request
const response = await productsClient.updateProductInput(request);
console.log(response);
}
callUpdateProductInput();
updateProductInput(request, options, callback)
updateProductInput(request: protos.google.shopping.merchant.products.v1.IUpdateProductInputRequest, options: CallOptions, callback: Callback<protos.google.shopping.merchant.products.v1.IProductInput, protos.google.shopping.merchant.products.v1.IUpdateProductInputRequest | null | undefined, {} | null | undefined>): void;| Parameters | |
|---|---|
| Name | Description |
request |
IUpdateProductInputRequest
|
options |
CallOptions
|
callback |
Callback<protos.google.shopping.merchant.products.v1.IProductInput, protos.google.shopping.merchant.products.v1.IUpdateProductInputRequest | null | undefined, {} | null | undefined>
|
| Returns | |
|---|---|
| Type | Description |
void |
|
updateProductInput(request, callback)
updateProductInput(request: protos.google.shopping.merchant.products.v1.IUpdateProductInputRequest, callback: Callback<protos.google.shopping.merchant.products.v1.IProductInput, protos.google.shopping.merchant.products.v1.IUpdateProductInputRequest | null | undefined, {} | null | undefined>): void;| Parameters | |
|---|---|
| Name | Description |
request |
IUpdateProductInputRequest
|
callback |
Callback<protos.google.shopping.merchant.products.v1.IProductInput, protos.google.shopping.merchant.products.v1.IUpdateProductInputRequest | null | undefined, {} | null | undefined>
|
| Returns | |
|---|---|
| Type | Description |
void |
|