Show / Hide Table of Contents

Class CustomTargetingValueServiceClient

CustomTargetingValueService client wrapper, for convenient use.

Inheritance
object
CustomTargetingValueServiceClient
CustomTargetingValueServiceClientImpl
Inherited Members
object.GetHashCode()
object.GetType()
object.MemberwiseClone()
object.ToString()
Namespace: Google.Ads.AdManager.V1
Assembly: Google.Ads.AdManager.V1.dll
Syntax
public abstract class CustomTargetingValueServiceClient
Remarks

Provides methods for handling CustomTargetingValue objects.

Properties

DefaultEndpoint

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

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

The default CustomTargetingValueService scopes are:

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

GrpcClient

The underlying gRPC CustomTargetingValueService client

Declaration
public virtual CustomTargetingValueService.CustomTargetingValueServiceClient GrpcClient { get; }
Property Value
Type Description
CustomTargetingValueService.CustomTargetingValueServiceClient

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

Declaration
public static CustomTargetingValueServiceClient Create()
Returns
Type Description
CustomTargetingValueServiceClient

The created CustomTargetingValueServiceClient.

CreateAsync(CancellationToken)

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

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

The CancellationToken to use while creating the client.

Returns
Type Description
Task<CustomTargetingValueServiceClient>

The task representing the created CustomTargetingValueServiceClient.

GetCustomTargetingValue(CustomTargetingValueName, CallSettings)

API to retrieve a CustomTargetingValue object.

Declaration
public virtual CustomTargetingValue GetCustomTargetingValue(CustomTargetingValueName name, CallSettings callSettings = null)
Parameters
Type Name Description
CustomTargetingValueName name

Required. The resource name of the CustomTargetingValue. Format: networks/{network_code}/customTargetingValues/{custom_targeting_value_id}

CallSettings callSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
CustomTargetingValue

The RPC response.

Sample code
// Create client
CustomTargetingValueServiceClient customTargetingValueServiceClient = CustomTargetingValueServiceClient.Create();
// Initialize request argument(s)
CustomTargetingValueName name = CustomTargetingValueName.FromNetworkCodeCustomTargetingValue("[NETWORK_CODE]", "[CUSTOM_TARGETING_VALUE]");
// Make the request
CustomTargetingValue response = customTargetingValueServiceClient.GetCustomTargetingValue(name);

GetCustomTargetingValue(GetCustomTargetingValueRequest, CallSettings)

API to retrieve a CustomTargetingValue object.

Declaration
public virtual CustomTargetingValue GetCustomTargetingValue(GetCustomTargetingValueRequest request, CallSettings callSettings = null)
Parameters
Type Name Description
GetCustomTargetingValueRequest 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
CustomTargetingValue

The RPC response.

Sample code
// Create client
CustomTargetingValueServiceClient customTargetingValueServiceClient = CustomTargetingValueServiceClient.Create();
// Initialize request argument(s)
GetCustomTargetingValueRequest request = new GetCustomTargetingValueRequest
{
    CustomTargetingValueName = CustomTargetingValueName.FromNetworkCodeCustomTargetingValue("[NETWORK_CODE]", "[CUSTOM_TARGETING_VALUE]"),
};
// Make the request
CustomTargetingValue response = customTargetingValueServiceClient.GetCustomTargetingValue(request);

GetCustomTargetingValue(string, CallSettings)

API to retrieve a CustomTargetingValue object.

Declaration
public virtual CustomTargetingValue GetCustomTargetingValue(string name, CallSettings callSettings = null)
Parameters
Type Name Description
string name

Required. The resource name of the CustomTargetingValue. Format: networks/{network_code}/customTargetingValues/{custom_targeting_value_id}

CallSettings callSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
CustomTargetingValue

The RPC response.

Sample code
// Create client
CustomTargetingValueServiceClient customTargetingValueServiceClient = CustomTargetingValueServiceClient.Create();
// Initialize request argument(s)
string name = "networks/[NETWORK_CODE]/customTargetingValues/[CUSTOM_TARGETING_VALUE]";
// Make the request
CustomTargetingValue response = customTargetingValueServiceClient.GetCustomTargetingValue(name);

