Show / Hide Table of Contents

Class GeoTargetServiceClient

GeoTargetService client wrapper, for convenient use.

Inheritance
object
GeoTargetServiceClient
GeoTargetServiceClientImpl
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 GeoTargetServiceClient
Remarks

Provides methods for handling GeoTarget objects.

Properties

DefaultEndpoint

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

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

The default GeoTargetService scopes are:

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

GrpcClient

The underlying gRPC GeoTargetService client

Declaration
public virtual GeoTargetService.GeoTargetServiceClient GrpcClient { get; }
Property Value
Type Description
GeoTargetService.GeoTargetServiceClient

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

Declaration
public static GeoTargetServiceClient Create()
Returns
Type Description
GeoTargetServiceClient

The created GeoTargetServiceClient.

CreateAsync(CancellationToken)

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

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

The CancellationToken to use while creating the client.

Returns
Type Description
Task<GeoTargetServiceClient>

The task representing the created GeoTargetServiceClient.

GetGeoTarget(GeoTargetName, CallSettings)

API to retrieve a GeoTarget object.

Declaration
public virtual GeoTarget GetGeoTarget(GeoTargetName name, CallSettings callSettings = null)
Parameters
Type Name Description
GeoTargetName name

Required. The resource name of the GeoTarget. Format: networks/{network_code}/geoTargets/{geo_target_id}

CallSettings callSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
GeoTarget

The RPC response.

Sample code
// Create client
GeoTargetServiceClient geoTargetServiceClient = GeoTargetServiceClient.Create();
// Initialize request argument(s)
GeoTargetName name = GeoTargetName.FromNetworkCodeGeoTarget("[NETWORK_CODE]", "[GEO_TARGET]");
// Make the request
GeoTarget response = geoTargetServiceClient.GetGeoTarget(name);

GetGeoTarget(GetGeoTargetRequest, CallSettings)

API to retrieve a GeoTarget object.

Declaration
public virtual GeoTarget GetGeoTarget(GetGeoTargetRequest request, CallSettings callSettings = null)
Parameters
Type Name Description
GetGeoTargetRequest 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
GeoTarget

The RPC response.

Sample code
// Create client
GeoTargetServiceClient geoTargetServiceClient = GeoTargetServiceClient.Create();
// Initialize request argument(s)
GetGeoTargetRequest request = new GetGeoTargetRequest
{
    GeoTargetName = GeoTargetName.FromNetworkCodeGeoTarget("[NETWORK_CODE]", "[GEO_TARGET]"),
};
// Make the request
GeoTarget response = geoTargetServiceClient.GetGeoTarget(request);

GetGeoTarget(string, CallSettings)

API to retrieve a GeoTarget object.

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

Required. The resource name of the GeoTarget. Format: networks/{network_code}/geoTargets/{geo_target_id}

CallSettings callSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
GeoTarget

The RPC response.

Sample code
// Create client
GeoTargetServiceClient geoTargetServiceClient = GeoTargetServiceClient.Create();
// Initialize request argument(s)
string name = "networks/[NETWORK_CODE]/geoTargets/[GEO_TARGET]";
// Make the request
GeoTarget response = geoTargetServiceClient.GetGeoTarget(name);

GetGeoTargetAsync(GeoTargetName, CallSettings)

API to retrieve a GeoTarget object.

Declaration
public virtual Task<GeoTarget> GetGeoTargetAsync(GeoTargetName name, CallSettings callSettings = null)
Parameters
Type Name Description
GeoTargetName name

Required. The resource name of the GeoTarget. Format: networks/{network_code}/geoTargets/{geo_target_id}

CallSettings callSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
Task<GeoTarget>

A Task containing the RPC response.

Sample code
// Create client
GeoTargetServiceClient geoTargetServiceClient = await GeoTargetServiceClient.CreateAsync();
// Initialize request argument(s)
GeoTargetName name = GeoTargetName.FromNetworkCodeGeoTarget("[NETWORK_CODE]", "[GEO_TARGET]");
// Make the request
GeoTarget response = await geoTargetServiceClient.GetGeoTargetAsync(name);

GetGeoTargetAsync(GeoTargetName, CancellationToken)

API to retrieve a GeoTarget object.

Declaration
public virtual Task<GeoTarget> GetGeoTargetAsync(GeoTargetName name, CancellationToken cancellationToken)
Parameters
Type Name Description
GeoTargetName name

