Show / Hide Table of Contents

Class ContentLabelServiceClient

ContentLabelService client wrapper, for convenient use.

Inheritance
object
ContentLabelServiceClient
ContentLabelServiceClientImpl
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 ContentLabelServiceClient
Remarks

Provides methods for handling ContentLabel objects.

Properties

DefaultEndpoint

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

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

The default ContentLabelService scopes are:

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

GrpcClient

The underlying gRPC ContentLabelService client

Declaration
public virtual ContentLabelService.ContentLabelServiceClient GrpcClient { get; }
Property Value
Type Description
ContentLabelService.ContentLabelServiceClient

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

Declaration
public static ContentLabelServiceClient Create()
Returns
Type Description
ContentLabelServiceClient

The created ContentLabelServiceClient.

CreateAsync(CancellationToken)

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

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

The CancellationToken to use while creating the client.

Returns
Type Description
Task<ContentLabelServiceClient>

The task representing the created ContentLabelServiceClient.

GetContentLabel(ContentLabelName, CallSettings)

API to retrieve a ContentLabel object.

Declaration
public virtual ContentLabel GetContentLabel(ContentLabelName name, CallSettings callSettings = null)
Parameters
Type Name Description
ContentLabelName name

Required. The resource name of the ContentLabel. Format: networks/{network_code}/contentLabels/{content_label_id}

CallSettings callSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
ContentLabel

The RPC response.

Sample code
// Create client
ContentLabelServiceClient contentLabelServiceClient = ContentLabelServiceClient.Create();
// Initialize request argument(s)
ContentLabelName name = ContentLabelName.FromNetworkCodeContentLabel("[NETWORK_CODE]", "[CONTENT_LABEL]");
// Make the request
ContentLabel response = contentLabelServiceClient.GetContentLabel(name);

GetContentLabel(GetContentLabelRequest, CallSettings)

API to retrieve a ContentLabel object.

Declaration
public virtual ContentLabel GetContentLabel(GetContentLabelRequest request, CallSettings callSettings = null)
Parameters
Type Name Description
GetContentLabelRequest 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
ContentLabel

The RPC response.

Sample code
// Create client
ContentLabelServiceClient contentLabelServiceClient = ContentLabelServiceClient.Create();
// Initialize request argument(s)
GetContentLabelRequest request = new GetContentLabelRequest
{
    ContentLabelName = ContentLabelName.FromNetworkCodeContentLabel("[NETWORK_CODE]", "[CONTENT_LABEL]"),
};
// Make the request
ContentLabel response = contentLabelServiceClient.GetContentLabel(request);

GetContentLabel(string, CallSettings)

API to retrieve a ContentLabel object.

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

Required. The resource name of the ContentLabel. Format: networks/{network_code}/contentLabels/{content_label_id}

CallSettings callSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
ContentLabel

The RPC response.

Sample code
// Create client
ContentLabelServiceClient contentLabelServiceClient = ContentLabelServiceClient.Create();
// Initialize request argument(s)
string name = "networks/[NETWORK_CODE]/contentLabels/[CONTENT_LABEL]";
// Make the request
ContentLabel response = contentLabelServiceClient.GetContentLabel(name);

GetContentLabelAsync(ContentLabelName, CallSettings)

API to retrieve a ContentLabel object.

Declaration
public virtual Task<ContentLabel> GetContentLabelAsync(ContentLabelName name, CallSettings callSettings = null)
Parameters
Type Name Description
ContentLabelName name

Required. The resource name of the ContentLabel. Format: networks/{network_code}/contentLabels/{content_label_id}

CallSettings callSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
Task<ContentLabel>

A Task containing the RPC response.

Sample code
// Create client
ContentLabelServiceClient contentLabelServiceClient = await ContentLabelServiceClient.CreateAsync();
// Initialize request argument(s)
ContentLabelName name = ContentLabelName.FromNetworkCodeContentLabel("[NETWORK_CODE]", "[CONTENT_LABEL]");
// Make the request
ContentLabel response = await contentLabelServiceClient.GetContentLabelAsync(name);

GetContentLabelAsync(ContentLabelName, CancellationToken)

API to retrieve a ContentLabel object.

Declaration
public virtual Task<ContentLabel> GetContentLabelAsync(ContentLabelName name, CancellationToken cancellationToken)
Parameters
Type Name Description
ContentLabelName name

