Show / Hide Table of Contents

Class AdUnitServiceClient

AdUnitService client wrapper, for convenient use.

Inheritance
object
AdUnitServiceClient
AdUnitServiceClientImpl
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 AdUnitServiceClient
Remarks

Provides methods for handling AdUnit objects.

Properties

DefaultEndpoint

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

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

The default AdUnitService scopes are:

    GrpcClient

    The underlying gRPC AdUnitService client

    Declaration
    public virtual AdUnitService.AdUnitServiceClient GrpcClient { get; }
    Property Value
    Type Description
    AdUnitService.AdUnitServiceClient

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

    Declaration
    public static AdUnitServiceClient Create()
    Returns
    Type Description
    AdUnitServiceClient

    The created AdUnitServiceClient.

    CreateAsync(CancellationToken)

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

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

    The CancellationToken to use while creating the client.

    Returns
    Type Description
    Task<AdUnitServiceClient>

    The task representing the created AdUnitServiceClient.

    GetAdUnit(AdUnitName, CallSettings)

    API to retrieve an AdUnit object.

    Declaration
    public virtual AdUnit GetAdUnit(AdUnitName name, CallSettings callSettings = null)
    Parameters
    Type Name Description
    AdUnitName name

    Required. The resource name of the AdUnit. Format: networks/{network_code}/adUnits/{ad_unit_id}

    CallSettings callSettings

    If not null, applies overrides to this RPC call.

    Returns
    Type Description
    AdUnit

    The RPC response.

    Sample code
    // Create client
    AdUnitServiceClient adUnitServiceClient = AdUnitServiceClient.Create();
    // Initialize request argument(s)
    AdUnitName name = AdUnitName.FromNetworkCodeAdUnit("[NETWORK_CODE]", "[AD_UNIT]");
    // Make the request
    AdUnit response = adUnitServiceClient.GetAdUnit(name);
    

    GetAdUnit(GetAdUnitRequest, CallSettings)

    API to retrieve an AdUnit object.

    Declaration
    public virtual AdUnit GetAdUnit(GetAdUnitRequest request, CallSettings callSettings = null)
    Parameters
    Type Name Description
    GetAdUnitRequest 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
    AdUnit

    The RPC response.

    Sample code
    // Create client
    AdUnitServiceClient adUnitServiceClient = AdUnitServiceClient.Create();
    // Initialize request argument(s)
    GetAdUnitRequest request = new GetAdUnitRequest
    {
        AdUnitName = AdUnitName.FromNetworkCodeAdUnit("[NETWORK_CODE]", "[AD_UNIT]"),
    };
    // Make the request
    AdUnit response = adUnitServiceClient.GetAdUnit(request);
    

    GetAdUnit(string, CallSettings)

    API to retrieve an AdUnit object.

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

    Required. The resource name of the AdUnit. Format: networks/{network_code}/adUnits/{ad_unit_id}

    CallSettings callSettings

    If not null, applies overrides to this RPC call.

    Returns
    Type Description
    AdUnit

    The RPC response.

    Sample code
    // Create client
    AdUnitServiceClient adUnitServiceClient = AdUnitServiceClient.Create();
    // Initialize request argument(s)
    string name = "networks/[NETWORK_CODE]/adUnits/[AD_UNIT]";
    // Make the request
    AdUnit response = adUnitServiceClient.GetAdUnit(name);
    

    GetAdUnitAsync(AdUnitName, CallSettings)

    API to retrieve an AdUnit object.

    Declaration
    public virtual Task<AdUnit> GetAdUnitAsync(AdUnitName name, CallSettings callSettings = null)
    Parameters
    Type Name Description
    AdUnitName name

    Required. The resource name of the AdUnit. Format: networks/{network_code}/adUnits/{ad_unit_id}

    CallSettings callSettings

    If not null, applies overrides to this RPC call.

    Returns
    Type Description
    Task<AdUnit>

    A Task containing the RPC response.

    Sample code
    // Create client
    AdUnitServiceClient adUnitServiceClient = await AdUnitServiceClient.CreateAsync();
    // Initialize request argument(s)
    AdUnitName name = AdUnitName.FromNetworkCodeAdUnit("[NETWORK_CODE]", "[AD_UNIT]");
    // Make the request
    AdUnit response = await adUnitServiceClient.GetAdUnitAsync(name);
    

    GetAdUnitAsync(AdUnitName, CancellationToken)

    API to retrieve an AdUnit object.

    Declaration
    public virtual Task<AdUnit> GetAdUnitAsync(AdUnitName name, CancellationToken cancellationToken)
    Parameters
    Type Name Description
    AdUnitName name

    Required. The resource name of the AdUnit. Format: networks/{network_code}/adUnits/{ad_unit_id}

    CancellationToken cancellationToken

    A CancellationToken to use for this RPC.

    Returns
    Type Description
    Task<AdUnit>

    A Task containing the RPC response.

    Sample code
    // Create client
    AdUnitServiceClient adUnitServiceClient = await AdUnitServiceClient.CreateAsync();
    // Initialize request argument(s)
    AdUnitName name = AdUnitName.FromNetworkCodeAdUnit("[NETWORK_CODE]", "[AD_UNIT]");
    // Make the request
    AdUnit response = await adUnitServiceClient.GetAdUnitAsync(name);
    

    GetAdUnitAsync(GetAdUnitRequest, CallSettings)

    API to retrieve an AdUnit object.

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

    A Task containing the RPC response.

    Sample code
    // Create client
    AdUnitServiceClient adUnitServiceClient = await AdUnitServiceClient.CreateAsync();
    // Initialize request argument(s)
    GetAdUnitRequest request = new GetAdUnitRequest
    {
        AdUnitName = AdUnitName.FromNetworkCodeAdUnit("[NETWORK_CODE]", "[AD_UNIT]"),
    };
    // Make the request
    AdUnit response = await adUnitServiceClient.GetAdUnitAsync(request);
    

    GetAdUnitAsync(GetAdUnitRequest, CancellationToken)

    API to retrieve an AdUnit object.

    Declaration
    public virtual Task<AdUnit> GetAdUnitAsync(GetAdUnitRequest request, CancellationToken cancellationToken)
    Parameters
    Type Name Description
    GetAdUnitRequest 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<AdUnit>

    A Task containing the RPC response.

    Sample code
    // Create client
    AdUnitServiceClient adUnitServiceClient = await AdUnitServiceClient.CreateAsync();
    // Initialize request argument(s)
    GetAdUnitRequest request = new GetAdUnitRequest
    {
        AdUnitName = AdUnitName.FromNetworkCodeAdUnit("[NETWORK_CODE]", "[AD_UNIT]"),
    };
    // Make the request
    AdUnit response = await adUnitServiceClient.GetAdUnitAsync(request);
    

    GetAdUnitAsync(string, CallSettings)

    API to retrieve an AdUnit object.

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

    Required. The resource name of the AdUnit. Format: networks/{network_code}/adUnits/{ad_unit_id}

    CallSettings callSettings

    If not null, applies overrides to this RPC call.

    Returns
    Type Description
    Task<AdUnit>

    A Task containing the RPC response.

    Sample code
    // Create client
    AdUnitServiceClient adUnitServiceClient = await AdUnitServiceClient.CreateAsync();
    // Initialize request argument(s)
    string name = "networks/[NETWORK_CODE]/adUnits/[AD_UNIT]";
    // Make the request
    AdUnit response = await adUnitServiceClient.GetAdUnitAsync(name);
    

    GetAdUnitAsync(string, CancellationToken)

    API to retrieve an AdUnit object.

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

    Required. The resource name of the AdUnit. Format: networks/{network_code}/adUnits/{ad_unit_id}

    CancellationToken cancellationToken

    A CancellationToken to use for this RPC.

    Returns
    Type Description
    Task<AdUnit>

    A Task containing the RPC response.

    Sample code
    // Create client
    AdUnitServiceClient adUnitServiceClient = await AdUnitServiceClient.CreateAsync();
    // Initialize request argument(s)
    string name = "networks/[NETWORK_CODE]/adUnits/[AD_UNIT]";
    // Make the request
    AdUnit response = await adUnitServiceClient.GetAdUnitAsync(name);
    

    ListAdUnitSizes(ListAdUnitSizesRequest, CallSettings)

    API to retrieve a list of AdUnitSize objects.

    Declaration
    public virtual PagedEnumerable<ListAdUnitSizesResponse, AdUnitSize> ListAdUnitSizes(ListAdUnitSizesRequest request, CallSettings callSettings = null)
    Parameters
    Type Name Description
    ListAdUnitSizesRequest 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<ListAdUnitSizesResponse, AdUnitSize>

    A pageable sequence of AdUnitSize resources.

    Sample code
    // Create client
    AdUnitServiceClient adUnitServiceClient = AdUnitServiceClient.Create();
    // Initialize request argument(s)
    ListAdUnitSizesRequest request = new ListAdUnitSizesRequest
    {
        ParentAsNetworkName = NetworkName.FromNetworkCode("[NETWORK_CODE]"),
        Filter = "",
        OrderBy = "",
        Skip = 0,
    };
    // Make the request
    PagedEnumerable<ListAdUnitSizesResponse, AdUnitSize> response = adUnitServiceClient.ListAdUnitSizes(request);
    
    // Iterate over all response items, lazily performing RPCs as required
    foreach (AdUnitSize 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 (ListAdUnitSizesResponse page in response.AsRawResponses())
    {
        // Do something with each page of items
        Console.WriteLine("A page of results:");
        foreach (AdUnitSize 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<AdUnitSize> 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 (AdUnitSize 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;
    

    ListAdUnitSizes(NetworkName, string, int?, CallSettings)

    API to retrieve a list of AdUnitSize objects.

    Declaration
    public virtual PagedEnumerable<ListAdUnitSizesResponse, AdUnitSize> ListAdUnitSizes(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 AdUnitSizes. 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<ListAdUnitSizesResponse, AdUnitSize>

    A pageable sequence of AdUnitSize resources.

    Sample code
    // Create client
    AdUnitServiceClient adUnitServiceClient = AdUnitServiceClient.Create();
    // Initialize request argument(s)
    NetworkName parent = NetworkName.FromNetworkCode("[NETWORK_CODE]");
    // Make the request
    PagedEnumerable<ListAdUnitSizesResponse, AdUnitSize> response = adUnitServiceClient.ListAdUnitSizes(parent);
    
    // Iterate over all response items, lazily performing RPCs as required
    foreach (AdUnitSize 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 (ListAdUnitSizesResponse page in response.AsRawResponses())
    {
        // Do something with each page of items
        Console.WriteLine("A page of results:");
        foreach (AdUnitSize 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<AdUnitSize> 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 (AdUnitSize 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;
    

    ListAdUnitSizes(string, string, int?, CallSettings)

    API to retrieve a list of AdUnitSize objects.

    Declaration
    public virtual PagedEnumerable<ListAdUnitSizesResponse, AdUnitSize> ListAdUnitSizes(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 AdUnitSizes. 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<ListAdUnitSizesResponse, AdUnitSize>

    A pageable sequence of AdUnitSize resources.

    Sample code
    // Create client
    AdUnitServiceClient adUnitServiceClient = AdUnitServiceClient.Create();
    // Initialize request argument(s)
    string parent = "networks/[NETWORK_CODE]";
    // Make the request
    PagedEnumerable<ListAdUnitSizesResponse, AdUnitSize> response = adUnitServiceClient.ListAdUnitSizes(parent);
    
    // Iterate over all response items, lazily performing RPCs as required
    foreach (AdUnitSize 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 (ListAdUnitSizesResponse page in response.AsRawResponses())
    {
        // Do something with each page of items
        Console.WriteLine("A page of results:");
        foreach (AdUnitSize 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<AdUnitSize> 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 (AdUnitSize 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;
    

    ListAdUnitSizesAsync(ListAdUnitSizesRequest, CallSettings)

    API to retrieve a list of AdUnitSize objects.

    Declaration
    public virtual PagedAsyncEnumerable<ListAdUnitSizesResponse, AdUnitSize> ListAdUnitSizesAsync(ListAdUnitSizesRequest request, CallSettings callSettings = null)
    Parameters
    Type Name Description
    ListAdUnitSizesRequest 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<ListAdUnitSizesResponse, AdUnitSize>

    A pageable asynchronous sequence of AdUnitSize resources.

    Sample code
    // Create client
    AdUnitServiceClient adUnitServiceClient = await AdUnitServiceClient.CreateAsync();
    // Initialize request argument(s)
    ListAdUnitSizesRequest request = new ListAdUnitSizesRequest
    {
        ParentAsNetworkName = NetworkName.FromNetworkCode("[NETWORK_CODE]"),
        Filter = "",
        OrderBy = "",
        Skip = 0,
    };
    // Make the request
    PagedAsyncEnumerable<ListAdUnitSizesResponse, AdUnitSize> response = adUnitServiceClient.ListAdUnitSizesAsync(request);
    
    // Iterate over all response items, lazily performing RPCs as required
    await response.ForEachAsync((AdUnitSize 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((ListAdUnitSizesResponse page) =>
    {
        // Do something with each page of items
        Console.WriteLine("A page of results:");
        foreach (AdUnitSize 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<AdUnitSize> 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 (AdUnitSize 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;
    

    ListAdUnitSizesAsync(NetworkName, string, int?, CallSettings)

    API to retrieve a list of AdUnitSize objects.

    Declaration
    public virtual PagedAsyncEnumerable<ListAdUnitSizesResponse, AdUnitSize> ListAdUnitSizesAsync(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 AdUnitSizes. 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<ListAdUnitSizesResponse, AdUnitSize>

    A pageable asynchronous sequence of AdUnitSize resources.

    Sample code
    // Create client
    AdUnitServiceClient adUnitServiceClient = await AdUnitServiceClient.CreateAsync();
    // Initialize request argument(s)
    NetworkName parent = NetworkName.FromNetworkCode("[NETWORK_CODE]");
    // Make the request
    PagedAsyncEnumerable<ListAdUnitSizesResponse, AdUnitSize> response = adUnitServiceClient.ListAdUnitSizesAsync(parent);
    
    // Iterate over all response items, lazily performing RPCs as required
    await response.ForEachAsync((AdUnitSize 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((ListAdUnitSizesResponse page) =>
    {
        // Do something with each page of items
        Console.WriteLine("A page of results:");
        foreach (AdUnitSize 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<AdUnitSize> 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 (AdUnitSize 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;
    

    ListAdUnitSizesAsync(string, string, int?, CallSettings)

    API to retrieve a list of AdUnitSize objects.

    Declaration
    public virtual PagedAsyncEnumerable<ListAdUnitSizesResponse, AdUnitSize> ListAdUnitSizesAsync(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 AdUnitSizes. 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<ListAdUnitSizesResponse, AdUnitSize>

    A pageable asynchronous sequence of AdUnitSize resources.

    Sample code
    // Create client
    AdUnitServiceClient adUnitServiceClient = await AdUnitServiceClient.CreateAsync();
    // Initialize request argument(s)
    string parent = "networks/[NETWORK_CODE]";
    // Make the request
    PagedAsyncEnumerable<ListAdUnitSizesResponse, AdUnitSize> response = adUnitServiceClient.ListAdUnitSizesAsync(parent);
    
    // Iterate over all response items, lazily performing RPCs as required
    await response.ForEachAsync((AdUnitSize 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((ListAdUnitSizesResponse page) =>
    {
        // Do something with each page of items
        Console.WriteLine("A page of results:");
        foreach (AdUnitSize 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<AdUnitSize> 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 (AdUnitSize 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;
    

    ListAdUnits(ListAdUnitsRequest, CallSettings)

    API to retrieve a list of AdUnit objects.

    Declaration
    public virtual PagedEnumerable<ListAdUnitsResponse, AdUnit> ListAdUnits(ListAdUnitsRequest request, CallSettings callSettings = null)
    Parameters
    Type Name Description
    ListAdUnitsRequest 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<ListAdUnitsResponse, AdUnit>

    A pageable sequence of AdUnit resources.

    Sample code
    // Create client
    AdUnitServiceClient adUnitServiceClient = AdUnitServiceClient.Create();
    // Initialize request argument(s)
    ListAdUnitsRequest request = new ListAdUnitsRequest
    {
        ParentAsNetworkName = NetworkName.FromNetworkCode("[NETWORK_CODE]"),
        Filter = "",
        OrderBy = "",
        Skip = 0,
    };
    // Make the request
    PagedEnumerable<ListAdUnitsResponse, AdUnit> response = adUnitServiceClient.ListAdUnits(request);
    
    // Iterate over all response items, lazily performing RPCs as required
    foreach (AdUnit 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 (ListAdUnitsResponse page in response.AsRawResponses())
    {
        // Do something with each page of items
        Console.WriteLine("A page of results:");
        foreach (AdUnit 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<AdUnit> 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 (AdUnit 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;
    

    ListAdUnits(NetworkName, string, int?, CallSettings)

    API to retrieve a list of AdUnit objects.

    Declaration
    public virtual PagedEnumerable<ListAdUnitsResponse, AdUnit> ListAdUnits(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 AdUnits. 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<ListAdUnitsResponse, AdUnit>

    A pageable sequence of AdUnit resources.

    Sample code
    // Create client
    AdUnitServiceClient adUnitServiceClient = AdUnitServiceClient.Create();
    // Initialize request argument(s)
    NetworkName parent = NetworkName.FromNetworkCode("[NETWORK_CODE]");
    // Make the request
    PagedEnumerable<ListAdUnitsResponse, AdUnit> response = adUnitServiceClient.ListAdUnits(parent);
    
    // Iterate over all response items, lazily performing RPCs as required
    foreach (AdUnit 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 (ListAdUnitsResponse page in response.AsRawResponses())
    {
        // Do something with each page of items
        Console.WriteLine("A page of results:");
        foreach (AdUnit 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<AdUnit> 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 (AdUnit 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;
    

    ListAdUnits(string, string, int?, CallSettings)

    API to retrieve a list of AdUnit objects.

    Declaration
    public virtual PagedEnumerable<ListAdUnitsResponse, AdUnit> ListAdUnits(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 AdUnits. 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<ListAdUnitsResponse, AdUnit>

    A pageable sequence of AdUnit resources.

    Sample code
    // Create client
    AdUnitServiceClient adUnitServiceClient = AdUnitServiceClient.Create();
    // Initialize request argument(s)
    string parent = "networks/[NETWORK_CODE]";
    // Make the request
    PagedEnumerable<ListAdUnitsResponse, AdUnit> response = adUnitServiceClient.ListAdUnits(parent);
    
    // Iterate over all response items, lazily performing RPCs as required
    foreach (AdUnit 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 (ListAdUnitsResponse page in response.AsRawResponses())
    {
        // Do something with each page of items
        Console.WriteLine("A page of results:");
        foreach (AdUnit 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<AdUnit> 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 (AdUnit 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;
    

    ListAdUnitsAsync(ListAdUnitsRequest, CallSettings)

    API to retrieve a list of AdUnit objects.

    Declaration
    public virtual PagedAsyncEnumerable<ListAdUnitsResponse, AdUnit> ListAdUnitsAsync(ListAdUnitsRequest request, CallSettings callSettings = null)
    Parameters
    Type Name Description
    ListAdUnitsRequest 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<ListAdUnitsResponse, AdUnit>

    A pageable asynchronous sequence of AdUnit resources.

    Sample code
    // Create client
    AdUnitServiceClient adUnitServiceClient = await AdUnitServiceClient.CreateAsync();
    // Initialize request argument(s)
    ListAdUnitsRequest request = new ListAdUnitsRequest
    {
        ParentAsNetworkName = NetworkName.FromNetworkCode("[NETWORK_CODE]"),
        Filter = "",
        OrderBy = "",
        Skip = 0,
    };
    // Make the request
    PagedAsyncEnumerable<ListAdUnitsResponse, AdUnit> response = adUnitServiceClient.ListAdUnitsAsync(request);
    
    // Iterate over all response items, lazily performing RPCs as required
    await response.ForEachAsync((AdUnit 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((ListAdUnitsResponse page) =>
    {
        // Do something with each page of items
        Console.WriteLine("A page of results:");
        foreach (AdUnit 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<AdUnit> 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 (AdUnit 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;
    

    ListAdUnitsAsync(NetworkName, string, int?, CallSettings)

    API to retrieve a list of AdUnit objects.

    Declaration
    public virtual PagedAsyncEnumerable<ListAdUnitsResponse, AdUnit> ListAdUnitsAsync(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 AdUnits. 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<ListAdUnitsResponse, AdUnit>

    A pageable asynchronous sequence of AdUnit resources.

    Sample code
    // Create client
    AdUnitServiceClient adUnitServiceClient = await AdUnitServiceClient.CreateAsync();
    // Initialize request argument(s)
    NetworkName parent = NetworkName.FromNetworkCode("[NETWORK_CODE]");
    // Make the request
    PagedAsyncEnumerable<ListAdUnitsResponse, AdUnit> response = adUnitServiceClient.ListAdUnitsAsync(parent);
    
    // Iterate over all response items, lazily performing RPCs as required
    await response.ForEachAsync((AdUnit 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((ListAdUnitsResponse page) =>
    {
        // Do something with each page of items
        Console.WriteLine("A page of results:");
        foreach (AdUnit 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<AdUnit> 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 (AdUnit 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;
    

    ListAdUnitsAsync(string, string, int?, CallSettings)

    API to retrieve a list of AdUnit objects.

    Declaration
    public virtual PagedAsyncEnumerable<ListAdUnitsResponse, AdUnit> ListAdUnitsAsync(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 AdUnits. 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<ListAdUnitsResponse, AdUnit>

    A pageable asynchronous sequence of AdUnit resources.

    Sample code
    // Create client
    AdUnitServiceClient adUnitServiceClient = await AdUnitServiceClient.CreateAsync();
    // Initialize request argument(s)
    string parent = "networks/[NETWORK_CODE]";
    // Make the request
    PagedAsyncEnumerable<ListAdUnitsResponse, AdUnit> response = adUnitServiceClient.ListAdUnitsAsync(parent);
    
    // Iterate over all response items, lazily performing RPCs as required
    await response.ForEachAsync((AdUnit 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((ListAdUnitsResponse page) =>
    {
        // Do something with each page of items
        Console.WriteLine("A page of results:");
        foreach (AdUnit 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<AdUnit> 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 (AdUnit 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