Class RecaptchaEnterpriseServiceClient (2.6.1)

public class RecaptchaEnterpriseServiceClient implements BackgroundResource

Service Description: Service to determine the likelihood an event is legitimate.

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 (RecaptchaEnterpriseServiceClient recaptchaEnterpriseServiceClient =
     RecaptchaEnterpriseServiceClient.create()) {
   ProjectName parent = ProjectName.of("[PROJECT]");
   Assessment assessment = Assessment.newBuilder().build();
   Assessment response = recaptchaEnterpriseServiceClient.createAssessment(parent, assessment);
 }
 

Note: close() needs to be called on the RecaptchaEnterpriseServiceClient 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:

  1. 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.
  2. 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.
  3. 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 RecaptchaEnterpriseServiceSettings to create(). For example:

To customize credentials:


 RecaptchaEnterpriseServiceSettings recaptchaEnterpriseServiceSettings =
     RecaptchaEnterpriseServiceSettings.newBuilder()
         .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
         .build();
 RecaptchaEnterpriseServiceClient recaptchaEnterpriseServiceClient =
     RecaptchaEnterpriseServiceClient.create(recaptchaEnterpriseServiceSettings);
 

To customize the endpoint:


 RecaptchaEnterpriseServiceSettings recaptchaEnterpriseServiceSettings =
     RecaptchaEnterpriseServiceSettings.newBuilder().setEndpoint(myEndpoint).build();
 RecaptchaEnterpriseServiceClient recaptchaEnterpriseServiceClient =
     RecaptchaEnterpriseServiceClient.create(recaptchaEnterpriseServiceSettings);
 

Please refer to the GitHub repository's samples for more quickstart code snippets.

Inheritance

java.lang.Object > RecaptchaEnterpriseServiceClient

Implements

BackgroundResource

Static Methods

create()

public static final RecaptchaEnterpriseServiceClient create()

Constructs an instance of RecaptchaEnterpriseServiceClient with default settings.

Returns
TypeDescription
RecaptchaEnterpriseServiceClient
Exceptions
TypeDescription
IOException

create(RecaptchaEnterpriseServiceSettings settings)

public static final RecaptchaEnterpriseServiceClient create(RecaptchaEnterpriseServiceSettings settings)

Constructs an instance of RecaptchaEnterpriseServiceClient, using the given settings. The channels are created based on the settings passed in, or defaults for any settings that are not set.

Parameter
NameDescription
settingsRecaptchaEnterpriseServiceSettings
Returns
TypeDescription
RecaptchaEnterpriseServiceClient
Exceptions
TypeDescription
IOException

create(RecaptchaEnterpriseServiceStub stub)

public static final RecaptchaEnterpriseServiceClient create(RecaptchaEnterpriseServiceStub stub)

Constructs an instance of RecaptchaEnterpriseServiceClient, using the given stub for making calls. This is for advanced usage - prefer using create(RecaptchaEnterpriseServiceSettings).

Parameter
NameDescription
stubRecaptchaEnterpriseServiceStub
Returns
TypeDescription
RecaptchaEnterpriseServiceClient

Constructors

RecaptchaEnterpriseServiceClient(RecaptchaEnterpriseServiceSettings settings)

protected RecaptchaEnterpriseServiceClient(RecaptchaEnterpriseServiceSettings settings)

Constructs an instance of RecaptchaEnterpriseServiceClient, 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.

Parameter
NameDescription
settingsRecaptchaEnterpriseServiceSettings

RecaptchaEnterpriseServiceClient(RecaptchaEnterpriseServiceStub stub)

protected RecaptchaEnterpriseServiceClient(RecaptchaEnterpriseServiceStub stub)
Parameter
NameDescription
stubRecaptchaEnterpriseServiceStub

Methods

annotateAssessment(AnnotateAssessmentRequest request)

public final AnnotateAssessmentResponse annotateAssessment(AnnotateAssessmentRequest request)

Annotates a previously created Assessment to provide additional information on whether the event turned out to be authentic or fraudulent.

Sample code:


 try (RecaptchaEnterpriseServiceClient recaptchaEnterpriseServiceClient =
     RecaptchaEnterpriseServiceClient.create()) {
   AnnotateAssessmentRequest request =
       AnnotateAssessmentRequest.newBuilder()
           .setName(AssessmentName.of("[PROJECT]", "[ASSESSMENT]").toString())
           .addAllReasons(new ArrayList<AnnotateAssessmentRequest.Reason>())
           .setHashedAccountId(ByteString.EMPTY)
           .build();
   AnnotateAssessmentResponse response =
       recaptchaEnterpriseServiceClient.annotateAssessment(request);
 }
 
Parameter
NameDescription
requestAnnotateAssessmentRequest

The request object containing all of the parameters for the API call.

Returns
TypeDescription
AnnotateAssessmentResponse

annotateAssessment(AssessmentName name, AnnotateAssessmentRequest.Annotation annotation)

public final AnnotateAssessmentResponse annotateAssessment(AssessmentName name, AnnotateAssessmentRequest.Annotation annotation)

Annotates a previously created Assessment to provide additional information on whether the event turned out to be authentic or fraudulent.

Sample code:


 try (RecaptchaEnterpriseServiceClient recaptchaEnterpriseServiceClient =
     RecaptchaEnterpriseServiceClient.create()) {
   AssessmentName name = AssessmentName.of("[PROJECT]", "[ASSESSMENT]");
   AnnotateAssessmentRequest.Annotation annotation =
       AnnotateAssessmentRequest.Annotation.forNumber(0);
   AnnotateAssessmentResponse response =
       recaptchaEnterpriseServiceClient.annotateAssessment(name, annotation);
 }
 
