Show / Hide Table of Contents

Class LocalInventoryServiceClient

LocalInventoryService client wrapper, for convenient use.

Inheritance
object
LocalInventoryServiceClient
LocalInventoryServiceClientImpl
Inherited Members
object.GetHashCode()
object.GetType()
object.MemberwiseClone()
object.ToString()
Namespace: Google.Shopping.Merchant.Inventories.V1
Assembly: Google.Shopping.Merchant.Inventories.V1.dll
Syntax
public abstract class LocalInventoryServiceClient
Remarks

Service to manage local inventory for products

Properties

DefaultEndpoint

The default endpoint for the LocalInventoryService 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 LocalInventoryService scopes.

Declaration
public static IReadOnlyList<string> DefaultScopes { get; }
Property Value
Type Description
IReadOnlyList<string>
Remarks

The default LocalInventoryService scopes are:

  • https://www.googleapis.com/auth/content

GrpcClient

The underlying gRPC LocalInventoryService client

Declaration
public virtual LocalInventoryService.LocalInventoryServiceClient GrpcClient { get; }
Property Value
Type Description
LocalInventoryService.LocalInventoryServiceClient

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 LocalInventoryServiceClient using the default credentials, endpoint and settings. To specify custom credentials or other settings, use LocalInventoryServiceClientBuilder.

Declaration
public static LocalInventoryServiceClient Create()
Returns
Type Description
LocalInventoryServiceClient

The created LocalInventoryServiceClient.

CreateAsync(CancellationToken)

Asynchronously creates a LocalInventoryServiceClient using the default credentials, endpoint and settings. To specify custom credentials or other settings, use LocalInventoryServiceClientBuilder.

Declaration
public static Task<LocalInventoryServiceClient> CreateAsync(CancellationToken cancellationToken = default)
Parameters
Type Name Description
CancellationToken cancellationToken

The CancellationToken to use while creating the client.

Returns
Type Description
Task<LocalInventoryServiceClient>

The task representing the created LocalInventoryServiceClient.

DeleteLocalInventory(DeleteLocalInventoryRequest, CallSettings)

Deletes the specified LocalInventory from the given product in your merchant account. It might take a up to an hour for the LocalInventory 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 DeleteLocalInventory(DeleteLocalInventoryRequest request, CallSettings callSettings = null)
Parameters
Type Name Description
DeleteLocalInventoryRequest 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
LocalInventoryServiceClient localInventoryServiceClient = LocalInventoryServiceClient.Create();
// Initialize request argument(s)
DeleteLocalInventoryRequest request = new DeleteLocalInventoryRequest
{
    LocalInventoryName = LocalInventoryName.FromAccountProductStoreCode("[ACCOUNT]", "[PRODUCT]", "[STORE_CODE]"),
};
// Make the request
localInventoryServiceClient.DeleteLocalInventory(request);

DeleteLocalInventory(LocalInventoryName, CallSettings)

Deletes the specified LocalInventory from the given product in your merchant account. It might take a up to an hour for the LocalInventory 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 DeleteLocalInventory(LocalInventoryName name, CallSettings callSettings = null)
Parameters
Type Name Description
LocalInventoryName name

Required. The name of the local inventory for the given product to delete. Format: accounts/{account}/products/{product}/localInventories/{store_code}

CallSettings callSettings

If not null, applies overrides to this RPC call.

Sample code
// Create client
LocalInventoryServiceClient localInventoryServiceClient = LocalInventoryServiceClient.Create();
// Initialize request argument(s)
LocalInventoryName name = LocalInventoryName.FromAccountProductStoreCode("[ACCOUNT]", "[PRODUCT]", "[STORE_CODE]");
// Make the request
localInventoryServiceClient.DeleteLocalInventory(name);

DeleteLocalInventory(string, CallSettings)

Deletes the specified LocalInventory from the given product in your merchant account. It might take a up to an hour for the LocalInventory 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 DeleteLocalInventory(string name, CallSettings callSettings = null)
Parameters
Type Name Description
string name

Required. The name of the local inventory for the given product to delete. Format: accounts/{account}/products/{product}/localInventories/{store_code}

CallSettings callSettings

If not null, applies overrides to this RPC call.

