com.google.ads.googleads.v10.services.KeywordPlanServiceClient Maven / Gradle / Ivy
/*
* Copyright 2022 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.google.ads.googleads.v10.services;
import com.google.ads.googleads.v10.resources.KeywordPlanName;
import com.google.ads.googleads.v10.services.stub.KeywordPlanServiceStub;
import com.google.ads.googleads.v10.services.stub.KeywordPlanServiceStubSettings;
import com.google.api.gax.core.BackgroundResource;
import com.google.api.gax.rpc.UnaryCallable;
import java.io.IOException;
import java.util.List;
import java.util.concurrent.TimeUnit;
import javax.annotation.Generated;
// AUTO-GENERATED DOCUMENTATION AND CLASS.
/**
* Service Description: Service to manage keyword plans.
*
* 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:
*
*
{@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 (KeywordPlanServiceClient keywordPlanServiceClient = KeywordPlanServiceClient.create()) {
* String customerId = "customerId-1581184615";
* List operations = new ArrayList<>();
* MutateKeywordPlansResponse response =
* keywordPlanServiceClient.mutateKeywordPlans(customerId, operations);
* }
* }
*
* Note: close() needs to be called on the KeywordPlanServiceClient object to clean up resources
* such as threads. In the example above, try-with-resources is used, which automatically calls
* close().
*
*
The surface of this class includes several types of Java methods for each of the API's
* methods:
*
*
* - A "flattened" method. With this type of method, the fields of the request type have been
* converted into function parameters. It may be the case that not all fields are available as
* parameters, and not every API method will have a flattened method entry point.
*
- A "request object" method. This type of method only takes one parameter, a request object,
* which must be constructed before the call. Not every API method will have a request object
* method.
*
- A "callable" method. This type of method takes no parameters and returns 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 KeywordPlanServiceSettings to
* create(). For example:
*
*
To customize credentials:
*
*
{@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
* KeywordPlanServiceSettings keywordPlanServiceSettings =
* KeywordPlanServiceSettings.newBuilder()
* .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
* .build();
* KeywordPlanServiceClient keywordPlanServiceClient =
* KeywordPlanServiceClient.create(keywordPlanServiceSettings);
* }
*
* To customize the endpoint:
*
*
{@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
* KeywordPlanServiceSettings keywordPlanServiceSettings =
* KeywordPlanServiceSettings.newBuilder().setEndpoint(myEndpoint).build();
* KeywordPlanServiceClient keywordPlanServiceClient =
* KeywordPlanServiceClient.create(keywordPlanServiceSettings);
* }
*
* Please refer to the GitHub repository's samples for more quickstart code snippets.
*/
@Generated("by gapic-generator-java")
public class KeywordPlanServiceClient implements BackgroundResource {
private final KeywordPlanServiceSettings settings;
private final KeywordPlanServiceStub stub;
/** Constructs an instance of KeywordPlanServiceClient with default settings. */
public static final KeywordPlanServiceClient create() throws IOException {
return create(KeywordPlanServiceSettings.newBuilder().build());
}
/**
* Constructs an instance of KeywordPlanServiceClient, using the given settings. The channels are
* created based on the settings passed in, or defaults for any settings that are not set.
*/
public static final KeywordPlanServiceClient create(KeywordPlanServiceSettings settings)
throws IOException {
return new KeywordPlanServiceClient(settings);
}
/**
* Constructs an instance of KeywordPlanServiceClient, using the given stub for making calls. This
* is for advanced usage - prefer using create(KeywordPlanServiceSettings).
*/
public static final KeywordPlanServiceClient create(KeywordPlanServiceStub stub) {
return new KeywordPlanServiceClient(stub);
}
/**
* Constructs an instance of KeywordPlanServiceClient, 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.
*/
protected KeywordPlanServiceClient(KeywordPlanServiceSettings settings) throws IOException {
this.settings = settings;
this.stub = ((KeywordPlanServiceStubSettings) settings.getStubSettings()).createStub();
}
protected KeywordPlanServiceClient(KeywordPlanServiceStub stub) {
this.settings = null;
this.stub = stub;
}
public final KeywordPlanServiceSettings getSettings() {
return settings;
}
public KeywordPlanServiceStub getStub() {
return stub;
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Creates, updates, or removes keyword plans. Operation statuses are returned.
*
*
List of thrown errors: [AuthenticationError]() [AuthorizationError]() [DatabaseError]()
* [FieldError]() [HeaderError]() [InternalError]() [KeywordPlanError]() [MutateError]()
* [NewResourceCreationError]() [QuotaError]() [RequestError]()
* [ResourceCountLimitExceededError]() [StringLengthError]()
*
*
Sample code:
*
*
{@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 (KeywordPlanServiceClient keywordPlanServiceClient = KeywordPlanServiceClient.create()) {
* String customerId = "customerId-1581184615";
* List operations = new ArrayList<>();
* MutateKeywordPlansResponse response =
* keywordPlanServiceClient.mutateKeywordPlans(customerId, operations);
* }
* }
*
* @param customerId Required. The ID of the customer whose keyword plans are being modified.
* @param operations Required. The list of operations to perform on individual keyword plans.
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final MutateKeywordPlansResponse mutateKeywordPlans(
String customerId, List operations) {
MutateKeywordPlansRequest request =
MutateKeywordPlansRequest.newBuilder()
.setCustomerId(customerId)
.addAllOperations(operations)
.build();
return mutateKeywordPlans(request);
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Creates, updates, or removes keyword plans. Operation statuses are returned.
*
* List of thrown errors: [AuthenticationError]() [AuthorizationError]() [DatabaseError]()
* [FieldError]() [HeaderError]() [InternalError]() [KeywordPlanError]() [MutateError]()
* [NewResourceCreationError]() [QuotaError]() [RequestError]()
* [ResourceCountLimitExceededError]() [StringLengthError]()
*
*
Sample code:
*
*
{@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 (KeywordPlanServiceClient keywordPlanServiceClient = KeywordPlanServiceClient.create()) {
* MutateKeywordPlansRequest request =
* MutateKeywordPlansRequest.newBuilder()
* .setCustomerId("customerId-1581184615")
* .addAllOperations(new ArrayList())
* .setPartialFailure(true)
* .setValidateOnly(true)
* .build();
* MutateKeywordPlansResponse response = keywordPlanServiceClient.mutateKeywordPlans(request);
* }
* }
*
* @param 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
*/
public final MutateKeywordPlansResponse mutateKeywordPlans(MutateKeywordPlansRequest request) {
return mutateKeywordPlansCallable().call(request);
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Creates, updates, or removes keyword plans. Operation statuses are returned.
*
* List of thrown errors: [AuthenticationError]() [AuthorizationError]() [DatabaseError]()
* [FieldError]() [HeaderError]() [InternalError]() [KeywordPlanError]() [MutateError]()
* [NewResourceCreationError]() [QuotaError]() [RequestError]()
* [ResourceCountLimitExceededError]() [StringLengthError]()
*
*
Sample code:
*
*
{@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 (KeywordPlanServiceClient keywordPlanServiceClient = KeywordPlanServiceClient.create()) {
* MutateKeywordPlansRequest request =
* MutateKeywordPlansRequest.newBuilder()
* .setCustomerId("customerId-1581184615")
* .addAllOperations(new ArrayList())
* .setPartialFailure(true)
* .setValidateOnly(true)
* .build();
* ApiFuture future =
* keywordPlanServiceClient.mutateKeywordPlansCallable().futureCall(request);
* // Do something.
* MutateKeywordPlansResponse response = future.get();
* }
* }
*/
public final UnaryCallable
mutateKeywordPlansCallable() {
return stub.mutateKeywordPlansCallable();
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Returns the requested Keyword Plan forecast curve. Only the bidding strategy is considered for
* generating forecast curve. The bidding strategy value specified in the plan is ignored.
*
* To generate a forecast at a value specified in the plan, use
* KeywordPlanService.GenerateForecastMetrics.
*
*
List of thrown errors: [AuthenticationError]() [AuthorizationError]() [HeaderError]()
* [InternalError]() [KeywordPlanError]() [QuotaError]() [RequestError]()
*
*
Sample code:
*
*
{@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 (KeywordPlanServiceClient keywordPlanServiceClient = KeywordPlanServiceClient.create()) {
* KeywordPlanName keywordPlan = KeywordPlanName.of("[CUSTOMER_ID]", "[KEYWORD_PLAN_ID]");
* GenerateForecastCurveResponse response =
* keywordPlanServiceClient.generateForecastCurve(keywordPlan);
* }
* }
*
* @param keywordPlan Required. The resource name of the keyword plan to be forecasted.
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final GenerateForecastCurveResponse generateForecastCurve(KeywordPlanName keywordPlan) {
GenerateForecastCurveRequest request =
GenerateForecastCurveRequest.newBuilder()
.setKeywordPlan(keywordPlan == null ? null : keywordPlan.toString())
.build();
return generateForecastCurve(request);
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Returns the requested Keyword Plan forecast curve. Only the bidding strategy is considered for
* generating forecast curve. The bidding strategy value specified in the plan is ignored.
*
* To generate a forecast at a value specified in the plan, use
* KeywordPlanService.GenerateForecastMetrics.
*
*
List of thrown errors: [AuthenticationError]() [AuthorizationError]() [HeaderError]()
* [InternalError]() [KeywordPlanError]() [QuotaError]() [RequestError]()
*
*
Sample code:
*
*
{@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 (KeywordPlanServiceClient keywordPlanServiceClient = KeywordPlanServiceClient.create()) {
* String keywordPlan = KeywordPlanName.of("[CUSTOMER_ID]", "[KEYWORD_PLAN_ID]").toString();
* GenerateForecastCurveResponse response =
* keywordPlanServiceClient.generateForecastCurve(keywordPlan);
* }
* }
*
* @param keywordPlan Required. The resource name of the keyword plan to be forecasted.
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final GenerateForecastCurveResponse generateForecastCurve(String keywordPlan) {
GenerateForecastCurveRequest request =
GenerateForecastCurveRequest.newBuilder().setKeywordPlan(keywordPlan).build();
return generateForecastCurve(request);
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Returns the requested Keyword Plan forecast curve. Only the bidding strategy is considered for
* generating forecast curve. The bidding strategy value specified in the plan is ignored.
*
* To generate a forecast at a value specified in the plan, use
* KeywordPlanService.GenerateForecastMetrics.
*
*
List of thrown errors: [AuthenticationError]() [AuthorizationError]() [HeaderError]()
* [InternalError]() [KeywordPlanError]() [QuotaError]() [RequestError]()
*
*
Sample code:
*
*
{@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 (KeywordPlanServiceClient keywordPlanServiceClient = KeywordPlanServiceClient.create()) {
* GenerateForecastCurveRequest request =
* GenerateForecastCurveRequest.newBuilder()
* .setKeywordPlan(KeywordPlanName.of("[CUSTOMER_ID]", "[KEYWORD_PLAN_ID]").toString())
* .build();
* GenerateForecastCurveResponse response =
* keywordPlanServiceClient.generateForecastCurve(request);
* }
* }
*
* @param 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
*/
public final GenerateForecastCurveResponse generateForecastCurve(
GenerateForecastCurveRequest request) {
return generateForecastCurveCallable().call(request);
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Returns the requested Keyword Plan forecast curve. Only the bidding strategy is considered for
* generating forecast curve. The bidding strategy value specified in the plan is ignored.
*
* To generate a forecast at a value specified in the plan, use
* KeywordPlanService.GenerateForecastMetrics.
*
*
List of thrown errors: [AuthenticationError]() [AuthorizationError]() [HeaderError]()
* [InternalError]() [KeywordPlanError]() [QuotaError]() [RequestError]()
*
*
Sample code:
*
*
{@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 (KeywordPlanServiceClient keywordPlanServiceClient = KeywordPlanServiceClient.create()) {
* GenerateForecastCurveRequest request =
* GenerateForecastCurveRequest.newBuilder()
* .setKeywordPlan(KeywordPlanName.of("[CUSTOMER_ID]", "[KEYWORD_PLAN_ID]").toString())
* .build();
* ApiFuture future =
* keywordPlanServiceClient.generateForecastCurveCallable().futureCall(request);
* // Do something.
* GenerateForecastCurveResponse response = future.get();
* }
* }
*/
public final UnaryCallable
generateForecastCurveCallable() {
return stub.generateForecastCurveCallable();
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Returns a forecast in the form of a time series for the Keyword Plan over the next 52 weeks.
* (1) Forecasts closer to the current date are generally more accurate than further out.
*
* (2) The forecast reflects seasonal trends using current and prior traffic patterns. The
* forecast period of the plan is ignored.
*
*
List of thrown errors: [AuthenticationError]() [AuthorizationError]() [HeaderError]()
* [InternalError]() [KeywordPlanError]() [QuotaError]() [RequestError]()
*
*
Sample code:
*
*
{@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 (KeywordPlanServiceClient keywordPlanServiceClient = KeywordPlanServiceClient.create()) {
* KeywordPlanName keywordPlan = KeywordPlanName.of("[CUSTOMER_ID]", "[KEYWORD_PLAN_ID]");
* GenerateForecastTimeSeriesResponse response =
* keywordPlanServiceClient.generateForecastTimeSeries(keywordPlan);
* }
* }
*
* @param keywordPlan Required. The resource name of the keyword plan to be forecasted.
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final GenerateForecastTimeSeriesResponse generateForecastTimeSeries(
KeywordPlanName keywordPlan) {
GenerateForecastTimeSeriesRequest request =
GenerateForecastTimeSeriesRequest.newBuilder()
.setKeywordPlan(keywordPlan == null ? null : keywordPlan.toString())
.build();
return generateForecastTimeSeries(request);
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Returns a forecast in the form of a time series for the Keyword Plan over the next 52 weeks.
* (1) Forecasts closer to the current date are generally more accurate than further out.
*
* (2) The forecast reflects seasonal trends using current and prior traffic patterns. The
* forecast period of the plan is ignored.
*
*
List of thrown errors: [AuthenticationError]() [AuthorizationError]() [HeaderError]()
* [InternalError]() [KeywordPlanError]() [QuotaError]() [RequestError]()
*
*
Sample code:
*
*
{@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 (KeywordPlanServiceClient keywordPlanServiceClient = KeywordPlanServiceClient.create()) {
* String keywordPlan = KeywordPlanName.of("[CUSTOMER_ID]", "[KEYWORD_PLAN_ID]").toString();
* GenerateForecastTimeSeriesResponse response =
* keywordPlanServiceClient.generateForecastTimeSeries(keywordPlan);
* }
* }
*
* @param keywordPlan Required. The resource name of the keyword plan to be forecasted.
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final GenerateForecastTimeSeriesResponse generateForecastTimeSeries(String keywordPlan) {
GenerateForecastTimeSeriesRequest request =
GenerateForecastTimeSeriesRequest.newBuilder().setKeywordPlan(keywordPlan).build();
return generateForecastTimeSeries(request);
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Returns a forecast in the form of a time series for the Keyword Plan over the next 52 weeks.
* (1) Forecasts closer to the current date are generally more accurate than further out.
*
* (2) The forecast reflects seasonal trends using current and prior traffic patterns. The
* forecast period of the plan is ignored.
*
*
List of thrown errors: [AuthenticationError]() [AuthorizationError]() [HeaderError]()
* [InternalError]() [KeywordPlanError]() [QuotaError]() [RequestError]()
*
*
Sample code:
*
*
{@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 (KeywordPlanServiceClient keywordPlanServiceClient = KeywordPlanServiceClient.create()) {
* GenerateForecastTimeSeriesRequest request =
* GenerateForecastTimeSeriesRequest.newBuilder()
* .setKeywordPlan(KeywordPlanName.of("[CUSTOMER_ID]", "[KEYWORD_PLAN_ID]").toString())
* .build();
* GenerateForecastTimeSeriesResponse response =
* keywordPlanServiceClient.generateForecastTimeSeries(request);
* }
* }
*
* @param 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
*/
public final GenerateForecastTimeSeriesResponse generateForecastTimeSeries(
GenerateForecastTimeSeriesRequest request) {
return generateForecastTimeSeriesCallable().call(request);
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Returns a forecast in the form of a time series for the Keyword Plan over the next 52 weeks.
* (1) Forecasts closer to the current date are generally more accurate than further out.
*
* (2) The forecast reflects seasonal trends using current and prior traffic patterns. The
* forecast period of the plan is ignored.
*
*
List of thrown errors: [AuthenticationError]() [AuthorizationError]() [HeaderError]()
* [InternalError]() [KeywordPlanError]() [QuotaError]() [RequestError]()
*
*
Sample code:
*
*
{@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 (KeywordPlanServiceClient keywordPlanServiceClient = KeywordPlanServiceClient.create()) {
* GenerateForecastTimeSeriesRequest request =
* GenerateForecastTimeSeriesRequest.newBuilder()
* .setKeywordPlan(KeywordPlanName.of("[CUSTOMER_ID]", "[KEYWORD_PLAN_ID]").toString())
* .build();
* ApiFuture future =
* keywordPlanServiceClient.generateForecastTimeSeriesCallable().futureCall(request);
* // Do something.
* GenerateForecastTimeSeriesResponse response = future.get();
* }
* }
*/
public final UnaryCallable
generateForecastTimeSeriesCallable() {
return stub.generateForecastTimeSeriesCallable();
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Returns the requested Keyword Plan forecasts.
*
* List of thrown errors: [AuthenticationError]() [AuthorizationError]() [HeaderError]()
* [InternalError]() [KeywordPlanError]() [QuotaError]() [RequestError]()
*
*
Sample code:
*
*
{@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 (KeywordPlanServiceClient keywordPlanServiceClient = KeywordPlanServiceClient.create()) {
* KeywordPlanName keywordPlan = KeywordPlanName.of("[CUSTOMER_ID]", "[KEYWORD_PLAN_ID]");
* GenerateForecastMetricsResponse response =
* keywordPlanServiceClient.generateForecastMetrics(keywordPlan);
* }
* }
*
* @param keywordPlan Required. The resource name of the keyword plan to be forecasted.
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final GenerateForecastMetricsResponse generateForecastMetrics(
KeywordPlanName keywordPlan) {
GenerateForecastMetricsRequest request =
GenerateForecastMetricsRequest.newBuilder()
.setKeywordPlan(keywordPlan == null ? null : keywordPlan.toString())
.build();
return generateForecastMetrics(request);
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Returns the requested Keyword Plan forecasts.
*
* List of thrown errors: [AuthenticationError]() [AuthorizationError]() [HeaderError]()
* [InternalError]() [KeywordPlanError]() [QuotaError]() [RequestError]()
*
*
Sample code:
*
*
{@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 (KeywordPlanServiceClient keywordPlanServiceClient = KeywordPlanServiceClient.create()) {
* String keywordPlan = KeywordPlanName.of("[CUSTOMER_ID]", "[KEYWORD_PLAN_ID]").toString();
* GenerateForecastMetricsResponse response =
* keywordPlanServiceClient.generateForecastMetrics(keywordPlan);
* }
* }
*
* @param keywordPlan Required. The resource name of the keyword plan to be forecasted.
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final GenerateForecastMetricsResponse generateForecastMetrics(String keywordPlan) {
GenerateForecastMetricsRequest request =
GenerateForecastMetricsRequest.newBuilder().setKeywordPlan(keywordPlan).build();
return generateForecastMetrics(request);
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Returns the requested Keyword Plan forecasts.
*
* List of thrown errors: [AuthenticationError]() [AuthorizationError]() [HeaderError]()
* [InternalError]() [KeywordPlanError]() [QuotaError]() [RequestError]()
*
*
Sample code:
*
*
{@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 (KeywordPlanServiceClient keywordPlanServiceClient = KeywordPlanServiceClient.create()) {
* GenerateForecastMetricsRequest request =
* GenerateForecastMetricsRequest.newBuilder()
* .setKeywordPlan(KeywordPlanName.of("[CUSTOMER_ID]", "[KEYWORD_PLAN_ID]").toString())
* .build();
* GenerateForecastMetricsResponse response =
* keywordPlanServiceClient.generateForecastMetrics(request);
* }
* }
*
* @param 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
*/
public final GenerateForecastMetricsResponse generateForecastMetrics(
GenerateForecastMetricsRequest request) {
return generateForecastMetricsCallable().call(request);
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Returns the requested Keyword Plan forecasts.
*
* List of thrown errors: [AuthenticationError]() [AuthorizationError]() [HeaderError]()
* [InternalError]() [KeywordPlanError]() [QuotaError]() [RequestError]()
*
*
Sample code:
*
*
{@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 (KeywordPlanServiceClient keywordPlanServiceClient = KeywordPlanServiceClient.create()) {
* GenerateForecastMetricsRequest request =
* GenerateForecastMetricsRequest.newBuilder()
* .setKeywordPlan(KeywordPlanName.of("[CUSTOMER_ID]", "[KEYWORD_PLAN_ID]").toString())
* .build();
* ApiFuture future =
* keywordPlanServiceClient.generateForecastMetricsCallable().futureCall(request);
* // Do something.
* GenerateForecastMetricsResponse response = future.get();
* }
* }
*/
public final UnaryCallable
generateForecastMetricsCallable() {
return stub.generateForecastMetricsCallable();
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Returns the requested Keyword Plan historical metrics.
*
* List of thrown errors: [AuthenticationError]() [AuthorizationError]() [HeaderError]()
* [InternalError]() [KeywordPlanError]() [QuotaError]() [RequestError]()
*
*
Sample code:
*
*
{@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 (KeywordPlanServiceClient keywordPlanServiceClient = KeywordPlanServiceClient.create()) {
* KeywordPlanName keywordPlan = KeywordPlanName.of("[CUSTOMER_ID]", "[KEYWORD_PLAN_ID]");
* GenerateHistoricalMetricsResponse response =
* keywordPlanServiceClient.generateHistoricalMetrics(keywordPlan);
* }
* }
*
* @param keywordPlan Required. The resource name of the keyword plan of which historical metrics
* are requested.
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final GenerateHistoricalMetricsResponse generateHistoricalMetrics(
KeywordPlanName keywordPlan) {
GenerateHistoricalMetricsRequest request =
GenerateHistoricalMetricsRequest.newBuilder()
.setKeywordPlan(keywordPlan == null ? null : keywordPlan.toString())
.build();
return generateHistoricalMetrics(request);
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Returns the requested Keyword Plan historical metrics.
*
* List of thrown errors: [AuthenticationError]() [AuthorizationError]() [HeaderError]()
* [InternalError]() [KeywordPlanError]() [QuotaError]() [RequestError]()
*
*
Sample code:
*
*
{@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 (KeywordPlanServiceClient keywordPlanServiceClient = KeywordPlanServiceClient.create()) {
* String keywordPlan = KeywordPlanName.of("[CUSTOMER_ID]", "[KEYWORD_PLAN_ID]").toString();
* GenerateHistoricalMetricsResponse response =
* keywordPlanServiceClient.generateHistoricalMetrics(keywordPlan);
* }
* }
*
* @param keywordPlan Required. The resource name of the keyword plan of which historical metrics
* are requested.
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final GenerateHistoricalMetricsResponse generateHistoricalMetrics(String keywordPlan) {
GenerateHistoricalMetricsRequest request =
GenerateHistoricalMetricsRequest.newBuilder().setKeywordPlan(keywordPlan).build();
return generateHistoricalMetrics(request);
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Returns the requested Keyword Plan historical metrics.
*
* List of thrown errors: [AuthenticationError]() [AuthorizationError]() [HeaderError]()
* [InternalError]() [KeywordPlanError]() [QuotaError]() [RequestError]()
*
*
Sample code:
*
*
{@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 (KeywordPlanServiceClient keywordPlanServiceClient = KeywordPlanServiceClient.create()) {
* GenerateHistoricalMetricsRequest request =
* GenerateHistoricalMetricsRequest.newBuilder()
* .setKeywordPlan(KeywordPlanName.of("[CUSTOMER_ID]", "[KEYWORD_PLAN_ID]").toString())
* .setAggregateMetrics(KeywordPlanAggregateMetrics.newBuilder().build())
* .setHistoricalMetricsOptions(HistoricalMetricsOptions.newBuilder().build())
* .build();
* GenerateHistoricalMetricsResponse response =
* keywordPlanServiceClient.generateHistoricalMetrics(request);
* }
* }
*
* @param 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
*/
public final GenerateHistoricalMetricsResponse generateHistoricalMetrics(
GenerateHistoricalMetricsRequest request) {
return generateHistoricalMetricsCallable().call(request);
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Returns the requested Keyword Plan historical metrics.
*
* List of thrown errors: [AuthenticationError]() [AuthorizationError]() [HeaderError]()
* [InternalError]() [KeywordPlanError]() [QuotaError]() [RequestError]()
*
*
Sample code:
*
*
{@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 (KeywordPlanServiceClient keywordPlanServiceClient = KeywordPlanServiceClient.create()) {
* GenerateHistoricalMetricsRequest request =
* GenerateHistoricalMetricsRequest.newBuilder()
* .setKeywordPlan(KeywordPlanName.of("[CUSTOMER_ID]", "[KEYWORD_PLAN_ID]").toString())
* .setAggregateMetrics(KeywordPlanAggregateMetrics.newBuilder().build())
* .setHistoricalMetricsOptions(HistoricalMetricsOptions.newBuilder().build())
* .build();
* ApiFuture future =
* keywordPlanServiceClient.generateHistoricalMetricsCallable().futureCall(request);
* // Do something.
* GenerateHistoricalMetricsResponse response = future.get();
* }
* }
*/
public final UnaryCallable
generateHistoricalMetricsCallable() {
return stub.generateHistoricalMetricsCallable();
}
@Override
public final void close() {
stub.close();
}
@Override
public void shutdown() {
stub.shutdown();
}
@Override
public boolean isShutdown() {
return stub.isShutdown();
}
@Override
public boolean isTerminated() {
return stub.isTerminated();
}
@Override
public void shutdownNow() {
stub.shutdownNow();
}
@Override
public boolean awaitTermination(long duration, TimeUnit unit) throws InterruptedException {
return stub.awaitTermination(duration, unit);
}
}