Parameters
NameDescription
nameAssessmentName

Required. The resource name of the Assessment, in the format "projects/{project}/assessments/{assessment}".

annotationAnnotateAssessmentRequest.Annotation

Optional. The annotation that will be assigned to the Event. This field can be left empty to provide reasons that apply to an event without concluding whether the event is legitimate or fraudulent.

Returns
TypeDescription
AnnotateAssessmentResponse

annotateAssessment(String name, AnnotateAssessmentRequest.Annotation annotation)

public final AnnotateAssessmentResponse annotateAssessment(String name, AnnotateAssessmentRequest.Annotation annotation)

Annotates a previously created Assessment to provide additional information on whether the event turned out to be authentic or fraudulent.

Sample code:


 try (RecaptchaEnterpriseServiceClient recaptchaEnterpriseServiceClient =
     RecaptchaEnterpriseServiceClient.create()) {
   String name = AssessmentName.of("[PROJECT]", "[ASSESSMENT]").toString();
   AnnotateAssessmentRequest.Annotation annotation =
       AnnotateAssessmentRequest.Annotation.forNumber(0);
   AnnotateAssessmentResponse response =
       recaptchaEnterpriseServiceClient.annotateAssessment(name, annotation);
 }
 
Parameters
NameDescription
nameString

Required. The resource name of the Assessment, in the format "projects/{project}/assessments/{assessment}".

annotationAnnotateAssessmentRequest.Annotation

Optional. The annotation that will be assigned to the Event. This field can be left empty to provide reasons that apply to an event without concluding whether the event is legitimate or fraudulent.

Returns
TypeDescription
AnnotateAssessmentResponse

annotateAssessmentCallable()

public final UnaryCallable<AnnotateAssessmentRequest,AnnotateAssessmentResponse> annotateAssessmentCallable()

Annotates a previously created Assessment to provide additional information on whether the event turned out to be authentic or fraudulent.

Sample code:


 try (RecaptchaEnterpriseServiceClient recaptchaEnterpriseServiceClient =
     RecaptchaEnterpriseServiceClient.create()) {
   AnnotateAssessmentRequest request =
       AnnotateAssessmentRequest.newBuilder()
           .setName(AssessmentName.of("[PROJECT]", "[ASSESSMENT]").toString())
           .addAllReasons(new ArrayList<AnnotateAssessmentRequest.Reason>())
           .setHashedAccountId(ByteString.EMPTY)
           .build();
   ApiFuture<AnnotateAssessmentResponse> future =
       recaptchaEnterpriseServiceClient.annotateAssessmentCallable().futureCall(request);
   // Do something.
   AnnotateAssessmentResponse response = future.get();
 }
 
Returns
TypeDescription
UnaryCallable<AnnotateAssessmentRequest,AnnotateAssessmentResponse>

awaitTermination(long duration, TimeUnit unit)

public boolean awaitTermination(long duration, TimeUnit unit)
Parameters
NameDescription
durationlong
unitTimeUnit
Returns
TypeDescription
boolean
Exceptions
TypeDescription
InterruptedException

close()

public final void close()

createAssessment(CreateAssessmentRequest request)

public final Assessment createAssessment(CreateAssessmentRequest request)

Creates an Assessment of the likelihood an event is legitimate.

Sample code:


 try (RecaptchaEnterpriseServiceClient recaptchaEnterpriseServiceClient =
     RecaptchaEnterpriseServiceClient.create()) {
   CreateAssessmentRequest request =
       CreateAssessmentRequest.newBuilder()
           .setParent(ProjectName.of("[PROJECT]").toString())
           .setAssessment(Assessment.newBuilder().build())
           .build();
   Assessment response = recaptchaEnterpriseServiceClient.createAssessment(request);
 }
 
Parameter
NameDescription
requestCreateAssessmentRequest

The request object containing all of the parameters for the API call.

Returns
TypeDescription
Assessment

createAssessment(ProjectName parent, Assessment assessment)

public final Assessment createAssessment(ProjectName parent, Assessment assessment)

Creates an Assessment of the likelihood an event is legitimate.

Sample code:


 try (RecaptchaEnterpriseServiceClient recaptchaEnterpriseServiceClient =
     RecaptchaEnterpriseServiceClient.create()) {
   ProjectName parent = ProjectName.of("[PROJECT]");
   Assessment assessment = Assessment.newBuilder().build();
   Assessment response = recaptchaEnterpriseServiceClient.createAssessment(parent, assessment);
 }
 
Parameters
NameDescription
parentProjectName

Required. The name of the project in which the assessment will be created, in the format "projects/{project}".

assessmentAssessment

Required. The assessment details.

Returns
TypeDescription
Assessment

createAssessment(String parent, Assessment assessment)

public final Assessment createAssessment(String parent, Assessment assessment)

Creates an Assessment of the likelihood an event is legitimate.

Sample code:


 try (RecaptchaEnterpriseServiceClient recaptchaEnterpriseServiceClient =
     RecaptchaEnterpriseServiceClient.create()) {
   String parent = ProjectName.of("[PROJECT]").toString();
   Assessment assessment = Assessment.newBuilder().build();
   Assessment response = recaptchaEnterpriseServiceClient.createAssessment(parent, assessment);
 }
 
Parameters
NameDescription
parentString

Required. The name of the project in which the assessment will be created, in the format "projects/{project}".

assessmentAssessment

Required. The assessment details.

Returns
TypeDescription
Assessment

createAssessmentCallable()

public final UnaryCallable<CreateAssessmentRequest,Assessment> createAssessmentCallable()

Creates an Assessment of the likelihood an event is legitimate.