Sample code
// Create client
LocalInventoryServiceClient localInventoryServiceClient = LocalInventoryServiceClient.Create();
// Initialize request argument(s)
string name = "accounts/[ACCOUNT]/products/[PRODUCT]/localInventories/[STORE_CODE]";
// Make the request
localInventoryServiceClient.DeleteLocalInventory(name);

DeleteLocalInventoryAsync(DeleteLocalInventoryRequest, CallSettings)

Deletes the specified LocalInventory from the given product in your merchant account. It might take a up to an hour for the LocalInventory 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 DeleteLocalInventoryAsync(DeleteLocalInventoryRequest request, CallSettings callSettings = null)
Parameters
Type Name Description
DeleteLocalInventoryRequest 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
LocalInventoryServiceClient localInventoryServiceClient = await LocalInventoryServiceClient.CreateAsync();
// Initialize request argument(s)
DeleteLocalInventoryRequest request = new DeleteLocalInventoryRequest
{
    LocalInventoryName = LocalInventoryName.FromAccountProductStoreCode("[ACCOUNT]", "[PRODUCT]", "[STORE_CODE]"),
};
// Make the request
await localInventoryServiceClient.DeleteLocalInventoryAsync(request);

DeleteLocalInventoryAsync(DeleteLocalInventoryRequest, CancellationToken)

Deletes the specified LocalInventory from the given product in your merchant account. It might take a up to an hour for the LocalInventory 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 DeleteLocalInventoryAsync(DeleteLocalInventoryRequest request, CancellationToken cancellationToken)
Parameters
Type Name Description
DeleteLocalInventoryRequest 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
LocalInventoryServiceClient localInventoryServiceClient = await LocalInventoryServiceClient.CreateAsync();
// Initialize request argument(s)
DeleteLocalInventoryRequest request = new DeleteLocalInventoryRequest
{
    LocalInventoryName = LocalInventoryName.FromAccountProductStoreCode("[ACCOUNT]", "[PRODUCT]", "[STORE_CODE]"),
};
// Make the request
await localInventoryServiceClient.DeleteLocalInventoryAsync(request);

DeleteLocalInventoryAsync(LocalInventoryName, CallSettings)

Deletes the specified LocalInventory from the given product in your merchant account. It might take a up to an hour for the LocalInventory 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 DeleteLocalInventoryAsync(LocalInventoryName name, CallSettings callSettings = null)
Parameters
Type Name Description
LocalInventoryName name

Required. The name of the local inventory for the given product to delete. Format: accounts/{account}/products/{product}/localInventories/{store_code}

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
LocalInventoryServiceClient localInventoryServiceClient = await LocalInventoryServiceClient.CreateAsync();
// Initialize request argument(s)
LocalInventoryName name = LocalInventoryName.FromAccountProductStoreCode("[ACCOUNT]", "[PRODUCT]", "[STORE_CODE]");
// Make the request
await localInventoryServiceClient.DeleteLocalInventoryAsync(name);

DeleteLocalInventoryAsync(LocalInventoryName, CancellationToken)

Deletes the specified LocalInventory from the given product in your merchant account. It might take a up to an hour for the LocalInventory 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 DeleteLocalInventoryAsync(LocalInventoryName name, CancellationToken cancellationToken)
Parameters
Type Name Description
LocalInventoryName name

Required. The name of the local inventory for the given product to delete. Format: accounts/{account}/products/{product}/localInventories/{store_code}

CancellationToken cancellationToken

A CancellationToken to use for this RPC.

Returns
Type Description
Task

A Task containing the RPC response.

Sample code
// Create client
LocalInventoryServiceClient localInventoryServiceClient = await LocalInventoryServiceClient.CreateAsync();
// Initialize request argument(s)
LocalInventoryName name = LocalInventoryName.FromAccountProductStoreCode("[ACCOUNT]", "[PRODUCT]", "[STORE_CODE]");
// Make the request
await localInventoryServiceClient.DeleteLocalInventoryAsync(name);

DeleteLocalInventoryAsync(string, CallSettings)

Deletes the specified LocalInventory from the given product in your merchant account. It might take a up to an hour for the LocalInventory 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 DeleteLocalInventoryAsync(string name, CallSettings callSettings = null)
Parameters
Type Name Description
string name

