Show / Hide Table of Contents

Class ProductsServiceClient

ProductsService client wrapper, for convenient use.

Inheritance
object
ProductsServiceClient
ProductsServiceClientImpl
Inherited Members
object.GetHashCode()
object.GetType()
object.MemberwiseClone()
object.ToString()
Namespace: Google.Shopping.Merchant.Products.V1
Assembly: Google.Shopping.Merchant.Products.V1.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. Format: accounts/{account}/products/{product}

The {product} 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 {product} segment in the URL is automatically detected by the server, supporting two options:

  1. Encoded Format: The {product} 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 {product} segment must be the base64url encoding of this string, which is ZW5-VVMtc2t1LzEyMw. The full resource name for the product would be accounts/123/products/ZW5-VVMtc2t1LzEyMw.
  1. Plain Format: The {product} 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 {product} segment is used to differentiate between the two formats.

Note: For calls to the v1beta version, the plain format is channel~content_language~feed_label~offer_id, for example: accounts/123/products/online~en~US~sku123.

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. Format: accounts/{account}/products/{product}

The {product} 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 {product} segment in the URL is automatically detected by the server, supporting two options:

  1. Encoded Format: The {product} 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 {product} segment must be the base64url encoding of this string, which is ZW5-VVMtc2t1LzEyMw. The full resource name for the product would be accounts/123/products/ZW5-VVMtc2t1LzEyMw.
  1. Plain Format: The {product} 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 {product} segment is used to differentiate between the two formats.

Note: For calls to the v1beta version, the plain format is channel~content_language~feed_label~offer_id, for example: accounts/123/products/online~en~US~sku123.

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. Format: accounts/{account}/products/{product}

The {product} 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 {product} segment in the URL is automatically detected by the server, supporting two options:

  1. Encoded Format: The {product} 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 {product} segment must be the base64url encoding of this string, which is ZW5-VVMtc2t1LzEyMw. The full resource name for the product would be accounts/123/products/ZW5-VVMtc2t1LzEyMw.
  1. Plain Format: The {product} 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 {product} segment is used to differentiate between the two formats.

Note: For calls to the v1beta version, the plain format is channel~content_language~feed_label~offer_id, for example: accounts/123/products/online~en~US~sku123.

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. Format: accounts/{account}/products/{product}

The {product} 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 {product} segment in the URL is automatically detected by the server, supporting two options:

  1. Encoded Format: The {product} 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 {product} segment must be the base64url encoding of this string, which is ZW5-VVMtc2t1LzEyMw. The full resource name for the product would be accounts/123/products/ZW5-VVMtc2t1LzEyMw.
  1. Plain Format: The {product} 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 {product} segment is used to differentiate between the two formats.

Note: For calls to the v1beta version, the plain format is channel~content_language~feed_label~offer_id, for example: accounts/123/products/online~en~US~sku123.

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. Format: accounts/{account}/products/{product}

The {product} 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 {product} segment in the URL is automatically detected by the server, supporting two options:

  1. Encoded Format: The {product} 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 {product} segment must be the base64url encoding of this string, which is ZW5-VVMtc2t1LzEyMw. The full resource name for the product would be accounts/123/products/ZW5-VVMtc2t1LzEyMw.
  1. Plain Format: The {product} 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 {product} segment is used to differentiate between the two formats.

Note: For calls to the v1beta version, the plain format is channel~content_language~feed_label~offer_id, for example: accounts/123/products/online~en~US~sku123.

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. Format: accounts/{account}/products/{product}

The {product} 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 {product} segment in the URL is automatically detected by the server, supporting two options:

  1. Encoded Format: The {product} 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 {product} segment must be the base64url encoding of this string, which is ZW5-VVMtc2t1LzEyMw. The full resource name for the product would be accounts/123/products/ZW5-VVMtc2t1LzEyMw.
  1. Plain Format: The {product} 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 {product} segment is used to differentiate between the two formats.

Note: For calls to the v1beta version, the plain format is channel~content_language~feed_label~offer_id, for example: accounts/123/products/online~en~US~sku123.

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: accounts/{account}

string pageToken

The token returned from the previous request. A value of null or an empty string retrieves the first page.

int? pageSize

The size of page to request. The response will not be larger than this, but may be smaller. A value of null or 0 uses a server-defined page size.

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: accounts/{account}

string pageToken

The token returned from the previous request. A value of null or an empty string retrieves the first page.

int? pageSize

The size of page to request. The response will not be larger than this, but may be smaller. A value of null or 0 uses a server-defined page size.

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: accounts/{account}

string pageToken

The token returned from the previous request. A value of null or an empty string retrieves the first page.

int? pageSize

The size of page to request. The response will not be larger than this, but may be smaller. A value of null or 0 uses a server-defined page size.

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 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
await 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 = 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 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
await 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 = 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: accounts/{account}

string pageToken

The token returned from the previous request. A value of null or an empty string retrieves the first page.

int? pageSize

The size of page to request. The response will not be larger than this, but may be smaller. A value of null or 0 uses a server-defined page size.

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 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
await 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 = 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.

In this article
Back to top Generated by DocFX