Sample code:


 try (RecaptchaEnterpriseServiceClient recaptchaEnterpriseServiceClient =
     RecaptchaEnterpriseServiceClient.create()) {
   CreateAssessmentRequest request =
       CreateAssessmentRequest.newBuilder()
           .setParent(ProjectName.of("[PROJECT]").toString())
           .setAssessment(Assessment.newBuilder().build())
           .build();
   ApiFuture<Assessment> future =
       recaptchaEnterpriseServiceClient.createAssessmentCallable().futureCall(request);
   // Do something.
   Assessment response = future.get();
 }
 
Returns
TypeDescription
UnaryCallable<CreateAssessmentRequest,Assessment>

createKey(CreateKeyRequest request)

public final Key createKey(CreateKeyRequest request)

Creates a new reCAPTCHA Enterprise key.

Sample code:


 try (RecaptchaEnterpriseServiceClient recaptchaEnterpriseServiceClient =
     RecaptchaEnterpriseServiceClient.create()) {
   CreateKeyRequest request =
       CreateKeyRequest.newBuilder()
           .setParent(ProjectName.of("[PROJECT]").toString())
           .setKey(Key.newBuilder().build())
           .build();
   Key response = recaptchaEnterpriseServiceClient.createKey(request);
 }
 
Parameter
NameDescription
requestCreateKeyRequest

The request object containing all of the parameters for the API call.

Returns
TypeDescription
Key

createKeyCallable()

public final UnaryCallable<CreateKeyRequest,Key> createKeyCallable()

Creates a new reCAPTCHA Enterprise key.

Sample code:


 try (RecaptchaEnterpriseServiceClient recaptchaEnterpriseServiceClient =
     RecaptchaEnterpriseServiceClient.create()) {
   CreateKeyRequest request =
       CreateKeyRequest.newBuilder()
           .setParent(ProjectName.of("[PROJECT]").toString())
           .setKey(Key.newBuilder().build())
           .build();
   ApiFuture<Key> future =
       recaptchaEnterpriseServiceClient.createKeyCallable().futureCall(request);
   // Do something.
   Key response = future.get();
 }
 
Returns
TypeDescription
UnaryCallable<CreateKeyRequest,Key>

deleteKey(DeleteKeyRequest request)

public final void deleteKey(DeleteKeyRequest request)

Deletes the specified key.

Sample code:


 try (RecaptchaEnterpriseServiceClient recaptchaEnterpriseServiceClient =
     RecaptchaEnterpriseServiceClient.create()) {
   DeleteKeyRequest request =
       DeleteKeyRequest.newBuilder()
           .setName(KeyName.of("[PROJECT]", "[KEY]").toString())
           .build();
   recaptchaEnterpriseServiceClient.deleteKey(request);
 }
 
Parameter
NameDescription
requestDeleteKeyRequest

The request object containing all of the parameters for the API call.

deleteKeyCallable()

public final UnaryCallable<DeleteKeyRequest,Empty> deleteKeyCallable()

Deletes the specified key.

Sample code:


 try (RecaptchaEnterpriseServiceClient recaptchaEnterpriseServiceClient =
     RecaptchaEnterpriseServiceClient.create()) {
   DeleteKeyRequest request =
       DeleteKeyRequest.newBuilder()
           .setName(KeyName.of("[PROJECT]", "[KEY]").toString())
           .build();
   ApiFuture<Empty> future =
       recaptchaEnterpriseServiceClient.deleteKeyCallable().futureCall(request);
   // Do something.
   future.get();
 }
 
Returns
TypeDescription
UnaryCallable<DeleteKeyRequest,Empty>

getKey(GetKeyRequest request)

public final Key getKey(GetKeyRequest request)

Returns the specified key.

Sample code:


 try (RecaptchaEnterpriseServiceClient recaptchaEnterpriseServiceClient =
     RecaptchaEnterpriseServiceClient.create()) {
   GetKeyRequest request =
       GetKeyRequest.newBuilder().setName(KeyName.of("[PROJECT]", "[KEY]").toString()).build();
   Key response = recaptchaEnterpriseServiceClient.getKey(request);
 }
 
Parameter
NameDescription
requestGetKeyRequest

The request object containing all of the parameters for the API call.

Returns
TypeDescription
Key

getKeyCallable()

public final UnaryCallable<GetKeyRequest,Key> getKeyCallable()

Returns the specified key.

Sample code:


 try (RecaptchaEnterpriseServiceClient recaptchaEnterpriseServiceClient =
     RecaptchaEnterpriseServiceClient.create()) {
   GetKeyRequest request =
       GetKeyRequest.newBuilder().setName(KeyName.of("[PROJECT]", "[KEY]").toString()).build();
   ApiFuture<Key> future = recaptchaEnterpriseServiceClient.getKeyCallable().futureCall(request);
   // Do something.
   Key response = future.get();
 }
 
Returns
TypeDescription
UnaryCallable<GetKeyRequest,Key>

getMetrics(GetMetricsRequest request)

public final Metrics getMetrics(GetMetricsRequest request)

Get some aggregated metrics for a Key. This data can be used to build dashboards.

Sample code:


 try (RecaptchaEnterpriseServiceClient recaptchaEnterpriseServiceClient =
     RecaptchaEnterpriseServiceClient.create()) {
   GetMetricsRequest request =
       GetMetricsRequest.newBuilder()
           .setName(MetricsName.of("[PROJECT]", "[KEY]").toString())
           .build();
   Metrics response = recaptchaEnterpriseServiceClient.getMetrics(request);
 }
 
Parameter
NameDescription
requestGetMetricsRequest

The request object containing all of the parameters for the API call.

Returns
TypeDescription
Metrics