GetCustomTargetingValueAsync(CustomTargetingValueName, CallSettings)

API to retrieve a CustomTargetingValue object.

Declaration
public virtual Task<CustomTargetingValue> GetCustomTargetingValueAsync(CustomTargetingValueName name, CallSettings callSettings = null)
Parameters
Type Name Description
CustomTargetingValueName name

Required. The resource name of the CustomTargetingValue. Format: networks/{network_code}/customTargetingValues/{custom_targeting_value_id}

CallSettings callSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
Task<CustomTargetingValue>

A Task containing the RPC response.

Sample code
// Create client
CustomTargetingValueServiceClient customTargetingValueServiceClient = await CustomTargetingValueServiceClient.CreateAsync();
// Initialize request argument(s)
CustomTargetingValueName name = CustomTargetingValueName.FromNetworkCodeCustomTargetingValue("[NETWORK_CODE]", "[CUSTOM_TARGETING_VALUE]");
// Make the request
CustomTargetingValue response = await customTargetingValueServiceClient.GetCustomTargetingValueAsync(name);

GetCustomTargetingValueAsync(CustomTargetingValueName, CancellationToken)

API to retrieve a CustomTargetingValue object.

Declaration
public virtual Task<CustomTargetingValue> GetCustomTargetingValueAsync(CustomTargetingValueName name, CancellationToken cancellationToken)
Parameters
Type Name Description
CustomTargetingValueName name

Required. The resource name of the CustomTargetingValue. Format: networks/{network_code}/customTargetingValues/{custom_targeting_value_id}

CancellationToken cancellationToken

A CancellationToken to use for this RPC.

Returns
Type Description
Task<CustomTargetingValue>

A Task containing the RPC response.

Sample code
// Create client
CustomTargetingValueServiceClient customTargetingValueServiceClient = await CustomTargetingValueServiceClient.CreateAsync();
// Initialize request argument(s)
CustomTargetingValueName name = CustomTargetingValueName.FromNetworkCodeCustomTargetingValue("[NETWORK_CODE]", "[CUSTOM_TARGETING_VALUE]");
// Make the request
CustomTargetingValue response = await customTargetingValueServiceClient.GetCustomTargetingValueAsync(name);

GetCustomTargetingValueAsync(GetCustomTargetingValueRequest, CallSettings)

API to retrieve a CustomTargetingValue object.

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

A Task containing the RPC response.

Sample code
// Create client
CustomTargetingValueServiceClient customTargetingValueServiceClient = await CustomTargetingValueServiceClient.CreateAsync();
// Initialize request argument(s)
GetCustomTargetingValueRequest request = new GetCustomTargetingValueRequest
{
    CustomTargetingValueName = CustomTargetingValueName.FromNetworkCodeCustomTargetingValue("[NETWORK_CODE]", "[CUSTOM_TARGETING_VALUE]"),
};
// Make the request
CustomTargetingValue response = await customTargetingValueServiceClient.GetCustomTargetingValueAsync(request);

GetCustomTargetingValueAsync(GetCustomTargetingValueRequest, CancellationToken)

API to retrieve a CustomTargetingValue object.

Declaration
public virtual Task<CustomTargetingValue> GetCustomTargetingValueAsync(GetCustomTargetingValueRequest request, CancellationToken cancellationToken)
Parameters
Type Name Description
GetCustomTargetingValueRequest 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<CustomTargetingValue>

A Task containing the RPC response.

Sample code
// Create client
CustomTargetingValueServiceClient customTargetingValueServiceClient = await CustomTargetingValueServiceClient.CreateAsync();
// Initialize request argument(s)
GetCustomTargetingValueRequest request = new GetCustomTargetingValueRequest
{
    CustomTargetingValueName = CustomTargetingValueName.FromNetworkCodeCustomTargetingValue("[NETWORK_CODE]", "[CUSTOM_TARGETING_VALUE]"),
};
// Make the request
CustomTargetingValue response = await customTargetingValueServiceClient.GetCustomTargetingValueAsync(request);

