Class NetworkServiceClient
NetworkService client wrapper, for convenient use.
Namespace: Google.Ads.AdManager.V1
Assembly: Google.Ads.AdManager.V1.dll
Syntax
public abstract class NetworkServiceClient
Remarks
Provides methods for handling Network objects.
Properties
DefaultEndpoint
The default endpoint for the NetworkService 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 NetworkService scopes.
Declaration
public static IReadOnlyList<string> DefaultScopes { get; }
Property Value
Type | Description |
---|---|
IReadOnlyList<string> |
Remarks
The default NetworkService scopes are:
GrpcClient
The underlying gRPC NetworkService client
Declaration
public virtual NetworkService.NetworkServiceClient GrpcClient { get; }
Property Value
Type | Description |
---|---|
NetworkService.NetworkServiceClient |
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 NetworkServiceClient using the default credentials, endpoint and settings. To specify custom credentials or other settings, use NetworkServiceClientBuilder.
Declaration
public static NetworkServiceClient Create()
Returns
Type | Description |
---|---|
NetworkServiceClient | The created NetworkServiceClient. |
CreateAsync(CancellationToken)
Asynchronously creates a NetworkServiceClient using the default credentials, endpoint and settings. To specify custom credentials or other settings, use NetworkServiceClientBuilder.
Declaration
public static Task<NetworkServiceClient> CreateAsync(CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
CancellationToken | cancellationToken | The CancellationToken to use while creating the client. |
Returns
Type | Description |
---|---|
Task<NetworkServiceClient> | The task representing the created NetworkServiceClient. |
GetNetwork(GetNetworkRequest, CallSettings)
API to retrieve a Network object.
Declaration
public virtual Network GetNetwork(GetNetworkRequest request, CallSettings callSettings = null)
Parameters
Type | Name | Description |
---|---|---|
GetNetworkRequest | 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 |
---|---|
Network | The RPC response. |
Sample code
// Create client
NetworkServiceClient networkServiceClient = NetworkServiceClient.Create();
// Initialize request argument(s)
GetNetworkRequest request = new GetNetworkRequest
{
NetworkName = NetworkName.FromNetworkCode("[NETWORK_CODE]"),
};
// Make the request
Network response = networkServiceClient.GetNetwork(request);
GetNetwork(NetworkName, CallSettings)
API to retrieve a Network object.
Declaration
public virtual Network GetNetwork(NetworkName name, CallSettings callSettings = null)
Parameters
Type | Name | Description |
---|---|---|
NetworkName | name | Required. Resource name of Network. Format: networks/{network_code} |
CallSettings | callSettings | If not null, applies overrides to this RPC call. |
Returns
Type | Description |
---|---|
Network | The RPC response. |
Sample code
// Create client
NetworkServiceClient networkServiceClient = NetworkServiceClient.Create();
// Initialize request argument(s)
NetworkName name = NetworkName.FromNetworkCode("[NETWORK_CODE]");
// Make the request
Network response = networkServiceClient.GetNetwork(name);
GetNetwork(string, CallSettings)
API to retrieve a Network object.
Declaration
public virtual Network GetNetwork(string name, CallSettings callSettings = null)
Parameters
Type | Name | Description |
---|---|---|
string | name | Required. Resource name of Network. Format: networks/{network_code} |
CallSettings | callSettings | If not null, applies overrides to this RPC call. |
Returns
Type | Description |
---|---|
Network | The RPC response. |
Sample code
// Create client
NetworkServiceClient networkServiceClient = NetworkServiceClient.Create();
// Initialize request argument(s)
string name = "networks/[NETWORK_CODE]";
// Make the request
Network response = networkServiceClient.GetNetwork(name);
GetNetworkAsync(GetNetworkRequest, CallSettings)
API to retrieve a Network object.
Declaration
public virtual Task<Network> GetNetworkAsync(GetNetworkRequest request, CallSettings callSettings = null)
Parameters
Type | Name | Description |
---|---|---|
GetNetworkRequest | 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<Network> | A Task containing the RPC response. |
Sample code
// Create client
NetworkServiceClient networkServiceClient = await NetworkServiceClient.CreateAsync();
// Initialize request argument(s)
GetNetworkRequest request = new GetNetworkRequest
{
NetworkName = NetworkName.FromNetworkCode("[NETWORK_CODE]"),
};
// Make the request
Network response = await networkServiceClient.GetNetworkAsync(request);
GetNetworkAsync(GetNetworkRequest, CancellationToken)
API to retrieve a Network object.
Declaration
public virtual Task<Network> GetNetworkAsync(GetNetworkRequest request, CancellationToken cancellationToken)
Parameters
Type | Name | Description |
---|---|---|
GetNetworkRequest | 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<Network> | A Task containing the RPC response. |
Sample code
// Create client
NetworkServiceClient networkServiceClient = await NetworkServiceClient.CreateAsync();
// Initialize request argument(s)
GetNetworkRequest request = new GetNetworkRequest
{
NetworkName = NetworkName.FromNetworkCode("[NETWORK_CODE]"),
};
// Make the request
Network response = await networkServiceClient.GetNetworkAsync(request);
GetNetworkAsync(NetworkName, CallSettings)
API to retrieve a Network object.
Declaration
public virtual Task<Network> GetNetworkAsync(NetworkName name, CallSettings callSettings = null)
Parameters
Type | Name | Description |
---|---|---|
NetworkName | name | Required. Resource name of Network. Format: networks/{network_code} |
CallSettings | callSettings | If not null, applies overrides to this RPC call. |
Returns
Type | Description |
---|---|
Task<Network> | A Task containing the RPC response. |
Sample code
// Create client
NetworkServiceClient networkServiceClient = await NetworkServiceClient.CreateAsync();
// Initialize request argument(s)
NetworkName name = NetworkName.FromNetworkCode("[NETWORK_CODE]");
// Make the request
Network response = await networkServiceClient.GetNetworkAsync(name);
GetNetworkAsync(NetworkName, CancellationToken)
API to retrieve a Network object.
Declaration
public virtual Task<Network> GetNetworkAsync(NetworkName name, CancellationToken cancellationToken)
Parameters
Type | Name | Description |
---|---|---|
NetworkName | name | Required. Resource name of Network. Format: networks/{network_code} |
CancellationToken | cancellationToken | A CancellationToken to use for this RPC. |
Returns
Type | Description |
---|---|
Task<Network> | A Task containing the RPC response. |
Sample code
// Create client
NetworkServiceClient networkServiceClient = await NetworkServiceClient.CreateAsync();
// Initialize request argument(s)
NetworkName name = NetworkName.FromNetworkCode("[NETWORK_CODE]");
// Make the request
Network response = await networkServiceClient.GetNetworkAsync(name);
GetNetworkAsync(string, CallSettings)
API to retrieve a Network object.
Declaration
public virtual Task<Network> GetNetworkAsync(string name, CallSettings callSettings = null)
Parameters
Type | Name | Description |
---|---|---|
string | name | Required. Resource name of Network. Format: networks/{network_code} |
CallSettings | callSettings | If not null, applies overrides to this RPC call. |
Returns
Type | Description |
---|---|
Task<Network> | A Task containing the RPC response. |
Sample code
// Create client
NetworkServiceClient networkServiceClient = await NetworkServiceClient.CreateAsync();
// Initialize request argument(s)
string name = "networks/[NETWORK_CODE]";
// Make the request
Network response = await networkServiceClient.GetNetworkAsync(name);
GetNetworkAsync(string, CancellationToken)
API to retrieve a Network object.
Declaration
public virtual Task<Network> GetNetworkAsync(string name, CancellationToken cancellationToken)
Parameters
Type | Name | Description |
---|---|---|
string | name | Required. Resource name of Network. Format: networks/{network_code} |
CancellationToken | cancellationToken | A CancellationToken to use for this RPC. |
Returns
Type | Description |
---|---|
Task<Network> | A Task containing the RPC response. |
Sample code
// Create client
NetworkServiceClient networkServiceClient = await NetworkServiceClient.CreateAsync();
// Initialize request argument(s)
string name = "networks/[NETWORK_CODE]";
// Make the request
Network response = await networkServiceClient.GetNetworkAsync(name);
ListNetworks(ListNetworksRequest, CallSettings)
API to retrieve all the networks the current user has access to.
Declaration
public virtual ListNetworksResponse ListNetworks(ListNetworksRequest request, CallSettings callSettings = null)
Parameters
Type | Name | Description |
---|---|---|
ListNetworksRequest | 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 |
---|---|
ListNetworksResponse | The RPC response. |
Sample code
// Create client
NetworkServiceClient networkServiceClient = NetworkServiceClient.Create();
// Initialize request argument(s)
ListNetworksRequest request = new ListNetworksRequest { };
// Make the request
ListNetworksResponse response = networkServiceClient.ListNetworks(request);
ListNetworksAsync(ListNetworksRequest, CallSettings)
API to retrieve all the networks the current user has access to.
Declaration
public virtual Task<ListNetworksResponse> ListNetworksAsync(ListNetworksRequest request, CallSettings callSettings = null)
Parameters
Type | Name | Description |
---|---|---|
ListNetworksRequest | 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<ListNetworksResponse> | A Task containing the RPC response. |
Sample code
// Create client
NetworkServiceClient networkServiceClient = await NetworkServiceClient.CreateAsync();
// Initialize request argument(s)
ListNetworksRequest request = new ListNetworksRequest { };
// Make the request
ListNetworksResponse response = await networkServiceClient.ListNetworksAsync(request);
ListNetworksAsync(ListNetworksRequest, CancellationToken)
API to retrieve all the networks the current user has access to.
Declaration
public virtual Task<ListNetworksResponse> ListNetworksAsync(ListNetworksRequest request, CancellationToken cancellationToken)
Parameters
Type | Name | Description |
---|---|---|
ListNetworksRequest | 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<ListNetworksResponse> | A Task containing the RPC response. |
Sample code
// Create client
NetworkServiceClient networkServiceClient = await NetworkServiceClient.CreateAsync();
// Initialize request argument(s)
ListNetworksRequest request = new ListNetworksRequest { };
// Make the request
ListNetworksResponse response = await networkServiceClient.ListNetworksAsync(request);
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.