getMetrics(MetricsName name)

public final Metrics getMetrics(MetricsName name)

Get some aggregated metrics for a Key. This data can be used to build dashboards.

Sample code:


 try (RecaptchaEnterpriseServiceClient recaptchaEnterpriseServiceClient =
     RecaptchaEnterpriseServiceClient.create()) {
   MetricsName name = MetricsName.of("[PROJECT]", "[KEY]");
   Metrics response = recaptchaEnterpriseServiceClient.getMetrics(name);
 }
 
Parameter
NameDescription
nameMetricsName

Required. The name of the requested metrics, in the format "projects/{project}/keys/{key}/metrics".

Returns
TypeDescription
Metrics

getMetrics(String name)

public final Metrics getMetrics(String name)

Get some aggregated metrics for a Key. This data can be used to build dashboards.

Sample code:


 try (RecaptchaEnterpriseServiceClient recaptchaEnterpriseServiceClient =
     RecaptchaEnterpriseServiceClient.create()) {
   String name = MetricsName.of("[PROJECT]", "[KEY]").toString();
   Metrics response = recaptchaEnterpriseServiceClient.getMetrics(name);
 }
 
Parameter
NameDescription
nameString

Required. The name of the requested metrics, in the format "projects/{project}/keys/{key}/metrics".

Returns
TypeDescription
Metrics

getMetricsCallable()

public final UnaryCallable<GetMetricsRequest,Metrics> getMetricsCallable()

Get some aggregated metrics for a Key. This data can be used to build dashboards.

Sample code:


 try (RecaptchaEnterpriseServiceClient recaptchaEnterpriseServiceClient =
     RecaptchaEnterpriseServiceClient.create()) {
   GetMetricsRequest request =
       GetMetricsRequest.newBuilder()
           .setName(MetricsName.of("[PROJECT]", "[KEY]").toString())
           .build();
   ApiFuture<Metrics> future =
       recaptchaEnterpriseServiceClient.getMetricsCallable().futureCall(request);
   // Do something.
   Metrics response = future.get();
 }
 
Returns
TypeDescription
UnaryCallable<GetMetricsRequest,Metrics>

getSettings()

public final RecaptchaEnterpriseServiceSettings getSettings()
Returns
TypeDescription
RecaptchaEnterpriseServiceSettings

getStub()

public RecaptchaEnterpriseServiceStub getStub()
Returns
TypeDescription
RecaptchaEnterpriseServiceStub

isShutdown()

public boolean isShutdown()
Returns
TypeDescription
boolean

isTerminated()

public boolean isTerminated()
Returns
TypeDescription
boolean

listKeys(ListKeysRequest request)

public final RecaptchaEnterpriseServiceClient.ListKeysPagedResponse listKeys(ListKeysRequest request)

Returns the list of all keys that belong to a project.

Sample code:


 try (RecaptchaEnterpriseServiceClient recaptchaEnterpriseServiceClient =
     RecaptchaEnterpriseServiceClient.create()) {
   ListKeysRequest request =
       ListKeysRequest.newBuilder()
           .setParent(ProjectName.of("[PROJECT]").toString())
           .setPageSize(883849137)
           .setPageToken("pageToken873572522")
           .build();
   for (Key element : recaptchaEnterpriseServiceClient.listKeys(request).iterateAll()) {
     // doThingsWith(element);
   }
 }
 
Parameter
NameDescription
requestListKeysRequest

The request object containing all of the parameters for the API call.

Returns
TypeDescription
RecaptchaEnterpriseServiceClient.ListKeysPagedResponse

listKeysCallable()

public final UnaryCallable<ListKeysRequest,ListKeysResponse> listKeysCallable()

Returns the list of all keys that belong to a project.

Sample code:


 try (RecaptchaEnterpriseServiceClient recaptchaEnterpriseServiceClient =
     RecaptchaEnterpriseServiceClient.create()) {
   ListKeysRequest request =
       ListKeysRequest.newBuilder()
           .setParent(ProjectName.of("[PROJECT]").toString())
           .setPageSize(883849137)
           .setPageToken("pageToken873572522")
           .build();
   while (true) {
     ListKeysResponse response =
         recaptchaEnterpriseServiceClient.listKeysCallable().call(request);
     for (Key element : response.getResponsesList()) {
       // doThingsWith(element);
     }
     String nextPageToken = response.getNextPageToken();
     if (!Strings.isNullOrEmpty(nextPageToken)) {
       request = request.toBuilder().setPageToken(nextPageToken).build();
     } else {
       break;
     }
   }
 }
 
Returns
TypeDescription
UnaryCallable<ListKeysRequest,ListKeysResponse>

listKeysPagedCallable()

public final UnaryCallable<ListKeysRequest,RecaptchaEnterpriseServiceClient.ListKeysPagedResponse> listKeysPagedCallable()

Returns the list of all keys that belong to a project.

Sample code:


 try (RecaptchaEnterpriseServiceClient recaptchaEnterpriseServiceClient =
     RecaptchaEnterpriseServiceClient.create()) {
   ListKeysRequest request =
       ListKeysRequest.newBuilder()
           .setParent(ProjectName.of("[PROJECT]").toString())
           .setPageSize(883849137)
           .setPageToken("pageToken873572522")
           .build();
   ApiFuture<Key> future =
       recaptchaEnterpriseServiceClient.listKeysPagedCallable().futureCall(request);
   // Do something.
   for (Key element : future.get().iterateAll()) {
     // doThingsWith(element);
   }
 }
 
Returns
TypeDescription
UnaryCallable<ListKeysRequest,ListKeysPagedResponse>

listRelatedAccountGroupMemberships(ListRelatedAccountGroupMembershipsRequest request)

