Class CompanyServiceClient
CompanyService client wrapper, for convenient use.
Namespace: Google.Ads.AdManager.V1
Assembly: Google.Ads.AdManager.V1.dll
Syntax
public abstract class CompanyServiceClient
Remarks
Provides methods for handling Company
objects.
Properties
DefaultEndpoint
The default endpoint for the CompanyService 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 CompanyService scopes.
Declaration
public static IReadOnlyList<string> DefaultScopes { get; }
Property Value
Type | Description |
---|---|
IReadOnlyList<string> |
Remarks
The default CompanyService scopes are:
GrpcClient
The underlying gRPC CompanyService client
Declaration
public virtual CompanyService.CompanyServiceClient GrpcClient { get; }
Property Value
Type | Description |
---|---|
CompanyService.CompanyServiceClient |
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 CompanyServiceClient using the default credentials, endpoint and settings. To specify custom credentials or other settings, use CompanyServiceClientBuilder.
Declaration
public static CompanyServiceClient Create()
Returns
Type | Description |
---|---|
CompanyServiceClient | The created CompanyServiceClient. |
CreateAsync(CancellationToken)
Asynchronously creates a CompanyServiceClient using the default credentials, endpoint and settings. To specify custom credentials or other settings, use CompanyServiceClientBuilder.
Declaration
public static Task<CompanyServiceClient> CreateAsync(CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
CancellationToken | cancellationToken | The CancellationToken to use while creating the client. |
Returns
Type | Description |
---|---|
Task<CompanyServiceClient> | The task representing the created CompanyServiceClient. |
GetCompany(CompanyName, CallSettings)
API to retrieve a Company
object.
Declaration
public virtual Company GetCompany(CompanyName name, CallSettings callSettings = null)
Parameters
Type | Name | Description |
---|---|---|
CompanyName | name | Required. The resource name of the Company.
Format: |
CallSettings | callSettings | If not null, applies overrides to this RPC call. |
Returns
Type | Description |
---|---|
Company | The RPC response. |
Sample code
// Create client
CompanyServiceClient companyServiceClient = CompanyServiceClient.Create();
// Initialize request argument(s)
CompanyName name = CompanyName.FromNetworkCodeCompany("[NETWORK_CODE]", "[COMPANY]");
// Make the request
Company response = companyServiceClient.GetCompany(name);
GetCompany(GetCompanyRequest, CallSettings)
API to retrieve a Company
object.
Declaration
public virtual Company GetCompany(GetCompanyRequest request, CallSettings callSettings = null)
Parameters
Type | Name | Description |
---|---|---|
GetCompanyRequest | 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 |
---|---|
Company | The RPC response. |
Sample code
// Create client
CompanyServiceClient companyServiceClient = CompanyServiceClient.Create();
// Initialize request argument(s)
GetCompanyRequest request = new GetCompanyRequest
{
CompanyName = CompanyName.FromNetworkCodeCompany("[NETWORK_CODE]", "[COMPANY]"),
};
// Make the request
Company response = companyServiceClient.GetCompany(request);
GetCompany(string, CallSettings)
API to retrieve a Company
object.
Declaration
public virtual Company GetCompany(string name, CallSettings callSettings = null)
Parameters
Type | Name | Description |
---|---|---|
string | name | Required. The resource name of the Company.
Format: |
CallSettings | callSettings | If not null, applies overrides to this RPC call. |
Returns
Type | Description |
---|---|
Company | The RPC response. |
Sample code
// Create client
CompanyServiceClient companyServiceClient = CompanyServiceClient.Create();
// Initialize request argument(s)
string name = "networks/[NETWORK_CODE]/companies/[COMPANY]";
// Make the request
Company response = companyServiceClient.GetCompany(name);
GetCompanyAsync(CompanyName, CallSettings)
API to retrieve a Company
object.
Declaration
public virtual Task<Company> GetCompanyAsync(CompanyName name, CallSettings callSettings = null)
Parameters
Type | Name | Description |
---|---|---|
CompanyName | name | Required. The resource name of the Company.
Format: |
CallSettings | callSettings | If not null, applies overrides to this RPC call. |
Returns
Type | Description |
---|---|
Task<Company> | A Task containing the RPC response. |
Sample code
// Create client
CompanyServiceClient companyServiceClient = await CompanyServiceClient.CreateAsync();
// Initialize request argument(s)
CompanyName name = CompanyName.FromNetworkCodeCompany("[NETWORK_CODE]", "[COMPANY]");
// Make the request
Company response = await companyServiceClient.GetCompanyAsync(name);
GetCompanyAsync(CompanyName, CancellationToken)
API to retrieve a Company
object.
Declaration
public virtual Task<Company> GetCompanyAsync(CompanyName name, CancellationToken cancellationToken)
Parameters
Type | Name | Description |
---|---|---|
CompanyName | name | Required. The resource name of the Company.
Format: |
CancellationToken | cancellationToken | A CancellationToken to use for this RPC. |
Returns
Type | Description |
---|---|
Task<Company> | A Task containing the RPC response. |
Sample code
// Create client
CompanyServiceClient companyServiceClient = await CompanyServiceClient.CreateAsync();
// Initialize request argument(s)
CompanyName name = CompanyName.FromNetworkCodeCompany("[NETWORK_CODE]", "[COMPANY]");
// Make the request
Company response = await companyServiceClient.GetCompanyAsync(name);
GetCompanyAsync(GetCompanyRequest, CallSettings)
API to retrieve a Company
object.
Declaration
public virtual Task<Company> GetCompanyAsync(GetCompanyRequest request, CallSettings callSettings = null)
Parameters
Type | Name | Description |
---|---|---|
GetCompanyRequest | 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<Company> | A Task containing the RPC response. |
Sample code
// Create client
CompanyServiceClient companyServiceClient = await CompanyServiceClient.CreateAsync();
// Initialize request argument(s)
GetCompanyRequest request = new GetCompanyRequest
{
CompanyName = CompanyName.FromNetworkCodeCompany("[NETWORK_CODE]", "[COMPANY]"),
};
// Make the request
Company response = await companyServiceClient.GetCompanyAsync(request);
GetCompanyAsync(GetCompanyRequest, CancellationToken)
API to retrieve a Company
object.
Declaration
public virtual Task<Company> GetCompanyAsync(GetCompanyRequest request, CancellationToken cancellationToken)
Parameters
Type | Name | Description |
---|---|---|
GetCompanyRequest | 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<Company> | A Task containing the RPC response. |
Sample code
// Create client
CompanyServiceClient companyServiceClient = await CompanyServiceClient.CreateAsync();
// Initialize request argument(s)
GetCompanyRequest request = new GetCompanyRequest
{
CompanyName = CompanyName.FromNetworkCodeCompany("[NETWORK_CODE]", "[COMPANY]"),
};
// Make the request
Company response = await companyServiceClient.GetCompanyAsync(request);
GetCompanyAsync(string, CallSettings)
API to retrieve a Company
object.
Declaration
public virtual Task<Company> GetCompanyAsync(string name, CallSettings callSettings = null)
Parameters
Type | Name | Description |
---|---|---|
string | name | Required. The resource name of the Company.
Format: |
CallSettings | callSettings | If not null, applies overrides to this RPC call. |
Returns
Type | Description |
---|---|
Task<Company> | A Task containing the RPC response. |
Sample code
// Create client
CompanyServiceClient companyServiceClient = await CompanyServiceClient.CreateAsync();
// Initialize request argument(s)
string name = "networks/[NETWORK_CODE]/companies/[COMPANY]";
// Make the request
Company response = await companyServiceClient.GetCompanyAsync(name);
GetCompanyAsync(string, CancellationToken)
API to retrieve a Company
object.
Declaration
public virtual Task<Company> GetCompanyAsync(string name, CancellationToken cancellationToken)
Parameters
Type | Name | Description |
---|---|---|
string | name | Required. The resource name of the Company.
Format: |
CancellationToken | cancellationToken | A CancellationToken to use for this RPC. |
Returns
Type | Description |
---|---|
Task<Company> | A Task containing the RPC response. |
Sample code
// Create client
CompanyServiceClient companyServiceClient = await CompanyServiceClient.CreateAsync();
// Initialize request argument(s)
string name = "networks/[NETWORK_CODE]/companies/[COMPANY]";
// Make the request
Company response = await companyServiceClient.GetCompanyAsync(name);
ListCompanies(ListCompaniesRequest, CallSettings)
API to retrieve a list of Company
objects.
Declaration
public virtual PagedEnumerable<ListCompaniesResponse, Company> ListCompanies(ListCompaniesRequest request, CallSettings callSettings = null)
Parameters
Type | Name | Description |
---|---|---|
ListCompaniesRequest | 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<ListCompaniesResponse, Company> | A pageable sequence of Company resources. |
Sample code
// Create client
CompanyServiceClient companyServiceClient = CompanyServiceClient.Create();
// Initialize request argument(s)
ListCompaniesRequest request = new ListCompaniesRequest
{
ParentAsNetworkName = NetworkName.FromNetworkCode("[NETWORK_CODE]"),
Filter = "",
OrderBy = "",
Skip = 0,
};
// Make the request
PagedEnumerable<ListCompaniesResponse, Company> response = companyServiceClient.ListCompanies(request);
// Iterate over all response items, lazily performing RPCs as required
foreach (Company 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 (ListCompaniesResponse page in response.AsRawResponses())
{
// Do something with each page of items
Console.WriteLine("A page of results:");
foreach (Company 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<Company> 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 (Company 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;
ListCompanies(NetworkName, string, int?, CallSettings)
API to retrieve a list of Company
objects.
Declaration
public virtual PagedEnumerable<ListCompaniesResponse, Company> ListCompanies(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 Companies.
Format: |
string | pageToken | The token returned from the previous request. A value of |
int? | pageSize | The size of page to request. The response will not be larger than this, but may be smaller. A value of
|
CallSettings | callSettings | If not null, applies overrides to this RPC call. |
Returns
Type | Description |
---|---|
PagedEnumerable<ListCompaniesResponse, Company> | A pageable sequence of Company resources. |
Sample code
// Create client
CompanyServiceClient companyServiceClient = CompanyServiceClient.Create();
// Initialize request argument(s)
NetworkName parent = NetworkName.FromNetworkCode("[NETWORK_CODE]");
// Make the request
PagedEnumerable<ListCompaniesResponse, Company> response = companyServiceClient.ListCompanies(parent);
// Iterate over all response items, lazily performing RPCs as required
foreach (Company 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 (ListCompaniesResponse page in response.AsRawResponses())
{
// Do something with each page of items
Console.WriteLine("A page of results:");
foreach (Company 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<Company> 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 (Company 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;
ListCompanies(string, string, int?, CallSettings)
API to retrieve a list of Company
objects.
Declaration
public virtual PagedEnumerable<ListCompaniesResponse, Company> ListCompanies(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 Companies.
Format: |
string | pageToken | The token returned from the previous request. A value of |
int? | pageSize | The size of page to request. The response will not be larger than this, but may be smaller. A value of
|
CallSettings | callSettings | If not null, applies overrides to this RPC call. |
Returns
Type | Description |
---|---|
PagedEnumerable<ListCompaniesResponse, Company> | A pageable sequence of Company resources. |
Sample code
// Create client
CompanyServiceClient companyServiceClient = CompanyServiceClient.Create();
// Initialize request argument(s)
string parent = "networks/[NETWORK_CODE]";
// Make the request
PagedEnumerable<ListCompaniesResponse, Company> response = companyServiceClient.ListCompanies(parent);
// Iterate over all response items, lazily performing RPCs as required
foreach (Company 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 (ListCompaniesResponse page in response.AsRawResponses())
{
// Do something with each page of items
Console.WriteLine("A page of results:");
foreach (Company 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<Company> 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 (Company 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;
ListCompaniesAsync(ListCompaniesRequest, CallSettings)
API to retrieve a list of Company
objects.
Declaration
public virtual PagedAsyncEnumerable<ListCompaniesResponse, Company> ListCompaniesAsync(ListCompaniesRequest request, CallSettings callSettings = null)
Parameters
Type | Name | Description |
---|---|---|
ListCompaniesRequest | 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<ListCompaniesResponse, Company> | A pageable asynchronous sequence of Company resources. |
Sample code
// Create client
CompanyServiceClient companyServiceClient = await CompanyServiceClient.CreateAsync();
// Initialize request argument(s)
ListCompaniesRequest request = new ListCompaniesRequest
{
ParentAsNetworkName = NetworkName.FromNetworkCode("[NETWORK_CODE]"),
Filter = "",
OrderBy = "",
Skip = 0,
};
// Make the request
PagedAsyncEnumerable<ListCompaniesResponse, Company> response = companyServiceClient.ListCompaniesAsync(request);
// Iterate over all response items, lazily performing RPCs as required
await response.ForEachAsync((Company 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((ListCompaniesResponse page) =>
{
// Do something with each page of items
Console.WriteLine("A page of results:");
foreach (Company 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<Company> 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 (Company 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;
ListCompaniesAsync(NetworkName, string, int?, CallSettings)
API to retrieve a list of Company
objects.
Declaration
public virtual PagedAsyncEnumerable<ListCompaniesResponse, Company> ListCompaniesAsync(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 Companies.
Format: |
string | pageToken | The token returned from the previous request. A value of |
int? | pageSize | The size of page to request. The response will not be larger than this, but may be smaller. A value of
|
CallSettings | callSettings | If not null, applies overrides to this RPC call. |
Returns
Type | Description |
---|---|
PagedAsyncEnumerable<ListCompaniesResponse, Company> | A pageable asynchronous sequence of Company resources. |
Sample code
// Create client
CompanyServiceClient companyServiceClient = await CompanyServiceClient.CreateAsync();
// Initialize request argument(s)
NetworkName parent = NetworkName.FromNetworkCode("[NETWORK_CODE]");
// Make the request
PagedAsyncEnumerable<ListCompaniesResponse, Company> response = companyServiceClient.ListCompaniesAsync(parent);
// Iterate over all response items, lazily performing RPCs as required
await response.ForEachAsync((Company 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((ListCompaniesResponse page) =>
{
// Do something with each page of items
Console.WriteLine("A page of results:");
foreach (Company 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<Company> 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 (Company 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;
ListCompaniesAsync(string, string, int?, CallSettings)
API to retrieve a list of Company
objects.
Declaration
public virtual PagedAsyncEnumerable<ListCompaniesResponse, Company> ListCompaniesAsync(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 Companies.
Format: |
string | pageToken | The token returned from the previous request. A value of |
int? | pageSize | The size of page to request. The response will not be larger than this, but may be smaller. A value of
|
CallSettings | callSettings | If not null, applies overrides to this RPC call. |
Returns
Type | Description |
---|---|
PagedAsyncEnumerable<ListCompaniesResponse, Company> | A pageable asynchronous sequence of Company resources. |
Sample code
// Create client
CompanyServiceClient companyServiceClient = await CompanyServiceClient.CreateAsync();
// Initialize request argument(s)
string parent = "networks/[NETWORK_CODE]";
// Make the request
PagedAsyncEnumerable<ListCompaniesResponse, Company> response = companyServiceClient.ListCompaniesAsync(parent);
// Iterate over all response items, lazily performing RPCs as required
await response.ForEachAsync((Company 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((ListCompaniesResponse page) =>
{
// Do something with each page of items
Console.WriteLine("A page of results:");
foreach (Company 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<Company> 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 (Company 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.