Class RegionalInventoryServiceClient
RegionalInventoryService client wrapper, for convenient use.
Namespace: Google.Shopping.Merchant.Inventories.V1
Assembly: Google.Shopping.Merchant.Inventories.V1.dll
Syntax
public abstract class RegionalInventoryServiceClient
Remarks
Service to manage regional inventory for products. There is also separate
regions resource and API to manage regions definitions.
Properties
DefaultEndpoint
The default endpoint for the RegionalInventoryService 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 RegionalInventoryService scopes.
Declaration
public static IReadOnlyList<string> DefaultScopes { get; }
Property Value
| Type | Description |
|---|---|
| IReadOnlyList<string> |
Remarks
The default RegionalInventoryService scopes are:
- https://www.googleapis.com/auth/content
GrpcClient
The underlying gRPC RegionalInventoryService client
Declaration
public virtual RegionalInventoryService.RegionalInventoryServiceClient GrpcClient { get; }
Property Value
| Type | Description |
|---|---|
| RegionalInventoryService.RegionalInventoryServiceClient |
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 RegionalInventoryServiceClient using the default credentials, endpoint and settings. To specify custom credentials or other settings, use RegionalInventoryServiceClientBuilder.
Declaration
public static RegionalInventoryServiceClient Create()
Returns
| Type | Description |
|---|---|
| RegionalInventoryServiceClient | The created RegionalInventoryServiceClient. |
CreateAsync(CancellationToken)
Asynchronously creates a RegionalInventoryServiceClient using the default credentials, endpoint and settings. To specify custom credentials or other settings, use RegionalInventoryServiceClientBuilder.
Declaration
public static Task<RegionalInventoryServiceClient> CreateAsync(CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| CancellationToken | cancellationToken | The CancellationToken to use while creating the client. |
Returns
| Type | Description |
|---|---|
| Task<RegionalInventoryServiceClient> | The task representing the created RegionalInventoryServiceClient. |
DeleteRegionalInventory(DeleteRegionalInventoryRequest, CallSettings)
Deletes the specified RegionalInventory resource from the given product
in your merchant account. It might take up to an hour for the
RegionalInventory to be deleted from the specific product.
Once you have received a successful delete response, wait for that
period before attempting a delete again.
Declaration
public virtual void DeleteRegionalInventory(DeleteRegionalInventoryRequest request, CallSettings callSettings = null)
Parameters
| Type | Name | Description |
|---|---|---|
| DeleteRegionalInventoryRequest | request | The request object containing all of the parameters for the API call. |
| CallSettings | callSettings | If not null, applies overrides to this RPC call. |
Sample code
// Create client
RegionalInventoryServiceClient regionalInventoryServiceClient = RegionalInventoryServiceClient.Create();
// Initialize request argument(s)
DeleteRegionalInventoryRequest request = new DeleteRegionalInventoryRequest
{
RegionalInventoryName = RegionalInventoryName.FromAccountProductRegion("[ACCOUNT]", "[PRODUCT]", "[REGION]"),
};
// Make the request
regionalInventoryServiceClient.DeleteRegionalInventory(request);
DeleteRegionalInventory(RegionalInventoryName, CallSettings)
Deletes the specified RegionalInventory resource from the given product
in your merchant account. It might take up to an hour for the
RegionalInventory to be deleted from the specific product.
Once you have received a successful delete response, wait for that
period before attempting a delete again.
Declaration
public virtual void DeleteRegionalInventory(RegionalInventoryName name, CallSettings callSettings = null)
Parameters
| Type | Name | Description |
|---|---|---|
| RegionalInventoryName | name | Required. The name of the |
| CallSettings | callSettings | If not null, applies overrides to this RPC call. |
Sample code
// Create client
RegionalInventoryServiceClient regionalInventoryServiceClient = RegionalInventoryServiceClient.Create();
// Initialize request argument(s)
RegionalInventoryName name = RegionalInventoryName.FromAccountProductRegion("[ACCOUNT]", "[PRODUCT]", "[REGION]");
// Make the request
regionalInventoryServiceClient.DeleteRegionalInventory(name);
DeleteRegionalInventory(string, CallSettings)
Deletes the specified RegionalInventory resource from the given product
in your merchant account. It might take up to an hour for the
RegionalInventory to be deleted from the specific product.
Once you have received a successful delete response, wait for that
period before attempting a delete again.
Declaration
public virtual void DeleteRegionalInventory(string name, CallSettings callSettings = null)
Parameters
| Type | Name | Description |
|---|---|---|
| string | name | Required. The name of the |
| CallSettings | callSettings | If not null, applies overrides to this RPC call. |
Sample code
// Create client
RegionalInventoryServiceClient regionalInventoryServiceClient = RegionalInventoryServiceClient.Create();
// Initialize request argument(s)
string name = "accounts/[ACCOUNT]/products/[PRODUCT]/regionalInventories/[REGION]";
// Make the request
regionalInventoryServiceClient.DeleteRegionalInventory(name);
DeleteRegionalInventoryAsync(DeleteRegionalInventoryRequest, CallSettings)
Deletes the specified RegionalInventory resource from the given product
in your merchant account. It might take up to an hour for the
RegionalInventory to be deleted from the specific product.
Once you have received a successful delete response, wait for that
period before attempting a delete again.
Declaration
public virtual Task DeleteRegionalInventoryAsync(DeleteRegionalInventoryRequest request, CallSettings callSettings = null)
Parameters
| Type | Name | Description |
|---|---|---|
| DeleteRegionalInventoryRequest | 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 | A Task containing the RPC response. |
Sample code
// Create client
RegionalInventoryServiceClient regionalInventoryServiceClient = await RegionalInventoryServiceClient.CreateAsync();
// Initialize request argument(s)
DeleteRegionalInventoryRequest request = new DeleteRegionalInventoryRequest
{
RegionalInventoryName = RegionalInventoryName.FromAccountProductRegion("[ACCOUNT]", "[PRODUCT]", "[REGION]"),
};
// Make the request
await regionalInventoryServiceClient.DeleteRegionalInventoryAsync(request);
DeleteRegionalInventoryAsync(DeleteRegionalInventoryRequest, CancellationToken)
Deletes the specified RegionalInventory resource from the given product
in your merchant account. It might take up to an hour for the
RegionalInventory to be deleted from the specific product.
Once you have received a successful delete response, wait for that
period before attempting a delete again.
Declaration
public virtual Task DeleteRegionalInventoryAsync(DeleteRegionalInventoryRequest request, CancellationToken cancellationToken)
Parameters
| Type | Name | Description |
|---|---|---|
| DeleteRegionalInventoryRequest | 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 | A Task containing the RPC response. |
Sample code
// Create client
RegionalInventoryServiceClient regionalInventoryServiceClient = await RegionalInventoryServiceClient.CreateAsync();
// Initialize request argument(s)
DeleteRegionalInventoryRequest request = new DeleteRegionalInventoryRequest
{
RegionalInventoryName = RegionalInventoryName.FromAccountProductRegion("[ACCOUNT]", "[PRODUCT]", "[REGION]"),
};
// Make the request
await regionalInventoryServiceClient.DeleteRegionalInventoryAsync(request);
DeleteRegionalInventoryAsync(RegionalInventoryName, CallSettings)
Deletes the specified RegionalInventory resource from the given product
in your merchant account. It might take up to an hour for the
RegionalInventory to be deleted from the specific product.
Once you have received a successful delete response, wait for that
period before attempting a delete again.
Declaration
public virtual Task DeleteRegionalInventoryAsync(RegionalInventoryName name, CallSettings callSettings = null)
Parameters
| Type | Name | Description |
|---|---|---|
| RegionalInventoryName | name | Required. The name of the |
| CallSettings | callSettings | If not null, applies overrides to this RPC call. |
Returns
| Type | Description |
|---|---|
| Task | A Task containing the RPC response. |
Sample code
// Create client
RegionalInventoryServiceClient regionalInventoryServiceClient = await RegionalInventoryServiceClient.CreateAsync();
// Initialize request argument(s)
RegionalInventoryName name = RegionalInventoryName.FromAccountProductRegion("[ACCOUNT]", "[PRODUCT]", "[REGION]");
// Make the request
await regionalInventoryServiceClient.DeleteRegionalInventoryAsync(name);
DeleteRegionalInventoryAsync(RegionalInventoryName, CancellationToken)
Deletes the specified RegionalInventory resource from the given product
in your merchant account. It might take up to an hour for the
RegionalInventory to be deleted from the specific product.
Once you have received a successful delete response, wait for that
period before attempting a delete again.
Declaration
public virtual Task DeleteRegionalInventoryAsync(RegionalInventoryName name, CancellationToken cancellationToken)
Parameters
| Type | Name | Description |
|---|---|---|
| RegionalInventoryName | name | Required. The name of the |
| CancellationToken | cancellationToken | A CancellationToken to use for this RPC. |
Returns
| Type | Description |
|---|---|
| Task | A Task containing the RPC response. |
Sample code
// Create client
RegionalInventoryServiceClient regionalInventoryServiceClient = await RegionalInventoryServiceClient.CreateAsync();
// Initialize request argument(s)
RegionalInventoryName name = RegionalInventoryName.FromAccountProductRegion("[ACCOUNT]", "[PRODUCT]", "[REGION]");
// Make the request
await regionalInventoryServiceClient.DeleteRegionalInventoryAsync(name);
DeleteRegionalInventoryAsync(string, CallSettings)
Deletes the specified RegionalInventory resource from the given product
in your merchant account. It might take up to an hour for the
RegionalInventory to be deleted from the specific product.
Once you have received a successful delete response, wait for that
period before attempting a delete again.
Declaration
public virtual Task DeleteRegionalInventoryAsync(string name, CallSettings callSettings = null)
Parameters
| Type | Name | Description |
|---|---|---|
| string | name | Required. The name of the |
| CallSettings | callSettings | If not null, applies overrides to this RPC call. |
Returns
| Type | Description |
|---|---|
| Task | A Task containing the RPC response. |
Sample code
// Create client
RegionalInventoryServiceClient regionalInventoryServiceClient = await RegionalInventoryServiceClient.CreateAsync();
// Initialize request argument(s)
string name = "accounts/[ACCOUNT]/products/[PRODUCT]/regionalInventories/[REGION]";
// Make the request
await regionalInventoryServiceClient.DeleteRegionalInventoryAsync(name);
DeleteRegionalInventoryAsync(string, CancellationToken)
Deletes the specified RegionalInventory resource from the given product
in your merchant account. It might take up to an hour for the
RegionalInventory to be deleted from the specific product.
Once you have received a successful delete response, wait for that
period before attempting a delete again.
Declaration
public virtual Task DeleteRegionalInventoryAsync(string name, CancellationToken cancellationToken)
Parameters
| Type | Name | Description |
|---|---|---|
| string | name | Required. The name of the |
| CancellationToken | cancellationToken | A CancellationToken to use for this RPC. |
Returns
| Type | Description |
|---|---|
| Task | A Task containing the RPC response. |
Sample code
// Create client
RegionalInventoryServiceClient regionalInventoryServiceClient = await RegionalInventoryServiceClient.CreateAsync();
// Initialize request argument(s)
string name = "accounts/[ACCOUNT]/products/[PRODUCT]/regionalInventories/[REGION]";
// Make the request
await regionalInventoryServiceClient.DeleteRegionalInventoryAsync(name);
InsertRegionalInventory(InsertRegionalInventoryRequest, CallSettings)
Inserts a RegionalInventory to a given product in your
merchant account.
Replaces the full RegionalInventory resource if an entry with the same
[region][google.shopping.merchant.inventories.v1.RegionalInventory.region]
already exists for the product.
It might take up to 30 minutes for the new or updated RegionalInventory
resource to appear in products.
Declaration
public virtual RegionalInventory InsertRegionalInventory(InsertRegionalInventoryRequest request, CallSettings callSettings = null)
Parameters
| Type | Name | Description |
|---|---|---|
| InsertRegionalInventoryRequest | 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 |
|---|---|
| RegionalInventory | The RPC response. |
Sample code
// Create client
RegionalInventoryServiceClient regionalInventoryServiceClient = RegionalInventoryServiceClient.Create();
// Initialize request argument(s)
InsertRegionalInventoryRequest request = new InsertRegionalInventoryRequest
{
ParentAsProductName = ProductName.FromAccountProduct("[ACCOUNT]", "[PRODUCT]"),
RegionalInventory = new RegionalInventory(),
};
// Make the request
RegionalInventory response = regionalInventoryServiceClient.InsertRegionalInventory(request);
InsertRegionalInventoryAsync(InsertRegionalInventoryRequest, CallSettings)
Inserts a RegionalInventory to a given product in your
merchant account.
Replaces the full RegionalInventory resource if an entry with the same
[region][google.shopping.merchant.inventories.v1.RegionalInventory.region]
already exists for the product.
It might take up to 30 minutes for the new or updated RegionalInventory
resource to appear in products.
Declaration
public virtual Task<RegionalInventory> InsertRegionalInventoryAsync(InsertRegionalInventoryRequest request, CallSettings callSettings = null)
Parameters
| Type | Name | Description |
|---|---|---|
| InsertRegionalInventoryRequest | 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<RegionalInventory> | A Task containing the RPC response. |
Sample code
// Create client
RegionalInventoryServiceClient regionalInventoryServiceClient = await RegionalInventoryServiceClient.CreateAsync();
// Initialize request argument(s)
InsertRegionalInventoryRequest request = new InsertRegionalInventoryRequest
{
ParentAsProductName = ProductName.FromAccountProduct("[ACCOUNT]", "[PRODUCT]"),
RegionalInventory = new RegionalInventory(),
};
// Make the request
RegionalInventory response = await regionalInventoryServiceClient.InsertRegionalInventoryAsync(request);
InsertRegionalInventoryAsync(InsertRegionalInventoryRequest, CancellationToken)
Inserts a RegionalInventory to a given product in your
merchant account.
Replaces the full RegionalInventory resource if an entry with the same
[region][google.shopping.merchant.inventories.v1.RegionalInventory.region]
already exists for the product.
It might take up to 30 minutes for the new or updated RegionalInventory
resource to appear in products.
Declaration
public virtual Task<RegionalInventory> InsertRegionalInventoryAsync(InsertRegionalInventoryRequest request, CancellationToken cancellationToken)
Parameters
| Type | Name | Description |
|---|---|---|
| InsertRegionalInventoryRequest | 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<RegionalInventory> | A Task containing the RPC response. |
Sample code
// Create client
RegionalInventoryServiceClient regionalInventoryServiceClient = await RegionalInventoryServiceClient.CreateAsync();
// Initialize request argument(s)
InsertRegionalInventoryRequest request = new InsertRegionalInventoryRequest
{
ParentAsProductName = ProductName.FromAccountProduct("[ACCOUNT]", "[PRODUCT]"),
RegionalInventory = new RegionalInventory(),
};
// Make the request
RegionalInventory response = await regionalInventoryServiceClient.InsertRegionalInventoryAsync(request);
ListRegionalInventories(ListRegionalInventoriesRequest, CallSettings)
Lists the RegionalInventory resources for the given product in your
merchant account. The response might contain fewer items than specified by
pageSize. If pageToken was returned in previous request, it can be
used to obtain additional results.
RegionalInventory resources are listed per product for a given account.
Declaration
public virtual PagedEnumerable<ListRegionalInventoriesResponse, RegionalInventory> ListRegionalInventories(ListRegionalInventoriesRequest request, CallSettings callSettings = null)
Parameters
| Type | Name | Description |
|---|---|---|
| ListRegionalInventoriesRequest | 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<ListRegionalInventoriesResponse, RegionalInventory> | A pageable sequence of RegionalInventory resources. |
Sample code
// Create client
RegionalInventoryServiceClient regionalInventoryServiceClient = RegionalInventoryServiceClient.Create();
// Initialize request argument(s)
ListRegionalInventoriesRequest request = new ListRegionalInventoriesRequest
{
ParentAsProductName = ProductName.FromAccountProduct("[ACCOUNT]", "[PRODUCT]"),
};
// Make the request
PagedEnumerable<ListRegionalInventoriesResponse, RegionalInventory> response = regionalInventoryServiceClient.ListRegionalInventories(request);
// Iterate over all response items, lazily performing RPCs as required
foreach (RegionalInventory 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 (ListRegionalInventoriesResponse page in response.AsRawResponses())
{
// Do something with each page of items
Console.WriteLine("A page of results:");
foreach (RegionalInventory 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<RegionalInventory> 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 (RegionalInventory 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;
ListRegionalInventories(ProductName, string, int?, CallSettings)
Lists the RegionalInventory resources for the given product in your
merchant account. The response might contain fewer items than specified by
pageSize. If pageToken was returned in previous request, it can be
used to obtain additional results.
RegionalInventory resources are listed per product for a given account.
Declaration
public virtual PagedEnumerable<ListRegionalInventoriesResponse, RegionalInventory> ListRegionalInventories(ProductName parent, string pageToken = null, int? pageSize = null, CallSettings callSettings = null)
Parameters
| Type | Name | Description |
|---|---|---|
| ProductName | parent | Required. The |
| 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<ListRegionalInventoriesResponse, RegionalInventory> | A pageable sequence of RegionalInventory resources. |
Sample code
// Create client
RegionalInventoryServiceClient regionalInventoryServiceClient = RegionalInventoryServiceClient.Create();
// Initialize request argument(s)
ProductName parent = ProductName.FromAccountProduct("[ACCOUNT]", "[PRODUCT]");
// Make the request
PagedEnumerable<ListRegionalInventoriesResponse, RegionalInventory> response = regionalInventoryServiceClient.ListRegionalInventories(parent);
// Iterate over all response items, lazily performing RPCs as required
foreach (RegionalInventory 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 (ListRegionalInventoriesResponse page in response.AsRawResponses())
{
// Do something with each page of items
Console.WriteLine("A page of results:");
foreach (RegionalInventory 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<RegionalInventory> 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 (RegionalInventory 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;
ListRegionalInventories(string, string, int?, CallSettings)
Lists the RegionalInventory resources for the given product in your
merchant account. The response might contain fewer items than specified by
pageSize. If pageToken was returned in previous request, it can be
used to obtain additional results.
RegionalInventory resources are listed per product for a given account.
Declaration
public virtual PagedEnumerable<ListRegionalInventoriesResponse, RegionalInventory> ListRegionalInventories(string parent, string pageToken = null, int? pageSize = null, CallSettings callSettings = null)
Parameters
| Type | Name | Description |
|---|---|---|
| string | parent | Required. The |
| 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<ListRegionalInventoriesResponse, RegionalInventory> | A pageable sequence of RegionalInventory resources. |
Sample code
// Create client
RegionalInventoryServiceClient regionalInventoryServiceClient = RegionalInventoryServiceClient.Create();
// Initialize request argument(s)
string parent = "accounts/[ACCOUNT]/products/[PRODUCT]";
// Make the request
PagedEnumerable<ListRegionalInventoriesResponse, RegionalInventory> response = regionalInventoryServiceClient.ListRegionalInventories(parent);
// Iterate over all response items, lazily performing RPCs as required
foreach (RegionalInventory 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 (ListRegionalInventoriesResponse page in response.AsRawResponses())
{
// Do something with each page of items
Console.WriteLine("A page of results:");
foreach (RegionalInventory 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<RegionalInventory> 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 (RegionalInventory 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;
ListRegionalInventoriesAsync(ListRegionalInventoriesRequest, CallSettings)
Lists the RegionalInventory resources for the given product in your
merchant account. The response might contain fewer items than specified by
pageSize. If pageToken was returned in previous request, it can be
used to obtain additional results.
RegionalInventory resources are listed per product for a given account.
Declaration
public virtual PagedAsyncEnumerable<ListRegionalInventoriesResponse, RegionalInventory> ListRegionalInventoriesAsync(ListRegionalInventoriesRequest request, CallSettings callSettings = null)
Parameters
| Type | Name | Description |
|---|---|---|
| ListRegionalInventoriesRequest | 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<ListRegionalInventoriesResponse, RegionalInventory> | A pageable asynchronous sequence of RegionalInventory resources. |
Sample code
// Create client
RegionalInventoryServiceClient regionalInventoryServiceClient = await RegionalInventoryServiceClient.CreateAsync();
// Initialize request argument(s)
ListRegionalInventoriesRequest request = new ListRegionalInventoriesRequest
{
ParentAsProductName = ProductName.FromAccountProduct("[ACCOUNT]", "[PRODUCT]"),
};
// Make the request
PagedAsyncEnumerable<ListRegionalInventoriesResponse, RegionalInventory> response = regionalInventoryServiceClient.ListRegionalInventoriesAsync(request);
// Iterate over all response items, lazily performing RPCs as required
await response.ForEachAsync((RegionalInventory 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((ListRegionalInventoriesResponse page) =>
{
// Do something with each page of items
Console.WriteLine("A page of results:");
foreach (RegionalInventory 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<RegionalInventory> 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 (RegionalInventory 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;
ListRegionalInventoriesAsync(ProductName, string, int?, CallSettings)
Lists the RegionalInventory resources for the given product in your
merchant account. The response might contain fewer items than specified by
pageSize. If pageToken was returned in previous request, it can be
used to obtain additional results.
RegionalInventory resources are listed per product for a given account.
Declaration
public virtual PagedAsyncEnumerable<ListRegionalInventoriesResponse, RegionalInventory> ListRegionalInventoriesAsync(ProductName parent, string pageToken = null, int? pageSize = null, CallSettings callSettings = null)
Parameters
| Type | Name | Description |
|---|---|---|
| ProductName | parent | Required. The |
| 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<ListRegionalInventoriesResponse, RegionalInventory> | A pageable asynchronous sequence of RegionalInventory resources. |
Sample code
// Create client
RegionalInventoryServiceClient regionalInventoryServiceClient = await RegionalInventoryServiceClient.CreateAsync();
// Initialize request argument(s)
ProductName parent = ProductName.FromAccountProduct("[ACCOUNT]", "[PRODUCT]");
// Make the request
PagedAsyncEnumerable<ListRegionalInventoriesResponse, RegionalInventory> response = regionalInventoryServiceClient.ListRegionalInventoriesAsync(parent);
// Iterate over all response items, lazily performing RPCs as required
await response.ForEachAsync((RegionalInventory 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((ListRegionalInventoriesResponse page) =>
{
// Do something with each page of items
Console.WriteLine("A page of results:");
foreach (RegionalInventory 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<RegionalInventory> 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 (RegionalInventory 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;
ListRegionalInventoriesAsync(string, string, int?, CallSettings)
Lists the RegionalInventory resources for the given product in your
merchant account. The response might contain fewer items than specified by
pageSize. If pageToken was returned in previous request, it can be
used to obtain additional results.
RegionalInventory resources are listed per product for a given account.
Declaration
public virtual PagedAsyncEnumerable<ListRegionalInventoriesResponse, RegionalInventory> ListRegionalInventoriesAsync(string parent, string pageToken = null, int? pageSize = null, CallSettings callSettings = null)
Parameters
| Type | Name | Description |
|---|---|---|
| string | parent | Required. The |
| 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<ListRegionalInventoriesResponse, RegionalInventory> | A pageable asynchronous sequence of RegionalInventory resources. |
Sample code
// Create client
RegionalInventoryServiceClient regionalInventoryServiceClient = await RegionalInventoryServiceClient.CreateAsync();
// Initialize request argument(s)
string parent = "accounts/[ACCOUNT]/products/[PRODUCT]";
// Make the request
PagedAsyncEnumerable<ListRegionalInventoriesResponse, RegionalInventory> response = regionalInventoryServiceClient.ListRegionalInventoriesAsync(parent);
// Iterate over all response items, lazily performing RPCs as required
await response.ForEachAsync((RegionalInventory 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((ListRegionalInventoriesResponse page) =>
{
// Do something with each page of items
Console.WriteLine("A page of results:");
foreach (RegionalInventory 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<RegionalInventory> 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 (RegionalInventory 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.