Class CampaignExperimentServiceClient
- java.lang.Object
-
- com.google.ads.googleads.v10.services.CampaignExperimentServiceClient
-
- All Implemented Interfaces:
com.google.api.gax.core.BackgroundResource,java.lang.AutoCloseable
@Generated("by gapic-generator-java") public class CampaignExperimentServiceClient extends java.lang.Object implements com.google.api.gax.core.BackgroundResourceService Description: CampaignExperimentService manages the life cycle of campaign experiments. It is used to create new experiments from drafts, modify experiment properties, promote changes in an experiment back to its base campaign, graduate experiments into new stand-alone campaigns, and to remove an experiment.An experiment consists of two variants or arms - the base campaign and the experiment campaign, directing a fixed share of traffic to each arm. A campaign experiment is created from a draft of changes to the base campaign and will be a snapshot of changes in the draft at the time of creation.
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:
try (CampaignExperimentServiceClient campaignExperimentServiceClient = CampaignExperimentServiceClient.create()) { String customerId = "customerId-1581184615"; List<CampaignExperimentOperation> operations = new ArrayList<>(); MutateCampaignExperimentsResponse response = campaignExperimentServiceClient.mutateCampaignExperiments(customerId, operations); }Note: close() needs to be called on the CampaignExperimentServiceClient 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 CampaignExperimentServiceSettings to create(). For example:
To customize credentials:
CampaignExperimentServiceSettings campaignExperimentServiceSettings = CampaignExperimentServiceSettings.newBuilder() .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials)) .build(); CampaignExperimentServiceClient campaignExperimentServiceClient = CampaignExperimentServiceClient.create(campaignExperimentServiceSettings);To customize the endpoint:
CampaignExperimentServiceSettings campaignExperimentServiceSettings = CampaignExperimentServiceSettings.newBuilder().setEndpoint(myEndpoint).build(); CampaignExperimentServiceClient campaignExperimentServiceClient = CampaignExperimentServiceClient.create(campaignExperimentServiceSettings);Please refer to the GitHub repository's samples for more quickstart code snippets.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classCampaignExperimentServiceClient.ListCampaignExperimentAsyncErrorsFixedSizeCollectionstatic classCampaignExperimentServiceClient.ListCampaignExperimentAsyncErrorsPagestatic classCampaignExperimentServiceClient.ListCampaignExperimentAsyncErrorsPagedResponse
-
Constructor Summary
Constructors Modifier Constructor Description protectedCampaignExperimentServiceClient(CampaignExperimentServiceSettings settings)Constructs an instance of CampaignExperimentServiceClient, using the given settings.protectedCampaignExperimentServiceClient(CampaignExperimentServiceStub stub)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanawaitTermination(long duration, java.util.concurrent.TimeUnit unit)voidclose()static CampaignExperimentServiceClientcreate()Constructs an instance of CampaignExperimentServiceClient with default settings.static CampaignExperimentServiceClientcreate(CampaignExperimentServiceSettings settings)Constructs an instance of CampaignExperimentServiceClient, using the given settings.static CampaignExperimentServiceClientcreate(CampaignExperimentServiceStub stub)Constructs an instance of CampaignExperimentServiceClient, using the given stub for making calls.com.google.api.gax.longrunning.OperationFuture<com.google.protobuf.Empty,CreateCampaignExperimentMetadata>createCampaignExperimentAsync(CreateCampaignExperimentRequest request)Creates a campaign experiment based on a campaign draft.com.google.api.gax.longrunning.OperationFuture<com.google.protobuf.Empty,CreateCampaignExperimentMetadata>createCampaignExperimentAsync(java.lang.String customerId, CampaignExperiment campaignExperiment)Creates a campaign experiment based on a campaign draft.com.google.api.gax.rpc.UnaryCallable<CreateCampaignExperimentRequest,com.google.longrunning.Operation>createCampaignExperimentCallable()Creates a campaign experiment based on a campaign draft.com.google.api.gax.rpc.OperationCallable<CreateCampaignExperimentRequest,com.google.protobuf.Empty,CreateCampaignExperimentMetadata>createCampaignExperimentOperationCallable()Creates a campaign experiment based on a campaign draft.voidendCampaignExperiment(CampaignExperimentName campaignExperiment)Immediately ends a campaign experiment, changing the experiment's scheduled end date and without waiting for end of day.voidendCampaignExperiment(EndCampaignExperimentRequest request)Immediately ends a campaign experiment, changing the experiment's scheduled end date and without waiting for end of day.voidendCampaignExperiment(java.lang.String campaignExperiment)Immediately ends a campaign experiment, changing the experiment's scheduled end date and without waiting for end of day.com.google.api.gax.rpc.UnaryCallable<EndCampaignExperimentRequest,com.google.protobuf.Empty>endCampaignExperimentCallable()Immediately ends a campaign experiment, changing the experiment's scheduled end date and without waiting for end of day.com.google.longrunning.OperationsClientgetOperationsClient()Returns the OperationsClient that can be used to query the status of a long-running operation returned by another API method call.CampaignExperimentServiceSettingsgetSettings()CampaignExperimentServiceStubgetStub()GraduateCampaignExperimentResponsegraduateCampaignExperiment(CampaignExperimentName campaignExperiment, java.lang.String campaignBudget)Graduates a campaign experiment to a full campaign.GraduateCampaignExperimentResponsegraduateCampaignExperiment(GraduateCampaignExperimentRequest request)Graduates a campaign experiment to a full campaign.GraduateCampaignExperimentResponsegraduateCampaignExperiment(java.lang.String campaignExperiment, java.lang.String campaignBudget)Graduates a campaign experiment to a full campaign.com.google.api.gax.rpc.UnaryCallable<GraduateCampaignExperimentRequest,GraduateCampaignExperimentResponse>graduateCampaignExperimentCallable()Graduates a campaign experiment to a full campaign.booleanisShutdown()booleanisTerminated()CampaignExperimentServiceClient.ListCampaignExperimentAsyncErrorsPagedResponselistCampaignExperimentAsyncErrors(CampaignExperimentName resourceName)Returns all errors that occurred during CampaignExperiment create or promote (whichever occurred last).CampaignExperimentServiceClient.ListCampaignExperimentAsyncErrorsPagedResponselistCampaignExperimentAsyncErrors(ListCampaignExperimentAsyncErrorsRequest request)Returns all errors that occurred during CampaignExperiment create or promote (whichever occurred last).CampaignExperimentServiceClient.ListCampaignExperimentAsyncErrorsPagedResponselistCampaignExperimentAsyncErrors(java.lang.String resourceName)Returns all errors that occurred during CampaignExperiment create or promote (whichever occurred last).com.google.api.gax.rpc.UnaryCallable<ListCampaignExperimentAsyncErrorsRequest,ListCampaignExperimentAsyncErrorsResponse>listCampaignExperimentAsyncErrorsCallable()Returns all errors that occurred during CampaignExperiment create or promote (whichever occurred last).com.google.api.gax.rpc.UnaryCallable<ListCampaignExperimentAsyncErrorsRequest,CampaignExperimentServiceClient.ListCampaignExperimentAsyncErrorsPagedResponse>listCampaignExperimentAsyncErrorsPagedCallable()Returns all errors that occurred during CampaignExperiment create or promote (whichever occurred last).MutateCampaignExperimentsResponsemutateCampaignExperiments(MutateCampaignExperimentsRequest request)Updates campaign experiments.MutateCampaignExperimentsResponsemutateCampaignExperiments(java.lang.String customerId, java.util.List<CampaignExperimentOperation> operations)Updates campaign experiments.com.google.api.gax.rpc.UnaryCallable<MutateCampaignExperimentsRequest,MutateCampaignExperimentsResponse>mutateCampaignExperimentsCallable()Updates campaign experiments.com.google.api.gax.longrunning.OperationFuture<com.google.protobuf.Empty,com.google.protobuf.Empty>promoteCampaignExperimentAsync(CampaignExperimentName campaignExperiment)Promotes the changes in a experiment campaign back to the base campaign.com.google.api.gax.longrunning.OperationFuture<com.google.protobuf.Empty,com.google.protobuf.Empty>promoteCampaignExperimentAsync(PromoteCampaignExperimentRequest request)Promotes the changes in a experiment campaign back to the base campaign.com.google.api.gax.longrunning.OperationFuture<com.google.protobuf.Empty,com.google.protobuf.Empty>promoteCampaignExperimentAsync(java.lang.String campaignExperiment)Promotes the changes in a experiment campaign back to the base campaign.com.google.api.gax.rpc.UnaryCallable<PromoteCampaignExperimentRequest,com.google.longrunning.Operation>promoteCampaignExperimentCallable()Promotes the changes in a experiment campaign back to the base campaign.com.google.api.gax.rpc.OperationCallable<PromoteCampaignExperimentRequest,com.google.protobuf.Empty,com.google.protobuf.Empty>promoteCampaignExperimentOperationCallable()Promotes the changes in a experiment campaign back to the base campaign.voidshutdown()voidshutdownNow()
-
-
-
Constructor Detail
-
CampaignExperimentServiceClient
protected CampaignExperimentServiceClient(CampaignExperimentServiceSettings settings) throws java.io.IOException
Constructs an instance of CampaignExperimentServiceClient, 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:
java.io.IOException
-
CampaignExperimentServiceClient
@BetaApi("A restructuring of stub classes is planned, so this may break in the future") protected CampaignExperimentServiceClient(CampaignExperimentServiceStub stub)
-
-
Method Detail
-
create
public static final CampaignExperimentServiceClient create() throws java.io.IOException
Constructs an instance of CampaignExperimentServiceClient with default settings.- Throws:
java.io.IOException
-
create
public static final CampaignExperimentServiceClient create(CampaignExperimentServiceSettings settings) throws java.io.IOException
Constructs an instance of CampaignExperimentServiceClient, using the given settings. The channels are created based on the settings passed in, or defaults for any settings that are not set.- Throws:
java.io.IOException
-
create
@BetaApi("A restructuring of stub classes is planned, so this may break in the future") public static final CampaignExperimentServiceClient create(CampaignExperimentServiceStub stub)Constructs an instance of CampaignExperimentServiceClient, using the given stub for making calls. This is for advanced usage - prefer using create(CampaignExperimentServiceSettings).
-
getSettings
public final CampaignExperimentServiceSettings getSettings()
-
getStub
@BetaApi("A restructuring of stub classes is planned, so this may break in the future") public CampaignExperimentServiceStub getStub()
-
getOperationsClient
public final com.google.longrunning.OperationsClient getOperationsClient()
Returns the OperationsClient that can be used to query the status of a long-running operation returned by another API method call.
-
createCampaignExperimentAsync
public final com.google.api.gax.longrunning.OperationFuture<com.google.protobuf.Empty,CreateCampaignExperimentMetadata> createCampaignExperimentAsync(java.lang.String customerId, CampaignExperiment campaignExperiment)
Creates a campaign experiment based on a campaign draft. The draft campaign will be forked into a real campaign (called the experiment campaign) that will begin serving ads if successfully created.The campaign experiment is created immediately with status INITIALIZING. This method return a long running operation that tracks the forking of the draft campaign. If the forking fails, a list of errors can be retrieved using the ListCampaignExperimentAsyncErrors method. The operation's metadata will be a StringValue containing the resource name of the created campaign experiment.
List of thrown errors: [AuthenticationError]() [AuthorizationError]() [CampaignExperimentError]() [DatabaseError]() [DateError]() [DateRangeError]() [FieldError]() [HeaderError]() [InternalError]() [QuotaError]() [RangeError]() [RequestError]()
Sample code:
try (CampaignExperimentServiceClient campaignExperimentServiceClient = CampaignExperimentServiceClient.create()) { String customerId = "customerId-1581184615"; CampaignExperiment campaignExperiment = CampaignExperiment.newBuilder().build(); campaignExperimentServiceClient .createCampaignExperimentAsync(customerId, campaignExperiment) .get(); }- Parameters:
customerId- Required. The ID of the customer whose campaign experiment is being created.campaignExperiment- Required. The campaign experiment to be created.- Throws:
com.google.api.gax.rpc.ApiException- if the remote call fails
-
createCampaignExperimentAsync
public final com.google.api.gax.longrunning.OperationFuture<com.google.protobuf.Empty,CreateCampaignExperimentMetadata> createCampaignExperimentAsync(CreateCampaignExperimentRequest request)
Creates a campaign experiment based on a campaign draft. The draft campaign will be forked into a real campaign (called the experiment campaign) that will begin serving ads if successfully created.The campaign experiment is created immediately with status INITIALIZING. This method return a long running operation that tracks the forking of the draft campaign. If the forking fails, a list of errors can be retrieved using the ListCampaignExperimentAsyncErrors method. The operation's metadata will be a StringValue containing the resource name of the created campaign experiment.
List of thrown errors: [AuthenticationError]() [AuthorizationError]() [CampaignExperimentError]() [DatabaseError]() [DateError]() [DateRangeError]() [FieldError]() [HeaderError]() [InternalError]() [QuotaError]() [RangeError]() [RequestError]()
Sample code:
try (CampaignExperimentServiceClient campaignExperimentServiceClient = CampaignExperimentServiceClient.create()) { CreateCampaignExperimentRequest request = CreateCampaignExperimentRequest.newBuilder() .setCustomerId("customerId-1581184615") .setCampaignExperiment(CampaignExperiment.newBuilder().build()) .setValidateOnly(true) .build(); campaignExperimentServiceClient.createCampaignExperimentAsync(request).get(); }- 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
-
createCampaignExperimentOperationCallable
public final com.google.api.gax.rpc.OperationCallable<CreateCampaignExperimentRequest,com.google.protobuf.Empty,CreateCampaignExperimentMetadata> createCampaignExperimentOperationCallable()
Creates a campaign experiment based on a campaign draft. The draft campaign will be forked into a real campaign (called the experiment campaign) that will begin serving ads if successfully created.The campaign experiment is created immediately with status INITIALIZING. This method return a long running operation that tracks the forking of the draft campaign. If the forking fails, a list of errors can be retrieved using the ListCampaignExperimentAsyncErrors method. The operation's metadata will be a StringValue containing the resource name of the created campaign experiment.
List of thrown errors: [AuthenticationError]() [AuthorizationError]() [CampaignExperimentError]() [DatabaseError]() [DateError]() [DateRangeError]() [FieldError]() [HeaderError]() [InternalError]() [QuotaError]() [RangeError]() [RequestError]()
Sample code:
try (CampaignExperimentServiceClient campaignExperimentServiceClient = CampaignExperimentServiceClient.create()) { CreateCampaignExperimentRequest request = CreateCampaignExperimentRequest.newBuilder() .setCustomerId("customerId-1581184615") .setCampaignExperiment(CampaignExperiment.newBuilder().build()) .setValidateOnly(true) .build(); OperationFuture<Empty, CreateCampaignExperimentMetadata> future = campaignExperimentServiceClient .createCampaignExperimentOperationCallable() .futureCall(request); // Do something. future.get(); }
-
createCampaignExperimentCallable
public final com.google.api.gax.rpc.UnaryCallable<CreateCampaignExperimentRequest,com.google.longrunning.Operation> createCampaignExperimentCallable()
Creates a campaign experiment based on a campaign draft. The draft campaign will be forked into a real campaign (called the experiment campaign) that will begin serving ads if successfully created.The campaign experiment is created immediately with status INITIALIZING. This method return a long running operation that tracks the forking of the draft campaign. If the forking fails, a list of errors can be retrieved using the ListCampaignExperimentAsyncErrors method. The operation's metadata will be a StringValue containing the resource name of the created campaign experiment.
List of thrown errors: [AuthenticationError]() [AuthorizationError]() [CampaignExperimentError]() [DatabaseError]() [DateError]() [DateRangeError]() [FieldError]() [HeaderError]() [InternalError]() [QuotaError]() [RangeError]() [RequestError]()
Sample code:
try (CampaignExperimentServiceClient campaignExperimentServiceClient = CampaignExperimentServiceClient.create()) { CreateCampaignExperimentRequest request = CreateCampaignExperimentRequest.newBuilder() .setCustomerId("customerId-1581184615") .setCampaignExperiment(CampaignExperiment.newBuilder().build()) .setValidateOnly(true) .build(); ApiFuture<Operation> future = campaignExperimentServiceClient.createCampaignExperimentCallable().futureCall(request); // Do something. future.get(); }
-
mutateCampaignExperiments
public final MutateCampaignExperimentsResponse mutateCampaignExperiments(java.lang.String customerId, java.util.List<CampaignExperimentOperation> operations)
Updates campaign experiments. Operation statuses are returned.List of thrown errors: [AuthenticationError]() [AuthorizationError]() [CampaignExperimentError]() [HeaderError]() [InternalError]() [QuotaError]() [RequestError]()
Sample code:
try (CampaignExperimentServiceClient campaignExperimentServiceClient = CampaignExperimentServiceClient.create()) { String customerId = "customerId-1581184615"; List<CampaignExperimentOperation> operations = new ArrayList<>(); MutateCampaignExperimentsResponse response = campaignExperimentServiceClient.mutateCampaignExperiments(customerId, operations); }- Parameters:
customerId- Required. The ID of the customer whose campaign experiments are being modified.operations- Required. The list of operations to perform on individual campaign experiments.- Throws:
com.google.api.gax.rpc.ApiException- if the remote call fails
-
mutateCampaignExperiments
public final MutateCampaignExperimentsResponse mutateCampaignExperiments(MutateCampaignExperimentsRequest request)
Updates campaign experiments. Operation statuses are returned.List of thrown errors: [AuthenticationError]() [AuthorizationError]() [CampaignExperimentError]() [HeaderError]() [InternalError]() [QuotaError]() [RequestError]()
Sample code:
try (CampaignExperimentServiceClient campaignExperimentServiceClient = CampaignExperimentServiceClient.create()) { MutateCampaignExperimentsRequest request = MutateCampaignExperimentsRequest.newBuilder() .setCustomerId("customerId-1581184615") .addAllOperations(new ArrayList<CampaignExperimentOperation>()) .setPartialFailure(true) .setValidateOnly(true) .build(); MutateCampaignExperimentsResponse response = campaignExperimentServiceClient.mutateCampaignExperiments(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
-
mutateCampaignExperimentsCallable
public final com.google.api.gax.rpc.UnaryCallable<MutateCampaignExperimentsRequest,MutateCampaignExperimentsResponse> mutateCampaignExperimentsCallable()
Updates campaign experiments. Operation statuses are returned.List of thrown errors: [AuthenticationError]() [AuthorizationError]() [CampaignExperimentError]() [HeaderError]() [InternalError]() [QuotaError]() [RequestError]()
Sample code:
try (CampaignExperimentServiceClient campaignExperimentServiceClient = CampaignExperimentServiceClient.create()) { MutateCampaignExperimentsRequest request = MutateCampaignExperimentsRequest.newBuilder() .setCustomerId("customerId-1581184615") .addAllOperations(new ArrayList<CampaignExperimentOperation>()) .setPartialFailure(true) .setValidateOnly(true) .build(); ApiFuture<MutateCampaignExperimentsResponse> future = campaignExperimentServiceClient.mutateCampaignExperimentsCallable().futureCall(request); // Do something. MutateCampaignExperimentsResponse response = future.get(); }
-
graduateCampaignExperiment
public final GraduateCampaignExperimentResponse graduateCampaignExperiment(CampaignExperimentName campaignExperiment, java.lang.String campaignBudget)
Graduates a campaign experiment to a full campaign. The base and experiment campaigns will start running independently with their own budgets.List of thrown errors: [AuthenticationError]() [AuthorizationError]() [CampaignExperimentError]() [HeaderError]() [InternalError]() [MutateError]() [QuotaError]() [RequestError]()
Sample code:
try (CampaignExperimentServiceClient campaignExperimentServiceClient = CampaignExperimentServiceClient.create()) { CampaignExperimentName campaignExperiment = CampaignExperimentName.of("[CUSTOMER_ID]", "[CAMPAIGN_EXPERIMENT_ID]"); String campaignBudget = "campaignBudget-2134405003"; GraduateCampaignExperimentResponse response = campaignExperimentServiceClient.graduateCampaignExperiment( campaignExperiment, campaignBudget); }- Parameters:
campaignExperiment- Required. The resource name of the campaign experiment to graduate.campaignBudget- Required. Resource name of the budget to attach to the campaign graduated from the experiment.- Throws:
com.google.api.gax.rpc.ApiException- if the remote call fails
-
graduateCampaignExperiment
public final GraduateCampaignExperimentResponse graduateCampaignExperiment(java.lang.String campaignExperiment, java.lang.String campaignBudget)
Graduates a campaign experiment to a full campaign. The base and experiment campaigns will start running independently with their own budgets.List of thrown errors: [AuthenticationError]() [AuthorizationError]() [CampaignExperimentError]() [HeaderError]() [InternalError]() [MutateError]() [QuotaError]() [RequestError]()
Sample code:
try (CampaignExperimentServiceClient campaignExperimentServiceClient = CampaignExperimentServiceClient.create()) { String campaignExperiment = CampaignExperimentName.of("[CUSTOMER_ID]", "[CAMPAIGN_EXPERIMENT_ID]").toString(); String campaignBudget = "campaignBudget-2134405003"; GraduateCampaignExperimentResponse response = campaignExperimentServiceClient.graduateCampaignExperiment( campaignExperiment, campaignBudget); }- Parameters:
campaignExperiment- Required. The resource name of the campaign experiment to graduate.campaignBudget- Required. Resource name of the budget to attach to the campaign graduated from the experiment.- Throws:
com.google.api.gax.rpc.ApiException- if the remote call fails
-
graduateCampaignExperiment
public final GraduateCampaignExperimentResponse graduateCampaignExperiment(GraduateCampaignExperimentRequest request)
Graduates a campaign experiment to a full campaign. The base and experiment campaigns will start running independently with their own budgets.List of thrown errors: [AuthenticationError]() [AuthorizationError]() [CampaignExperimentError]() [HeaderError]() [InternalError]() [MutateError]() [QuotaError]() [RequestError]()
Sample code:
try (CampaignExperimentServiceClient campaignExperimentServiceClient = CampaignExperimentServiceClient.create()) { GraduateCampaignExperimentRequest request = GraduateCampaignExperimentRequest.newBuilder() .setCampaignExperiment( CampaignExperimentName.of("[CUSTOMER_ID]", "[CAMPAIGN_EXPERIMENT_ID]").toString()) .setCampaignBudget("campaignBudget-2134405003") .setValidateOnly(true) .build(); GraduateCampaignExperimentResponse response = campaignExperimentServiceClient.graduateCampaignExperiment(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
-
graduateCampaignExperimentCallable
public final com.google.api.gax.rpc.UnaryCallable<GraduateCampaignExperimentRequest,GraduateCampaignExperimentResponse> graduateCampaignExperimentCallable()
Graduates a campaign experiment to a full campaign. The base and experiment campaigns will start running independently with their own budgets.List of thrown errors: [AuthenticationError]() [AuthorizationError]() [CampaignExperimentError]() [HeaderError]() [InternalError]() [MutateError]() [QuotaError]() [RequestError]()
Sample code:
try (CampaignExperimentServiceClient campaignExperimentServiceClient = CampaignExperimentServiceClient.create()) { GraduateCampaignExperimentRequest request = GraduateCampaignExperimentRequest.newBuilder() .setCampaignExperiment( CampaignExperimentName.of("[CUSTOMER_ID]", "[CAMPAIGN_EXPERIMENT_ID]").toString()) .setCampaignBudget("campaignBudget-2134405003") .setValidateOnly(true) .build(); ApiFuture<GraduateCampaignExperimentResponse> future = campaignExperimentServiceClient.graduateCampaignExperimentCallable().futureCall(request); // Do something. GraduateCampaignExperimentResponse response = future.get(); }
-
promoteCampaignExperimentAsync
public final com.google.api.gax.longrunning.OperationFuture<com.google.protobuf.Empty,com.google.protobuf.Empty> promoteCampaignExperimentAsync(CampaignExperimentName campaignExperiment)
Promotes the changes in a experiment campaign back to the base campaign.The campaign experiment is updated immediately with status PROMOTING. This method return a long running operation that tracks the promoting of the experiment campaign. If the promoting fails, a list of errors can be retrieved using the ListCampaignExperimentAsyncErrors method.
List of thrown errors: [AuthenticationError]() [AuthorizationError]() [HeaderError]() [InternalError]() [QuotaError]() [RequestError]()
Sample code:
try (CampaignExperimentServiceClient campaignExperimentServiceClient = CampaignExperimentServiceClient.create()) { CampaignExperimentName campaignExperiment = CampaignExperimentName.of("[CUSTOMER_ID]", "[CAMPAIGN_EXPERIMENT_ID]"); campaignExperimentServiceClient.promoteCampaignExperimentAsync(campaignExperiment).get(); }- Parameters:
campaignExperiment- Required. The resource name of the campaign experiment to promote.- Throws:
com.google.api.gax.rpc.ApiException- if the remote call fails
-
promoteCampaignExperimentAsync
public final com.google.api.gax.longrunning.OperationFuture<com.google.protobuf.Empty,com.google.protobuf.Empty> promoteCampaignExperimentAsync(java.lang.String campaignExperiment)
Promotes the changes in a experiment campaign back to the base campaign.The campaign experiment is updated immediately with status PROMOTING. This method return a long running operation that tracks the promoting of the experiment campaign. If the promoting fails, a list of errors can be retrieved using the ListCampaignExperimentAsyncErrors method.
List of thrown errors: [AuthenticationError]() [AuthorizationError]() [HeaderError]() [InternalError]() [QuotaError]() [RequestError]()
Sample code:
try (CampaignExperimentServiceClient campaignExperimentServiceClient = CampaignExperimentServiceClient.create()) { String campaignExperiment = CampaignExperimentName.of("[CUSTOMER_ID]", "[CAMPAIGN_EXPERIMENT_ID]").toString(); campaignExperimentServiceClient.promoteCampaignExperimentAsync(campaignExperiment).get(); }- Parameters:
campaignExperiment- Required. The resource name of the campaign experiment to promote.- Throws:
com.google.api.gax.rpc.ApiException- if the remote call fails
-
promoteCampaignExperimentAsync
public final com.google.api.gax.longrunning.OperationFuture<com.google.protobuf.Empty,com.google.protobuf.Empty> promoteCampaignExperimentAsync(PromoteCampaignExperimentRequest request)
Promotes the changes in a experiment campaign back to the base campaign.The campaign experiment is updated immediately with status PROMOTING. This method return a long running operation that tracks the promoting of the experiment campaign. If the promoting fails, a list of errors can be retrieved using the ListCampaignExperimentAsyncErrors method.
List of thrown errors: [AuthenticationError]() [AuthorizationError]() [HeaderError]() [InternalError]() [QuotaError]() [RequestError]()
Sample code:
try (CampaignExperimentServiceClient campaignExperimentServiceClient = CampaignExperimentServiceClient.create()) { PromoteCampaignExperimentRequest request = PromoteCampaignExperimentRequest.newBuilder() .setCampaignExperiment( CampaignExperimentName.of("[CUSTOMER_ID]", "[CAMPAIGN_EXPERIMENT_ID]").toString()) .setValidateOnly(true) .build(); campaignExperimentServiceClient.promoteCampaignExperimentAsync(request).get(); }- 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
-
promoteCampaignExperimentOperationCallable
public final com.google.api.gax.rpc.OperationCallable<PromoteCampaignExperimentRequest,com.google.protobuf.Empty,com.google.protobuf.Empty> promoteCampaignExperimentOperationCallable()
Promotes the changes in a experiment campaign back to the base campaign.The campaign experiment is updated immediately with status PROMOTING. This method return a long running operation that tracks the promoting of the experiment campaign. If the promoting fails, a list of errors can be retrieved using the ListCampaignExperimentAsyncErrors method.
List of thrown errors: [AuthenticationError]() [AuthorizationError]() [HeaderError]() [InternalError]() [QuotaError]() [RequestError]()
Sample code:
try (CampaignExperimentServiceClient campaignExperimentServiceClient = CampaignExperimentServiceClient.create()) { PromoteCampaignExperimentRequest request = PromoteCampaignExperimentRequest.newBuilder() .setCampaignExperiment( CampaignExperimentName.of("[CUSTOMER_ID]", "[CAMPAIGN_EXPERIMENT_ID]").toString()) .setValidateOnly(true) .build(); OperationFuture<Empty, Empty> future = campaignExperimentServiceClient .promoteCampaignExperimentOperationCallable() .futureCall(request); // Do something. future.get(); }
-
promoteCampaignExperimentCallable
public final com.google.api.gax.rpc.UnaryCallable<PromoteCampaignExperimentRequest,com.google.longrunning.Operation> promoteCampaignExperimentCallable()
Promotes the changes in a experiment campaign back to the base campaign.The campaign experiment is updated immediately with status PROMOTING. This method return a long running operation that tracks the promoting of the experiment campaign. If the promoting fails, a list of errors can be retrieved using the ListCampaignExperimentAsyncErrors method.
List of thrown errors: [AuthenticationError]() [AuthorizationError]() [HeaderError]() [InternalError]() [QuotaError]() [RequestError]()
Sample code:
try (CampaignExperimentServiceClient campaignExperimentServiceClient = CampaignExperimentServiceClient.create()) { PromoteCampaignExperimentRequest request = PromoteCampaignExperimentRequest.newBuilder() .setCampaignExperiment( CampaignExperimentName.of("[CUSTOMER_ID]", "[CAMPAIGN_EXPERIMENT_ID]").toString()) .setValidateOnly(true) .build(); ApiFuture<Operation> future = campaignExperimentServiceClient.promoteCampaignExperimentCallable().futureCall(request); // Do something. future.get(); }
-
endCampaignExperiment
public final void endCampaignExperiment(CampaignExperimentName campaignExperiment)
Immediately ends a campaign experiment, changing the experiment's scheduled end date and without waiting for end of day. End date is updated to be the time of the request.List of thrown errors: [AuthenticationError]() [AuthorizationError]() [CampaignExperimentError]() [HeaderError]() [InternalError]() [QuotaError]() [RequestError]()
Sample code:
try (CampaignExperimentServiceClient campaignExperimentServiceClient = CampaignExperimentServiceClient.create()) { CampaignExperimentName campaignExperiment = CampaignExperimentName.of("[CUSTOMER_ID]", "[CAMPAIGN_EXPERIMENT_ID]"); campaignExperimentServiceClient.endCampaignExperiment(campaignExperiment); }- Parameters:
campaignExperiment- Required. The resource name of the campaign experiment to end.- Throws:
com.google.api.gax.rpc.ApiException- if the remote call fails
-
endCampaignExperiment
public final void endCampaignExperiment(java.lang.String campaignExperiment)
Immediately ends a campaign experiment, changing the experiment's scheduled end date and without waiting for end of day. End date is updated to be the time of the request.List of thrown errors: [AuthenticationError]() [AuthorizationError]() [CampaignExperimentError]() [HeaderError]() [InternalError]() [QuotaError]() [RequestError]()
Sample code:
try (CampaignExperimentServiceClient campaignExperimentServiceClient = CampaignExperimentServiceClient.create()) { String campaignExperiment = CampaignExperimentName.of("[CUSTOMER_ID]", "[CAMPAIGN_EXPERIMENT_ID]").toString(); campaignExperimentServiceClient.endCampaignExperiment(campaignExperiment); }- Parameters:
campaignExperiment- Required. The resource name of the campaign experiment to end.- Throws:
com.google.api.gax.rpc.ApiException- if the remote call fails
-
endCampaignExperiment
public final void endCampaignExperiment(EndCampaignExperimentRequest request)
Immediately ends a campaign experiment, changing the experiment's scheduled end date and without waiting for end of day. End date is updated to be the time of the request.List of thrown errors: [AuthenticationError]() [AuthorizationError]() [CampaignExperimentError]() [HeaderError]() [InternalError]() [QuotaError]() [RequestError]()
Sample code:
try (CampaignExperimentServiceClient campaignExperimentServiceClient = CampaignExperimentServiceClient.create()) { EndCampaignExperimentRequest request = EndCampaignExperimentRequest.newBuilder() .setCampaignExperiment( CampaignExperimentName.of("[CUSTOMER_ID]", "[CAMPAIGN_EXPERIMENT_ID]").toString()) .setValidateOnly(true) .build(); campaignExperimentServiceClient.endCampaignExperiment(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
-
endCampaignExperimentCallable
public final com.google.api.gax.rpc.UnaryCallable<EndCampaignExperimentRequest,com.google.protobuf.Empty> endCampaignExperimentCallable()
Immediately ends a campaign experiment, changing the experiment's scheduled end date and without waiting for end of day. End date is updated to be the time of the request.List of thrown errors: [AuthenticationError]() [AuthorizationError]() [CampaignExperimentError]() [HeaderError]() [InternalError]() [QuotaError]() [RequestError]()
Sample code:
try (CampaignExperimentServiceClient campaignExperimentServiceClient = CampaignExperimentServiceClient.create()) { EndCampaignExperimentRequest request = EndCampaignExperimentRequest.newBuilder() .setCampaignExperiment( CampaignExperimentName.of("[CUSTOMER_ID]", "[CAMPAIGN_EXPERIMENT_ID]").toString()) .setValidateOnly(true) .build(); ApiFuture<Empty> future = campaignExperimentServiceClient.endCampaignExperimentCallable().futureCall(request); // Do something. future.get(); }
-
listCampaignExperimentAsyncErrors
public final CampaignExperimentServiceClient.ListCampaignExperimentAsyncErrorsPagedResponse listCampaignExperimentAsyncErrors(CampaignExperimentName resourceName)
Returns all errors that occurred during CampaignExperiment create or promote (whichever occurred last). Supports standard list paging.List of thrown errors: [AuthenticationError]() [AuthorizationError]() [HeaderError]() [InternalError]() [QuotaError]() [RequestError]()
Sample code:
try (CampaignExperimentServiceClient campaignExperimentServiceClient = CampaignExperimentServiceClient.create()) { CampaignExperimentName resourceName = CampaignExperimentName.of("[CUSTOMER_ID]", "[CAMPAIGN_EXPERIMENT_ID]"); for (Status element : campaignExperimentServiceClient .listCampaignExperimentAsyncErrors(resourceName) .iterateAll()) { // doThingsWith(element); } }- Parameters:
resourceName- Required. The name of the campaign experiment from which to retrieve the async errors.- Throws:
com.google.api.gax.rpc.ApiException- if the remote call fails
-
listCampaignExperimentAsyncErrors
public final CampaignExperimentServiceClient.ListCampaignExperimentAsyncErrorsPagedResponse listCampaignExperimentAsyncErrors(java.lang.String resourceName)
Returns all errors that occurred during CampaignExperiment create or promote (whichever occurred last). Supports standard list paging.List of thrown errors: [AuthenticationError]() [AuthorizationError]() [HeaderError]() [InternalError]() [QuotaError]() [RequestError]()
Sample code:
try (CampaignExperimentServiceClient campaignExperimentServiceClient = CampaignExperimentServiceClient.create()) { String resourceName = CampaignExperimentName.of("[CUSTOMER_ID]", "[CAMPAIGN_EXPERIMENT_ID]").toString(); for (Status element : campaignExperimentServiceClient .listCampaignExperimentAsyncErrors(resourceName) .iterateAll()) { // doThingsWith(element); } }- Parameters:
resourceName- Required. The name of the campaign experiment from which to retrieve the async errors.- Throws:
com.google.api.gax.rpc.ApiException- if the remote call fails
-
listCampaignExperimentAsyncErrors
public final CampaignExperimentServiceClient.ListCampaignExperimentAsyncErrorsPagedResponse listCampaignExperimentAsyncErrors(ListCampaignExperimentAsyncErrorsRequest request)
Returns all errors that occurred during CampaignExperiment create or promote (whichever occurred last). Supports standard list paging.List of thrown errors: [AuthenticationError]() [AuthorizationError]() [HeaderError]() [InternalError]() [QuotaError]() [RequestError]()
Sample code:
try (CampaignExperimentServiceClient campaignExperimentServiceClient = CampaignExperimentServiceClient.create()) { ListCampaignExperimentAsyncErrorsRequest request = ListCampaignExperimentAsyncErrorsRequest.newBuilder() .setResourceName( CampaignExperimentName.of("[CUSTOMER_ID]", "[CAMPAIGN_EXPERIMENT_ID]").toString()) .setPageToken("pageToken873572522") .setPageSize(883849137) .build(); for (Status element : campaignExperimentServiceClient.listCampaignExperimentAsyncErrors(request).iterateAll()) { // doThingsWith(element); } }- 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
-
listCampaignExperimentAsyncErrorsPagedCallable
public final com.google.api.gax.rpc.UnaryCallable<ListCampaignExperimentAsyncErrorsRequest,CampaignExperimentServiceClient.ListCampaignExperimentAsyncErrorsPagedResponse> listCampaignExperimentAsyncErrorsPagedCallable()
Returns all errors that occurred during CampaignExperiment create or promote (whichever occurred last). Supports standard list paging.List of thrown errors: [AuthenticationError]() [AuthorizationError]() [HeaderError]() [InternalError]() [QuotaError]() [RequestError]()
Sample code:
try (CampaignExperimentServiceClient campaignExperimentServiceClient = CampaignExperimentServiceClient.create()) { ListCampaignExperimentAsyncErrorsRequest request = ListCampaignExperimentAsyncErrorsRequest.newBuilder() .setResourceName( CampaignExperimentName.of("[CUSTOMER_ID]", "[CAMPAIGN_EXPERIMENT_ID]").toString()) .setPageToken("pageToken873572522") .setPageSize(883849137) .build(); ApiFuture<Status> future = campaignExperimentServiceClient .listCampaignExperimentAsyncErrorsPagedCallable() .futureCall(request); // Do something. for (Status element : future.get().iterateAll()) { // doThingsWith(element); } }
-
listCampaignExperimentAsyncErrorsCallable
public final com.google.api.gax.rpc.UnaryCallable<ListCampaignExperimentAsyncErrorsRequest,ListCampaignExperimentAsyncErrorsResponse> listCampaignExperimentAsyncErrorsCallable()
Returns all errors that occurred during CampaignExperiment create or promote (whichever occurred last). Supports standard list paging.List of thrown errors: [AuthenticationError]() [AuthorizationError]() [HeaderError]() [InternalError]() [QuotaError]() [RequestError]()
Sample code:
try (CampaignExperimentServiceClient campaignExperimentServiceClient = CampaignExperimentServiceClient.create()) { ListCampaignExperimentAsyncErrorsRequest request = ListCampaignExperimentAsyncErrorsRequest.newBuilder() .setResourceName( CampaignExperimentName.of("[CUSTOMER_ID]", "[CAMPAIGN_EXPERIMENT_ID]").toString()) .setPageToken("pageToken873572522") .setPageSize(883849137) .build(); while (true) { ListCampaignExperimentAsyncErrorsResponse response = campaignExperimentServiceClient .listCampaignExperimentAsyncErrorsCallable() .call(request); for (Status element : response.getResponsesList()) { // doThingsWith(element); } String nextPageToken = response.getNextPageToken(); if (!Strings.isNullOrEmpty(nextPageToken)) { request = request.toBuilder().setPageToken(nextPageToken).build(); } else { break; } } }
-
close
public final void close()
- Specified by:
closein interfacejava.lang.AutoCloseable
-
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
public boolean awaitTermination(long duration, java.util.concurrent.TimeUnit unit) throws java.lang.InterruptedException- Specified by:
awaitTerminationin interfacecom.google.api.gax.core.BackgroundResource- Throws:
java.lang.InterruptedException
-
-