public final RecaptchaEnterpriseServiceClient.ListRelatedAccountGroupMembershipsPagedResponse listRelatedAccountGroupMemberships(ListRelatedAccountGroupMembershipsRequest request)

Get the memberships in a group of related accounts.

Sample code:


 try (RecaptchaEnterpriseServiceClient recaptchaEnterpriseServiceClient =
     RecaptchaEnterpriseServiceClient.create()) {
   ListRelatedAccountGroupMembershipsRequest request =
       ListRelatedAccountGroupMembershipsRequest.newBuilder()
           .setParent(
               RelatedAccountGroupName.of("[PROJECT]", "[RELATEDACCOUNTGROUP]").toString())
           .setPageSize(883849137)
           .setPageToken("pageToken873572522")
           .build();
   for (RelatedAccountGroupMembership element :
       recaptchaEnterpriseServiceClient
           .listRelatedAccountGroupMemberships(request)
           .iterateAll()) {
     // doThingsWith(element);
   }
 }
 
Parameter
NameDescription
requestListRelatedAccountGroupMembershipsRequest

The request object containing all of the parameters for the API call.

Returns
TypeDescription
RecaptchaEnterpriseServiceClient.ListRelatedAccountGroupMembershipsPagedResponse

listRelatedAccountGroupMemberships(RelatedAccountGroupName parent)

public final RecaptchaEnterpriseServiceClient.ListRelatedAccountGroupMembershipsPagedResponse listRelatedAccountGroupMemberships(RelatedAccountGroupName parent)

Get the memberships in a group of related accounts.

Sample code:


 try (RecaptchaEnterpriseServiceClient recaptchaEnterpriseServiceClient =
     RecaptchaEnterpriseServiceClient.create()) {
   RelatedAccountGroupName parent =
       RelatedAccountGroupName.of("[PROJECT]", "[RELATEDACCOUNTGROUP]");
   for (RelatedAccountGroupMembership element :
       recaptchaEnterpriseServiceClient
           .listRelatedAccountGroupMemberships(parent)
           .iterateAll()) {
     // doThingsWith(element);
   }
 }
 
Parameter
NameDescription
parentRelatedAccountGroupName

Required. The resource name for the related account group in the format projects/{project}/relatedaccountgroups/{relatedaccountgroup}.

Returns
TypeDescription
RecaptchaEnterpriseServiceClient.ListRelatedAccountGroupMembershipsPagedResponse

listRelatedAccountGroupMemberships(String parent)

public final RecaptchaEnterpriseServiceClient.ListRelatedAccountGroupMembershipsPagedResponse listRelatedAccountGroupMemberships(String parent)

Get the memberships in a group of related accounts.

Sample code:


 try (RecaptchaEnterpriseServiceClient recaptchaEnterpriseServiceClient =
     RecaptchaEnterpriseServiceClient.create()) {
   String parent = RelatedAccountGroupName.of("[PROJECT]", "[RELATEDACCOUNTGROUP]").toString();
   for (RelatedAccountGroupMembership element :
       recaptchaEnterpriseServiceClient
           .listRelatedAccountGroupMemberships(parent)
           .iterateAll()) {
     // doThingsWith(element);
   }
 }
 
Parameter
NameDescription
parentString

Required. The resource name for the related account group in the format projects/{project}/relatedaccountgroups/{relatedaccountgroup}.

Returns
TypeDescription
RecaptchaEnterpriseServiceClient.ListRelatedAccountGroupMembershipsPagedResponse

listRelatedAccountGroupMembershipsCallable()

public final UnaryCallable<ListRelatedAccountGroupMembershipsRequest,ListRelatedAccountGroupMembershipsResponse> listRelatedAccountGroupMembershipsCallable()

Get the memberships in a group of related accounts.

Sample code:


 try (RecaptchaEnterpriseServiceClient recaptchaEnterpriseServiceClient =
     RecaptchaEnterpriseServiceClient.create()) {
   ListRelatedAccountGroupMembershipsRequest request =
       ListRelatedAccountGroupMembershipsRequest.newBuilder()
           .setParent(
               RelatedAccountGroupName.of("[PROJECT]", "[RELATEDACCOUNTGROUP]").toString())
           .setPageSize(883849137)
           .setPageToken("pageToken873572522")
           .build();
   while (true) {
     ListRelatedAccountGroupMembershipsResponse response =
         recaptchaEnterpriseServiceClient
             .listRelatedAccountGroupMembershipsCallable()
             .call(request);
     for (RelatedAccountGroupMembership element : response.getResponsesList()) {
       // doThingsWith(element);
     }
     String nextPageToken = response.getNextPageToken();
     if (!Strings.isNullOrEmpty(nextPageToken)) {
       request = request.toBuilder().setPageToken(nextPageToken).build();
     } else {
       break;
     }
   }
 }
 
Returns
TypeDescription
UnaryCallable<ListRelatedAccountGroupMembershipsRequest,ListRelatedAccountGroupMembershipsResponse>

listRelatedAccountGroupMembershipsPagedCallable()

public final UnaryCallable<ListRelatedAccountGroupMembershipsRequest,RecaptchaEnterpriseServiceClient.ListRelatedAccountGroupMembershipsPagedResponse> listRelatedAccountGroupMembershipsPagedCallable()

Get the memberships in a group of related accounts.

