Class BenchmarksServiceClient
- All Implemented Interfaces:
com.google.api.gax.core.BackgroundResource,AutoCloseable
This class provides the ability to make remote calls to the backing service through method calls that map to API methods. Sample code to get started:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (BenchmarksServiceClient benchmarksServiceClient = BenchmarksServiceClient.create()) {
ListBenchmarksAvailableDatesRequest request =
ListBenchmarksAvailableDatesRequest.newBuilder()
.setApplicationInfo(AdditionalApplicationInfo.newBuilder().build())
.build();
ListBenchmarksAvailableDatesResponse response =
benchmarksServiceClient.listBenchmarksAvailableDates(request);
}
Note: close() needs to be called on the BenchmarksServiceClient object to clean up resources such as threads. In the example above, try-with-resources is used, which automatically calls close().
| Method | Description | Method Variants |
|---|---|---|
ListBenchmarksAvailableDates |
Returns a date range that supports benchmarks. List of thrown errors: [AuthenticationError]() [AuthorizationError]() [FieldError]() [HeaderError]() [InternalError]() [QuotaError]() [RequestError]() |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
ListBenchmarksLocations |
Returns the list of locations that support benchmarks (for example, countries). List of thrown errors: [AuthenticationError]() [AuthorizationError]() [FieldError]() [HeaderError]() [InternalError]() [QuotaError]() [RequestError]() |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
ListBenchmarksProducts |
Returns the list of products that supports benchmarks. List of thrown errors: [AuthenticationError]() [AuthorizationError]() [FieldError]() [HeaderError]() [InternalError]() [QuotaError]() [RequestError]() |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
ListBenchmarksSources |
Returns the list of benchmarks sources (for example, Industry Verticals). List of thrown errors: [AuthenticationError]() [AuthorizationError]() [FieldError]() [HeaderError]() [InternalError]() [QuotaError]() [RequestError]() |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
GenerateBenchmarksMetrics |
Returns YouTube advertisement metrics for the given client against industry benchmarks. List of thrown errors: [AuthenticationError]() [AuthorizationError]() [BenchmarksError]() [FieldError]() [HeaderError]() [InternalError]() [QuotaError]() [RangeError]() [RequestError]() |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
See the individual methods for example code.
Many parameters require resource names to be formatted in a particular way. To assist with these names, this class includes a format method for each type of name, and additionally a parse method to extract the individual identifiers contained within names that are returned.
This class can be customized by passing in a custom instance of BenchmarksServiceSettings to create(). For example:
To customize credentials:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
BenchmarksServiceSettings benchmarksServiceSettings =
BenchmarksServiceSettings.newBuilder()
.setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
.build();
BenchmarksServiceClient benchmarksServiceClient =
BenchmarksServiceClient.create(benchmarksServiceSettings);
To customize the endpoint:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
BenchmarksServiceSettings benchmarksServiceSettings =
BenchmarksServiceSettings.newBuilder().setEndpoint(myEndpoint).build();
BenchmarksServiceClient benchmarksServiceClient =
BenchmarksServiceClient.create(benchmarksServiceSettings);
Please refer to the GitHub repository's samples for more quickstart code snippets.
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedConstructs an instance of BenchmarksServiceClient, using the given settings.protected -
Method Summary
Modifier and TypeMethodDescriptionbooleanawaitTermination(long duration, TimeUnit unit) final voidclose()static final BenchmarksServiceClientcreate()Constructs an instance of BenchmarksServiceClient with default settings.static final BenchmarksServiceClientcreate(BenchmarksServiceSettings settings) Constructs an instance of BenchmarksServiceClient, using the given settings.static final BenchmarksServiceClientcreate(BenchmarksServiceStub stub) Constructs an instance of BenchmarksServiceClient, using the given stub for making calls.Returns YouTube advertisement metrics for the given client against industry benchmarks.generateBenchmarksMetrics(String customerId, LocationInfo location, BenchmarksSource benchmarksSource, ProductFilter productFilter) Returns YouTube advertisement metrics for the given client against industry benchmarks.final com.google.api.gax.rpc.UnaryCallable<GenerateBenchmarksMetricsRequest,GenerateBenchmarksMetricsResponse> Returns YouTube advertisement metrics for the given client against industry benchmarks.getStub()booleanbooleanReturns a date range that supports benchmarks.final com.google.api.gax.rpc.UnaryCallable<ListBenchmarksAvailableDatesRequest,ListBenchmarksAvailableDatesResponse> Returns a date range that supports benchmarks.Returns the list of locations that support benchmarks (for example, countries).final com.google.api.gax.rpc.UnaryCallable<ListBenchmarksLocationsRequest,ListBenchmarksLocationsResponse> Returns the list of locations that support benchmarks (for example, countries).Returns the list of products that supports benchmarks.final com.google.api.gax.rpc.UnaryCallable<ListBenchmarksProductsRequest,ListBenchmarksProductsResponse> Returns the list of products that supports benchmarks.Returns the list of benchmarks sources (for example, Industry Verticals).listBenchmarksSources(List<BenchmarksSourceTypeEnum.BenchmarksSourceType> benchmarksSources) Returns the list of benchmarks sources (for example, Industry Verticals).final com.google.api.gax.rpc.UnaryCallable<ListBenchmarksSourcesRequest,ListBenchmarksSourcesResponse> Returns the list of benchmarks sources (for example, Industry Verticals).voidshutdown()void
-
Constructor Details
-
BenchmarksServiceClient
Constructs an instance of BenchmarksServiceClient, using the given settings. This is protected so that it is easy to make a subclass, but otherwise, the static factory methods should be preferred.- Throws:
IOException
-
BenchmarksServiceClient
-
-
Method Details
-
create
Constructs an instance of BenchmarksServiceClient with default settings.- Throws:
IOException
-
create
public static final BenchmarksServiceClient create(BenchmarksServiceSettings settings) throws IOException Constructs an instance of BenchmarksServiceClient, using the given settings. The channels are created based on the settings passed in, or defaults for any settings that are not set.- Throws:
IOException
-
create
Constructs an instance of BenchmarksServiceClient, using the given stub for making calls. This is for advanced usage - prefer using create(BenchmarksServiceSettings). -
getSettings
-
getStub
-
listBenchmarksAvailableDates
public final ListBenchmarksAvailableDatesResponse listBenchmarksAvailableDates(ListBenchmarksAvailableDatesRequest request) Returns a date range that supports benchmarks.List of thrown errors: [AuthenticationError]() [AuthorizationError]() [FieldError]() [HeaderError]() [InternalError]() [QuotaError]() [RequestError]()
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (BenchmarksServiceClient benchmarksServiceClient = BenchmarksServiceClient.create()) { ListBenchmarksAvailableDatesRequest request = ListBenchmarksAvailableDatesRequest.newBuilder() .setApplicationInfo(AdditionalApplicationInfo.newBuilder().build()) .build(); ListBenchmarksAvailableDatesResponse response = benchmarksServiceClient.listBenchmarksAvailableDates(request); }- Parameters:
request- The request object containing all of the parameters for the API call.- Throws:
com.google.api.gax.rpc.ApiException- if the remote call fails
-
listBenchmarksAvailableDatesCallable
public final com.google.api.gax.rpc.UnaryCallable<ListBenchmarksAvailableDatesRequest,ListBenchmarksAvailableDatesResponse> listBenchmarksAvailableDatesCallable()Returns a date range that supports benchmarks.List of thrown errors: [AuthenticationError]() [AuthorizationError]() [FieldError]() [HeaderError]() [InternalError]() [QuotaError]() [RequestError]()
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (BenchmarksServiceClient benchmarksServiceClient = BenchmarksServiceClient.create()) { ListBenchmarksAvailableDatesRequest request = ListBenchmarksAvailableDatesRequest.newBuilder() .setApplicationInfo(AdditionalApplicationInfo.newBuilder().build()) .build(); ApiFuture<ListBenchmarksAvailableDatesResponse> future = benchmarksServiceClient.listBenchmarksAvailableDatesCallable().futureCall(request); // Do something. ListBenchmarksAvailableDatesResponse response = future.get(); } -
listBenchmarksLocations
public final ListBenchmarksLocationsResponse listBenchmarksLocations(ListBenchmarksLocationsRequest request) Returns the list of locations that support benchmarks (for example, countries).List of thrown errors: [AuthenticationError]() [AuthorizationError]() [FieldError]() [HeaderError]() [InternalError]() [QuotaError]() [RequestError]()
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (BenchmarksServiceClient benchmarksServiceClient = BenchmarksServiceClient.create()) { ListBenchmarksLocationsRequest request = ListBenchmarksLocationsRequest.newBuilder() .setApplicationInfo(AdditionalApplicationInfo.newBuilder().build()) .build(); ListBenchmarksLocationsResponse response = benchmarksServiceClient.listBenchmarksLocations(request); }- Parameters:
request- The request object containing all of the parameters for the API call.- Throws:
com.google.api.gax.rpc.ApiException- if the remote call fails
-
listBenchmarksLocationsCallable
public final com.google.api.gax.rpc.UnaryCallable<ListBenchmarksLocationsRequest,ListBenchmarksLocationsResponse> listBenchmarksLocationsCallable()Returns the list of locations that support benchmarks (for example, countries).List of thrown errors: [AuthenticationError]() [AuthorizationError]() [FieldError]() [HeaderError]() [InternalError]() [QuotaError]() [RequestError]()
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (BenchmarksServiceClient benchmarksServiceClient = BenchmarksServiceClient.create()) { ListBenchmarksLocationsRequest request = ListBenchmarksLocationsRequest.newBuilder() .setApplicationInfo(AdditionalApplicationInfo.newBuilder().build()) .build(); ApiFuture<ListBenchmarksLocationsResponse> future = benchmarksServiceClient.listBenchmarksLocationsCallable().futureCall(request); // Do something. ListBenchmarksLocationsResponse response = future.get(); } -
listBenchmarksProducts
public final ListBenchmarksProductsResponse listBenchmarksProducts(ListBenchmarksProductsRequest request) Returns the list of products that supports benchmarks.List of thrown errors: [AuthenticationError]() [AuthorizationError]() [FieldError]() [HeaderError]() [InternalError]() [QuotaError]() [RequestError]()
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (BenchmarksServiceClient benchmarksServiceClient = BenchmarksServiceClient.create()) { ListBenchmarksProductsRequest request = ListBenchmarksProductsRequest.newBuilder() .setApplicationInfo(AdditionalApplicationInfo.newBuilder().build()) .build(); ListBenchmarksProductsResponse response = benchmarksServiceClient.listBenchmarksProducts(request); }- Parameters:
request- The request object containing all of the parameters for the API call.- Throws:
com.google.api.gax.rpc.ApiException- if the remote call fails
-
listBenchmarksProductsCallable
public final com.google.api.gax.rpc.UnaryCallable<ListBenchmarksProductsRequest,ListBenchmarksProductsResponse> listBenchmarksProductsCallable()Returns the list of products that supports benchmarks.List of thrown errors: [AuthenticationError]() [AuthorizationError]() [FieldError]() [HeaderError]() [InternalError]() [QuotaError]() [RequestError]()
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (BenchmarksServiceClient benchmarksServiceClient = BenchmarksServiceClient.create()) { ListBenchmarksProductsRequest request = ListBenchmarksProductsRequest.newBuilder() .setApplicationInfo(AdditionalApplicationInfo.newBuilder().build()) .build(); ApiFuture<ListBenchmarksProductsResponse> future = benchmarksServiceClient.listBenchmarksProductsCallable().futureCall(request); // Do something. ListBenchmarksProductsResponse response = future.get(); } -
listBenchmarksSources
public final ListBenchmarksSourcesResponse listBenchmarksSources(List<BenchmarksSourceTypeEnum.BenchmarksSourceType> benchmarksSources) Returns the list of benchmarks sources (for example, Industry Verticals).List of thrown errors: [AuthenticationError]() [AuthorizationError]() [FieldError]() [HeaderError]() [InternalError]() [QuotaError]() [RequestError]()
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (BenchmarksServiceClient benchmarksServiceClient = BenchmarksServiceClient.create()) { List<BenchmarksSourceTypeEnum.BenchmarksSourceType> benchmarksSources = new ArrayList<>(); ListBenchmarksSourcesResponse response = benchmarksServiceClient.listBenchmarksSources(benchmarksSources); }- Parameters:
benchmarksSources- Required. The types of benchmarks sources to be returned (for example, INDUSTRY_VERTICAL).- Throws:
com.google.api.gax.rpc.ApiException- if the remote call fails
-
listBenchmarksSources
public final ListBenchmarksSourcesResponse listBenchmarksSources(ListBenchmarksSourcesRequest request) Returns the list of benchmarks sources (for example, Industry Verticals).List of thrown errors: [AuthenticationError]() [AuthorizationError]() [FieldError]() [HeaderError]() [InternalError]() [QuotaError]() [RequestError]()
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (BenchmarksServiceClient benchmarksServiceClient = BenchmarksServiceClient.create()) { ListBenchmarksSourcesRequest request = ListBenchmarksSourcesRequest.newBuilder() .addAllBenchmarksSources( new ArrayList<BenchmarksSourceTypeEnum.BenchmarksSourceType>()) .setApplicationInfo(AdditionalApplicationInfo.newBuilder().build()) .build(); ListBenchmarksSourcesResponse response = benchmarksServiceClient.listBenchmarksSources(request); }- Parameters:
request- The request object containing all of the parameters for the API call.- Throws:
com.google.api.gax.rpc.ApiException- if the remote call fails
-
listBenchmarksSourcesCallable
public final com.google.api.gax.rpc.UnaryCallable<ListBenchmarksSourcesRequest,ListBenchmarksSourcesResponse> listBenchmarksSourcesCallable()Returns the list of benchmarks sources (for example, Industry Verticals).List of thrown errors: [AuthenticationError]() [AuthorizationError]() [FieldError]() [HeaderError]() [InternalError]() [QuotaError]() [RequestError]()
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (BenchmarksServiceClient benchmarksServiceClient = BenchmarksServiceClient.create()) { ListBenchmarksSourcesRequest request = ListBenchmarksSourcesRequest.newBuilder() .addAllBenchmarksSources( new ArrayList<BenchmarksSourceTypeEnum.BenchmarksSourceType>()) .setApplicationInfo(AdditionalApplicationInfo.newBuilder().build()) .build(); ApiFuture<ListBenchmarksSourcesResponse> future = benchmarksServiceClient.listBenchmarksSourcesCallable().futureCall(request); // Do something. ListBenchmarksSourcesResponse response = future.get(); } -
generateBenchmarksMetrics
public final GenerateBenchmarksMetricsResponse generateBenchmarksMetrics(String customerId, LocationInfo location, BenchmarksSource benchmarksSource, ProductFilter productFilter) Returns YouTube advertisement metrics for the given client against industry benchmarks.List of thrown errors: [AuthenticationError]() [AuthorizationError]() [BenchmarksError]() [FieldError]() [HeaderError]() [InternalError]() [QuotaError]() [RangeError]() [RequestError]()
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (BenchmarksServiceClient benchmarksServiceClient = BenchmarksServiceClient.create()) { String customerId = "customerId-1581184615"; LocationInfo location = LocationInfo.newBuilder().build(); BenchmarksSource benchmarksSource = BenchmarksSource.newBuilder().build(); ProductFilter productFilter = ProductFilter.newBuilder().build(); GenerateBenchmarksMetricsResponse response = benchmarksServiceClient.generateBenchmarksMetrics( customerId, location, benchmarksSource, productFilter); }- Parameters:
customerId- Required. The ID of the customer. Supply a client customer ID to generate metrics for the customer. A manager account customer ID will not return customer metrics since it does not have any associated direct ad campaigns.location- Required. The location to generate benchmarks metrics for.benchmarksSource- Required. The source used to generate benchmarks metrics for.productFilter- Required. The products to aggregate metrics over. Product filter settings support a list of product IDs or a list of marketing objectives.- Throws:
com.google.api.gax.rpc.ApiException- if the remote call fails
-
generateBenchmarksMetrics
public final GenerateBenchmarksMetricsResponse generateBenchmarksMetrics(GenerateBenchmarksMetricsRequest request) Returns YouTube advertisement metrics for the given client against industry benchmarks.List of thrown errors: [AuthenticationError]() [AuthorizationError]() [BenchmarksError]() [FieldError]() [HeaderError]() [InternalError]() [QuotaError]() [RangeError]() [RequestError]()
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (BenchmarksServiceClient benchmarksServiceClient = BenchmarksServiceClient.create()) { GenerateBenchmarksMetricsRequest request = GenerateBenchmarksMetricsRequest.newBuilder() .setCustomerId("customerId-1581184615") .setDateRange(DateRange.newBuilder().build()) .setLocation(LocationInfo.newBuilder().build()) .setBenchmarksSource(BenchmarksSource.newBuilder().build()) .setProductFilter(ProductFilter.newBuilder().build()) .setCurrencyCode("currencyCode1004773790") .setCustomerBenchmarksGroup("customerBenchmarksGroup-2124896949") .setApplicationInfo(AdditionalApplicationInfo.newBuilder().build()) .build(); GenerateBenchmarksMetricsResponse response = benchmarksServiceClient.generateBenchmarksMetrics(request); }- Parameters:
request- The request object containing all of the parameters for the API call.- Throws:
com.google.api.gax.rpc.ApiException- if the remote call fails
-
generateBenchmarksMetricsCallable
public final com.google.api.gax.rpc.UnaryCallable<GenerateBenchmarksMetricsRequest,GenerateBenchmarksMetricsResponse> generateBenchmarksMetricsCallable()Returns YouTube advertisement metrics for the given client against industry benchmarks.List of thrown errors: [AuthenticationError]() [AuthorizationError]() [BenchmarksError]() [FieldError]() [HeaderError]() [InternalError]() [QuotaError]() [RangeError]() [RequestError]()
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (BenchmarksServiceClient benchmarksServiceClient = BenchmarksServiceClient.create()) { GenerateBenchmarksMetricsRequest request = GenerateBenchmarksMetricsRequest.newBuilder() .setCustomerId("customerId-1581184615") .setDateRange(DateRange.newBuilder().build()) .setLocation(LocationInfo.newBuilder().build()) .setBenchmarksSource(BenchmarksSource.newBuilder().build()) .setProductFilter(ProductFilter.newBuilder().build()) .setCurrencyCode("currencyCode1004773790") .setCustomerBenchmarksGroup("customerBenchmarksGroup-2124896949") .setApplicationInfo(AdditionalApplicationInfo.newBuilder().build()) .build(); ApiFuture<GenerateBenchmarksMetricsResponse> future = benchmarksServiceClient.generateBenchmarksMetricsCallable().futureCall(request); // Do something. GenerateBenchmarksMetricsResponse response = future.get(); } -
close
public final void close()- Specified by:
closein interfaceAutoCloseable
-
shutdown
public void shutdown()- Specified by:
shutdownin interfacecom.google.api.gax.core.BackgroundResource
-
isShutdown
public boolean isShutdown()- Specified by:
isShutdownin interfacecom.google.api.gax.core.BackgroundResource
-
isTerminated
public boolean isTerminated()- Specified by:
isTerminatedin interfacecom.google.api.gax.core.BackgroundResource
-
shutdownNow
public void shutdownNow()- Specified by:
shutdownNowin interfacecom.google.api.gax.core.BackgroundResource
-
awaitTermination
- Specified by:
awaitTerminationin interfacecom.google.api.gax.core.BackgroundResource- Throws:
InterruptedException
-