Required. The name of the local inventory for the given product to delete. Format: accounts/{account}/products/{product}/localInventories/{store_code}

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
LocalInventoryServiceClient localInventoryServiceClient = await LocalInventoryServiceClient.CreateAsync();
// Initialize request argument(s)
string name = "accounts/[ACCOUNT]/products/[PRODUCT]/localInventories/[STORE_CODE]";
// Make the request
await localInventoryServiceClient.DeleteLocalInventoryAsync(name);

DeleteLocalInventoryAsync(string, CancellationToken)

Deletes the specified LocalInventory from the given product in your merchant account. It might take a up to an hour for the LocalInventory 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 DeleteLocalInventoryAsync(string name, CancellationToken cancellationToken)
Parameters
Type Name Description
string name

Required. The name of the local inventory for the given product to delete. Format: accounts/{account}/products/{product}/localInventories/{store_code}

CancellationToken cancellationToken

A CancellationToken to use for this RPC.

Returns
Type Description
Task

A Task containing the RPC response.

Sample code
// Create client
LocalInventoryServiceClient localInventoryServiceClient = await LocalInventoryServiceClient.CreateAsync();
// Initialize request argument(s)
string name = "accounts/[ACCOUNT]/products/[PRODUCT]/localInventories/[STORE_CODE]";
// Make the request
await localInventoryServiceClient.DeleteLocalInventoryAsync(name);

InsertLocalInventory(InsertLocalInventoryRequest, CallSettings)

Inserts a LocalInventory resource to a product in your merchant account.

Replaces the full LocalInventory resource if an entry with the same [storeCode][google.shopping.merchant.inventories.v1.LocalInventory.store_code] already exists for the product.

It might take up to 30 minutes for the new or updated LocalInventory resource to appear in products.

Declaration
public virtual LocalInventory InsertLocalInventory(InsertLocalInventoryRequest request, CallSettings callSettings = null)
Parameters
Type Name Description
InsertLocalInventoryRequest 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
LocalInventory

The RPC response.

Sample code
// Create client
LocalInventoryServiceClient localInventoryServiceClient = LocalInventoryServiceClient.Create();
// Initialize request argument(s)
InsertLocalInventoryRequest request = new InsertLocalInventoryRequest
{
    ParentAsProductName = ProductName.FromAccountProduct("[ACCOUNT]", "[PRODUCT]"),
    LocalInventory = new LocalInventory(),
};
// Make the request
LocalInventory response = localInventoryServiceClient.InsertLocalInventory(request);

InsertLocalInventoryAsync(InsertLocalInventoryRequest, CallSettings)

Inserts a LocalInventory resource to a product in your merchant account.

Replaces the full LocalInventory resource if an entry with the same [storeCode][google.shopping.merchant.inventories.v1.LocalInventory.store_code] already exists for the product.

It might take up to 30 minutes for the new or updated LocalInventory resource to appear in products.

Declaration
public virtual Task<LocalInventory> InsertLocalInventoryAsync(InsertLocalInventoryRequest request, CallSettings callSettings = null)
Parameters
Type Name Description
InsertLocalInventoryRequest 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<LocalInventory>

A Task containing the RPC response.

Sample code
// Create client
LocalInventoryServiceClient localInventoryServiceClient = await LocalInventoryServiceClient.CreateAsync();
// Initialize request argument(s)
InsertLocalInventoryRequest request = new InsertLocalInventoryRequest
{
    ParentAsProductName = ProductName.FromAccountProduct("[ACCOUNT]", "[PRODUCT]"),
    LocalInventory = new LocalInventory(),
};
// Make the request
LocalInventory response = await localInventoryServiceClient.InsertLocalInventoryAsync(request);

InsertLocalInventoryAsync(InsertLocalInventoryRequest, CancellationToken)

Inserts a LocalInventory resource to a product in your merchant account.

Replaces the full LocalInventory resource if an entry with the same [storeCode][google.shopping.merchant.inventories.v1.LocalInventory.store_code] already exists for the product.

It might take up to 30 minutes for the new or updated LocalInventory resource to appear in products.

Declaration
public virtual Task<LocalInventory> InsertLocalInventoryAsync(InsertLocalInventoryRequest request, CancellationToken cancellationToken)
Parameters
Type Name Description
InsertLocalInventoryRequest 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<LocalInventory>

A Task containing the RPC response.