Sample code:


 try (RecaptchaEnterpriseServiceClient recaptchaEnterpriseServiceClient =
     RecaptchaEnterpriseServiceClient.create()) {
   ListRelatedAccountGroupMembershipsRequest request =
       ListRelatedAccountGroupMembershipsRequest.newBuilder()
           .setParent(
               RelatedAccountGroupName.of("[PROJECT]", "[RELATEDACCOUNTGROUP]").toString())
           .setPageSize(883849137)
           .setPageToken("pageToken873572522")
           .build();
   ApiFuture<RelatedAccountGroupMembership> future =
       recaptchaEnterpriseServiceClient
           .listRelatedAccountGroupMembershipsPagedCallable()
           .futureCall(request);
   // Do something.
   for (RelatedAccountGroupMembership element : future.get().iterateAll()) {
     // doThingsWith(element);
   }
 }
 
Returns
TypeDescription
UnaryCallable<ListRelatedAccountGroupMembershipsRequest,ListRelatedAccountGroupMembershipsPagedResponse>

listRelatedAccountGroups(ListRelatedAccountGroupsRequest request)

public final RecaptchaEnterpriseServiceClient.ListRelatedAccountGroupsPagedResponse listRelatedAccountGroups(ListRelatedAccountGroupsRequest request)

List groups of related accounts.

Sample code:


 try (RecaptchaEnterpriseServiceClient recaptchaEnterpriseServiceClient =
     RecaptchaEnterpriseServiceClient.create()) {
   ListRelatedAccountGroupsRequest request =
       ListRelatedAccountGroupsRequest.newBuilder()
           .setParent(ProjectName.of("[PROJECT]").toString())
           .setPageSize(883849137)
           .setPageToken("pageToken873572522")
           .build();
   for (RelatedAccountGroup element :
       recaptchaEnterpriseServiceClient.listRelatedAccountGroups(request).iterateAll()) {
     // doThingsWith(element);
   }
 }
 
Parameter
NameDescription
requestListRelatedAccountGroupsRequest

The request object containing all of the parameters for the API call.

Returns
TypeDescription
RecaptchaEnterpriseServiceClient.ListRelatedAccountGroupsPagedResponse

listRelatedAccountGroups(ProjectName parent)

public final RecaptchaEnterpriseServiceClient.ListRelatedAccountGroupsPagedResponse listRelatedAccountGroups(ProjectName parent)

List groups of related accounts.

Sample code:


 try (RecaptchaEnterpriseServiceClient recaptchaEnterpriseServiceClient =
     RecaptchaEnterpriseServiceClient.create()) {
   ProjectName parent = ProjectName.of("[PROJECT]");
   for (RelatedAccountGroup element :
       recaptchaEnterpriseServiceClient.listRelatedAccountGroups(parent).iterateAll()) {
     // doThingsWith(element);
   }
 }
 
Parameter
NameDescription
parentProjectName

Required. The name of the project to list related account groups from, in the format "projects/{project}".

Returns
TypeDescription
RecaptchaEnterpriseServiceClient.ListRelatedAccountGroupsPagedResponse

listRelatedAccountGroups(String parent)

public final RecaptchaEnterpriseServiceClient.ListRelatedAccountGroupsPagedResponse listRelatedAccountGroups(String parent)

List groups of related accounts.

Sample code:


 try (RecaptchaEnterpriseServiceClient recaptchaEnterpriseServiceClient =
     RecaptchaEnterpriseServiceClient.create()) {
   String parent = ProjectName.of("[PROJECT]").toString();
   for (RelatedAccountGroup element :
       recaptchaEnterpriseServiceClient.listRelatedAccountGroups(parent).iterateAll()) {
     // doThingsWith(element);
   }
 }
 
Parameter
NameDescription
parentString

Required. The name of the project to list related account groups from, in the format "projects/{project}".

Returns
TypeDescription
RecaptchaEnterpriseServiceClient.ListRelatedAccountGroupsPagedResponse

listRelatedAccountGroupsCallable()

public final UnaryCallable<ListRelatedAccountGroupsRequest,ListRelatedAccountGroupsResponse> listRelatedAccountGroupsCallable()

List groups of related accounts.

Sample code:


 try (RecaptchaEnterpriseServiceClient recaptchaEnterpriseServiceClient =
     RecaptchaEnterpriseServiceClient.create()) {
   ListRelatedAccountGroupsRequest request =
       ListRelatedAccountGroupsRequest.newBuilder()
           .setParent(ProjectName.of("[PROJECT]").toString())
           .setPageSize(883849137)
           .setPageToken("pageToken873572522")
           .build();
   while (true) {
     ListRelatedAccountGroupsResponse response =
         recaptchaEnterpriseServiceClient.listRelatedAccountGroupsCallable().call(request);
     for (RelatedAccountGroup element : response.getResponsesList()) {
       // doThingsWith(element);
     }
     String nextPageToken = response.getNextPageToken();
     if (!Strings.isNullOrEmpty(nextPageToken)) {
       request = request.toBuilder().setPageToken(nextPageToken).build();
     } else {
       break;
     }
   }
 }
 
Returns
TypeDescription
UnaryCallable<ListRelatedAccountGroupsRequest,ListRelatedAccountGroupsResponse>

listRelatedAccountGroupsPagedCallable()

public final UnaryCallable<ListRelatedAccountGroupsRequest,RecaptchaEnterpriseServiceClient.ListRelatedAccountGroupsPagedResponse> listRelatedAccountGroupsPagedCallable()

List groups of related accounts.

Sample code:


 try (RecaptchaEnterpriseServiceClient recaptchaEnterpriseServiceClient =
     RecaptchaEnterpriseServiceClient.create()) {
   ListRelatedAccountGroupsRequest request =
       ListRelatedAccountGroupsRequest.newBuilder()
           .setParent(ProjectName.of("[PROJECT]").toString())
           .setPageSize(883849137)
           .setPageToken("pageToken873572522")
           .build();
   ApiFuture<RelatedAccountGroup> future =
       recaptchaEnterpriseServiceClient
           .listRelatedAccountGroupsPagedCallable()
           .futureCall(request);
   // Do something.
   for (RelatedAccountGroup element : future.get().iterateAll()) {
     // doThingsWith(element);
   }
 }
 