Required. The resource name of the ContentLabel. Format: networks/{network_code}/contentLabels/{content_label_id}

CancellationToken cancellationToken

A CancellationToken to use for this RPC.

Returns
Type Description
Task<ContentLabel>

A Task containing the RPC response.

Sample code
// Create client
ContentLabelServiceClient contentLabelServiceClient = await ContentLabelServiceClient.CreateAsync();
// Initialize request argument(s)
ContentLabelName name = ContentLabelName.FromNetworkCodeContentLabel("[NETWORK_CODE]", "[CONTENT_LABEL]");
// Make the request
ContentLabel response = await contentLabelServiceClient.GetContentLabelAsync(name);

GetContentLabelAsync(GetContentLabelRequest, CallSettings)

API to retrieve a ContentLabel object.

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

A Task containing the RPC response.

Sample code
// Create client
ContentLabelServiceClient contentLabelServiceClient = await ContentLabelServiceClient.CreateAsync();
// Initialize request argument(s)
GetContentLabelRequest request = new GetContentLabelRequest
{
    ContentLabelName = ContentLabelName.FromNetworkCodeContentLabel("[NETWORK_CODE]", "[CONTENT_LABEL]"),
};
// Make the request
ContentLabel response = await contentLabelServiceClient.GetContentLabelAsync(request);

GetContentLabelAsync(GetContentLabelRequest, CancellationToken)

API to retrieve a ContentLabel object.

Declaration
public virtual Task<ContentLabel> GetContentLabelAsync(GetContentLabelRequest request, CancellationToken cancellationToken)
Parameters
Type Name Description
GetContentLabelRequest 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<ContentLabel>

A Task containing the RPC response.

Sample code
// Create client
ContentLabelServiceClient contentLabelServiceClient = await ContentLabelServiceClient.CreateAsync();
// Initialize request argument(s)
GetContentLabelRequest request = new GetContentLabelRequest
{
    ContentLabelName = ContentLabelName.FromNetworkCodeContentLabel("[NETWORK_CODE]", "[CONTENT_LABEL]"),
};
// Make the request
ContentLabel response = await contentLabelServiceClient.GetContentLabelAsync(request);

GetContentLabelAsync(string, CallSettings)

API to retrieve a ContentLabel object.

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

Required. The resource name of the ContentLabel. Format: networks/{network_code}/contentLabels/{content_label_id}

CallSettings callSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
Task<ContentLabel>

A Task containing the RPC response.

Sample code
// Create client
ContentLabelServiceClient contentLabelServiceClient = await ContentLabelServiceClient.CreateAsync();
// Initialize request argument(s)
string name = "networks/[NETWORK_CODE]/contentLabels/[CONTENT_LABEL]";
// Make the request
ContentLabel response = await contentLabelServiceClient.GetContentLabelAsync(name);

GetContentLabelAsync(string, CancellationToken)

API to retrieve a ContentLabel object.

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

Required. The resource name of the ContentLabel. Format: networks/{network_code}/contentLabels/{content_label_id}

CancellationToken cancellationToken

A CancellationToken to use for this RPC.

Returns
Type Description
Task<ContentLabel>

A Task containing the RPC response.

Sample code
// Create client
ContentLabelServiceClient contentLabelServiceClient = await ContentLabelServiceClient.CreateAsync();
// Initialize request argument(s)
string name = "networks/[NETWORK_CODE]/contentLabels/[CONTENT_LABEL]";
// Make the request
ContentLabel response = await contentLabelServiceClient.GetContentLabelAsync(name);

ListContentLabels(ListContentLabelsRequest, CallSettings)

API to retrieve a list of ContentLabel objects.

Declaration
public virtual PagedEnumerable<ListContentLabelsResponse, ContentLabel> ListContentLabels(ListContentLabelsRequest request, CallSettings callSettings = null)
Parameters
Type Name Description
ListContentLabelsRequest 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<ListContentLabelsResponse, ContentLabel>

A pageable sequence of ContentLabel resources.

Sample code
// Create client
ContentLabelServiceClient contentLabelServiceClient = ContentLabelServiceClient.Create();
// Initialize request argument(s)
ListContentLabelsRequest request = new ListContentLabelsRequest
{
    ParentAsNetworkName = NetworkName.FromNetworkCode("[NETWORK_CODE]"),
    Filter = "",
    OrderBy = "",
    Skip = 0,
};
// Make the request
PagedEnumerable<ListContentLabelsResponse, ContentLabel> response = contentLabelServiceClient.ListContentLabels(request);

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