Required. The resource name of the GeoTarget. Format: networks/{network_code}/geoTargets/{geo_target_id}

CancellationToken cancellationToken

A CancellationToken to use for this RPC.

Returns
Type Description
Task<GeoTarget>

A Task containing the RPC response.

Sample code
// Create client
GeoTargetServiceClient geoTargetServiceClient = await GeoTargetServiceClient.CreateAsync();
// Initialize request argument(s)
GeoTargetName name = GeoTargetName.FromNetworkCodeGeoTarget("[NETWORK_CODE]", "[GEO_TARGET]");
// Make the request
GeoTarget response = await geoTargetServiceClient.GetGeoTargetAsync(name);

GetGeoTargetAsync(GetGeoTargetRequest, CallSettings)

API to retrieve a GeoTarget object.

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

A Task containing the RPC response.

Sample code
// Create client
GeoTargetServiceClient geoTargetServiceClient = await GeoTargetServiceClient.CreateAsync();
// Initialize request argument(s)
GetGeoTargetRequest request = new GetGeoTargetRequest
{
    GeoTargetName = GeoTargetName.FromNetworkCodeGeoTarget("[NETWORK_CODE]", "[GEO_TARGET]"),
};
// Make the request
GeoTarget response = await geoTargetServiceClient.GetGeoTargetAsync(request);

GetGeoTargetAsync(GetGeoTargetRequest, CancellationToken)

API to retrieve a GeoTarget object.

Declaration
public virtual Task<GeoTarget> GetGeoTargetAsync(GetGeoTargetRequest request, CancellationToken cancellationToken)
Parameters
Type Name Description
GetGeoTargetRequest 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<GeoTarget>

A Task containing the RPC response.

Sample code
// Create client
GeoTargetServiceClient geoTargetServiceClient = await GeoTargetServiceClient.CreateAsync();
// Initialize request argument(s)
GetGeoTargetRequest request = new GetGeoTargetRequest
{
    GeoTargetName = GeoTargetName.FromNetworkCodeGeoTarget("[NETWORK_CODE]", "[GEO_TARGET]"),
};
// Make the request
GeoTarget response = await geoTargetServiceClient.GetGeoTargetAsync(request);

GetGeoTargetAsync(string, CallSettings)

API to retrieve a GeoTarget object.

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

Required. The resource name of the GeoTarget. Format: networks/{network_code}/geoTargets/{geo_target_id}

CallSettings callSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
Task<GeoTarget>

A Task containing the RPC response.

Sample code
// Create client
GeoTargetServiceClient geoTargetServiceClient = await GeoTargetServiceClient.CreateAsync();
// Initialize request argument(s)
string name = "networks/[NETWORK_CODE]/geoTargets/[GEO_TARGET]";
// Make the request
GeoTarget response = await geoTargetServiceClient.GetGeoTargetAsync(name);

GetGeoTargetAsync(string, CancellationToken)

API to retrieve a GeoTarget object.

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

Required. The resource name of the GeoTarget. Format: networks/{network_code}/geoTargets/{geo_target_id}

CancellationToken cancellationToken

A CancellationToken to use for this RPC.

Returns
Type Description
Task<GeoTarget>

A Task containing the RPC response.

Sample code
// Create client
GeoTargetServiceClient geoTargetServiceClient = await GeoTargetServiceClient.CreateAsync();
// Initialize request argument(s)
string name = "networks/[NETWORK_CODE]/geoTargets/[GEO_TARGET]";
// Make the request
GeoTarget response = await geoTargetServiceClient.GetGeoTargetAsync(name);

ListGeoTargets(ListGeoTargetsRequest, CallSettings)

API to retrieve a list of GeoTarget objects.

Declaration
public virtual PagedEnumerable<ListGeoTargetsResponse, GeoTarget> ListGeoTargets(ListGeoTargetsRequest request, CallSettings callSettings = null)
Parameters
Type Name Description
ListGeoTargetsRequest 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<ListGeoTargetsResponse, GeoTarget>

A pageable sequence of GeoTarget resources.

Sample code
// Create client
GeoTargetServiceClient geoTargetServiceClient = GeoTargetServiceClient.Create();
// Initialize request argument(s)
ListGeoTargetsRequest request = new ListGeoTargetsRequest
{
    ParentAsNetworkName = NetworkName.FromNetworkCode("[NETWORK_CODE]"),
    Filter = "",
    OrderBy = "",
    Skip = 0,
};
// Make the request
PagedEnumerable<ListGeoTargetsResponse, GeoTarget> response = geoTargetServiceClient.ListGeoTargets(request);

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