Returns
TypeDescription
UnaryCallable<ListRelatedAccountGroupsRequest,ListRelatedAccountGroupsPagedResponse>

migrateKey(MigrateKeyRequest request)

public final Key migrateKey(MigrateKeyRequest request)

Migrates an existing key from reCAPTCHA to reCAPTCHA Enterprise. Once a key is migrated, it can be used from either product. SiteVerify requests are billed as CreateAssessment calls. You must be authenticated as one of the current owners of the reCAPTCHA Site Key, and your user must have the reCAPTCHA Enterprise Admin IAM role in the destination project.

Sample code:


 try (RecaptchaEnterpriseServiceClient recaptchaEnterpriseServiceClient =
     RecaptchaEnterpriseServiceClient.create()) {
   MigrateKeyRequest request =
       MigrateKeyRequest.newBuilder()
           .setName(KeyName.of("[PROJECT]", "[KEY]").toString())
           .build();
   Key response = recaptchaEnterpriseServiceClient.migrateKey(request);
 }
 
Parameter
NameDescription
requestMigrateKeyRequest

The request object containing all of the parameters for the API call.

Returns
TypeDescription
Key

migrateKeyCallable()

public final UnaryCallable<MigrateKeyRequest,Key> migrateKeyCallable()

Migrates an existing key from reCAPTCHA to reCAPTCHA Enterprise. Once a key is migrated, it can be used from either product. SiteVerify requests are billed as CreateAssessment calls. You must be authenticated as one of the current owners of the reCAPTCHA Site Key, and your user must have the reCAPTCHA Enterprise Admin IAM role in the destination project.

Sample code:


 try (RecaptchaEnterpriseServiceClient recaptchaEnterpriseServiceClient =
     RecaptchaEnterpriseServiceClient.create()) {
   MigrateKeyRequest request =
       MigrateKeyRequest.newBuilder()
           .setName(KeyName.of("[PROJECT]", "[KEY]").toString())
           .build();
   ApiFuture<Key> future =
       recaptchaEnterpriseServiceClient.migrateKeyCallable().futureCall(request);
   // Do something.
   Key response = future.get();
 }
 
Returns
TypeDescription
UnaryCallable<MigrateKeyRequest,Key>

searchRelatedAccountGroupMemberships(RelatedAccountGroupName parent, ByteString hashedAccountId)

public final RecaptchaEnterpriseServiceClient.SearchRelatedAccountGroupMembershipsPagedResponse searchRelatedAccountGroupMemberships(RelatedAccountGroupName parent, ByteString hashedAccountId)

Search group memberships related to a given account.

Sample code:


 try (RecaptchaEnterpriseServiceClient recaptchaEnterpriseServiceClient =
     RecaptchaEnterpriseServiceClient.create()) {
   RelatedAccountGroupName parent =
       RelatedAccountGroupName.of("[PROJECT]", "[RELATEDACCOUNTGROUP]");
   ByteString hashedAccountId = ByteString.EMPTY;
   for (RelatedAccountGroupMembership element :
       recaptchaEnterpriseServiceClient
           .searchRelatedAccountGroupMemberships(parent, hashedAccountId)
           .iterateAll()) {
     // doThingsWith(element);
   }
 }
 
Parameters
NameDescription
parentRelatedAccountGroupName

Required. The name of the project to search related account group memberships from, in the format "projects/{project}".

hashedAccountIdByteString

Optional. The unique stable hashed user identifier we should search connections to. The identifier should correspond to a hashed_account_id provided in a previous CreateAssessment or AnnotateAssessment call.

Returns
TypeDescription
RecaptchaEnterpriseServiceClient.SearchRelatedAccountGroupMembershipsPagedResponse

searchRelatedAccountGroupMemberships(SearchRelatedAccountGroupMembershipsRequest request)

public final RecaptchaEnterpriseServiceClient.SearchRelatedAccountGroupMembershipsPagedResponse searchRelatedAccountGroupMemberships(SearchRelatedAccountGroupMembershipsRequest request)

Search group memberships related to a given account.

Sample code:


 try (RecaptchaEnterpriseServiceClient recaptchaEnterpriseServiceClient =
     RecaptchaEnterpriseServiceClient.create()) {
   SearchRelatedAccountGroupMembershipsRequest request =
       SearchRelatedAccountGroupMembershipsRequest.newBuilder()
           .setParent(
               RelatedAccountGroupName.of("[PROJECT]", "[RELATEDACCOUNTGROUP]").toString())
           .setHashedAccountId(ByteString.EMPTY)
           .setPageSize(883849137)
           .setPageToken("pageToken873572522")
           .build();
   for (RelatedAccountGroupMembership element :
       recaptchaEnterpriseServiceClient
           .searchRelatedAccountGroupMemberships(request)
           .iterateAll()) {
     // doThingsWith(element);
   }
 }
 
Parameter
NameDescription
requestSearchRelatedAccountGroupMembershipsRequest

The request object containing all of the parameters for the API call.

Returns
TypeDescription
RecaptchaEnterpriseServiceClient.SearchRelatedAccountGroupMembershipsPagedResponse

searchRelatedAccountGroupMemberships(String parent, ByteString hashedAccountId)

public final RecaptchaEnterpriseServiceClient.SearchRelatedAccountGroupMembershipsPagedResponse searchRelatedAccountGroupMemberships(String parent, ByteString hashedAccountId)