Sample code
// Create client
LocalInventoryServiceClient localInventoryServiceClient = await LocalInventoryServiceClient.CreateAsync();
// Initialize request argument(s)
InsertLocalInventoryRequest request = new InsertLocalInventoryRequest
{
    ParentAsProductName = ProductName.FromAccountProduct("[ACCOUNT]", "[PRODUCT]"),
    LocalInventory = new LocalInventory(),
};
// Make the request
LocalInventory response = await localInventoryServiceClient.InsertLocalInventoryAsync(request);

ListLocalInventories(ListLocalInventoriesRequest, CallSettings)

Lists the LocalInventory 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.

LocalInventory resources are listed per product for a given account.

Declaration
public virtual PagedEnumerable<ListLocalInventoriesResponse, LocalInventory> ListLocalInventories(ListLocalInventoriesRequest request, CallSettings callSettings = null)
Parameters
Type Name Description
ListLocalInventoriesRequest 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<ListLocalInventoriesResponse, LocalInventory>

A pageable sequence of LocalInventory resources.

Sample code
// Create client
LocalInventoryServiceClient localInventoryServiceClient = LocalInventoryServiceClient.Create();
// Initialize request argument(s)
ListLocalInventoriesRequest request = new ListLocalInventoriesRequest
{
    ParentAsProductName = ProductName.FromAccountProduct("[ACCOUNT]", "[PRODUCT]"),
};
// Make the request
PagedEnumerable<ListLocalInventoriesResponse, LocalInventory> response = localInventoryServiceClient.ListLocalInventories(request);

