Class TaxonomyCategoryServiceClient
TaxonomyCategoryService client wrapper, for convenient use.
Namespace: Google.Ads.AdManager.V1
Assembly: Google.Ads.AdManager.V1.dll
Syntax
public abstract class TaxonomyCategoryServiceClient
Remarks
Provides methods for handling TaxonomyCategory
objects.
Properties
DefaultEndpoint
The default endpoint for the TaxonomyCategoryService service, which is a host of "admanager.googleapis.com" and a port of 443.
Declaration
public static string DefaultEndpoint { get; }
Property Value
Type | Description |
---|---|
string |
DefaultScopes
The default TaxonomyCategoryService scopes.
Declaration
public static IReadOnlyList<string> DefaultScopes { get; }
Property Value
Type | Description |
---|---|
IReadOnlyList<string> |
Remarks
The default TaxonomyCategoryService scopes are:
GrpcClient
The underlying gRPC TaxonomyCategoryService client
Declaration
public virtual TaxonomyCategoryService.TaxonomyCategoryServiceClient GrpcClient { get; }
Property Value
Type | Description |
---|---|
TaxonomyCategoryService.TaxonomyCategoryServiceClient |
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 TaxonomyCategoryServiceClient using the default credentials, endpoint and settings. To specify custom credentials or other settings, use TaxonomyCategoryServiceClientBuilder.
Declaration
public static TaxonomyCategoryServiceClient Create()
Returns
Type | Description |
---|---|
TaxonomyCategoryServiceClient | The created TaxonomyCategoryServiceClient. |
CreateAsync(CancellationToken)
Asynchronously creates a TaxonomyCategoryServiceClient using the default credentials, endpoint and settings. To specify custom credentials or other settings, use TaxonomyCategoryServiceClientBuilder.
Declaration
public static Task<TaxonomyCategoryServiceClient> CreateAsync(CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
CancellationToken | cancellationToken | The CancellationToken to use while creating the client. |
Returns
Type | Description |
---|---|
Task<TaxonomyCategoryServiceClient> | The task representing the created TaxonomyCategoryServiceClient. |
GetTaxonomyCategory(GetTaxonomyCategoryRequest, CallSettings)
API to retrieve a TaxonomyCategory
object.
Declaration
public virtual TaxonomyCategory GetTaxonomyCategory(GetTaxonomyCategoryRequest request, CallSettings callSettings = null)
Parameters
Type | Name | Description |
---|---|---|
GetTaxonomyCategoryRequest | 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 |
---|---|
TaxonomyCategory | The RPC response. |
Sample code
// Create client
TaxonomyCategoryServiceClient taxonomyCategoryServiceClient = TaxonomyCategoryServiceClient.Create();
// Initialize request argument(s)
GetTaxonomyCategoryRequest request = new GetTaxonomyCategoryRequest
{
TaxonomyCategoryName = TaxonomyCategoryName.FromNetworkCodeTaxonomyCategory("[NETWORK_CODE]", "[TAXONOMY_CATEGORY]"),
};
// Make the request
TaxonomyCategory response = taxonomyCategoryServiceClient.GetTaxonomyCategory(request);
GetTaxonomyCategory(TaxonomyCategoryName, CallSettings)
API to retrieve a TaxonomyCategory
object.
Declaration
public virtual TaxonomyCategory GetTaxonomyCategory(TaxonomyCategoryName name, CallSettings callSettings = null)
Parameters
Type | Name | Description |
---|---|---|
TaxonomyCategoryName | name | Required. The resource name of the TaxonomyCategory.
Format: |
CallSettings | callSettings | If not null, applies overrides to this RPC call. |
Returns
Type | Description |
---|---|
TaxonomyCategory | The RPC response. |
Sample code
// Create client
TaxonomyCategoryServiceClient taxonomyCategoryServiceClient = TaxonomyCategoryServiceClient.Create();
// Initialize request argument(s)
TaxonomyCategoryName name = TaxonomyCategoryName.FromNetworkCodeTaxonomyCategory("[NETWORK_CODE]", "[TAXONOMY_CATEGORY]");
// Make the request
TaxonomyCategory response = taxonomyCategoryServiceClient.GetTaxonomyCategory(name);
GetTaxonomyCategory(string, CallSettings)
API to retrieve a TaxonomyCategory
object.
Declaration
public virtual TaxonomyCategory GetTaxonomyCategory(string name, CallSettings callSettings = null)
Parameters
Type | Name | Description |
---|---|---|
string | name | Required. The resource name of the TaxonomyCategory.
Format: |
CallSettings | callSettings | If not null, applies overrides to this RPC call. |
Returns
Type | Description |
---|---|
TaxonomyCategory | The RPC response. |
Sample code
// Create client
TaxonomyCategoryServiceClient taxonomyCategoryServiceClient = TaxonomyCategoryServiceClient.Create();
// Initialize request argument(s)
string name = "networks/[NETWORK_CODE]/taxonomyCategories/[TAXONOMY_CATEGORY]";
// Make the request
TaxonomyCategory response = taxonomyCategoryServiceClient.GetTaxonomyCategory(name);
GetTaxonomyCategoryAsync(GetTaxonomyCategoryRequest, CallSettings)
API to retrieve a TaxonomyCategory
object.
Declaration
public virtual Task<TaxonomyCategory> GetTaxonomyCategoryAsync(GetTaxonomyCategoryRequest request, CallSettings callSettings = null)
Parameters
Type | Name | Description |
---|---|---|
GetTaxonomyCategoryRequest | 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<TaxonomyCategory> | A Task containing the RPC response. |
Sample code
// Create client
TaxonomyCategoryServiceClient taxonomyCategoryServiceClient = await TaxonomyCategoryServiceClient.CreateAsync();
// Initialize request argument(s)
GetTaxonomyCategoryRequest request = new GetTaxonomyCategoryRequest
{
TaxonomyCategoryName = TaxonomyCategoryName.FromNetworkCodeTaxonomyCategory("[NETWORK_CODE]", "[TAXONOMY_CATEGORY]"),
};
// Make the request
TaxonomyCategory response = await taxonomyCategoryServiceClient.GetTaxonomyCategoryAsync(request);
GetTaxonomyCategoryAsync(GetTaxonomyCategoryRequest, CancellationToken)
API to retrieve a TaxonomyCategory
object.
Declaration
public virtual Task<TaxonomyCategory> GetTaxonomyCategoryAsync(GetTaxonomyCategoryRequest request, CancellationToken cancellationToken)
Parameters
Type | Name | Description |
---|---|---|
GetTaxonomyCategoryRequest | 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<TaxonomyCategory> | A Task containing the RPC response. |
Sample code
// Create client
TaxonomyCategoryServiceClient taxonomyCategoryServiceClient = await TaxonomyCategoryServiceClient.CreateAsync();
// Initialize request argument(s)
GetTaxonomyCategoryRequest request = new GetTaxonomyCategoryRequest
{
TaxonomyCategoryName = TaxonomyCategoryName.FromNetworkCodeTaxonomyCategory("[NETWORK_CODE]", "[TAXONOMY_CATEGORY]"),
};
// Make the request
TaxonomyCategory response = await taxonomyCategoryServiceClient.GetTaxonomyCategoryAsync(request);
GetTaxonomyCategoryAsync(TaxonomyCategoryName, CallSettings)
API to retrieve a TaxonomyCategory
object.
Declaration
public virtual Task<TaxonomyCategory> GetTaxonomyCategoryAsync(TaxonomyCategoryName name, CallSettings callSettings = null)
Parameters
Type | Name | Description |
---|---|---|
TaxonomyCategoryName | name | Required. The resource name of the TaxonomyCategory.
Format: |
CallSettings | callSettings | If not null, applies overrides to this RPC call. |
Returns
Type | Description |
---|---|
Task<TaxonomyCategory> | A Task containing the RPC response. |
Sample code
// Create client
TaxonomyCategoryServiceClient taxonomyCategoryServiceClient = await TaxonomyCategoryServiceClient.CreateAsync();
// Initialize request argument(s)
TaxonomyCategoryName name = TaxonomyCategoryName.FromNetworkCodeTaxonomyCategory("[NETWORK_CODE]", "[TAXONOMY_CATEGORY]");
// Make the request
TaxonomyCategory response = await taxonomyCategoryServiceClient.GetTaxonomyCategoryAsync(name);
GetTaxonomyCategoryAsync(TaxonomyCategoryName, CancellationToken)
API to retrieve a TaxonomyCategory
object.
Declaration
public virtual Task<TaxonomyCategory> GetTaxonomyCategoryAsync(TaxonomyCategoryName name, CancellationToken cancellationToken)
Parameters
Type | Name | Description |
---|---|---|
TaxonomyCategoryName | name | Required. The resource name of the TaxonomyCategory.
Format: |
CancellationToken | cancellationToken | A CancellationToken to use for this RPC. |
Returns
Type | Description |
---|---|
Task<TaxonomyCategory> | A Task containing the RPC response. |
Sample code
// Create client
TaxonomyCategoryServiceClient taxonomyCategoryServiceClient = await TaxonomyCategoryServiceClient.CreateAsync();
// Initialize request argument(s)
TaxonomyCategoryName name = TaxonomyCategoryName.FromNetworkCodeTaxonomyCategory("[NETWORK_CODE]", "[TAXONOMY_CATEGORY]");
// Make the request
TaxonomyCategory response = await taxonomyCategoryServiceClient.GetTaxonomyCategoryAsync(name);
GetTaxonomyCategoryAsync(string, CallSettings)
API to retrieve a TaxonomyCategory
object.
Declaration
public virtual Task<TaxonomyCategory> GetTaxonomyCategoryAsync(string name, CallSettings callSettings = null)
Parameters
Type | Name | Description |
---|---|---|
string | name | Required. The resource name of the TaxonomyCategory.
Format: |
CallSettings | callSettings | If not null, applies overrides to this RPC call. |
Returns
Type | Description |
---|---|
Task<TaxonomyCategory> | A Task containing the RPC response. |
Sample code
// Create client
TaxonomyCategoryServiceClient taxonomyCategoryServiceClient = await TaxonomyCategoryServiceClient.CreateAsync();
// Initialize request argument(s)
string name = "networks/[NETWORK_CODE]/taxonomyCategories/[TAXONOMY_CATEGORY]";
// Make the request
TaxonomyCategory response = await taxonomyCategoryServiceClient.GetTaxonomyCategoryAsync(name);
GetTaxonomyCategoryAsync(string, CancellationToken)
API to retrieve a TaxonomyCategory
object.
Declaration
public virtual Task<TaxonomyCategory> GetTaxonomyCategoryAsync(string name, CancellationToken cancellationToken)
Parameters
Type | Name | Description |
---|---|---|
string | name | Required. The resource name of the TaxonomyCategory.
Format: |
CancellationToken | cancellationToken | A CancellationToken to use for this RPC. |
Returns
Type | Description |
---|---|
Task<TaxonomyCategory> | A Task containing the RPC response. |
Sample code
// Create client
TaxonomyCategoryServiceClient taxonomyCategoryServiceClient = await TaxonomyCategoryServiceClient.CreateAsync();
// Initialize request argument(s)
string name = "networks/[NETWORK_CODE]/taxonomyCategories/[TAXONOMY_CATEGORY]";
// Make the request
TaxonomyCategory response = await taxonomyCategoryServiceClient.GetTaxonomyCategoryAsync(name);
ListTaxonomyCategories(ListTaxonomyCategoriesRequest, CallSettings)
API to retrieve a list of TaxonomyCategory
objects.
Declaration
public virtual PagedEnumerable<ListTaxonomyCategoriesResponse, TaxonomyCategory> ListTaxonomyCategories(ListTaxonomyCategoriesRequest request, CallSettings callSettings = null)
Parameters
Type | Name | Description |
---|---|---|
ListTaxonomyCategoriesRequest | 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<ListTaxonomyCategoriesResponse, TaxonomyCategory> | A pageable sequence of TaxonomyCategory resources. |
Sample code
// Create client
TaxonomyCategoryServiceClient taxonomyCategoryServiceClient = TaxonomyCategoryServiceClient.Create();
// Initialize request argument(s)
ListTaxonomyCategoriesRequest request = new ListTaxonomyCategoriesRequest
{
ParentAsNetworkName = NetworkName.FromNetworkCode("[NETWORK_CODE]"),
Filter = "",
OrderBy = "",
Skip = 0,
};
// Make the request
PagedEnumerable<ListTaxonomyCategoriesResponse, TaxonomyCategory> response = taxonomyCategoryServiceClient.ListTaxonomyCategories(request);
// Iterate over all response items, lazily performing RPCs as required
foreach (TaxonomyCategory 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 (ListTaxonomyCategoriesResponse page in response.AsRawResponses())
{
// Do something with each page of items
Console.WriteLine("A page of results:");
foreach (TaxonomyCategory 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<TaxonomyCategory> 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 (TaxonomyCategory 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;
ListTaxonomyCategories(NetworkName, string, int?, CallSettings)
API to retrieve a list of TaxonomyCategory
objects.
Declaration
public virtual PagedEnumerable<ListTaxonomyCategoriesResponse, TaxonomyCategory> ListTaxonomyCategories(NetworkName parent, string pageToken = null, int? pageSize = null, CallSettings callSettings = null)
Parameters
Type | Name | Description |
---|---|---|
NetworkName | parent | Required. The parent, which owns this collection of TaxonomyCategories.
Format: |
string | pageToken | The token returned from the previous request. A value of |
int? | pageSize | The size of page to request. The response will not be larger than this, but may be smaller. A value of
|
CallSettings | callSettings | If not null, applies overrides to this RPC call. |
Returns
Type | Description |
---|---|
PagedEnumerable<ListTaxonomyCategoriesResponse, TaxonomyCategory> | A pageable sequence of TaxonomyCategory resources. |
Sample code
// Create client
TaxonomyCategoryServiceClient taxonomyCategoryServiceClient = TaxonomyCategoryServiceClient.Create();
// Initialize request argument(s)
NetworkName parent = NetworkName.FromNetworkCode("[NETWORK_CODE]");
// Make the request
PagedEnumerable<ListTaxonomyCategoriesResponse, TaxonomyCategory> response = taxonomyCategoryServiceClient.ListTaxonomyCategories(parent);
// Iterate over all response items, lazily performing RPCs as required
foreach (TaxonomyCategory 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 (ListTaxonomyCategoriesResponse page in response.AsRawResponses())
{
// Do something with each page of items
Console.WriteLine("A page of results:");
foreach (TaxonomyCategory 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<TaxonomyCategory> 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 (TaxonomyCategory 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;
ListTaxonomyCategories(string, string, int?, CallSettings)
API to retrieve a list of TaxonomyCategory
objects.
Declaration
public virtual PagedEnumerable<ListTaxonomyCategoriesResponse, TaxonomyCategory> ListTaxonomyCategories(string parent, string pageToken = null, int? pageSize = null, CallSettings callSettings = null)
Parameters
Type | Name | Description |
---|---|---|
string | parent | Required. The parent, which owns this collection of TaxonomyCategories.
Format: |
string | pageToken | The token returned from the previous request. A value of |
int? | pageSize | The size of page to request. The response will not be larger than this, but may be smaller. A value of
|
CallSettings | callSettings | If not null, applies overrides to this RPC call. |
Returns
Type | Description |
---|---|
PagedEnumerable<ListTaxonomyCategoriesResponse, TaxonomyCategory> | A pageable sequence of TaxonomyCategory resources. |
Sample code
// Create client
TaxonomyCategoryServiceClient taxonomyCategoryServiceClient = TaxonomyCategoryServiceClient.Create();
// Initialize request argument(s)
string parent = "networks/[NETWORK_CODE]";
// Make the request
PagedEnumerable<ListTaxonomyCategoriesResponse, TaxonomyCategory> response = taxonomyCategoryServiceClient.ListTaxonomyCategories(parent);
// Iterate over all response items, lazily performing RPCs as required
foreach (TaxonomyCategory 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 (ListTaxonomyCategoriesResponse page in response.AsRawResponses())
{
// Do something with each page of items
Console.WriteLine("A page of results:");
foreach (TaxonomyCategory 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<TaxonomyCategory> 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 (TaxonomyCategory 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;
ListTaxonomyCategoriesAsync(ListTaxonomyCategoriesRequest, CallSettings)
API to retrieve a list of TaxonomyCategory
objects.
Declaration
public virtual PagedAsyncEnumerable<ListTaxonomyCategoriesResponse, TaxonomyCategory> ListTaxonomyCategoriesAsync(ListTaxonomyCategoriesRequest request, CallSettings callSettings = null)
Parameters
Type | Name | Description |
---|---|---|
ListTaxonomyCategoriesRequest | 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<ListTaxonomyCategoriesResponse, TaxonomyCategory> | A pageable asynchronous sequence of TaxonomyCategory resources. |
Sample code
// Create client
TaxonomyCategoryServiceClient taxonomyCategoryServiceClient = await TaxonomyCategoryServiceClient.CreateAsync();
// Initialize request argument(s)
ListTaxonomyCategoriesRequest request = new ListTaxonomyCategoriesRequest
{
ParentAsNetworkName = NetworkName.FromNetworkCode("[NETWORK_CODE]"),
Filter = "",
OrderBy = "",
Skip = 0,
};
// Make the request
PagedAsyncEnumerable<ListTaxonomyCategoriesResponse, TaxonomyCategory> response = taxonomyCategoryServiceClient.ListTaxonomyCategoriesAsync(request);
// Iterate over all response items, lazily performing RPCs as required
await response.ForEachAsync((TaxonomyCategory 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((ListTaxonomyCategoriesResponse page) =>
{
// Do something with each page of items
Console.WriteLine("A page of results:");
foreach (TaxonomyCategory 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<TaxonomyCategory> 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 (TaxonomyCategory 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;
ListTaxonomyCategoriesAsync(NetworkName, string, int?, CallSettings)
API to retrieve a list of TaxonomyCategory
objects.
Declaration
public virtual PagedAsyncEnumerable<ListTaxonomyCategoriesResponse, TaxonomyCategory> ListTaxonomyCategoriesAsync(NetworkName parent, string pageToken = null, int? pageSize = null, CallSettings callSettings = null)
Parameters
Type | Name | Description |
---|---|---|
NetworkName | parent | Required. The parent, which owns this collection of TaxonomyCategories.
Format: |
string | pageToken | The token returned from the previous request. A value of |
int? | pageSize | The size of page to request. The response will not be larger than this, but may be smaller. A value of
|
CallSettings | callSettings | If not null, applies overrides to this RPC call. |
Returns
Type | Description |
---|---|
PagedAsyncEnumerable<ListTaxonomyCategoriesResponse, TaxonomyCategory> | A pageable asynchronous sequence of TaxonomyCategory resources. |
Sample code
// Create client
TaxonomyCategoryServiceClient taxonomyCategoryServiceClient = await TaxonomyCategoryServiceClient.CreateAsync();
// Initialize request argument(s)
NetworkName parent = NetworkName.FromNetworkCode("[NETWORK_CODE]");
// Make the request
PagedAsyncEnumerable<ListTaxonomyCategoriesResponse, TaxonomyCategory> response = taxonomyCategoryServiceClient.ListTaxonomyCategoriesAsync(parent);
// Iterate over all response items, lazily performing RPCs as required
await response.ForEachAsync((TaxonomyCategory 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((ListTaxonomyCategoriesResponse page) =>
{
// Do something with each page of items
Console.WriteLine("A page of results:");
foreach (TaxonomyCategory 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<TaxonomyCategory> 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 (TaxonomyCategory 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;
ListTaxonomyCategoriesAsync(string, string, int?, CallSettings)
API to retrieve a list of TaxonomyCategory
objects.
Declaration
public virtual PagedAsyncEnumerable<ListTaxonomyCategoriesResponse, TaxonomyCategory> ListTaxonomyCategoriesAsync(string parent, string pageToken = null, int? pageSize = null, CallSettings callSettings = null)
Parameters
Type | Name | Description |
---|---|---|
string | parent | Required. The parent, which owns this collection of TaxonomyCategories.
Format: |
string | pageToken | The token returned from the previous request. A value of |
int? | pageSize | The size of page to request. The response will not be larger than this, but may be smaller. A value of
|
CallSettings | callSettings | If not null, applies overrides to this RPC call. |
Returns
Type | Description |
---|---|
PagedAsyncEnumerable<ListTaxonomyCategoriesResponse, TaxonomyCategory> | A pageable asynchronous sequence of TaxonomyCategory resources. |
Sample code
// Create client
TaxonomyCategoryServiceClient taxonomyCategoryServiceClient = await TaxonomyCategoryServiceClient.CreateAsync();
// Initialize request argument(s)
string parent = "networks/[NETWORK_CODE]";
// Make the request
PagedAsyncEnumerable<ListTaxonomyCategoriesResponse, TaxonomyCategory> response = taxonomyCategoryServiceClient.ListTaxonomyCategoriesAsync(parent);
// Iterate over all response items, lazily performing RPCs as required
await response.ForEachAsync((TaxonomyCategory 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((ListTaxonomyCategoriesResponse page) =>
{
// Do something with each page of items
Console.WriteLine("A page of results:");
foreach (TaxonomyCategory 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<TaxonomyCategory> 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 (TaxonomyCategory 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.