Search group memberships related to a given account.

Sample code:


 try (RecaptchaEnterpriseServiceClient recaptchaEnterpriseServiceClient =
     RecaptchaEnterpriseServiceClient.create()) {
   String parent = RelatedAccountGroupName.of("[PROJECT]", "[RELATEDACCOUNTGROUP]").toString();
   ByteString hashedAccountId = ByteString.EMPTY;
   for (RelatedAccountGroupMembership element :
       recaptchaEnterpriseServiceClient
           .searchRelatedAccountGroupMemberships(parent, hashedAccountId)
           .iterateAll()) {
     // doThingsWith(element);
   }
 }
 
Parameters
NameDescription
parentString

Required. The name of the project to search related account group memberships from, in the format "projects/{project}".

hashedAccountIdByteString

Optional. The unique stable hashed user identifier we should search connections to. The identifier should correspond to a hashed_account_id provided in a previous CreateAssessment or AnnotateAssessment call.

Returns
TypeDescription
RecaptchaEnterpriseServiceClient.SearchRelatedAccountGroupMembershipsPagedResponse

searchRelatedAccountGroupMembershipsCallable()

public final UnaryCallable<SearchRelatedAccountGroupMembershipsRequest,SearchRelatedAccountGroupMembershipsResponse> searchRelatedAccountGroupMembershipsCallable()

Search group memberships related to a given account.

Sample code:


 try (RecaptchaEnterpriseServiceClient recaptchaEnterpriseServiceClient =
     RecaptchaEnterpriseServiceClient.create()) {
   SearchRelatedAccountGroupMembershipsRequest request =
       SearchRelatedAccountGroupMembershipsRequest.newBuilder()
           .setParent(
               RelatedAccountGroupName.of("[PROJECT]", "[RELATEDACCOUNTGROUP]").toString())
           .setHashedAccountId(ByteString.EMPTY)
           .setPageSize(883849137)
           .setPageToken("pageToken873572522")
           .build();
   while (true) {
     SearchRelatedAccountGroupMembershipsResponse response =
         recaptchaEnterpriseServiceClient
             .searchRelatedAccountGroupMembershipsCallable()
             .call(request);
     for (RelatedAccountGroupMembership element : response.getResponsesList()) {
       // doThingsWith(element);
     }
     String nextPageToken = response.getNextPageToken();
     if (!Strings.isNullOrEmpty(nextPageToken)) {
       request = request.toBuilder().setPageToken(nextPageToken).build();
     } else {
       break;
     }
   }
 }
 
Returns
TypeDescription
UnaryCallable<SearchRelatedAccountGroupMembershipsRequest,SearchRelatedAccountGroupMembershipsResponse>

searchRelatedAccountGroupMembershipsPagedCallable()

public final UnaryCallable<SearchRelatedAccountGroupMembershipsRequest,RecaptchaEnterpriseServiceClient.SearchRelatedAccountGroupMembershipsPagedResponse> searchRelatedAccountGroupMembershipsPagedCallable()

Search group memberships related to a given account.

Sample code:


 try (RecaptchaEnterpriseServiceClient recaptchaEnterpriseServiceClient =
     RecaptchaEnterpriseServiceClient.create()) {
   SearchRelatedAccountGroupMembershipsRequest request =
       SearchRelatedAccountGroupMembershipsRequest.newBuilder()
           .setParent(
               RelatedAccountGroupName.of("[PROJECT]", "[RELATEDACCOUNTGROUP]").toString())
           .setHashedAccountId(ByteString.EMPTY)
           .setPageSize(883849137)
           .setPageToken("pageToken873572522")
           .build();
   ApiFuture<RelatedAccountGroupMembership> future =
       recaptchaEnterpriseServiceClient
           .searchRelatedAccountGroupMembershipsPagedCallable()
           .futureCall(request);
   // Do something.
   for (RelatedAccountGroupMembership element : future.get().iterateAll()) {
     // doThingsWith(element);
   }
 }
 
Returns
TypeDescription
UnaryCallable<SearchRelatedAccountGroupMembershipsRequest,SearchRelatedAccountGroupMembershipsPagedResponse>

shutdown()

public void shutdown()

shutdownNow()

public void shutdownNow()

updateKey(UpdateKeyRequest request)

public final Key updateKey(UpdateKeyRequest request)

Updates the specified key.

Sample code:


 try (RecaptchaEnterpriseServiceClient recaptchaEnterpriseServiceClient =
     RecaptchaEnterpriseServiceClient.create()) {
   UpdateKeyRequest request =
       UpdateKeyRequest.newBuilder()
           .setKey(Key.newBuilder().build())
           .setUpdateMask(FieldMask.newBuilder().build())
           .build();
   Key response = recaptchaEnterpriseServiceClient.updateKey(request);
 }
 
Parameter
NameDescription
requestUpdateKeyRequest

The request object containing all of the parameters for the API call.

Returns
TypeDescription
Key

updateKeyCallable()

public final UnaryCallable<UpdateKeyRequest,Key> updateKeyCallable()

Updates the specified key.

Sample code:


 try (RecaptchaEnterpriseServiceClient recaptchaEnterpriseServiceClient =
     RecaptchaEnterpriseServiceClient.create()) {
   UpdateKeyRequest request =
       UpdateKeyRequest.newBuilder()
           .setKey(Key.newBuilder().build())
           .setUpdateMask(FieldMask.newBuilder().build())
           .build();
   ApiFuture<Key> future =
       recaptchaEnterpriseServiceClient.updateKeyCallable().futureCall(request);
   // Do something.
   Key response = future.get();
 }
 
Returns
TypeDescription
UnaryCallable<UpdateKeyRequest,Key>