ListGeoTargets(NetworkName, string, int?, CallSettings)

API to retrieve a list of GeoTarget objects.

Declaration
public virtual PagedEnumerable<ListGeoTargetsResponse, GeoTarget> ListGeoTargets(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 GeoTargets. 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<ListGeoTargetsResponse, GeoTarget>

A pageable sequence of GeoTarget resources.

Sample code
// Create client
GeoTargetServiceClient geoTargetServiceClient = GeoTargetServiceClient.Create();
// Initialize request argument(s)
NetworkName parent = NetworkName.FromNetworkCode("[NETWORK_CODE]");
// Make the request
PagedEnumerable<ListGeoTargetsResponse, GeoTarget> response = geoTargetServiceClient.ListGeoTargets(parent);

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

ListGeoTargets(string, string, int?, CallSettings)

API to retrieve a list of GeoTarget objects.

Declaration
public virtual PagedEnumerable<ListGeoTargetsResponse, GeoTarget> ListGeoTargets(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 GeoTargets. 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<ListGeoTargetsResponse, GeoTarget>

A pageable sequence of GeoTarget resources.

Sample code
// Create client
GeoTargetServiceClient geoTargetServiceClient = GeoTargetServiceClient.Create();
// Initialize request argument(s)
string parent = "networks/[NETWORK_CODE]";
// Make the request
PagedEnumerable<ListGeoTargetsResponse, GeoTarget> response = geoTargetServiceClient.ListGeoTargets(parent);

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

ListGeoTargetsAsync(ListGeoTargetsRequest, CallSettings)

API to retrieve a list of GeoTarget objects.

Declaration
public virtual PagedAsyncEnumerable<ListGeoTargetsResponse, GeoTarget> ListGeoTargetsAsync(ListGeoTargetsRequest request, CallSettings callSettings = null)
Parameters
Type Name Description
ListGeoTargetsRequest 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<ListGeoTargetsResponse, GeoTarget>

A pageable asynchronous sequence of GeoTarget resources.

Sample code
// Create client
GeoTargetServiceClient geoTargetServiceClient = await GeoTargetServiceClient.CreateAsync();
// Initialize request argument(s)
ListGeoTargetsRequest request = new ListGeoTargetsRequest
{
    ParentAsNetworkName = NetworkName.FromNetworkCode("[NETWORK_CODE]"),
    Filter = "",
    OrderBy = "",
    Skip = 0,
};
// Make the request
PagedAsyncEnumerable<ListGeoTargetsResponse, GeoTarget> response = geoTargetServiceClient.ListGeoTargetsAsync(request);

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

ListGeoTargetsAsync(NetworkName, string, int?, CallSettings)

API to retrieve a list of GeoTarget objects.

Declaration
public virtual PagedAsyncEnumerable<ListGeoTargetsResponse, GeoTarget> ListGeoTargetsAsync(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 GeoTargets. 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<ListGeoTargetsResponse, GeoTarget>

A pageable asynchronous sequence of GeoTarget resources.

Sample code
// Create client
GeoTargetServiceClient geoTargetServiceClient = await GeoTargetServiceClient.CreateAsync();
// Initialize request argument(s)
NetworkName parent = NetworkName.FromNetworkCode("[NETWORK_CODE]");
// Make the request
PagedAsyncEnumerable<ListGeoTargetsResponse, GeoTarget> response = geoTargetServiceClient.ListGeoTargetsAsync(parent);

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

ListGeoTargetsAsync(string, string, int?, CallSettings)

API to retrieve a list of GeoTarget objects.

Declaration
public virtual PagedAsyncEnumerable<ListGeoTargetsResponse, GeoTarget> ListGeoTargetsAsync(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 GeoTargets. 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<ListGeoTargetsResponse, GeoTarget>

A pageable asynchronous sequence of GeoTarget resources.

Sample code
// Create client
GeoTargetServiceClient geoTargetServiceClient = await GeoTargetServiceClient.CreateAsync();
// Initialize request argument(s)
string parent = "networks/[NETWORK_CODE]";
// Make the request
PagedAsyncEnumerable<ListGeoTargetsResponse, GeoTarget> response = geoTargetServiceClient.ListGeoTargetsAsync(parent);

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