Class ProgrammaticBuyerServiceClient
ProgrammaticBuyerService client wrapper, for convenient use.
Namespace: Google.Ads.AdManager.V1
Assembly: Google.Ads.AdManager.V1.dll
Syntax
public abstract class ProgrammaticBuyerServiceClient
Remarks
Provides methods for handling ProgrammaticBuyer objects.
Properties
DefaultEndpoint
The default endpoint for the ProgrammaticBuyerService 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 ProgrammaticBuyerService scopes.
Declaration
public static IReadOnlyList<string> DefaultScopes { get; }
Property Value
| Type | Description |
|---|---|
| IReadOnlyList<string> |
Remarks
The default ProgrammaticBuyerService scopes are:
- https://www.googleapis.com/auth/admanager
GrpcClient
The underlying gRPC ProgrammaticBuyerService client
Declaration
public virtual ProgrammaticBuyerService.ProgrammaticBuyerServiceClient GrpcClient { get; }
Property Value
| Type | Description |
|---|---|
| ProgrammaticBuyerService.ProgrammaticBuyerServiceClient |
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 ProgrammaticBuyerServiceClient using the default credentials, endpoint and settings. To specify custom credentials or other settings, use ProgrammaticBuyerServiceClientBuilder.
Declaration
public static ProgrammaticBuyerServiceClient Create()
Returns
| Type | Description |
|---|---|
| ProgrammaticBuyerServiceClient | The created ProgrammaticBuyerServiceClient. |
CreateAsync(CancellationToken)
Asynchronously creates a ProgrammaticBuyerServiceClient using the default credentials, endpoint and settings. To specify custom credentials or other settings, use ProgrammaticBuyerServiceClientBuilder.
Declaration
public static Task<ProgrammaticBuyerServiceClient> CreateAsync(CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| CancellationToken | cancellationToken | The CancellationToken to use while creating the client. |
Returns
| Type | Description |
|---|---|
| Task<ProgrammaticBuyerServiceClient> | The task representing the created ProgrammaticBuyerServiceClient. |
GetProgrammaticBuyer(GetProgrammaticBuyerRequest, CallSettings)
API to retrieve a ProgrammaticBuyer object.
Declaration
public virtual ProgrammaticBuyer GetProgrammaticBuyer(GetProgrammaticBuyerRequest request, CallSettings callSettings = null)
Parameters
| Type | Name | Description |
|---|---|---|
| GetProgrammaticBuyerRequest | 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 |
|---|---|
| ProgrammaticBuyer | The RPC response. |
Sample code
// Create client
ProgrammaticBuyerServiceClient programmaticBuyerServiceClient = ProgrammaticBuyerServiceClient.Create();
// Initialize request argument(s)
GetProgrammaticBuyerRequest request = new GetProgrammaticBuyerRequest
{
ProgrammaticBuyerName = ProgrammaticBuyerName.FromNetworkCodeProgrammaticBuyer("[NETWORK_CODE]", "[PROGRAMMATIC_BUYER]"),
};
// Make the request
ProgrammaticBuyer response = programmaticBuyerServiceClient.GetProgrammaticBuyer(request);
GetProgrammaticBuyer(ProgrammaticBuyerName, CallSettings)
API to retrieve a ProgrammaticBuyer object.
Declaration
public virtual ProgrammaticBuyer GetProgrammaticBuyer(ProgrammaticBuyerName name, CallSettings callSettings = null)
Parameters
| Type | Name | Description |
|---|---|---|
| ProgrammaticBuyerName | name | Required. The resource name of the ProgrammaticBuyer.
Format:
|
| CallSettings | callSettings | If not null, applies overrides to this RPC call. |
Returns
| Type | Description |
|---|---|
| ProgrammaticBuyer | The RPC response. |
Sample code
// Create client
ProgrammaticBuyerServiceClient programmaticBuyerServiceClient = ProgrammaticBuyerServiceClient.Create();
// Initialize request argument(s)
ProgrammaticBuyerName name = ProgrammaticBuyerName.FromNetworkCodeProgrammaticBuyer("[NETWORK_CODE]", "[PROGRAMMATIC_BUYER]");
// Make the request
ProgrammaticBuyer response = programmaticBuyerServiceClient.GetProgrammaticBuyer(name);
GetProgrammaticBuyer(string, CallSettings)
API to retrieve a ProgrammaticBuyer object.
Declaration
public virtual ProgrammaticBuyer GetProgrammaticBuyer(string name, CallSettings callSettings = null)
Parameters
| Type | Name | Description |
|---|---|---|
| string | name | Required. The resource name of the ProgrammaticBuyer.
Format:
|
| CallSettings | callSettings | If not null, applies overrides to this RPC call. |
Returns
| Type | Description |
|---|---|
| ProgrammaticBuyer | The RPC response. |
Sample code
// Create client
ProgrammaticBuyerServiceClient programmaticBuyerServiceClient = ProgrammaticBuyerServiceClient.Create();
// Initialize request argument(s)
string name = "networks/[NETWORK_CODE]/programmaticBuyers/[PROGRAMMATIC_BUYER]";
// Make the request
ProgrammaticBuyer response = programmaticBuyerServiceClient.GetProgrammaticBuyer(name);
GetProgrammaticBuyerAsync(GetProgrammaticBuyerRequest, CallSettings)
API to retrieve a ProgrammaticBuyer object.
Declaration
public virtual Task<ProgrammaticBuyer> GetProgrammaticBuyerAsync(GetProgrammaticBuyerRequest request, CallSettings callSettings = null)
Parameters
| Type | Name | Description |
|---|---|---|
| GetProgrammaticBuyerRequest | 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<ProgrammaticBuyer> | A Task containing the RPC response. |
Sample code
// Create client
ProgrammaticBuyerServiceClient programmaticBuyerServiceClient = await ProgrammaticBuyerServiceClient.CreateAsync();
// Initialize request argument(s)
GetProgrammaticBuyerRequest request = new GetProgrammaticBuyerRequest
{
ProgrammaticBuyerName = ProgrammaticBuyerName.FromNetworkCodeProgrammaticBuyer("[NETWORK_CODE]", "[PROGRAMMATIC_BUYER]"),
};
// Make the request
ProgrammaticBuyer response = await programmaticBuyerServiceClient.GetProgrammaticBuyerAsync(request);
GetProgrammaticBuyerAsync(GetProgrammaticBuyerRequest, CancellationToken)
API to retrieve a ProgrammaticBuyer object.
Declaration
public virtual Task<ProgrammaticBuyer> GetProgrammaticBuyerAsync(GetProgrammaticBuyerRequest request, CancellationToken cancellationToken)
Parameters
| Type | Name | Description |
|---|---|---|
| GetProgrammaticBuyerRequest | 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<ProgrammaticBuyer> | A Task containing the RPC response. |
Sample code
// Create client
ProgrammaticBuyerServiceClient programmaticBuyerServiceClient = await ProgrammaticBuyerServiceClient.CreateAsync();
// Initialize request argument(s)
GetProgrammaticBuyerRequest request = new GetProgrammaticBuyerRequest
{
ProgrammaticBuyerName = ProgrammaticBuyerName.FromNetworkCodeProgrammaticBuyer("[NETWORK_CODE]", "[PROGRAMMATIC_BUYER]"),
};
// Make the request
ProgrammaticBuyer response = await programmaticBuyerServiceClient.GetProgrammaticBuyerAsync(request);
GetProgrammaticBuyerAsync(ProgrammaticBuyerName, CallSettings)
API to retrieve a ProgrammaticBuyer object.
Declaration
public virtual Task<ProgrammaticBuyer> GetProgrammaticBuyerAsync(ProgrammaticBuyerName name, CallSettings callSettings = null)
Parameters
| Type | Name | Description |
|---|---|---|
| ProgrammaticBuyerName | name | Required. The resource name of the ProgrammaticBuyer.
Format:
|
| CallSettings | callSettings | If not null, applies overrides to this RPC call. |
Returns
| Type | Description |
|---|---|
| Task<ProgrammaticBuyer> | A Task containing the RPC response. |
Sample code
// Create client
ProgrammaticBuyerServiceClient programmaticBuyerServiceClient = await ProgrammaticBuyerServiceClient.CreateAsync();
// Initialize request argument(s)
ProgrammaticBuyerName name = ProgrammaticBuyerName.FromNetworkCodeProgrammaticBuyer("[NETWORK_CODE]", "[PROGRAMMATIC_BUYER]");
// Make the request
ProgrammaticBuyer response = await programmaticBuyerServiceClient.GetProgrammaticBuyerAsync(name);
GetProgrammaticBuyerAsync(ProgrammaticBuyerName, CancellationToken)
API to retrieve a ProgrammaticBuyer object.
Declaration
public virtual Task<ProgrammaticBuyer> GetProgrammaticBuyerAsync(ProgrammaticBuyerName name, CancellationToken cancellationToken)
Parameters
| Type | Name | Description |
|---|---|---|
| ProgrammaticBuyerName | name | Required. The resource name of the ProgrammaticBuyer.
Format:
|
| CancellationToken | cancellationToken | A CancellationToken to use for this RPC. |
Returns
| Type | Description |
|---|---|
| Task<ProgrammaticBuyer> | A Task containing the RPC response. |
Sample code
// Create client
ProgrammaticBuyerServiceClient programmaticBuyerServiceClient = await ProgrammaticBuyerServiceClient.CreateAsync();
// Initialize request argument(s)
ProgrammaticBuyerName name = ProgrammaticBuyerName.FromNetworkCodeProgrammaticBuyer("[NETWORK_CODE]", "[PROGRAMMATIC_BUYER]");
// Make the request
ProgrammaticBuyer response = await programmaticBuyerServiceClient.GetProgrammaticBuyerAsync(name);
GetProgrammaticBuyerAsync(string, CallSettings)
API to retrieve a ProgrammaticBuyer object.
Declaration
public virtual Task<ProgrammaticBuyer> GetProgrammaticBuyerAsync(string name, CallSettings callSettings = null)
Parameters
| Type | Name | Description |
|---|---|---|
| string | name | Required. The resource name of the ProgrammaticBuyer.
Format:
|
| CallSettings | callSettings | If not null, applies overrides to this RPC call. |
Returns
| Type | Description |
|---|---|
| Task<ProgrammaticBuyer> | A Task containing the RPC response. |
Sample code
// Create client
ProgrammaticBuyerServiceClient programmaticBuyerServiceClient = await ProgrammaticBuyerServiceClient.CreateAsync();
// Initialize request argument(s)
string name = "networks/[NETWORK_CODE]/programmaticBuyers/[PROGRAMMATIC_BUYER]";
// Make the request
ProgrammaticBuyer response = await programmaticBuyerServiceClient.GetProgrammaticBuyerAsync(name);
GetProgrammaticBuyerAsync(string, CancellationToken)
API to retrieve a ProgrammaticBuyer object.
Declaration
public virtual Task<ProgrammaticBuyer> GetProgrammaticBuyerAsync(string name, CancellationToken cancellationToken)
Parameters
| Type | Name | Description |
|---|---|---|
| string | name | Required. The resource name of the ProgrammaticBuyer.
Format:
|
| CancellationToken | cancellationToken | A CancellationToken to use for this RPC. |
Returns
| Type | Description |
|---|---|
| Task<ProgrammaticBuyer> | A Task containing the RPC response. |
Sample code
// Create client
ProgrammaticBuyerServiceClient programmaticBuyerServiceClient = await ProgrammaticBuyerServiceClient.CreateAsync();
// Initialize request argument(s)
string name = "networks/[NETWORK_CODE]/programmaticBuyers/[PROGRAMMATIC_BUYER]";
// Make the request
ProgrammaticBuyer response = await programmaticBuyerServiceClient.GetProgrammaticBuyerAsync(name);
ListProgrammaticBuyers(ListProgrammaticBuyersRequest, CallSettings)
API to retrieve a list of ProgrammaticBuyer objects.
Declaration
public virtual PagedEnumerable<ListProgrammaticBuyersResponse, ProgrammaticBuyer> ListProgrammaticBuyers(ListProgrammaticBuyersRequest request, CallSettings callSettings = null)
Parameters
| Type | Name | Description |
|---|---|---|
| ListProgrammaticBuyersRequest | 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<ListProgrammaticBuyersResponse, ProgrammaticBuyer> | A pageable sequence of ProgrammaticBuyer resources. |
Sample code
// Create client
ProgrammaticBuyerServiceClient programmaticBuyerServiceClient = ProgrammaticBuyerServiceClient.Create();
// Initialize request argument(s)
ListProgrammaticBuyersRequest request = new ListProgrammaticBuyersRequest
{
ParentAsNetworkName = NetworkName.FromNetworkCode("[NETWORK_CODE]"),
Filter = "",
OrderBy = "",
Skip = 0,
};
// Make the request
PagedEnumerable<ListProgrammaticBuyersResponse, ProgrammaticBuyer> response = programmaticBuyerServiceClient.ListProgrammaticBuyers(request);
// Iterate over all response items, lazily performing RPCs as required
foreach (ProgrammaticBuyer 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 (ListProgrammaticBuyersResponse page in response.AsRawResponses())
{
// Do something with each page of items
Console.WriteLine("A page of results:");
foreach (ProgrammaticBuyer 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<ProgrammaticBuyer> 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 (ProgrammaticBuyer 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;
ListProgrammaticBuyers(NetworkName, string, int?, CallSettings)
API to retrieve a list of ProgrammaticBuyer objects.
Declaration
public virtual PagedEnumerable<ListProgrammaticBuyersResponse, ProgrammaticBuyer> ListProgrammaticBuyers(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 ProgrammaticBuyers.
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<ListProgrammaticBuyersResponse, ProgrammaticBuyer> | A pageable sequence of ProgrammaticBuyer resources. |
Sample code
// Create client
ProgrammaticBuyerServiceClient programmaticBuyerServiceClient = ProgrammaticBuyerServiceClient.Create();
// Initialize request argument(s)
NetworkName parent = NetworkName.FromNetworkCode("[NETWORK_CODE]");
// Make the request
PagedEnumerable<ListProgrammaticBuyersResponse, ProgrammaticBuyer> response = programmaticBuyerServiceClient.ListProgrammaticBuyers(parent);
// Iterate over all response items, lazily performing RPCs as required
foreach (ProgrammaticBuyer 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 (ListProgrammaticBuyersResponse page in response.AsRawResponses())
{
// Do something with each page of items
Console.WriteLine("A page of results:");
foreach (ProgrammaticBuyer 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<ProgrammaticBuyer> 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 (ProgrammaticBuyer 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;
ListProgrammaticBuyers(string, string, int?, CallSettings)
API to retrieve a list of ProgrammaticBuyer objects.
Declaration
public virtual PagedEnumerable<ListProgrammaticBuyersResponse, ProgrammaticBuyer> ListProgrammaticBuyers(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 ProgrammaticBuyers.
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<ListProgrammaticBuyersResponse, ProgrammaticBuyer> | A pageable sequence of ProgrammaticBuyer resources. |
Sample code
// Create client
ProgrammaticBuyerServiceClient programmaticBuyerServiceClient = ProgrammaticBuyerServiceClient.Create();
// Initialize request argument(s)
string parent = "networks/[NETWORK_CODE]";
// Make the request
PagedEnumerable<ListProgrammaticBuyersResponse, ProgrammaticBuyer> response = programmaticBuyerServiceClient.ListProgrammaticBuyers(parent);
// Iterate over all response items, lazily performing RPCs as required
foreach (ProgrammaticBuyer 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 (ListProgrammaticBuyersResponse page in response.AsRawResponses())
{
// Do something with each page of items
Console.WriteLine("A page of results:");
foreach (ProgrammaticBuyer 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<ProgrammaticBuyer> 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 (ProgrammaticBuyer 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;
ListProgrammaticBuyersAsync(ListProgrammaticBuyersRequest, CallSettings)
API to retrieve a list of ProgrammaticBuyer objects.
Declaration
public virtual PagedAsyncEnumerable<ListProgrammaticBuyersResponse, ProgrammaticBuyer> ListProgrammaticBuyersAsync(ListProgrammaticBuyersRequest request, CallSettings callSettings = null)
Parameters
| Type | Name | Description |
|---|---|---|
| ListProgrammaticBuyersRequest | 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<ListProgrammaticBuyersResponse, ProgrammaticBuyer> | A pageable asynchronous sequence of ProgrammaticBuyer resources. |
Sample code
// Create client
ProgrammaticBuyerServiceClient programmaticBuyerServiceClient = await ProgrammaticBuyerServiceClient.CreateAsync();
// Initialize request argument(s)
ListProgrammaticBuyersRequest request = new ListProgrammaticBuyersRequest
{
ParentAsNetworkName = NetworkName.FromNetworkCode("[NETWORK_CODE]"),
Filter = "",
OrderBy = "",
Skip = 0,
};
// Make the request
PagedAsyncEnumerable<ListProgrammaticBuyersResponse, ProgrammaticBuyer> response = programmaticBuyerServiceClient.ListProgrammaticBuyersAsync(request);
// Iterate over all response items, lazily performing RPCs as required
await response.ForEachAsync((ProgrammaticBuyer 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((ListProgrammaticBuyersResponse page) =>
{
// Do something with each page of items
Console.WriteLine("A page of results:");
foreach (ProgrammaticBuyer 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<ProgrammaticBuyer> 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 (ProgrammaticBuyer 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;
ListProgrammaticBuyersAsync(NetworkName, string, int?, CallSettings)
API to retrieve a list of ProgrammaticBuyer objects.
Declaration
public virtual PagedAsyncEnumerable<ListProgrammaticBuyersResponse, ProgrammaticBuyer> ListProgrammaticBuyersAsync(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 ProgrammaticBuyers.
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<ListProgrammaticBuyersResponse, ProgrammaticBuyer> | A pageable asynchronous sequence of ProgrammaticBuyer resources. |
Sample code
// Create client
ProgrammaticBuyerServiceClient programmaticBuyerServiceClient = await ProgrammaticBuyerServiceClient.CreateAsync();
// Initialize request argument(s)
NetworkName parent = NetworkName.FromNetworkCode("[NETWORK_CODE]");
// Make the request
PagedAsyncEnumerable<ListProgrammaticBuyersResponse, ProgrammaticBuyer> response = programmaticBuyerServiceClient.ListProgrammaticBuyersAsync(parent);
// Iterate over all response items, lazily performing RPCs as required
await response.ForEachAsync((ProgrammaticBuyer 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((ListProgrammaticBuyersResponse page) =>
{
// Do something with each page of items
Console.WriteLine("A page of results:");
foreach (ProgrammaticBuyer 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<ProgrammaticBuyer> 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 (ProgrammaticBuyer 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;
ListProgrammaticBuyersAsync(string, string, int?, CallSettings)
API to retrieve a list of ProgrammaticBuyer objects.
Declaration
public virtual PagedAsyncEnumerable<ListProgrammaticBuyersResponse, ProgrammaticBuyer> ListProgrammaticBuyersAsync(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 ProgrammaticBuyers.
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<ListProgrammaticBuyersResponse, ProgrammaticBuyer> | A pageable asynchronous sequence of ProgrammaticBuyer resources. |
Sample code
// Create client
ProgrammaticBuyerServiceClient programmaticBuyerServiceClient = await ProgrammaticBuyerServiceClient.CreateAsync();
// Initialize request argument(s)
string parent = "networks/[NETWORK_CODE]";
// Make the request
PagedAsyncEnumerable<ListProgrammaticBuyersResponse, ProgrammaticBuyer> response = programmaticBuyerServiceClient.ListProgrammaticBuyersAsync(parent);
// Iterate over all response items, lazily performing RPCs as required
await response.ForEachAsync((ProgrammaticBuyer 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((ListProgrammaticBuyersResponse page) =>
{
// Do something with each page of items
Console.WriteLine("A page of results:");
foreach (ProgrammaticBuyer 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<ProgrammaticBuyer> 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 (ProgrammaticBuyer 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.