// Iterate over all response items, lazily performing RPCs as required
foreach (LocalInventory 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 (ListLocalInventoriesResponse page in response.AsRawResponses())
{
    // Do something with each page of items
    Console.WriteLine("A page of results:");
    foreach (LocalInventory 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<LocalInventory> 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 (LocalInventory 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;

ListLocalInventories(ProductName, string, int?, CallSettings)

Lists the LocalInventory 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.

LocalInventory resources are listed per product for a given account.

Declaration
public virtual PagedEnumerable<ListLocalInventoriesResponse, LocalInventory> ListLocalInventories(ProductName parent, string pageToken = null, int? pageSize = null, CallSettings callSettings = null)
Parameters
Type Name Description
ProductName parent

Required. The name of the parent product to list local inventories for. Format: accounts/{account}/products/{product}

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<ListLocalInventoriesResponse, LocalInventory>

A pageable sequence of LocalInventory resources.

Sample code
// Create client
LocalInventoryServiceClient localInventoryServiceClient = LocalInventoryServiceClient.Create();
// Initialize request argument(s)
ProductName parent = ProductName.FromAccountProduct("[ACCOUNT]", "[PRODUCT]");
// Make the request
PagedEnumerable<ListLocalInventoriesResponse, LocalInventory> response = localInventoryServiceClient.ListLocalInventories(parent);

// Iterate over all response items, lazily performing RPCs as required
foreach (LocalInventory 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 (ListLocalInventoriesResponse page in response.AsRawResponses())
{
    // Do something with each page of items
    Console.WriteLine("A page of results:");
    foreach (LocalInventory 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<LocalInventory> 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 (LocalInventory 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;

ListLocalInventories(string, string, int?, CallSettings)

Lists the LocalInventory 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.

LocalInventory resources are listed per product for a given account.

Declaration
public virtual PagedEnumerable<ListLocalInventoriesResponse, LocalInventory> ListLocalInventories(string parent, string pageToken = null, int? pageSize = null, CallSettings callSettings = null)
Parameters
Type Name Description
string parent

Required. The name of the parent product to list local inventories for. Format: accounts/{account}/products/{product}

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<ListLocalInventoriesResponse, LocalInventory>

A pageable sequence of LocalInventory resources.

Sample code
// Create client
LocalInventoryServiceClient localInventoryServiceClient = LocalInventoryServiceClient.Create();
// Initialize request argument(s)
string parent = "accounts/[ACCOUNT]/products/[PRODUCT]";
// Make the request
PagedEnumerable<ListLocalInventoriesResponse, LocalInventory> response = localInventoryServiceClient.ListLocalInventories(parent);

// Iterate over all response items, lazily performing RPCs as required
foreach (LocalInventory 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 (ListLocalInventoriesResponse page in response.AsRawResponses())
{
    // Do something with each page of items
    Console.WriteLine("A page of results:");
    foreach (LocalInventory 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<LocalInventory> 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 (LocalInventory 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;

ListLocalInventoriesAsync(ListLocalInventoriesRequest, CallSettings)

Lists the LocalInventory 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.

LocalInventory resources are listed per product for a given account.

Declaration
public virtual PagedAsyncEnumerable<ListLocalInventoriesResponse, LocalInventory> ListLocalInventoriesAsync(ListLocalInventoriesRequest request, CallSettings callSettings = null)
Parameters
Type Name Description
ListLocalInventoriesRequest 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<ListLocalInventoriesResponse, LocalInventory>

A pageable asynchronous sequence of LocalInventory resources.

Sample code
// Create client
LocalInventoryServiceClient localInventoryServiceClient = await LocalInventoryServiceClient.CreateAsync();
// Initialize request argument(s)
ListLocalInventoriesRequest request = new ListLocalInventoriesRequest
{
    ParentAsProductName = ProductName.FromAccountProduct("[ACCOUNT]", "[PRODUCT]"),
};
// Make the request
PagedAsyncEnumerable<ListLocalInventoriesResponse, LocalInventory> response = localInventoryServiceClient.ListLocalInventoriesAsync(request);

// Iterate over all response items, lazily performing RPCs as required
await response.ForEachAsync((LocalInventory 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((ListLocalInventoriesResponse page) =>
{
    // Do something with each page of items
    Console.WriteLine("A page of results:");
    foreach (LocalInventory 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<LocalInventory> 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 (LocalInventory 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;

ListLocalInventoriesAsync(ProductName, string, int?, CallSettings)

Lists the LocalInventory 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.

LocalInventory resources are listed per product for a given account.

Declaration
public virtual PagedAsyncEnumerable<ListLocalInventoriesResponse, LocalInventory> ListLocalInventoriesAsync(ProductName parent, string pageToken = null, int? pageSize = null, CallSettings callSettings = null)
Parameters
Type Name Description
ProductName parent

Required. The name of the parent product to list local inventories for. Format: accounts/{account}/products/{product}

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<ListLocalInventoriesResponse, LocalInventory>

A pageable asynchronous sequence of LocalInventory resources.

Sample code
// Create client
LocalInventoryServiceClient localInventoryServiceClient = await LocalInventoryServiceClient.CreateAsync();
// Initialize request argument(s)
ProductName parent = ProductName.FromAccountProduct("[ACCOUNT]", "[PRODUCT]");
// Make the request
PagedAsyncEnumerable<ListLocalInventoriesResponse, LocalInventory> response = localInventoryServiceClient.ListLocalInventoriesAsync(parent);

// Iterate over all response items, lazily performing RPCs as required
await response.ForEachAsync((LocalInventory 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((ListLocalInventoriesResponse page) =>
{
    // Do something with each page of items
    Console.WriteLine("A page of results:");
    foreach (LocalInventory 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<LocalInventory> 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 (LocalInventory 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;

ListLocalInventoriesAsync(string, string, int?, CallSettings)

Lists the LocalInventory 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.

LocalInventory resources are listed per product for a given account.

Declaration
public virtual PagedAsyncEnumerable<ListLocalInventoriesResponse, LocalInventory> ListLocalInventoriesAsync(string parent, string pageToken = null, int? pageSize = null, CallSettings callSettings = null)
Parameters
Type Name Description
string parent

Required. The name of the parent product to list local inventories for. Format: accounts/{account}/products/{product}

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<ListLocalInventoriesResponse, LocalInventory>

A pageable asynchronous sequence of LocalInventory resources.

Sample code
// Create client
LocalInventoryServiceClient localInventoryServiceClient = await LocalInventoryServiceClient.CreateAsync();
// Initialize request argument(s)
string parent = "accounts/[ACCOUNT]/products/[PRODUCT]";
// Make the request
PagedAsyncEnumerable<ListLocalInventoriesResponse, LocalInventory> response = localInventoryServiceClient.ListLocalInventoriesAsync(parent);

// Iterate over all response items, lazily performing RPCs as required
await response.ForEachAsync((LocalInventory 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((ListLocalInventoriesResponse page) =>
{
    // Do something with each page of items
    Console.WriteLine("A page of results:");
    foreach (LocalInventory 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<LocalInventory> 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 (LocalInventory 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