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