Class ProductsServiceClient
ProductsService client wrapper, for convenient use.
Namespace: Google.Shopping.Merchant.Products.V1Beta
Assembly: Google.Shopping.Merchant.Products.V1Beta.dll
Syntax
public abstract class ProductsServiceClient
Remarks
Service to use Product resource.
Properties
DefaultEndpoint
The default endpoint for the ProductsService service, which is a host of "merchantapi.googleapis.com" and a port of 443.
Declaration
public static string DefaultEndpoint { get; }
Property Value
| Type | Description |
|---|---|
| string |
DefaultScopes
The default ProductsService scopes.
Declaration
public static IReadOnlyList<string> DefaultScopes { get; }
Property Value
| Type | Description |
|---|---|
| IReadOnlyList<string> |
Remarks
The default ProductsService scopes are:
- https://www.googleapis.com/auth/content
GrpcClient
The underlying gRPC ProductsService client
Declaration
public virtual ProductsService.ProductsServiceClient GrpcClient { get; }
Property Value
| Type | Description |
|---|---|
| ProductsService.ProductsServiceClient |
ServiceMetadata
The service metadata associated with this client type.
Declaration
public static ServiceMetadata ServiceMetadata { get; }
Property Value
| Type | Description |
|---|---|
| ServiceMetadata |
Methods
Create()
Synchronously creates a ProductsServiceClient using the default credentials, endpoint and settings. To specify custom credentials or other settings, use ProductsServiceClientBuilder.
Declaration
public static ProductsServiceClient Create()
Returns
| Type | Description |
|---|---|
| ProductsServiceClient | The created ProductsServiceClient. |
CreateAsync(CancellationToken)
Asynchronously creates a ProductsServiceClient using the default credentials, endpoint and settings. To specify custom credentials or other settings, use ProductsServiceClientBuilder.
Declaration
public static Task<ProductsServiceClient> CreateAsync(CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| CancellationToken | cancellationToken | The CancellationToken to use while creating the client. |
Returns
| Type | Description |
|---|---|
| Task<ProductsServiceClient> | The task representing the created ProductsServiceClient. |
GetProduct(GetProductRequest, CallSettings)
Retrieves the processed product from your Merchant Center account.
After inserting, updating, or deleting a product input, it may take several minutes before the updated final product can be retrieved.
Declaration
public virtual Product GetProduct(GetProductRequest request, CallSettings callSettings = null)
Parameters
| Type | Name | Description |
|---|---|---|
| GetProductRequest | request | The request object containing all of the parameters for the API call. |
| CallSettings | callSettings | If not null, applies overrides to this RPC call. |
Returns
| Type | Description |
|---|---|
| Product | The RPC response. |
Sample code
// Create client
ProductsServiceClient productsServiceClient = ProductsServiceClient.Create();
// Initialize request argument(s)
GetProductRequest request = new GetProductRequest
{
ProductName = ProductName.FromAccountProduct("[ACCOUNT]", "[PRODUCT]"),
};
// Make the request
Product response = productsServiceClient.GetProduct(request);
GetProduct(ProductName, CallSettings)
Retrieves the processed product from your Merchant Center account.
After inserting, updating, or deleting a product input, it may take several minutes before the updated final product can be retrieved.
Declaration
public virtual Product GetProduct(ProductName name, CallSettings callSettings = null)
Parameters
| Type | Name | Description |
|---|---|---|
| ProductName | name | Required. The name of the product to retrieve.
Format: |
| CallSettings | callSettings | If not null, applies overrides to this RPC call. |
Returns
| Type | Description |
|---|---|
| Product | The RPC response. |
Sample code
// Create client
ProductsServiceClient productsServiceClient = ProductsServiceClient.Create();
// Initialize request argument(s)
ProductName name = ProductName.FromAccountProduct("[ACCOUNT]", "[PRODUCT]");
// Make the request
Product response = productsServiceClient.GetProduct(name);
GetProduct(string, CallSettings)
Retrieves the processed product from your Merchant Center account.
After inserting, updating, or deleting a product input, it may take several minutes before the updated final product can be retrieved.
Declaration
public virtual Product GetProduct(string name, CallSettings callSettings = null)
Parameters
| Type | Name | Description |
|---|---|---|
| string | name | Required. The name of the product to retrieve.
Format: |
| CallSettings | callSettings | If not null, applies overrides to this RPC call. |
Returns
| Type | Description |
|---|---|
| Product | The RPC response. |
Sample code
// Create client
ProductsServiceClient productsServiceClient = ProductsServiceClient.Create();
// Initialize request argument(s)
string name = "accounts/[ACCOUNT]/products/[PRODUCT]";
// Make the request
Product response = productsServiceClient.GetProduct(name);
GetProductAsync(GetProductRequest, CallSettings)
Retrieves the processed product from your Merchant Center account.
After inserting, updating, or deleting a product input, it may take several minutes before the updated final product can be retrieved.
Declaration
public virtual Task<Product> GetProductAsync(GetProductRequest request, CallSettings callSettings = null)
Parameters
| Type | Name | Description |
|---|---|---|
| GetProductRequest | request | The request object containing all of the parameters for the API call. |
| CallSettings | callSettings | If not null, applies overrides to this RPC call. |
Returns
| Type | Description |
|---|---|
| Task<Product> | A Task containing the RPC response. |
Sample code
// Create client
ProductsServiceClient productsServiceClient = await ProductsServiceClient.CreateAsync();
// Initialize request argument(s)
GetProductRequest request = new GetProductRequest
{
ProductName = ProductName.FromAccountProduct("[ACCOUNT]", "[PRODUCT]"),
};
// Make the request
Product response = await productsServiceClient.GetProductAsync(request);
GetProductAsync(GetProductRequest, CancellationToken)
Retrieves the processed product from your Merchant Center account.
After inserting, updating, or deleting a product input, it may take several minutes before the updated final product can be retrieved.
Declaration
public virtual Task<Product> GetProductAsync(GetProductRequest request, CancellationToken cancellationToken)
Parameters
| Type | Name | Description |
|---|---|---|
| GetProductRequest | request | The request object containing all of the parameters for the API call. |
| CancellationToken | cancellationToken | A CancellationToken to use for this RPC. |
Returns
| Type | Description |
|---|---|
| Task<Product> | A Task containing the RPC response. |
Sample code
// Create client
ProductsServiceClient productsServiceClient = await ProductsServiceClient.CreateAsync();
// Initialize request argument(s)
GetProductRequest request = new GetProductRequest
{
ProductName = ProductName.FromAccountProduct("[ACCOUNT]", "[PRODUCT]"),
};
// Make the request
Product response = await productsServiceClient.GetProductAsync(request);
GetProductAsync(ProductName, CallSettings)
Retrieves the processed product from your Merchant Center account.
After inserting, updating, or deleting a product input, it may take several minutes before the updated final product can be retrieved.
Declaration
public virtual Task<Product> GetProductAsync(ProductName name, CallSettings callSettings = null)
Parameters
| Type | Name | Description |
|---|---|---|
| ProductName | name | Required. The name of the product to retrieve.
Format: |
| CallSettings | callSettings | If not null, applies overrides to this RPC call. |
Returns
| Type | Description |
|---|---|
| Task<Product> | A Task containing the RPC response. |
Sample code
// Create client
ProductsServiceClient productsServiceClient = await ProductsServiceClient.CreateAsync();
// Initialize request argument(s)
ProductName name = ProductName.FromAccountProduct("[ACCOUNT]", "[PRODUCT]");
// Make the request
Product response = await productsServiceClient.GetProductAsync(name);
GetProductAsync(ProductName, CancellationToken)
Retrieves the processed product from your Merchant Center account.
After inserting, updating, or deleting a product input, it may take several minutes before the updated final product can be retrieved.
Declaration
public virtual Task<Product> GetProductAsync(ProductName name, CancellationToken cancellationToken)
Parameters
| Type | Name | Description |
|---|---|---|
| ProductName | name | Required. The name of the product to retrieve.
Format: |
| CancellationToken | cancellationToken | A CancellationToken to use for this RPC. |
Returns
| Type | Description |
|---|---|
| Task<Product> | A Task containing the RPC response. |
Sample code
// Create client
ProductsServiceClient productsServiceClient = await ProductsServiceClient.CreateAsync();
// Initialize request argument(s)
ProductName name = ProductName.FromAccountProduct("[ACCOUNT]", "[PRODUCT]");
// Make the request
Product response = await productsServiceClient.GetProductAsync(name);
GetProductAsync(string, CallSettings)
Retrieves the processed product from your Merchant Center account.
After inserting, updating, or deleting a product input, it may take several minutes before the updated final product can be retrieved.
Declaration
public virtual Task<Product> GetProductAsync(string name, CallSettings callSettings = null)
Parameters
| Type | Name | Description |
|---|---|---|
| string | name | Required. The name of the product to retrieve.
Format: |
| CallSettings | callSettings | If not null, applies overrides to this RPC call. |
Returns
| Type | Description |
|---|---|
| Task<Product> | A Task containing the RPC response. |
Sample code
// Create client
ProductsServiceClient productsServiceClient = await ProductsServiceClient.CreateAsync();
// Initialize request argument(s)
string name = "accounts/[ACCOUNT]/products/[PRODUCT]";
// Make the request
Product response = await productsServiceClient.GetProductAsync(name);
GetProductAsync(string, CancellationToken)
Retrieves the processed product from your Merchant Center account.
After inserting, updating, or deleting a product input, it may take several minutes before the updated final product can be retrieved.
Declaration
public virtual Task<Product> GetProductAsync(string name, CancellationToken cancellationToken)
Parameters
| Type | Name | Description |
|---|---|---|
| string | name | Required. The name of the product to retrieve.
Format: |
| CancellationToken | cancellationToken | A CancellationToken to use for this RPC. |
Returns
| Type | Description |
|---|---|
| Task<Product> | A Task containing the RPC response. |
Sample code
// Create client
ProductsServiceClient productsServiceClient = await ProductsServiceClient.CreateAsync();
// Initialize request argument(s)
string name = "accounts/[ACCOUNT]/products/[PRODUCT]";
// Make the request
Product response = await productsServiceClient.GetProductAsync(name);
ListProducts(AccountName, string, int?, CallSettings)
Lists the processed products in your Merchant Center account. The response
might contain fewer items than specified by pageSize. Rely on pageToken
to determine if there are more items to be requested.
After inserting, updating, or deleting a product input, it may take several minutes before the updated processed product can be retrieved.
Declaration
public virtual PagedEnumerable<ListProductsResponse, Product> ListProducts(AccountName parent, string pageToken = null, int? pageSize = null, CallSettings callSettings = null)
Parameters
| Type | Name | Description |
|---|---|---|
| AccountName | parent | Required. The account to list processed products for.
Format: |
| string | pageToken | The token returned from the previous request. A value of |
| int? | pageSize | The size of page to request. The response will not be larger than this, but may be smaller. A value of
|
| CallSettings | callSettings | If not null, applies overrides to this RPC call. |
Returns
| Type | Description |
|---|---|
| PagedEnumerable<ListProductsResponse, Product> | A pageable sequence of Product resources. |
Sample code
// Create client
ProductsServiceClient productsServiceClient = ProductsServiceClient.Create();
// Initialize request argument(s)
AccountName parent = AccountName.FromAccount("[ACCOUNT]");
// Make the request
PagedEnumerable<ListProductsResponse, Product> response = productsServiceClient.ListProducts(parent);
// Iterate over all response items, lazily performing RPCs as required
foreach (Product item in response)
{
// Do something with each item
Console.WriteLine(item);
}
// Or iterate over pages (of server-defined size), performing one RPC per page
foreach (ListProductsResponse page in response.AsRawResponses())
{
// Do something with each page of items
Console.WriteLine("A page of results:");
foreach (Product item in page)
{
// Do something with each item
Console.WriteLine(item);
}
}
// Or retrieve a single page of known size (unless it's the final page), performing as many RPCs as required
int pageSize = 10;
Page<Product> singlePage = response.ReadPage(pageSize);
// Do something with the page of items
Console.WriteLine($"A page of {pageSize} results (unless it's the final page):");
foreach (Product item in singlePage)
{
// Do something with each item
Console.WriteLine(item);
}
// Store the pageToken, for when the next page is required.
string nextPageToken = singlePage.NextPageToken;
ListProducts(ListProductsRequest, CallSettings)
Lists the processed products in your Merchant Center account. The response
might contain fewer items than specified by pageSize. Rely on pageToken
to determine if there are more items to be requested.
After inserting, updating, or deleting a product input, it may take several minutes before the updated processed product can be retrieved.
Declaration
public virtual PagedEnumerable<ListProductsResponse, Product> ListProducts(ListProductsRequest request, CallSettings callSettings = null)
Parameters
| Type | Name | Description |
|---|---|---|
| ListProductsRequest | request | The request object containing all of the parameters for the API call. |
| CallSettings | callSettings | If not null, applies overrides to this RPC call. |
Returns
| Type | Description |
|---|---|
| PagedEnumerable<ListProductsResponse, Product> | A pageable sequence of Product resources. |
Sample code
// Create client
ProductsServiceClient productsServiceClient = ProductsServiceClient.Create();
// Initialize request argument(s)
ListProductsRequest request = new ListProductsRequest
{
ParentAsAccountName = AccountName.FromAccount("[ACCOUNT]"),
};
// Make the request
PagedEnumerable<ListProductsResponse, Product> response = productsServiceClient.ListProducts(request);
// Iterate over all response items, lazily performing RPCs as required
foreach (Product item in response)
{
// Do something with each item
Console.WriteLine(item);
}
// Or iterate over pages (of server-defined size), performing one RPC per page
foreach (ListProductsResponse page in response.AsRawResponses())
{
// Do something with each page of items
Console.WriteLine("A page of results:");
foreach (Product item in page)
{
// Do something with each item
Console.WriteLine(item);
}
}
// Or retrieve a single page of known size (unless it's the final page), performing as many RPCs as required
int pageSize = 10;
Page<Product> singlePage = response.ReadPage(pageSize);
// Do something with the page of items
Console.WriteLine($"A page of {pageSize} results (unless it's the final page):");
foreach (Product item in singlePage)
{
// Do something with each item
Console.WriteLine(item);
}
// Store the pageToken, for when the next page is required.
string nextPageToken = singlePage.NextPageToken;
ListProducts(string, string, int?, CallSettings)
Lists the processed products in your Merchant Center account. The response
might contain fewer items than specified by pageSize. Rely on pageToken
to determine if there are more items to be requested.
After inserting, updating, or deleting a product input, it may take several minutes before the updated processed product can be retrieved.
Declaration
public virtual PagedEnumerable<ListProductsResponse, Product> ListProducts(string parent, string pageToken = null, int? pageSize = null, CallSettings callSettings = null)
Parameters
| Type | Name | Description |
|---|---|---|
| string | parent | Required. The account to list processed products for.
Format: |
| string | pageToken | The token returned from the previous request. A value of |
| int? | pageSize | The size of page to request. The response will not be larger than this, but may be smaller. A value of
|
| CallSettings | callSettings | If not null, applies overrides to this RPC call. |
Returns
| Type | Description |
|---|---|
| PagedEnumerable<ListProductsResponse, Product> | A pageable sequence of Product resources. |
Sample code
// Create client
ProductsServiceClient productsServiceClient = ProductsServiceClient.Create();
// Initialize request argument(s)
string parent = "accounts/[ACCOUNT]";
// Make the request
PagedEnumerable<ListProductsResponse, Product> response = productsServiceClient.ListProducts(parent);
// Iterate over all response items, lazily performing RPCs as required
foreach (Product item in response)
{
// Do something with each item
Console.WriteLine(item);
}
// Or iterate over pages (of server-defined size), performing one RPC per page
foreach (ListProductsResponse page in response.AsRawResponses())
{
// Do something with each page of items
Console.WriteLine("A page of results:");
foreach (Product item in page)
{
// Do something with each item
Console.WriteLine(item);
}
}
// Or retrieve a single page of known size (unless it's the final page), performing as many RPCs as required
int pageSize = 10;
Page<Product> singlePage = response.ReadPage(pageSize);
// Do something with the page of items
Console.WriteLine($"A page of {pageSize} results (unless it's the final page):");
foreach (Product item in singlePage)
{
// Do something with each item
Console.WriteLine(item);
}
// Store the pageToken, for when the next page is required.
string nextPageToken = singlePage.NextPageToken;
ListProductsAsync(AccountName, string, int?, CallSettings)
Lists the processed products in your Merchant Center account. The response
might contain fewer items than specified by pageSize. Rely on pageToken
to determine if there are more items to be requested.
After inserting, updating, or deleting a product input, it may take several minutes before the updated processed product can be retrieved.
Declaration
public virtual PagedAsyncEnumerable<ListProductsResponse, Product> ListProductsAsync(AccountName parent, string pageToken = null, int? pageSize = null, CallSettings callSettings = null)
Parameters
| Type | Name | Description |
|---|---|---|
| AccountName | parent | Required. The account to list processed products for.
Format: |
| string | pageToken | The token returned from the previous request. A value of |
| int? | pageSize | The size of page to request. The response will not be larger than this, but may be smaller. A value of
|
| CallSettings | callSettings | If not null, applies overrides to this RPC call. |
Returns
| Type | Description |
|---|---|
| PagedAsyncEnumerable<ListProductsResponse, Product> | A pageable asynchronous sequence of Product resources. |
Sample code
// Create client
ProductsServiceClient productsServiceClient = await ProductsServiceClient.CreateAsync();
// Initialize request argument(s)
AccountName parent = AccountName.FromAccount("[ACCOUNT]");
// Make the request
PagedAsyncEnumerable<ListProductsResponse, Product> response = productsServiceClient.ListProductsAsync(parent);
// Iterate over all response items, lazily performing RPCs as required
await response.ForEachAsync((Product item) =>
{
// Do something with each item
Console.WriteLine(item);
});
// Or iterate over pages (of server-defined size), performing one RPC per page
await response.AsRawResponses().ForEachAsync((ListProductsResponse page) =>
{
// Do something with each page of items
Console.WriteLine("A page of results:");
foreach (Product item in page)
{
// Do something with each item
Console.WriteLine(item);
}
});
// Or retrieve a single page of known size (unless it's the final page), performing as many RPCs as required
int pageSize = 10;
Page<Product> singlePage = await response.ReadPageAsync(pageSize);
// Do something with the page of items
Console.WriteLine($"A page of {pageSize} results (unless it's the final page):");
foreach (Product item in singlePage)
{
// Do something with each item
Console.WriteLine(item);
}
// Store the pageToken, for when the next page is required.
string nextPageToken = singlePage.NextPageToken;
ListProductsAsync(ListProductsRequest, CallSettings)
Lists the processed products in your Merchant Center account. The response
might contain fewer items than specified by pageSize. Rely on pageToken
to determine if there are more items to be requested.
After inserting, updating, or deleting a product input, it may take several minutes before the updated processed product can be retrieved.
Declaration
public virtual PagedAsyncEnumerable<ListProductsResponse, Product> ListProductsAsync(ListProductsRequest request, CallSettings callSettings = null)
Parameters
| Type | Name | Description |
|---|---|---|
| ListProductsRequest | request | The request object containing all of the parameters for the API call. |
| CallSettings | callSettings | If not null, applies overrides to this RPC call. |
Returns
| Type | Description |
|---|---|
| PagedAsyncEnumerable<ListProductsResponse, Product> | A pageable asynchronous sequence of Product resources. |
Sample code
// Create client
ProductsServiceClient productsServiceClient = await ProductsServiceClient.CreateAsync();
// Initialize request argument(s)
ListProductsRequest request = new ListProductsRequest
{
ParentAsAccountName = AccountName.FromAccount("[ACCOUNT]"),
};
// Make the request
PagedAsyncEnumerable<ListProductsResponse, Product> response = productsServiceClient.ListProductsAsync(request);
// Iterate over all response items, lazily performing RPCs as required
await response.ForEachAsync((Product item) =>
{
// Do something with each item
Console.WriteLine(item);
});
// Or iterate over pages (of server-defined size), performing one RPC per page
await response.AsRawResponses().ForEachAsync((ListProductsResponse page) =>
{
// Do something with each page of items
Console.WriteLine("A page of results:");
foreach (Product item in page)
{
// Do something with each item
Console.WriteLine(item);
}
});
// Or retrieve a single page of known size (unless it's the final page), performing as many RPCs as required
int pageSize = 10;
Page<Product> singlePage = await response.ReadPageAsync(pageSize);
// Do something with the page of items
Console.WriteLine($"A page of {pageSize} results (unless it's the final page):");
foreach (Product item in singlePage)
{
// Do something with each item
Console.WriteLine(item);
}
// Store the pageToken, for when the next page is required.
string nextPageToken = singlePage.NextPageToken;
ListProductsAsync(string, string, int?, CallSettings)
Lists the processed products in your Merchant Center account. The response
might contain fewer items than specified by pageSize. Rely on pageToken
to determine if there are more items to be requested.
After inserting, updating, or deleting a product input, it may take several minutes before the updated processed product can be retrieved.
Declaration
public virtual PagedAsyncEnumerable<ListProductsResponse, Product> ListProductsAsync(string parent, string pageToken = null, int? pageSize = null, CallSettings callSettings = null)
Parameters
| Type | Name | Description |
|---|---|---|
| string | parent | Required. The account to list processed products for.
Format: |
| string | pageToken | The token returned from the previous request. A value of |
| int? | pageSize | The size of page to request. The response will not be larger than this, but may be smaller. A value of
|
| CallSettings | callSettings | If not null, applies overrides to this RPC call. |
Returns
| Type | Description |
|---|---|
| PagedAsyncEnumerable<ListProductsResponse, Product> | A pageable asynchronous sequence of Product resources. |
Sample code
// Create client
ProductsServiceClient productsServiceClient = await ProductsServiceClient.CreateAsync();
// Initialize request argument(s)
string parent = "accounts/[ACCOUNT]";
// Make the request
PagedAsyncEnumerable<ListProductsResponse, Product> response = productsServiceClient.ListProductsAsync(parent);
// Iterate over all response items, lazily performing RPCs as required
await response.ForEachAsync((Product item) =>
{
// Do something with each item
Console.WriteLine(item);
});
// Or iterate over pages (of server-defined size), performing one RPC per page
await response.AsRawResponses().ForEachAsync((ListProductsResponse page) =>
{
// Do something with each page of items
Console.WriteLine("A page of results:");
foreach (Product item in page)
{
// Do something with each item
Console.WriteLine(item);
}
});
// Or retrieve a single page of known size (unless it's the final page), performing as many RPCs as required
int pageSize = 10;
Page<Product> singlePage = await response.ReadPageAsync(pageSize);
// Do something with the page of items
Console.WriteLine($"A page of {pageSize} results (unless it's the final page):");
foreach (Product item in singlePage)
{
// Do something with each item
Console.WriteLine(item);
}
// Store the pageToken, for when the next page is required.
string nextPageToken = singlePage.NextPageToken;
ShutdownDefaultChannelsAsync()
Shuts down any channels automatically created by Create() and CreateAsync(CancellationToken). Channels which weren't automatically created are not affected.
Declaration
public static Task ShutdownDefaultChannelsAsync()
Returns
| Type | Description |
|---|---|
| Task | A task representing the asynchronous shutdown operation. |
Remarks
After calling this method, further calls to Create() and CreateAsync(CancellationToken) will create new channels, which could in turn be shut down by another call to this method.