diff --git a/google-cloud-recaptchaenterprise/src/main/java/com/google/cloud/recaptchaenterprise/v1/RecaptchaEnterpriseServiceClient.java b/google-cloud-recaptchaenterprise/src/main/java/com/google/cloud/recaptchaenterprise/v1/RecaptchaEnterpriseServiceClient.java index 49f90615..d026a4d1 100644 --- a/google-cloud-recaptchaenterprise/src/main/java/com/google/cloud/recaptchaenterprise/v1/RecaptchaEnterpriseServiceClient.java +++ b/google-cloud-recaptchaenterprise/src/main/java/com/google/cloud/recaptchaenterprise/v1/RecaptchaEnterpriseServiceClient.java @@ -55,6 +55,15 @@ *

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
+ * 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(). @@ -163,6 +172,17 @@ public RecaptchaEnterpriseServiceStub getStub() { /** * Creates an Assessment of the likelihood an event is legitimate. * + *

Sample code: + * + *

{@code
+   * try (RecaptchaEnterpriseServiceClient recaptchaEnterpriseServiceClient =
+   *     RecaptchaEnterpriseServiceClient.create()) {
+   *   ProjectName parent = ProjectName.of("[PROJECT]");
+   *   Assessment assessment = Assessment.newBuilder().build();
+   *   Assessment response = recaptchaEnterpriseServiceClient.createAssessment(parent, assessment);
+   * }
+   * }
+ * * @param parent Required. The name of the project in which the assessment will be created, in the * format "projects/{project}". * @param assessment Required. The assessment details. @@ -181,6 +201,17 @@ public final Assessment createAssessment(ProjectName parent, Assessment assessme /** * Creates an Assessment of the likelihood an event is legitimate. * + *

Sample code: + * + *

{@code
+   * try (RecaptchaEnterpriseServiceClient recaptchaEnterpriseServiceClient =
+   *     RecaptchaEnterpriseServiceClient.create()) {
+   *   String parent = ProjectName.of("[PROJECT]").toString();
+   *   Assessment assessment = Assessment.newBuilder().build();
+   *   Assessment response = recaptchaEnterpriseServiceClient.createAssessment(parent, assessment);
+   * }
+   * }
+ * * @param parent Required. The name of the project in which the assessment will be created, in the * format "projects/{project}". * @param assessment Required. The assessment details. @@ -196,6 +227,20 @@ public final Assessment createAssessment(String parent, Assessment assessment) { /** * Creates an Assessment of the likelihood an event is legitimate. * + *

Sample code: + * + *

{@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);
+   * }
+   * }
+ * * @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 */ @@ -208,6 +253,21 @@ public final Assessment createAssessment(CreateAssessmentRequest request) { * Creates an Assessment of the likelihood an event is legitimate. * *

Sample code: + * + *

{@code
+   * try (RecaptchaEnterpriseServiceClient recaptchaEnterpriseServiceClient =
+   *     RecaptchaEnterpriseServiceClient.create()) {
+   *   CreateAssessmentRequest request =
+   *       CreateAssessmentRequest.newBuilder()
+   *           .setParent(ProjectName.of("[PROJECT]").toString())
+   *           .setAssessment(Assessment.newBuilder().build())
+   *           .build();
+   *   ApiFuture future =
+   *       recaptchaEnterpriseServiceClient.createAssessmentCallable().futureCall(request);
+   *   // Do something.
+   *   Assessment response = future.get();
+   * }
+   * }
*/ public final UnaryCallable createAssessmentCallable() { return stub.createAssessmentCallable(); @@ -218,6 +278,19 @@ public final UnaryCallable createAssessment * Annotates a previously created Assessment to provide additional information on whether the * event turned out to be authentic or fradulent. * + *

Sample code: + * + *

{@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);
+   * }
+   * }
+ * * @param name Required. The resource name of the Assessment, in the format * "projects/{project}/assessments/{assessment}". * @param annotation Required. The annotation that will be assigned to the Event. @@ -238,6 +311,19 @@ public final AnnotateAssessmentResponse annotateAssessment( * Annotates a previously created Assessment to provide additional information on whether the * event turned out to be authentic or fradulent. * + *

Sample code: + * + *

{@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);
+   * }
+   * }
+ * * @param name Required. The resource name of the Assessment, in the format * "projects/{project}/assessments/{assessment}". * @param annotation Required. The annotation that will be assigned to the Event. @@ -255,6 +341,20 @@ public final AnnotateAssessmentResponse annotateAssessment( * Annotates a previously created Assessment to provide additional information on whether the * event turned out to be authentic or fradulent. * + *

Sample code: + * + *

{@code
+   * try (RecaptchaEnterpriseServiceClient recaptchaEnterpriseServiceClient =
+   *     RecaptchaEnterpriseServiceClient.create()) {
+   *   AnnotateAssessmentRequest request =
+   *       AnnotateAssessmentRequest.newBuilder()
+   *           .setName(AssessmentName.of("[PROJECT]", "[ASSESSMENT]").toString())
+   *           .build();
+   *   AnnotateAssessmentResponse response =
+   *       recaptchaEnterpriseServiceClient.annotateAssessment(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 */ @@ -268,6 +368,20 @@ public final AnnotateAssessmentResponse annotateAssessment(AnnotateAssessmentReq * event turned out to be authentic or fradulent. * *

Sample code: + * + *

{@code
+   * try (RecaptchaEnterpriseServiceClient recaptchaEnterpriseServiceClient =
+   *     RecaptchaEnterpriseServiceClient.create()) {
+   *   AnnotateAssessmentRequest request =
+   *       AnnotateAssessmentRequest.newBuilder()
+   *           .setName(AssessmentName.of("[PROJECT]", "[ASSESSMENT]").toString())
+   *           .build();
+   *   ApiFuture future =
+   *       recaptchaEnterpriseServiceClient.annotateAssessmentCallable().futureCall(request);
+   *   // Do something.
+   *   AnnotateAssessmentResponse response = future.get();
+   * }
+   * }
*/ public final UnaryCallable annotateAssessmentCallable() { @@ -278,6 +392,20 @@ public final AnnotateAssessmentResponse annotateAssessment(AnnotateAssessmentReq /** * Creates a new reCAPTCHA Enterprise key. * + *

Sample code: + * + *

{@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);
+   * }
+   * }
+ * * @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 */ @@ -290,6 +418,21 @@ public final Key createKey(CreateKeyRequest request) { * Creates a new reCAPTCHA Enterprise key. * *

Sample code: + * + *

{@code
+   * try (RecaptchaEnterpriseServiceClient recaptchaEnterpriseServiceClient =
+   *     RecaptchaEnterpriseServiceClient.create()) {
+   *   CreateKeyRequest request =
+   *       CreateKeyRequest.newBuilder()
+   *           .setParent(ProjectName.of("[PROJECT]").toString())
+   *           .setKey(Key.newBuilder().build())
+   *           .build();
+   *   ApiFuture future =
+   *       recaptchaEnterpriseServiceClient.createKeyCallable().futureCall(request);
+   *   // Do something.
+   *   Key response = future.get();
+   * }
+   * }
*/ public final UnaryCallable createKeyCallable() { return stub.createKeyCallable(); @@ -299,6 +442,23 @@ public final UnaryCallable createKeyCallable() { /** * Returns the list of all keys that belong to a project. * + *

Sample code: + * + *

{@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);
+   *   }
+   * }
+   * }
+ * * @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 */ @@ -311,6 +471,24 @@ public final ListKeysPagedResponse listKeys(ListKeysRequest request) { * Returns the list of all keys that belong to a project. * *

Sample code: + * + *

{@code
+   * try (RecaptchaEnterpriseServiceClient recaptchaEnterpriseServiceClient =
+   *     RecaptchaEnterpriseServiceClient.create()) {
+   *   ListKeysRequest request =
+   *       ListKeysRequest.newBuilder()
+   *           .setParent(ProjectName.of("[PROJECT]").toString())
+   *           .setPageSize(883849137)
+   *           .setPageToken("pageToken873572522")
+   *           .build();
+   *   ApiFuture future =
+   *       recaptchaEnterpriseServiceClient.listKeysPagedCallable().futureCall(request);
+   *   // Do something.
+   *   for (Key element : future.get().iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * }
*/ public final UnaryCallable listKeysPagedCallable() { return stub.listKeysPagedCallable(); @@ -321,6 +499,25 @@ public final UnaryCallable listKeysPaged * Returns the list of all keys that belong to a project. * *

Sample code: + * + *

{@code
+   * try (RecaptchaEnterpriseServiceClient recaptchaEnterpriseServiceClient =
+   *     RecaptchaEnterpriseServiceClient.create()) {
+   *   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;
+   *     }
+   *   }
+   * }
+   * }
*/ public final UnaryCallable listKeysCallable() { return stub.listKeysCallable(); @@ -330,6 +527,17 @@ public final UnaryCallable listKeysCallable() /** * Returns the specified key. * + *

Sample code: + * + *

{@code
+   * try (RecaptchaEnterpriseServiceClient recaptchaEnterpriseServiceClient =
+   *     RecaptchaEnterpriseServiceClient.create()) {
+   *   GetKeyRequest request =
+   *       GetKeyRequest.newBuilder().setName(KeyName.of("[PROJECT]", "[KEY]").toString()).build();
+   *   Key response = recaptchaEnterpriseServiceClient.getKey(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 */ @@ -342,6 +550,17 @@ public final Key getKey(GetKeyRequest request) { * Returns the specified key. * *

Sample code: + * + *

{@code
+   * try (RecaptchaEnterpriseServiceClient recaptchaEnterpriseServiceClient =
+   *     RecaptchaEnterpriseServiceClient.create()) {
+   *   GetKeyRequest request =
+   *       GetKeyRequest.newBuilder().setName(KeyName.of("[PROJECT]", "[KEY]").toString()).build();
+   *   ApiFuture future = recaptchaEnterpriseServiceClient.getKeyCallable().futureCall(request);
+   *   // Do something.
+   *   Key response = future.get();
+   * }
+   * }
*/ public final UnaryCallable getKeyCallable() { return stub.getKeyCallable(); @@ -351,6 +570,20 @@ public final UnaryCallable getKeyCallable() { /** * Updates the specified key. * + *

Sample code: + * + *

{@code
+   * try (RecaptchaEnterpriseServiceClient recaptchaEnterpriseServiceClient =
+   *     RecaptchaEnterpriseServiceClient.create()) {
+   *   UpdateKeyRequest request =
+   *       UpdateKeyRequest.newBuilder()
+   *           .setKey(Key.newBuilder().build())
+   *           .setUpdateMask(FieldMask.newBuilder().build())
+   *           .build();
+   *   Key response = recaptchaEnterpriseServiceClient.updateKey(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 */ @@ -363,6 +596,21 @@ public final Key updateKey(UpdateKeyRequest request) { * Updates the specified key. * *

Sample code: + * + *

{@code
+   * try (RecaptchaEnterpriseServiceClient recaptchaEnterpriseServiceClient =
+   *     RecaptchaEnterpriseServiceClient.create()) {
+   *   UpdateKeyRequest request =
+   *       UpdateKeyRequest.newBuilder()
+   *           .setKey(Key.newBuilder().build())
+   *           .setUpdateMask(FieldMask.newBuilder().build())
+   *           .build();
+   *   ApiFuture future =
+   *       recaptchaEnterpriseServiceClient.updateKeyCallable().futureCall(request);
+   *   // Do something.
+   *   Key response = future.get();
+   * }
+   * }
*/ public final UnaryCallable updateKeyCallable() { return stub.updateKeyCallable(); @@ -372,6 +620,19 @@ public final UnaryCallable updateKeyCallable() { /** * Deletes the specified key. * + *

Sample code: + * + *

{@code
+   * try (RecaptchaEnterpriseServiceClient recaptchaEnterpriseServiceClient =
+   *     RecaptchaEnterpriseServiceClient.create()) {
+   *   DeleteKeyRequest request =
+   *       DeleteKeyRequest.newBuilder()
+   *           .setName(KeyName.of("[PROJECT]", "[KEY]").toString())
+   *           .build();
+   *   recaptchaEnterpriseServiceClient.deleteKey(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 */ @@ -384,6 +645,20 @@ public final void deleteKey(DeleteKeyRequest request) { * Deletes the specified key. * *

Sample code: + * + *

{@code
+   * try (RecaptchaEnterpriseServiceClient recaptchaEnterpriseServiceClient =
+   *     RecaptchaEnterpriseServiceClient.create()) {
+   *   DeleteKeyRequest request =
+   *       DeleteKeyRequest.newBuilder()
+   *           .setName(KeyName.of("[PROJECT]", "[KEY]").toString())
+   *           .build();
+   *   ApiFuture future =
+   *       recaptchaEnterpriseServiceClient.deleteKeyCallable().futureCall(request);
+   *   // Do something.
+   *   future.get();
+   * }
+   * }
*/ public final UnaryCallable deleteKeyCallable() { return stub.deleteKeyCallable(); diff --git a/google-cloud-recaptchaenterprise/src/main/java/com/google/cloud/recaptchaenterprise/v1/package-info.java b/google-cloud-recaptchaenterprise/src/main/java/com/google/cloud/recaptchaenterprise/v1/package-info.java index e30f7f9b..3eb310a2 100644 --- a/google-cloud-recaptchaenterprise/src/main/java/com/google/cloud/recaptchaenterprise/v1/package-info.java +++ b/google-cloud-recaptchaenterprise/src/main/java/com/google/cloud/recaptchaenterprise/v1/package-info.java @@ -22,6 +22,15 @@ *

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

Sample for RecaptchaEnterpriseServiceClient: + * + *

{@code
+ * try (RecaptchaEnterpriseServiceClient recaptchaEnterpriseServiceClient =
+ *     RecaptchaEnterpriseServiceClient.create()) {
+ *   ProjectName parent = ProjectName.of("[PROJECT]");
+ *   Assessment assessment = Assessment.newBuilder().build();
+ *   Assessment response = recaptchaEnterpriseServiceClient.createAssessment(parent, assessment);
+ * }
+ * }
*/ @Generated("by gapic-generator-java") package com.google.cloud.recaptchaenterprise.v1; diff --git a/google-cloud-recaptchaenterprise/src/main/java/com/google/cloud/recaptchaenterprise/v1beta1/RecaptchaEnterpriseServiceV1Beta1Client.java b/google-cloud-recaptchaenterprise/src/main/java/com/google/cloud/recaptchaenterprise/v1beta1/RecaptchaEnterpriseServiceV1Beta1Client.java index 943072a0..dbb89907 100644 --- a/google-cloud-recaptchaenterprise/src/main/java/com/google/cloud/recaptchaenterprise/v1beta1/RecaptchaEnterpriseServiceV1Beta1Client.java +++ b/google-cloud-recaptchaenterprise/src/main/java/com/google/cloud/recaptchaenterprise/v1beta1/RecaptchaEnterpriseServiceV1Beta1Client.java @@ -55,6 +55,16 @@ *

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

Note: close() needs to be called on the RecaptchaEnterpriseServiceV1Beta1Client object to * clean up resources such as threads. In the example above, try-with-resources is used, which * automatically calls close(). @@ -167,6 +177,18 @@ public RecaptchaEnterpriseServiceV1Beta1Stub getStub() { /** * Creates an Assessment of the likelihood an event is legitimate. * + *

Sample code: + * + *

{@code
+   * try (RecaptchaEnterpriseServiceV1Beta1Client recaptchaEnterpriseServiceV1Beta1Client =
+   *     RecaptchaEnterpriseServiceV1Beta1Client.create()) {
+   *   ProjectName parent = ProjectName.of("[PROJECT]");
+   *   Assessment assessment = Assessment.newBuilder().build();
+   *   Assessment response =
+   *       recaptchaEnterpriseServiceV1Beta1Client.createAssessment(parent, assessment);
+   * }
+   * }
+ * * @param parent Required. The name of the project in which the assessment will be created, in the * format "projects/{project_number}". * @param assessment Required. The assessment details. @@ -185,6 +207,18 @@ public final Assessment createAssessment(ProjectName parent, Assessment assessme /** * Creates an Assessment of the likelihood an event is legitimate. * + *

Sample code: + * + *

{@code
+   * try (RecaptchaEnterpriseServiceV1Beta1Client recaptchaEnterpriseServiceV1Beta1Client =
+   *     RecaptchaEnterpriseServiceV1Beta1Client.create()) {
+   *   String parent = ProjectName.of("[PROJECT]").toString();
+   *   Assessment assessment = Assessment.newBuilder().build();
+   *   Assessment response =
+   *       recaptchaEnterpriseServiceV1Beta1Client.createAssessment(parent, assessment);
+   * }
+   * }
+ * * @param parent Required. The name of the project in which the assessment will be created, in the * format "projects/{project_number}". * @param assessment Required. The assessment details. @@ -200,6 +234,20 @@ public final Assessment createAssessment(String parent, Assessment assessment) { /** * Creates an Assessment of the likelihood an event is legitimate. * + *

Sample code: + * + *

{@code
+   * try (RecaptchaEnterpriseServiceV1Beta1Client recaptchaEnterpriseServiceV1Beta1Client =
+   *     RecaptchaEnterpriseServiceV1Beta1Client.create()) {
+   *   CreateAssessmentRequest request =
+   *       CreateAssessmentRequest.newBuilder()
+   *           .setParent(ProjectName.of("[PROJECT]").toString())
+   *           .setAssessment(Assessment.newBuilder().build())
+   *           .build();
+   *   Assessment response = recaptchaEnterpriseServiceV1Beta1Client.createAssessment(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 */ @@ -212,6 +260,21 @@ public final Assessment createAssessment(CreateAssessmentRequest request) { * Creates an Assessment of the likelihood an event is legitimate. * *

Sample code: + * + *

{@code
+   * try (RecaptchaEnterpriseServiceV1Beta1Client recaptchaEnterpriseServiceV1Beta1Client =
+   *     RecaptchaEnterpriseServiceV1Beta1Client.create()) {
+   *   CreateAssessmentRequest request =
+   *       CreateAssessmentRequest.newBuilder()
+   *           .setParent(ProjectName.of("[PROJECT]").toString())
+   *           .setAssessment(Assessment.newBuilder().build())
+   *           .build();
+   *   ApiFuture future =
+   *       recaptchaEnterpriseServiceV1Beta1Client.createAssessmentCallable().futureCall(request);
+   *   // Do something.
+   *   Assessment response = future.get();
+   * }
+   * }
*/ public final UnaryCallable createAssessmentCallable() { return stub.createAssessmentCallable(); @@ -222,6 +285,19 @@ public final UnaryCallable createAssessment * Annotates a previously created Assessment to provide additional information on whether the * event turned out to be authentic or fradulent. * + *

Sample code: + * + *

{@code
+   * try (RecaptchaEnterpriseServiceV1Beta1Client recaptchaEnterpriseServiceV1Beta1Client =
+   *     RecaptchaEnterpriseServiceV1Beta1Client.create()) {
+   *   AssessmentName name = AssessmentName.of("[PROJECT]", "[ASSESSMENT]");
+   *   AnnotateAssessmentRequest.Annotation annotation =
+   *       AnnotateAssessmentRequest.Annotation.forNumber(0);
+   *   AnnotateAssessmentResponse response =
+   *       recaptchaEnterpriseServiceV1Beta1Client.annotateAssessment(name, annotation);
+   * }
+   * }
+ * * @param name Required. The resource name of the Assessment, in the format * "projects/{project_number}/assessments/{assessment_id}". * @param annotation Required. The annotation that will be assigned to the Event. @@ -242,6 +318,19 @@ public final AnnotateAssessmentResponse annotateAssessment( * Annotates a previously created Assessment to provide additional information on whether the * event turned out to be authentic or fradulent. * + *

Sample code: + * + *

{@code
+   * try (RecaptchaEnterpriseServiceV1Beta1Client recaptchaEnterpriseServiceV1Beta1Client =
+   *     RecaptchaEnterpriseServiceV1Beta1Client.create()) {
+   *   String name = AssessmentName.of("[PROJECT]", "[ASSESSMENT]").toString();
+   *   AnnotateAssessmentRequest.Annotation annotation =
+   *       AnnotateAssessmentRequest.Annotation.forNumber(0);
+   *   AnnotateAssessmentResponse response =
+   *       recaptchaEnterpriseServiceV1Beta1Client.annotateAssessment(name, annotation);
+   * }
+   * }
+ * * @param name Required. The resource name of the Assessment, in the format * "projects/{project_number}/assessments/{assessment_id}". * @param annotation Required. The annotation that will be assigned to the Event. @@ -259,6 +348,20 @@ public final AnnotateAssessmentResponse annotateAssessment( * Annotates a previously created Assessment to provide additional information on whether the * event turned out to be authentic or fradulent. * + *

Sample code: + * + *

{@code
+   * try (RecaptchaEnterpriseServiceV1Beta1Client recaptchaEnterpriseServiceV1Beta1Client =
+   *     RecaptchaEnterpriseServiceV1Beta1Client.create()) {
+   *   AnnotateAssessmentRequest request =
+   *       AnnotateAssessmentRequest.newBuilder()
+   *           .setName(AssessmentName.of("[PROJECT]", "[ASSESSMENT]").toString())
+   *           .build();
+   *   AnnotateAssessmentResponse response =
+   *       recaptchaEnterpriseServiceV1Beta1Client.annotateAssessment(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 */ @@ -272,6 +375,20 @@ public final AnnotateAssessmentResponse annotateAssessment(AnnotateAssessmentReq * event turned out to be authentic or fradulent. * *

Sample code: + * + *

{@code
+   * try (RecaptchaEnterpriseServiceV1Beta1Client recaptchaEnterpriseServiceV1Beta1Client =
+   *     RecaptchaEnterpriseServiceV1Beta1Client.create()) {
+   *   AnnotateAssessmentRequest request =
+   *       AnnotateAssessmentRequest.newBuilder()
+   *           .setName(AssessmentName.of("[PROJECT]", "[ASSESSMENT]").toString())
+   *           .build();
+   *   ApiFuture future =
+   *       recaptchaEnterpriseServiceV1Beta1Client.annotateAssessmentCallable().futureCall(request);
+   *   // Do something.
+   *   AnnotateAssessmentResponse response = future.get();
+   * }
+   * }
*/ public final UnaryCallable annotateAssessmentCallable() { @@ -282,6 +399,20 @@ public final AnnotateAssessmentResponse annotateAssessment(AnnotateAssessmentReq /** * Creates a new reCAPTCHA Enterprise key. * + *

Sample code: + * + *

{@code
+   * try (RecaptchaEnterpriseServiceV1Beta1Client recaptchaEnterpriseServiceV1Beta1Client =
+   *     RecaptchaEnterpriseServiceV1Beta1Client.create()) {
+   *   CreateKeyRequest request =
+   *       CreateKeyRequest.newBuilder()
+   *           .setParent(ProjectName.of("[PROJECT]").toString())
+   *           .setKey(Key.newBuilder().build())
+   *           .build();
+   *   Key response = recaptchaEnterpriseServiceV1Beta1Client.createKey(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 */ @@ -294,6 +425,21 @@ public final Key createKey(CreateKeyRequest request) { * Creates a new reCAPTCHA Enterprise key. * *

Sample code: + * + *

{@code
+   * try (RecaptchaEnterpriseServiceV1Beta1Client recaptchaEnterpriseServiceV1Beta1Client =
+   *     RecaptchaEnterpriseServiceV1Beta1Client.create()) {
+   *   CreateKeyRequest request =
+   *       CreateKeyRequest.newBuilder()
+   *           .setParent(ProjectName.of("[PROJECT]").toString())
+   *           .setKey(Key.newBuilder().build())
+   *           .build();
+   *   ApiFuture future =
+   *       recaptchaEnterpriseServiceV1Beta1Client.createKeyCallable().futureCall(request);
+   *   // Do something.
+   *   Key response = future.get();
+   * }
+   * }
*/ public final UnaryCallable createKeyCallable() { return stub.createKeyCallable(); @@ -303,6 +449,23 @@ public final UnaryCallable createKeyCallable() { /** * Returns the list of all keys that belong to a project. * + *

Sample code: + * + *

{@code
+   * try (RecaptchaEnterpriseServiceV1Beta1Client recaptchaEnterpriseServiceV1Beta1Client =
+   *     RecaptchaEnterpriseServiceV1Beta1Client.create()) {
+   *   ListKeysRequest request =
+   *       ListKeysRequest.newBuilder()
+   *           .setParent(ProjectName.of("[PROJECT]").toString())
+   *           .setPageSize(883849137)
+   *           .setPageToken("pageToken873572522")
+   *           .build();
+   *   for (Key element : recaptchaEnterpriseServiceV1Beta1Client.listKeys(request).iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * }
+ * * @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 */ @@ -315,6 +478,24 @@ public final ListKeysPagedResponse listKeys(ListKeysRequest request) { * Returns the list of all keys that belong to a project. * *

Sample code: + * + *

{@code
+   * try (RecaptchaEnterpriseServiceV1Beta1Client recaptchaEnterpriseServiceV1Beta1Client =
+   *     RecaptchaEnterpriseServiceV1Beta1Client.create()) {
+   *   ListKeysRequest request =
+   *       ListKeysRequest.newBuilder()
+   *           .setParent(ProjectName.of("[PROJECT]").toString())
+   *           .setPageSize(883849137)
+   *           .setPageToken("pageToken873572522")
+   *           .build();
+   *   ApiFuture future =
+   *       recaptchaEnterpriseServiceV1Beta1Client.listKeysPagedCallable().futureCall(request);
+   *   // Do something.
+   *   for (Key element : future.get().iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * }
*/ public final UnaryCallable listKeysPagedCallable() { return stub.listKeysPagedCallable(); @@ -325,6 +506,25 @@ public final UnaryCallable listKeysPaged * Returns the list of all keys that belong to a project. * *

Sample code: + * + *

{@code
+   * try (RecaptchaEnterpriseServiceV1Beta1Client recaptchaEnterpriseServiceV1Beta1Client =
+   *     RecaptchaEnterpriseServiceV1Beta1Client.create()) {
+   *   while (true) {
+   *     ListKeysResponse response =
+   *         recaptchaEnterpriseServiceV1Beta1Client.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;
+   *     }
+   *   }
+   * }
+   * }
*/ public final UnaryCallable listKeysCallable() { return stub.listKeysCallable(); @@ -334,6 +534,17 @@ public final UnaryCallable listKeysCallable() /** * Returns the specified key. * + *

Sample code: + * + *

{@code
+   * try (RecaptchaEnterpriseServiceV1Beta1Client recaptchaEnterpriseServiceV1Beta1Client =
+   *     RecaptchaEnterpriseServiceV1Beta1Client.create()) {
+   *   GetKeyRequest request =
+   *       GetKeyRequest.newBuilder().setName(KeyName.of("[PROJECT]", "[KEY]").toString()).build();
+   *   Key response = recaptchaEnterpriseServiceV1Beta1Client.getKey(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 */ @@ -346,6 +557,18 @@ public final Key getKey(GetKeyRequest request) { * Returns the specified key. * *

Sample code: + * + *

{@code
+   * try (RecaptchaEnterpriseServiceV1Beta1Client recaptchaEnterpriseServiceV1Beta1Client =
+   *     RecaptchaEnterpriseServiceV1Beta1Client.create()) {
+   *   GetKeyRequest request =
+   *       GetKeyRequest.newBuilder().setName(KeyName.of("[PROJECT]", "[KEY]").toString()).build();
+   *   ApiFuture future =
+   *       recaptchaEnterpriseServiceV1Beta1Client.getKeyCallable().futureCall(request);
+   *   // Do something.
+   *   Key response = future.get();
+   * }
+   * }
*/ public final UnaryCallable getKeyCallable() { return stub.getKeyCallable(); @@ -355,6 +578,20 @@ public final UnaryCallable getKeyCallable() { /** * Updates the specified key. * + *

Sample code: + * + *

{@code
+   * try (RecaptchaEnterpriseServiceV1Beta1Client recaptchaEnterpriseServiceV1Beta1Client =
+   *     RecaptchaEnterpriseServiceV1Beta1Client.create()) {
+   *   UpdateKeyRequest request =
+   *       UpdateKeyRequest.newBuilder()
+   *           .setKey(Key.newBuilder().build())
+   *           .setUpdateMask(FieldMask.newBuilder().build())
+   *           .build();
+   *   Key response = recaptchaEnterpriseServiceV1Beta1Client.updateKey(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 */ @@ -367,6 +604,21 @@ public final Key updateKey(UpdateKeyRequest request) { * Updates the specified key. * *

Sample code: + * + *

{@code
+   * try (RecaptchaEnterpriseServiceV1Beta1Client recaptchaEnterpriseServiceV1Beta1Client =
+   *     RecaptchaEnterpriseServiceV1Beta1Client.create()) {
+   *   UpdateKeyRequest request =
+   *       UpdateKeyRequest.newBuilder()
+   *           .setKey(Key.newBuilder().build())
+   *           .setUpdateMask(FieldMask.newBuilder().build())
+   *           .build();
+   *   ApiFuture future =
+   *       recaptchaEnterpriseServiceV1Beta1Client.updateKeyCallable().futureCall(request);
+   *   // Do something.
+   *   Key response = future.get();
+   * }
+   * }
*/ public final UnaryCallable updateKeyCallable() { return stub.updateKeyCallable(); @@ -376,6 +628,19 @@ public final UnaryCallable updateKeyCallable() { /** * Deletes the specified key. * + *

Sample code: + * + *

{@code
+   * try (RecaptchaEnterpriseServiceV1Beta1Client recaptchaEnterpriseServiceV1Beta1Client =
+   *     RecaptchaEnterpriseServiceV1Beta1Client.create()) {
+   *   DeleteKeyRequest request =
+   *       DeleteKeyRequest.newBuilder()
+   *           .setName(KeyName.of("[PROJECT]", "[KEY]").toString())
+   *           .build();
+   *   recaptchaEnterpriseServiceV1Beta1Client.deleteKey(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 */ @@ -388,6 +653,20 @@ public final void deleteKey(DeleteKeyRequest request) { * Deletes the specified key. * *

Sample code: + * + *

{@code
+   * try (RecaptchaEnterpriseServiceV1Beta1Client recaptchaEnterpriseServiceV1Beta1Client =
+   *     RecaptchaEnterpriseServiceV1Beta1Client.create()) {
+   *   DeleteKeyRequest request =
+   *       DeleteKeyRequest.newBuilder()
+   *           .setName(KeyName.of("[PROJECT]", "[KEY]").toString())
+   *           .build();
+   *   ApiFuture future =
+   *       recaptchaEnterpriseServiceV1Beta1Client.deleteKeyCallable().futureCall(request);
+   *   // Do something.
+   *   future.get();
+   * }
+   * }
*/ public final UnaryCallable deleteKeyCallable() { return stub.deleteKeyCallable(); diff --git a/google-cloud-recaptchaenterprise/src/main/java/com/google/cloud/recaptchaenterprise/v1beta1/package-info.java b/google-cloud-recaptchaenterprise/src/main/java/com/google/cloud/recaptchaenterprise/v1beta1/package-info.java index 70c4c290..09a455a9 100644 --- a/google-cloud-recaptchaenterprise/src/main/java/com/google/cloud/recaptchaenterprise/v1beta1/package-info.java +++ b/google-cloud-recaptchaenterprise/src/main/java/com/google/cloud/recaptchaenterprise/v1beta1/package-info.java @@ -22,6 +22,16 @@ *

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

Sample for RecaptchaEnterpriseServiceV1Beta1Client: + * + *

{@code
+ * try (RecaptchaEnterpriseServiceV1Beta1Client recaptchaEnterpriseServiceV1Beta1Client =
+ *     RecaptchaEnterpriseServiceV1Beta1Client.create()) {
+ *   ProjectName parent = ProjectName.of("[PROJECT]");
+ *   Assessment assessment = Assessment.newBuilder().build();
+ *   Assessment response =
+ *       recaptchaEnterpriseServiceV1Beta1Client.createAssessment(parent, assessment);
+ * }
+ * }
*/ @Generated("by gapic-generator-java") package com.google.cloud.recaptchaenterprise.v1beta1; diff --git a/synth.metadata b/synth.metadata index bde6757d..3fce059d 100644 --- a/synth.metadata +++ b/synth.metadata @@ -4,23 +4,23 @@ "git": { "name": ".", "remote": "https://github.com/googleapis/java-recaptchaenterprise.git", - "sha": "08d7f487f345870147456dad5d3fac31275c3b81" + "sha": "55fdcd83fd8da31ab7483b2e6ebab487c66a04ee" } }, { "git": { "name": "googleapis", "remote": "https://github.com/googleapis/googleapis.git", - "sha": "91e206bcfeaf8948ea03fe3cb1b7616108496cd3", - "internalRef": "350949863" + "sha": "8d8c008e56f1af31d57f75561e0f1848ffb29eeb", + "internalRef": "356341083" } }, { "git": { "name": "googleapis", "remote": "https://github.com/googleapis/googleapis.git", - "sha": "91e206bcfeaf8948ea03fe3cb1b7616108496cd3", - "internalRef": "350949863" + "sha": "8d8c008e56f1af31d57f75561e0f1848ffb29eeb", + "internalRef": "356341083" } }, {