GetCustomTargetingValueAsync(string, CallSettings)

API to retrieve a CustomTargetingValue object.

Declaration
public virtual Task<CustomTargetingValue> GetCustomTargetingValueAsync(string name, CallSettings callSettings = null)
Parameters
Type Name Description
string name

Required. The resource name of the CustomTargetingValue. Format: networks/{network_code}/customTargetingValues/{custom_targeting_value_id}

CallSettings callSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
Task<CustomTargetingValue>

A Task containing the RPC response.

Sample code
// Create client
CustomTargetingValueServiceClient customTargetingValueServiceClient = await CustomTargetingValueServiceClient.CreateAsync();
// Initialize request argument(s)
string name = "networks/[NETWORK_CODE]/customTargetingValues/[CUSTOM_TARGETING_VALUE]";
// Make the request
CustomTargetingValue response = await customTargetingValueServiceClient.GetCustomTargetingValueAsync(name);

GetCustomTargetingValueAsync(string, CancellationToken)

API to retrieve a CustomTargetingValue object.

Declaration
public virtual Task<CustomTargetingValue> GetCustomTargetingValueAsync(string name, CancellationToken cancellationToken)
Parameters
Type Name Description
string name

Required. The resource name of the CustomTargetingValue. Format: networks/{network_code}/customTargetingValues/{custom_targeting_value_id}

CancellationToken cancellationToken

A CancellationToken to use for this RPC.

Returns
Type Description
Task<CustomTargetingValue>

A Task containing the RPC response.

Sample code
// Create client
CustomTargetingValueServiceClient customTargetingValueServiceClient = await CustomTargetingValueServiceClient.CreateAsync();
// Initialize request argument(s)
string name = "networks/[NETWORK_CODE]/customTargetingValues/[CUSTOM_TARGETING_VALUE]";
// Make the request
CustomTargetingValue response = await customTargetingValueServiceClient.GetCustomTargetingValueAsync(name);

ListCustomTargetingValues(ListCustomTargetingValuesRequest, CallSettings)

API to retrieve a list of CustomTargetingValue objects.

Declaration
public virtual PagedEnumerable<ListCustomTargetingValuesResponse, CustomTargetingValue> ListCustomTargetingValues(ListCustomTargetingValuesRequest request, CallSettings callSettings = null)
Parameters
Type Name Description
ListCustomTargetingValuesRequest 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<ListCustomTargetingValuesResponse, CustomTargetingValue>

A pageable sequence of CustomTargetingValue resources.

Sample code
// Create client
CustomTargetingValueServiceClient customTargetingValueServiceClient = CustomTargetingValueServiceClient.Create();
// Initialize request argument(s)
ListCustomTargetingValuesRequest request = new ListCustomTargetingValuesRequest
{
    ParentAsNetworkName = NetworkName.FromNetworkCode("[NETWORK_CODE]"),
    Filter = "",
    OrderBy = "",
    Skip = 0,
};
// Make the request
PagedEnumerable<ListCustomTargetingValuesResponse, CustomTargetingValue> response = customTargetingValueServiceClient.ListCustomTargetingValues(request);

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

ListCustomTargetingValues(NetworkName, string, int?, CallSettings)

API to retrieve a list of CustomTargetingValue objects.