ListContentLabels(NetworkName, string, int?, CallSettings)

API to retrieve a list of ContentLabel objects.

Declaration
public virtual PagedEnumerable<ListContentLabelsResponse, ContentLabel> ListContentLabels(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 ContentLabels. 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<ListContentLabelsResponse, ContentLabel>

A pageable sequence of ContentLabel resources.

Sample code
// Create client
ContentLabelServiceClient contentLabelServiceClient = ContentLabelServiceClient.Create();
// Initialize request argument(s)
NetworkName parent = NetworkName.FromNetworkCode("[NETWORK_CODE]");
// Make the request
PagedEnumerable<ListContentLabelsResponse, ContentLabel> response = contentLabelServiceClient.ListContentLabels(parent);

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

ListContentLabels(string, string, int?, CallSettings)

API to retrieve a list of ContentLabel objects.

Declaration
public virtual PagedEnumerable<ListContentLabelsResponse, ContentLabel> ListContentLabels(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 ContentLabels. 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<ListContentLabelsResponse, ContentLabel>

A pageable sequence of ContentLabel resources.

Sample code
// Create client
ContentLabelServiceClient contentLabelServiceClient = ContentLabelServiceClient.Create();
// Initialize request argument(s)
string parent = "networks/[NETWORK_CODE]";
// Make the request
PagedEnumerable<ListContentLabelsResponse, ContentLabel> response = contentLabelServiceClient.ListContentLabels(parent);

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

ListContentLabelsAsync(ListContentLabelsRequest, CallSettings)

API to retrieve a list of ContentLabel objects.

Declaration
public virtual PagedAsyncEnumerable<ListContentLabelsResponse, ContentLabel> ListContentLabelsAsync(ListContentLabelsRequest request, CallSettings callSettings = null)
Parameters
Type Name Description
ListContentLabelsRequest 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<ListContentLabelsResponse, ContentLabel>

A pageable asynchronous sequence of ContentLabel resources.

Sample code
// Create client
ContentLabelServiceClient contentLabelServiceClient = await ContentLabelServiceClient.CreateAsync();
// Initialize request argument(s)
ListContentLabelsRequest request = new ListContentLabelsRequest
{
    ParentAsNetworkName = NetworkName.FromNetworkCode("[NETWORK_CODE]"),
    Filter = "",
    OrderBy = "",
    Skip = 0,
};
// Make the request
PagedAsyncEnumerable<ListContentLabelsResponse, ContentLabel> response = contentLabelServiceClient.ListContentLabelsAsync(request);

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

ListContentLabelsAsync(NetworkName, string, int?, CallSettings)

API to retrieve a list of ContentLabel objects.

Declaration
public virtual PagedAsyncEnumerable<ListContentLabelsResponse, ContentLabel> ListContentLabelsAsync(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 ContentLabels. 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<ListContentLabelsResponse, ContentLabel>

A pageable asynchronous sequence of ContentLabel resources.

Sample code
// Create client
ContentLabelServiceClient contentLabelServiceClient = await ContentLabelServiceClient.CreateAsync();
// Initialize request argument(s)
NetworkName parent = NetworkName.FromNetworkCode("[NETWORK_CODE]");
// Make the request
PagedAsyncEnumerable<ListContentLabelsResponse, ContentLabel> response = contentLabelServiceClient.ListContentLabelsAsync(parent);

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

ListContentLabelsAsync(string, string, int?, CallSettings)

API to retrieve a list of ContentLabel objects.

Declaration
public virtual PagedAsyncEnumerable<ListContentLabelsResponse, ContentLabel> ListContentLabelsAsync(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 ContentLabels. 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<ListContentLabelsResponse, ContentLabel>

A pageable asynchronous sequence of ContentLabel resources.

Sample code
// Create client
ContentLabelServiceClient contentLabelServiceClient = await ContentLabelServiceClient.CreateAsync();
// Initialize request argument(s)
string parent = "networks/[NETWORK_CODE]";
// Make the request
PagedAsyncEnumerable<ListContentLabelsResponse, ContentLabel> response = contentLabelServiceClient.ListContentLabelsAsync(parent);

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