Declaration
public virtual PagedEnumerable<ListCustomTargetingValuesResponse, CustomTargetingValue> ListCustomTargetingValues(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 CustomTargetingValues. Format: networks/{network_code}

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<ListCustomTargetingValuesResponse, CustomTargetingValue>

A pageable sequence of CustomTargetingValue resources.

Sample code
// Create client
CustomTargetingValueServiceClient customTargetingValueServiceClient = CustomTargetingValueServiceClient.Create();
// Initialize request argument(s)
NetworkName parent = NetworkName.FromNetworkCode("[NETWORK_CODE]");
// Make the request
PagedEnumerable<ListCustomTargetingValuesResponse, CustomTargetingValue> response = customTargetingValueServiceClient.ListCustomTargetingValues(parent);

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

ListCustomTargetingValues(string, string, int?, CallSettings)

API to retrieve a list of CustomTargetingValue objects.

Declaration
public virtual PagedEnumerable<ListCustomTargetingValuesResponse, CustomTargetingValue> ListCustomTargetingValues(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 CustomTargetingValues. Format: networks/{network_code}

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<ListCustomTargetingValuesResponse, CustomTargetingValue>

A pageable sequence of CustomTargetingValue resources.

Sample code
// Create client
CustomTargetingValueServiceClient customTargetingValueServiceClient = CustomTargetingValueServiceClient.Create();
// Initialize request argument(s)
string parent = "networks/[NETWORK_CODE]";
// Make the request
PagedEnumerable<ListCustomTargetingValuesResponse, CustomTargetingValue> response = customTargetingValueServiceClient.ListCustomTargetingValues(parent);

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

ListCustomTargetingValuesAsync(ListCustomTargetingValuesRequest, CallSettings)

API to retrieve a list of CustomTargetingValue objects.

Declaration
public virtual PagedAsyncEnumerable<ListCustomTargetingValuesResponse, CustomTargetingValue> ListCustomTargetingValuesAsync(ListCustomTargetingValuesRequest request, CallSettings callSettings = null)
Parameters
Type Name Description
ListCustomTargetingValuesRequest 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<ListCustomTargetingValuesResponse, CustomTargetingValue>

A pageable asynchronous sequence of CustomTargetingValue resources.

Sample code
// Create client
CustomTargetingValueServiceClient customTargetingValueServiceClient = await CustomTargetingValueServiceClient.CreateAsync();
// Initialize request argument(s)
ListCustomTargetingValuesRequest request = new ListCustomTargetingValuesRequest
{
    ParentAsNetworkName = NetworkName.FromNetworkCode("[NETWORK_CODE]"),
    Filter = "",
    OrderBy = "",
    Skip = 0,
};
// Make the request
PagedAsyncEnumerable<ListCustomTargetingValuesResponse, CustomTargetingValue> response = customTargetingValueServiceClient.ListCustomTargetingValuesAsync(request);

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

ListCustomTargetingValuesAsync(NetworkName, string, int?, CallSettings)

API to retrieve a list of CustomTargetingValue objects.

Declaration
public virtual PagedAsyncEnumerable<ListCustomTargetingValuesResponse, CustomTargetingValue> ListCustomTargetingValuesAsync(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 CustomTargetingValues. Format: networks/{network_code}

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<ListCustomTargetingValuesResponse, CustomTargetingValue>

A pageable asynchronous sequence of CustomTargetingValue resources.

Sample code
// Create client
CustomTargetingValueServiceClient customTargetingValueServiceClient = await CustomTargetingValueServiceClient.CreateAsync();
// Initialize request argument(s)
NetworkName parent = NetworkName.FromNetworkCode("[NETWORK_CODE]");
// Make the request
PagedAsyncEnumerable<ListCustomTargetingValuesResponse, CustomTargetingValue> response = customTargetingValueServiceClient.ListCustomTargetingValuesAsync(parent);

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

ListCustomTargetingValuesAsync(string, string, int?, CallSettings)

API to retrieve a list of CustomTargetingValue objects.

Declaration
public virtual PagedAsyncEnumerable<ListCustomTargetingValuesResponse, CustomTargetingValue> ListCustomTargetingValuesAsync(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 CustomTargetingValues. Format: networks/{network_code}

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<ListCustomTargetingValuesResponse, CustomTargetingValue>

A pageable asynchronous sequence of CustomTargetingValue resources.

Sample code
// Create client
CustomTargetingValueServiceClient customTargetingValueServiceClient = await CustomTargetingValueServiceClient.CreateAsync();
// Initialize request argument(s)
string parent = "networks/[NETWORK_CODE]";
// Make the request
PagedAsyncEnumerable<ListCustomTargetingValuesResponse, CustomTargetingValue> response = customTargetingValueServiceClient.ListCustomTargetingValuesAsync(parent);

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