diff --git a/google-cloud-dialogflow/pom.xml b/google-cloud-dialogflow/pom.xml index 840260c08..bac890cbf 100644 --- a/google-cloud-dialogflow/pom.xml +++ b/google-cloud-dialogflow/pom.xml @@ -41,7 +41,10 @@ com.google.api.grpc proto-google-common-protos - + + com.google.api.grpc + grpc-google-common-protos + com.google.api.grpc proto-google-cloud-dialogflow-v2 diff --git a/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2/AgentsClient.java b/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2/AgentsClient.java index e2f07620a..a28606cfe 100644 --- a/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2/AgentsClient.java +++ b/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2/AgentsClient.java @@ -30,6 +30,10 @@ import com.google.api.gax.rpc.UnaryCallable; import com.google.cloud.dialogflow.v2.stub.AgentsStub; import com.google.cloud.dialogflow.v2.stub.AgentsStubSettings; +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.ListLocationsResponse; +import com.google.cloud.location.Location; import com.google.common.util.concurrent.MoreExecutors; import com.google.longrunning.Operation; import com.google.protobuf.Empty; @@ -1469,6 +1473,145 @@ public final ValidationResult getValidationResult(GetValidationResultRequest req return stub.getValidationResultCallable(); } + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Lists information about the supported locations for this service. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
+   * try (AgentsClient agentsClient = AgentsClient.create()) {
+   *   ListLocationsRequest request =
+   *       ListLocationsRequest.newBuilder()
+   *           .setName("name3373707")
+   *           .setFilter("filter-1274492040")
+   *           .setPageSize(883849137)
+   *           .setPageToken("pageToken873572522")
+   *           .build();
+   *   for (Location element : agentsClient.listLocations(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 + */ + public final ListLocationsPagedResponse listLocations(ListLocationsRequest request) { + return listLocationsPagedCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Lists information about the supported locations for this service. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
+   * try (AgentsClient agentsClient = AgentsClient.create()) {
+   *   ListLocationsRequest request =
+   *       ListLocationsRequest.newBuilder()
+   *           .setName("name3373707")
+   *           .setFilter("filter-1274492040")
+   *           .setPageSize(883849137)
+   *           .setPageToken("pageToken873572522")
+   *           .build();
+   *   ApiFuture future = agentsClient.listLocationsPagedCallable().futureCall(request);
+   *   // Do something.
+   *   for (Location element : future.get().iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * }
+ */ + public final UnaryCallable + listLocationsPagedCallable() { + return stub.listLocationsPagedCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Lists information about the supported locations for this service. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
+   * try (AgentsClient agentsClient = AgentsClient.create()) {
+   *   ListLocationsRequest request =
+   *       ListLocationsRequest.newBuilder()
+   *           .setName("name3373707")
+   *           .setFilter("filter-1274492040")
+   *           .setPageSize(883849137)
+   *           .setPageToken("pageToken873572522")
+   *           .build();
+   *   while (true) {
+   *     ListLocationsResponse response = agentsClient.listLocationsCallable().call(request);
+   *     for (Location element : response.getLocationsList()) {
+   *       // doThingsWith(element);
+   *     }
+   *     String nextPageToken = response.getNextPageToken();
+   *     if (!Strings.isNullOrEmpty(nextPageToken)) {
+   *       request = request.toBuilder().setPageToken(nextPageToken).build();
+   *     } else {
+   *       break;
+   *     }
+   *   }
+   * }
+   * }
+ */ + public final UnaryCallable listLocationsCallable() { + return stub.listLocationsCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Gets information about a location. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
+   * try (AgentsClient agentsClient = AgentsClient.create()) {
+   *   GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build();
+   *   Location response = agentsClient.getLocation(request);
+   * }
+   * }
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final Location getLocation(GetLocationRequest request) { + return getLocationCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Gets information about a location. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
+   * try (AgentsClient agentsClient = AgentsClient.create()) {
+   *   GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build();
+   *   ApiFuture future = agentsClient.getLocationCallable().futureCall(request);
+   *   // Do something.
+   *   Location response = future.get();
+   * }
+   * }
+ */ + public final UnaryCallable getLocationCallable() { + return stub.getLocationCallable(); + } + @Override public final void close() { stub.close(); @@ -1573,4 +1716,80 @@ protected SearchAgentsFixedSizeCollection createCollection( return new SearchAgentsFixedSizeCollection(pages, collectionSize); } } + + public static class ListLocationsPagedResponse + extends AbstractPagedListResponse< + ListLocationsRequest, + ListLocationsResponse, + Location, + ListLocationsPage, + ListLocationsFixedSizeCollection> { + + public static ApiFuture createAsync( + PageContext context, + ApiFuture futureResponse) { + ApiFuture futurePage = + ListLocationsPage.createEmptyPage().createPageAsync(context, futureResponse); + return ApiFutures.transform( + futurePage, + input -> new ListLocationsPagedResponse(input), + MoreExecutors.directExecutor()); + } + + private ListLocationsPagedResponse(ListLocationsPage page) { + super(page, ListLocationsFixedSizeCollection.createEmptyCollection()); + } + } + + public static class ListLocationsPage + extends AbstractPage< + ListLocationsRequest, ListLocationsResponse, Location, ListLocationsPage> { + + private ListLocationsPage( + PageContext context, + ListLocationsResponse response) { + super(context, response); + } + + private static ListLocationsPage createEmptyPage() { + return new ListLocationsPage(null, null); + } + + @Override + protected ListLocationsPage createPage( + PageContext context, + ListLocationsResponse response) { + return new ListLocationsPage(context, response); + } + + @Override + public ApiFuture createPageAsync( + PageContext context, + ApiFuture futureResponse) { + return super.createPageAsync(context, futureResponse); + } + } + + public static class ListLocationsFixedSizeCollection + extends AbstractFixedSizeCollection< + ListLocationsRequest, + ListLocationsResponse, + Location, + ListLocationsPage, + ListLocationsFixedSizeCollection> { + + private ListLocationsFixedSizeCollection(List pages, int collectionSize) { + super(pages, collectionSize); + } + + private static ListLocationsFixedSizeCollection createEmptyCollection() { + return new ListLocationsFixedSizeCollection(null, 0); + } + + @Override + protected ListLocationsFixedSizeCollection createCollection( + List pages, int collectionSize) { + return new ListLocationsFixedSizeCollection(pages, collectionSize); + } + } } diff --git a/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2/AgentsSettings.java b/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2/AgentsSettings.java index 22fa2a6fa..5ecc9fb41 100644 --- a/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2/AgentsSettings.java +++ b/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2/AgentsSettings.java @@ -16,6 +16,7 @@ package com.google.cloud.dialogflow.v2; +import static com.google.cloud.dialogflow.v2.AgentsClient.ListLocationsPagedResponse; import static com.google.cloud.dialogflow.v2.AgentsClient.SearchAgentsPagedResponse; import com.google.api.core.ApiFunction; @@ -32,6 +33,10 @@ import com.google.api.gax.rpc.TransportChannelProvider; import com.google.api.gax.rpc.UnaryCallSettings; import com.google.cloud.dialogflow.v2.stub.AgentsStubSettings; +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.ListLocationsResponse; +import com.google.cloud.location.Location; import com.google.longrunning.Operation; import com.google.protobuf.Empty; import com.google.protobuf.Struct; @@ -143,6 +148,17 @@ public OperationCallSettings restoreAgentOpe return ((AgentsStubSettings) getStubSettings()).getValidationResultSettings(); } + /** Returns the object with the settings used for calls to listLocations. */ + public PagedCallSettings + listLocationsSettings() { + return ((AgentsStubSettings) getStubSettings()).listLocationsSettings(); + } + + /** Returns the object with the settings used for calls to getLocation. */ + public UnaryCallSettings getLocationSettings() { + return ((AgentsStubSettings) getStubSettings()).getLocationSettings(); + } + public static final AgentsSettings create(AgentsStubSettings stub) throws IOException { return new AgentsSettings.Builder(stub.toBuilder()).build(); } @@ -329,6 +345,18 @@ public UnaryCallSettings.Builder restoreAgentSet return getStubSettingsBuilder().getValidationResultSettings(); } + /** Returns the builder for the settings used for calls to listLocations. */ + public PagedCallSettings.Builder< + ListLocationsRequest, ListLocationsResponse, ListLocationsPagedResponse> + listLocationsSettings() { + return getStubSettingsBuilder().listLocationsSettings(); + } + + /** Returns the builder for the settings used for calls to getLocation. */ + public UnaryCallSettings.Builder getLocationSettings() { + return getStubSettingsBuilder().getLocationSettings(); + } + @Override public AgentsSettings build() throws IOException { return new AgentsSettings(this); diff --git a/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2/AnswerRecordsClient.java b/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2/AnswerRecordsClient.java index e0babd8af..44d0fc533 100644 --- a/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2/AnswerRecordsClient.java +++ b/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2/AnswerRecordsClient.java @@ -26,6 +26,10 @@ import com.google.api.gax.rpc.UnaryCallable; import com.google.cloud.dialogflow.v2.stub.AnswerRecordsStub; import com.google.cloud.dialogflow.v2.stub.AnswerRecordsStubSettings; +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.ListLocationsResponse; +import com.google.cloud.location.Location; import com.google.common.util.concurrent.MoreExecutors; import com.google.protobuf.FieldMask; import java.io.IOException; @@ -430,6 +434,146 @@ public final UnaryCallable updateAnswer return stub.updateAnswerRecordCallable(); } + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Lists information about the supported locations for this service. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
+   * try (AnswerRecordsClient answerRecordsClient = AnswerRecordsClient.create()) {
+   *   ListLocationsRequest request =
+   *       ListLocationsRequest.newBuilder()
+   *           .setName("name3373707")
+   *           .setFilter("filter-1274492040")
+   *           .setPageSize(883849137)
+   *           .setPageToken("pageToken873572522")
+   *           .build();
+   *   for (Location element : answerRecordsClient.listLocations(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 + */ + public final ListLocationsPagedResponse listLocations(ListLocationsRequest request) { + return listLocationsPagedCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Lists information about the supported locations for this service. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
+   * try (AnswerRecordsClient answerRecordsClient = AnswerRecordsClient.create()) {
+   *   ListLocationsRequest request =
+   *       ListLocationsRequest.newBuilder()
+   *           .setName("name3373707")
+   *           .setFilter("filter-1274492040")
+   *           .setPageSize(883849137)
+   *           .setPageToken("pageToken873572522")
+   *           .build();
+   *   ApiFuture future =
+   *       answerRecordsClient.listLocationsPagedCallable().futureCall(request);
+   *   // Do something.
+   *   for (Location element : future.get().iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * }
+ */ + public final UnaryCallable + listLocationsPagedCallable() { + return stub.listLocationsPagedCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Lists information about the supported locations for this service. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
+   * try (AnswerRecordsClient answerRecordsClient = AnswerRecordsClient.create()) {
+   *   ListLocationsRequest request =
+   *       ListLocationsRequest.newBuilder()
+   *           .setName("name3373707")
+   *           .setFilter("filter-1274492040")
+   *           .setPageSize(883849137)
+   *           .setPageToken("pageToken873572522")
+   *           .build();
+   *   while (true) {
+   *     ListLocationsResponse response = answerRecordsClient.listLocationsCallable().call(request);
+   *     for (Location element : response.getLocationsList()) {
+   *       // doThingsWith(element);
+   *     }
+   *     String nextPageToken = response.getNextPageToken();
+   *     if (!Strings.isNullOrEmpty(nextPageToken)) {
+   *       request = request.toBuilder().setPageToken(nextPageToken).build();
+   *     } else {
+   *       break;
+   *     }
+   *   }
+   * }
+   * }
+ */ + public final UnaryCallable listLocationsCallable() { + return stub.listLocationsCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Gets information about a location. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
+   * try (AnswerRecordsClient answerRecordsClient = AnswerRecordsClient.create()) {
+   *   GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build();
+   *   Location response = answerRecordsClient.getLocation(request);
+   * }
+   * }
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final Location getLocation(GetLocationRequest request) { + return getLocationCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Gets information about a location. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
+   * try (AnswerRecordsClient answerRecordsClient = AnswerRecordsClient.create()) {
+   *   GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build();
+   *   ApiFuture future = answerRecordsClient.getLocationCallable().futureCall(request);
+   *   // Do something.
+   *   Location response = future.get();
+   * }
+   * }
+ */ + public final UnaryCallable getLocationCallable() { + return stub.getLocationCallable(); + } + @Override public final void close() { stub.close(); @@ -539,4 +683,80 @@ protected ListAnswerRecordsFixedSizeCollection createCollection( return new ListAnswerRecordsFixedSizeCollection(pages, collectionSize); } } + + public static class ListLocationsPagedResponse + extends AbstractPagedListResponse< + ListLocationsRequest, + ListLocationsResponse, + Location, + ListLocationsPage, + ListLocationsFixedSizeCollection> { + + public static ApiFuture createAsync( + PageContext context, + ApiFuture futureResponse) { + ApiFuture futurePage = + ListLocationsPage.createEmptyPage().createPageAsync(context, futureResponse); + return ApiFutures.transform( + futurePage, + input -> new ListLocationsPagedResponse(input), + MoreExecutors.directExecutor()); + } + + private ListLocationsPagedResponse(ListLocationsPage page) { + super(page, ListLocationsFixedSizeCollection.createEmptyCollection()); + } + } + + public static class ListLocationsPage + extends AbstractPage< + ListLocationsRequest, ListLocationsResponse, Location, ListLocationsPage> { + + private ListLocationsPage( + PageContext context, + ListLocationsResponse response) { + super(context, response); + } + + private static ListLocationsPage createEmptyPage() { + return new ListLocationsPage(null, null); + } + + @Override + protected ListLocationsPage createPage( + PageContext context, + ListLocationsResponse response) { + return new ListLocationsPage(context, response); + } + + @Override + public ApiFuture createPageAsync( + PageContext context, + ApiFuture futureResponse) { + return super.createPageAsync(context, futureResponse); + } + } + + public static class ListLocationsFixedSizeCollection + extends AbstractFixedSizeCollection< + ListLocationsRequest, + ListLocationsResponse, + Location, + ListLocationsPage, + ListLocationsFixedSizeCollection> { + + private ListLocationsFixedSizeCollection(List pages, int collectionSize) { + super(pages, collectionSize); + } + + private static ListLocationsFixedSizeCollection createEmptyCollection() { + return new ListLocationsFixedSizeCollection(null, 0); + } + + @Override + protected ListLocationsFixedSizeCollection createCollection( + List pages, int collectionSize) { + return new ListLocationsFixedSizeCollection(pages, collectionSize); + } + } } diff --git a/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2/AnswerRecordsSettings.java b/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2/AnswerRecordsSettings.java index 76beaa54c..016cca3f3 100644 --- a/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2/AnswerRecordsSettings.java +++ b/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2/AnswerRecordsSettings.java @@ -17,6 +17,7 @@ package com.google.cloud.dialogflow.v2; import static com.google.cloud.dialogflow.v2.AnswerRecordsClient.ListAnswerRecordsPagedResponse; +import static com.google.cloud.dialogflow.v2.AnswerRecordsClient.ListLocationsPagedResponse; import com.google.api.core.ApiFunction; import com.google.api.core.BetaApi; @@ -31,6 +32,10 @@ import com.google.api.gax.rpc.TransportChannelProvider; import com.google.api.gax.rpc.UnaryCallSettings; import com.google.cloud.dialogflow.v2.stub.AnswerRecordsStubSettings; +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.ListLocationsResponse; +import com.google.cloud.location.Location; import java.io.IOException; import java.util.List; import javax.annotation.Generated; @@ -83,6 +88,17 @@ public UnaryCallSettings updateAnswerRe return ((AnswerRecordsStubSettings) getStubSettings()).updateAnswerRecordSettings(); } + /** Returns the object with the settings used for calls to listLocations. */ + public PagedCallSettings + listLocationsSettings() { + return ((AnswerRecordsStubSettings) getStubSettings()).listLocationsSettings(); + } + + /** Returns the object with the settings used for calls to getLocation. */ + public UnaryCallSettings getLocationSettings() { + return ((AnswerRecordsStubSettings) getStubSettings()).getLocationSettings(); + } + public static final AnswerRecordsSettings create(AnswerRecordsStubSettings stub) throws IOException { return new AnswerRecordsSettings.Builder(stub.toBuilder()).build(); @@ -211,6 +227,18 @@ public Builder applyToAllUnaryMethods( return getStubSettingsBuilder().updateAnswerRecordSettings(); } + /** Returns the builder for the settings used for calls to listLocations. */ + public PagedCallSettings.Builder< + ListLocationsRequest, ListLocationsResponse, ListLocationsPagedResponse> + listLocationsSettings() { + return getStubSettingsBuilder().listLocationsSettings(); + } + + /** Returns the builder for the settings used for calls to getLocation. */ + public UnaryCallSettings.Builder getLocationSettings() { + return getStubSettingsBuilder().getLocationSettings(); + } + @Override public AnswerRecordsSettings build() throws IOException { return new AnswerRecordsSettings(this); diff --git a/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2/ContextsClient.java b/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2/ContextsClient.java index bb63a4cd0..5f9278d5b 100644 --- a/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2/ContextsClient.java +++ b/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2/ContextsClient.java @@ -26,6 +26,10 @@ import com.google.api.gax.rpc.UnaryCallable; import com.google.cloud.dialogflow.v2.stub.ContextsStub; import com.google.cloud.dialogflow.v2.stub.ContextsStubSettings; +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.ListLocationsResponse; +import com.google.cloud.location.Location; import com.google.common.util.concurrent.MoreExecutors; import com.google.protobuf.Empty; import com.google.protobuf.FieldMask; @@ -847,6 +851,145 @@ public final UnaryCallable deleteAllContextsCal return stub.deleteAllContextsCallable(); } + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Lists information about the supported locations for this service. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
+   * try (ContextsClient contextsClient = ContextsClient.create()) {
+   *   ListLocationsRequest request =
+   *       ListLocationsRequest.newBuilder()
+   *           .setName("name3373707")
+   *           .setFilter("filter-1274492040")
+   *           .setPageSize(883849137)
+   *           .setPageToken("pageToken873572522")
+   *           .build();
+   *   for (Location element : contextsClient.listLocations(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 + */ + public final ListLocationsPagedResponse listLocations(ListLocationsRequest request) { + return listLocationsPagedCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Lists information about the supported locations for this service. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
+   * try (ContextsClient contextsClient = ContextsClient.create()) {
+   *   ListLocationsRequest request =
+   *       ListLocationsRequest.newBuilder()
+   *           .setName("name3373707")
+   *           .setFilter("filter-1274492040")
+   *           .setPageSize(883849137)
+   *           .setPageToken("pageToken873572522")
+   *           .build();
+   *   ApiFuture future = contextsClient.listLocationsPagedCallable().futureCall(request);
+   *   // Do something.
+   *   for (Location element : future.get().iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * }
+ */ + public final UnaryCallable + listLocationsPagedCallable() { + return stub.listLocationsPagedCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Lists information about the supported locations for this service. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
+   * try (ContextsClient contextsClient = ContextsClient.create()) {
+   *   ListLocationsRequest request =
+   *       ListLocationsRequest.newBuilder()
+   *           .setName("name3373707")
+   *           .setFilter("filter-1274492040")
+   *           .setPageSize(883849137)
+   *           .setPageToken("pageToken873572522")
+   *           .build();
+   *   while (true) {
+   *     ListLocationsResponse response = contextsClient.listLocationsCallable().call(request);
+   *     for (Location element : response.getLocationsList()) {
+   *       // doThingsWith(element);
+   *     }
+   *     String nextPageToken = response.getNextPageToken();
+   *     if (!Strings.isNullOrEmpty(nextPageToken)) {
+   *       request = request.toBuilder().setPageToken(nextPageToken).build();
+   *     } else {
+   *       break;
+   *     }
+   *   }
+   * }
+   * }
+ */ + public final UnaryCallable listLocationsCallable() { + return stub.listLocationsCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Gets information about a location. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
+   * try (ContextsClient contextsClient = ContextsClient.create()) {
+   *   GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build();
+   *   Location response = contextsClient.getLocation(request);
+   * }
+   * }
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final Location getLocation(GetLocationRequest request) { + return getLocationCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Gets information about a location. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
+   * try (ContextsClient contextsClient = ContextsClient.create()) {
+   *   GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build();
+   *   ApiFuture future = contextsClient.getLocationCallable().futureCall(request);
+   *   // Do something.
+   *   Location response = future.get();
+   * }
+   * }
+ */ + public final UnaryCallable getLocationCallable() { + return stub.getLocationCallable(); + } + @Override public final void close() { stub.close(); @@ -951,4 +1094,80 @@ protected ListContextsFixedSizeCollection createCollection( return new ListContextsFixedSizeCollection(pages, collectionSize); } } + + public static class ListLocationsPagedResponse + extends AbstractPagedListResponse< + ListLocationsRequest, + ListLocationsResponse, + Location, + ListLocationsPage, + ListLocationsFixedSizeCollection> { + + public static ApiFuture createAsync( + PageContext context, + ApiFuture futureResponse) { + ApiFuture futurePage = + ListLocationsPage.createEmptyPage().createPageAsync(context, futureResponse); + return ApiFutures.transform( + futurePage, + input -> new ListLocationsPagedResponse(input), + MoreExecutors.directExecutor()); + } + + private ListLocationsPagedResponse(ListLocationsPage page) { + super(page, ListLocationsFixedSizeCollection.createEmptyCollection()); + } + } + + public static class ListLocationsPage + extends AbstractPage< + ListLocationsRequest, ListLocationsResponse, Location, ListLocationsPage> { + + private ListLocationsPage( + PageContext context, + ListLocationsResponse response) { + super(context, response); + } + + private static ListLocationsPage createEmptyPage() { + return new ListLocationsPage(null, null); + } + + @Override + protected ListLocationsPage createPage( + PageContext context, + ListLocationsResponse response) { + return new ListLocationsPage(context, response); + } + + @Override + public ApiFuture createPageAsync( + PageContext context, + ApiFuture futureResponse) { + return super.createPageAsync(context, futureResponse); + } + } + + public static class ListLocationsFixedSizeCollection + extends AbstractFixedSizeCollection< + ListLocationsRequest, + ListLocationsResponse, + Location, + ListLocationsPage, + ListLocationsFixedSizeCollection> { + + private ListLocationsFixedSizeCollection(List pages, int collectionSize) { + super(pages, collectionSize); + } + + private static ListLocationsFixedSizeCollection createEmptyCollection() { + return new ListLocationsFixedSizeCollection(null, 0); + } + + @Override + protected ListLocationsFixedSizeCollection createCollection( + List pages, int collectionSize) { + return new ListLocationsFixedSizeCollection(pages, collectionSize); + } + } } diff --git a/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2/ContextsSettings.java b/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2/ContextsSettings.java index 10b678142..cf9cd8b08 100644 --- a/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2/ContextsSettings.java +++ b/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2/ContextsSettings.java @@ -17,6 +17,7 @@ package com.google.cloud.dialogflow.v2; import static com.google.cloud.dialogflow.v2.ContextsClient.ListContextsPagedResponse; +import static com.google.cloud.dialogflow.v2.ContextsClient.ListLocationsPagedResponse; import com.google.api.core.ApiFunction; import com.google.api.core.BetaApi; @@ -31,6 +32,10 @@ import com.google.api.gax.rpc.TransportChannelProvider; import com.google.api.gax.rpc.UnaryCallSettings; import com.google.cloud.dialogflow.v2.stub.ContextsStubSettings; +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.ListLocationsResponse; +import com.google.cloud.location.Location; import com.google.protobuf.Empty; import java.io.IOException; import java.util.List; @@ -103,6 +108,17 @@ public UnaryCallSettings deleteAllContextsSetti return ((ContextsStubSettings) getStubSettings()).deleteAllContextsSettings(); } + /** Returns the object with the settings used for calls to listLocations. */ + public PagedCallSettings + listLocationsSettings() { + return ((ContextsStubSettings) getStubSettings()).listLocationsSettings(); + } + + /** Returns the object with the settings used for calls to getLocation. */ + public UnaryCallSettings getLocationSettings() { + return ((ContextsStubSettings) getStubSettings()).getLocationSettings(); + } + public static final ContextsSettings create(ContextsStubSettings stub) throws IOException { return new ContextsSettings.Builder(stub.toBuilder()).build(); } @@ -249,6 +265,18 @@ public UnaryCallSettings.Builder deleteAllConte return getStubSettingsBuilder().deleteAllContextsSettings(); } + /** Returns the builder for the settings used for calls to listLocations. */ + public PagedCallSettings.Builder< + ListLocationsRequest, ListLocationsResponse, ListLocationsPagedResponse> + listLocationsSettings() { + return getStubSettingsBuilder().listLocationsSettings(); + } + + /** Returns the builder for the settings used for calls to getLocation. */ + public UnaryCallSettings.Builder getLocationSettings() { + return getStubSettingsBuilder().getLocationSettings(); + } + @Override public ContextsSettings build() throws IOException { return new ContextsSettings(this); diff --git a/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2/ConversationDatasetsClient.java b/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2/ConversationDatasetsClient.java index 545a0384b..053294b4e 100644 --- a/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2/ConversationDatasetsClient.java +++ b/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2/ConversationDatasetsClient.java @@ -30,6 +30,10 @@ import com.google.api.gax.rpc.UnaryCallable; import com.google.cloud.dialogflow.v2.stub.ConversationDatasetsStub; import com.google.cloud.dialogflow.v2.stub.ConversationDatasetsStubSettings; +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.ListLocationsResponse; +import com.google.cloud.location.Location; import com.google.common.util.concurrent.MoreExecutors; import com.google.longrunning.Operation; import com.google.protobuf.Empty; @@ -957,6 +961,153 @@ public final ListConversationDatasetsPagedResponse listConversationDatasets( return stub.importConversationDataCallable(); } + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Lists information about the supported locations for this service. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
+   * try (ConversationDatasetsClient conversationDatasetsClient =
+   *     ConversationDatasetsClient.create()) {
+   *   ListLocationsRequest request =
+   *       ListLocationsRequest.newBuilder()
+   *           .setName("name3373707")
+   *           .setFilter("filter-1274492040")
+   *           .setPageSize(883849137)
+   *           .setPageToken("pageToken873572522")
+   *           .build();
+   *   for (Location element : conversationDatasetsClient.listLocations(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 + */ + public final ListLocationsPagedResponse listLocations(ListLocationsRequest request) { + return listLocationsPagedCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Lists information about the supported locations for this service. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
+   * try (ConversationDatasetsClient conversationDatasetsClient =
+   *     ConversationDatasetsClient.create()) {
+   *   ListLocationsRequest request =
+   *       ListLocationsRequest.newBuilder()
+   *           .setName("name3373707")
+   *           .setFilter("filter-1274492040")
+   *           .setPageSize(883849137)
+   *           .setPageToken("pageToken873572522")
+   *           .build();
+   *   ApiFuture future =
+   *       conversationDatasetsClient.listLocationsPagedCallable().futureCall(request);
+   *   // Do something.
+   *   for (Location element : future.get().iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * }
+ */ + public final UnaryCallable + listLocationsPagedCallable() { + return stub.listLocationsPagedCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Lists information about the supported locations for this service. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
+   * try (ConversationDatasetsClient conversationDatasetsClient =
+   *     ConversationDatasetsClient.create()) {
+   *   ListLocationsRequest request =
+   *       ListLocationsRequest.newBuilder()
+   *           .setName("name3373707")
+   *           .setFilter("filter-1274492040")
+   *           .setPageSize(883849137)
+   *           .setPageToken("pageToken873572522")
+   *           .build();
+   *   while (true) {
+   *     ListLocationsResponse response =
+   *         conversationDatasetsClient.listLocationsCallable().call(request);
+   *     for (Location element : response.getLocationsList()) {
+   *       // doThingsWith(element);
+   *     }
+   *     String nextPageToken = response.getNextPageToken();
+   *     if (!Strings.isNullOrEmpty(nextPageToken)) {
+   *       request = request.toBuilder().setPageToken(nextPageToken).build();
+   *     } else {
+   *       break;
+   *     }
+   *   }
+   * }
+   * }
+ */ + public final UnaryCallable listLocationsCallable() { + return stub.listLocationsCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Gets information about a location. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
+   * try (ConversationDatasetsClient conversationDatasetsClient =
+   *     ConversationDatasetsClient.create()) {
+   *   GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build();
+   *   Location response = conversationDatasetsClient.getLocation(request);
+   * }
+   * }
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final Location getLocation(GetLocationRequest request) { + return getLocationCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Gets information about a location. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
+   * try (ConversationDatasetsClient conversationDatasetsClient =
+   *     ConversationDatasetsClient.create()) {
+   *   GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build();
+   *   ApiFuture future =
+   *       conversationDatasetsClient.getLocationCallable().futureCall(request);
+   *   // Do something.
+   *   Location response = future.get();
+   * }
+   * }
+ */ + public final UnaryCallable getLocationCallable() { + return stub.getLocationCallable(); + } + @Override public final void close() { stub.close(); @@ -1082,4 +1233,80 @@ protected ListConversationDatasetsFixedSizeCollection createCollection( return new ListConversationDatasetsFixedSizeCollection(pages, collectionSize); } } + + public static class ListLocationsPagedResponse + extends AbstractPagedListResponse< + ListLocationsRequest, + ListLocationsResponse, + Location, + ListLocationsPage, + ListLocationsFixedSizeCollection> { + + public static ApiFuture createAsync( + PageContext context, + ApiFuture futureResponse) { + ApiFuture futurePage = + ListLocationsPage.createEmptyPage().createPageAsync(context, futureResponse); + return ApiFutures.transform( + futurePage, + input -> new ListLocationsPagedResponse(input), + MoreExecutors.directExecutor()); + } + + private ListLocationsPagedResponse(ListLocationsPage page) { + super(page, ListLocationsFixedSizeCollection.createEmptyCollection()); + } + } + + public static class ListLocationsPage + extends AbstractPage< + ListLocationsRequest, ListLocationsResponse, Location, ListLocationsPage> { + + private ListLocationsPage( + PageContext context, + ListLocationsResponse response) { + super(context, response); + } + + private static ListLocationsPage createEmptyPage() { + return new ListLocationsPage(null, null); + } + + @Override + protected ListLocationsPage createPage( + PageContext context, + ListLocationsResponse response) { + return new ListLocationsPage(context, response); + } + + @Override + public ApiFuture createPageAsync( + PageContext context, + ApiFuture futureResponse) { + return super.createPageAsync(context, futureResponse); + } + } + + public static class ListLocationsFixedSizeCollection + extends AbstractFixedSizeCollection< + ListLocationsRequest, + ListLocationsResponse, + Location, + ListLocationsPage, + ListLocationsFixedSizeCollection> { + + private ListLocationsFixedSizeCollection(List pages, int collectionSize) { + super(pages, collectionSize); + } + + private static ListLocationsFixedSizeCollection createEmptyCollection() { + return new ListLocationsFixedSizeCollection(null, 0); + } + + @Override + protected ListLocationsFixedSizeCollection createCollection( + List pages, int collectionSize) { + return new ListLocationsFixedSizeCollection(pages, collectionSize); + } + } } diff --git a/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2/ConversationDatasetsSettings.java b/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2/ConversationDatasetsSettings.java index 03ebf9274..08e09d31c 100644 --- a/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2/ConversationDatasetsSettings.java +++ b/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2/ConversationDatasetsSettings.java @@ -17,6 +17,7 @@ package com.google.cloud.dialogflow.v2; import static com.google.cloud.dialogflow.v2.ConversationDatasetsClient.ListConversationDatasetsPagedResponse; +import static com.google.cloud.dialogflow.v2.ConversationDatasetsClient.ListLocationsPagedResponse; import com.google.api.core.ApiFunction; import com.google.api.core.BetaApi; @@ -32,6 +33,10 @@ import com.google.api.gax.rpc.TransportChannelProvider; import com.google.api.gax.rpc.UnaryCallSettings; import com.google.cloud.dialogflow.v2.stub.ConversationDatasetsStubSettings; +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.ListLocationsResponse; +import com.google.cloud.location.Location; import com.google.longrunning.Operation; import com.google.protobuf.Empty; import java.io.IOException; @@ -140,6 +145,17 @@ public class ConversationDatasetsSettings extends ClientSettings + listLocationsSettings() { + return ((ConversationDatasetsStubSettings) getStubSettings()).listLocationsSettings(); + } + + /** Returns the object with the settings used for calls to getLocation. */ + public UnaryCallSettings getLocationSettings() { + return ((ConversationDatasetsStubSettings) getStubSettings()).getLocationSettings(); + } + public static final ConversationDatasetsSettings create(ConversationDatasetsStubSettings stub) throws IOException { return new ConversationDatasetsSettings.Builder(stub.toBuilder()).build(); @@ -314,6 +330,18 @@ public Builder applyToAllUnaryMethods( return getStubSettingsBuilder().importConversationDataOperationSettings(); } + /** Returns the builder for the settings used for calls to listLocations. */ + public PagedCallSettings.Builder< + ListLocationsRequest, ListLocationsResponse, ListLocationsPagedResponse> + listLocationsSettings() { + return getStubSettingsBuilder().listLocationsSettings(); + } + + /** Returns the builder for the settings used for calls to getLocation. */ + public UnaryCallSettings.Builder getLocationSettings() { + return getStubSettingsBuilder().getLocationSettings(); + } + @Override public ConversationDatasetsSettings build() throws IOException { return new ConversationDatasetsSettings(this); diff --git a/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2/ConversationModelsClient.java b/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2/ConversationModelsClient.java index b4d2a6c7d..4cecf7dbf 100644 --- a/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2/ConversationModelsClient.java +++ b/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2/ConversationModelsClient.java @@ -30,6 +30,10 @@ import com.google.api.gax.rpc.UnaryCallable; import com.google.cloud.dialogflow.v2.stub.ConversationModelsStub; import com.google.cloud.dialogflow.v2.stub.ConversationModelsStubSettings; +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.ListLocationsResponse; +import com.google.cloud.location.Location; import com.google.common.util.concurrent.MoreExecutors; import com.google.longrunning.Operation; import com.google.protobuf.Empty; @@ -1276,6 +1280,148 @@ public final ListConversationModelEvaluationsPagedResponse listConversationModel return stub.createConversationModelEvaluationCallable(); } + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Lists information about the supported locations for this service. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
+   * try (ConversationModelsClient conversationModelsClient = ConversationModelsClient.create()) {
+   *   ListLocationsRequest request =
+   *       ListLocationsRequest.newBuilder()
+   *           .setName("name3373707")
+   *           .setFilter("filter-1274492040")
+   *           .setPageSize(883849137)
+   *           .setPageToken("pageToken873572522")
+   *           .build();
+   *   for (Location element : conversationModelsClient.listLocations(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 + */ + public final ListLocationsPagedResponse listLocations(ListLocationsRequest request) { + return listLocationsPagedCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Lists information about the supported locations for this service. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
+   * try (ConversationModelsClient conversationModelsClient = ConversationModelsClient.create()) {
+   *   ListLocationsRequest request =
+   *       ListLocationsRequest.newBuilder()
+   *           .setName("name3373707")
+   *           .setFilter("filter-1274492040")
+   *           .setPageSize(883849137)
+   *           .setPageToken("pageToken873572522")
+   *           .build();
+   *   ApiFuture future =
+   *       conversationModelsClient.listLocationsPagedCallable().futureCall(request);
+   *   // Do something.
+   *   for (Location element : future.get().iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * }
+ */ + public final UnaryCallable + listLocationsPagedCallable() { + return stub.listLocationsPagedCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Lists information about the supported locations for this service. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
+   * try (ConversationModelsClient conversationModelsClient = ConversationModelsClient.create()) {
+   *   ListLocationsRequest request =
+   *       ListLocationsRequest.newBuilder()
+   *           .setName("name3373707")
+   *           .setFilter("filter-1274492040")
+   *           .setPageSize(883849137)
+   *           .setPageToken("pageToken873572522")
+   *           .build();
+   *   while (true) {
+   *     ListLocationsResponse response =
+   *         conversationModelsClient.listLocationsCallable().call(request);
+   *     for (Location element : response.getLocationsList()) {
+   *       // doThingsWith(element);
+   *     }
+   *     String nextPageToken = response.getNextPageToken();
+   *     if (!Strings.isNullOrEmpty(nextPageToken)) {
+   *       request = request.toBuilder().setPageToken(nextPageToken).build();
+   *     } else {
+   *       break;
+   *     }
+   *   }
+   * }
+   * }
+ */ + public final UnaryCallable listLocationsCallable() { + return stub.listLocationsCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Gets information about a location. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
+   * try (ConversationModelsClient conversationModelsClient = ConversationModelsClient.create()) {
+   *   GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build();
+   *   Location response = conversationModelsClient.getLocation(request);
+   * }
+   * }
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final Location getLocation(GetLocationRequest request) { + return getLocationCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Gets information about a location. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
+   * try (ConversationModelsClient conversationModelsClient = ConversationModelsClient.create()) {
+   *   GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build();
+   *   ApiFuture future =
+   *       conversationModelsClient.getLocationCallable().futureCall(request);
+   *   // Do something.
+   *   Location response = future.get();
+   * }
+   * }
+ */ + public final UnaryCallable getLocationCallable() { + return stub.getLocationCallable(); + } + @Override public final void close() { stub.close(); @@ -1491,4 +1637,80 @@ protected ListConversationModelEvaluationsFixedSizeCollection createCollection( return new ListConversationModelEvaluationsFixedSizeCollection(pages, collectionSize); } } + + public static class ListLocationsPagedResponse + extends AbstractPagedListResponse< + ListLocationsRequest, + ListLocationsResponse, + Location, + ListLocationsPage, + ListLocationsFixedSizeCollection> { + + public static ApiFuture createAsync( + PageContext context, + ApiFuture futureResponse) { + ApiFuture futurePage = + ListLocationsPage.createEmptyPage().createPageAsync(context, futureResponse); + return ApiFutures.transform( + futurePage, + input -> new ListLocationsPagedResponse(input), + MoreExecutors.directExecutor()); + } + + private ListLocationsPagedResponse(ListLocationsPage page) { + super(page, ListLocationsFixedSizeCollection.createEmptyCollection()); + } + } + + public static class ListLocationsPage + extends AbstractPage< + ListLocationsRequest, ListLocationsResponse, Location, ListLocationsPage> { + + private ListLocationsPage( + PageContext context, + ListLocationsResponse response) { + super(context, response); + } + + private static ListLocationsPage createEmptyPage() { + return new ListLocationsPage(null, null); + } + + @Override + protected ListLocationsPage createPage( + PageContext context, + ListLocationsResponse response) { + return new ListLocationsPage(context, response); + } + + @Override + public ApiFuture createPageAsync( + PageContext context, + ApiFuture futureResponse) { + return super.createPageAsync(context, futureResponse); + } + } + + public static class ListLocationsFixedSizeCollection + extends AbstractFixedSizeCollection< + ListLocationsRequest, + ListLocationsResponse, + Location, + ListLocationsPage, + ListLocationsFixedSizeCollection> { + + private ListLocationsFixedSizeCollection(List pages, int collectionSize) { + super(pages, collectionSize); + } + + private static ListLocationsFixedSizeCollection createEmptyCollection() { + return new ListLocationsFixedSizeCollection(null, 0); + } + + @Override + protected ListLocationsFixedSizeCollection createCollection( + List pages, int collectionSize) { + return new ListLocationsFixedSizeCollection(pages, collectionSize); + } + } } diff --git a/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2/ConversationModelsSettings.java b/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2/ConversationModelsSettings.java index 04bedb0c2..63cf43c05 100644 --- a/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2/ConversationModelsSettings.java +++ b/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2/ConversationModelsSettings.java @@ -18,6 +18,7 @@ import static com.google.cloud.dialogflow.v2.ConversationModelsClient.ListConversationModelEvaluationsPagedResponse; import static com.google.cloud.dialogflow.v2.ConversationModelsClient.ListConversationModelsPagedResponse; +import static com.google.cloud.dialogflow.v2.ConversationModelsClient.ListLocationsPagedResponse; import com.google.api.core.ApiFunction; import com.google.api.core.BetaApi; @@ -33,6 +34,10 @@ import com.google.api.gax.rpc.TransportChannelProvider; import com.google.api.gax.rpc.UnaryCallSettings; import com.google.cloud.dialogflow.v2.stub.ConversationModelsStubSettings; +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.ListLocationsResponse; +import com.google.cloud.location.Location; import com.google.longrunning.Operation; import com.google.protobuf.Empty; import java.io.IOException; @@ -184,6 +189,17 @@ public class ConversationModelsSettings extends ClientSettings + listLocationsSettings() { + return ((ConversationModelsStubSettings) getStubSettings()).listLocationsSettings(); + } + + /** Returns the object with the settings used for calls to getLocation. */ + public UnaryCallSettings getLocationSettings() { + return ((ConversationModelsStubSettings) getStubSettings()).getLocationSettings(); + } + public static final ConversationModelsSettings create(ConversationModelsStubSettings stub) throws IOException { return new ConversationModelsSettings.Builder(stub.toBuilder()).build(); @@ -399,6 +415,18 @@ public Builder applyToAllUnaryMethods( return getStubSettingsBuilder().createConversationModelEvaluationOperationSettings(); } + /** Returns the builder for the settings used for calls to listLocations. */ + public PagedCallSettings.Builder< + ListLocationsRequest, ListLocationsResponse, ListLocationsPagedResponse> + listLocationsSettings() { + return getStubSettingsBuilder().listLocationsSettings(); + } + + /** Returns the builder for the settings used for calls to getLocation. */ + public UnaryCallSettings.Builder getLocationSettings() { + return getStubSettingsBuilder().getLocationSettings(); + } + @Override public ConversationModelsSettings build() throws IOException { return new ConversationModelsSettings(this); diff --git a/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2/ConversationProfilesClient.java b/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2/ConversationProfilesClient.java index f941098dd..a8eec7f5f 100644 --- a/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2/ConversationProfilesClient.java +++ b/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2/ConversationProfilesClient.java @@ -30,6 +30,10 @@ import com.google.api.gax.rpc.UnaryCallable; import com.google.cloud.dialogflow.v2.stub.ConversationProfilesStub; import com.google.cloud.dialogflow.v2.stub.ConversationProfilesStubSettings; +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.ListLocationsResponse; +import com.google.cloud.location.Location; import com.google.common.util.concurrent.MoreExecutors; import com.google.longrunning.Operation; import com.google.protobuf.Empty; @@ -1251,6 +1255,153 @@ public final void deleteConversationProfile(DeleteConversationProfileRequest req return stub.clearSuggestionFeatureConfigCallable(); } + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Lists information about the supported locations for this service. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
+   * try (ConversationProfilesClient conversationProfilesClient =
+   *     ConversationProfilesClient.create()) {
+   *   ListLocationsRequest request =
+   *       ListLocationsRequest.newBuilder()
+   *           .setName("name3373707")
+   *           .setFilter("filter-1274492040")
+   *           .setPageSize(883849137)
+   *           .setPageToken("pageToken873572522")
+   *           .build();
+   *   for (Location element : conversationProfilesClient.listLocations(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 + */ + public final ListLocationsPagedResponse listLocations(ListLocationsRequest request) { + return listLocationsPagedCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Lists information about the supported locations for this service. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
+   * try (ConversationProfilesClient conversationProfilesClient =
+   *     ConversationProfilesClient.create()) {
+   *   ListLocationsRequest request =
+   *       ListLocationsRequest.newBuilder()
+   *           .setName("name3373707")
+   *           .setFilter("filter-1274492040")
+   *           .setPageSize(883849137)
+   *           .setPageToken("pageToken873572522")
+   *           .build();
+   *   ApiFuture future =
+   *       conversationProfilesClient.listLocationsPagedCallable().futureCall(request);
+   *   // Do something.
+   *   for (Location element : future.get().iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * }
+ */ + public final UnaryCallable + listLocationsPagedCallable() { + return stub.listLocationsPagedCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Lists information about the supported locations for this service. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
+   * try (ConversationProfilesClient conversationProfilesClient =
+   *     ConversationProfilesClient.create()) {
+   *   ListLocationsRequest request =
+   *       ListLocationsRequest.newBuilder()
+   *           .setName("name3373707")
+   *           .setFilter("filter-1274492040")
+   *           .setPageSize(883849137)
+   *           .setPageToken("pageToken873572522")
+   *           .build();
+   *   while (true) {
+   *     ListLocationsResponse response =
+   *         conversationProfilesClient.listLocationsCallable().call(request);
+   *     for (Location element : response.getLocationsList()) {
+   *       // doThingsWith(element);
+   *     }
+   *     String nextPageToken = response.getNextPageToken();
+   *     if (!Strings.isNullOrEmpty(nextPageToken)) {
+   *       request = request.toBuilder().setPageToken(nextPageToken).build();
+   *     } else {
+   *       break;
+   *     }
+   *   }
+   * }
+   * }
+ */ + public final UnaryCallable listLocationsCallable() { + return stub.listLocationsCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Gets information about a location. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
+   * try (ConversationProfilesClient conversationProfilesClient =
+   *     ConversationProfilesClient.create()) {
+   *   GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build();
+   *   Location response = conversationProfilesClient.getLocation(request);
+   * }
+   * }
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final Location getLocation(GetLocationRequest request) { + return getLocationCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Gets information about a location. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
+   * try (ConversationProfilesClient conversationProfilesClient =
+   *     ConversationProfilesClient.create()) {
+   *   GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build();
+   *   ApiFuture future =
+   *       conversationProfilesClient.getLocationCallable().futureCall(request);
+   *   // Do something.
+   *   Location response = future.get();
+   * }
+   * }
+ */ + public final UnaryCallable getLocationCallable() { + return stub.getLocationCallable(); + } + @Override public final void close() { stub.close(); @@ -1376,4 +1527,80 @@ protected ListConversationProfilesFixedSizeCollection createCollection( return new ListConversationProfilesFixedSizeCollection(pages, collectionSize); } } + + public static class ListLocationsPagedResponse + extends AbstractPagedListResponse< + ListLocationsRequest, + ListLocationsResponse, + Location, + ListLocationsPage, + ListLocationsFixedSizeCollection> { + + public static ApiFuture createAsync( + PageContext context, + ApiFuture futureResponse) { + ApiFuture futurePage = + ListLocationsPage.createEmptyPage().createPageAsync(context, futureResponse); + return ApiFutures.transform( + futurePage, + input -> new ListLocationsPagedResponse(input), + MoreExecutors.directExecutor()); + } + + private ListLocationsPagedResponse(ListLocationsPage page) { + super(page, ListLocationsFixedSizeCollection.createEmptyCollection()); + } + } + + public static class ListLocationsPage + extends AbstractPage< + ListLocationsRequest, ListLocationsResponse, Location, ListLocationsPage> { + + private ListLocationsPage( + PageContext context, + ListLocationsResponse response) { + super(context, response); + } + + private static ListLocationsPage createEmptyPage() { + return new ListLocationsPage(null, null); + } + + @Override + protected ListLocationsPage createPage( + PageContext context, + ListLocationsResponse response) { + return new ListLocationsPage(context, response); + } + + @Override + public ApiFuture createPageAsync( + PageContext context, + ApiFuture futureResponse) { + return super.createPageAsync(context, futureResponse); + } + } + + public static class ListLocationsFixedSizeCollection + extends AbstractFixedSizeCollection< + ListLocationsRequest, + ListLocationsResponse, + Location, + ListLocationsPage, + ListLocationsFixedSizeCollection> { + + private ListLocationsFixedSizeCollection(List pages, int collectionSize) { + super(pages, collectionSize); + } + + private static ListLocationsFixedSizeCollection createEmptyCollection() { + return new ListLocationsFixedSizeCollection(null, 0); + } + + @Override + protected ListLocationsFixedSizeCollection createCollection( + List pages, int collectionSize) { + return new ListLocationsFixedSizeCollection(pages, collectionSize); + } + } } diff --git a/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2/ConversationProfilesSettings.java b/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2/ConversationProfilesSettings.java index aa2896c8d..bab77ec15 100644 --- a/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2/ConversationProfilesSettings.java +++ b/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2/ConversationProfilesSettings.java @@ -17,6 +17,7 @@ package com.google.cloud.dialogflow.v2; import static com.google.cloud.dialogflow.v2.ConversationProfilesClient.ListConversationProfilesPagedResponse; +import static com.google.cloud.dialogflow.v2.ConversationProfilesClient.ListLocationsPagedResponse; import com.google.api.core.ApiFunction; import com.google.api.core.BetaApi; @@ -32,6 +33,10 @@ import com.google.api.gax.rpc.TransportChannelProvider; import com.google.api.gax.rpc.UnaryCallSettings; import com.google.cloud.dialogflow.v2.stub.ConversationProfilesStubSettings; +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.ListLocationsResponse; +import com.google.cloud.location.Location; import com.google.longrunning.Operation; import com.google.protobuf.Empty; import java.io.IOException; @@ -147,6 +152,17 @@ public class ConversationProfilesSettings extends ClientSettings + listLocationsSettings() { + return ((ConversationProfilesStubSettings) getStubSettings()).listLocationsSettings(); + } + + /** Returns the object with the settings used for calls to getLocation. */ + public UnaryCallSettings getLocationSettings() { + return ((ConversationProfilesStubSettings) getStubSettings()).getLocationSettings(); + } + public static final ConversationProfilesSettings create(ConversationProfilesStubSettings stub) throws IOException { return new ConversationProfilesSettings.Builder(stub.toBuilder()).build(); @@ -326,6 +342,18 @@ public Builder applyToAllUnaryMethods( return getStubSettingsBuilder().clearSuggestionFeatureConfigOperationSettings(); } + /** Returns the builder for the settings used for calls to listLocations. */ + public PagedCallSettings.Builder< + ListLocationsRequest, ListLocationsResponse, ListLocationsPagedResponse> + listLocationsSettings() { + return getStubSettingsBuilder().listLocationsSettings(); + } + + /** Returns the builder for the settings used for calls to getLocation. */ + public UnaryCallSettings.Builder getLocationSettings() { + return getStubSettingsBuilder().getLocationSettings(); + } + @Override public ConversationProfilesSettings build() throws IOException { return new ConversationProfilesSettings(this); diff --git a/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2/ConversationsClient.java b/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2/ConversationsClient.java index e5ff72b9f..f4a7b8fab 100644 --- a/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2/ConversationsClient.java +++ b/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2/ConversationsClient.java @@ -26,6 +26,10 @@ import com.google.api.gax.rpc.UnaryCallable; import com.google.cloud.dialogflow.v2.stub.ConversationsStub; import com.google.cloud.dialogflow.v2.stub.ConversationsStubSettings; +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.ListLocationsResponse; +import com.google.cloud.location.Location; import com.google.common.util.concurrent.MoreExecutors; import java.io.IOException; import java.util.List; @@ -969,6 +973,146 @@ public final UnaryCallable listMessag return stub.listMessagesCallable(); } + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Lists information about the supported locations for this service. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
+   * try (ConversationsClient conversationsClient = ConversationsClient.create()) {
+   *   ListLocationsRequest request =
+   *       ListLocationsRequest.newBuilder()
+   *           .setName("name3373707")
+   *           .setFilter("filter-1274492040")
+   *           .setPageSize(883849137)
+   *           .setPageToken("pageToken873572522")
+   *           .build();
+   *   for (Location element : conversationsClient.listLocations(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 + */ + public final ListLocationsPagedResponse listLocations(ListLocationsRequest request) { + return listLocationsPagedCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Lists information about the supported locations for this service. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
+   * try (ConversationsClient conversationsClient = ConversationsClient.create()) {
+   *   ListLocationsRequest request =
+   *       ListLocationsRequest.newBuilder()
+   *           .setName("name3373707")
+   *           .setFilter("filter-1274492040")
+   *           .setPageSize(883849137)
+   *           .setPageToken("pageToken873572522")
+   *           .build();
+   *   ApiFuture future =
+   *       conversationsClient.listLocationsPagedCallable().futureCall(request);
+   *   // Do something.
+   *   for (Location element : future.get().iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * }
+ */ + public final UnaryCallable + listLocationsPagedCallable() { + return stub.listLocationsPagedCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Lists information about the supported locations for this service. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
+   * try (ConversationsClient conversationsClient = ConversationsClient.create()) {
+   *   ListLocationsRequest request =
+   *       ListLocationsRequest.newBuilder()
+   *           .setName("name3373707")
+   *           .setFilter("filter-1274492040")
+   *           .setPageSize(883849137)
+   *           .setPageToken("pageToken873572522")
+   *           .build();
+   *   while (true) {
+   *     ListLocationsResponse response = conversationsClient.listLocationsCallable().call(request);
+   *     for (Location element : response.getLocationsList()) {
+   *       // doThingsWith(element);
+   *     }
+   *     String nextPageToken = response.getNextPageToken();
+   *     if (!Strings.isNullOrEmpty(nextPageToken)) {
+   *       request = request.toBuilder().setPageToken(nextPageToken).build();
+   *     } else {
+   *       break;
+   *     }
+   *   }
+   * }
+   * }
+ */ + public final UnaryCallable listLocationsCallable() { + return stub.listLocationsCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Gets information about a location. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
+   * try (ConversationsClient conversationsClient = ConversationsClient.create()) {
+   *   GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build();
+   *   Location response = conversationsClient.getLocation(request);
+   * }
+   * }
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final Location getLocation(GetLocationRequest request) { + return getLocationCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Gets information about a location. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
+   * try (ConversationsClient conversationsClient = ConversationsClient.create()) {
+   *   GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build();
+   *   ApiFuture future = conversationsClient.getLocationCallable().futureCall(request);
+   *   // Do something.
+   *   Location response = future.get();
+   * }
+   * }
+ */ + public final UnaryCallable getLocationCallable() { + return stub.getLocationCallable(); + } + @Override public final void close() { stub.close(); @@ -1153,4 +1297,80 @@ protected ListMessagesFixedSizeCollection createCollection( return new ListMessagesFixedSizeCollection(pages, collectionSize); } } + + public static class ListLocationsPagedResponse + extends AbstractPagedListResponse< + ListLocationsRequest, + ListLocationsResponse, + Location, + ListLocationsPage, + ListLocationsFixedSizeCollection> { + + public static ApiFuture createAsync( + PageContext context, + ApiFuture futureResponse) { + ApiFuture futurePage = + ListLocationsPage.createEmptyPage().createPageAsync(context, futureResponse); + return ApiFutures.transform( + futurePage, + input -> new ListLocationsPagedResponse(input), + MoreExecutors.directExecutor()); + } + + private ListLocationsPagedResponse(ListLocationsPage page) { + super(page, ListLocationsFixedSizeCollection.createEmptyCollection()); + } + } + + public static class ListLocationsPage + extends AbstractPage< + ListLocationsRequest, ListLocationsResponse, Location, ListLocationsPage> { + + private ListLocationsPage( + PageContext context, + ListLocationsResponse response) { + super(context, response); + } + + private static ListLocationsPage createEmptyPage() { + return new ListLocationsPage(null, null); + } + + @Override + protected ListLocationsPage createPage( + PageContext context, + ListLocationsResponse response) { + return new ListLocationsPage(context, response); + } + + @Override + public ApiFuture createPageAsync( + PageContext context, + ApiFuture futureResponse) { + return super.createPageAsync(context, futureResponse); + } + } + + public static class ListLocationsFixedSizeCollection + extends AbstractFixedSizeCollection< + ListLocationsRequest, + ListLocationsResponse, + Location, + ListLocationsPage, + ListLocationsFixedSizeCollection> { + + private ListLocationsFixedSizeCollection(List pages, int collectionSize) { + super(pages, collectionSize); + } + + private static ListLocationsFixedSizeCollection createEmptyCollection() { + return new ListLocationsFixedSizeCollection(null, 0); + } + + @Override + protected ListLocationsFixedSizeCollection createCollection( + List pages, int collectionSize) { + return new ListLocationsFixedSizeCollection(pages, collectionSize); + } + } } diff --git a/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2/ConversationsSettings.java b/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2/ConversationsSettings.java index 2aebe0796..b612e18bf 100644 --- a/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2/ConversationsSettings.java +++ b/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2/ConversationsSettings.java @@ -17,6 +17,7 @@ package com.google.cloud.dialogflow.v2; import static com.google.cloud.dialogflow.v2.ConversationsClient.ListConversationsPagedResponse; +import static com.google.cloud.dialogflow.v2.ConversationsClient.ListLocationsPagedResponse; import static com.google.cloud.dialogflow.v2.ConversationsClient.ListMessagesPagedResponse; import com.google.api.core.ApiFunction; @@ -32,6 +33,10 @@ import com.google.api.gax.rpc.TransportChannelProvider; import com.google.api.gax.rpc.UnaryCallSettings; import com.google.cloud.dialogflow.v2.stub.ConversationsStubSettings; +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.ListLocationsResponse; +import com.google.cloud.location.Location; import java.io.IOException; import java.util.List; import javax.annotation.Generated; @@ -101,6 +106,17 @@ public UnaryCallSettings getConversationSe return ((ConversationsStubSettings) getStubSettings()).listMessagesSettings(); } + /** Returns the object with the settings used for calls to listLocations. */ + public PagedCallSettings + listLocationsSettings() { + return ((ConversationsStubSettings) getStubSettings()).listLocationsSettings(); + } + + /** Returns the object with the settings used for calls to getLocation. */ + public UnaryCallSettings getLocationSettings() { + return ((ConversationsStubSettings) getStubSettings()).getLocationSettings(); + } + public static final ConversationsSettings create(ConversationsStubSettings stub) throws IOException { return new ConversationsSettings.Builder(stub.toBuilder()).build(); @@ -248,6 +264,18 @@ public Builder applyToAllUnaryMethods( return getStubSettingsBuilder().listMessagesSettings(); } + /** Returns the builder for the settings used for calls to listLocations. */ + public PagedCallSettings.Builder< + ListLocationsRequest, ListLocationsResponse, ListLocationsPagedResponse> + listLocationsSettings() { + return getStubSettingsBuilder().listLocationsSettings(); + } + + /** Returns the builder for the settings used for calls to getLocation. */ + public UnaryCallSettings.Builder getLocationSettings() { + return getStubSettingsBuilder().getLocationSettings(); + } + @Override public ConversationsSettings build() throws IOException { return new ConversationsSettings(this); diff --git a/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2/DocumentsClient.java b/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2/DocumentsClient.java index ab111f7df..fa6da2744 100644 --- a/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2/DocumentsClient.java +++ b/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2/DocumentsClient.java @@ -30,6 +30,10 @@ import com.google.api.gax.rpc.UnaryCallable; import com.google.cloud.dialogflow.v2.stub.DocumentsStub; import com.google.cloud.dialogflow.v2.stub.DocumentsStubSettings; +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.ListLocationsResponse; +import com.google.cloud.location.Location; import com.google.common.util.concurrent.MoreExecutors; import com.google.longrunning.Operation; import com.google.protobuf.Empty; @@ -1445,6 +1449,145 @@ public final UnaryCallable exportDocumentCalla return stub.exportDocumentCallable(); } + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Lists information about the supported locations for this service. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
+   * try (DocumentsClient documentsClient = DocumentsClient.create()) {
+   *   ListLocationsRequest request =
+   *       ListLocationsRequest.newBuilder()
+   *           .setName("name3373707")
+   *           .setFilter("filter-1274492040")
+   *           .setPageSize(883849137)
+   *           .setPageToken("pageToken873572522")
+   *           .build();
+   *   for (Location element : documentsClient.listLocations(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 + */ + public final ListLocationsPagedResponse listLocations(ListLocationsRequest request) { + return listLocationsPagedCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Lists information about the supported locations for this service. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
+   * try (DocumentsClient documentsClient = DocumentsClient.create()) {
+   *   ListLocationsRequest request =
+   *       ListLocationsRequest.newBuilder()
+   *           .setName("name3373707")
+   *           .setFilter("filter-1274492040")
+   *           .setPageSize(883849137)
+   *           .setPageToken("pageToken873572522")
+   *           .build();
+   *   ApiFuture future = documentsClient.listLocationsPagedCallable().futureCall(request);
+   *   // Do something.
+   *   for (Location element : future.get().iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * }
+ */ + public final UnaryCallable + listLocationsPagedCallable() { + return stub.listLocationsPagedCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Lists information about the supported locations for this service. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
+   * try (DocumentsClient documentsClient = DocumentsClient.create()) {
+   *   ListLocationsRequest request =
+   *       ListLocationsRequest.newBuilder()
+   *           .setName("name3373707")
+   *           .setFilter("filter-1274492040")
+   *           .setPageSize(883849137)
+   *           .setPageToken("pageToken873572522")
+   *           .build();
+   *   while (true) {
+   *     ListLocationsResponse response = documentsClient.listLocationsCallable().call(request);
+   *     for (Location element : response.getLocationsList()) {
+   *       // doThingsWith(element);
+   *     }
+   *     String nextPageToken = response.getNextPageToken();
+   *     if (!Strings.isNullOrEmpty(nextPageToken)) {
+   *       request = request.toBuilder().setPageToken(nextPageToken).build();
+   *     } else {
+   *       break;
+   *     }
+   *   }
+   * }
+   * }
+ */ + public final UnaryCallable listLocationsCallable() { + return stub.listLocationsCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Gets information about a location. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
+   * try (DocumentsClient documentsClient = DocumentsClient.create()) {
+   *   GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build();
+   *   Location response = documentsClient.getLocation(request);
+   * }
+   * }
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final Location getLocation(GetLocationRequest request) { + return getLocationCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Gets information about a location. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
+   * try (DocumentsClient documentsClient = DocumentsClient.create()) {
+   *   GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build();
+   *   ApiFuture future = documentsClient.getLocationCallable().futureCall(request);
+   *   // Do something.
+   *   Location response = future.get();
+   * }
+   * }
+ */ + public final UnaryCallable getLocationCallable() { + return stub.getLocationCallable(); + } + @Override public final void close() { stub.close(); @@ -1550,4 +1693,80 @@ protected ListDocumentsFixedSizeCollection createCollection( return new ListDocumentsFixedSizeCollection(pages, collectionSize); } } + + public static class ListLocationsPagedResponse + extends AbstractPagedListResponse< + ListLocationsRequest, + ListLocationsResponse, + Location, + ListLocationsPage, + ListLocationsFixedSizeCollection> { + + public static ApiFuture createAsync( + PageContext context, + ApiFuture futureResponse) { + ApiFuture futurePage = + ListLocationsPage.createEmptyPage().createPageAsync(context, futureResponse); + return ApiFutures.transform( + futurePage, + input -> new ListLocationsPagedResponse(input), + MoreExecutors.directExecutor()); + } + + private ListLocationsPagedResponse(ListLocationsPage page) { + super(page, ListLocationsFixedSizeCollection.createEmptyCollection()); + } + } + + public static class ListLocationsPage + extends AbstractPage< + ListLocationsRequest, ListLocationsResponse, Location, ListLocationsPage> { + + private ListLocationsPage( + PageContext context, + ListLocationsResponse response) { + super(context, response); + } + + private static ListLocationsPage createEmptyPage() { + return new ListLocationsPage(null, null); + } + + @Override + protected ListLocationsPage createPage( + PageContext context, + ListLocationsResponse response) { + return new ListLocationsPage(context, response); + } + + @Override + public ApiFuture createPageAsync( + PageContext context, + ApiFuture futureResponse) { + return super.createPageAsync(context, futureResponse); + } + } + + public static class ListLocationsFixedSizeCollection + extends AbstractFixedSizeCollection< + ListLocationsRequest, + ListLocationsResponse, + Location, + ListLocationsPage, + ListLocationsFixedSizeCollection> { + + private ListLocationsFixedSizeCollection(List pages, int collectionSize) { + super(pages, collectionSize); + } + + private static ListLocationsFixedSizeCollection createEmptyCollection() { + return new ListLocationsFixedSizeCollection(null, 0); + } + + @Override + protected ListLocationsFixedSizeCollection createCollection( + List pages, int collectionSize) { + return new ListLocationsFixedSizeCollection(pages, collectionSize); + } + } } diff --git a/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2/DocumentsSettings.java b/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2/DocumentsSettings.java index 44bd05325..8852f1f49 100644 --- a/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2/DocumentsSettings.java +++ b/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2/DocumentsSettings.java @@ -17,6 +17,7 @@ package com.google.cloud.dialogflow.v2; import static com.google.cloud.dialogflow.v2.DocumentsClient.ListDocumentsPagedResponse; +import static com.google.cloud.dialogflow.v2.DocumentsClient.ListLocationsPagedResponse; import com.google.api.core.ApiFunction; import com.google.api.core.BetaApi; @@ -32,6 +33,10 @@ import com.google.api.gax.rpc.TransportChannelProvider; import com.google.api.gax.rpc.UnaryCallSettings; import com.google.cloud.dialogflow.v2.stub.DocumentsStubSettings; +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.ListLocationsResponse; +import com.google.cloud.location.Location; import com.google.longrunning.Operation; import com.google.protobuf.Empty; import java.io.IOException; @@ -152,6 +157,17 @@ public UnaryCallSettings exportDocumentSetting return ((DocumentsStubSettings) getStubSettings()).exportDocumentOperationSettings(); } + /** Returns the object with the settings used for calls to listLocations. */ + public PagedCallSettings + listLocationsSettings() { + return ((DocumentsStubSettings) getStubSettings()).listLocationsSettings(); + } + + /** Returns the object with the settings used for calls to getLocation. */ + public UnaryCallSettings getLocationSettings() { + return ((DocumentsStubSettings) getStubSettings()).getLocationSettings(); + } + public static final DocumentsSettings create(DocumentsStubSettings stub) throws IOException { return new DocumentsSettings.Builder(stub.toBuilder()).build(); } @@ -349,6 +365,18 @@ public UnaryCallSettings.Builder exportDocumen return getStubSettingsBuilder().exportDocumentOperationSettings(); } + /** Returns the builder for the settings used for calls to listLocations. */ + public PagedCallSettings.Builder< + ListLocationsRequest, ListLocationsResponse, ListLocationsPagedResponse> + listLocationsSettings() { + return getStubSettingsBuilder().listLocationsSettings(); + } + + /** Returns the builder for the settings used for calls to getLocation. */ + public UnaryCallSettings.Builder getLocationSettings() { + return getStubSettingsBuilder().getLocationSettings(); + } + @Override public DocumentsSettings build() throws IOException { return new DocumentsSettings(this); diff --git a/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2/EntityTypesClient.java b/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2/EntityTypesClient.java index f5a46e17c..03c2c4ad6 100644 --- a/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2/EntityTypesClient.java +++ b/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2/EntityTypesClient.java @@ -30,6 +30,10 @@ import com.google.api.gax.rpc.UnaryCallable; import com.google.cloud.dialogflow.v2.stub.EntityTypesStub; import com.google.cloud.dialogflow.v2.stub.EntityTypesStubSettings; +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.ListLocationsResponse; +import com.google.cloud.location.Location; import com.google.common.util.concurrent.MoreExecutors; import com.google.longrunning.Operation; import com.google.protobuf.Empty; @@ -2277,6 +2281,146 @@ public final UnaryCallable batchDeleteEnt return stub.batchDeleteEntitiesCallable(); } + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Lists information about the supported locations for this service. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
+   * try (EntityTypesClient entityTypesClient = EntityTypesClient.create()) {
+   *   ListLocationsRequest request =
+   *       ListLocationsRequest.newBuilder()
+   *           .setName("name3373707")
+   *           .setFilter("filter-1274492040")
+   *           .setPageSize(883849137)
+   *           .setPageToken("pageToken873572522")
+   *           .build();
+   *   for (Location element : entityTypesClient.listLocations(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 + */ + public final ListLocationsPagedResponse listLocations(ListLocationsRequest request) { + return listLocationsPagedCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Lists information about the supported locations for this service. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
+   * try (EntityTypesClient entityTypesClient = EntityTypesClient.create()) {
+   *   ListLocationsRequest request =
+   *       ListLocationsRequest.newBuilder()
+   *           .setName("name3373707")
+   *           .setFilter("filter-1274492040")
+   *           .setPageSize(883849137)
+   *           .setPageToken("pageToken873572522")
+   *           .build();
+   *   ApiFuture future =
+   *       entityTypesClient.listLocationsPagedCallable().futureCall(request);
+   *   // Do something.
+   *   for (Location element : future.get().iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * }
+ */ + public final UnaryCallable + listLocationsPagedCallable() { + return stub.listLocationsPagedCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Lists information about the supported locations for this service. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
+   * try (EntityTypesClient entityTypesClient = EntityTypesClient.create()) {
+   *   ListLocationsRequest request =
+   *       ListLocationsRequest.newBuilder()
+   *           .setName("name3373707")
+   *           .setFilter("filter-1274492040")
+   *           .setPageSize(883849137)
+   *           .setPageToken("pageToken873572522")
+   *           .build();
+   *   while (true) {
+   *     ListLocationsResponse response = entityTypesClient.listLocationsCallable().call(request);
+   *     for (Location element : response.getLocationsList()) {
+   *       // doThingsWith(element);
+   *     }
+   *     String nextPageToken = response.getNextPageToken();
+   *     if (!Strings.isNullOrEmpty(nextPageToken)) {
+   *       request = request.toBuilder().setPageToken(nextPageToken).build();
+   *     } else {
+   *       break;
+   *     }
+   *   }
+   * }
+   * }
+ */ + public final UnaryCallable listLocationsCallable() { + return stub.listLocationsCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Gets information about a location. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
+   * try (EntityTypesClient entityTypesClient = EntityTypesClient.create()) {
+   *   GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build();
+   *   Location response = entityTypesClient.getLocation(request);
+   * }
+   * }
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final Location getLocation(GetLocationRequest request) { + return getLocationCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Gets information about a location. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
+   * try (EntityTypesClient entityTypesClient = EntityTypesClient.create()) {
+   *   GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build();
+   *   ApiFuture future = entityTypesClient.getLocationCallable().futureCall(request);
+   *   // Do something.
+   *   Location response = future.get();
+   * }
+   * }
+ */ + public final UnaryCallable getLocationCallable() { + return stub.getLocationCallable(); + } + @Override public final void close() { stub.close(); @@ -2383,4 +2527,80 @@ protected ListEntityTypesFixedSizeCollection createCollection( return new ListEntityTypesFixedSizeCollection(pages, collectionSize); } } + + public static class ListLocationsPagedResponse + extends AbstractPagedListResponse< + ListLocationsRequest, + ListLocationsResponse, + Location, + ListLocationsPage, + ListLocationsFixedSizeCollection> { + + public static ApiFuture createAsync( + PageContext context, + ApiFuture futureResponse) { + ApiFuture futurePage = + ListLocationsPage.createEmptyPage().createPageAsync(context, futureResponse); + return ApiFutures.transform( + futurePage, + input -> new ListLocationsPagedResponse(input), + MoreExecutors.directExecutor()); + } + + private ListLocationsPagedResponse(ListLocationsPage page) { + super(page, ListLocationsFixedSizeCollection.createEmptyCollection()); + } + } + + public static class ListLocationsPage + extends AbstractPage< + ListLocationsRequest, ListLocationsResponse, Location, ListLocationsPage> { + + private ListLocationsPage( + PageContext context, + ListLocationsResponse response) { + super(context, response); + } + + private static ListLocationsPage createEmptyPage() { + return new ListLocationsPage(null, null); + } + + @Override + protected ListLocationsPage createPage( + PageContext context, + ListLocationsResponse response) { + return new ListLocationsPage(context, response); + } + + @Override + public ApiFuture createPageAsync( + PageContext context, + ApiFuture futureResponse) { + return super.createPageAsync(context, futureResponse); + } + } + + public static class ListLocationsFixedSizeCollection + extends AbstractFixedSizeCollection< + ListLocationsRequest, + ListLocationsResponse, + Location, + ListLocationsPage, + ListLocationsFixedSizeCollection> { + + private ListLocationsFixedSizeCollection(List pages, int collectionSize) { + super(pages, collectionSize); + } + + private static ListLocationsFixedSizeCollection createEmptyCollection() { + return new ListLocationsFixedSizeCollection(null, 0); + } + + @Override + protected ListLocationsFixedSizeCollection createCollection( + List pages, int collectionSize) { + return new ListLocationsFixedSizeCollection(pages, collectionSize); + } + } } diff --git a/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2/EntityTypesSettings.java b/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2/EntityTypesSettings.java index fe7ef2610..6e84c4eb4 100644 --- a/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2/EntityTypesSettings.java +++ b/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2/EntityTypesSettings.java @@ -17,6 +17,7 @@ package com.google.cloud.dialogflow.v2; import static com.google.cloud.dialogflow.v2.EntityTypesClient.ListEntityTypesPagedResponse; +import static com.google.cloud.dialogflow.v2.EntityTypesClient.ListLocationsPagedResponse; import com.google.api.core.ApiFunction; import com.google.api.core.BetaApi; @@ -32,6 +33,10 @@ import com.google.api.gax.rpc.TransportChannelProvider; import com.google.api.gax.rpc.UnaryCallSettings; import com.google.cloud.dialogflow.v2.stub.EntityTypesStubSettings; +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.ListLocationsResponse; +import com.google.cloud.location.Location; import com.google.longrunning.Operation; import com.google.protobuf.Empty; import com.google.protobuf.Struct; @@ -160,6 +165,17 @@ public UnaryCallSettings batchDeleteEntit return ((EntityTypesStubSettings) getStubSettings()).batchDeleteEntitiesOperationSettings(); } + /** Returns the object with the settings used for calls to listLocations. */ + public PagedCallSettings + listLocationsSettings() { + return ((EntityTypesStubSettings) getStubSettings()).listLocationsSettings(); + } + + /** Returns the object with the settings used for calls to getLocation. */ + public UnaryCallSettings getLocationSettings() { + return ((EntityTypesStubSettings) getStubSettings()).getLocationSettings(); + } + public static final EntityTypesSettings create(EntityTypesStubSettings stub) throws IOException { return new EntityTypesSettings.Builder(stub.toBuilder()).build(); } @@ -364,6 +380,18 @@ public UnaryCallSettings.Builder deleteEntityTyp return getStubSettingsBuilder().batchDeleteEntitiesOperationSettings(); } + /** Returns the builder for the settings used for calls to listLocations. */ + public PagedCallSettings.Builder< + ListLocationsRequest, ListLocationsResponse, ListLocationsPagedResponse> + listLocationsSettings() { + return getStubSettingsBuilder().listLocationsSettings(); + } + + /** Returns the builder for the settings used for calls to getLocation. */ + public UnaryCallSettings.Builder getLocationSettings() { + return getStubSettingsBuilder().getLocationSettings(); + } + @Override public EntityTypesSettings build() throws IOException { return new EntityTypesSettings(this); diff --git a/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2/EnvironmentsClient.java b/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2/EnvironmentsClient.java index 02b5dde5e..62bd6e2e0 100644 --- a/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2/EnvironmentsClient.java +++ b/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2/EnvironmentsClient.java @@ -26,6 +26,10 @@ import com.google.api.gax.rpc.UnaryCallable; import com.google.cloud.dialogflow.v2.stub.EnvironmentsStub; import com.google.cloud.dialogflow.v2.stub.EnvironmentsStubSettings; +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.ListLocationsResponse; +import com.google.cloud.location.Location; import com.google.common.util.concurrent.MoreExecutors; import com.google.protobuf.Empty; import java.io.IOException; @@ -650,6 +654,146 @@ public final GetEnvironmentHistoryPagedResponse getEnvironmentHistory( return stub.getEnvironmentHistoryCallable(); } + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Lists information about the supported locations for this service. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
+   * try (EnvironmentsClient environmentsClient = EnvironmentsClient.create()) {
+   *   ListLocationsRequest request =
+   *       ListLocationsRequest.newBuilder()
+   *           .setName("name3373707")
+   *           .setFilter("filter-1274492040")
+   *           .setPageSize(883849137)
+   *           .setPageToken("pageToken873572522")
+   *           .build();
+   *   for (Location element : environmentsClient.listLocations(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 + */ + public final ListLocationsPagedResponse listLocations(ListLocationsRequest request) { + return listLocationsPagedCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Lists information about the supported locations for this service. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
+   * try (EnvironmentsClient environmentsClient = EnvironmentsClient.create()) {
+   *   ListLocationsRequest request =
+   *       ListLocationsRequest.newBuilder()
+   *           .setName("name3373707")
+   *           .setFilter("filter-1274492040")
+   *           .setPageSize(883849137)
+   *           .setPageToken("pageToken873572522")
+   *           .build();
+   *   ApiFuture future =
+   *       environmentsClient.listLocationsPagedCallable().futureCall(request);
+   *   // Do something.
+   *   for (Location element : future.get().iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * }
+ */ + public final UnaryCallable + listLocationsPagedCallable() { + return stub.listLocationsPagedCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Lists information about the supported locations for this service. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
+   * try (EnvironmentsClient environmentsClient = EnvironmentsClient.create()) {
+   *   ListLocationsRequest request =
+   *       ListLocationsRequest.newBuilder()
+   *           .setName("name3373707")
+   *           .setFilter("filter-1274492040")
+   *           .setPageSize(883849137)
+   *           .setPageToken("pageToken873572522")
+   *           .build();
+   *   while (true) {
+   *     ListLocationsResponse response = environmentsClient.listLocationsCallable().call(request);
+   *     for (Location element : response.getLocationsList()) {
+   *       // doThingsWith(element);
+   *     }
+   *     String nextPageToken = response.getNextPageToken();
+   *     if (!Strings.isNullOrEmpty(nextPageToken)) {
+   *       request = request.toBuilder().setPageToken(nextPageToken).build();
+   *     } else {
+   *       break;
+   *     }
+   *   }
+   * }
+   * }
+ */ + public final UnaryCallable listLocationsCallable() { + return stub.listLocationsCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Gets information about a location. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
+   * try (EnvironmentsClient environmentsClient = EnvironmentsClient.create()) {
+   *   GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build();
+   *   Location response = environmentsClient.getLocation(request);
+   * }
+   * }
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final Location getLocation(GetLocationRequest request) { + return getLocationCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Gets information about a location. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
+   * try (EnvironmentsClient environmentsClient = EnvironmentsClient.create()) {
+   *   GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build();
+   *   ApiFuture future = environmentsClient.getLocationCallable().futureCall(request);
+   *   // Do something.
+   *   Location response = future.get();
+   * }
+   * }
+ */ + public final UnaryCallable getLocationCallable() { + return stub.getLocationCallable(); + } + @Override public final void close() { stub.close(); @@ -840,4 +984,80 @@ protected GetEnvironmentHistoryFixedSizeCollection createCollection( return new GetEnvironmentHistoryFixedSizeCollection(pages, collectionSize); } } + + public static class ListLocationsPagedResponse + extends AbstractPagedListResponse< + ListLocationsRequest, + ListLocationsResponse, + Location, + ListLocationsPage, + ListLocationsFixedSizeCollection> { + + public static ApiFuture createAsync( + PageContext context, + ApiFuture futureResponse) { + ApiFuture futurePage = + ListLocationsPage.createEmptyPage().createPageAsync(context, futureResponse); + return ApiFutures.transform( + futurePage, + input -> new ListLocationsPagedResponse(input), + MoreExecutors.directExecutor()); + } + + private ListLocationsPagedResponse(ListLocationsPage page) { + super(page, ListLocationsFixedSizeCollection.createEmptyCollection()); + } + } + + public static class ListLocationsPage + extends AbstractPage< + ListLocationsRequest, ListLocationsResponse, Location, ListLocationsPage> { + + private ListLocationsPage( + PageContext context, + ListLocationsResponse response) { + super(context, response); + } + + private static ListLocationsPage createEmptyPage() { + return new ListLocationsPage(null, null); + } + + @Override + protected ListLocationsPage createPage( + PageContext context, + ListLocationsResponse response) { + return new ListLocationsPage(context, response); + } + + @Override + public ApiFuture createPageAsync( + PageContext context, + ApiFuture futureResponse) { + return super.createPageAsync(context, futureResponse); + } + } + + public static class ListLocationsFixedSizeCollection + extends AbstractFixedSizeCollection< + ListLocationsRequest, + ListLocationsResponse, + Location, + ListLocationsPage, + ListLocationsFixedSizeCollection> { + + private ListLocationsFixedSizeCollection(List pages, int collectionSize) { + super(pages, collectionSize); + } + + private static ListLocationsFixedSizeCollection createEmptyCollection() { + return new ListLocationsFixedSizeCollection(null, 0); + } + + @Override + protected ListLocationsFixedSizeCollection createCollection( + List pages, int collectionSize) { + return new ListLocationsFixedSizeCollection(pages, collectionSize); + } + } } diff --git a/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2/EnvironmentsSettings.java b/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2/EnvironmentsSettings.java index c631c0d12..1af05b27c 100644 --- a/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2/EnvironmentsSettings.java +++ b/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2/EnvironmentsSettings.java @@ -18,6 +18,7 @@ import static com.google.cloud.dialogflow.v2.EnvironmentsClient.GetEnvironmentHistoryPagedResponse; import static com.google.cloud.dialogflow.v2.EnvironmentsClient.ListEnvironmentsPagedResponse; +import static com.google.cloud.dialogflow.v2.EnvironmentsClient.ListLocationsPagedResponse; import com.google.api.core.ApiFunction; import com.google.api.core.BetaApi; @@ -32,6 +33,10 @@ import com.google.api.gax.rpc.TransportChannelProvider; import com.google.api.gax.rpc.UnaryCallSettings; import com.google.cloud.dialogflow.v2.stub.EnvironmentsStubSettings; +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.ListLocationsResponse; +import com.google.cloud.location.Location; import com.google.protobuf.Empty; import java.io.IOException; import java.util.List; @@ -107,6 +112,17 @@ public UnaryCallSettings deleteEnvironmentSetti return ((EnvironmentsStubSettings) getStubSettings()).getEnvironmentHistorySettings(); } + /** Returns the object with the settings used for calls to listLocations. */ + public PagedCallSettings + listLocationsSettings() { + return ((EnvironmentsStubSettings) getStubSettings()).listLocationsSettings(); + } + + /** Returns the object with the settings used for calls to getLocation. */ + public UnaryCallSettings getLocationSettings() { + return ((EnvironmentsStubSettings) getStubSettings()).getLocationSettings(); + } + public static final EnvironmentsSettings create(EnvironmentsStubSettings stub) throws IOException { return new EnvironmentsSettings.Builder(stub.toBuilder()).build(); @@ -258,6 +274,18 @@ public UnaryCallSettings.Builder deleteEnvironm return getStubSettingsBuilder().getEnvironmentHistorySettings(); } + /** Returns the builder for the settings used for calls to listLocations. */ + public PagedCallSettings.Builder< + ListLocationsRequest, ListLocationsResponse, ListLocationsPagedResponse> + listLocationsSettings() { + return getStubSettingsBuilder().listLocationsSettings(); + } + + /** Returns the builder for the settings used for calls to getLocation. */ + public UnaryCallSettings.Builder getLocationSettings() { + return getStubSettingsBuilder().getLocationSettings(); + } + @Override public EnvironmentsSettings build() throws IOException { return new EnvironmentsSettings(this); diff --git a/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2/FulfillmentsClient.java b/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2/FulfillmentsClient.java index 1d4e170bf..f8a43a1ba 100644 --- a/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2/FulfillmentsClient.java +++ b/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2/FulfillmentsClient.java @@ -16,12 +16,24 @@ package com.google.cloud.dialogflow.v2; +import com.google.api.core.ApiFuture; +import com.google.api.core.ApiFutures; import com.google.api.gax.core.BackgroundResource; +import com.google.api.gax.paging.AbstractFixedSizeCollection; +import com.google.api.gax.paging.AbstractPage; +import com.google.api.gax.paging.AbstractPagedListResponse; +import com.google.api.gax.rpc.PageContext; import com.google.api.gax.rpc.UnaryCallable; import com.google.cloud.dialogflow.v2.stub.FulfillmentsStub; import com.google.cloud.dialogflow.v2.stub.FulfillmentsStubSettings; +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.ListLocationsResponse; +import com.google.cloud.location.Location; +import com.google.common.util.concurrent.MoreExecutors; import com.google.protobuf.FieldMask; import java.io.IOException; +import java.util.List; import java.util.concurrent.TimeUnit; import javax.annotation.Generated; @@ -335,6 +347,146 @@ public final UnaryCallable updateFulfillm return stub.updateFulfillmentCallable(); } + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Lists information about the supported locations for this service. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
+   * try (FulfillmentsClient fulfillmentsClient = FulfillmentsClient.create()) {
+   *   ListLocationsRequest request =
+   *       ListLocationsRequest.newBuilder()
+   *           .setName("name3373707")
+   *           .setFilter("filter-1274492040")
+   *           .setPageSize(883849137)
+   *           .setPageToken("pageToken873572522")
+   *           .build();
+   *   for (Location element : fulfillmentsClient.listLocations(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 + */ + public final ListLocationsPagedResponse listLocations(ListLocationsRequest request) { + return listLocationsPagedCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Lists information about the supported locations for this service. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
+   * try (FulfillmentsClient fulfillmentsClient = FulfillmentsClient.create()) {
+   *   ListLocationsRequest request =
+   *       ListLocationsRequest.newBuilder()
+   *           .setName("name3373707")
+   *           .setFilter("filter-1274492040")
+   *           .setPageSize(883849137)
+   *           .setPageToken("pageToken873572522")
+   *           .build();
+   *   ApiFuture future =
+   *       fulfillmentsClient.listLocationsPagedCallable().futureCall(request);
+   *   // Do something.
+   *   for (Location element : future.get().iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * }
+ */ + public final UnaryCallable + listLocationsPagedCallable() { + return stub.listLocationsPagedCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Lists information about the supported locations for this service. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
+   * try (FulfillmentsClient fulfillmentsClient = FulfillmentsClient.create()) {
+   *   ListLocationsRequest request =
+   *       ListLocationsRequest.newBuilder()
+   *           .setName("name3373707")
+   *           .setFilter("filter-1274492040")
+   *           .setPageSize(883849137)
+   *           .setPageToken("pageToken873572522")
+   *           .build();
+   *   while (true) {
+   *     ListLocationsResponse response = fulfillmentsClient.listLocationsCallable().call(request);
+   *     for (Location element : response.getLocationsList()) {
+   *       // doThingsWith(element);
+   *     }
+   *     String nextPageToken = response.getNextPageToken();
+   *     if (!Strings.isNullOrEmpty(nextPageToken)) {
+   *       request = request.toBuilder().setPageToken(nextPageToken).build();
+   *     } else {
+   *       break;
+   *     }
+   *   }
+   * }
+   * }
+ */ + public final UnaryCallable listLocationsCallable() { + return stub.listLocationsCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Gets information about a location. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
+   * try (FulfillmentsClient fulfillmentsClient = FulfillmentsClient.create()) {
+   *   GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build();
+   *   Location response = fulfillmentsClient.getLocation(request);
+   * }
+   * }
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final Location getLocation(GetLocationRequest request) { + return getLocationCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Gets information about a location. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
+   * try (FulfillmentsClient fulfillmentsClient = FulfillmentsClient.create()) {
+   *   GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build();
+   *   ApiFuture future = fulfillmentsClient.getLocationCallable().futureCall(request);
+   *   // Do something.
+   *   Location response = future.get();
+   * }
+   * }
+ */ + public final UnaryCallable getLocationCallable() { + return stub.getLocationCallable(); + } + @Override public final void close() { stub.close(); @@ -364,4 +516,80 @@ public void shutdownNow() { public boolean awaitTermination(long duration, TimeUnit unit) throws InterruptedException { return stub.awaitTermination(duration, unit); } + + public static class ListLocationsPagedResponse + extends AbstractPagedListResponse< + ListLocationsRequest, + ListLocationsResponse, + Location, + ListLocationsPage, + ListLocationsFixedSizeCollection> { + + public static ApiFuture createAsync( + PageContext context, + ApiFuture futureResponse) { + ApiFuture futurePage = + ListLocationsPage.createEmptyPage().createPageAsync(context, futureResponse); + return ApiFutures.transform( + futurePage, + input -> new ListLocationsPagedResponse(input), + MoreExecutors.directExecutor()); + } + + private ListLocationsPagedResponse(ListLocationsPage page) { + super(page, ListLocationsFixedSizeCollection.createEmptyCollection()); + } + } + + public static class ListLocationsPage + extends AbstractPage< + ListLocationsRequest, ListLocationsResponse, Location, ListLocationsPage> { + + private ListLocationsPage( + PageContext context, + ListLocationsResponse response) { + super(context, response); + } + + private static ListLocationsPage createEmptyPage() { + return new ListLocationsPage(null, null); + } + + @Override + protected ListLocationsPage createPage( + PageContext context, + ListLocationsResponse response) { + return new ListLocationsPage(context, response); + } + + @Override + public ApiFuture createPageAsync( + PageContext context, + ApiFuture futureResponse) { + return super.createPageAsync(context, futureResponse); + } + } + + public static class ListLocationsFixedSizeCollection + extends AbstractFixedSizeCollection< + ListLocationsRequest, + ListLocationsResponse, + Location, + ListLocationsPage, + ListLocationsFixedSizeCollection> { + + private ListLocationsFixedSizeCollection(List pages, int collectionSize) { + super(pages, collectionSize); + } + + private static ListLocationsFixedSizeCollection createEmptyCollection() { + return new ListLocationsFixedSizeCollection(null, 0); + } + + @Override + protected ListLocationsFixedSizeCollection createCollection( + List pages, int collectionSize) { + return new ListLocationsFixedSizeCollection(pages, collectionSize); + } + } } diff --git a/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2/FulfillmentsSettings.java b/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2/FulfillmentsSettings.java index 3a0ccb44a..613bbfc8b 100644 --- a/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2/FulfillmentsSettings.java +++ b/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2/FulfillmentsSettings.java @@ -16,6 +16,8 @@ package com.google.cloud.dialogflow.v2; +import static com.google.cloud.dialogflow.v2.FulfillmentsClient.ListLocationsPagedResponse; + import com.google.api.core.ApiFunction; import com.google.api.core.BetaApi; import com.google.api.gax.core.GoogleCredentialsProvider; @@ -25,9 +27,14 @@ import com.google.api.gax.rpc.ApiClientHeaderProvider; import com.google.api.gax.rpc.ClientContext; import com.google.api.gax.rpc.ClientSettings; +import com.google.api.gax.rpc.PagedCallSettings; import com.google.api.gax.rpc.TransportChannelProvider; import com.google.api.gax.rpc.UnaryCallSettings; import com.google.cloud.dialogflow.v2.stub.FulfillmentsStubSettings; +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.ListLocationsResponse; +import com.google.cloud.location.Location; import java.io.IOException; import java.util.List; import javax.annotation.Generated; @@ -78,6 +85,17 @@ public UnaryCallSettings updateFulfillmen return ((FulfillmentsStubSettings) getStubSettings()).updateFulfillmentSettings(); } + /** Returns the object with the settings used for calls to listLocations. */ + public PagedCallSettings + listLocationsSettings() { + return ((FulfillmentsStubSettings) getStubSettings()).listLocationsSettings(); + } + + /** Returns the object with the settings used for calls to getLocation. */ + public UnaryCallSettings getLocationSettings() { + return ((FulfillmentsStubSettings) getStubSettings()).getLocationSettings(); + } + public static final FulfillmentsSettings create(FulfillmentsStubSettings stub) throws IOException { return new FulfillmentsSettings.Builder(stub.toBuilder()).build(); @@ -204,6 +222,18 @@ public UnaryCallSettings.Builder getFulfillm return getStubSettingsBuilder().updateFulfillmentSettings(); } + /** Returns the builder for the settings used for calls to listLocations. */ + public PagedCallSettings.Builder< + ListLocationsRequest, ListLocationsResponse, ListLocationsPagedResponse> + listLocationsSettings() { + return getStubSettingsBuilder().listLocationsSettings(); + } + + /** Returns the builder for the settings used for calls to getLocation. */ + public UnaryCallSettings.Builder getLocationSettings() { + return getStubSettingsBuilder().getLocationSettings(); + } + @Override public FulfillmentsSettings build() throws IOException { return new FulfillmentsSettings(this); diff --git a/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2/IntentsClient.java b/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2/IntentsClient.java index dcaf53a57..3dc5de626 100644 --- a/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2/IntentsClient.java +++ b/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2/IntentsClient.java @@ -30,6 +30,10 @@ import com.google.api.gax.rpc.UnaryCallable; import com.google.cloud.dialogflow.v2.stub.IntentsStub; import com.google.cloud.dialogflow.v2.stub.IntentsStubSettings; +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.ListLocationsResponse; +import com.google.cloud.location.Location; import com.google.common.util.concurrent.MoreExecutors; import com.google.longrunning.Operation; import com.google.protobuf.Empty; @@ -1544,6 +1548,145 @@ public final UnaryCallable batchDeleteInte return stub.batchDeleteIntentsCallable(); } + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Lists information about the supported locations for this service. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
+   * try (IntentsClient intentsClient = IntentsClient.create()) {
+   *   ListLocationsRequest request =
+   *       ListLocationsRequest.newBuilder()
+   *           .setName("name3373707")
+   *           .setFilter("filter-1274492040")
+   *           .setPageSize(883849137)
+   *           .setPageToken("pageToken873572522")
+   *           .build();
+   *   for (Location element : intentsClient.listLocations(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 + */ + public final ListLocationsPagedResponse listLocations(ListLocationsRequest request) { + return listLocationsPagedCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Lists information about the supported locations for this service. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
+   * try (IntentsClient intentsClient = IntentsClient.create()) {
+   *   ListLocationsRequest request =
+   *       ListLocationsRequest.newBuilder()
+   *           .setName("name3373707")
+   *           .setFilter("filter-1274492040")
+   *           .setPageSize(883849137)
+   *           .setPageToken("pageToken873572522")
+   *           .build();
+   *   ApiFuture future = intentsClient.listLocationsPagedCallable().futureCall(request);
+   *   // Do something.
+   *   for (Location element : future.get().iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * }
+ */ + public final UnaryCallable + listLocationsPagedCallable() { + return stub.listLocationsPagedCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Lists information about the supported locations for this service. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
+   * try (IntentsClient intentsClient = IntentsClient.create()) {
+   *   ListLocationsRequest request =
+   *       ListLocationsRequest.newBuilder()
+   *           .setName("name3373707")
+   *           .setFilter("filter-1274492040")
+   *           .setPageSize(883849137)
+   *           .setPageToken("pageToken873572522")
+   *           .build();
+   *   while (true) {
+   *     ListLocationsResponse response = intentsClient.listLocationsCallable().call(request);
+   *     for (Location element : response.getLocationsList()) {
+   *       // doThingsWith(element);
+   *     }
+   *     String nextPageToken = response.getNextPageToken();
+   *     if (!Strings.isNullOrEmpty(nextPageToken)) {
+   *       request = request.toBuilder().setPageToken(nextPageToken).build();
+   *     } else {
+   *       break;
+   *     }
+   *   }
+   * }
+   * }
+ */ + public final UnaryCallable listLocationsCallable() { + return stub.listLocationsCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Gets information about a location. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
+   * try (IntentsClient intentsClient = IntentsClient.create()) {
+   *   GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build();
+   *   Location response = intentsClient.getLocation(request);
+   * }
+   * }
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final Location getLocation(GetLocationRequest request) { + return getLocationCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Gets information about a location. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
+   * try (IntentsClient intentsClient = IntentsClient.create()) {
+   *   GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build();
+   *   ApiFuture future = intentsClient.getLocationCallable().futureCall(request);
+   *   // Do something.
+   *   Location response = future.get();
+   * }
+   * }
+ */ + public final UnaryCallable getLocationCallable() { + return stub.getLocationCallable(); + } + @Override public final void close() { stub.close(); @@ -1646,4 +1789,80 @@ protected ListIntentsFixedSizeCollection createCollection( return new ListIntentsFixedSizeCollection(pages, collectionSize); } } + + public static class ListLocationsPagedResponse + extends AbstractPagedListResponse< + ListLocationsRequest, + ListLocationsResponse, + Location, + ListLocationsPage, + ListLocationsFixedSizeCollection> { + + public static ApiFuture createAsync( + PageContext context, + ApiFuture futureResponse) { + ApiFuture futurePage = + ListLocationsPage.createEmptyPage().createPageAsync(context, futureResponse); + return ApiFutures.transform( + futurePage, + input -> new ListLocationsPagedResponse(input), + MoreExecutors.directExecutor()); + } + + private ListLocationsPagedResponse(ListLocationsPage page) { + super(page, ListLocationsFixedSizeCollection.createEmptyCollection()); + } + } + + public static class ListLocationsPage + extends AbstractPage< + ListLocationsRequest, ListLocationsResponse, Location, ListLocationsPage> { + + private ListLocationsPage( + PageContext context, + ListLocationsResponse response) { + super(context, response); + } + + private static ListLocationsPage createEmptyPage() { + return new ListLocationsPage(null, null); + } + + @Override + protected ListLocationsPage createPage( + PageContext context, + ListLocationsResponse response) { + return new ListLocationsPage(context, response); + } + + @Override + public ApiFuture createPageAsync( + PageContext context, + ApiFuture futureResponse) { + return super.createPageAsync(context, futureResponse); + } + } + + public static class ListLocationsFixedSizeCollection + extends AbstractFixedSizeCollection< + ListLocationsRequest, + ListLocationsResponse, + Location, + ListLocationsPage, + ListLocationsFixedSizeCollection> { + + private ListLocationsFixedSizeCollection(List pages, int collectionSize) { + super(pages, collectionSize); + } + + private static ListLocationsFixedSizeCollection createEmptyCollection() { + return new ListLocationsFixedSizeCollection(null, 0); + } + + @Override + protected ListLocationsFixedSizeCollection createCollection( + List pages, int collectionSize) { + return new ListLocationsFixedSizeCollection(pages, collectionSize); + } + } } diff --git a/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2/IntentsSettings.java b/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2/IntentsSettings.java index 7669defe3..982b9b39b 100644 --- a/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2/IntentsSettings.java +++ b/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2/IntentsSettings.java @@ -17,6 +17,7 @@ package com.google.cloud.dialogflow.v2; import static com.google.cloud.dialogflow.v2.IntentsClient.ListIntentsPagedResponse; +import static com.google.cloud.dialogflow.v2.IntentsClient.ListLocationsPagedResponse; import com.google.api.core.ApiFunction; import com.google.api.core.BetaApi; @@ -32,6 +33,10 @@ import com.google.api.gax.rpc.TransportChannelProvider; import com.google.api.gax.rpc.UnaryCallSettings; import com.google.cloud.dialogflow.v2.stub.IntentsStubSettings; +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.ListLocationsResponse; +import com.google.cloud.location.Location; import com.google.longrunning.Operation; import com.google.protobuf.Empty; import com.google.protobuf.Struct; @@ -123,6 +128,17 @@ public UnaryCallSettings batchDeleteIntent return ((IntentsStubSettings) getStubSettings()).batchDeleteIntentsOperationSettings(); } + /** Returns the object with the settings used for calls to listLocations. */ + public PagedCallSettings + listLocationsSettings() { + return ((IntentsStubSettings) getStubSettings()).listLocationsSettings(); + } + + /** Returns the object with the settings used for calls to getLocation. */ + public UnaryCallSettings getLocationSettings() { + return ((IntentsStubSettings) getStubSettings()).getLocationSettings(); + } + public static final IntentsSettings create(IntentsStubSettings stub) throws IOException { return new IntentsSettings.Builder(stub.toBuilder()).build(); } @@ -289,6 +305,18 @@ public UnaryCallSettings.Builder deleteIntentSetting return getStubSettingsBuilder().batchDeleteIntentsOperationSettings(); } + /** Returns the builder for the settings used for calls to listLocations. */ + public PagedCallSettings.Builder< + ListLocationsRequest, ListLocationsResponse, ListLocationsPagedResponse> + listLocationsSettings() { + return getStubSettingsBuilder().listLocationsSettings(); + } + + /** Returns the builder for the settings used for calls to getLocation. */ + public UnaryCallSettings.Builder getLocationSettings() { + return getStubSettingsBuilder().getLocationSettings(); + } + @Override public IntentsSettings build() throws IOException { return new IntentsSettings(this); diff --git a/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2/KnowledgeBasesClient.java b/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2/KnowledgeBasesClient.java index c3c9e49b0..38ca82b2a 100644 --- a/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2/KnowledgeBasesClient.java +++ b/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2/KnowledgeBasesClient.java @@ -26,6 +26,10 @@ import com.google.api.gax.rpc.UnaryCallable; import com.google.cloud.dialogflow.v2.stub.KnowledgeBasesStub; import com.google.cloud.dialogflow.v2.stub.KnowledgeBasesStubSettings; +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.ListLocationsResponse; +import com.google.cloud.location.Location; import com.google.common.util.concurrent.MoreExecutors; import com.google.protobuf.Empty; import com.google.protobuf.FieldMask; @@ -793,6 +797,146 @@ public final KnowledgeBase updateKnowledgeBase(UpdateKnowledgeBaseRequest reques return stub.updateKnowledgeBaseCallable(); } + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Lists information about the supported locations for this service. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
+   * try (KnowledgeBasesClient knowledgeBasesClient = KnowledgeBasesClient.create()) {
+   *   ListLocationsRequest request =
+   *       ListLocationsRequest.newBuilder()
+   *           .setName("name3373707")
+   *           .setFilter("filter-1274492040")
+   *           .setPageSize(883849137)
+   *           .setPageToken("pageToken873572522")
+   *           .build();
+   *   for (Location element : knowledgeBasesClient.listLocations(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 + */ + public final ListLocationsPagedResponse listLocations(ListLocationsRequest request) { + return listLocationsPagedCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Lists information about the supported locations for this service. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
+   * try (KnowledgeBasesClient knowledgeBasesClient = KnowledgeBasesClient.create()) {
+   *   ListLocationsRequest request =
+   *       ListLocationsRequest.newBuilder()
+   *           .setName("name3373707")
+   *           .setFilter("filter-1274492040")
+   *           .setPageSize(883849137)
+   *           .setPageToken("pageToken873572522")
+   *           .build();
+   *   ApiFuture future =
+   *       knowledgeBasesClient.listLocationsPagedCallable().futureCall(request);
+   *   // Do something.
+   *   for (Location element : future.get().iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * }
+ */ + public final UnaryCallable + listLocationsPagedCallable() { + return stub.listLocationsPagedCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Lists information about the supported locations for this service. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
+   * try (KnowledgeBasesClient knowledgeBasesClient = KnowledgeBasesClient.create()) {
+   *   ListLocationsRequest request =
+   *       ListLocationsRequest.newBuilder()
+   *           .setName("name3373707")
+   *           .setFilter("filter-1274492040")
+   *           .setPageSize(883849137)
+   *           .setPageToken("pageToken873572522")
+   *           .build();
+   *   while (true) {
+   *     ListLocationsResponse response = knowledgeBasesClient.listLocationsCallable().call(request);
+   *     for (Location element : response.getLocationsList()) {
+   *       // doThingsWith(element);
+   *     }
+   *     String nextPageToken = response.getNextPageToken();
+   *     if (!Strings.isNullOrEmpty(nextPageToken)) {
+   *       request = request.toBuilder().setPageToken(nextPageToken).build();
+   *     } else {
+   *       break;
+   *     }
+   *   }
+   * }
+   * }
+ */ + public final UnaryCallable listLocationsCallable() { + return stub.listLocationsCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Gets information about a location. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
+   * try (KnowledgeBasesClient knowledgeBasesClient = KnowledgeBasesClient.create()) {
+   *   GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build();
+   *   Location response = knowledgeBasesClient.getLocation(request);
+   * }
+   * }
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final Location getLocation(GetLocationRequest request) { + return getLocationCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Gets information about a location. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
+   * try (KnowledgeBasesClient knowledgeBasesClient = KnowledgeBasesClient.create()) {
+   *   GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build();
+   *   ApiFuture future = knowledgeBasesClient.getLocationCallable().futureCall(request);
+   *   // Do something.
+   *   Location response = future.get();
+   * }
+   * }
+ */ + public final UnaryCallable getLocationCallable() { + return stub.getLocationCallable(); + } + @Override public final void close() { stub.close(); @@ -902,4 +1046,80 @@ protected ListKnowledgeBasesFixedSizeCollection createCollection( return new ListKnowledgeBasesFixedSizeCollection(pages, collectionSize); } } + + public static class ListLocationsPagedResponse + extends AbstractPagedListResponse< + ListLocationsRequest, + ListLocationsResponse, + Location, + ListLocationsPage, + ListLocationsFixedSizeCollection> { + + public static ApiFuture createAsync( + PageContext context, + ApiFuture futureResponse) { + ApiFuture futurePage = + ListLocationsPage.createEmptyPage().createPageAsync(context, futureResponse); + return ApiFutures.transform( + futurePage, + input -> new ListLocationsPagedResponse(input), + MoreExecutors.directExecutor()); + } + + private ListLocationsPagedResponse(ListLocationsPage page) { + super(page, ListLocationsFixedSizeCollection.createEmptyCollection()); + } + } + + public static class ListLocationsPage + extends AbstractPage< + ListLocationsRequest, ListLocationsResponse, Location, ListLocationsPage> { + + private ListLocationsPage( + PageContext context, + ListLocationsResponse response) { + super(context, response); + } + + private static ListLocationsPage createEmptyPage() { + return new ListLocationsPage(null, null); + } + + @Override + protected ListLocationsPage createPage( + PageContext context, + ListLocationsResponse response) { + return new ListLocationsPage(context, response); + } + + @Override + public ApiFuture createPageAsync( + PageContext context, + ApiFuture futureResponse) { + return super.createPageAsync(context, futureResponse); + } + } + + public static class ListLocationsFixedSizeCollection + extends AbstractFixedSizeCollection< + ListLocationsRequest, + ListLocationsResponse, + Location, + ListLocationsPage, + ListLocationsFixedSizeCollection> { + + private ListLocationsFixedSizeCollection(List pages, int collectionSize) { + super(pages, collectionSize); + } + + private static ListLocationsFixedSizeCollection createEmptyCollection() { + return new ListLocationsFixedSizeCollection(null, 0); + } + + @Override + protected ListLocationsFixedSizeCollection createCollection( + List pages, int collectionSize) { + return new ListLocationsFixedSizeCollection(pages, collectionSize); + } + } } diff --git a/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2/KnowledgeBasesSettings.java b/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2/KnowledgeBasesSettings.java index a00ddab3a..24737da18 100644 --- a/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2/KnowledgeBasesSettings.java +++ b/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2/KnowledgeBasesSettings.java @@ -17,6 +17,7 @@ package com.google.cloud.dialogflow.v2; import static com.google.cloud.dialogflow.v2.KnowledgeBasesClient.ListKnowledgeBasesPagedResponse; +import static com.google.cloud.dialogflow.v2.KnowledgeBasesClient.ListLocationsPagedResponse; import com.google.api.core.ApiFunction; import com.google.api.core.BetaApi; @@ -31,6 +32,10 @@ import com.google.api.gax.rpc.TransportChannelProvider; import com.google.api.gax.rpc.UnaryCallSettings; import com.google.cloud.dialogflow.v2.stub.KnowledgeBasesStubSettings; +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.ListLocationsResponse; +import com.google.cloud.location.Location; import com.google.protobuf.Empty; import java.io.IOException; import java.util.List; @@ -102,6 +107,17 @@ public UnaryCallSettings deleteKnowledgeBaseS return ((KnowledgeBasesStubSettings) getStubSettings()).updateKnowledgeBaseSettings(); } + /** Returns the object with the settings used for calls to listLocations. */ + public PagedCallSettings + listLocationsSettings() { + return ((KnowledgeBasesStubSettings) getStubSettings()).listLocationsSettings(); + } + + /** Returns the object with the settings used for calls to getLocation. */ + public UnaryCallSettings getLocationSettings() { + return ((KnowledgeBasesStubSettings) getStubSettings()).getLocationSettings(); + } + public static final KnowledgeBasesSettings create(KnowledgeBasesStubSettings stub) throws IOException { return new KnowledgeBasesSettings.Builder(stub.toBuilder()).build(); @@ -248,6 +264,18 @@ public Builder applyToAllUnaryMethods( return getStubSettingsBuilder().updateKnowledgeBaseSettings(); } + /** Returns the builder for the settings used for calls to listLocations. */ + public PagedCallSettings.Builder< + ListLocationsRequest, ListLocationsResponse, ListLocationsPagedResponse> + listLocationsSettings() { + return getStubSettingsBuilder().listLocationsSettings(); + } + + /** Returns the builder for the settings used for calls to getLocation. */ + public UnaryCallSettings.Builder getLocationSettings() { + return getStubSettingsBuilder().getLocationSettings(); + } + @Override public KnowledgeBasesSettings build() throws IOException { return new KnowledgeBasesSettings(this); diff --git a/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2/ParticipantsClient.java b/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2/ParticipantsClient.java index f67f6e1b1..97f2f62b2 100644 --- a/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2/ParticipantsClient.java +++ b/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2/ParticipantsClient.java @@ -26,6 +26,10 @@ import com.google.api.gax.rpc.UnaryCallable; import com.google.cloud.dialogflow.v2.stub.ParticipantsStub; import com.google.cloud.dialogflow.v2.stub.ParticipantsStubSettings; +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.ListLocationsResponse; +import com.google.cloud.location.Location; import com.google.common.util.concurrent.MoreExecutors; import com.google.protobuf.FieldMask; import java.io.IOException; @@ -1246,6 +1250,146 @@ public final SuggestSmartRepliesResponse suggestSmartReplies(SuggestSmartReplies return stub.suggestSmartRepliesCallable(); } + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Lists information about the supported locations for this service. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
+   * try (ParticipantsClient participantsClient = ParticipantsClient.create()) {
+   *   ListLocationsRequest request =
+   *       ListLocationsRequest.newBuilder()
+   *           .setName("name3373707")
+   *           .setFilter("filter-1274492040")
+   *           .setPageSize(883849137)
+   *           .setPageToken("pageToken873572522")
+   *           .build();
+   *   for (Location element : participantsClient.listLocations(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 + */ + public final ListLocationsPagedResponse listLocations(ListLocationsRequest request) { + return listLocationsPagedCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Lists information about the supported locations for this service. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
+   * try (ParticipantsClient participantsClient = ParticipantsClient.create()) {
+   *   ListLocationsRequest request =
+   *       ListLocationsRequest.newBuilder()
+   *           .setName("name3373707")
+   *           .setFilter("filter-1274492040")
+   *           .setPageSize(883849137)
+   *           .setPageToken("pageToken873572522")
+   *           .build();
+   *   ApiFuture future =
+   *       participantsClient.listLocationsPagedCallable().futureCall(request);
+   *   // Do something.
+   *   for (Location element : future.get().iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * }
+ */ + public final UnaryCallable + listLocationsPagedCallable() { + return stub.listLocationsPagedCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Lists information about the supported locations for this service. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
+   * try (ParticipantsClient participantsClient = ParticipantsClient.create()) {
+   *   ListLocationsRequest request =
+   *       ListLocationsRequest.newBuilder()
+   *           .setName("name3373707")
+   *           .setFilter("filter-1274492040")
+   *           .setPageSize(883849137)
+   *           .setPageToken("pageToken873572522")
+   *           .build();
+   *   while (true) {
+   *     ListLocationsResponse response = participantsClient.listLocationsCallable().call(request);
+   *     for (Location element : response.getLocationsList()) {
+   *       // doThingsWith(element);
+   *     }
+   *     String nextPageToken = response.getNextPageToken();
+   *     if (!Strings.isNullOrEmpty(nextPageToken)) {
+   *       request = request.toBuilder().setPageToken(nextPageToken).build();
+   *     } else {
+   *       break;
+   *     }
+   *   }
+   * }
+   * }
+ */ + public final UnaryCallable listLocationsCallable() { + return stub.listLocationsCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Gets information about a location. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
+   * try (ParticipantsClient participantsClient = ParticipantsClient.create()) {
+   *   GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build();
+   *   Location response = participantsClient.getLocation(request);
+   * }
+   * }
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final Location getLocation(GetLocationRequest request) { + return getLocationCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Gets information about a location. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
+   * try (ParticipantsClient participantsClient = ParticipantsClient.create()) {
+   *   GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build();
+   *   ApiFuture future = participantsClient.getLocationCallable().futureCall(request);
+   *   // Do something.
+   *   Location response = future.get();
+   * }
+   * }
+ */ + public final UnaryCallable getLocationCallable() { + return stub.getLocationCallable(); + } + @Override public final void close() { stub.close(); @@ -1352,4 +1496,80 @@ protected ListParticipantsFixedSizeCollection createCollection( return new ListParticipantsFixedSizeCollection(pages, collectionSize); } } + + public static class ListLocationsPagedResponse + extends AbstractPagedListResponse< + ListLocationsRequest, + ListLocationsResponse, + Location, + ListLocationsPage, + ListLocationsFixedSizeCollection> { + + public static ApiFuture createAsync( + PageContext context, + ApiFuture futureResponse) { + ApiFuture futurePage = + ListLocationsPage.createEmptyPage().createPageAsync(context, futureResponse); + return ApiFutures.transform( + futurePage, + input -> new ListLocationsPagedResponse(input), + MoreExecutors.directExecutor()); + } + + private ListLocationsPagedResponse(ListLocationsPage page) { + super(page, ListLocationsFixedSizeCollection.createEmptyCollection()); + } + } + + public static class ListLocationsPage + extends AbstractPage< + ListLocationsRequest, ListLocationsResponse, Location, ListLocationsPage> { + + private ListLocationsPage( + PageContext context, + ListLocationsResponse response) { + super(context, response); + } + + private static ListLocationsPage createEmptyPage() { + return new ListLocationsPage(null, null); + } + + @Override + protected ListLocationsPage createPage( + PageContext context, + ListLocationsResponse response) { + return new ListLocationsPage(context, response); + } + + @Override + public ApiFuture createPageAsync( + PageContext context, + ApiFuture futureResponse) { + return super.createPageAsync(context, futureResponse); + } + } + + public static class ListLocationsFixedSizeCollection + extends AbstractFixedSizeCollection< + ListLocationsRequest, + ListLocationsResponse, + Location, + ListLocationsPage, + ListLocationsFixedSizeCollection> { + + private ListLocationsFixedSizeCollection(List pages, int collectionSize) { + super(pages, collectionSize); + } + + private static ListLocationsFixedSizeCollection createEmptyCollection() { + return new ListLocationsFixedSizeCollection(null, 0); + } + + @Override + protected ListLocationsFixedSizeCollection createCollection( + List pages, int collectionSize) { + return new ListLocationsFixedSizeCollection(pages, collectionSize); + } + } } diff --git a/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2/ParticipantsSettings.java b/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2/ParticipantsSettings.java index 58e1aa501..cc2af47e3 100644 --- a/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2/ParticipantsSettings.java +++ b/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2/ParticipantsSettings.java @@ -16,6 +16,7 @@ package com.google.cloud.dialogflow.v2; +import static com.google.cloud.dialogflow.v2.ParticipantsClient.ListLocationsPagedResponse; import static com.google.cloud.dialogflow.v2.ParticipantsClient.ListParticipantsPagedResponse; import com.google.api.core.ApiFunction; @@ -31,6 +32,10 @@ import com.google.api.gax.rpc.TransportChannelProvider; import com.google.api.gax.rpc.UnaryCallSettings; import com.google.cloud.dialogflow.v2.stub.ParticipantsStubSettings; +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.ListLocationsResponse; +import com.google.cloud.location.Location; import java.io.IOException; import java.util.List; import javax.annotation.Generated; @@ -116,6 +121,17 @@ public UnaryCallSettings analyzeC return ((ParticipantsStubSettings) getStubSettings()).suggestSmartRepliesSettings(); } + /** Returns the object with the settings used for calls to listLocations. */ + public PagedCallSettings + listLocationsSettings() { + return ((ParticipantsStubSettings) getStubSettings()).listLocationsSettings(); + } + + /** Returns the object with the settings used for calls to getLocation. */ + public UnaryCallSettings getLocationSettings() { + return ((ParticipantsStubSettings) getStubSettings()).getLocationSettings(); + } + public static final ParticipantsSettings create(ParticipantsStubSettings stub) throws IOException { return new ParticipantsSettings.Builder(stub.toBuilder()).build(); @@ -279,6 +295,18 @@ public UnaryCallSettings.Builder getParticip return getStubSettingsBuilder().suggestSmartRepliesSettings(); } + /** Returns the builder for the settings used for calls to listLocations. */ + public PagedCallSettings.Builder< + ListLocationsRequest, ListLocationsResponse, ListLocationsPagedResponse> + listLocationsSettings() { + return getStubSettingsBuilder().listLocationsSettings(); + } + + /** Returns the builder for the settings used for calls to getLocation. */ + public UnaryCallSettings.Builder getLocationSettings() { + return getStubSettingsBuilder().getLocationSettings(); + } + @Override public ParticipantsSettings build() throws IOException { return new ParticipantsSettings(this); diff --git a/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2/SessionEntityTypesClient.java b/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2/SessionEntityTypesClient.java index ae01281fa..481effa93 100644 --- a/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2/SessionEntityTypesClient.java +++ b/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2/SessionEntityTypesClient.java @@ -26,6 +26,10 @@ import com.google.api.gax.rpc.UnaryCallable; import com.google.cloud.dialogflow.v2.stub.SessionEntityTypesStub; import com.google.cloud.dialogflow.v2.stub.SessionEntityTypesStubSettings; +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.ListLocationsResponse; +import com.google.cloud.location.Location; import com.google.common.util.concurrent.MoreExecutors; import com.google.protobuf.Empty; import com.google.protobuf.FieldMask; @@ -880,6 +884,148 @@ public final void deleteSessionEntityType(DeleteSessionEntityTypeRequest request return stub.deleteSessionEntityTypeCallable(); } + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Lists information about the supported locations for this service. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
+   * try (SessionEntityTypesClient sessionEntityTypesClient = SessionEntityTypesClient.create()) {
+   *   ListLocationsRequest request =
+   *       ListLocationsRequest.newBuilder()
+   *           .setName("name3373707")
+   *           .setFilter("filter-1274492040")
+   *           .setPageSize(883849137)
+   *           .setPageToken("pageToken873572522")
+   *           .build();
+   *   for (Location element : sessionEntityTypesClient.listLocations(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 + */ + public final ListLocationsPagedResponse listLocations(ListLocationsRequest request) { + return listLocationsPagedCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Lists information about the supported locations for this service. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
+   * try (SessionEntityTypesClient sessionEntityTypesClient = SessionEntityTypesClient.create()) {
+   *   ListLocationsRequest request =
+   *       ListLocationsRequest.newBuilder()
+   *           .setName("name3373707")
+   *           .setFilter("filter-1274492040")
+   *           .setPageSize(883849137)
+   *           .setPageToken("pageToken873572522")
+   *           .build();
+   *   ApiFuture future =
+   *       sessionEntityTypesClient.listLocationsPagedCallable().futureCall(request);
+   *   // Do something.
+   *   for (Location element : future.get().iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * }
+ */ + public final UnaryCallable + listLocationsPagedCallable() { + return stub.listLocationsPagedCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Lists information about the supported locations for this service. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
+   * try (SessionEntityTypesClient sessionEntityTypesClient = SessionEntityTypesClient.create()) {
+   *   ListLocationsRequest request =
+   *       ListLocationsRequest.newBuilder()
+   *           .setName("name3373707")
+   *           .setFilter("filter-1274492040")
+   *           .setPageSize(883849137)
+   *           .setPageToken("pageToken873572522")
+   *           .build();
+   *   while (true) {
+   *     ListLocationsResponse response =
+   *         sessionEntityTypesClient.listLocationsCallable().call(request);
+   *     for (Location element : response.getLocationsList()) {
+   *       // doThingsWith(element);
+   *     }
+   *     String nextPageToken = response.getNextPageToken();
+   *     if (!Strings.isNullOrEmpty(nextPageToken)) {
+   *       request = request.toBuilder().setPageToken(nextPageToken).build();
+   *     } else {
+   *       break;
+   *     }
+   *   }
+   * }
+   * }
+ */ + public final UnaryCallable listLocationsCallable() { + return stub.listLocationsCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Gets information about a location. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
+   * try (SessionEntityTypesClient sessionEntityTypesClient = SessionEntityTypesClient.create()) {
+   *   GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build();
+   *   Location response = sessionEntityTypesClient.getLocation(request);
+   * }
+   * }
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final Location getLocation(GetLocationRequest request) { + return getLocationCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Gets information about a location. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
+   * try (SessionEntityTypesClient sessionEntityTypesClient = SessionEntityTypesClient.create()) {
+   *   GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build();
+   *   ApiFuture future =
+   *       sessionEntityTypesClient.getLocationCallable().futureCall(request);
+   *   // Do something.
+   *   Location response = future.get();
+   * }
+   * }
+ */ + public final UnaryCallable getLocationCallable() { + return stub.getLocationCallable(); + } + @Override public final void close() { stub.close(); @@ -997,4 +1143,80 @@ protected ListSessionEntityTypesFixedSizeCollection createCollection( return new ListSessionEntityTypesFixedSizeCollection(pages, collectionSize); } } + + public static class ListLocationsPagedResponse + extends AbstractPagedListResponse< + ListLocationsRequest, + ListLocationsResponse, + Location, + ListLocationsPage, + ListLocationsFixedSizeCollection> { + + public static ApiFuture createAsync( + PageContext context, + ApiFuture futureResponse) { + ApiFuture futurePage = + ListLocationsPage.createEmptyPage().createPageAsync(context, futureResponse); + return ApiFutures.transform( + futurePage, + input -> new ListLocationsPagedResponse(input), + MoreExecutors.directExecutor()); + } + + private ListLocationsPagedResponse(ListLocationsPage page) { + super(page, ListLocationsFixedSizeCollection.createEmptyCollection()); + } + } + + public static class ListLocationsPage + extends AbstractPage< + ListLocationsRequest, ListLocationsResponse, Location, ListLocationsPage> { + + private ListLocationsPage( + PageContext context, + ListLocationsResponse response) { + super(context, response); + } + + private static ListLocationsPage createEmptyPage() { + return new ListLocationsPage(null, null); + } + + @Override + protected ListLocationsPage createPage( + PageContext context, + ListLocationsResponse response) { + return new ListLocationsPage(context, response); + } + + @Override + public ApiFuture createPageAsync( + PageContext context, + ApiFuture futureResponse) { + return super.createPageAsync(context, futureResponse); + } + } + + public static class ListLocationsFixedSizeCollection + extends AbstractFixedSizeCollection< + ListLocationsRequest, + ListLocationsResponse, + Location, + ListLocationsPage, + ListLocationsFixedSizeCollection> { + + private ListLocationsFixedSizeCollection(List pages, int collectionSize) { + super(pages, collectionSize); + } + + private static ListLocationsFixedSizeCollection createEmptyCollection() { + return new ListLocationsFixedSizeCollection(null, 0); + } + + @Override + protected ListLocationsFixedSizeCollection createCollection( + List pages, int collectionSize) { + return new ListLocationsFixedSizeCollection(pages, collectionSize); + } + } } diff --git a/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2/SessionEntityTypesSettings.java b/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2/SessionEntityTypesSettings.java index be0182518..b254b995c 100644 --- a/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2/SessionEntityTypesSettings.java +++ b/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2/SessionEntityTypesSettings.java @@ -16,6 +16,7 @@ package com.google.cloud.dialogflow.v2; +import static com.google.cloud.dialogflow.v2.SessionEntityTypesClient.ListLocationsPagedResponse; import static com.google.cloud.dialogflow.v2.SessionEntityTypesClient.ListSessionEntityTypesPagedResponse; import com.google.api.core.ApiFunction; @@ -31,6 +32,10 @@ import com.google.api.gax.rpc.TransportChannelProvider; import com.google.api.gax.rpc.UnaryCallSettings; import com.google.cloud.dialogflow.v2.stub.SessionEntityTypesStubSettings; +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.ListLocationsResponse; +import com.google.cloud.location.Location; import com.google.protobuf.Empty; import java.io.IOException; import java.util.List; @@ -107,6 +112,17 @@ public class SessionEntityTypesSettings extends ClientSettings + listLocationsSettings() { + return ((SessionEntityTypesStubSettings) getStubSettings()).listLocationsSettings(); + } + + /** Returns the object with the settings used for calls to getLocation. */ + public UnaryCallSettings getLocationSettings() { + return ((SessionEntityTypesStubSettings) getStubSettings()).getLocationSettings(); + } + public static final SessionEntityTypesSettings create(SessionEntityTypesStubSettings stub) throws IOException { return new SessionEntityTypesSettings.Builder(stub.toBuilder()).build(); @@ -255,6 +271,18 @@ public Builder applyToAllUnaryMethods( return getStubSettingsBuilder().deleteSessionEntityTypeSettings(); } + /** Returns the builder for the settings used for calls to listLocations. */ + public PagedCallSettings.Builder< + ListLocationsRequest, ListLocationsResponse, ListLocationsPagedResponse> + listLocationsSettings() { + return getStubSettingsBuilder().listLocationsSettings(); + } + + /** Returns the builder for the settings used for calls to getLocation. */ + public UnaryCallSettings.Builder getLocationSettings() { + return getStubSettingsBuilder().getLocationSettings(); + } + @Override public SessionEntityTypesSettings build() throws IOException { return new SessionEntityTypesSettings(this); diff --git a/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2/SessionsClient.java b/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2/SessionsClient.java index ce0ee114f..5d625416f 100644 --- a/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2/SessionsClient.java +++ b/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2/SessionsClient.java @@ -16,12 +16,24 @@ package com.google.cloud.dialogflow.v2; +import com.google.api.core.ApiFuture; +import com.google.api.core.ApiFutures; import com.google.api.gax.core.BackgroundResource; +import com.google.api.gax.paging.AbstractFixedSizeCollection; +import com.google.api.gax.paging.AbstractPage; +import com.google.api.gax.paging.AbstractPagedListResponse; import com.google.api.gax.rpc.BidiStreamingCallable; +import com.google.api.gax.rpc.PageContext; import com.google.api.gax.rpc.UnaryCallable; import com.google.cloud.dialogflow.v2.stub.SessionsStub; import com.google.cloud.dialogflow.v2.stub.SessionsStubSettings; +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.ListLocationsResponse; +import com.google.cloud.location.Location; +import com.google.common.util.concurrent.MoreExecutors; import java.io.IOException; +import java.util.List; import java.util.concurrent.TimeUnit; import javax.annotation.Generated; @@ -393,6 +405,145 @@ public final UnaryCallable detectInte return stub.streamingDetectIntentCallable(); } + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Lists information about the supported locations for this service. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
+   * try (SessionsClient sessionsClient = SessionsClient.create()) {
+   *   ListLocationsRequest request =
+   *       ListLocationsRequest.newBuilder()
+   *           .setName("name3373707")
+   *           .setFilter("filter-1274492040")
+   *           .setPageSize(883849137)
+   *           .setPageToken("pageToken873572522")
+   *           .build();
+   *   for (Location element : sessionsClient.listLocations(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 + */ + public final ListLocationsPagedResponse listLocations(ListLocationsRequest request) { + return listLocationsPagedCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Lists information about the supported locations for this service. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
+   * try (SessionsClient sessionsClient = SessionsClient.create()) {
+   *   ListLocationsRequest request =
+   *       ListLocationsRequest.newBuilder()
+   *           .setName("name3373707")
+   *           .setFilter("filter-1274492040")
+   *           .setPageSize(883849137)
+   *           .setPageToken("pageToken873572522")
+   *           .build();
+   *   ApiFuture future = sessionsClient.listLocationsPagedCallable().futureCall(request);
+   *   // Do something.
+   *   for (Location element : future.get().iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * }
+ */ + public final UnaryCallable + listLocationsPagedCallable() { + return stub.listLocationsPagedCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Lists information about the supported locations for this service. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
+   * try (SessionsClient sessionsClient = SessionsClient.create()) {
+   *   ListLocationsRequest request =
+   *       ListLocationsRequest.newBuilder()
+   *           .setName("name3373707")
+   *           .setFilter("filter-1274492040")
+   *           .setPageSize(883849137)
+   *           .setPageToken("pageToken873572522")
+   *           .build();
+   *   while (true) {
+   *     ListLocationsResponse response = sessionsClient.listLocationsCallable().call(request);
+   *     for (Location element : response.getLocationsList()) {
+   *       // doThingsWith(element);
+   *     }
+   *     String nextPageToken = response.getNextPageToken();
+   *     if (!Strings.isNullOrEmpty(nextPageToken)) {
+   *       request = request.toBuilder().setPageToken(nextPageToken).build();
+   *     } else {
+   *       break;
+   *     }
+   *   }
+   * }
+   * }
+ */ + public final UnaryCallable listLocationsCallable() { + return stub.listLocationsCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Gets information about a location. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
+   * try (SessionsClient sessionsClient = SessionsClient.create()) {
+   *   GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build();
+   *   Location response = sessionsClient.getLocation(request);
+   * }
+   * }
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final Location getLocation(GetLocationRequest request) { + return getLocationCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Gets information about a location. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
+   * try (SessionsClient sessionsClient = SessionsClient.create()) {
+   *   GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build();
+   *   ApiFuture future = sessionsClient.getLocationCallable().futureCall(request);
+   *   // Do something.
+   *   Location response = future.get();
+   * }
+   * }
+ */ + public final UnaryCallable getLocationCallable() { + return stub.getLocationCallable(); + } + @Override public final void close() { stub.close(); @@ -422,4 +573,80 @@ public void shutdownNow() { public boolean awaitTermination(long duration, TimeUnit unit) throws InterruptedException { return stub.awaitTermination(duration, unit); } + + public static class ListLocationsPagedResponse + extends AbstractPagedListResponse< + ListLocationsRequest, + ListLocationsResponse, + Location, + ListLocationsPage, + ListLocationsFixedSizeCollection> { + + public static ApiFuture createAsync( + PageContext context, + ApiFuture futureResponse) { + ApiFuture futurePage = + ListLocationsPage.createEmptyPage().createPageAsync(context, futureResponse); + return ApiFutures.transform( + futurePage, + input -> new ListLocationsPagedResponse(input), + MoreExecutors.directExecutor()); + } + + private ListLocationsPagedResponse(ListLocationsPage page) { + super(page, ListLocationsFixedSizeCollection.createEmptyCollection()); + } + } + + public static class ListLocationsPage + extends AbstractPage< + ListLocationsRequest, ListLocationsResponse, Location, ListLocationsPage> { + + private ListLocationsPage( + PageContext context, + ListLocationsResponse response) { + super(context, response); + } + + private static ListLocationsPage createEmptyPage() { + return new ListLocationsPage(null, null); + } + + @Override + protected ListLocationsPage createPage( + PageContext context, + ListLocationsResponse response) { + return new ListLocationsPage(context, response); + } + + @Override + public ApiFuture createPageAsync( + PageContext context, + ApiFuture futureResponse) { + return super.createPageAsync(context, futureResponse); + } + } + + public static class ListLocationsFixedSizeCollection + extends AbstractFixedSizeCollection< + ListLocationsRequest, + ListLocationsResponse, + Location, + ListLocationsPage, + ListLocationsFixedSizeCollection> { + + private ListLocationsFixedSizeCollection(List pages, int collectionSize) { + super(pages, collectionSize); + } + + private static ListLocationsFixedSizeCollection createEmptyCollection() { + return new ListLocationsFixedSizeCollection(null, 0); + } + + @Override + protected ListLocationsFixedSizeCollection createCollection( + List pages, int collectionSize) { + return new ListLocationsFixedSizeCollection(pages, collectionSize); + } + } } diff --git a/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2/SessionsSettings.java b/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2/SessionsSettings.java index b3bcb01f5..b4fdfb84f 100644 --- a/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2/SessionsSettings.java +++ b/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2/SessionsSettings.java @@ -16,6 +16,8 @@ package com.google.cloud.dialogflow.v2; +import static com.google.cloud.dialogflow.v2.SessionsClient.ListLocationsPagedResponse; + import com.google.api.core.ApiFunction; import com.google.api.core.BetaApi; import com.google.api.gax.core.GoogleCredentialsProvider; @@ -25,10 +27,15 @@ import com.google.api.gax.rpc.ApiClientHeaderProvider; import com.google.api.gax.rpc.ClientContext; import com.google.api.gax.rpc.ClientSettings; +import com.google.api.gax.rpc.PagedCallSettings; import com.google.api.gax.rpc.StreamingCallSettings; import com.google.api.gax.rpc.TransportChannelProvider; import com.google.api.gax.rpc.UnaryCallSettings; import com.google.cloud.dialogflow.v2.stub.SessionsStubSettings; +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.ListLocationsResponse; +import com.google.cloud.location.Location; import java.io.IOException; import java.util.List; import javax.annotation.Generated; @@ -80,6 +87,17 @@ public UnaryCallSettings detectIntent return ((SessionsStubSettings) getStubSettings()).streamingDetectIntentSettings(); } + /** Returns the object with the settings used for calls to listLocations. */ + public PagedCallSettings + listLocationsSettings() { + return ((SessionsStubSettings) getStubSettings()).listLocationsSettings(); + } + + /** Returns the object with the settings used for calls to getLocation. */ + public UnaryCallSettings getLocationSettings() { + return ((SessionsStubSettings) getStubSettings()).getLocationSettings(); + } + public static final SessionsSettings create(SessionsStubSettings stub) throws IOException { return new SessionsSettings.Builder(stub.toBuilder()).build(); } @@ -207,6 +225,18 @@ public Builder applyToAllUnaryMethods( return getStubSettingsBuilder().streamingDetectIntentSettings(); } + /** Returns the builder for the settings used for calls to listLocations. */ + public PagedCallSettings.Builder< + ListLocationsRequest, ListLocationsResponse, ListLocationsPagedResponse> + listLocationsSettings() { + return getStubSettingsBuilder().listLocationsSettings(); + } + + /** Returns the builder for the settings used for calls to getLocation. */ + public UnaryCallSettings.Builder getLocationSettings() { + return getStubSettingsBuilder().getLocationSettings(); + } + @Override public SessionsSettings build() throws IOException { return new SessionsSettings(this); diff --git a/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2/VersionsClient.java b/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2/VersionsClient.java index c48aa888e..33d83304e 100644 --- a/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2/VersionsClient.java +++ b/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2/VersionsClient.java @@ -26,6 +26,10 @@ import com.google.api.gax.rpc.UnaryCallable; import com.google.cloud.dialogflow.v2.stub.VersionsStub; import com.google.cloud.dialogflow.v2.stub.VersionsStubSettings; +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.ListLocationsResponse; +import com.google.cloud.location.Location; import com.google.common.util.concurrent.MoreExecutors; import com.google.protobuf.Empty; import com.google.protobuf.FieldMask; @@ -723,6 +727,145 @@ public final UnaryCallable deleteVersionCallable() return stub.deleteVersionCallable(); } + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Lists information about the supported locations for this service. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
+   * try (VersionsClient versionsClient = VersionsClient.create()) {
+   *   ListLocationsRequest request =
+   *       ListLocationsRequest.newBuilder()
+   *           .setName("name3373707")
+   *           .setFilter("filter-1274492040")
+   *           .setPageSize(883849137)
+   *           .setPageToken("pageToken873572522")
+   *           .build();
+   *   for (Location element : versionsClient.listLocations(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 + */ + public final ListLocationsPagedResponse listLocations(ListLocationsRequest request) { + return listLocationsPagedCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Lists information about the supported locations for this service. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
+   * try (VersionsClient versionsClient = VersionsClient.create()) {
+   *   ListLocationsRequest request =
+   *       ListLocationsRequest.newBuilder()
+   *           .setName("name3373707")
+   *           .setFilter("filter-1274492040")
+   *           .setPageSize(883849137)
+   *           .setPageToken("pageToken873572522")
+   *           .build();
+   *   ApiFuture future = versionsClient.listLocationsPagedCallable().futureCall(request);
+   *   // Do something.
+   *   for (Location element : future.get().iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * }
+ */ + public final UnaryCallable + listLocationsPagedCallable() { + return stub.listLocationsPagedCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Lists information about the supported locations for this service. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
+   * try (VersionsClient versionsClient = VersionsClient.create()) {
+   *   ListLocationsRequest request =
+   *       ListLocationsRequest.newBuilder()
+   *           .setName("name3373707")
+   *           .setFilter("filter-1274492040")
+   *           .setPageSize(883849137)
+   *           .setPageToken("pageToken873572522")
+   *           .build();
+   *   while (true) {
+   *     ListLocationsResponse response = versionsClient.listLocationsCallable().call(request);
+   *     for (Location element : response.getLocationsList()) {
+   *       // doThingsWith(element);
+   *     }
+   *     String nextPageToken = response.getNextPageToken();
+   *     if (!Strings.isNullOrEmpty(nextPageToken)) {
+   *       request = request.toBuilder().setPageToken(nextPageToken).build();
+   *     } else {
+   *       break;
+   *     }
+   *   }
+   * }
+   * }
+ */ + public final UnaryCallable listLocationsCallable() { + return stub.listLocationsCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Gets information about a location. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
+   * try (VersionsClient versionsClient = VersionsClient.create()) {
+   *   GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build();
+   *   Location response = versionsClient.getLocation(request);
+   * }
+   * }
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final Location getLocation(GetLocationRequest request) { + return getLocationCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Gets information about a location. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
+   * try (VersionsClient versionsClient = VersionsClient.create()) {
+   *   GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build();
+   *   ApiFuture future = versionsClient.getLocationCallable().futureCall(request);
+   *   // Do something.
+   *   Location response = future.get();
+   * }
+   * }
+ */ + public final UnaryCallable getLocationCallable() { + return stub.getLocationCallable(); + } + @Override public final void close() { stub.close(); @@ -827,4 +970,80 @@ protected ListVersionsFixedSizeCollection createCollection( return new ListVersionsFixedSizeCollection(pages, collectionSize); } } + + public static class ListLocationsPagedResponse + extends AbstractPagedListResponse< + ListLocationsRequest, + ListLocationsResponse, + Location, + ListLocationsPage, + ListLocationsFixedSizeCollection> { + + public static ApiFuture createAsync( + PageContext context, + ApiFuture futureResponse) { + ApiFuture futurePage = + ListLocationsPage.createEmptyPage().createPageAsync(context, futureResponse); + return ApiFutures.transform( + futurePage, + input -> new ListLocationsPagedResponse(input), + MoreExecutors.directExecutor()); + } + + private ListLocationsPagedResponse(ListLocationsPage page) { + super(page, ListLocationsFixedSizeCollection.createEmptyCollection()); + } + } + + public static class ListLocationsPage + extends AbstractPage< + ListLocationsRequest, ListLocationsResponse, Location, ListLocationsPage> { + + private ListLocationsPage( + PageContext context, + ListLocationsResponse response) { + super(context, response); + } + + private static ListLocationsPage createEmptyPage() { + return new ListLocationsPage(null, null); + } + + @Override + protected ListLocationsPage createPage( + PageContext context, + ListLocationsResponse response) { + return new ListLocationsPage(context, response); + } + + @Override + public ApiFuture createPageAsync( + PageContext context, + ApiFuture futureResponse) { + return super.createPageAsync(context, futureResponse); + } + } + + public static class ListLocationsFixedSizeCollection + extends AbstractFixedSizeCollection< + ListLocationsRequest, + ListLocationsResponse, + Location, + ListLocationsPage, + ListLocationsFixedSizeCollection> { + + private ListLocationsFixedSizeCollection(List pages, int collectionSize) { + super(pages, collectionSize); + } + + private static ListLocationsFixedSizeCollection createEmptyCollection() { + return new ListLocationsFixedSizeCollection(null, 0); + } + + @Override + protected ListLocationsFixedSizeCollection createCollection( + List pages, int collectionSize) { + return new ListLocationsFixedSizeCollection(pages, collectionSize); + } + } } diff --git a/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2/VersionsSettings.java b/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2/VersionsSettings.java index 2baeddbc6..1521b7622 100644 --- a/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2/VersionsSettings.java +++ b/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2/VersionsSettings.java @@ -16,6 +16,7 @@ package com.google.cloud.dialogflow.v2; +import static com.google.cloud.dialogflow.v2.VersionsClient.ListLocationsPagedResponse; import static com.google.cloud.dialogflow.v2.VersionsClient.ListVersionsPagedResponse; import com.google.api.core.ApiFunction; @@ -31,6 +32,10 @@ import com.google.api.gax.rpc.TransportChannelProvider; import com.google.api.gax.rpc.UnaryCallSettings; import com.google.cloud.dialogflow.v2.stub.VersionsStubSettings; +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.ListLocationsResponse; +import com.google.cloud.location.Location; import com.google.protobuf.Empty; import java.io.IOException; import java.util.List; @@ -98,6 +103,17 @@ public UnaryCallSettings deleteVersionSettings() { return ((VersionsStubSettings) getStubSettings()).deleteVersionSettings(); } + /** Returns the object with the settings used for calls to listLocations. */ + public PagedCallSettings + listLocationsSettings() { + return ((VersionsStubSettings) getStubSettings()).listLocationsSettings(); + } + + /** Returns the object with the settings used for calls to getLocation. */ + public UnaryCallSettings getLocationSettings() { + return ((VersionsStubSettings) getStubSettings()).getLocationSettings(); + } + public static final VersionsSettings create(VersionsStubSettings stub) throws IOException { return new VersionsSettings.Builder(stub.toBuilder()).build(); } @@ -239,6 +255,18 @@ public UnaryCallSettings.Builder deleteVersionSetti return getStubSettingsBuilder().deleteVersionSettings(); } + /** Returns the builder for the settings used for calls to listLocations. */ + public PagedCallSettings.Builder< + ListLocationsRequest, ListLocationsResponse, ListLocationsPagedResponse> + listLocationsSettings() { + return getStubSettingsBuilder().listLocationsSettings(); + } + + /** Returns the builder for the settings used for calls to getLocation. */ + public UnaryCallSettings.Builder getLocationSettings() { + return getStubSettingsBuilder().getLocationSettings(); + } + @Override public VersionsSettings build() throws IOException { return new VersionsSettings(this); diff --git a/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2/gapic_metadata.json b/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2/gapic_metadata.json index 6e7bfc619..95bab3d6e 100644 --- a/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2/gapic_metadata.json +++ b/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2/gapic_metadata.json @@ -19,12 +19,18 @@ "GetAgent": { "methods": ["getAgent", "getAgent", "getAgent", "getAgent", "getAgentCallable"] }, + "GetLocation": { + "methods": ["getLocation", "getLocationCallable"] + }, "GetValidationResult": { "methods": ["getValidationResult", "getValidationResultCallable"] }, "ImportAgent": { "methods": ["importAgentAsync", "importAgentOperationCallable", "importAgentCallable"] }, + "ListLocations": { + "methods": ["listLocations", "listLocationsPagedCallable", "listLocationsCallable"] + }, "RestoreAgent": { "methods": ["restoreAgentAsync", "restoreAgentOperationCallable", "restoreAgentCallable"] }, @@ -46,9 +52,15 @@ "grpc": { "libraryClient": "AnswerRecordsClient", "rpcs": { + "GetLocation": { + "methods": ["getLocation", "getLocationCallable"] + }, "ListAnswerRecords": { "methods": ["listAnswerRecords", "listAnswerRecords", "listAnswerRecords", "listAnswerRecords", "listAnswerRecordsPagedCallable", "listAnswerRecordsCallable"] }, + "ListLocations": { + "methods": ["listLocations", "listLocationsPagedCallable", "listLocationsCallable"] + }, "UpdateAnswerRecord": { "methods": ["updateAnswerRecord", "updateAnswerRecord", "updateAnswerRecordCallable"] } @@ -73,9 +85,15 @@ "GetContext": { "methods": ["getContext", "getContext", "getContext", "getContextCallable"] }, + "GetLocation": { + "methods": ["getLocation", "getLocationCallable"] + }, "ListContexts": { "methods": ["listContexts", "listContexts", "listContexts", "listContextsPagedCallable", "listContextsCallable"] }, + "ListLocations": { + "methods": ["listLocations", "listLocationsPagedCallable", "listLocationsCallable"] + }, "UpdateContext": { "methods": ["updateContext", "updateContext", "updateContextCallable"] } @@ -97,9 +115,15 @@ "GetConversation": { "methods": ["getConversation", "getConversation", "getConversation", "getConversationCallable"] }, + "GetLocation": { + "methods": ["getLocation", "getLocationCallable"] + }, "ListConversations": { "methods": ["listConversations", "listConversations", "listConversations", "listConversations", "listConversationsPagedCallable", "listConversationsCallable"] }, + "ListLocations": { + "methods": ["listLocations", "listLocationsPagedCallable", "listLocationsCallable"] + }, "ListMessages": { "methods": ["listMessages", "listMessages", "listMessages", "listMessagesPagedCallable", "listMessagesCallable"] } @@ -121,11 +145,17 @@ "GetConversationDataset": { "methods": ["getConversationDataset", "getConversationDataset", "getConversationDataset", "getConversationDatasetCallable"] }, + "GetLocation": { + "methods": ["getLocation", "getLocationCallable"] + }, "ImportConversationData": { "methods": ["importConversationDataAsync", "importConversationDataOperationCallable", "importConversationDataCallable"] }, "ListConversationDatasets": { "methods": ["listConversationDatasets", "listConversationDatasets", "listConversationDatasets", "listConversationDatasetsPagedCallable", "listConversationDatasetsCallable"] + }, + "ListLocations": { + "methods": ["listLocations", "listLocationsPagedCallable", "listLocationsCallable"] } } } @@ -154,12 +184,18 @@ "GetConversationModelEvaluation": { "methods": ["getConversationModelEvaluation", "getConversationModelEvaluation", "getConversationModelEvaluationCallable"] }, + "GetLocation": { + "methods": ["getLocation", "getLocationCallable"] + }, "ListConversationModelEvaluations": { "methods": ["listConversationModelEvaluations", "listConversationModelEvaluations", "listConversationModelEvaluationsPagedCallable", "listConversationModelEvaluationsCallable"] }, "ListConversationModels": { "methods": ["listConversationModels", "listConversationModels", "listConversationModelsPagedCallable", "listConversationModelsCallable"] }, + "ListLocations": { + "methods": ["listLocations", "listLocationsPagedCallable", "listLocationsCallable"] + }, "UndeployConversationModel": { "methods": ["undeployConversationModelAsync", "undeployConversationModelOperationCallable", "undeployConversationModelCallable"] } @@ -184,9 +220,15 @@ "GetConversationProfile": { "methods": ["getConversationProfile", "getConversationProfile", "getConversationProfile", "getConversationProfileCallable"] }, + "GetLocation": { + "methods": ["getLocation", "getLocationCallable"] + }, "ListConversationProfiles": { "methods": ["listConversationProfiles", "listConversationProfiles", "listConversationProfiles", "listConversationProfiles", "listConversationProfilesPagedCallable", "listConversationProfilesCallable"] }, + "ListLocations": { + "methods": ["listLocations", "listLocationsPagedCallable", "listLocationsCallable"] + }, "SetSuggestionFeatureConfig": { "methods": ["setSuggestionFeatureConfigAsync", "setSuggestionFeatureConfigAsync", "setSuggestionFeatureConfigOperationCallable", "setSuggestionFeatureConfigCallable"] }, @@ -214,12 +256,18 @@ "GetDocument": { "methods": ["getDocument", "getDocument", "getDocument", "getDocumentCallable"] }, + "GetLocation": { + "methods": ["getLocation", "getLocationCallable"] + }, "ImportDocuments": { "methods": ["importDocumentsAsync", "importDocumentsOperationCallable", "importDocumentsCallable"] }, "ListDocuments": { "methods": ["listDocuments", "listDocuments", "listDocuments", "listDocumentsPagedCallable", "listDocumentsCallable"] }, + "ListLocations": { + "methods": ["listLocations", "listLocationsPagedCallable", "listLocationsCallable"] + }, "ReloadDocument": { "methods": ["reloadDocumentAsync", "reloadDocumentAsync", "reloadDocumentAsync", "reloadDocumentOperationCallable", "reloadDocumentCallable"] }, @@ -259,9 +307,15 @@ "GetEntityType": { "methods": ["getEntityType", "getEntityType", "getEntityType", "getEntityType", "getEntityType", "getEntityTypeCallable"] }, + "GetLocation": { + "methods": ["getLocation", "getLocationCallable"] + }, "ListEntityTypes": { "methods": ["listEntityTypes", "listEntityTypes", "listEntityTypes", "listEntityTypes", "listEntityTypes", "listEntityTypesPagedCallable", "listEntityTypesCallable"] }, + "ListLocations": { + "methods": ["listLocations", "listLocationsPagedCallable", "listLocationsCallable"] + }, "UpdateEntityType": { "methods": ["updateEntityType", "updateEntityType", "updateEntityType", "updateEntityTypeCallable"] } @@ -286,9 +340,15 @@ "GetEnvironmentHistory": { "methods": ["getEnvironmentHistory", "getEnvironmentHistoryPagedCallable", "getEnvironmentHistoryCallable"] }, + "GetLocation": { + "methods": ["getLocation", "getLocationCallable"] + }, "ListEnvironments": { "methods": ["listEnvironments", "listEnvironments", "listEnvironments", "listEnvironmentsPagedCallable", "listEnvironmentsCallable"] }, + "ListLocations": { + "methods": ["listLocations", "listLocationsPagedCallable", "listLocationsCallable"] + }, "UpdateEnvironment": { "methods": ["updateEnvironment", "updateEnvironmentCallable"] } @@ -304,6 +364,12 @@ "GetFulfillment": { "methods": ["getFulfillment", "getFulfillment", "getFulfillment", "getFulfillmentCallable"] }, + "GetLocation": { + "methods": ["getLocation", "getLocationCallable"] + }, + "ListLocations": { + "methods": ["listLocations", "listLocationsPagedCallable", "listLocationsCallable"] + }, "UpdateFulfillment": { "methods": ["updateFulfillment", "updateFulfillment", "updateFulfillmentCallable"] } @@ -331,9 +397,15 @@ "GetIntent": { "methods": ["getIntent", "getIntent", "getIntent", "getIntent", "getIntent", "getIntentCallable"] }, + "GetLocation": { + "methods": ["getLocation", "getLocationCallable"] + }, "ListIntents": { "methods": ["listIntents", "listIntents", "listIntents", "listIntents", "listIntents", "listIntentsPagedCallable", "listIntentsCallable"] }, + "ListLocations": { + "methods": ["listLocations", "listLocationsPagedCallable", "listLocationsCallable"] + }, "UpdateIntent": { "methods": ["updateIntent", "updateIntent", "updateIntent", "updateIntentCallable"] } @@ -355,9 +427,15 @@ "GetKnowledgeBase": { "methods": ["getKnowledgeBase", "getKnowledgeBase", "getKnowledgeBase", "getKnowledgeBaseCallable"] }, + "GetLocation": { + "methods": ["getLocation", "getLocationCallable"] + }, "ListKnowledgeBases": { "methods": ["listKnowledgeBases", "listKnowledgeBases", "listKnowledgeBases", "listKnowledgeBases", "listKnowledgeBasesPagedCallable", "listKnowledgeBasesCallable"] }, + "ListLocations": { + "methods": ["listLocations", "listLocationsPagedCallable", "listLocationsCallable"] + }, "UpdateKnowledgeBase": { "methods": ["updateKnowledgeBase", "updateKnowledgeBase", "updateKnowledgeBaseCallable"] } @@ -376,9 +454,15 @@ "CreateParticipant": { "methods": ["createParticipant", "createParticipant", "createParticipant", "createParticipantCallable"] }, + "GetLocation": { + "methods": ["getLocation", "getLocationCallable"] + }, "GetParticipant": { "methods": ["getParticipant", "getParticipant", "getParticipant", "getParticipantCallable"] }, + "ListLocations": { + "methods": ["listLocations", "listLocationsPagedCallable", "listLocationsCallable"] + }, "ListParticipants": { "methods": ["listParticipants", "listParticipants", "listParticipants", "listParticipantsPagedCallable", "listParticipantsCallable"] }, @@ -406,6 +490,12 @@ "DetectIntent": { "methods": ["detectIntent", "detectIntent", "detectIntent", "detectIntentCallable"] }, + "GetLocation": { + "methods": ["getLocation", "getLocationCallable"] + }, + "ListLocations": { + "methods": ["listLocations", "listLocationsPagedCallable", "listLocationsCallable"] + }, "StreamingDetectIntent": { "methods": ["streamingDetectIntentCallable"] } @@ -424,9 +514,15 @@ "DeleteSessionEntityType": { "methods": ["deleteSessionEntityType", "deleteSessionEntityType", "deleteSessionEntityType", "deleteSessionEntityTypeCallable"] }, + "GetLocation": { + "methods": ["getLocation", "getLocationCallable"] + }, "GetSessionEntityType": { "methods": ["getSessionEntityType", "getSessionEntityType", "getSessionEntityType", "getSessionEntityTypeCallable"] }, + "ListLocations": { + "methods": ["listLocations", "listLocationsPagedCallable", "listLocationsCallable"] + }, "ListSessionEntityTypes": { "methods": ["listSessionEntityTypes", "listSessionEntityTypes", "listSessionEntityTypes", "listSessionEntityTypesPagedCallable", "listSessionEntityTypesCallable"] }, @@ -448,9 +544,15 @@ "DeleteVersion": { "methods": ["deleteVersion", "deleteVersion", "deleteVersion", "deleteVersionCallable"] }, + "GetLocation": { + "methods": ["getLocation", "getLocationCallable"] + }, "GetVersion": { "methods": ["getVersion", "getVersion", "getVersion", "getVersionCallable"] }, + "ListLocations": { + "methods": ["listLocations", "listLocationsPagedCallable", "listLocationsCallable"] + }, "ListVersions": { "methods": ["listVersions", "listVersions", "listVersions", "listVersionsPagedCallable", "listVersionsCallable"] }, diff --git a/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2/stub/AgentsStub.java b/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2/stub/AgentsStub.java index 443098ca4..f34c4b0df 100644 --- a/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2/stub/AgentsStub.java +++ b/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2/stub/AgentsStub.java @@ -16,6 +16,7 @@ package com.google.cloud.dialogflow.v2.stub; +import static com.google.cloud.dialogflow.v2.AgentsClient.ListLocationsPagedResponse; import static com.google.cloud.dialogflow.v2.AgentsClient.SearchAgentsPagedResponse; import com.google.api.gax.core.BackgroundResource; @@ -34,6 +35,10 @@ import com.google.cloud.dialogflow.v2.SetAgentRequest; import com.google.cloud.dialogflow.v2.TrainAgentRequest; import com.google.cloud.dialogflow.v2.ValidationResult; +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.ListLocationsResponse; +import com.google.cloud.location.Location; import com.google.longrunning.Operation; import com.google.longrunning.stub.OperationsStub; import com.google.protobuf.Empty; @@ -114,6 +119,19 @@ public UnaryCallable getValidation throw new UnsupportedOperationException("Not implemented: getValidationResultCallable()"); } + public UnaryCallable + listLocationsPagedCallable() { + throw new UnsupportedOperationException("Not implemented: listLocationsPagedCallable()"); + } + + public UnaryCallable listLocationsCallable() { + throw new UnsupportedOperationException("Not implemented: listLocationsCallable()"); + } + + public UnaryCallable getLocationCallable() { + throw new UnsupportedOperationException("Not implemented: getLocationCallable()"); + } + @Override public abstract void close(); } diff --git a/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2/stub/AgentsStubSettings.java b/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2/stub/AgentsStubSettings.java index d3b16798b..2f1256b6a 100644 --- a/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2/stub/AgentsStubSettings.java +++ b/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2/stub/AgentsStubSettings.java @@ -16,6 +16,7 @@ package com.google.cloud.dialogflow.v2.stub; +import static com.google.cloud.dialogflow.v2.AgentsClient.ListLocationsPagedResponse; import static com.google.cloud.dialogflow.v2.AgentsClient.SearchAgentsPagedResponse; import com.google.api.core.ApiFunction; @@ -60,6 +61,10 @@ import com.google.cloud.dialogflow.v2.SetAgentRequest; import com.google.cloud.dialogflow.v2.TrainAgentRequest; import com.google.cloud.dialogflow.v2.ValidationResult; +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.ListLocationsResponse; +import com.google.cloud.location.Location; import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableMap; import com.google.common.collect.ImmutableSet; @@ -133,6 +138,10 @@ public class AgentsStubSettings extends StubSettings { restoreAgentOperationSettings; private final UnaryCallSettings getValidationResultSettings; + private final PagedCallSettings< + ListLocationsRequest, ListLocationsResponse, ListLocationsPagedResponse> + listLocationsSettings; + private final UnaryCallSettings getLocationSettings; private static final PagedListDescriptor SEARCH_AGENTS_PAGE_STR_DESC = @@ -170,6 +179,42 @@ public Iterable extractResources(SearchAgentsResponse payload) { } }; + private static final PagedListDescriptor + LIST_LOCATIONS_PAGE_STR_DESC = + new PagedListDescriptor() { + @Override + public String emptyToken() { + return ""; + } + + @Override + public ListLocationsRequest injectToken(ListLocationsRequest payload, String token) { + return ListLocationsRequest.newBuilder(payload).setPageToken(token).build(); + } + + @Override + public ListLocationsRequest injectPageSize(ListLocationsRequest payload, int pageSize) { + return ListLocationsRequest.newBuilder(payload).setPageSize(pageSize).build(); + } + + @Override + public Integer extractPageSize(ListLocationsRequest payload) { + return payload.getPageSize(); + } + + @Override + public String extractNextToken(ListLocationsResponse payload) { + return payload.getNextPageToken(); + } + + @Override + public Iterable extractResources(ListLocationsResponse payload) { + return payload.getLocationsList() == null + ? ImmutableList.of() + : payload.getLocationsList(); + } + }; + private static final PagedListResponseFactory< SearchAgentsRequest, SearchAgentsResponse, SearchAgentsPagedResponse> SEARCH_AGENTS_PAGE_STR_FACT = @@ -187,6 +232,23 @@ public ApiFuture getFuturePagedResponse( } }; + private static final PagedListResponseFactory< + ListLocationsRequest, ListLocationsResponse, ListLocationsPagedResponse> + LIST_LOCATIONS_PAGE_STR_FACT = + new PagedListResponseFactory< + ListLocationsRequest, ListLocationsResponse, ListLocationsPagedResponse>() { + @Override + public ApiFuture getFuturePagedResponse( + UnaryCallable callable, + ListLocationsRequest request, + ApiCallContext context, + ApiFuture futureResponse) { + PageContext pageContext = + PageContext.create(callable, LIST_LOCATIONS_PAGE_STR_DESC, request, context); + return ListLocationsPagedResponse.createAsync(pageContext, futureResponse); + } + }; + /** Returns the object with the settings used for calls to getAgent. */ public UnaryCallSettings getAgentSettings() { return getAgentSettings; @@ -255,6 +317,17 @@ public OperationCallSettings restoreAgentOpe return getValidationResultSettings; } + /** Returns the object with the settings used for calls to listLocations. */ + public PagedCallSettings + listLocationsSettings() { + return listLocationsSettings; + } + + /** Returns the object with the settings used for calls to getLocation. */ + public UnaryCallSettings getLocationSettings() { + return getLocationSettings; + } + public AgentsStub createStub() throws IOException { if (getTransportChannelProvider() .getTransportName() @@ -372,6 +445,8 @@ protected AgentsStubSettings(Builder settingsBuilder) throws IOException { restoreAgentSettings = settingsBuilder.restoreAgentSettings().build(); restoreAgentOperationSettings = settingsBuilder.restoreAgentOperationSettings().build(); getValidationResultSettings = settingsBuilder.getValidationResultSettings().build(); + listLocationsSettings = settingsBuilder.listLocationsSettings().build(); + getLocationSettings = settingsBuilder.getLocationSettings().build(); } /** Builder for AgentsStubSettings. */ @@ -397,6 +472,10 @@ public static class Builder extends StubSettings.Builder getValidationResultSettings; + private final PagedCallSettings.Builder< + ListLocationsRequest, ListLocationsResponse, ListLocationsPagedResponse> + listLocationsSettings; + private final UnaryCallSettings.Builder getLocationSettings; private static final ImmutableMap> RETRYABLE_CODE_DEFINITIONS; @@ -448,6 +527,8 @@ protected Builder(ClientContext clientContext) { restoreAgentSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); restoreAgentOperationSettings = OperationCallSettings.newBuilder(); getValidationResultSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + listLocationsSettings = PagedCallSettings.newBuilder(LIST_LOCATIONS_PAGE_STR_FACT); + getLocationSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); unaryMethodSettingsBuilders = ImmutableList.>of( @@ -459,7 +540,9 @@ protected Builder(ClientContext clientContext) { exportAgentSettings, importAgentSettings, restoreAgentSettings, - getValidationResultSettings); + getValidationResultSettings, + listLocationsSettings, + getLocationSettings); initDefaults(this); } @@ -479,6 +562,8 @@ protected Builder(AgentsStubSettings settings) { restoreAgentSettings = settings.restoreAgentSettings.toBuilder(); restoreAgentOperationSettings = settings.restoreAgentOperationSettings.toBuilder(); getValidationResultSettings = settings.getValidationResultSettings.toBuilder(); + listLocationsSettings = settings.listLocationsSettings.toBuilder(); + getLocationSettings = settings.getLocationSettings.toBuilder(); unaryMethodSettingsBuilders = ImmutableList.>of( @@ -490,7 +575,9 @@ protected Builder(AgentsStubSettings settings) { exportAgentSettings, importAgentSettings, restoreAgentSettings, - getValidationResultSettings); + getValidationResultSettings, + listLocationsSettings, + getLocationSettings); } private static Builder createDefault() { @@ -565,6 +652,16 @@ private static Builder initDefaults(Builder builder) { .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes")) .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params")); + builder + .listLocationsSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params")); + + builder + .getLocationSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params")); + builder .trainAgentOperationSettings() .setInitialCallSettings( @@ -756,6 +853,18 @@ public UnaryCallSettings.Builder restoreAgentSet return getValidationResultSettings; } + /** Returns the builder for the settings used for calls to listLocations. */ + public PagedCallSettings.Builder< + ListLocationsRequest, ListLocationsResponse, ListLocationsPagedResponse> + listLocationsSettings() { + return listLocationsSettings; + } + + /** Returns the builder for the settings used for calls to getLocation. */ + public UnaryCallSettings.Builder getLocationSettings() { + return getLocationSettings; + } + @Override public AgentsStubSettings build() throws IOException { return new AgentsStubSettings(this); diff --git a/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2/stub/AnswerRecordsStub.java b/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2/stub/AnswerRecordsStub.java index 07890785c..50b8483ee 100644 --- a/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2/stub/AnswerRecordsStub.java +++ b/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2/stub/AnswerRecordsStub.java @@ -17,6 +17,7 @@ package com.google.cloud.dialogflow.v2.stub; import static com.google.cloud.dialogflow.v2.AnswerRecordsClient.ListAnswerRecordsPagedResponse; +import static com.google.cloud.dialogflow.v2.AnswerRecordsClient.ListLocationsPagedResponse; import com.google.api.gax.core.BackgroundResource; import com.google.api.gax.rpc.UnaryCallable; @@ -24,6 +25,10 @@ import com.google.cloud.dialogflow.v2.ListAnswerRecordsRequest; import com.google.cloud.dialogflow.v2.ListAnswerRecordsResponse; import com.google.cloud.dialogflow.v2.UpdateAnswerRecordRequest; +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.ListLocationsResponse; +import com.google.cloud.location.Location; import javax.annotation.Generated; // AUTO-GENERATED DOCUMENTATION AND CLASS. @@ -49,6 +54,19 @@ public UnaryCallable updateAnswerRecord throw new UnsupportedOperationException("Not implemented: updateAnswerRecordCallable()"); } + public UnaryCallable + listLocationsPagedCallable() { + throw new UnsupportedOperationException("Not implemented: listLocationsPagedCallable()"); + } + + public UnaryCallable listLocationsCallable() { + throw new UnsupportedOperationException("Not implemented: listLocationsCallable()"); + } + + public UnaryCallable getLocationCallable() { + throw new UnsupportedOperationException("Not implemented: getLocationCallable()"); + } + @Override public abstract void close(); } diff --git a/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2/stub/AnswerRecordsStubSettings.java b/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2/stub/AnswerRecordsStubSettings.java index aac13ca3d..eb5f60ace 100644 --- a/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2/stub/AnswerRecordsStubSettings.java +++ b/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2/stub/AnswerRecordsStubSettings.java @@ -17,6 +17,7 @@ package com.google.cloud.dialogflow.v2.stub; import static com.google.cloud.dialogflow.v2.AnswerRecordsClient.ListAnswerRecordsPagedResponse; +import static com.google.cloud.dialogflow.v2.AnswerRecordsClient.ListLocationsPagedResponse; import com.google.api.core.ApiFunction; import com.google.api.core.ApiFuture; @@ -47,6 +48,10 @@ import com.google.cloud.dialogflow.v2.ListAnswerRecordsRequest; import com.google.cloud.dialogflow.v2.ListAnswerRecordsResponse; import com.google.cloud.dialogflow.v2.UpdateAnswerRecordRequest; +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.ListLocationsResponse; +import com.google.cloud.location.Location; import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableMap; import com.google.common.collect.ImmutableSet; @@ -104,6 +109,10 @@ public class AnswerRecordsStubSettings extends StubSettings updateAnswerRecordSettings; + private final PagedCallSettings< + ListLocationsRequest, ListLocationsResponse, ListLocationsPagedResponse> + listLocationsSettings; + private final UnaryCallSettings getLocationSettings; private static final PagedListDescriptor< ListAnswerRecordsRequest, ListAnswerRecordsResponse, AnswerRecord> @@ -145,6 +154,42 @@ public Iterable extractResources(ListAnswerRecordsResponse payload } }; + private static final PagedListDescriptor + LIST_LOCATIONS_PAGE_STR_DESC = + new PagedListDescriptor() { + @Override + public String emptyToken() { + return ""; + } + + @Override + public ListLocationsRequest injectToken(ListLocationsRequest payload, String token) { + return ListLocationsRequest.newBuilder(payload).setPageToken(token).build(); + } + + @Override + public ListLocationsRequest injectPageSize(ListLocationsRequest payload, int pageSize) { + return ListLocationsRequest.newBuilder(payload).setPageSize(pageSize).build(); + } + + @Override + public Integer extractPageSize(ListLocationsRequest payload) { + return payload.getPageSize(); + } + + @Override + public String extractNextToken(ListLocationsResponse payload) { + return payload.getNextPageToken(); + } + + @Override + public Iterable extractResources(ListLocationsResponse payload) { + return payload.getLocationsList() == null + ? ImmutableList.of() + : payload.getLocationsList(); + } + }; + private static final PagedListResponseFactory< ListAnswerRecordsRequest, ListAnswerRecordsResponse, ListAnswerRecordsPagedResponse> LIST_ANSWER_RECORDS_PAGE_STR_FACT = @@ -166,6 +211,23 @@ public ApiFuture getFuturePagedResponse( } }; + private static final PagedListResponseFactory< + ListLocationsRequest, ListLocationsResponse, ListLocationsPagedResponse> + LIST_LOCATIONS_PAGE_STR_FACT = + new PagedListResponseFactory< + ListLocationsRequest, ListLocationsResponse, ListLocationsPagedResponse>() { + @Override + public ApiFuture getFuturePagedResponse( + UnaryCallable callable, + ListLocationsRequest request, + ApiCallContext context, + ApiFuture futureResponse) { + PageContext pageContext = + PageContext.create(callable, LIST_LOCATIONS_PAGE_STR_DESC, request, context); + return ListLocationsPagedResponse.createAsync(pageContext, futureResponse); + } + }; + /** Returns the object with the settings used for calls to listAnswerRecords. */ public PagedCallSettings< ListAnswerRecordsRequest, ListAnswerRecordsResponse, ListAnswerRecordsPagedResponse> @@ -178,6 +240,17 @@ public UnaryCallSettings updateAnswerRe return updateAnswerRecordSettings; } + /** Returns the object with the settings used for calls to listLocations. */ + public PagedCallSettings + listLocationsSettings() { + return listLocationsSettings; + } + + /** Returns the object with the settings used for calls to getLocation. */ + public UnaryCallSettings getLocationSettings() { + return getLocationSettings; + } + public AnswerRecordsStub createStub() throws IOException { if (getTransportChannelProvider() .getTransportName() @@ -286,6 +359,8 @@ protected AnswerRecordsStubSettings(Builder settingsBuilder) throws IOException listAnswerRecordsSettings = settingsBuilder.listAnswerRecordsSettings().build(); updateAnswerRecordSettings = settingsBuilder.updateAnswerRecordSettings().build(); + listLocationsSettings = settingsBuilder.listLocationsSettings().build(); + getLocationSettings = settingsBuilder.getLocationSettings().build(); } /** Builder for AnswerRecordsStubSettings. */ @@ -296,6 +371,10 @@ public static class Builder extends StubSettings.Builder updateAnswerRecordSettings; + private final PagedCallSettings.Builder< + ListLocationsRequest, ListLocationsResponse, ListLocationsPagedResponse> + listLocationsSettings; + private final UnaryCallSettings.Builder getLocationSettings; private static final ImmutableMap> RETRYABLE_CODE_DEFINITIONS; @@ -336,10 +415,15 @@ protected Builder(ClientContext clientContext) { listAnswerRecordsSettings = PagedCallSettings.newBuilder(LIST_ANSWER_RECORDS_PAGE_STR_FACT); updateAnswerRecordSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + listLocationsSettings = PagedCallSettings.newBuilder(LIST_LOCATIONS_PAGE_STR_FACT); + getLocationSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); unaryMethodSettingsBuilders = ImmutableList.>of( - listAnswerRecordsSettings, updateAnswerRecordSettings); + listAnswerRecordsSettings, + updateAnswerRecordSettings, + listLocationsSettings, + getLocationSettings); initDefaults(this); } @@ -348,10 +432,15 @@ protected Builder(AnswerRecordsStubSettings settings) { listAnswerRecordsSettings = settings.listAnswerRecordsSettings.toBuilder(); updateAnswerRecordSettings = settings.updateAnswerRecordSettings.toBuilder(); + listLocationsSettings = settings.listLocationsSettings.toBuilder(); + getLocationSettings = settings.getLocationSettings.toBuilder(); unaryMethodSettingsBuilders = ImmutableList.>of( - listAnswerRecordsSettings, updateAnswerRecordSettings); + listAnswerRecordsSettings, + updateAnswerRecordSettings, + listLocationsSettings, + getLocationSettings); } private static Builder createDefault() { @@ -391,6 +480,16 @@ private static Builder initDefaults(Builder builder) { .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes")) .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params")); + builder + .listLocationsSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params")); + + builder + .getLocationSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params")); + return builder; } @@ -422,6 +521,18 @@ public Builder applyToAllUnaryMethods( return updateAnswerRecordSettings; } + /** Returns the builder for the settings used for calls to listLocations. */ + public PagedCallSettings.Builder< + ListLocationsRequest, ListLocationsResponse, ListLocationsPagedResponse> + listLocationsSettings() { + return listLocationsSettings; + } + + /** Returns the builder for the settings used for calls to getLocation. */ + public UnaryCallSettings.Builder getLocationSettings() { + return getLocationSettings; + } + @Override public AnswerRecordsStubSettings build() throws IOException { return new AnswerRecordsStubSettings(this); diff --git a/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2/stub/ContextsStub.java b/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2/stub/ContextsStub.java index 3e05d8f2b..802db350c 100644 --- a/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2/stub/ContextsStub.java +++ b/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2/stub/ContextsStub.java @@ -17,6 +17,7 @@ package com.google.cloud.dialogflow.v2.stub; import static com.google.cloud.dialogflow.v2.ContextsClient.ListContextsPagedResponse; +import static com.google.cloud.dialogflow.v2.ContextsClient.ListLocationsPagedResponse; import com.google.api.gax.core.BackgroundResource; import com.google.api.gax.rpc.UnaryCallable; @@ -28,6 +29,10 @@ import com.google.cloud.dialogflow.v2.ListContextsRequest; import com.google.cloud.dialogflow.v2.ListContextsResponse; import com.google.cloud.dialogflow.v2.UpdateContextRequest; +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.ListLocationsResponse; +import com.google.cloud.location.Location; import com.google.protobuf.Empty; import javax.annotation.Generated; @@ -68,6 +73,19 @@ public UnaryCallable deleteAllContextsCallable( throw new UnsupportedOperationException("Not implemented: deleteAllContextsCallable()"); } + public UnaryCallable + listLocationsPagedCallable() { + throw new UnsupportedOperationException("Not implemented: listLocationsPagedCallable()"); + } + + public UnaryCallable listLocationsCallable() { + throw new UnsupportedOperationException("Not implemented: listLocationsCallable()"); + } + + public UnaryCallable getLocationCallable() { + throw new UnsupportedOperationException("Not implemented: getLocationCallable()"); + } + @Override public abstract void close(); } diff --git a/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2/stub/ContextsStubSettings.java b/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2/stub/ContextsStubSettings.java index 9c30bd13f..8efa1b92b 100644 --- a/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2/stub/ContextsStubSettings.java +++ b/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2/stub/ContextsStubSettings.java @@ -17,6 +17,7 @@ package com.google.cloud.dialogflow.v2.stub; import static com.google.cloud.dialogflow.v2.ContextsClient.ListContextsPagedResponse; +import static com.google.cloud.dialogflow.v2.ContextsClient.ListLocationsPagedResponse; import com.google.api.core.ApiFunction; import com.google.api.core.ApiFuture; @@ -51,6 +52,10 @@ import com.google.cloud.dialogflow.v2.ListContextsRequest; import com.google.cloud.dialogflow.v2.ListContextsResponse; import com.google.cloud.dialogflow.v2.UpdateContextRequest; +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.ListLocationsResponse; +import com.google.cloud.location.Location; import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableMap; import com.google.common.collect.ImmutableSet; @@ -111,6 +116,10 @@ public class ContextsStubSettings extends StubSettings { private final UnaryCallSettings updateContextSettings; private final UnaryCallSettings deleteContextSettings; private final UnaryCallSettings deleteAllContextsSettings; + private final PagedCallSettings< + ListLocationsRequest, ListLocationsResponse, ListLocationsPagedResponse> + listLocationsSettings; + private final UnaryCallSettings getLocationSettings; private static final PagedListDescriptor LIST_CONTEXTS_PAGE_STR_DESC = @@ -148,6 +157,42 @@ public Iterable extractResources(ListContextsResponse payload) { } }; + private static final PagedListDescriptor + LIST_LOCATIONS_PAGE_STR_DESC = + new PagedListDescriptor() { + @Override + public String emptyToken() { + return ""; + } + + @Override + public ListLocationsRequest injectToken(ListLocationsRequest payload, String token) { + return ListLocationsRequest.newBuilder(payload).setPageToken(token).build(); + } + + @Override + public ListLocationsRequest injectPageSize(ListLocationsRequest payload, int pageSize) { + return ListLocationsRequest.newBuilder(payload).setPageSize(pageSize).build(); + } + + @Override + public Integer extractPageSize(ListLocationsRequest payload) { + return payload.getPageSize(); + } + + @Override + public String extractNextToken(ListLocationsResponse payload) { + return payload.getNextPageToken(); + } + + @Override + public Iterable extractResources(ListLocationsResponse payload) { + return payload.getLocationsList() == null + ? ImmutableList.of() + : payload.getLocationsList(); + } + }; + private static final PagedListResponseFactory< ListContextsRequest, ListContextsResponse, ListContextsPagedResponse> LIST_CONTEXTS_PAGE_STR_FACT = @@ -165,6 +210,23 @@ public ApiFuture getFuturePagedResponse( } }; + private static final PagedListResponseFactory< + ListLocationsRequest, ListLocationsResponse, ListLocationsPagedResponse> + LIST_LOCATIONS_PAGE_STR_FACT = + new PagedListResponseFactory< + ListLocationsRequest, ListLocationsResponse, ListLocationsPagedResponse>() { + @Override + public ApiFuture getFuturePagedResponse( + UnaryCallable callable, + ListLocationsRequest request, + ApiCallContext context, + ApiFuture futureResponse) { + PageContext pageContext = + PageContext.create(callable, LIST_LOCATIONS_PAGE_STR_DESC, request, context); + return ListLocationsPagedResponse.createAsync(pageContext, futureResponse); + } + }; + /** Returns the object with the settings used for calls to listContexts. */ public PagedCallSettings listContextsSettings() { @@ -196,6 +258,17 @@ public UnaryCallSettings deleteAllContextsSetti return deleteAllContextsSettings; } + /** Returns the object with the settings used for calls to listLocations. */ + public PagedCallSettings + listLocationsSettings() { + return listLocationsSettings; + } + + /** Returns the object with the settings used for calls to getLocation. */ + public UnaryCallSettings getLocationSettings() { + return getLocationSettings; + } + public ContextsStub createStub() throws IOException { if (getTransportChannelProvider() .getTransportName() @@ -306,6 +379,8 @@ protected ContextsStubSettings(Builder settingsBuilder) throws IOException { updateContextSettings = settingsBuilder.updateContextSettings().build(); deleteContextSettings = settingsBuilder.deleteContextSettings().build(); deleteAllContextsSettings = settingsBuilder.deleteAllContextsSettings().build(); + listLocationsSettings = settingsBuilder.listLocationsSettings().build(); + getLocationSettings = settingsBuilder.getLocationSettings().build(); } /** Builder for ContextsStubSettings. */ @@ -320,6 +395,10 @@ public static class Builder extends StubSettings.Builder deleteContextSettings; private final UnaryCallSettings.Builder deleteAllContextsSettings; + private final PagedCallSettings.Builder< + ListLocationsRequest, ListLocationsResponse, ListLocationsPagedResponse> + listLocationsSettings; + private final UnaryCallSettings.Builder getLocationSettings; private static final ImmutableMap> RETRYABLE_CODE_DEFINITIONS; @@ -364,6 +443,8 @@ protected Builder(ClientContext clientContext) { updateContextSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); deleteContextSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); deleteAllContextsSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + listLocationsSettings = PagedCallSettings.newBuilder(LIST_LOCATIONS_PAGE_STR_FACT); + getLocationSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); unaryMethodSettingsBuilders = ImmutableList.>of( @@ -372,7 +453,9 @@ protected Builder(ClientContext clientContext) { createContextSettings, updateContextSettings, deleteContextSettings, - deleteAllContextsSettings); + deleteAllContextsSettings, + listLocationsSettings, + getLocationSettings); initDefaults(this); } @@ -385,6 +468,8 @@ protected Builder(ContextsStubSettings settings) { updateContextSettings = settings.updateContextSettings.toBuilder(); deleteContextSettings = settings.deleteContextSettings.toBuilder(); deleteAllContextsSettings = settings.deleteAllContextsSettings.toBuilder(); + listLocationsSettings = settings.listLocationsSettings.toBuilder(); + getLocationSettings = settings.getLocationSettings.toBuilder(); unaryMethodSettingsBuilders = ImmutableList.>of( @@ -393,7 +478,9 @@ protected Builder(ContextsStubSettings settings) { createContextSettings, updateContextSettings, deleteContextSettings, - deleteAllContextsSettings); + deleteAllContextsSettings, + listLocationsSettings, + getLocationSettings); } private static Builder createDefault() { @@ -453,6 +540,16 @@ private static Builder initDefaults(Builder builder) { .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes")) .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params")); + builder + .listLocationsSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params")); + + builder + .getLocationSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params")); + return builder; } @@ -503,6 +600,18 @@ public UnaryCallSettings.Builder deleteAllConte return deleteAllContextsSettings; } + /** Returns the builder for the settings used for calls to listLocations. */ + public PagedCallSettings.Builder< + ListLocationsRequest, ListLocationsResponse, ListLocationsPagedResponse> + listLocationsSettings() { + return listLocationsSettings; + } + + /** Returns the builder for the settings used for calls to getLocation. */ + public UnaryCallSettings.Builder getLocationSettings() { + return getLocationSettings; + } + @Override public ContextsStubSettings build() throws IOException { return new ContextsStubSettings(this); diff --git a/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2/stub/ConversationDatasetsStub.java b/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2/stub/ConversationDatasetsStub.java index 5fc129bac..c70aedab9 100644 --- a/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2/stub/ConversationDatasetsStub.java +++ b/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2/stub/ConversationDatasetsStub.java @@ -17,6 +17,7 @@ package com.google.cloud.dialogflow.v2.stub; import static com.google.cloud.dialogflow.v2.ConversationDatasetsClient.ListConversationDatasetsPagedResponse; +import static com.google.cloud.dialogflow.v2.ConversationDatasetsClient.ListLocationsPagedResponse; import com.google.api.gax.core.BackgroundResource; import com.google.api.gax.rpc.OperationCallable; @@ -32,6 +33,10 @@ import com.google.cloud.dialogflow.v2.ImportConversationDataRequest; import com.google.cloud.dialogflow.v2.ListConversationDatasetsRequest; import com.google.cloud.dialogflow.v2.ListConversationDatasetsResponse; +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.ListLocationsResponse; +import com.google.cloud.location.Location; import com.google.longrunning.Operation; import com.google.longrunning.stub.OperationsStub; import com.google.protobuf.Empty; @@ -109,6 +114,19 @@ public UnaryCallable importConversatio throw new UnsupportedOperationException("Not implemented: importConversationDataCallable()"); } + public UnaryCallable + listLocationsPagedCallable() { + throw new UnsupportedOperationException("Not implemented: listLocationsPagedCallable()"); + } + + public UnaryCallable listLocationsCallable() { + throw new UnsupportedOperationException("Not implemented: listLocationsCallable()"); + } + + public UnaryCallable getLocationCallable() { + throw new UnsupportedOperationException("Not implemented: getLocationCallable()"); + } + @Override public abstract void close(); } diff --git a/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2/stub/ConversationDatasetsStubSettings.java b/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2/stub/ConversationDatasetsStubSettings.java index 80f144262..9c95d252d 100644 --- a/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2/stub/ConversationDatasetsStubSettings.java +++ b/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2/stub/ConversationDatasetsStubSettings.java @@ -17,6 +17,7 @@ package com.google.cloud.dialogflow.v2.stub; import static com.google.cloud.dialogflow.v2.ConversationDatasetsClient.ListConversationDatasetsPagedResponse; +import static com.google.cloud.dialogflow.v2.ConversationDatasetsClient.ListLocationsPagedResponse; import com.google.api.core.ApiFunction; import com.google.api.core.ApiFuture; @@ -58,6 +59,10 @@ import com.google.cloud.dialogflow.v2.ImportConversationDataRequest; import com.google.cloud.dialogflow.v2.ListConversationDatasetsRequest; import com.google.cloud.dialogflow.v2.ListConversationDatasetsResponse; +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.ListLocationsResponse; +import com.google.cloud.location.Location; import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableMap; import com.google.common.collect.ImmutableSet; @@ -140,6 +145,10 @@ public class ConversationDatasetsStubSettings ImportConversationDataOperationResponse, ImportConversationDataOperationMetadata> importConversationDataOperationSettings; + private final PagedCallSettings< + ListLocationsRequest, ListLocationsResponse, ListLocationsPagedResponse> + listLocationsSettings; + private final UnaryCallSettings getLocationSettings; private static final PagedListDescriptor< ListConversationDatasetsRequest, ListConversationDatasetsResponse, ConversationDataset> @@ -188,6 +197,42 @@ public Iterable extractResources( } }; + private static final PagedListDescriptor + LIST_LOCATIONS_PAGE_STR_DESC = + new PagedListDescriptor() { + @Override + public String emptyToken() { + return ""; + } + + @Override + public ListLocationsRequest injectToken(ListLocationsRequest payload, String token) { + return ListLocationsRequest.newBuilder(payload).setPageToken(token).build(); + } + + @Override + public ListLocationsRequest injectPageSize(ListLocationsRequest payload, int pageSize) { + return ListLocationsRequest.newBuilder(payload).setPageSize(pageSize).build(); + } + + @Override + public Integer extractPageSize(ListLocationsRequest payload) { + return payload.getPageSize(); + } + + @Override + public String extractNextToken(ListLocationsResponse payload) { + return payload.getNextPageToken(); + } + + @Override + public Iterable extractResources(ListLocationsResponse payload) { + return payload.getLocationsList() == null + ? ImmutableList.of() + : payload.getLocationsList(); + } + }; + private static final PagedListResponseFactory< ListConversationDatasetsRequest, ListConversationDatasetsResponse, @@ -215,6 +260,23 @@ public ApiFuture getFuturePagedResponse( } }; + private static final PagedListResponseFactory< + ListLocationsRequest, ListLocationsResponse, ListLocationsPagedResponse> + LIST_LOCATIONS_PAGE_STR_FACT = + new PagedListResponseFactory< + ListLocationsRequest, ListLocationsResponse, ListLocationsPagedResponse>() { + @Override + public ApiFuture getFuturePagedResponse( + UnaryCallable callable, + ListLocationsRequest request, + ApiCallContext context, + ApiFuture futureResponse) { + PageContext pageContext = + PageContext.create(callable, LIST_LOCATIONS_PAGE_STR_DESC, request, context); + return ListLocationsPagedResponse.createAsync(pageContext, futureResponse); + } + }; + /** Returns the object with the settings used for calls to createConversationDataset. */ public UnaryCallSettings createConversationDatasetSettings() { @@ -273,6 +335,17 @@ public ApiFuture getFuturePagedResponse( return importConversationDataOperationSettings; } + /** Returns the object with the settings used for calls to listLocations. */ + public PagedCallSettings + listLocationsSettings() { + return listLocationsSettings; + } + + /** Returns the object with the settings used for calls to getLocation. */ + public UnaryCallSettings getLocationSettings() { + return getLocationSettings; + } + public ConversationDatasetsStub createStub() throws IOException { if (getTransportChannelProvider() .getTransportName() @@ -390,6 +463,8 @@ protected ConversationDatasetsStubSettings(Builder settingsBuilder) throws IOExc importConversationDataSettings = settingsBuilder.importConversationDataSettings().build(); importConversationDataOperationSettings = settingsBuilder.importConversationDataOperationSettings().build(); + listLocationsSettings = settingsBuilder.listLocationsSettings().build(); + getLocationSettings = settingsBuilder.getLocationSettings().build(); } /** Builder for ConversationDatasetsStubSettings. */ @@ -422,6 +497,10 @@ public static class Builder ImportConversationDataOperationResponse, ImportConversationDataOperationMetadata> importConversationDataOperationSettings; + private final PagedCallSettings.Builder< + ListLocationsRequest, ListLocationsResponse, ListLocationsPagedResponse> + listLocationsSettings; + private final UnaryCallSettings.Builder getLocationSettings; private static final ImmutableMap> RETRYABLE_CODE_DEFINITIONS; @@ -469,6 +548,8 @@ protected Builder(ClientContext clientContext) { deleteConversationDatasetOperationSettings = OperationCallSettings.newBuilder(); importConversationDataSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); importConversationDataOperationSettings = OperationCallSettings.newBuilder(); + listLocationsSettings = PagedCallSettings.newBuilder(LIST_LOCATIONS_PAGE_STR_FACT); + getLocationSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); unaryMethodSettingsBuilders = ImmutableList.>of( @@ -476,7 +557,9 @@ protected Builder(ClientContext clientContext) { getConversationDatasetSettings, listConversationDatasetsSettings, deleteConversationDatasetSettings, - importConversationDataSettings); + importConversationDataSettings, + listLocationsSettings, + getLocationSettings); initDefaults(this); } @@ -494,6 +577,8 @@ protected Builder(ConversationDatasetsStubSettings settings) { importConversationDataSettings = settings.importConversationDataSettings.toBuilder(); importConversationDataOperationSettings = settings.importConversationDataOperationSettings.toBuilder(); + listLocationsSettings = settings.listLocationsSettings.toBuilder(); + getLocationSettings = settings.getLocationSettings.toBuilder(); unaryMethodSettingsBuilders = ImmutableList.>of( @@ -501,7 +586,9 @@ protected Builder(ConversationDatasetsStubSettings settings) { getConversationDatasetSettings, listConversationDatasetsSettings, deleteConversationDatasetSettings, - importConversationDataSettings); + importConversationDataSettings, + listLocationsSettings, + getLocationSettings); } private static Builder createDefault() { @@ -556,6 +643,16 @@ private static Builder initDefaults(Builder builder) { .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes")) .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params")); + builder + .listLocationsSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params")); + + builder + .getLocationSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params")); + builder .createConversationDatasetOperationSettings() .setInitialCallSettings( @@ -716,6 +813,18 @@ public Builder applyToAllUnaryMethods( return importConversationDataOperationSettings; } + /** Returns the builder for the settings used for calls to listLocations. */ + public PagedCallSettings.Builder< + ListLocationsRequest, ListLocationsResponse, ListLocationsPagedResponse> + listLocationsSettings() { + return listLocationsSettings; + } + + /** Returns the builder for the settings used for calls to getLocation. */ + public UnaryCallSettings.Builder getLocationSettings() { + return getLocationSettings; + } + @Override public ConversationDatasetsStubSettings build() throws IOException { return new ConversationDatasetsStubSettings(this); diff --git a/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2/stub/ConversationModelsStub.java b/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2/stub/ConversationModelsStub.java index 9ab95e2a0..89424ea07 100644 --- a/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2/stub/ConversationModelsStub.java +++ b/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2/stub/ConversationModelsStub.java @@ -18,6 +18,7 @@ import static com.google.cloud.dialogflow.v2.ConversationModelsClient.ListConversationModelEvaluationsPagedResponse; import static com.google.cloud.dialogflow.v2.ConversationModelsClient.ListConversationModelsPagedResponse; +import static com.google.cloud.dialogflow.v2.ConversationModelsClient.ListLocationsPagedResponse; import com.google.api.gax.core.BackgroundResource; import com.google.api.gax.rpc.OperationCallable; @@ -40,6 +41,10 @@ import com.google.cloud.dialogflow.v2.ListConversationModelsResponse; import com.google.cloud.dialogflow.v2.UndeployConversationModelOperationMetadata; import com.google.cloud.dialogflow.v2.UndeployConversationModelRequest; +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.ListLocationsResponse; +import com.google.cloud.location.Location; import com.google.longrunning.Operation; import com.google.longrunning.stub.OperationsStub; import com.google.protobuf.Empty; @@ -163,6 +168,19 @@ public com.google.api.gax.httpjson.longrunning.stub.OperationsStub getHttpJsonOp "Not implemented: createConversationModelEvaluationCallable()"); } + public UnaryCallable + listLocationsPagedCallable() { + throw new UnsupportedOperationException("Not implemented: listLocationsPagedCallable()"); + } + + public UnaryCallable listLocationsCallable() { + throw new UnsupportedOperationException("Not implemented: listLocationsCallable()"); + } + + public UnaryCallable getLocationCallable() { + throw new UnsupportedOperationException("Not implemented: getLocationCallable()"); + } + @Override public abstract void close(); } diff --git a/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2/stub/ConversationModelsStubSettings.java b/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2/stub/ConversationModelsStubSettings.java index ba0039a46..a74fef1fc 100644 --- a/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2/stub/ConversationModelsStubSettings.java +++ b/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2/stub/ConversationModelsStubSettings.java @@ -18,6 +18,7 @@ import static com.google.cloud.dialogflow.v2.ConversationModelsClient.ListConversationModelEvaluationsPagedResponse; import static com.google.cloud.dialogflow.v2.ConversationModelsClient.ListConversationModelsPagedResponse; +import static com.google.cloud.dialogflow.v2.ConversationModelsClient.ListLocationsPagedResponse; import com.google.api.core.ApiFunction; import com.google.api.core.ApiFuture; @@ -66,6 +67,10 @@ import com.google.cloud.dialogflow.v2.ListConversationModelsResponse; import com.google.cloud.dialogflow.v2.UndeployConversationModelOperationMetadata; import com.google.cloud.dialogflow.v2.UndeployConversationModelRequest; +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.ListLocationsResponse; +import com.google.cloud.location.Location; import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableMap; import com.google.common.collect.ImmutableSet; @@ -165,6 +170,10 @@ public class ConversationModelsStubSettings extends StubSettings createConversationModelEvaluationOperationSettings; + private final PagedCallSettings< + ListLocationsRequest, ListLocationsResponse, ListLocationsPagedResponse> + listLocationsSettings; + private final UnaryCallSettings getLocationSettings; private static final PagedListDescriptor< ListConversationModelsRequest, ListConversationModelsResponse, ConversationModel> @@ -258,6 +267,42 @@ public Iterable extractResources( } }; + private static final PagedListDescriptor + LIST_LOCATIONS_PAGE_STR_DESC = + new PagedListDescriptor() { + @Override + public String emptyToken() { + return ""; + } + + @Override + public ListLocationsRequest injectToken(ListLocationsRequest payload, String token) { + return ListLocationsRequest.newBuilder(payload).setPageToken(token).build(); + } + + @Override + public ListLocationsRequest injectPageSize(ListLocationsRequest payload, int pageSize) { + return ListLocationsRequest.newBuilder(payload).setPageSize(pageSize).build(); + } + + @Override + public Integer extractPageSize(ListLocationsRequest payload) { + return payload.getPageSize(); + } + + @Override + public String extractNextToken(ListLocationsResponse payload) { + return payload.getNextPageToken(); + } + + @Override + public Iterable extractResources(ListLocationsResponse payload) { + return payload.getLocationsList() == null + ? ImmutableList.of() + : payload.getLocationsList(); + } + }; + private static final PagedListResponseFactory< ListConversationModelsRequest, ListConversationModelsResponse, @@ -318,6 +363,23 @@ public ApiFuture getFuturePagedRe } }; + private static final PagedListResponseFactory< + ListLocationsRequest, ListLocationsResponse, ListLocationsPagedResponse> + LIST_LOCATIONS_PAGE_STR_FACT = + new PagedListResponseFactory< + ListLocationsRequest, ListLocationsResponse, ListLocationsPagedResponse>() { + @Override + public ApiFuture getFuturePagedResponse( + UnaryCallable callable, + ListLocationsRequest request, + ApiCallContext context, + ApiFuture futureResponse) { + PageContext pageContext = + PageContext.create(callable, LIST_LOCATIONS_PAGE_STR_DESC, request, context); + return ListLocationsPagedResponse.createAsync(pageContext, futureResponse); + } + }; + /** Returns the object with the settings used for calls to createConversationModel. */ public UnaryCallSettings createConversationModelSettings() { @@ -417,6 +479,17 @@ public ApiFuture getFuturePagedRe return createConversationModelEvaluationOperationSettings; } + /** Returns the object with the settings used for calls to listLocations. */ + public PagedCallSettings + listLocationsSettings() { + return listLocationsSettings; + } + + /** Returns the object with the settings used for calls to getLocation. */ + public UnaryCallSettings getLocationSettings() { + return getLocationSettings; + } + public ConversationModelsStub createStub() throws IOException { if (getTransportChannelProvider() .getTransportName() @@ -545,6 +618,8 @@ protected ConversationModelsStubSettings(Builder settingsBuilder) throws IOExcep settingsBuilder.createConversationModelEvaluationSettings().build(); createConversationModelEvaluationOperationSettings = settingsBuilder.createConversationModelEvaluationOperationSettings().build(); + listLocationsSettings = settingsBuilder.listLocationsSettings().build(); + getLocationSettings = settingsBuilder.getLocationSettings().build(); } /** Builder for ConversationModelsStubSettings. */ @@ -595,6 +670,10 @@ public static class Builder ConversationModelEvaluation, CreateConversationModelEvaluationOperationMetadata> createConversationModelEvaluationOperationSettings; + private final PagedCallSettings.Builder< + ListLocationsRequest, ListLocationsResponse, ListLocationsPagedResponse> + listLocationsSettings; + private final UnaryCallSettings.Builder getLocationSettings; private static final ImmutableMap> RETRYABLE_CODE_DEFINITIONS; @@ -649,6 +728,8 @@ protected Builder(ClientContext clientContext) { PagedCallSettings.newBuilder(LIST_CONVERSATION_MODEL_EVALUATIONS_PAGE_STR_FACT); createConversationModelEvaluationSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); createConversationModelEvaluationOperationSettings = OperationCallSettings.newBuilder(); + listLocationsSettings = PagedCallSettings.newBuilder(LIST_LOCATIONS_PAGE_STR_FACT); + getLocationSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); unaryMethodSettingsBuilders = ImmutableList.>of( @@ -660,7 +741,9 @@ protected Builder(ClientContext clientContext) { undeployConversationModelSettings, getConversationModelEvaluationSettings, listConversationModelEvaluationsSettings, - createConversationModelEvaluationSettings); + createConversationModelEvaluationSettings, + listLocationsSettings, + getLocationSettings); initDefaults(this); } @@ -689,6 +772,8 @@ protected Builder(ConversationModelsStubSettings settings) { settings.createConversationModelEvaluationSettings.toBuilder(); createConversationModelEvaluationOperationSettings = settings.createConversationModelEvaluationOperationSettings.toBuilder(); + listLocationsSettings = settings.listLocationsSettings.toBuilder(); + getLocationSettings = settings.getLocationSettings.toBuilder(); unaryMethodSettingsBuilders = ImmutableList.>of( @@ -700,7 +785,9 @@ protected Builder(ConversationModelsStubSettings settings) { undeployConversationModelSettings, getConversationModelEvaluationSettings, listConversationModelEvaluationsSettings, - createConversationModelEvaluationSettings); + createConversationModelEvaluationSettings, + listLocationsSettings, + getLocationSettings); } private static Builder createDefault() { @@ -775,6 +862,16 @@ private static Builder initDefaults(Builder builder) { .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes")) .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params")); + builder + .listLocationsSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params")); + + builder + .getLocationSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params")); + builder .createConversationModelOperationSettings() .setInitialCallSettings( @@ -1031,6 +1128,18 @@ public Builder applyToAllUnaryMethods( return createConversationModelEvaluationOperationSettings; } + /** Returns the builder for the settings used for calls to listLocations. */ + public PagedCallSettings.Builder< + ListLocationsRequest, ListLocationsResponse, ListLocationsPagedResponse> + listLocationsSettings() { + return listLocationsSettings; + } + + /** Returns the builder for the settings used for calls to getLocation. */ + public UnaryCallSettings.Builder getLocationSettings() { + return getLocationSettings; + } + @Override public ConversationModelsStubSettings build() throws IOException { return new ConversationModelsStubSettings(this); diff --git a/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2/stub/ConversationProfilesStub.java b/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2/stub/ConversationProfilesStub.java index 55d4a877d..3461da095 100644 --- a/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2/stub/ConversationProfilesStub.java +++ b/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2/stub/ConversationProfilesStub.java @@ -17,6 +17,7 @@ package com.google.cloud.dialogflow.v2.stub; import static com.google.cloud.dialogflow.v2.ConversationProfilesClient.ListConversationProfilesPagedResponse; +import static com.google.cloud.dialogflow.v2.ConversationProfilesClient.ListLocationsPagedResponse; import com.google.api.gax.core.BackgroundResource; import com.google.api.gax.rpc.OperationCallable; @@ -32,6 +33,10 @@ import com.google.cloud.dialogflow.v2.SetSuggestionFeatureConfigOperationMetadata; import com.google.cloud.dialogflow.v2.SetSuggestionFeatureConfigRequest; import com.google.cloud.dialogflow.v2.UpdateConversationProfileRequest; +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.ListLocationsResponse; +import com.google.cloud.location.Location; import com.google.longrunning.Operation; import com.google.longrunning.stub.OperationsStub; import com.google.protobuf.Empty; @@ -115,6 +120,19 @@ public com.google.api.gax.httpjson.longrunning.stub.OperationsStub getHttpJsonOp "Not implemented: clearSuggestionFeatureConfigCallable()"); } + public UnaryCallable + listLocationsPagedCallable() { + throw new UnsupportedOperationException("Not implemented: listLocationsPagedCallable()"); + } + + public UnaryCallable listLocationsCallable() { + throw new UnsupportedOperationException("Not implemented: listLocationsCallable()"); + } + + public UnaryCallable getLocationCallable() { + throw new UnsupportedOperationException("Not implemented: getLocationCallable()"); + } + @Override public abstract void close(); } diff --git a/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2/stub/ConversationProfilesStubSettings.java b/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2/stub/ConversationProfilesStubSettings.java index 3475ae0be..8bf697d94 100644 --- a/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2/stub/ConversationProfilesStubSettings.java +++ b/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2/stub/ConversationProfilesStubSettings.java @@ -17,6 +17,7 @@ package com.google.cloud.dialogflow.v2.stub; import static com.google.cloud.dialogflow.v2.ConversationProfilesClient.ListConversationProfilesPagedResponse; +import static com.google.cloud.dialogflow.v2.ConversationProfilesClient.ListLocationsPagedResponse; import com.google.api.core.ApiFunction; import com.google.api.core.ApiFuture; @@ -58,6 +59,10 @@ import com.google.cloud.dialogflow.v2.SetSuggestionFeatureConfigOperationMetadata; import com.google.cloud.dialogflow.v2.SetSuggestionFeatureConfigRequest; import com.google.cloud.dialogflow.v2.UpdateConversationProfileRequest; +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.ListLocationsResponse; +import com.google.cloud.location.Location; import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableMap; import com.google.common.collect.ImmutableSet; @@ -141,6 +146,10 @@ public class ConversationProfilesStubSettings ConversationProfile, ClearSuggestionFeatureConfigOperationMetadata> clearSuggestionFeatureConfigOperationSettings; + private final PagedCallSettings< + ListLocationsRequest, ListLocationsResponse, ListLocationsPagedResponse> + listLocationsSettings; + private final UnaryCallSettings getLocationSettings; private static final PagedListDescriptor< ListConversationProfilesRequest, ListConversationProfilesResponse, ConversationProfile> @@ -189,6 +198,42 @@ public Iterable extractResources( } }; + private static final PagedListDescriptor + LIST_LOCATIONS_PAGE_STR_DESC = + new PagedListDescriptor() { + @Override + public String emptyToken() { + return ""; + } + + @Override + public ListLocationsRequest injectToken(ListLocationsRequest payload, String token) { + return ListLocationsRequest.newBuilder(payload).setPageToken(token).build(); + } + + @Override + public ListLocationsRequest injectPageSize(ListLocationsRequest payload, int pageSize) { + return ListLocationsRequest.newBuilder(payload).setPageSize(pageSize).build(); + } + + @Override + public Integer extractPageSize(ListLocationsRequest payload) { + return payload.getPageSize(); + } + + @Override + public String extractNextToken(ListLocationsResponse payload) { + return payload.getNextPageToken(); + } + + @Override + public Iterable extractResources(ListLocationsResponse payload) { + return payload.getLocationsList() == null + ? ImmutableList.of() + : payload.getLocationsList(); + } + }; + private static final PagedListResponseFactory< ListConversationProfilesRequest, ListConversationProfilesResponse, @@ -216,6 +261,23 @@ public ApiFuture getFuturePagedResponse( } }; + private static final PagedListResponseFactory< + ListLocationsRequest, ListLocationsResponse, ListLocationsPagedResponse> + LIST_LOCATIONS_PAGE_STR_FACT = + new PagedListResponseFactory< + ListLocationsRequest, ListLocationsResponse, ListLocationsPagedResponse>() { + @Override + public ApiFuture getFuturePagedResponse( + UnaryCallable callable, + ListLocationsRequest request, + ApiCallContext context, + ApiFuture futureResponse) { + PageContext pageContext = + PageContext.create(callable, LIST_LOCATIONS_PAGE_STR_DESC, request, context); + return ListLocationsPagedResponse.createAsync(pageContext, futureResponse); + } + }; + /** Returns the object with the settings used for calls to listConversationProfiles. */ public PagedCallSettings< ListConversationProfilesRequest, @@ -279,6 +341,17 @@ public ApiFuture getFuturePagedResponse( return clearSuggestionFeatureConfigOperationSettings; } + /** Returns the object with the settings used for calls to listLocations. */ + public PagedCallSettings + listLocationsSettings() { + return listLocationsSettings; + } + + /** Returns the object with the settings used for calls to getLocation. */ + public UnaryCallSettings getLocationSettings() { + return getLocationSettings; + } + public ConversationProfilesStub createStub() throws IOException { if (getTransportChannelProvider() .getTransportName() @@ -398,6 +471,8 @@ protected ConversationProfilesStubSettings(Builder settingsBuilder) throws IOExc settingsBuilder.clearSuggestionFeatureConfigSettings().build(); clearSuggestionFeatureConfigOperationSettings = settingsBuilder.clearSuggestionFeatureConfigOperationSettings().build(); + listLocationsSettings = settingsBuilder.listLocationsSettings().build(); + getLocationSettings = settingsBuilder.getLocationSettings().build(); } /** Builder for ConversationProfilesStubSettings. */ @@ -431,6 +506,10 @@ public static class Builder ConversationProfile, ClearSuggestionFeatureConfigOperationMetadata> clearSuggestionFeatureConfigOperationSettings; + private final PagedCallSettings.Builder< + ListLocationsRequest, ListLocationsResponse, ListLocationsPagedResponse> + listLocationsSettings; + private final UnaryCallSettings.Builder getLocationSettings; private static final ImmutableMap> RETRYABLE_CODE_DEFINITIONS; @@ -479,6 +558,8 @@ protected Builder(ClientContext clientContext) { setSuggestionFeatureConfigOperationSettings = OperationCallSettings.newBuilder(); clearSuggestionFeatureConfigSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); clearSuggestionFeatureConfigOperationSettings = OperationCallSettings.newBuilder(); + listLocationsSettings = PagedCallSettings.newBuilder(LIST_LOCATIONS_PAGE_STR_FACT); + getLocationSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); unaryMethodSettingsBuilders = ImmutableList.>of( @@ -488,7 +569,9 @@ protected Builder(ClientContext clientContext) { updateConversationProfileSettings, deleteConversationProfileSettings, setSuggestionFeatureConfigSettings, - clearSuggestionFeatureConfigSettings); + clearSuggestionFeatureConfigSettings, + listLocationsSettings, + getLocationSettings); initDefaults(this); } @@ -507,6 +590,8 @@ protected Builder(ConversationProfilesStubSettings settings) { settings.clearSuggestionFeatureConfigSettings.toBuilder(); clearSuggestionFeatureConfigOperationSettings = settings.clearSuggestionFeatureConfigOperationSettings.toBuilder(); + listLocationsSettings = settings.listLocationsSettings.toBuilder(); + getLocationSettings = settings.getLocationSettings.toBuilder(); unaryMethodSettingsBuilders = ImmutableList.>of( @@ -516,7 +601,9 @@ protected Builder(ConversationProfilesStubSettings settings) { updateConversationProfileSettings, deleteConversationProfileSettings, setSuggestionFeatureConfigSettings, - clearSuggestionFeatureConfigSettings); + clearSuggestionFeatureConfigSettings, + listLocationsSettings, + getLocationSettings); } private static Builder createDefault() { @@ -581,6 +668,16 @@ private static Builder initDefaults(Builder builder) { .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes")) .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params")); + builder + .listLocationsSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params")); + + builder + .getLocationSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params")); + builder .setSuggestionFeatureConfigOperationSettings() .setInitialCallSettings( @@ -718,6 +815,18 @@ public Builder applyToAllUnaryMethods( return clearSuggestionFeatureConfigOperationSettings; } + /** Returns the builder for the settings used for calls to listLocations. */ + public PagedCallSettings.Builder< + ListLocationsRequest, ListLocationsResponse, ListLocationsPagedResponse> + listLocationsSettings() { + return listLocationsSettings; + } + + /** Returns the builder for the settings used for calls to getLocation. */ + public UnaryCallSettings.Builder getLocationSettings() { + return getLocationSettings; + } + @Override public ConversationProfilesStubSettings build() throws IOException { return new ConversationProfilesStubSettings(this); diff --git a/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2/stub/ConversationsStub.java b/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2/stub/ConversationsStub.java index df1446167..8f52a5549 100644 --- a/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2/stub/ConversationsStub.java +++ b/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2/stub/ConversationsStub.java @@ -17,6 +17,7 @@ package com.google.cloud.dialogflow.v2.stub; import static com.google.cloud.dialogflow.v2.ConversationsClient.ListConversationsPagedResponse; +import static com.google.cloud.dialogflow.v2.ConversationsClient.ListLocationsPagedResponse; import static com.google.cloud.dialogflow.v2.ConversationsClient.ListMessagesPagedResponse; import com.google.api.gax.core.BackgroundResource; @@ -29,6 +30,10 @@ import com.google.cloud.dialogflow.v2.ListConversationsResponse; import com.google.cloud.dialogflow.v2.ListMessagesRequest; import com.google.cloud.dialogflow.v2.ListMessagesResponse; +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.ListLocationsResponse; +import com.google.cloud.location.Location; import javax.annotation.Generated; // AUTO-GENERATED DOCUMENTATION AND CLASS. @@ -70,6 +75,19 @@ public UnaryCallable listMessagesCall throw new UnsupportedOperationException("Not implemented: listMessagesCallable()"); } + public UnaryCallable + listLocationsPagedCallable() { + throw new UnsupportedOperationException("Not implemented: listLocationsPagedCallable()"); + } + + public UnaryCallable listLocationsCallable() { + throw new UnsupportedOperationException("Not implemented: listLocationsCallable()"); + } + + public UnaryCallable getLocationCallable() { + throw new UnsupportedOperationException("Not implemented: getLocationCallable()"); + } + @Override public abstract void close(); } diff --git a/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2/stub/ConversationsStubSettings.java b/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2/stub/ConversationsStubSettings.java index c04485516..c5cfeb422 100644 --- a/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2/stub/ConversationsStubSettings.java +++ b/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2/stub/ConversationsStubSettings.java @@ -17,6 +17,7 @@ package com.google.cloud.dialogflow.v2.stub; import static com.google.cloud.dialogflow.v2.ConversationsClient.ListConversationsPagedResponse; +import static com.google.cloud.dialogflow.v2.ConversationsClient.ListLocationsPagedResponse; import static com.google.cloud.dialogflow.v2.ConversationsClient.ListMessagesPagedResponse; import com.google.api.core.ApiFunction; @@ -53,6 +54,10 @@ import com.google.cloud.dialogflow.v2.ListMessagesRequest; import com.google.cloud.dialogflow.v2.ListMessagesResponse; import com.google.cloud.dialogflow.v2.Message; +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.ListLocationsResponse; +import com.google.cloud.location.Location; import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableMap; import com.google.common.collect.ImmutableSet; @@ -116,6 +121,10 @@ public class ConversationsStubSettings extends StubSettings listMessagesSettings; + private final PagedCallSettings< + ListLocationsRequest, ListLocationsResponse, ListLocationsPagedResponse> + listLocationsSettings; + private final UnaryCallSettings getLocationSettings; private static final PagedListDescriptor< ListConversationsRequest, ListConversationsResponse, Conversation> @@ -193,6 +202,42 @@ public Iterable extractResources(ListMessagesResponse payload) { } }; + private static final PagedListDescriptor + LIST_LOCATIONS_PAGE_STR_DESC = + new PagedListDescriptor() { + @Override + public String emptyToken() { + return ""; + } + + @Override + public ListLocationsRequest injectToken(ListLocationsRequest payload, String token) { + return ListLocationsRequest.newBuilder(payload).setPageToken(token).build(); + } + + @Override + public ListLocationsRequest injectPageSize(ListLocationsRequest payload, int pageSize) { + return ListLocationsRequest.newBuilder(payload).setPageSize(pageSize).build(); + } + + @Override + public Integer extractPageSize(ListLocationsRequest payload) { + return payload.getPageSize(); + } + + @Override + public String extractNextToken(ListLocationsResponse payload) { + return payload.getNextPageToken(); + } + + @Override + public Iterable extractResources(ListLocationsResponse payload) { + return payload.getLocationsList() == null + ? ImmutableList.of() + : payload.getLocationsList(); + } + }; + private static final PagedListResponseFactory< ListConversationsRequest, ListConversationsResponse, ListConversationsPagedResponse> LIST_CONVERSATIONS_PAGE_STR_FACT = @@ -231,6 +276,23 @@ public ApiFuture getFuturePagedResponse( } }; + private static final PagedListResponseFactory< + ListLocationsRequest, ListLocationsResponse, ListLocationsPagedResponse> + LIST_LOCATIONS_PAGE_STR_FACT = + new PagedListResponseFactory< + ListLocationsRequest, ListLocationsResponse, ListLocationsPagedResponse>() { + @Override + public ApiFuture getFuturePagedResponse( + UnaryCallable callable, + ListLocationsRequest request, + ApiCallContext context, + ApiFuture futureResponse) { + PageContext pageContext = + PageContext.create(callable, LIST_LOCATIONS_PAGE_STR_DESC, request, context); + return ListLocationsPagedResponse.createAsync(pageContext, futureResponse); + } + }; + /** Returns the object with the settings used for calls to createConversation. */ public UnaryCallSettings createConversationSettings() { return createConversationSettings; @@ -260,6 +322,17 @@ public UnaryCallSettings getConversationSe return listMessagesSettings; } + /** Returns the object with the settings used for calls to listLocations. */ + public PagedCallSettings + listLocationsSettings() { + return listLocationsSettings; + } + + /** Returns the object with the settings used for calls to getLocation. */ + public UnaryCallSettings getLocationSettings() { + return getLocationSettings; + } + public ConversationsStub createStub() throws IOException { if (getTransportChannelProvider() .getTransportName() @@ -371,6 +444,8 @@ protected ConversationsStubSettings(Builder settingsBuilder) throws IOException getConversationSettings = settingsBuilder.getConversationSettings().build(); completeConversationSettings = settingsBuilder.completeConversationSettings().build(); listMessagesSettings = settingsBuilder.listMessagesSettings().build(); + listLocationsSettings = settingsBuilder.listLocationsSettings().build(); + getLocationSettings = settingsBuilder.getLocationSettings().build(); } /** Builder for ConversationsStubSettings. */ @@ -388,6 +463,10 @@ public static class Builder extends StubSettings.Builder listMessagesSettings; + private final PagedCallSettings.Builder< + ListLocationsRequest, ListLocationsResponse, ListLocationsPagedResponse> + listLocationsSettings; + private final UnaryCallSettings.Builder getLocationSettings; private static final ImmutableMap> RETRYABLE_CODE_DEFINITIONS; @@ -431,6 +510,8 @@ protected Builder(ClientContext clientContext) { getConversationSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); completeConversationSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); listMessagesSettings = PagedCallSettings.newBuilder(LIST_MESSAGES_PAGE_STR_FACT); + listLocationsSettings = PagedCallSettings.newBuilder(LIST_LOCATIONS_PAGE_STR_FACT); + getLocationSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); unaryMethodSettingsBuilders = ImmutableList.>of( @@ -438,7 +519,9 @@ protected Builder(ClientContext clientContext) { listConversationsSettings, getConversationSettings, completeConversationSettings, - listMessagesSettings); + listMessagesSettings, + listLocationsSettings, + getLocationSettings); initDefaults(this); } @@ -450,6 +533,8 @@ protected Builder(ConversationsStubSettings settings) { getConversationSettings = settings.getConversationSettings.toBuilder(); completeConversationSettings = settings.completeConversationSettings.toBuilder(); listMessagesSettings = settings.listMessagesSettings.toBuilder(); + listLocationsSettings = settings.listLocationsSettings.toBuilder(); + getLocationSettings = settings.getLocationSettings.toBuilder(); unaryMethodSettingsBuilders = ImmutableList.>of( @@ -457,7 +542,9 @@ protected Builder(ConversationsStubSettings settings) { listConversationsSettings, getConversationSettings, completeConversationSettings, - listMessagesSettings); + listMessagesSettings, + listLocationsSettings, + getLocationSettings); } private static Builder createDefault() { @@ -512,6 +599,16 @@ private static Builder initDefaults(Builder builder) { .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes")) .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params")); + builder + .listLocationsSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params")); + + builder + .getLocationSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params")); + return builder; } @@ -562,6 +659,18 @@ public Builder applyToAllUnaryMethods( return listMessagesSettings; } + /** Returns the builder for the settings used for calls to listLocations. */ + public PagedCallSettings.Builder< + ListLocationsRequest, ListLocationsResponse, ListLocationsPagedResponse> + listLocationsSettings() { + return listLocationsSettings; + } + + /** Returns the builder for the settings used for calls to getLocation. */ + public UnaryCallSettings.Builder getLocationSettings() { + return getLocationSettings; + } + @Override public ConversationsStubSettings build() throws IOException { return new ConversationsStubSettings(this); diff --git a/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2/stub/DocumentsStub.java b/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2/stub/DocumentsStub.java index a91b4044c..0c870f311 100644 --- a/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2/stub/DocumentsStub.java +++ b/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2/stub/DocumentsStub.java @@ -17,6 +17,7 @@ package com.google.cloud.dialogflow.v2.stub; import static com.google.cloud.dialogflow.v2.DocumentsClient.ListDocumentsPagedResponse; +import static com.google.cloud.dialogflow.v2.DocumentsClient.ListLocationsPagedResponse; import com.google.api.gax.core.BackgroundResource; import com.google.api.gax.rpc.OperationCallable; @@ -33,6 +34,10 @@ import com.google.cloud.dialogflow.v2.ListDocumentsResponse; import com.google.cloud.dialogflow.v2.ReloadDocumentRequest; import com.google.cloud.dialogflow.v2.UpdateDocumentRequest; +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.ListLocationsResponse; +import com.google.cloud.location.Location; import com.google.longrunning.Operation; import com.google.longrunning.stub.OperationsStub; import com.google.protobuf.Empty; @@ -123,6 +128,19 @@ public UnaryCallable exportDocumentCallable() throw new UnsupportedOperationException("Not implemented: exportDocumentCallable()"); } + public UnaryCallable + listLocationsPagedCallable() { + throw new UnsupportedOperationException("Not implemented: listLocationsPagedCallable()"); + } + + public UnaryCallable listLocationsCallable() { + throw new UnsupportedOperationException("Not implemented: listLocationsCallable()"); + } + + public UnaryCallable getLocationCallable() { + throw new UnsupportedOperationException("Not implemented: getLocationCallable()"); + } + @Override public abstract void close(); } diff --git a/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2/stub/DocumentsStubSettings.java b/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2/stub/DocumentsStubSettings.java index 623c2587f..fa4312d7f 100644 --- a/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2/stub/DocumentsStubSettings.java +++ b/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2/stub/DocumentsStubSettings.java @@ -17,6 +17,7 @@ package com.google.cloud.dialogflow.v2.stub; import static com.google.cloud.dialogflow.v2.DocumentsClient.ListDocumentsPagedResponse; +import static com.google.cloud.dialogflow.v2.DocumentsClient.ListLocationsPagedResponse; import com.google.api.core.ApiFunction; import com.google.api.core.ApiFuture; @@ -59,6 +60,10 @@ import com.google.cloud.dialogflow.v2.ListDocumentsResponse; import com.google.cloud.dialogflow.v2.ReloadDocumentRequest; import com.google.cloud.dialogflow.v2.UpdateDocumentRequest; +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.ListLocationsResponse; +import com.google.cloud.location.Location; import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableMap; import com.google.common.collect.ImmutableSet; @@ -135,6 +140,10 @@ public class DocumentsStubSettings extends StubSettings { private final UnaryCallSettings exportDocumentSettings; private final OperationCallSettings exportDocumentOperationSettings; + private final PagedCallSettings< + ListLocationsRequest, ListLocationsResponse, ListLocationsPagedResponse> + listLocationsSettings; + private final UnaryCallSettings getLocationSettings; private static final PagedListDescriptor LIST_DOCUMENTS_PAGE_STR_DESC = @@ -172,6 +181,42 @@ public Iterable extractResources(ListDocumentsResponse payload) { } }; + private static final PagedListDescriptor + LIST_LOCATIONS_PAGE_STR_DESC = + new PagedListDescriptor() { + @Override + public String emptyToken() { + return ""; + } + + @Override + public ListLocationsRequest injectToken(ListLocationsRequest payload, String token) { + return ListLocationsRequest.newBuilder(payload).setPageToken(token).build(); + } + + @Override + public ListLocationsRequest injectPageSize(ListLocationsRequest payload, int pageSize) { + return ListLocationsRequest.newBuilder(payload).setPageSize(pageSize).build(); + } + + @Override + public Integer extractPageSize(ListLocationsRequest payload) { + return payload.getPageSize(); + } + + @Override + public String extractNextToken(ListLocationsResponse payload) { + return payload.getNextPageToken(); + } + + @Override + public Iterable extractResources(ListLocationsResponse payload) { + return payload.getLocationsList() == null + ? ImmutableList.of() + : payload.getLocationsList(); + } + }; + private static final PagedListResponseFactory< ListDocumentsRequest, ListDocumentsResponse, ListDocumentsPagedResponse> LIST_DOCUMENTS_PAGE_STR_FACT = @@ -189,6 +234,23 @@ public ApiFuture getFuturePagedResponse( } }; + private static final PagedListResponseFactory< + ListLocationsRequest, ListLocationsResponse, ListLocationsPagedResponse> + LIST_LOCATIONS_PAGE_STR_FACT = + new PagedListResponseFactory< + ListLocationsRequest, ListLocationsResponse, ListLocationsPagedResponse>() { + @Override + public ApiFuture getFuturePagedResponse( + UnaryCallable callable, + ListLocationsRequest request, + ApiCallContext context, + ApiFuture futureResponse) { + PageContext pageContext = + PageContext.create(callable, LIST_LOCATIONS_PAGE_STR_DESC, request, context); + return ListLocationsPagedResponse.createAsync(pageContext, futureResponse); + } + }; + /** Returns the object with the settings used for calls to listDocuments. */ public PagedCallSettings listDocumentsSettings() { @@ -267,6 +329,17 @@ public UnaryCallSettings exportDocumentSetting return exportDocumentOperationSettings; } + /** Returns the object with the settings used for calls to listLocations. */ + public PagedCallSettings + listLocationsSettings() { + return listLocationsSettings; + } + + /** Returns the object with the settings used for calls to getLocation. */ + public UnaryCallSettings getLocationSettings() { + return getLocationSettings; + } + public DocumentsStub createStub() throws IOException { if (getTransportChannelProvider() .getTransportName() @@ -385,6 +458,8 @@ protected DocumentsStubSettings(Builder settingsBuilder) throws IOException { reloadDocumentOperationSettings = settingsBuilder.reloadDocumentOperationSettings().build(); exportDocumentSettings = settingsBuilder.exportDocumentSettings().build(); exportDocumentOperationSettings = settingsBuilder.exportDocumentOperationSettings().build(); + listLocationsSettings = settingsBuilder.listLocationsSettings().build(); + getLocationSettings = settingsBuilder.getLocationSettings().build(); } /** Builder for DocumentsStubSettings. */ @@ -424,6 +499,10 @@ public static class Builder extends StubSettings.Builder exportDocumentOperationSettings; + private final PagedCallSettings.Builder< + ListLocationsRequest, ListLocationsResponse, ListLocationsPagedResponse> + listLocationsSettings; + private final UnaryCallSettings.Builder getLocationSettings; private static final ImmutableMap> RETRYABLE_CODE_DEFINITIONS; @@ -476,6 +555,8 @@ protected Builder(ClientContext clientContext) { reloadDocumentOperationSettings = OperationCallSettings.newBuilder(); exportDocumentSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); exportDocumentOperationSettings = OperationCallSettings.newBuilder(); + listLocationsSettings = PagedCallSettings.newBuilder(LIST_LOCATIONS_PAGE_STR_FACT); + getLocationSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); unaryMethodSettingsBuilders = ImmutableList.>of( @@ -486,7 +567,9 @@ protected Builder(ClientContext clientContext) { deleteDocumentSettings, updateDocumentSettings, reloadDocumentSettings, - exportDocumentSettings); + exportDocumentSettings, + listLocationsSettings, + getLocationSettings); initDefaults(this); } @@ -507,6 +590,8 @@ protected Builder(DocumentsStubSettings settings) { reloadDocumentOperationSettings = settings.reloadDocumentOperationSettings.toBuilder(); exportDocumentSettings = settings.exportDocumentSettings.toBuilder(); exportDocumentOperationSettings = settings.exportDocumentOperationSettings.toBuilder(); + listLocationsSettings = settings.listLocationsSettings.toBuilder(); + getLocationSettings = settings.getLocationSettings.toBuilder(); unaryMethodSettingsBuilders = ImmutableList.>of( @@ -517,7 +602,9 @@ protected Builder(DocumentsStubSettings settings) { deleteDocumentSettings, updateDocumentSettings, reloadDocumentSettings, - exportDocumentSettings); + exportDocumentSettings, + listLocationsSettings, + getLocationSettings); } private static Builder createDefault() { @@ -587,6 +674,16 @@ private static Builder initDefaults(Builder builder) { .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes")) .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params")); + builder + .listLocationsSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params")); + + builder + .getLocationSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params")); + builder .createDocumentOperationSettings() .setInitialCallSettings( @@ -850,6 +947,18 @@ public UnaryCallSettings.Builder exportDocumen return exportDocumentOperationSettings; } + /** Returns the builder for the settings used for calls to listLocations. */ + public PagedCallSettings.Builder< + ListLocationsRequest, ListLocationsResponse, ListLocationsPagedResponse> + listLocationsSettings() { + return listLocationsSettings; + } + + /** Returns the builder for the settings used for calls to getLocation. */ + public UnaryCallSettings.Builder getLocationSettings() { + return getLocationSettings; + } + @Override public DocumentsStubSettings build() throws IOException { return new DocumentsStubSettings(this); diff --git a/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2/stub/EntityTypesStub.java b/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2/stub/EntityTypesStub.java index 550bf5804..893c24de6 100644 --- a/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2/stub/EntityTypesStub.java +++ b/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2/stub/EntityTypesStub.java @@ -17,6 +17,7 @@ package com.google.cloud.dialogflow.v2.stub; import static com.google.cloud.dialogflow.v2.EntityTypesClient.ListEntityTypesPagedResponse; +import static com.google.cloud.dialogflow.v2.EntityTypesClient.ListLocationsPagedResponse; import com.google.api.gax.core.BackgroundResource; import com.google.api.gax.rpc.OperationCallable; @@ -34,6 +35,10 @@ import com.google.cloud.dialogflow.v2.ListEntityTypesRequest; import com.google.cloud.dialogflow.v2.ListEntityTypesResponse; import com.google.cloud.dialogflow.v2.UpdateEntityTypeRequest; +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.ListLocationsResponse; +import com.google.cloud.location.Location; import com.google.longrunning.Operation; import com.google.longrunning.stub.OperationsStub; import com.google.protobuf.Empty; @@ -132,6 +137,19 @@ public UnaryCallable batchDeleteEntitiesC throw new UnsupportedOperationException("Not implemented: batchDeleteEntitiesCallable()"); } + public UnaryCallable + listLocationsPagedCallable() { + throw new UnsupportedOperationException("Not implemented: listLocationsPagedCallable()"); + } + + public UnaryCallable listLocationsCallable() { + throw new UnsupportedOperationException("Not implemented: listLocationsCallable()"); + } + + public UnaryCallable getLocationCallable() { + throw new UnsupportedOperationException("Not implemented: getLocationCallable()"); + } + @Override public abstract void close(); } diff --git a/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2/stub/EntityTypesStubSettings.java b/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2/stub/EntityTypesStubSettings.java index f3b7aa682..ce42210d7 100644 --- a/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2/stub/EntityTypesStubSettings.java +++ b/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2/stub/EntityTypesStubSettings.java @@ -17,6 +17,7 @@ package com.google.cloud.dialogflow.v2.stub; import static com.google.cloud.dialogflow.v2.EntityTypesClient.ListEntityTypesPagedResponse; +import static com.google.cloud.dialogflow.v2.EntityTypesClient.ListLocationsPagedResponse; import com.google.api.core.ApiFunction; import com.google.api.core.ApiFuture; @@ -60,6 +61,10 @@ import com.google.cloud.dialogflow.v2.ListEntityTypesRequest; import com.google.cloud.dialogflow.v2.ListEntityTypesResponse; import com.google.cloud.dialogflow.v2.UpdateEntityTypeRequest; +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.ListLocationsResponse; +import com.google.cloud.location.Location; import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableMap; import com.google.common.collect.ImmutableSet; @@ -143,6 +148,10 @@ public class EntityTypesStubSettings extends StubSettings batchDeleteEntitiesOperationSettings; + private final PagedCallSettings< + ListLocationsRequest, ListLocationsResponse, ListLocationsPagedResponse> + listLocationsSettings; + private final UnaryCallSettings getLocationSettings; private static final PagedListDescriptor< ListEntityTypesRequest, ListEntityTypesResponse, EntityType> @@ -183,6 +192,42 @@ public Iterable extractResources(ListEntityTypesResponse payload) { } }; + private static final PagedListDescriptor + LIST_LOCATIONS_PAGE_STR_DESC = + new PagedListDescriptor() { + @Override + public String emptyToken() { + return ""; + } + + @Override + public ListLocationsRequest injectToken(ListLocationsRequest payload, String token) { + return ListLocationsRequest.newBuilder(payload).setPageToken(token).build(); + } + + @Override + public ListLocationsRequest injectPageSize(ListLocationsRequest payload, int pageSize) { + return ListLocationsRequest.newBuilder(payload).setPageSize(pageSize).build(); + } + + @Override + public Integer extractPageSize(ListLocationsRequest payload) { + return payload.getPageSize(); + } + + @Override + public String extractNextToken(ListLocationsResponse payload) { + return payload.getNextPageToken(); + } + + @Override + public Iterable extractResources(ListLocationsResponse payload) { + return payload.getLocationsList() == null + ? ImmutableList.of() + : payload.getLocationsList(); + } + }; + private static final PagedListResponseFactory< ListEntityTypesRequest, ListEntityTypesResponse, ListEntityTypesPagedResponse> LIST_ENTITY_TYPES_PAGE_STR_FACT = @@ -200,6 +245,23 @@ public ApiFuture getFuturePagedResponse( } }; + private static final PagedListResponseFactory< + ListLocationsRequest, ListLocationsResponse, ListLocationsPagedResponse> + LIST_LOCATIONS_PAGE_STR_FACT = + new PagedListResponseFactory< + ListLocationsRequest, ListLocationsResponse, ListLocationsPagedResponse>() { + @Override + public ApiFuture getFuturePagedResponse( + UnaryCallable callable, + ListLocationsRequest request, + ApiCallContext context, + ApiFuture futureResponse) { + PageContext pageContext = + PageContext.create(callable, LIST_LOCATIONS_PAGE_STR_DESC, request, context); + return ListLocationsPagedResponse.createAsync(pageContext, futureResponse); + } + }; + /** Returns the object with the settings used for calls to listEntityTypes. */ public PagedCallSettings< ListEntityTypesRequest, ListEntityTypesResponse, ListEntityTypesPagedResponse> @@ -285,6 +347,17 @@ public UnaryCallSettings batchDeleteEntit return batchDeleteEntitiesOperationSettings; } + /** Returns the object with the settings used for calls to listLocations. */ + public PagedCallSettings + listLocationsSettings() { + return listLocationsSettings; + } + + /** Returns the object with the settings used for calls to getLocation. */ + public UnaryCallSettings getLocationSettings() { + return getLocationSettings; + } + public EntityTypesStub createStub() throws IOException { if (getTransportChannelProvider() .getTransportName() @@ -411,6 +484,8 @@ protected EntityTypesStubSettings(Builder settingsBuilder) throws IOException { batchDeleteEntitiesSettings = settingsBuilder.batchDeleteEntitiesSettings().build(); batchDeleteEntitiesOperationSettings = settingsBuilder.batchDeleteEntitiesOperationSettings().build(); + listLocationsSettings = settingsBuilder.listLocationsSettings().build(); + getLocationSettings = settingsBuilder.getLocationSettings().build(); } /** Builder for EntityTypesStubSettings. */ @@ -447,6 +522,10 @@ public static class Builder extends StubSettings.Builder batchDeleteEntitiesOperationSettings; + private final PagedCallSettings.Builder< + ListLocationsRequest, ListLocationsResponse, ListLocationsPagedResponse> + listLocationsSettings; + private final UnaryCallSettings.Builder getLocationSettings; private static final ImmutableMap> RETRYABLE_CODE_DEFINITIONS; @@ -500,6 +579,8 @@ protected Builder(ClientContext clientContext) { batchUpdateEntitiesOperationSettings = OperationCallSettings.newBuilder(); batchDeleteEntitiesSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); batchDeleteEntitiesOperationSettings = OperationCallSettings.newBuilder(); + listLocationsSettings = PagedCallSettings.newBuilder(LIST_LOCATIONS_PAGE_STR_FACT); + getLocationSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); unaryMethodSettingsBuilders = ImmutableList.>of( @@ -512,7 +593,9 @@ protected Builder(ClientContext clientContext) { batchDeleteEntityTypesSettings, batchCreateEntitiesSettings, batchUpdateEntitiesSettings, - batchDeleteEntitiesSettings); + batchDeleteEntitiesSettings, + listLocationsSettings, + getLocationSettings); initDefaults(this); } @@ -539,6 +622,8 @@ protected Builder(EntityTypesStubSettings settings) { batchDeleteEntitiesSettings = settings.batchDeleteEntitiesSettings.toBuilder(); batchDeleteEntitiesOperationSettings = settings.batchDeleteEntitiesOperationSettings.toBuilder(); + listLocationsSettings = settings.listLocationsSettings.toBuilder(); + getLocationSettings = settings.getLocationSettings.toBuilder(); unaryMethodSettingsBuilders = ImmutableList.>of( @@ -551,7 +636,9 @@ protected Builder(EntityTypesStubSettings settings) { batchDeleteEntityTypesSettings, batchCreateEntitiesSettings, batchUpdateEntitiesSettings, - batchDeleteEntitiesSettings); + batchDeleteEntitiesSettings, + listLocationsSettings, + getLocationSettings); } private static Builder createDefault() { @@ -631,6 +718,16 @@ private static Builder initDefaults(Builder builder) { .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes")) .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params")); + builder + .listLocationsSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params")); + + builder + .getLocationSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params")); + builder .batchUpdateEntityTypesOperationSettings() .setInitialCallSettings( @@ -870,6 +967,18 @@ public UnaryCallSettings.Builder deleteEntityTyp return batchDeleteEntitiesOperationSettings; } + /** Returns the builder for the settings used for calls to listLocations. */ + public PagedCallSettings.Builder< + ListLocationsRequest, ListLocationsResponse, ListLocationsPagedResponse> + listLocationsSettings() { + return listLocationsSettings; + } + + /** Returns the builder for the settings used for calls to getLocation. */ + public UnaryCallSettings.Builder getLocationSettings() { + return getLocationSettings; + } + @Override public EntityTypesStubSettings build() throws IOException { return new EntityTypesStubSettings(this); diff --git a/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2/stub/EnvironmentsStub.java b/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2/stub/EnvironmentsStub.java index b3a347b70..f59a4f113 100644 --- a/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2/stub/EnvironmentsStub.java +++ b/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2/stub/EnvironmentsStub.java @@ -18,6 +18,7 @@ import static com.google.cloud.dialogflow.v2.EnvironmentsClient.GetEnvironmentHistoryPagedResponse; import static com.google.cloud.dialogflow.v2.EnvironmentsClient.ListEnvironmentsPagedResponse; +import static com.google.cloud.dialogflow.v2.EnvironmentsClient.ListLocationsPagedResponse; import com.google.api.gax.core.BackgroundResource; import com.google.api.gax.rpc.UnaryCallable; @@ -30,6 +31,10 @@ import com.google.cloud.dialogflow.v2.ListEnvironmentsRequest; import com.google.cloud.dialogflow.v2.ListEnvironmentsResponse; import com.google.cloud.dialogflow.v2.UpdateEnvironmentRequest; +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.ListLocationsResponse; +import com.google.cloud.location.Location; import com.google.protobuf.Empty; import javax.annotation.Generated; @@ -79,6 +84,19 @@ public UnaryCallable deleteEnvironmentCallable( throw new UnsupportedOperationException("Not implemented: getEnvironmentHistoryCallable()"); } + public UnaryCallable + listLocationsPagedCallable() { + throw new UnsupportedOperationException("Not implemented: listLocationsPagedCallable()"); + } + + public UnaryCallable listLocationsCallable() { + throw new UnsupportedOperationException("Not implemented: listLocationsCallable()"); + } + + public UnaryCallable getLocationCallable() { + throw new UnsupportedOperationException("Not implemented: getLocationCallable()"); + } + @Override public abstract void close(); } diff --git a/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2/stub/EnvironmentsStubSettings.java b/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2/stub/EnvironmentsStubSettings.java index 90f67a45a..e24852da0 100644 --- a/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2/stub/EnvironmentsStubSettings.java +++ b/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2/stub/EnvironmentsStubSettings.java @@ -18,6 +18,7 @@ import static com.google.cloud.dialogflow.v2.EnvironmentsClient.GetEnvironmentHistoryPagedResponse; import static com.google.cloud.dialogflow.v2.EnvironmentsClient.ListEnvironmentsPagedResponse; +import static com.google.cloud.dialogflow.v2.EnvironmentsClient.ListLocationsPagedResponse; import com.google.api.core.ApiFunction; import com.google.api.core.ApiFuture; @@ -53,6 +54,10 @@ import com.google.cloud.dialogflow.v2.ListEnvironmentsRequest; import com.google.cloud.dialogflow.v2.ListEnvironmentsResponse; import com.google.cloud.dialogflow.v2.UpdateEnvironmentRequest; +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.ListLocationsResponse; +import com.google.cloud.location.Location; import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableMap; import com.google.common.collect.ImmutableSet; @@ -116,6 +121,10 @@ public class EnvironmentsStubSettings extends StubSettings getEnvironmentHistorySettings; + private final PagedCallSettings< + ListLocationsRequest, ListLocationsResponse, ListLocationsPagedResponse> + listLocationsSettings; + private final UnaryCallSettings getLocationSettings; private static final PagedListDescriptor< ListEnvironmentsRequest, ListEnvironmentsResponse, Environment> @@ -197,6 +206,42 @@ public Iterable extractResources(EnvironmentHistory pa } }; + private static final PagedListDescriptor + LIST_LOCATIONS_PAGE_STR_DESC = + new PagedListDescriptor() { + @Override + public String emptyToken() { + return ""; + } + + @Override + public ListLocationsRequest injectToken(ListLocationsRequest payload, String token) { + return ListLocationsRequest.newBuilder(payload).setPageToken(token).build(); + } + + @Override + public ListLocationsRequest injectPageSize(ListLocationsRequest payload, int pageSize) { + return ListLocationsRequest.newBuilder(payload).setPageSize(pageSize).build(); + } + + @Override + public Integer extractPageSize(ListLocationsRequest payload) { + return payload.getPageSize(); + } + + @Override + public String extractNextToken(ListLocationsResponse payload) { + return payload.getNextPageToken(); + } + + @Override + public Iterable extractResources(ListLocationsResponse payload) { + return payload.getLocationsList() == null + ? ImmutableList.of() + : payload.getLocationsList(); + } + }; + private static final PagedListResponseFactory< ListEnvironmentsRequest, ListEnvironmentsResponse, ListEnvironmentsPagedResponse> LIST_ENVIRONMENTS_PAGE_STR_FACT = @@ -238,6 +283,23 @@ public ApiFuture getFuturePagedResponse( } }; + private static final PagedListResponseFactory< + ListLocationsRequest, ListLocationsResponse, ListLocationsPagedResponse> + LIST_LOCATIONS_PAGE_STR_FACT = + new PagedListResponseFactory< + ListLocationsRequest, ListLocationsResponse, ListLocationsPagedResponse>() { + @Override + public ApiFuture getFuturePagedResponse( + UnaryCallable callable, + ListLocationsRequest request, + ApiCallContext context, + ApiFuture futureResponse) { + PageContext pageContext = + PageContext.create(callable, LIST_LOCATIONS_PAGE_STR_DESC, request, context); + return ListLocationsPagedResponse.createAsync(pageContext, futureResponse); + } + }; + /** Returns the object with the settings used for calls to listEnvironments. */ public PagedCallSettings< ListEnvironmentsRequest, ListEnvironmentsResponse, ListEnvironmentsPagedResponse> @@ -272,6 +334,17 @@ public UnaryCallSettings deleteEnvironmentSetti return getEnvironmentHistorySettings; } + /** Returns the object with the settings used for calls to listLocations. */ + public PagedCallSettings + listLocationsSettings() { + return listLocationsSettings; + } + + /** Returns the object with the settings used for calls to getLocation. */ + public UnaryCallSettings getLocationSettings() { + return getLocationSettings; + } + public EnvironmentsStub createStub() throws IOException { if (getTransportChannelProvider() .getTransportName() @@ -384,6 +457,8 @@ protected EnvironmentsStubSettings(Builder settingsBuilder) throws IOException { updateEnvironmentSettings = settingsBuilder.updateEnvironmentSettings().build(); deleteEnvironmentSettings = settingsBuilder.deleteEnvironmentSettings().build(); getEnvironmentHistorySettings = settingsBuilder.getEnvironmentHistorySettings().build(); + listLocationsSettings = settingsBuilder.listLocationsSettings().build(); + getLocationSettings = settingsBuilder.getLocationSettings().build(); } /** Builder for EnvironmentsStubSettings. */ @@ -403,6 +478,10 @@ public static class Builder extends StubSettings.Builder getEnvironmentHistorySettings; + private final PagedCallSettings.Builder< + ListLocationsRequest, ListLocationsResponse, ListLocationsPagedResponse> + listLocationsSettings; + private final UnaryCallSettings.Builder getLocationSettings; private static final ImmutableMap> RETRYABLE_CODE_DEFINITIONS; @@ -448,6 +527,8 @@ protected Builder(ClientContext clientContext) { deleteEnvironmentSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); getEnvironmentHistorySettings = PagedCallSettings.newBuilder(GET_ENVIRONMENT_HISTORY_PAGE_STR_FACT); + listLocationsSettings = PagedCallSettings.newBuilder(LIST_LOCATIONS_PAGE_STR_FACT); + getLocationSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); unaryMethodSettingsBuilders = ImmutableList.>of( @@ -456,7 +537,9 @@ protected Builder(ClientContext clientContext) { createEnvironmentSettings, updateEnvironmentSettings, deleteEnvironmentSettings, - getEnvironmentHistorySettings); + getEnvironmentHistorySettings, + listLocationsSettings, + getLocationSettings); initDefaults(this); } @@ -469,6 +552,8 @@ protected Builder(EnvironmentsStubSettings settings) { updateEnvironmentSettings = settings.updateEnvironmentSettings.toBuilder(); deleteEnvironmentSettings = settings.deleteEnvironmentSettings.toBuilder(); getEnvironmentHistorySettings = settings.getEnvironmentHistorySettings.toBuilder(); + listLocationsSettings = settings.listLocationsSettings.toBuilder(); + getLocationSettings = settings.getLocationSettings.toBuilder(); unaryMethodSettingsBuilders = ImmutableList.>of( @@ -477,7 +562,9 @@ protected Builder(EnvironmentsStubSettings settings) { createEnvironmentSettings, updateEnvironmentSettings, deleteEnvironmentSettings, - getEnvironmentHistorySettings); + getEnvironmentHistorySettings, + listLocationsSettings, + getLocationSettings); } private static Builder createDefault() { @@ -537,6 +624,16 @@ private static Builder initDefaults(Builder builder) { .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes")) .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params")); + builder + .listLocationsSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params")); + + builder + .getLocationSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params")); + return builder; } @@ -591,6 +688,18 @@ public UnaryCallSettings.Builder deleteEnvironm return getEnvironmentHistorySettings; } + /** Returns the builder for the settings used for calls to listLocations. */ + public PagedCallSettings.Builder< + ListLocationsRequest, ListLocationsResponse, ListLocationsPagedResponse> + listLocationsSettings() { + return listLocationsSettings; + } + + /** Returns the builder for the settings used for calls to getLocation. */ + public UnaryCallSettings.Builder getLocationSettings() { + return getLocationSettings; + } + @Override public EnvironmentsStubSettings build() throws IOException { return new EnvironmentsStubSettings(this); diff --git a/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2/stub/FulfillmentsStub.java b/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2/stub/FulfillmentsStub.java index d59549f73..0b637b91b 100644 --- a/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2/stub/FulfillmentsStub.java +++ b/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2/stub/FulfillmentsStub.java @@ -16,11 +16,17 @@ package com.google.cloud.dialogflow.v2.stub; +import static com.google.cloud.dialogflow.v2.FulfillmentsClient.ListLocationsPagedResponse; + import com.google.api.gax.core.BackgroundResource; import com.google.api.gax.rpc.UnaryCallable; import com.google.cloud.dialogflow.v2.Fulfillment; import com.google.cloud.dialogflow.v2.GetFulfillmentRequest; import com.google.cloud.dialogflow.v2.UpdateFulfillmentRequest; +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.ListLocationsResponse; +import com.google.cloud.location.Location; import javax.annotation.Generated; // AUTO-GENERATED DOCUMENTATION AND CLASS. @@ -40,6 +46,19 @@ public UnaryCallable updateFulfillmentCal throw new UnsupportedOperationException("Not implemented: updateFulfillmentCallable()"); } + public UnaryCallable + listLocationsPagedCallable() { + throw new UnsupportedOperationException("Not implemented: listLocationsPagedCallable()"); + } + + public UnaryCallable listLocationsCallable() { + throw new UnsupportedOperationException("Not implemented: listLocationsCallable()"); + } + + public UnaryCallable getLocationCallable() { + throw new UnsupportedOperationException("Not implemented: getLocationCallable()"); + } + @Override public abstract void close(); } diff --git a/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2/stub/FulfillmentsStubSettings.java b/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2/stub/FulfillmentsStubSettings.java index d285d3af2..fd5fbf0cd 100644 --- a/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2/stub/FulfillmentsStubSettings.java +++ b/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2/stub/FulfillmentsStubSettings.java @@ -16,7 +16,10 @@ package com.google.cloud.dialogflow.v2.stub; +import static com.google.cloud.dialogflow.v2.FulfillmentsClient.ListLocationsPagedResponse; + import com.google.api.core.ApiFunction; +import com.google.api.core.ApiFuture; import com.google.api.core.BetaApi; import com.google.api.gax.core.GaxProperties; import com.google.api.gax.core.GoogleCredentialsProvider; @@ -28,15 +31,25 @@ import com.google.api.gax.httpjson.HttpJsonTransportChannel; import com.google.api.gax.httpjson.InstantiatingHttpJsonChannelProvider; import com.google.api.gax.retrying.RetrySettings; +import com.google.api.gax.rpc.ApiCallContext; import com.google.api.gax.rpc.ApiClientHeaderProvider; import com.google.api.gax.rpc.ClientContext; +import com.google.api.gax.rpc.PageContext; +import com.google.api.gax.rpc.PagedCallSettings; +import com.google.api.gax.rpc.PagedListDescriptor; +import com.google.api.gax.rpc.PagedListResponseFactory; import com.google.api.gax.rpc.StatusCode; import com.google.api.gax.rpc.StubSettings; import com.google.api.gax.rpc.TransportChannelProvider; import com.google.api.gax.rpc.UnaryCallSettings; +import com.google.api.gax.rpc.UnaryCallable; import com.google.cloud.dialogflow.v2.Fulfillment; import com.google.cloud.dialogflow.v2.GetFulfillmentRequest; import com.google.cloud.dialogflow.v2.UpdateFulfillmentRequest; +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.ListLocationsResponse; +import com.google.cloud.location.Location; import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableMap; import com.google.common.collect.ImmutableSet; @@ -91,6 +104,63 @@ public class FulfillmentsStubSettings extends StubSettings getFulfillmentSettings; private final UnaryCallSettings updateFulfillmentSettings; + private final PagedCallSettings< + ListLocationsRequest, ListLocationsResponse, ListLocationsPagedResponse> + listLocationsSettings; + private final UnaryCallSettings getLocationSettings; + + private static final PagedListDescriptor + LIST_LOCATIONS_PAGE_STR_DESC = + new PagedListDescriptor() { + @Override + public String emptyToken() { + return ""; + } + + @Override + public ListLocationsRequest injectToken(ListLocationsRequest payload, String token) { + return ListLocationsRequest.newBuilder(payload).setPageToken(token).build(); + } + + @Override + public ListLocationsRequest injectPageSize(ListLocationsRequest payload, int pageSize) { + return ListLocationsRequest.newBuilder(payload).setPageSize(pageSize).build(); + } + + @Override + public Integer extractPageSize(ListLocationsRequest payload) { + return payload.getPageSize(); + } + + @Override + public String extractNextToken(ListLocationsResponse payload) { + return payload.getNextPageToken(); + } + + @Override + public Iterable extractResources(ListLocationsResponse payload) { + return payload.getLocationsList() == null + ? ImmutableList.of() + : payload.getLocationsList(); + } + }; + + private static final PagedListResponseFactory< + ListLocationsRequest, ListLocationsResponse, ListLocationsPagedResponse> + LIST_LOCATIONS_PAGE_STR_FACT = + new PagedListResponseFactory< + ListLocationsRequest, ListLocationsResponse, ListLocationsPagedResponse>() { + @Override + public ApiFuture getFuturePagedResponse( + UnaryCallable callable, + ListLocationsRequest request, + ApiCallContext context, + ApiFuture futureResponse) { + PageContext pageContext = + PageContext.create(callable, LIST_LOCATIONS_PAGE_STR_DESC, request, context); + return ListLocationsPagedResponse.createAsync(pageContext, futureResponse); + } + }; /** Returns the object with the settings used for calls to getFulfillment. */ public UnaryCallSettings getFulfillmentSettings() { @@ -102,6 +172,17 @@ public UnaryCallSettings updateFulfillmen return updateFulfillmentSettings; } + /** Returns the object with the settings used for calls to listLocations. */ + public PagedCallSettings + listLocationsSettings() { + return listLocationsSettings; + } + + /** Returns the object with the settings used for calls to getLocation. */ + public UnaryCallSettings getLocationSettings() { + return getLocationSettings; + } + public FulfillmentsStub createStub() throws IOException { if (getTransportChannelProvider() .getTransportName() @@ -210,6 +291,8 @@ protected FulfillmentsStubSettings(Builder settingsBuilder) throws IOException { getFulfillmentSettings = settingsBuilder.getFulfillmentSettings().build(); updateFulfillmentSettings = settingsBuilder.updateFulfillmentSettings().build(); + listLocationsSettings = settingsBuilder.listLocationsSettings().build(); + getLocationSettings = settingsBuilder.getLocationSettings().build(); } /** Builder for FulfillmentsStubSettings. */ @@ -219,6 +302,10 @@ public static class Builder extends StubSettings.Builder updateFulfillmentSettings; + private final PagedCallSettings.Builder< + ListLocationsRequest, ListLocationsResponse, ListLocationsPagedResponse> + listLocationsSettings; + private final UnaryCallSettings.Builder getLocationSettings; private static final ImmutableMap> RETRYABLE_CODE_DEFINITIONS; @@ -259,10 +346,15 @@ protected Builder(ClientContext clientContext) { getFulfillmentSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); updateFulfillmentSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + listLocationsSettings = PagedCallSettings.newBuilder(LIST_LOCATIONS_PAGE_STR_FACT); + getLocationSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); unaryMethodSettingsBuilders = ImmutableList.>of( - getFulfillmentSettings, updateFulfillmentSettings); + getFulfillmentSettings, + updateFulfillmentSettings, + listLocationsSettings, + getLocationSettings); initDefaults(this); } @@ -271,10 +363,15 @@ protected Builder(FulfillmentsStubSettings settings) { getFulfillmentSettings = settings.getFulfillmentSettings.toBuilder(); updateFulfillmentSettings = settings.updateFulfillmentSettings.toBuilder(); + listLocationsSettings = settings.listLocationsSettings.toBuilder(); + getLocationSettings = settings.getLocationSettings.toBuilder(); unaryMethodSettingsBuilders = ImmutableList.>of( - getFulfillmentSettings, updateFulfillmentSettings); + getFulfillmentSettings, + updateFulfillmentSettings, + listLocationsSettings, + getLocationSettings); } private static Builder createDefault() { @@ -314,6 +411,16 @@ private static Builder initDefaults(Builder builder) { .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes")) .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params")); + builder + .listLocationsSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params")); + + builder + .getLocationSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params")); + return builder; } @@ -343,6 +450,18 @@ public UnaryCallSettings.Builder getFulfillm return updateFulfillmentSettings; } + /** Returns the builder for the settings used for calls to listLocations. */ + public PagedCallSettings.Builder< + ListLocationsRequest, ListLocationsResponse, ListLocationsPagedResponse> + listLocationsSettings() { + return listLocationsSettings; + } + + /** Returns the builder for the settings used for calls to getLocation. */ + public UnaryCallSettings.Builder getLocationSettings() { + return getLocationSettings; + } + @Override public FulfillmentsStubSettings build() throws IOException { return new FulfillmentsStubSettings(this); diff --git a/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2/stub/GrpcAgentsStub.java b/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2/stub/GrpcAgentsStub.java index 68ce7f876..b121db992 100644 --- a/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2/stub/GrpcAgentsStub.java +++ b/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2/stub/GrpcAgentsStub.java @@ -16,6 +16,7 @@ package com.google.cloud.dialogflow.v2.stub; +import static com.google.cloud.dialogflow.v2.AgentsClient.ListLocationsPagedResponse; import static com.google.cloud.dialogflow.v2.AgentsClient.SearchAgentsPagedResponse; import com.google.api.gax.core.BackgroundResource; @@ -38,6 +39,10 @@ import com.google.cloud.dialogflow.v2.SetAgentRequest; import com.google.cloud.dialogflow.v2.TrainAgentRequest; import com.google.cloud.dialogflow.v2.ValidationResult; +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.ListLocationsResponse; +import com.google.cloud.location.Location; import com.google.common.collect.ImmutableMap; import com.google.longrunning.Operation; import com.google.longrunning.stub.GrpcOperationsStub; @@ -134,6 +139,25 @@ public class GrpcAgentsStub extends AgentsStub { .setResponseMarshaller(ProtoUtils.marshaller(ValidationResult.getDefaultInstance())) .build(); + private static final MethodDescriptor + listLocationsMethodDescriptor = + MethodDescriptor.newBuilder() + .setType(MethodDescriptor.MethodType.UNARY) + .setFullMethodName("google.cloud.location.Locations/ListLocations") + .setRequestMarshaller( + ProtoUtils.marshaller(ListLocationsRequest.getDefaultInstance())) + .setResponseMarshaller( + ProtoUtils.marshaller(ListLocationsResponse.getDefaultInstance())) + .build(); + + private static final MethodDescriptor getLocationMethodDescriptor = + MethodDescriptor.newBuilder() + .setType(MethodDescriptor.MethodType.UNARY) + .setFullMethodName("google.cloud.location.Locations/GetLocation") + .setRequestMarshaller(ProtoUtils.marshaller(GetLocationRequest.getDefaultInstance())) + .setResponseMarshaller(ProtoUtils.marshaller(Location.getDefaultInstance())) + .build(); + private final UnaryCallable getAgentCallable; private final UnaryCallable setAgentCallable; private final UnaryCallable deleteAgentCallable; @@ -151,6 +175,10 @@ public class GrpcAgentsStub extends AgentsStub { private final OperationCallable restoreAgentOperationCallable; private final UnaryCallable getValidationResultCallable; + private final UnaryCallable listLocationsCallable; + private final UnaryCallable + listLocationsPagedCallable; + private final UnaryCallable getLocationCallable; private final BackgroundResource backgroundResources; private final GrpcOperationsStub operationsStub; @@ -282,6 +310,26 @@ protected GrpcAgentsStub( return params.build(); }) .build(); + GrpcCallSettings listLocationsTransportSettings = + GrpcCallSettings.newBuilder() + .setMethodDescriptor(listLocationsMethodDescriptor) + .setParamsExtractor( + request -> { + ImmutableMap.Builder params = ImmutableMap.builder(); + params.put("name", String.valueOf(request.getName())); + return params.build(); + }) + .build(); + GrpcCallSettings getLocationTransportSettings = + GrpcCallSettings.newBuilder() + .setMethodDescriptor(getLocationMethodDescriptor) + .setParamsExtractor( + request -> { + ImmutableMap.Builder params = ImmutableMap.builder(); + params.put("name", String.valueOf(request.getName())); + return params.build(); + }) + .build(); this.getAgentCallable = callableFactory.createUnaryCallable( @@ -339,6 +387,15 @@ protected GrpcAgentsStub( getValidationResultTransportSettings, settings.getValidationResultSettings(), clientContext); + this.listLocationsCallable = + callableFactory.createUnaryCallable( + listLocationsTransportSettings, settings.listLocationsSettings(), clientContext); + this.listLocationsPagedCallable = + callableFactory.createPagedCallable( + listLocationsTransportSettings, settings.listLocationsSettings(), clientContext); + this.getLocationCallable = + callableFactory.createUnaryCallable( + getLocationTransportSettings, settings.getLocationSettings(), clientContext); this.backgroundResources = new BackgroundResourceAggregation(clientContext.getBackgroundResources()); @@ -419,6 +476,22 @@ public UnaryCallable getValidation return getValidationResultCallable; } + @Override + public UnaryCallable listLocationsCallable() { + return listLocationsCallable; + } + + @Override + public UnaryCallable + listLocationsPagedCallable() { + return listLocationsPagedCallable; + } + + @Override + public UnaryCallable getLocationCallable() { + return getLocationCallable; + } + @Override public final void close() { try { diff --git a/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2/stub/GrpcAnswerRecordsStub.java b/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2/stub/GrpcAnswerRecordsStub.java index b3104582c..1fbb439cd 100644 --- a/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2/stub/GrpcAnswerRecordsStub.java +++ b/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2/stub/GrpcAnswerRecordsStub.java @@ -17,6 +17,7 @@ package com.google.cloud.dialogflow.v2.stub; import static com.google.cloud.dialogflow.v2.AnswerRecordsClient.ListAnswerRecordsPagedResponse; +import static com.google.cloud.dialogflow.v2.AnswerRecordsClient.ListLocationsPagedResponse; import com.google.api.gax.core.BackgroundResource; import com.google.api.gax.core.BackgroundResourceAggregation; @@ -28,6 +29,10 @@ import com.google.cloud.dialogflow.v2.ListAnswerRecordsRequest; import com.google.cloud.dialogflow.v2.ListAnswerRecordsResponse; import com.google.cloud.dialogflow.v2.UpdateAnswerRecordRequest; +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.ListLocationsResponse; +import com.google.cloud.location.Location; import com.google.common.collect.ImmutableMap; import com.google.longrunning.stub.GrpcOperationsStub; import io.grpc.MethodDescriptor; @@ -65,11 +70,34 @@ public class GrpcAnswerRecordsStub extends AnswerRecordsStub { .setResponseMarshaller(ProtoUtils.marshaller(AnswerRecord.getDefaultInstance())) .build(); + private static final MethodDescriptor + listLocationsMethodDescriptor = + MethodDescriptor.newBuilder() + .setType(MethodDescriptor.MethodType.UNARY) + .setFullMethodName("google.cloud.location.Locations/ListLocations") + .setRequestMarshaller( + ProtoUtils.marshaller(ListLocationsRequest.getDefaultInstance())) + .setResponseMarshaller( + ProtoUtils.marshaller(ListLocationsResponse.getDefaultInstance())) + .build(); + + private static final MethodDescriptor getLocationMethodDescriptor = + MethodDescriptor.newBuilder() + .setType(MethodDescriptor.MethodType.UNARY) + .setFullMethodName("google.cloud.location.Locations/GetLocation") + .setRequestMarshaller(ProtoUtils.marshaller(GetLocationRequest.getDefaultInstance())) + .setResponseMarshaller(ProtoUtils.marshaller(Location.getDefaultInstance())) + .build(); + private final UnaryCallable listAnswerRecordsCallable; private final UnaryCallable listAnswerRecordsPagedCallable; private final UnaryCallable updateAnswerRecordCallable; + private final UnaryCallable listLocationsCallable; + private final UnaryCallable + listLocationsPagedCallable; + private final UnaryCallable getLocationCallable; private final BackgroundResource backgroundResources; private final GrpcOperationsStub operationsStub; @@ -135,6 +163,26 @@ protected GrpcAnswerRecordsStub( return params.build(); }) .build(); + GrpcCallSettings listLocationsTransportSettings = + GrpcCallSettings.newBuilder() + .setMethodDescriptor(listLocationsMethodDescriptor) + .setParamsExtractor( + request -> { + ImmutableMap.Builder params = ImmutableMap.builder(); + params.put("name", String.valueOf(request.getName())); + return params.build(); + }) + .build(); + GrpcCallSettings getLocationTransportSettings = + GrpcCallSettings.newBuilder() + .setMethodDescriptor(getLocationMethodDescriptor) + .setParamsExtractor( + request -> { + ImmutableMap.Builder params = ImmutableMap.builder(); + params.put("name", String.valueOf(request.getName())); + return params.build(); + }) + .build(); this.listAnswerRecordsCallable = callableFactory.createUnaryCallable( @@ -151,6 +199,15 @@ protected GrpcAnswerRecordsStub( updateAnswerRecordTransportSettings, settings.updateAnswerRecordSettings(), clientContext); + this.listLocationsCallable = + callableFactory.createUnaryCallable( + listLocationsTransportSettings, settings.listLocationsSettings(), clientContext); + this.listLocationsPagedCallable = + callableFactory.createPagedCallable( + listLocationsTransportSettings, settings.listLocationsSettings(), clientContext); + this.getLocationCallable = + callableFactory.createUnaryCallable( + getLocationTransportSettings, settings.getLocationSettings(), clientContext); this.backgroundResources = new BackgroundResourceAggregation(clientContext.getBackgroundResources()); @@ -177,6 +234,22 @@ public UnaryCallable updateAnswerRecord return updateAnswerRecordCallable; } + @Override + public UnaryCallable listLocationsCallable() { + return listLocationsCallable; + } + + @Override + public UnaryCallable + listLocationsPagedCallable() { + return listLocationsPagedCallable; + } + + @Override + public UnaryCallable getLocationCallable() { + return getLocationCallable; + } + @Override public final void close() { try { diff --git a/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2/stub/GrpcContextsStub.java b/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2/stub/GrpcContextsStub.java index e8ecf12be..ee5d0711f 100644 --- a/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2/stub/GrpcContextsStub.java +++ b/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2/stub/GrpcContextsStub.java @@ -17,6 +17,7 @@ package com.google.cloud.dialogflow.v2.stub; import static com.google.cloud.dialogflow.v2.ContextsClient.ListContextsPagedResponse; +import static com.google.cloud.dialogflow.v2.ContextsClient.ListLocationsPagedResponse; import com.google.api.gax.core.BackgroundResource; import com.google.api.gax.core.BackgroundResourceAggregation; @@ -32,6 +33,10 @@ import com.google.cloud.dialogflow.v2.ListContextsRequest; import com.google.cloud.dialogflow.v2.ListContextsResponse; import com.google.cloud.dialogflow.v2.UpdateContextRequest; +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.ListLocationsResponse; +import com.google.cloud.location.Location; import com.google.common.collect.ImmutableMap; import com.google.longrunning.stub.GrpcOperationsStub; import com.google.protobuf.Empty; @@ -105,6 +110,25 @@ public class GrpcContextsStub extends ContextsStub { .setResponseMarshaller(ProtoUtils.marshaller(Empty.getDefaultInstance())) .build(); + private static final MethodDescriptor + listLocationsMethodDescriptor = + MethodDescriptor.newBuilder() + .setType(MethodDescriptor.MethodType.UNARY) + .setFullMethodName("google.cloud.location.Locations/ListLocations") + .setRequestMarshaller( + ProtoUtils.marshaller(ListLocationsRequest.getDefaultInstance())) + .setResponseMarshaller( + ProtoUtils.marshaller(ListLocationsResponse.getDefaultInstance())) + .build(); + + private static final MethodDescriptor getLocationMethodDescriptor = + MethodDescriptor.newBuilder() + .setType(MethodDescriptor.MethodType.UNARY) + .setFullMethodName("google.cloud.location.Locations/GetLocation") + .setRequestMarshaller(ProtoUtils.marshaller(GetLocationRequest.getDefaultInstance())) + .setResponseMarshaller(ProtoUtils.marshaller(Location.getDefaultInstance())) + .build(); + private final UnaryCallable listContextsCallable; private final UnaryCallable listContextsPagedCallable; @@ -113,6 +137,10 @@ public class GrpcContextsStub extends ContextsStub { private final UnaryCallable updateContextCallable; private final UnaryCallable deleteContextCallable; private final UnaryCallable deleteAllContextsCallable; + private final UnaryCallable listLocationsCallable; + private final UnaryCallable + listLocationsPagedCallable; + private final UnaryCallable getLocationCallable; private final BackgroundResource backgroundResources; private final GrpcOperationsStub operationsStub; @@ -213,6 +241,26 @@ protected GrpcContextsStub( return params.build(); }) .build(); + GrpcCallSettings listLocationsTransportSettings = + GrpcCallSettings.newBuilder() + .setMethodDescriptor(listLocationsMethodDescriptor) + .setParamsExtractor( + request -> { + ImmutableMap.Builder params = ImmutableMap.builder(); + params.put("name", String.valueOf(request.getName())); + return params.build(); + }) + .build(); + GrpcCallSettings getLocationTransportSettings = + GrpcCallSettings.newBuilder() + .setMethodDescriptor(getLocationMethodDescriptor) + .setParamsExtractor( + request -> { + ImmutableMap.Builder params = ImmutableMap.builder(); + params.put("name", String.valueOf(request.getName())); + return params.build(); + }) + .build(); this.listContextsCallable = callableFactory.createUnaryCallable( @@ -237,6 +285,15 @@ protected GrpcContextsStub( deleteAllContextsTransportSettings, settings.deleteAllContextsSettings(), clientContext); + this.listLocationsCallable = + callableFactory.createUnaryCallable( + listLocationsTransportSettings, settings.listLocationsSettings(), clientContext); + this.listLocationsPagedCallable = + callableFactory.createPagedCallable( + listLocationsTransportSettings, settings.listLocationsSettings(), clientContext); + this.getLocationCallable = + callableFactory.createUnaryCallable( + getLocationTransportSettings, settings.getLocationSettings(), clientContext); this.backgroundResources = new BackgroundResourceAggregation(clientContext.getBackgroundResources()); @@ -281,6 +338,22 @@ public UnaryCallable deleteAllContextsCallable( return deleteAllContextsCallable; } + @Override + public UnaryCallable listLocationsCallable() { + return listLocationsCallable; + } + + @Override + public UnaryCallable + listLocationsPagedCallable() { + return listLocationsPagedCallable; + } + + @Override + public UnaryCallable getLocationCallable() { + return getLocationCallable; + } + @Override public final void close() { try { diff --git a/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2/stub/GrpcConversationDatasetsStub.java b/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2/stub/GrpcConversationDatasetsStub.java index 05430dd32..0ce099549 100644 --- a/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2/stub/GrpcConversationDatasetsStub.java +++ b/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2/stub/GrpcConversationDatasetsStub.java @@ -17,6 +17,7 @@ package com.google.cloud.dialogflow.v2.stub; import static com.google.cloud.dialogflow.v2.ConversationDatasetsClient.ListConversationDatasetsPagedResponse; +import static com.google.cloud.dialogflow.v2.ConversationDatasetsClient.ListLocationsPagedResponse; import com.google.api.gax.core.BackgroundResource; import com.google.api.gax.core.BackgroundResourceAggregation; @@ -36,6 +37,10 @@ import com.google.cloud.dialogflow.v2.ImportConversationDataRequest; import com.google.cloud.dialogflow.v2.ListConversationDatasetsRequest; import com.google.cloud.dialogflow.v2.ListConversationDatasetsResponse; +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.ListLocationsResponse; +import com.google.cloud.location.Location; import com.google.common.collect.ImmutableMap; import com.google.longrunning.Operation; import com.google.longrunning.stub.GrpcOperationsStub; @@ -113,6 +118,25 @@ public class GrpcConversationDatasetsStub extends ConversationDatasetsStub { .setResponseMarshaller(ProtoUtils.marshaller(Operation.getDefaultInstance())) .build(); + private static final MethodDescriptor + listLocationsMethodDescriptor = + MethodDescriptor.newBuilder() + .setType(MethodDescriptor.MethodType.UNARY) + .setFullMethodName("google.cloud.location.Locations/ListLocations") + .setRequestMarshaller( + ProtoUtils.marshaller(ListLocationsRequest.getDefaultInstance())) + .setResponseMarshaller( + ProtoUtils.marshaller(ListLocationsResponse.getDefaultInstance())) + .build(); + + private static final MethodDescriptor getLocationMethodDescriptor = + MethodDescriptor.newBuilder() + .setType(MethodDescriptor.MethodType.UNARY) + .setFullMethodName("google.cloud.location.Locations/GetLocation") + .setRequestMarshaller(ProtoUtils.marshaller(GetLocationRequest.getDefaultInstance())) + .setResponseMarshaller(ProtoUtils.marshaller(Location.getDefaultInstance())) + .build(); + private final UnaryCallable createConversationDatasetCallable; private final OperationCallable< @@ -139,6 +163,10 @@ public class GrpcConversationDatasetsStub extends ConversationDatasetsStub { ImportConversationDataOperationResponse, ImportConversationDataOperationMetadata> importConversationDataOperationCallable; + private final UnaryCallable listLocationsCallable; + private final UnaryCallable + listLocationsPagedCallable; + private final UnaryCallable getLocationCallable; private final BackgroundResource backgroundResources; private final GrpcOperationsStub operationsStub; @@ -240,6 +268,26 @@ protected GrpcConversationDatasetsStub( return params.build(); }) .build(); + GrpcCallSettings listLocationsTransportSettings = + GrpcCallSettings.newBuilder() + .setMethodDescriptor(listLocationsMethodDescriptor) + .setParamsExtractor( + request -> { + ImmutableMap.Builder params = ImmutableMap.builder(); + params.put("name", String.valueOf(request.getName())); + return params.build(); + }) + .build(); + GrpcCallSettings getLocationTransportSettings = + GrpcCallSettings.newBuilder() + .setMethodDescriptor(getLocationMethodDescriptor) + .setParamsExtractor( + request -> { + ImmutableMap.Builder params = ImmutableMap.builder(); + params.put("name", String.valueOf(request.getName())); + return params.build(); + }) + .build(); this.createConversationDatasetCallable = callableFactory.createUnaryCallable( @@ -289,6 +337,15 @@ protected GrpcConversationDatasetsStub( settings.importConversationDataOperationSettings(), clientContext, operationsStub); + this.listLocationsCallable = + callableFactory.createUnaryCallable( + listLocationsTransportSettings, settings.listLocationsSettings(), clientContext); + this.listLocationsPagedCallable = + callableFactory.createPagedCallable( + listLocationsTransportSettings, settings.listLocationsSettings(), clientContext); + this.getLocationCallable = + callableFactory.createUnaryCallable( + getLocationTransportSettings, settings.getLocationSettings(), clientContext); this.backgroundResources = new BackgroundResourceAggregation(clientContext.getBackgroundResources()); @@ -358,6 +415,22 @@ public UnaryCallable importConversatio return importConversationDataOperationCallable; } + @Override + public UnaryCallable listLocationsCallable() { + return listLocationsCallable; + } + + @Override + public UnaryCallable + listLocationsPagedCallable() { + return listLocationsPagedCallable; + } + + @Override + public UnaryCallable getLocationCallable() { + return getLocationCallable; + } + @Override public final void close() { try { diff --git a/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2/stub/GrpcConversationModelsStub.java b/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2/stub/GrpcConversationModelsStub.java index ccda4a4e6..1851e8a76 100644 --- a/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2/stub/GrpcConversationModelsStub.java +++ b/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2/stub/GrpcConversationModelsStub.java @@ -18,6 +18,7 @@ import static com.google.cloud.dialogflow.v2.ConversationModelsClient.ListConversationModelEvaluationsPagedResponse; import static com.google.cloud.dialogflow.v2.ConversationModelsClient.ListConversationModelsPagedResponse; +import static com.google.cloud.dialogflow.v2.ConversationModelsClient.ListLocationsPagedResponse; import com.google.api.gax.core.BackgroundResource; import com.google.api.gax.core.BackgroundResourceAggregation; @@ -44,6 +45,10 @@ import com.google.cloud.dialogflow.v2.ListConversationModelsResponse; import com.google.cloud.dialogflow.v2.UndeployConversationModelOperationMetadata; import com.google.cloud.dialogflow.v2.UndeployConversationModelRequest; +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.ListLocationsResponse; +import com.google.cloud.location.Location; import com.google.common.collect.ImmutableMap; import com.google.longrunning.Operation; import com.google.longrunning.stub.GrpcOperationsStub; @@ -174,6 +179,25 @@ public class GrpcConversationModelsStub extends ConversationModelsStub { .setResponseMarshaller(ProtoUtils.marshaller(Operation.getDefaultInstance())) .build(); + private static final MethodDescriptor + listLocationsMethodDescriptor = + MethodDescriptor.newBuilder() + .setType(MethodDescriptor.MethodType.UNARY) + .setFullMethodName("google.cloud.location.Locations/ListLocations") + .setRequestMarshaller( + ProtoUtils.marshaller(ListLocationsRequest.getDefaultInstance())) + .setResponseMarshaller( + ProtoUtils.marshaller(ListLocationsResponse.getDefaultInstance())) + .build(); + + private static final MethodDescriptor getLocationMethodDescriptor = + MethodDescriptor.newBuilder() + .setType(MethodDescriptor.MethodType.UNARY) + .setFullMethodName("google.cloud.location.Locations/GetLocation") + .setRequestMarshaller(ProtoUtils.marshaller(GetLocationRequest.getDefaultInstance())) + .setResponseMarshaller(ProtoUtils.marshaller(Location.getDefaultInstance())) + .build(); + private final UnaryCallable createConversationModelCallable; private final OperationCallable< @@ -217,6 +241,10 @@ public class GrpcConversationModelsStub extends ConversationModelsStub { ConversationModelEvaluation, CreateConversationModelEvaluationOperationMetadata> createConversationModelEvaluationOperationCallable; + private final UnaryCallable listLocationsCallable; + private final UnaryCallable + listLocationsPagedCallable; + private final UnaryCallable getLocationCallable; private final BackgroundResource backgroundResources; private final GrpcOperationsStub operationsStub; @@ -366,6 +394,26 @@ protected GrpcConversationModelsStub( return params.build(); }) .build(); + GrpcCallSettings listLocationsTransportSettings = + GrpcCallSettings.newBuilder() + .setMethodDescriptor(listLocationsMethodDescriptor) + .setParamsExtractor( + request -> { + ImmutableMap.Builder params = ImmutableMap.builder(); + params.put("name", String.valueOf(request.getName())); + return params.build(); + }) + .build(); + GrpcCallSettings getLocationTransportSettings = + GrpcCallSettings.newBuilder() + .setMethodDescriptor(getLocationMethodDescriptor) + .setParamsExtractor( + request -> { + ImmutableMap.Builder params = ImmutableMap.builder(); + params.put("name", String.valueOf(request.getName())); + return params.build(); + }) + .build(); this.createConversationModelCallable = callableFactory.createUnaryCallable( @@ -452,6 +500,15 @@ protected GrpcConversationModelsStub( settings.createConversationModelEvaluationOperationSettings(), clientContext, operationsStub); + this.listLocationsCallable = + callableFactory.createUnaryCallable( + listLocationsTransportSettings, settings.listLocationsSettings(), clientContext); + this.listLocationsPagedCallable = + callableFactory.createPagedCallable( + listLocationsTransportSettings, settings.listLocationsSettings(), clientContext); + this.getLocationCallable = + callableFactory.createUnaryCallable( + getLocationTransportSettings, settings.getLocationSettings(), clientContext); this.backgroundResources = new BackgroundResourceAggregation(clientContext.getBackgroundResources()); @@ -568,6 +625,22 @@ public GrpcOperationsStub getOperationsStub() { return createConversationModelEvaluationOperationCallable; } + @Override + public UnaryCallable listLocationsCallable() { + return listLocationsCallable; + } + + @Override + public UnaryCallable + listLocationsPagedCallable() { + return listLocationsPagedCallable; + } + + @Override + public UnaryCallable getLocationCallable() { + return getLocationCallable; + } + @Override public final void close() { try { diff --git a/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2/stub/GrpcConversationProfilesStub.java b/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2/stub/GrpcConversationProfilesStub.java index 83ba799c5..0665ec5a4 100644 --- a/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2/stub/GrpcConversationProfilesStub.java +++ b/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2/stub/GrpcConversationProfilesStub.java @@ -17,6 +17,7 @@ package com.google.cloud.dialogflow.v2.stub; import static com.google.cloud.dialogflow.v2.ConversationProfilesClient.ListConversationProfilesPagedResponse; +import static com.google.cloud.dialogflow.v2.ConversationProfilesClient.ListLocationsPagedResponse; import com.google.api.gax.core.BackgroundResource; import com.google.api.gax.core.BackgroundResourceAggregation; @@ -36,6 +37,10 @@ import com.google.cloud.dialogflow.v2.SetSuggestionFeatureConfigOperationMetadata; import com.google.cloud.dialogflow.v2.SetSuggestionFeatureConfigRequest; import com.google.cloud.dialogflow.v2.UpdateConversationProfileRequest; +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.ListLocationsResponse; +import com.google.cloud.location.Location; import com.google.common.collect.ImmutableMap; import com.google.longrunning.Operation; import com.google.longrunning.stub.GrpcOperationsStub; @@ -137,6 +142,25 @@ public class GrpcConversationProfilesStub extends ConversationProfilesStub { .setResponseMarshaller(ProtoUtils.marshaller(Operation.getDefaultInstance())) .build(); + private static final MethodDescriptor + listLocationsMethodDescriptor = + MethodDescriptor.newBuilder() + .setType(MethodDescriptor.MethodType.UNARY) + .setFullMethodName("google.cloud.location.Locations/ListLocations") + .setRequestMarshaller( + ProtoUtils.marshaller(ListLocationsRequest.getDefaultInstance())) + .setResponseMarshaller( + ProtoUtils.marshaller(ListLocationsResponse.getDefaultInstance())) + .build(); + + private static final MethodDescriptor getLocationMethodDescriptor = + MethodDescriptor.newBuilder() + .setType(MethodDescriptor.MethodType.UNARY) + .setFullMethodName("google.cloud.location.Locations/GetLocation") + .setRequestMarshaller(ProtoUtils.marshaller(GetLocationRequest.getDefaultInstance())) + .setResponseMarshaller(ProtoUtils.marshaller(Location.getDefaultInstance())) + .build(); + private final UnaryCallable listConversationProfilesCallable; private final UnaryCallable< @@ -164,6 +188,10 @@ public class GrpcConversationProfilesStub extends ConversationProfilesStub { ConversationProfile, ClearSuggestionFeatureConfigOperationMetadata> clearSuggestionFeatureConfigOperationCallable; + private final UnaryCallable listLocationsCallable; + private final UnaryCallable + listLocationsPagedCallable; + private final UnaryCallable getLocationCallable; private final BackgroundResource backgroundResources; private final GrpcOperationsStub operationsStub; @@ -291,6 +319,26 @@ protected GrpcConversationProfilesStub( return params.build(); }) .build(); + GrpcCallSettings listLocationsTransportSettings = + GrpcCallSettings.newBuilder() + .setMethodDescriptor(listLocationsMethodDescriptor) + .setParamsExtractor( + request -> { + ImmutableMap.Builder params = ImmutableMap.builder(); + params.put("name", String.valueOf(request.getName())); + return params.build(); + }) + .build(); + GrpcCallSettings getLocationTransportSettings = + GrpcCallSettings.newBuilder() + .setMethodDescriptor(getLocationMethodDescriptor) + .setParamsExtractor( + request -> { + ImmutableMap.Builder params = ImmutableMap.builder(); + params.put("name", String.valueOf(request.getName())); + return params.build(); + }) + .build(); this.listConversationProfilesCallable = callableFactory.createUnaryCallable( @@ -344,6 +392,15 @@ protected GrpcConversationProfilesStub( settings.clearSuggestionFeatureConfigOperationSettings(), clientContext, operationsStub); + this.listLocationsCallable = + callableFactory.createUnaryCallable( + listLocationsTransportSettings, settings.listLocationsSettings(), clientContext); + this.listLocationsPagedCallable = + callableFactory.createPagedCallable( + listLocationsTransportSettings, settings.listLocationsSettings(), clientContext); + this.getLocationCallable = + callableFactory.createUnaryCallable( + getLocationTransportSettings, settings.getLocationSettings(), clientContext); this.backgroundResources = new BackgroundResourceAggregation(clientContext.getBackgroundResources()); @@ -419,6 +476,22 @@ public GrpcOperationsStub getOperationsStub() { return clearSuggestionFeatureConfigOperationCallable; } + @Override + public UnaryCallable listLocationsCallable() { + return listLocationsCallable; + } + + @Override + public UnaryCallable + listLocationsPagedCallable() { + return listLocationsPagedCallable; + } + + @Override + public UnaryCallable getLocationCallable() { + return getLocationCallable; + } + @Override public final void close() { try { diff --git a/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2/stub/GrpcConversationsStub.java b/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2/stub/GrpcConversationsStub.java index 292ef6cf8..3357f8784 100644 --- a/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2/stub/GrpcConversationsStub.java +++ b/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2/stub/GrpcConversationsStub.java @@ -17,6 +17,7 @@ package com.google.cloud.dialogflow.v2.stub; import static com.google.cloud.dialogflow.v2.ConversationsClient.ListConversationsPagedResponse; +import static com.google.cloud.dialogflow.v2.ConversationsClient.ListLocationsPagedResponse; import static com.google.cloud.dialogflow.v2.ConversationsClient.ListMessagesPagedResponse; import com.google.api.gax.core.BackgroundResource; @@ -33,6 +34,10 @@ import com.google.cloud.dialogflow.v2.ListConversationsResponse; import com.google.cloud.dialogflow.v2.ListMessagesRequest; import com.google.cloud.dialogflow.v2.ListMessagesResponse; +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.ListLocationsResponse; +import com.google.cloud.location.Location; import com.google.common.collect.ImmutableMap; import com.google.longrunning.stub.GrpcOperationsStub; import io.grpc.MethodDescriptor; @@ -100,6 +105,25 @@ public class GrpcConversationsStub extends ConversationsStub { ProtoUtils.marshaller(ListMessagesResponse.getDefaultInstance())) .build(); + private static final MethodDescriptor + listLocationsMethodDescriptor = + MethodDescriptor.newBuilder() + .setType(MethodDescriptor.MethodType.UNARY) + .setFullMethodName("google.cloud.location.Locations/ListLocations") + .setRequestMarshaller( + ProtoUtils.marshaller(ListLocationsRequest.getDefaultInstance())) + .setResponseMarshaller( + ProtoUtils.marshaller(ListLocationsResponse.getDefaultInstance())) + .build(); + + private static final MethodDescriptor getLocationMethodDescriptor = + MethodDescriptor.newBuilder() + .setType(MethodDescriptor.MethodType.UNARY) + .setFullMethodName("google.cloud.location.Locations/GetLocation") + .setRequestMarshaller(ProtoUtils.marshaller(GetLocationRequest.getDefaultInstance())) + .setResponseMarshaller(ProtoUtils.marshaller(Location.getDefaultInstance())) + .build(); + private final UnaryCallable createConversationCallable; private final UnaryCallable listConversationsCallable; @@ -111,6 +135,10 @@ public class GrpcConversationsStub extends ConversationsStub { private final UnaryCallable listMessagesCallable; private final UnaryCallable listMessagesPagedCallable; + private final UnaryCallable listLocationsCallable; + private final UnaryCallable + listLocationsPagedCallable; + private final UnaryCallable getLocationCallable; private final BackgroundResource backgroundResources; private final GrpcOperationsStub operationsStub; @@ -206,6 +234,26 @@ protected GrpcConversationsStub( return params.build(); }) .build(); + GrpcCallSettings listLocationsTransportSettings = + GrpcCallSettings.newBuilder() + .setMethodDescriptor(listLocationsMethodDescriptor) + .setParamsExtractor( + request -> { + ImmutableMap.Builder params = ImmutableMap.builder(); + params.put("name", String.valueOf(request.getName())); + return params.build(); + }) + .build(); + GrpcCallSettings getLocationTransportSettings = + GrpcCallSettings.newBuilder() + .setMethodDescriptor(getLocationMethodDescriptor) + .setParamsExtractor( + request -> { + ImmutableMap.Builder params = ImmutableMap.builder(); + params.put("name", String.valueOf(request.getName())); + return params.build(); + }) + .build(); this.createConversationCallable = callableFactory.createUnaryCallable( @@ -236,6 +284,15 @@ protected GrpcConversationsStub( this.listMessagesPagedCallable = callableFactory.createPagedCallable( listMessagesTransportSettings, settings.listMessagesSettings(), clientContext); + this.listLocationsCallable = + callableFactory.createUnaryCallable( + listLocationsTransportSettings, settings.listLocationsSettings(), clientContext); + this.listLocationsPagedCallable = + callableFactory.createPagedCallable( + listLocationsTransportSettings, settings.listLocationsSettings(), clientContext); + this.getLocationCallable = + callableFactory.createUnaryCallable( + getLocationTransportSettings, settings.getLocationSettings(), clientContext); this.backgroundResources = new BackgroundResourceAggregation(clientContext.getBackgroundResources()); @@ -282,6 +339,22 @@ public UnaryCallable listMessage return listMessagesPagedCallable; } + @Override + public UnaryCallable listLocationsCallable() { + return listLocationsCallable; + } + + @Override + public UnaryCallable + listLocationsPagedCallable() { + return listLocationsPagedCallable; + } + + @Override + public UnaryCallable getLocationCallable() { + return getLocationCallable; + } + @Override public final void close() { try { diff --git a/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2/stub/GrpcDocumentsStub.java b/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2/stub/GrpcDocumentsStub.java index 2f88b9591..a7abda763 100644 --- a/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2/stub/GrpcDocumentsStub.java +++ b/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2/stub/GrpcDocumentsStub.java @@ -17,6 +17,7 @@ package com.google.cloud.dialogflow.v2.stub; import static com.google.cloud.dialogflow.v2.DocumentsClient.ListDocumentsPagedResponse; +import static com.google.cloud.dialogflow.v2.DocumentsClient.ListLocationsPagedResponse; import com.google.api.gax.core.BackgroundResource; import com.google.api.gax.core.BackgroundResourceAggregation; @@ -37,6 +38,10 @@ import com.google.cloud.dialogflow.v2.ListDocumentsResponse; import com.google.cloud.dialogflow.v2.ReloadDocumentRequest; import com.google.cloud.dialogflow.v2.UpdateDocumentRequest; +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.ListLocationsResponse; +import com.google.cloud.location.Location; import com.google.common.collect.ImmutableMap; import com.google.longrunning.Operation; import com.google.longrunning.stub.GrpcOperationsStub; @@ -134,6 +139,25 @@ public class GrpcDocumentsStub extends DocumentsStub { .setResponseMarshaller(ProtoUtils.marshaller(Operation.getDefaultInstance())) .build(); + private static final MethodDescriptor + listLocationsMethodDescriptor = + MethodDescriptor.newBuilder() + .setType(MethodDescriptor.MethodType.UNARY) + .setFullMethodName("google.cloud.location.Locations/ListLocations") + .setRequestMarshaller( + ProtoUtils.marshaller(ListLocationsRequest.getDefaultInstance())) + .setResponseMarshaller( + ProtoUtils.marshaller(ListLocationsResponse.getDefaultInstance())) + .build(); + + private static final MethodDescriptor getLocationMethodDescriptor = + MethodDescriptor.newBuilder() + .setType(MethodDescriptor.MethodType.UNARY) + .setFullMethodName("google.cloud.location.Locations/GetLocation") + .setRequestMarshaller(ProtoUtils.marshaller(GetLocationRequest.getDefaultInstance())) + .setResponseMarshaller(ProtoUtils.marshaller(Location.getDefaultInstance())) + .build(); + private final UnaryCallable listDocumentsCallable; private final UnaryCallable listDocumentsPagedCallable; @@ -157,6 +181,10 @@ public class GrpcDocumentsStub extends DocumentsStub { private final UnaryCallable exportDocumentCallable; private final OperationCallable exportDocumentOperationCallable; + private final UnaryCallable listLocationsCallable; + private final UnaryCallable + listLocationsPagedCallable; + private final UnaryCallable getLocationCallable; private final BackgroundResource backgroundResources; private final GrpcOperationsStub operationsStub; @@ -279,6 +307,26 @@ protected GrpcDocumentsStub( return params.build(); }) .build(); + GrpcCallSettings listLocationsTransportSettings = + GrpcCallSettings.newBuilder() + .setMethodDescriptor(listLocationsMethodDescriptor) + .setParamsExtractor( + request -> { + ImmutableMap.Builder params = ImmutableMap.builder(); + params.put("name", String.valueOf(request.getName())); + return params.build(); + }) + .build(); + GrpcCallSettings getLocationTransportSettings = + GrpcCallSettings.newBuilder() + .setMethodDescriptor(getLocationMethodDescriptor) + .setParamsExtractor( + request -> { + ImmutableMap.Builder params = ImmutableMap.builder(); + params.put("name", String.valueOf(request.getName())); + return params.build(); + }) + .build(); this.listDocumentsCallable = callableFactory.createUnaryCallable( @@ -343,6 +391,15 @@ protected GrpcDocumentsStub( settings.exportDocumentOperationSettings(), clientContext, operationsStub); + this.listLocationsCallable = + callableFactory.createUnaryCallable( + listLocationsTransportSettings, settings.listLocationsSettings(), clientContext); + this.listLocationsPagedCallable = + callableFactory.createPagedCallable( + listLocationsTransportSettings, settings.listLocationsSettings(), clientContext); + this.getLocationCallable = + callableFactory.createUnaryCallable( + getLocationTransportSettings, settings.getLocationSettings(), clientContext); this.backgroundResources = new BackgroundResourceAggregation(clientContext.getBackgroundResources()); @@ -435,6 +492,22 @@ public UnaryCallable exportDocumentCallable() return exportDocumentOperationCallable; } + @Override + public UnaryCallable listLocationsCallable() { + return listLocationsCallable; + } + + @Override + public UnaryCallable + listLocationsPagedCallable() { + return listLocationsPagedCallable; + } + + @Override + public UnaryCallable getLocationCallable() { + return getLocationCallable; + } + @Override public final void close() { try { diff --git a/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2/stub/GrpcEntityTypesStub.java b/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2/stub/GrpcEntityTypesStub.java index e2f1e28c7..a7635e475 100644 --- a/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2/stub/GrpcEntityTypesStub.java +++ b/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2/stub/GrpcEntityTypesStub.java @@ -17,6 +17,7 @@ package com.google.cloud.dialogflow.v2.stub; import static com.google.cloud.dialogflow.v2.EntityTypesClient.ListEntityTypesPagedResponse; +import static com.google.cloud.dialogflow.v2.EntityTypesClient.ListLocationsPagedResponse; import com.google.api.gax.core.BackgroundResource; import com.google.api.gax.core.BackgroundResourceAggregation; @@ -38,6 +39,10 @@ import com.google.cloud.dialogflow.v2.ListEntityTypesRequest; import com.google.cloud.dialogflow.v2.ListEntityTypesResponse; import com.google.cloud.dialogflow.v2.UpdateEntityTypeRequest; +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.ListLocationsResponse; +import com.google.cloud.location.Location; import com.google.common.collect.ImmutableMap; import com.google.longrunning.Operation; import com.google.longrunning.stub.GrpcOperationsStub; @@ -158,6 +163,25 @@ public class GrpcEntityTypesStub extends EntityTypesStub { .setResponseMarshaller(ProtoUtils.marshaller(Operation.getDefaultInstance())) .build(); + private static final MethodDescriptor + listLocationsMethodDescriptor = + MethodDescriptor.newBuilder() + .setType(MethodDescriptor.MethodType.UNARY) + .setFullMethodName("google.cloud.location.Locations/ListLocations") + .setRequestMarshaller( + ProtoUtils.marshaller(ListLocationsRequest.getDefaultInstance())) + .setResponseMarshaller( + ProtoUtils.marshaller(ListLocationsResponse.getDefaultInstance())) + .build(); + + private static final MethodDescriptor getLocationMethodDescriptor = + MethodDescriptor.newBuilder() + .setType(MethodDescriptor.MethodType.UNARY) + .setFullMethodName("google.cloud.location.Locations/GetLocation") + .setRequestMarshaller(ProtoUtils.marshaller(GetLocationRequest.getDefaultInstance())) + .setResponseMarshaller(ProtoUtils.marshaller(Location.getDefaultInstance())) + .build(); + private final UnaryCallable listEntityTypesCallable; private final UnaryCallable @@ -184,6 +208,10 @@ public class GrpcEntityTypesStub extends EntityTypesStub { private final UnaryCallable batchDeleteEntitiesCallable; private final OperationCallable batchDeleteEntitiesOperationCallable; + private final UnaryCallable listLocationsCallable; + private final UnaryCallable + listLocationsPagedCallable; + private final UnaryCallable getLocationCallable; private final BackgroundResource backgroundResources; private final GrpcOperationsStub operationsStub; @@ -330,6 +358,26 @@ protected GrpcEntityTypesStub( return params.build(); }) .build(); + GrpcCallSettings listLocationsTransportSettings = + GrpcCallSettings.newBuilder() + .setMethodDescriptor(listLocationsMethodDescriptor) + .setParamsExtractor( + request -> { + ImmutableMap.Builder params = ImmutableMap.builder(); + params.put("name", String.valueOf(request.getName())); + return params.build(); + }) + .build(); + GrpcCallSettings getLocationTransportSettings = + GrpcCallSettings.newBuilder() + .setMethodDescriptor(getLocationMethodDescriptor) + .setParamsExtractor( + request -> { + ImmutableMap.Builder params = ImmutableMap.builder(); + params.put("name", String.valueOf(request.getName())); + return params.build(); + }) + .build(); this.listEntityTypesCallable = callableFactory.createUnaryCallable( @@ -404,6 +452,15 @@ protected GrpcEntityTypesStub( settings.batchDeleteEntitiesOperationSettings(), clientContext, operationsStub); + this.listLocationsCallable = + callableFactory.createUnaryCallable( + listLocationsTransportSettings, settings.listLocationsSettings(), clientContext); + this.listLocationsPagedCallable = + callableFactory.createPagedCallable( + listLocationsTransportSettings, settings.listLocationsSettings(), clientContext); + this.getLocationCallable = + callableFactory.createUnaryCallable( + getLocationTransportSettings, settings.getLocationSettings(), clientContext); this.backgroundResources = new BackgroundResourceAggregation(clientContext.getBackgroundResources()); @@ -499,6 +556,22 @@ public UnaryCallable batchDeleteEntitiesC return batchDeleteEntitiesOperationCallable; } + @Override + public UnaryCallable listLocationsCallable() { + return listLocationsCallable; + } + + @Override + public UnaryCallable + listLocationsPagedCallable() { + return listLocationsPagedCallable; + } + + @Override + public UnaryCallable getLocationCallable() { + return getLocationCallable; + } + @Override public final void close() { try { diff --git a/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2/stub/GrpcEnvironmentsStub.java b/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2/stub/GrpcEnvironmentsStub.java index fd91c8ae9..39b9df86b 100644 --- a/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2/stub/GrpcEnvironmentsStub.java +++ b/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2/stub/GrpcEnvironmentsStub.java @@ -18,6 +18,7 @@ import static com.google.cloud.dialogflow.v2.EnvironmentsClient.GetEnvironmentHistoryPagedResponse; import static com.google.cloud.dialogflow.v2.EnvironmentsClient.ListEnvironmentsPagedResponse; +import static com.google.cloud.dialogflow.v2.EnvironmentsClient.ListLocationsPagedResponse; import com.google.api.gax.core.BackgroundResource; import com.google.api.gax.core.BackgroundResourceAggregation; @@ -34,6 +35,10 @@ import com.google.cloud.dialogflow.v2.ListEnvironmentsRequest; import com.google.cloud.dialogflow.v2.ListEnvironmentsResponse; import com.google.cloud.dialogflow.v2.UpdateEnvironmentRequest; +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.ListLocationsResponse; +import com.google.cloud.location.Location; import com.google.common.collect.ImmutableMap; import com.google.longrunning.stub.GrpcOperationsStub; import com.google.protobuf.Empty; @@ -112,6 +117,25 @@ public class GrpcEnvironmentsStub extends EnvironmentsStub { .setResponseMarshaller(ProtoUtils.marshaller(EnvironmentHistory.getDefaultInstance())) .build(); + private static final MethodDescriptor + listLocationsMethodDescriptor = + MethodDescriptor.newBuilder() + .setType(MethodDescriptor.MethodType.UNARY) + .setFullMethodName("google.cloud.location.Locations/ListLocations") + .setRequestMarshaller( + ProtoUtils.marshaller(ListLocationsRequest.getDefaultInstance())) + .setResponseMarshaller( + ProtoUtils.marshaller(ListLocationsResponse.getDefaultInstance())) + .build(); + + private static final MethodDescriptor getLocationMethodDescriptor = + MethodDescriptor.newBuilder() + .setType(MethodDescriptor.MethodType.UNARY) + .setFullMethodName("google.cloud.location.Locations/GetLocation") + .setRequestMarshaller(ProtoUtils.marshaller(GetLocationRequest.getDefaultInstance())) + .setResponseMarshaller(ProtoUtils.marshaller(Location.getDefaultInstance())) + .build(); + private final UnaryCallable listEnvironmentsCallable; private final UnaryCallable @@ -124,6 +148,10 @@ public class GrpcEnvironmentsStub extends EnvironmentsStub { getEnvironmentHistoryCallable; private final UnaryCallable getEnvironmentHistoryPagedCallable; + private final UnaryCallable listLocationsCallable; + private final UnaryCallable + listLocationsPagedCallable; + private final UnaryCallable getLocationCallable; private final BackgroundResource backgroundResources; private final GrpcOperationsStub operationsStub; @@ -230,6 +258,26 @@ protected GrpcEnvironmentsStub( return params.build(); }) .build(); + GrpcCallSettings listLocationsTransportSettings = + GrpcCallSettings.newBuilder() + .setMethodDescriptor(listLocationsMethodDescriptor) + .setParamsExtractor( + request -> { + ImmutableMap.Builder params = ImmutableMap.builder(); + params.put("name", String.valueOf(request.getName())); + return params.build(); + }) + .build(); + GrpcCallSettings getLocationTransportSettings = + GrpcCallSettings.newBuilder() + .setMethodDescriptor(getLocationMethodDescriptor) + .setParamsExtractor( + request -> { + ImmutableMap.Builder params = ImmutableMap.builder(); + params.put("name", String.valueOf(request.getName())); + return params.build(); + }) + .build(); this.listEnvironmentsCallable = callableFactory.createUnaryCallable( @@ -265,6 +313,15 @@ protected GrpcEnvironmentsStub( getEnvironmentHistoryTransportSettings, settings.getEnvironmentHistorySettings(), clientContext); + this.listLocationsCallable = + callableFactory.createUnaryCallable( + listLocationsTransportSettings, settings.listLocationsSettings(), clientContext); + this.listLocationsPagedCallable = + callableFactory.createPagedCallable( + listLocationsTransportSettings, settings.listLocationsSettings(), clientContext); + this.getLocationCallable = + callableFactory.createUnaryCallable( + getLocationTransportSettings, settings.getLocationSettings(), clientContext); this.backgroundResources = new BackgroundResourceAggregation(clientContext.getBackgroundResources()); @@ -318,6 +375,22 @@ public UnaryCallable deleteEnvironmentCallable( return getEnvironmentHistoryPagedCallable; } + @Override + public UnaryCallable listLocationsCallable() { + return listLocationsCallable; + } + + @Override + public UnaryCallable + listLocationsPagedCallable() { + return listLocationsPagedCallable; + } + + @Override + public UnaryCallable getLocationCallable() { + return getLocationCallable; + } + @Override public final void close() { try { diff --git a/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2/stub/GrpcFulfillmentsStub.java b/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2/stub/GrpcFulfillmentsStub.java index d76813ef6..0f85c7220 100644 --- a/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2/stub/GrpcFulfillmentsStub.java +++ b/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2/stub/GrpcFulfillmentsStub.java @@ -16,6 +16,8 @@ package com.google.cloud.dialogflow.v2.stub; +import static com.google.cloud.dialogflow.v2.FulfillmentsClient.ListLocationsPagedResponse; + import com.google.api.gax.core.BackgroundResource; import com.google.api.gax.core.BackgroundResourceAggregation; import com.google.api.gax.grpc.GrpcCallSettings; @@ -25,6 +27,10 @@ import com.google.cloud.dialogflow.v2.Fulfillment; import com.google.cloud.dialogflow.v2.GetFulfillmentRequest; import com.google.cloud.dialogflow.v2.UpdateFulfillmentRequest; +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.ListLocationsResponse; +import com.google.cloud.location.Location; import com.google.common.collect.ImmutableMap; import com.google.longrunning.stub.GrpcOperationsStub; import io.grpc.MethodDescriptor; @@ -61,8 +67,31 @@ public class GrpcFulfillmentsStub extends FulfillmentsStub { .setResponseMarshaller(ProtoUtils.marshaller(Fulfillment.getDefaultInstance())) .build(); + private static final MethodDescriptor + listLocationsMethodDescriptor = + MethodDescriptor.newBuilder() + .setType(MethodDescriptor.MethodType.UNARY) + .setFullMethodName("google.cloud.location.Locations/ListLocations") + .setRequestMarshaller( + ProtoUtils.marshaller(ListLocationsRequest.getDefaultInstance())) + .setResponseMarshaller( + ProtoUtils.marshaller(ListLocationsResponse.getDefaultInstance())) + .build(); + + private static final MethodDescriptor getLocationMethodDescriptor = + MethodDescriptor.newBuilder() + .setType(MethodDescriptor.MethodType.UNARY) + .setFullMethodName("google.cloud.location.Locations/GetLocation") + .setRequestMarshaller(ProtoUtils.marshaller(GetLocationRequest.getDefaultInstance())) + .setResponseMarshaller(ProtoUtils.marshaller(Location.getDefaultInstance())) + .build(); + private final UnaryCallable getFulfillmentCallable; private final UnaryCallable updateFulfillmentCallable; + private final UnaryCallable listLocationsCallable; + private final UnaryCallable + listLocationsPagedCallable; + private final UnaryCallable getLocationCallable; private final BackgroundResource backgroundResources; private final GrpcOperationsStub operationsStub; @@ -127,6 +156,26 @@ protected GrpcFulfillmentsStub( return params.build(); }) .build(); + GrpcCallSettings listLocationsTransportSettings = + GrpcCallSettings.newBuilder() + .setMethodDescriptor(listLocationsMethodDescriptor) + .setParamsExtractor( + request -> { + ImmutableMap.Builder params = ImmutableMap.builder(); + params.put("name", String.valueOf(request.getName())); + return params.build(); + }) + .build(); + GrpcCallSettings getLocationTransportSettings = + GrpcCallSettings.newBuilder() + .setMethodDescriptor(getLocationMethodDescriptor) + .setParamsExtractor( + request -> { + ImmutableMap.Builder params = ImmutableMap.builder(); + params.put("name", String.valueOf(request.getName())); + return params.build(); + }) + .build(); this.getFulfillmentCallable = callableFactory.createUnaryCallable( @@ -136,6 +185,15 @@ protected GrpcFulfillmentsStub( updateFulfillmentTransportSettings, settings.updateFulfillmentSettings(), clientContext); + this.listLocationsCallable = + callableFactory.createUnaryCallable( + listLocationsTransportSettings, settings.listLocationsSettings(), clientContext); + this.listLocationsPagedCallable = + callableFactory.createPagedCallable( + listLocationsTransportSettings, settings.listLocationsSettings(), clientContext); + this.getLocationCallable = + callableFactory.createUnaryCallable( + getLocationTransportSettings, settings.getLocationSettings(), clientContext); this.backgroundResources = new BackgroundResourceAggregation(clientContext.getBackgroundResources()); @@ -155,6 +213,22 @@ public UnaryCallable updateFulfillmentCal return updateFulfillmentCallable; } + @Override + public UnaryCallable listLocationsCallable() { + return listLocationsCallable; + } + + @Override + public UnaryCallable + listLocationsPagedCallable() { + return listLocationsPagedCallable; + } + + @Override + public UnaryCallable getLocationCallable() { + return getLocationCallable; + } + @Override public final void close() { try { diff --git a/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2/stub/GrpcIntentsStub.java b/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2/stub/GrpcIntentsStub.java index 9b14f977e..51d718c5b 100644 --- a/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2/stub/GrpcIntentsStub.java +++ b/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2/stub/GrpcIntentsStub.java @@ -17,6 +17,7 @@ package com.google.cloud.dialogflow.v2.stub; import static com.google.cloud.dialogflow.v2.IntentsClient.ListIntentsPagedResponse; +import static com.google.cloud.dialogflow.v2.IntentsClient.ListLocationsPagedResponse; import com.google.api.gax.core.BackgroundResource; import com.google.api.gax.core.BackgroundResourceAggregation; @@ -35,6 +36,10 @@ import com.google.cloud.dialogflow.v2.ListIntentsRequest; import com.google.cloud.dialogflow.v2.ListIntentsResponse; import com.google.cloud.dialogflow.v2.UpdateIntentRequest; +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.ListLocationsResponse; +import com.google.cloud.location.Location; import com.google.common.collect.ImmutableMap; import com.google.longrunning.Operation; import com.google.longrunning.stub.GrpcOperationsStub; @@ -116,6 +121,25 @@ public class GrpcIntentsStub extends IntentsStub { .setResponseMarshaller(ProtoUtils.marshaller(Operation.getDefaultInstance())) .build(); + private static final MethodDescriptor + listLocationsMethodDescriptor = + MethodDescriptor.newBuilder() + .setType(MethodDescriptor.MethodType.UNARY) + .setFullMethodName("google.cloud.location.Locations/ListLocations") + .setRequestMarshaller( + ProtoUtils.marshaller(ListLocationsRequest.getDefaultInstance())) + .setResponseMarshaller( + ProtoUtils.marshaller(ListLocationsResponse.getDefaultInstance())) + .build(); + + private static final MethodDescriptor getLocationMethodDescriptor = + MethodDescriptor.newBuilder() + .setType(MethodDescriptor.MethodType.UNARY) + .setFullMethodName("google.cloud.location.Locations/GetLocation") + .setRequestMarshaller(ProtoUtils.marshaller(GetLocationRequest.getDefaultInstance())) + .setResponseMarshaller(ProtoUtils.marshaller(Location.getDefaultInstance())) + .build(); + private final UnaryCallable listIntentsCallable; private final UnaryCallable listIntentsPagedCallable; @@ -129,6 +153,10 @@ public class GrpcIntentsStub extends IntentsStub { private final UnaryCallable batchDeleteIntentsCallable; private final OperationCallable batchDeleteIntentsOperationCallable; + private final UnaryCallable listLocationsCallable; + private final UnaryCallable + listLocationsPagedCallable; + private final UnaryCallable getLocationCallable; private final BackgroundResource backgroundResources; private final GrpcOperationsStub operationsStub; @@ -239,6 +267,26 @@ protected GrpcIntentsStub( return params.build(); }) .build(); + GrpcCallSettings listLocationsTransportSettings = + GrpcCallSettings.newBuilder() + .setMethodDescriptor(listLocationsMethodDescriptor) + .setParamsExtractor( + request -> { + ImmutableMap.Builder params = ImmutableMap.builder(); + params.put("name", String.valueOf(request.getName())); + return params.build(); + }) + .build(); + GrpcCallSettings getLocationTransportSettings = + GrpcCallSettings.newBuilder() + .setMethodDescriptor(getLocationMethodDescriptor) + .setParamsExtractor( + request -> { + ImmutableMap.Builder params = ImmutableMap.builder(); + params.put("name", String.valueOf(request.getName())); + return params.build(); + }) + .build(); this.listIntentsCallable = callableFactory.createUnaryCallable( @@ -280,6 +328,15 @@ protected GrpcIntentsStub( settings.batchDeleteIntentsOperationSettings(), clientContext, operationsStub); + this.listLocationsCallable = + callableFactory.createUnaryCallable( + listLocationsTransportSettings, settings.listLocationsSettings(), clientContext); + this.listLocationsPagedCallable = + callableFactory.createPagedCallable( + listLocationsTransportSettings, settings.listLocationsSettings(), clientContext); + this.getLocationCallable = + callableFactory.createUnaryCallable( + getLocationTransportSettings, settings.getLocationSettings(), clientContext); this.backgroundResources = new BackgroundResourceAggregation(clientContext.getBackgroundResources()); @@ -341,6 +398,22 @@ public UnaryCallable batchDeleteIntentsCal return batchDeleteIntentsOperationCallable; } + @Override + public UnaryCallable listLocationsCallable() { + return listLocationsCallable; + } + + @Override + public UnaryCallable + listLocationsPagedCallable() { + return listLocationsPagedCallable; + } + + @Override + public UnaryCallable getLocationCallable() { + return getLocationCallable; + } + @Override public final void close() { try { diff --git a/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2/stub/GrpcKnowledgeBasesStub.java b/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2/stub/GrpcKnowledgeBasesStub.java index afc43250f..cf79d2808 100644 --- a/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2/stub/GrpcKnowledgeBasesStub.java +++ b/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2/stub/GrpcKnowledgeBasesStub.java @@ -17,6 +17,7 @@ package com.google.cloud.dialogflow.v2.stub; import static com.google.cloud.dialogflow.v2.KnowledgeBasesClient.ListKnowledgeBasesPagedResponse; +import static com.google.cloud.dialogflow.v2.KnowledgeBasesClient.ListLocationsPagedResponse; import com.google.api.gax.core.BackgroundResource; import com.google.api.gax.core.BackgroundResourceAggregation; @@ -31,6 +32,10 @@ import com.google.cloud.dialogflow.v2.ListKnowledgeBasesRequest; import com.google.cloud.dialogflow.v2.ListKnowledgeBasesResponse; import com.google.cloud.dialogflow.v2.UpdateKnowledgeBaseRequest; +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.ListLocationsResponse; +import com.google.cloud.location.Location; import com.google.common.collect.ImmutableMap; import com.google.longrunning.stub.GrpcOperationsStub; import com.google.protobuf.Empty; @@ -99,6 +104,25 @@ public class GrpcKnowledgeBasesStub extends KnowledgeBasesStub { .setResponseMarshaller(ProtoUtils.marshaller(KnowledgeBase.getDefaultInstance())) .build(); + private static final MethodDescriptor + listLocationsMethodDescriptor = + MethodDescriptor.newBuilder() + .setType(MethodDescriptor.MethodType.UNARY) + .setFullMethodName("google.cloud.location.Locations/ListLocations") + .setRequestMarshaller( + ProtoUtils.marshaller(ListLocationsRequest.getDefaultInstance())) + .setResponseMarshaller( + ProtoUtils.marshaller(ListLocationsResponse.getDefaultInstance())) + .build(); + + private static final MethodDescriptor getLocationMethodDescriptor = + MethodDescriptor.newBuilder() + .setType(MethodDescriptor.MethodType.UNARY) + .setFullMethodName("google.cloud.location.Locations/GetLocation") + .setRequestMarshaller(ProtoUtils.marshaller(GetLocationRequest.getDefaultInstance())) + .setResponseMarshaller(ProtoUtils.marshaller(Location.getDefaultInstance())) + .build(); + private final UnaryCallable listKnowledgeBasesCallable; private final UnaryCallable @@ -109,6 +133,10 @@ public class GrpcKnowledgeBasesStub extends KnowledgeBasesStub { private final UnaryCallable deleteKnowledgeBaseCallable; private final UnaryCallable updateKnowledgeBaseCallable; + private final UnaryCallable listLocationsCallable; + private final UnaryCallable + listLocationsPagedCallable; + private final UnaryCallable getLocationCallable; private final BackgroundResource backgroundResources; private final GrpcOperationsStub operationsStub; @@ -209,6 +237,26 @@ protected GrpcKnowledgeBasesStub( return params.build(); }) .build(); + GrpcCallSettings listLocationsTransportSettings = + GrpcCallSettings.newBuilder() + .setMethodDescriptor(listLocationsMethodDescriptor) + .setParamsExtractor( + request -> { + ImmutableMap.Builder params = ImmutableMap.builder(); + params.put("name", String.valueOf(request.getName())); + return params.build(); + }) + .build(); + GrpcCallSettings getLocationTransportSettings = + GrpcCallSettings.newBuilder() + .setMethodDescriptor(getLocationMethodDescriptor) + .setParamsExtractor( + request -> { + ImmutableMap.Builder params = ImmutableMap.builder(); + params.put("name", String.valueOf(request.getName())); + return params.build(); + }) + .build(); this.listKnowledgeBasesCallable = callableFactory.createUnaryCallable( @@ -238,6 +286,15 @@ protected GrpcKnowledgeBasesStub( updateKnowledgeBaseTransportSettings, settings.updateKnowledgeBaseSettings(), clientContext); + this.listLocationsCallable = + callableFactory.createUnaryCallable( + listLocationsTransportSettings, settings.listLocationsSettings(), clientContext); + this.listLocationsPagedCallable = + callableFactory.createPagedCallable( + listLocationsTransportSettings, settings.listLocationsSettings(), clientContext); + this.getLocationCallable = + callableFactory.createUnaryCallable( + getLocationTransportSettings, settings.getLocationSettings(), clientContext); this.backgroundResources = new BackgroundResourceAggregation(clientContext.getBackgroundResources()); @@ -279,6 +336,22 @@ public UnaryCallable updateKnowledgeB return updateKnowledgeBaseCallable; } + @Override + public UnaryCallable listLocationsCallable() { + return listLocationsCallable; + } + + @Override + public UnaryCallable + listLocationsPagedCallable() { + return listLocationsPagedCallable; + } + + @Override + public UnaryCallable getLocationCallable() { + return getLocationCallable; + } + @Override public final void close() { try { diff --git a/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2/stub/GrpcParticipantsStub.java b/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2/stub/GrpcParticipantsStub.java index e6c0e2319..cfe85173f 100644 --- a/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2/stub/GrpcParticipantsStub.java +++ b/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2/stub/GrpcParticipantsStub.java @@ -16,6 +16,7 @@ package com.google.cloud.dialogflow.v2.stub; +import static com.google.cloud.dialogflow.v2.ParticipantsClient.ListLocationsPagedResponse; import static com.google.cloud.dialogflow.v2.ParticipantsClient.ListParticipantsPagedResponse; import com.google.api.gax.core.BackgroundResource; @@ -38,6 +39,10 @@ import com.google.cloud.dialogflow.v2.SuggestSmartRepliesRequest; import com.google.cloud.dialogflow.v2.SuggestSmartRepliesResponse; import com.google.cloud.dialogflow.v2.UpdateParticipantRequest; +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.ListLocationsResponse; +import com.google.cloud.location.Location; import com.google.common.collect.ImmutableMap; import com.google.longrunning.stub.GrpcOperationsStub; import io.grpc.MethodDescriptor; @@ -139,6 +144,25 @@ public class GrpcParticipantsStub extends ParticipantsStub { ProtoUtils.marshaller(SuggestSmartRepliesResponse.getDefaultInstance())) .build(); + private static final MethodDescriptor + listLocationsMethodDescriptor = + MethodDescriptor.newBuilder() + .setType(MethodDescriptor.MethodType.UNARY) + .setFullMethodName("google.cloud.location.Locations/ListLocations") + .setRequestMarshaller( + ProtoUtils.marshaller(ListLocationsRequest.getDefaultInstance())) + .setResponseMarshaller( + ProtoUtils.marshaller(ListLocationsResponse.getDefaultInstance())) + .build(); + + private static final MethodDescriptor getLocationMethodDescriptor = + MethodDescriptor.newBuilder() + .setType(MethodDescriptor.MethodType.UNARY) + .setFullMethodName("google.cloud.location.Locations/GetLocation") + .setRequestMarshaller(ProtoUtils.marshaller(GetLocationRequest.getDefaultInstance())) + .setResponseMarshaller(ProtoUtils.marshaller(Location.getDefaultInstance())) + .build(); + private final UnaryCallable createParticipantCallable; private final UnaryCallable getParticipantCallable; private final UnaryCallable @@ -153,6 +177,10 @@ public class GrpcParticipantsStub extends ParticipantsStub { suggestFaqAnswersCallable; private final UnaryCallable suggestSmartRepliesCallable; + private final UnaryCallable listLocationsCallable; + private final UnaryCallable + listLocationsPagedCallable; + private final UnaryCallable getLocationCallable; private final BackgroundResource backgroundResources; private final GrpcOperationsStub operationsStub; @@ -282,6 +310,26 @@ protected GrpcParticipantsStub( return params.build(); }) .build(); + GrpcCallSettings listLocationsTransportSettings = + GrpcCallSettings.newBuilder() + .setMethodDescriptor(listLocationsMethodDescriptor) + .setParamsExtractor( + request -> { + ImmutableMap.Builder params = ImmutableMap.builder(); + params.put("name", String.valueOf(request.getName())); + return params.build(); + }) + .build(); + GrpcCallSettings getLocationTransportSettings = + GrpcCallSettings.newBuilder() + .setMethodDescriptor(getLocationMethodDescriptor) + .setParamsExtractor( + request -> { + ImmutableMap.Builder params = ImmutableMap.builder(); + params.put("name", String.valueOf(request.getName())); + return params.build(); + }) + .build(); this.createParticipantCallable = callableFactory.createUnaryCallable( @@ -318,6 +366,15 @@ protected GrpcParticipantsStub( suggestSmartRepliesTransportSettings, settings.suggestSmartRepliesSettings(), clientContext); + this.listLocationsCallable = + callableFactory.createUnaryCallable( + listLocationsTransportSettings, settings.listLocationsSettings(), clientContext); + this.listLocationsPagedCallable = + callableFactory.createPagedCallable( + listLocationsTransportSettings, settings.listLocationsSettings(), clientContext); + this.getLocationCallable = + callableFactory.createUnaryCallable( + getLocationTransportSettings, settings.getLocationSettings(), clientContext); this.backgroundResources = new BackgroundResourceAggregation(clientContext.getBackgroundResources()); @@ -376,6 +433,22 @@ public UnaryCallable suggestArt return suggestSmartRepliesCallable; } + @Override + public UnaryCallable listLocationsCallable() { + return listLocationsCallable; + } + + @Override + public UnaryCallable + listLocationsPagedCallable() { + return listLocationsPagedCallable; + } + + @Override + public UnaryCallable getLocationCallable() { + return getLocationCallable; + } + @Override public final void close() { try { diff --git a/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2/stub/GrpcSessionEntityTypesStub.java b/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2/stub/GrpcSessionEntityTypesStub.java index 219fe77e6..9acece2be 100644 --- a/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2/stub/GrpcSessionEntityTypesStub.java +++ b/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2/stub/GrpcSessionEntityTypesStub.java @@ -16,6 +16,7 @@ package com.google.cloud.dialogflow.v2.stub; +import static com.google.cloud.dialogflow.v2.SessionEntityTypesClient.ListLocationsPagedResponse; import static com.google.cloud.dialogflow.v2.SessionEntityTypesClient.ListSessionEntityTypesPagedResponse; import com.google.api.gax.core.BackgroundResource; @@ -31,6 +32,10 @@ import com.google.cloud.dialogflow.v2.ListSessionEntityTypesResponse; import com.google.cloud.dialogflow.v2.SessionEntityType; import com.google.cloud.dialogflow.v2.UpdateSessionEntityTypeRequest; +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.ListLocationsResponse; +import com.google.cloud.location.Location; import com.google.common.collect.ImmutableMap; import com.google.longrunning.stub.GrpcOperationsStub; import com.google.protobuf.Empty; @@ -106,6 +111,25 @@ public class GrpcSessionEntityTypesStub extends SessionEntityTypesStub { .setResponseMarshaller(ProtoUtils.marshaller(Empty.getDefaultInstance())) .build(); + private static final MethodDescriptor + listLocationsMethodDescriptor = + MethodDescriptor.newBuilder() + .setType(MethodDescriptor.MethodType.UNARY) + .setFullMethodName("google.cloud.location.Locations/ListLocations") + .setRequestMarshaller( + ProtoUtils.marshaller(ListLocationsRequest.getDefaultInstance())) + .setResponseMarshaller( + ProtoUtils.marshaller(ListLocationsResponse.getDefaultInstance())) + .build(); + + private static final MethodDescriptor getLocationMethodDescriptor = + MethodDescriptor.newBuilder() + .setType(MethodDescriptor.MethodType.UNARY) + .setFullMethodName("google.cloud.location.Locations/GetLocation") + .setRequestMarshaller(ProtoUtils.marshaller(GetLocationRequest.getDefaultInstance())) + .setResponseMarshaller(ProtoUtils.marshaller(Location.getDefaultInstance())) + .build(); + private final UnaryCallable listSessionEntityTypesCallable; private final UnaryCallable @@ -118,6 +142,10 @@ public class GrpcSessionEntityTypesStub extends SessionEntityTypesStub { updateSessionEntityTypeCallable; private final UnaryCallable deleteSessionEntityTypeCallable; + private final UnaryCallable listLocationsCallable; + private final UnaryCallable + listLocationsPagedCallable; + private final UnaryCallable getLocationCallable; private final BackgroundResource backgroundResources; private final GrpcOperationsStub operationsStub; @@ -221,6 +249,26 @@ protected GrpcSessionEntityTypesStub( return params.build(); }) .build(); + GrpcCallSettings listLocationsTransportSettings = + GrpcCallSettings.newBuilder() + .setMethodDescriptor(listLocationsMethodDescriptor) + .setParamsExtractor( + request -> { + ImmutableMap.Builder params = ImmutableMap.builder(); + params.put("name", String.valueOf(request.getName())); + return params.build(); + }) + .build(); + GrpcCallSettings getLocationTransportSettings = + GrpcCallSettings.newBuilder() + .setMethodDescriptor(getLocationMethodDescriptor) + .setParamsExtractor( + request -> { + ImmutableMap.Builder params = ImmutableMap.builder(); + params.put("name", String.valueOf(request.getName())); + return params.build(); + }) + .build(); this.listSessionEntityTypesCallable = callableFactory.createUnaryCallable( @@ -252,6 +300,15 @@ protected GrpcSessionEntityTypesStub( deleteSessionEntityTypeTransportSettings, settings.deleteSessionEntityTypeSettings(), clientContext); + this.listLocationsCallable = + callableFactory.createUnaryCallable( + listLocationsTransportSettings, settings.listLocationsSettings(), clientContext); + this.listLocationsPagedCallable = + callableFactory.createPagedCallable( + listLocationsTransportSettings, settings.listLocationsSettings(), clientContext); + this.getLocationCallable = + callableFactory.createUnaryCallable( + getLocationTransportSettings, settings.getLocationSettings(), clientContext); this.backgroundResources = new BackgroundResourceAggregation(clientContext.getBackgroundResources()); @@ -296,6 +353,22 @@ public UnaryCallable deleteSessionEntityT return deleteSessionEntityTypeCallable; } + @Override + public UnaryCallable listLocationsCallable() { + return listLocationsCallable; + } + + @Override + public UnaryCallable + listLocationsPagedCallable() { + return listLocationsPagedCallable; + } + + @Override + public UnaryCallable getLocationCallable() { + return getLocationCallable; + } + @Override public final void close() { try { diff --git a/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2/stub/GrpcSessionsStub.java b/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2/stub/GrpcSessionsStub.java index ee7a34406..7cf1743bc 100644 --- a/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2/stub/GrpcSessionsStub.java +++ b/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2/stub/GrpcSessionsStub.java @@ -16,6 +16,8 @@ package com.google.cloud.dialogflow.v2.stub; +import static com.google.cloud.dialogflow.v2.SessionsClient.ListLocationsPagedResponse; + import com.google.api.gax.core.BackgroundResource; import com.google.api.gax.core.BackgroundResourceAggregation; import com.google.api.gax.grpc.GrpcCallSettings; @@ -27,6 +29,10 @@ import com.google.cloud.dialogflow.v2.DetectIntentResponse; import com.google.cloud.dialogflow.v2.StreamingDetectIntentRequest; import com.google.cloud.dialogflow.v2.StreamingDetectIntentResponse; +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.ListLocationsResponse; +import com.google.cloud.location.Location; import com.google.common.collect.ImmutableMap; import com.google.longrunning.stub.GrpcOperationsStub; import io.grpc.MethodDescriptor; @@ -64,9 +70,32 @@ public class GrpcSessionsStub extends SessionsStub { ProtoUtils.marshaller(StreamingDetectIntentResponse.getDefaultInstance())) .build(); + private static final MethodDescriptor + listLocationsMethodDescriptor = + MethodDescriptor.newBuilder() + .setType(MethodDescriptor.MethodType.UNARY) + .setFullMethodName("google.cloud.location.Locations/ListLocations") + .setRequestMarshaller( + ProtoUtils.marshaller(ListLocationsRequest.getDefaultInstance())) + .setResponseMarshaller( + ProtoUtils.marshaller(ListLocationsResponse.getDefaultInstance())) + .build(); + + private static final MethodDescriptor getLocationMethodDescriptor = + MethodDescriptor.newBuilder() + .setType(MethodDescriptor.MethodType.UNARY) + .setFullMethodName("google.cloud.location.Locations/GetLocation") + .setRequestMarshaller(ProtoUtils.marshaller(GetLocationRequest.getDefaultInstance())) + .setResponseMarshaller(ProtoUtils.marshaller(Location.getDefaultInstance())) + .build(); + private final UnaryCallable detectIntentCallable; private final BidiStreamingCallable streamingDetectIntentCallable; + private final UnaryCallable listLocationsCallable; + private final UnaryCallable + listLocationsPagedCallable; + private final UnaryCallable getLocationCallable; private final BackgroundResource backgroundResources; private final GrpcOperationsStub operationsStub; @@ -123,6 +152,26 @@ protected GrpcSessionsStub( .newBuilder() .setMethodDescriptor(streamingDetectIntentMethodDescriptor) .build(); + GrpcCallSettings listLocationsTransportSettings = + GrpcCallSettings.newBuilder() + .setMethodDescriptor(listLocationsMethodDescriptor) + .setParamsExtractor( + request -> { + ImmutableMap.Builder params = ImmutableMap.builder(); + params.put("name", String.valueOf(request.getName())); + return params.build(); + }) + .build(); + GrpcCallSettings getLocationTransportSettings = + GrpcCallSettings.newBuilder() + .setMethodDescriptor(getLocationMethodDescriptor) + .setParamsExtractor( + request -> { + ImmutableMap.Builder params = ImmutableMap.builder(); + params.put("name", String.valueOf(request.getName())); + return params.build(); + }) + .build(); this.detectIntentCallable = callableFactory.createUnaryCallable( @@ -132,6 +181,15 @@ protected GrpcSessionsStub( streamingDetectIntentTransportSettings, settings.streamingDetectIntentSettings(), clientContext); + this.listLocationsCallable = + callableFactory.createUnaryCallable( + listLocationsTransportSettings, settings.listLocationsSettings(), clientContext); + this.listLocationsPagedCallable = + callableFactory.createPagedCallable( + listLocationsTransportSettings, settings.listLocationsSettings(), clientContext); + this.getLocationCallable = + callableFactory.createUnaryCallable( + getLocationTransportSettings, settings.getLocationSettings(), clientContext); this.backgroundResources = new BackgroundResourceAggregation(clientContext.getBackgroundResources()); @@ -152,6 +210,22 @@ public UnaryCallable detectIntentCall return streamingDetectIntentCallable; } + @Override + public UnaryCallable listLocationsCallable() { + return listLocationsCallable; + } + + @Override + public UnaryCallable + listLocationsPagedCallable() { + return listLocationsPagedCallable; + } + + @Override + public UnaryCallable getLocationCallable() { + return getLocationCallable; + } + @Override public final void close() { try { diff --git a/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2/stub/GrpcVersionsStub.java b/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2/stub/GrpcVersionsStub.java index 876440080..823346b06 100644 --- a/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2/stub/GrpcVersionsStub.java +++ b/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2/stub/GrpcVersionsStub.java @@ -16,6 +16,7 @@ package com.google.cloud.dialogflow.v2.stub; +import static com.google.cloud.dialogflow.v2.VersionsClient.ListLocationsPagedResponse; import static com.google.cloud.dialogflow.v2.VersionsClient.ListVersionsPagedResponse; import com.google.api.gax.core.BackgroundResource; @@ -31,6 +32,10 @@ import com.google.cloud.dialogflow.v2.ListVersionsResponse; import com.google.cloud.dialogflow.v2.UpdateVersionRequest; import com.google.cloud.dialogflow.v2.Version; +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.ListLocationsResponse; +import com.google.cloud.location.Location; import com.google.common.collect.ImmutableMap; import com.google.longrunning.stub.GrpcOperationsStub; import com.google.protobuf.Empty; @@ -94,6 +99,25 @@ public class GrpcVersionsStub extends VersionsStub { .setResponseMarshaller(ProtoUtils.marshaller(Empty.getDefaultInstance())) .build(); + private static final MethodDescriptor + listLocationsMethodDescriptor = + MethodDescriptor.newBuilder() + .setType(MethodDescriptor.MethodType.UNARY) + .setFullMethodName("google.cloud.location.Locations/ListLocations") + .setRequestMarshaller( + ProtoUtils.marshaller(ListLocationsRequest.getDefaultInstance())) + .setResponseMarshaller( + ProtoUtils.marshaller(ListLocationsResponse.getDefaultInstance())) + .build(); + + private static final MethodDescriptor getLocationMethodDescriptor = + MethodDescriptor.newBuilder() + .setType(MethodDescriptor.MethodType.UNARY) + .setFullMethodName("google.cloud.location.Locations/GetLocation") + .setRequestMarshaller(ProtoUtils.marshaller(GetLocationRequest.getDefaultInstance())) + .setResponseMarshaller(ProtoUtils.marshaller(Location.getDefaultInstance())) + .build(); + private final UnaryCallable listVersionsCallable; private final UnaryCallable listVersionsPagedCallable; @@ -101,6 +125,10 @@ public class GrpcVersionsStub extends VersionsStub { private final UnaryCallable createVersionCallable; private final UnaryCallable updateVersionCallable; private final UnaryCallable deleteVersionCallable; + private final UnaryCallable listLocationsCallable; + private final UnaryCallable + listLocationsPagedCallable; + private final UnaryCallable getLocationCallable; private final BackgroundResource backgroundResources; private final GrpcOperationsStub operationsStub; @@ -191,6 +219,26 @@ protected GrpcVersionsStub( return params.build(); }) .build(); + GrpcCallSettings listLocationsTransportSettings = + GrpcCallSettings.newBuilder() + .setMethodDescriptor(listLocationsMethodDescriptor) + .setParamsExtractor( + request -> { + ImmutableMap.Builder params = ImmutableMap.builder(); + params.put("name", String.valueOf(request.getName())); + return params.build(); + }) + .build(); + GrpcCallSettings getLocationTransportSettings = + GrpcCallSettings.newBuilder() + .setMethodDescriptor(getLocationMethodDescriptor) + .setParamsExtractor( + request -> { + ImmutableMap.Builder params = ImmutableMap.builder(); + params.put("name", String.valueOf(request.getName())); + return params.build(); + }) + .build(); this.listVersionsCallable = callableFactory.createUnaryCallable( @@ -210,6 +258,15 @@ protected GrpcVersionsStub( this.deleteVersionCallable = callableFactory.createUnaryCallable( deleteVersionTransportSettings, settings.deleteVersionSettings(), clientContext); + this.listLocationsCallable = + callableFactory.createUnaryCallable( + listLocationsTransportSettings, settings.listLocationsSettings(), clientContext); + this.listLocationsPagedCallable = + callableFactory.createPagedCallable( + listLocationsTransportSettings, settings.listLocationsSettings(), clientContext); + this.getLocationCallable = + callableFactory.createUnaryCallable( + getLocationTransportSettings, settings.getLocationSettings(), clientContext); this.backgroundResources = new BackgroundResourceAggregation(clientContext.getBackgroundResources()); @@ -249,6 +306,22 @@ public UnaryCallable deleteVersionCallable() { return deleteVersionCallable; } + @Override + public UnaryCallable listLocationsCallable() { + return listLocationsCallable; + } + + @Override + public UnaryCallable + listLocationsPagedCallable() { + return listLocationsPagedCallable; + } + + @Override + public UnaryCallable getLocationCallable() { + return getLocationCallable; + } + @Override public final void close() { try { diff --git a/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2/stub/HttpJsonAgentsStub.java b/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2/stub/HttpJsonAgentsStub.java index 4b432d3d1..03f775f37 100644 --- a/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2/stub/HttpJsonAgentsStub.java +++ b/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2/stub/HttpJsonAgentsStub.java @@ -16,6 +16,7 @@ package com.google.cloud.dialogflow.v2.stub; +import static com.google.cloud.dialogflow.v2.AgentsClient.ListLocationsPagedResponse; import static com.google.cloud.dialogflow.v2.AgentsClient.SearchAgentsPagedResponse; import com.google.api.core.BetaApi; @@ -46,6 +47,10 @@ import com.google.cloud.dialogflow.v2.SetAgentRequest; import com.google.cloud.dialogflow.v2.TrainAgentRequest; import com.google.cloud.dialogflow.v2.ValidationResult; +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.ListLocationsResponse; +import com.google.cloud.location.Location; import com.google.longrunning.Operation; import com.google.protobuf.Empty; import com.google.protobuf.Struct; @@ -409,6 +414,72 @@ public class HttpJsonAgentsStub extends AgentsStub { .build()) .build(); + private static final ApiMethodDescriptor + listLocationsMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("google.cloud.location.Locations/ListLocations") + .setHttpMethod("GET") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v2/{name=projects/*}/locations", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam(fields, "name", request.getName()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + return fields; + }) + .setRequestBodyExtractor(request -> null) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(ListLocationsResponse.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private static final ApiMethodDescriptor + getLocationMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("google.cloud.location.Locations/GetLocation") + .setHttpMethod("GET") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v2/{name=projects/*/locations/*}", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam(fields, "name", request.getName()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + return fields; + }) + .setRequestBodyExtractor(request -> null) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(Location.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + private final UnaryCallable getAgentCallable; private final UnaryCallable setAgentCallable; private final UnaryCallable deleteAgentCallable; @@ -426,6 +497,10 @@ public class HttpJsonAgentsStub extends AgentsStub { private final OperationCallable restoreAgentOperationCallable; private final UnaryCallable getValidationResultCallable; + private final UnaryCallable listLocationsCallable; + private final UnaryCallable + listLocationsPagedCallable; + private final UnaryCallable getLocationCallable; private final BackgroundResource backgroundResources; private final HttpJsonOperationsStub httpJsonOperationsStub; @@ -515,6 +590,17 @@ protected HttpJsonAgentsStub( .setMethodDescriptor(getValidationResultMethodDescriptor) .setTypeRegistry(typeRegistry) .build(); + HttpJsonCallSettings + listLocationsTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(listLocationsMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings getLocationTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(getLocationMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); this.getAgentCallable = callableFactory.createUnaryCallable( @@ -572,6 +658,15 @@ protected HttpJsonAgentsStub( getValidationResultTransportSettings, settings.getValidationResultSettings(), clientContext); + this.listLocationsCallable = + callableFactory.createUnaryCallable( + listLocationsTransportSettings, settings.listLocationsSettings(), clientContext); + this.listLocationsPagedCallable = + callableFactory.createPagedCallable( + listLocationsTransportSettings, settings.listLocationsSettings(), clientContext); + this.getLocationCallable = + callableFactory.createUnaryCallable( + getLocationTransportSettings, settings.getLocationSettings(), clientContext); this.backgroundResources = new BackgroundResourceAggregation(clientContext.getBackgroundResources()); @@ -589,6 +684,8 @@ public static List getMethodDescriptors() { methodDescriptors.add(importAgentMethodDescriptor); methodDescriptors.add(restoreAgentMethodDescriptor); methodDescriptors.add(getValidationResultMethodDescriptor); + methodDescriptors.add(listLocationsMethodDescriptor); + methodDescriptors.add(getLocationMethodDescriptor); return methodDescriptors; } @@ -667,6 +764,22 @@ public UnaryCallable getValidation return getValidationResultCallable; } + @Override + public UnaryCallable listLocationsCallable() { + return listLocationsCallable; + } + + @Override + public UnaryCallable + listLocationsPagedCallable() { + return listLocationsPagedCallable; + } + + @Override + public UnaryCallable getLocationCallable() { + return getLocationCallable; + } + @Override public final void close() { try { diff --git a/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2/stub/HttpJsonAnswerRecordsStub.java b/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2/stub/HttpJsonAnswerRecordsStub.java index c8600b418..d17322101 100644 --- a/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2/stub/HttpJsonAnswerRecordsStub.java +++ b/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2/stub/HttpJsonAnswerRecordsStub.java @@ -17,6 +17,7 @@ package com.google.cloud.dialogflow.v2.stub; import static com.google.cloud.dialogflow.v2.AnswerRecordsClient.ListAnswerRecordsPagedResponse; +import static com.google.cloud.dialogflow.v2.AnswerRecordsClient.ListLocationsPagedResponse; import com.google.api.core.BetaApi; import com.google.api.core.InternalApi; @@ -34,6 +35,10 @@ import com.google.cloud.dialogflow.v2.ListAnswerRecordsRequest; import com.google.cloud.dialogflow.v2.ListAnswerRecordsResponse; import com.google.cloud.dialogflow.v2.UpdateAnswerRecordRequest; +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.ListLocationsResponse; +import com.google.cloud.location.Location; import com.google.protobuf.TypeRegistry; import java.io.IOException; import java.util.ArrayList; @@ -131,11 +136,81 @@ public class HttpJsonAnswerRecordsStub extends AnswerRecordsStub { .build()) .build(); + private static final ApiMethodDescriptor + listLocationsMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("google.cloud.location.Locations/ListLocations") + .setHttpMethod("GET") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v2/{name=projects/*}/locations", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam(fields, "name", request.getName()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + return fields; + }) + .setRequestBodyExtractor(request -> null) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(ListLocationsResponse.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private static final ApiMethodDescriptor + getLocationMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("google.cloud.location.Locations/GetLocation") + .setHttpMethod("GET") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v2/{name=projects/*/locations/*}", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam(fields, "name", request.getName()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + return fields; + }) + .setRequestBodyExtractor(request -> null) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(Location.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + private final UnaryCallable listAnswerRecordsCallable; private final UnaryCallable listAnswerRecordsPagedCallable; private final UnaryCallable updateAnswerRecordCallable; + private final UnaryCallable listLocationsCallable; + private final UnaryCallable + listLocationsPagedCallable; + private final UnaryCallable getLocationCallable; private final BackgroundResource backgroundResources; private final HttpJsonStubCallableFactory callableFactory; @@ -191,6 +266,17 @@ protected HttpJsonAnswerRecordsStub( .setMethodDescriptor(updateAnswerRecordMethodDescriptor) .setTypeRegistry(typeRegistry) .build(); + HttpJsonCallSettings + listLocationsTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(listLocationsMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings getLocationTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(getLocationMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); this.listAnswerRecordsCallable = callableFactory.createUnaryCallable( @@ -207,6 +293,15 @@ protected HttpJsonAnswerRecordsStub( updateAnswerRecordTransportSettings, settings.updateAnswerRecordSettings(), clientContext); + this.listLocationsCallable = + callableFactory.createUnaryCallable( + listLocationsTransportSettings, settings.listLocationsSettings(), clientContext); + this.listLocationsPagedCallable = + callableFactory.createPagedCallable( + listLocationsTransportSettings, settings.listLocationsSettings(), clientContext); + this.getLocationCallable = + callableFactory.createUnaryCallable( + getLocationTransportSettings, settings.getLocationSettings(), clientContext); this.backgroundResources = new BackgroundResourceAggregation(clientContext.getBackgroundResources()); @@ -217,6 +312,8 @@ public static List getMethodDescriptors() { List methodDescriptors = new ArrayList<>(); methodDescriptors.add(listAnswerRecordsMethodDescriptor); methodDescriptors.add(updateAnswerRecordMethodDescriptor); + methodDescriptors.add(listLocationsMethodDescriptor); + methodDescriptors.add(getLocationMethodDescriptor); return methodDescriptors; } @@ -237,6 +334,22 @@ public UnaryCallable updateAnswerRecord return updateAnswerRecordCallable; } + @Override + public UnaryCallable listLocationsCallable() { + return listLocationsCallable; + } + + @Override + public UnaryCallable + listLocationsPagedCallable() { + return listLocationsPagedCallable; + } + + @Override + public UnaryCallable getLocationCallable() { + return getLocationCallable; + } + @Override public final void close() { try { diff --git a/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2/stub/HttpJsonContextsStub.java b/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2/stub/HttpJsonContextsStub.java index 28f95777d..fcf49b1d8 100644 --- a/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2/stub/HttpJsonContextsStub.java +++ b/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2/stub/HttpJsonContextsStub.java @@ -17,6 +17,7 @@ package com.google.cloud.dialogflow.v2.stub; import static com.google.cloud.dialogflow.v2.ContextsClient.ListContextsPagedResponse; +import static com.google.cloud.dialogflow.v2.ContextsClient.ListLocationsPagedResponse; import com.google.api.core.BetaApi; import com.google.api.core.InternalApi; @@ -38,6 +39,10 @@ import com.google.cloud.dialogflow.v2.ListContextsRequest; import com.google.cloud.dialogflow.v2.ListContextsResponse; import com.google.cloud.dialogflow.v2.UpdateContextRequest; +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.ListLocationsResponse; +import com.google.cloud.location.Location; import com.google.protobuf.Empty; import com.google.protobuf.TypeRegistry; import java.io.IOException; @@ -288,6 +293,72 @@ public class HttpJsonContextsStub extends ContextsStub { .build()) .build(); + private static final ApiMethodDescriptor + listLocationsMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("google.cloud.location.Locations/ListLocations") + .setHttpMethod("GET") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v2/{name=projects/*}/locations", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam(fields, "name", request.getName()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + return fields; + }) + .setRequestBodyExtractor(request -> null) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(ListLocationsResponse.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private static final ApiMethodDescriptor + getLocationMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("google.cloud.location.Locations/GetLocation") + .setHttpMethod("GET") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v2/{name=projects/*/locations/*}", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam(fields, "name", request.getName()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + return fields; + }) + .setRequestBodyExtractor(request -> null) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(Location.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + private final UnaryCallable listContextsCallable; private final UnaryCallable listContextsPagedCallable; @@ -296,6 +367,10 @@ public class HttpJsonContextsStub extends ContextsStub { private final UnaryCallable updateContextCallable; private final UnaryCallable deleteContextCallable; private final UnaryCallable deleteAllContextsCallable; + private final UnaryCallable listLocationsCallable; + private final UnaryCallable + listLocationsPagedCallable; + private final UnaryCallable getLocationCallable; private final BackgroundResource backgroundResources; private final HttpJsonStubCallableFactory callableFactory; @@ -368,6 +443,17 @@ protected HttpJsonContextsStub( .setMethodDescriptor(deleteAllContextsMethodDescriptor) .setTypeRegistry(typeRegistry) .build(); + HttpJsonCallSettings + listLocationsTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(listLocationsMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings getLocationTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(getLocationMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); this.listContextsCallable = callableFactory.createUnaryCallable( @@ -392,6 +478,15 @@ protected HttpJsonContextsStub( deleteAllContextsTransportSettings, settings.deleteAllContextsSettings(), clientContext); + this.listLocationsCallable = + callableFactory.createUnaryCallable( + listLocationsTransportSettings, settings.listLocationsSettings(), clientContext); + this.listLocationsPagedCallable = + callableFactory.createPagedCallable( + listLocationsTransportSettings, settings.listLocationsSettings(), clientContext); + this.getLocationCallable = + callableFactory.createUnaryCallable( + getLocationTransportSettings, settings.getLocationSettings(), clientContext); this.backgroundResources = new BackgroundResourceAggregation(clientContext.getBackgroundResources()); @@ -406,6 +501,8 @@ public static List getMethodDescriptors() { methodDescriptors.add(updateContextMethodDescriptor); methodDescriptors.add(deleteContextMethodDescriptor); methodDescriptors.add(deleteAllContextsMethodDescriptor); + methodDescriptors.add(listLocationsMethodDescriptor); + methodDescriptors.add(getLocationMethodDescriptor); return methodDescriptors; } @@ -444,6 +541,22 @@ public UnaryCallable deleteAllContextsCallable( return deleteAllContextsCallable; } + @Override + public UnaryCallable listLocationsCallable() { + return listLocationsCallable; + } + + @Override + public UnaryCallable + listLocationsPagedCallable() { + return listLocationsPagedCallable; + } + + @Override + public UnaryCallable getLocationCallable() { + return getLocationCallable; + } + @Override public final void close() { try { diff --git a/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2/stub/HttpJsonConversationDatasetsStub.java b/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2/stub/HttpJsonConversationDatasetsStub.java index f154362f6..8316a5107 100644 --- a/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2/stub/HttpJsonConversationDatasetsStub.java +++ b/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2/stub/HttpJsonConversationDatasetsStub.java @@ -17,6 +17,7 @@ package com.google.cloud.dialogflow.v2.stub; import static com.google.cloud.dialogflow.v2.ConversationDatasetsClient.ListConversationDatasetsPagedResponse; +import static com.google.cloud.dialogflow.v2.ConversationDatasetsClient.ListLocationsPagedResponse; import com.google.api.core.BetaApi; import com.google.api.core.InternalApi; @@ -44,6 +45,10 @@ import com.google.cloud.dialogflow.v2.ImportConversationDataRequest; import com.google.cloud.dialogflow.v2.ListConversationDatasetsRequest; import com.google.cloud.dialogflow.v2.ListConversationDatasetsResponse; +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.ListLocationsResponse; +import com.google.cloud.location.Location; import com.google.longrunning.Operation; import com.google.protobuf.Empty; import com.google.protobuf.TypeRegistry; @@ -269,6 +274,72 @@ public class HttpJsonConversationDatasetsStub extends ConversationDatasetsStub { HttpJsonOperationSnapshot.create(response)) .build(); + private static final ApiMethodDescriptor + listLocationsMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("google.cloud.location.Locations/ListLocations") + .setHttpMethod("GET") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v2/{name=projects/*}/locations", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam(fields, "name", request.getName()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + return fields; + }) + .setRequestBodyExtractor(request -> null) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(ListLocationsResponse.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private static final ApiMethodDescriptor + getLocationMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("google.cloud.location.Locations/GetLocation") + .setHttpMethod("GET") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v2/{name=projects/*/locations/*}", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam(fields, "name", request.getName()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + return fields; + }) + .setRequestBodyExtractor(request -> null) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(Location.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + private final UnaryCallable createConversationDatasetCallable; private final OperationCallable< @@ -295,6 +366,10 @@ public class HttpJsonConversationDatasetsStub extends ConversationDatasetsStub { ImportConversationDataOperationResponse, ImportConversationDataOperationMetadata> importConversationDataOperationCallable; + private final UnaryCallable listLocationsCallable; + private final UnaryCallable + listLocationsPagedCallable; + private final UnaryCallable getLocationCallable; private final BackgroundResource backgroundResources; private final HttpJsonOperationsStub httpJsonOperationsStub; @@ -374,6 +449,17 @@ protected HttpJsonConversationDatasetsStub( .setMethodDescriptor(importConversationDataMethodDescriptor) .setTypeRegistry(typeRegistry) .build(); + HttpJsonCallSettings + listLocationsTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(listLocationsMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings getLocationTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(getLocationMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); this.createConversationDatasetCallable = callableFactory.createUnaryCallable( @@ -423,6 +509,15 @@ protected HttpJsonConversationDatasetsStub( settings.importConversationDataOperationSettings(), clientContext, httpJsonOperationsStub); + this.listLocationsCallable = + callableFactory.createUnaryCallable( + listLocationsTransportSettings, settings.listLocationsSettings(), clientContext); + this.listLocationsPagedCallable = + callableFactory.createPagedCallable( + listLocationsTransportSettings, settings.listLocationsSettings(), clientContext); + this.getLocationCallable = + callableFactory.createUnaryCallable( + getLocationTransportSettings, settings.getLocationSettings(), clientContext); this.backgroundResources = new BackgroundResourceAggregation(clientContext.getBackgroundResources()); @@ -436,6 +531,8 @@ public static List getMethodDescriptors() { methodDescriptors.add(listConversationDatasetsMethodDescriptor); methodDescriptors.add(deleteConversationDatasetMethodDescriptor); methodDescriptors.add(importConversationDataMethodDescriptor); + methodDescriptors.add(listLocationsMethodDescriptor); + methodDescriptors.add(getLocationMethodDescriptor); return methodDescriptors; } @@ -503,6 +600,22 @@ public UnaryCallable importConversatio return importConversationDataOperationCallable; } + @Override + public UnaryCallable listLocationsCallable() { + return listLocationsCallable; + } + + @Override + public UnaryCallable + listLocationsPagedCallable() { + return listLocationsPagedCallable; + } + + @Override + public UnaryCallable getLocationCallable() { + return getLocationCallable; + } + @Override public final void close() { try { diff --git a/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2/stub/HttpJsonConversationModelsStub.java b/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2/stub/HttpJsonConversationModelsStub.java index b5da866b9..42dce9083 100644 --- a/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2/stub/HttpJsonConversationModelsStub.java +++ b/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2/stub/HttpJsonConversationModelsStub.java @@ -18,6 +18,7 @@ import static com.google.cloud.dialogflow.v2.ConversationModelsClient.ListConversationModelEvaluationsPagedResponse; import static com.google.cloud.dialogflow.v2.ConversationModelsClient.ListConversationModelsPagedResponse; +import static com.google.cloud.dialogflow.v2.ConversationModelsClient.ListLocationsPagedResponse; import com.google.api.core.BetaApi; import com.google.api.core.InternalApi; @@ -52,6 +53,10 @@ import com.google.cloud.dialogflow.v2.ListConversationModelsResponse; import com.google.cloud.dialogflow.v2.UndeployConversationModelOperationMetadata; import com.google.cloud.dialogflow.v2.UndeployConversationModelRequest; +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.ListLocationsResponse; +import com.google.cloud.location.Location; import com.google.longrunning.Operation; import com.google.protobuf.Empty; import com.google.protobuf.TypeRegistry; @@ -442,6 +447,72 @@ public class HttpJsonConversationModelsStub extends ConversationModelsStub { HttpJsonOperationSnapshot.create(response)) .build(); + private static final ApiMethodDescriptor + listLocationsMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("google.cloud.location.Locations/ListLocations") + .setHttpMethod("GET") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v2/{name=projects/*}/locations", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam(fields, "name", request.getName()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + return fields; + }) + .setRequestBodyExtractor(request -> null) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(ListLocationsResponse.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private static final ApiMethodDescriptor + getLocationMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("google.cloud.location.Locations/GetLocation") + .setHttpMethod("GET") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v2/{name=projects/*/locations/*}", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam(fields, "name", request.getName()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + return fields; + }) + .setRequestBodyExtractor(request -> null) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(Location.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + private final UnaryCallable createConversationModelCallable; private final OperationCallable< @@ -485,6 +556,10 @@ public class HttpJsonConversationModelsStub extends ConversationModelsStub { ConversationModelEvaluation, CreateConversationModelEvaluationOperationMetadata> createConversationModelEvaluationOperationCallable; + private final UnaryCallable listLocationsCallable; + private final UnaryCallable + listLocationsPagedCallable; + private final UnaryCallable getLocationCallable; private final BackgroundResource backgroundResources; private final HttpJsonOperationsStub httpJsonOperationsStub; @@ -592,6 +667,17 @@ protected HttpJsonConversationModelsStub( .setMethodDescriptor(createConversationModelEvaluationMethodDescriptor) .setTypeRegistry(typeRegistry) .build(); + HttpJsonCallSettings + listLocationsTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(listLocationsMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings getLocationTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(getLocationMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); this.createConversationModelCallable = callableFactory.createUnaryCallable( @@ -678,6 +764,15 @@ protected HttpJsonConversationModelsStub( settings.createConversationModelEvaluationOperationSettings(), clientContext, httpJsonOperationsStub); + this.listLocationsCallable = + callableFactory.createUnaryCallable( + listLocationsTransportSettings, settings.listLocationsSettings(), clientContext); + this.listLocationsPagedCallable = + callableFactory.createPagedCallable( + listLocationsTransportSettings, settings.listLocationsSettings(), clientContext); + this.getLocationCallable = + callableFactory.createUnaryCallable( + getLocationTransportSettings, settings.getLocationSettings(), clientContext); this.backgroundResources = new BackgroundResourceAggregation(clientContext.getBackgroundResources()); @@ -695,6 +790,8 @@ public static List getMethodDescriptors() { methodDescriptors.add(getConversationModelEvaluationMethodDescriptor); methodDescriptors.add(listConversationModelEvaluationsMethodDescriptor); methodDescriptors.add(createConversationModelEvaluationMethodDescriptor); + methodDescriptors.add(listLocationsMethodDescriptor); + methodDescriptors.add(getLocationMethodDescriptor); return methodDescriptors; } @@ -809,6 +906,22 @@ public HttpJsonOperationsStub getHttpJsonOperationsStub() { return createConversationModelEvaluationOperationCallable; } + @Override + public UnaryCallable listLocationsCallable() { + return listLocationsCallable; + } + + @Override + public UnaryCallable + listLocationsPagedCallable() { + return listLocationsPagedCallable; + } + + @Override + public UnaryCallable getLocationCallable() { + return getLocationCallable; + } + @Override public final void close() { try { diff --git a/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2/stub/HttpJsonConversationProfilesStub.java b/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2/stub/HttpJsonConversationProfilesStub.java index f95c3656f..9ca7044bb 100644 --- a/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2/stub/HttpJsonConversationProfilesStub.java +++ b/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2/stub/HttpJsonConversationProfilesStub.java @@ -17,6 +17,7 @@ package com.google.cloud.dialogflow.v2.stub; import static com.google.cloud.dialogflow.v2.ConversationProfilesClient.ListConversationProfilesPagedResponse; +import static com.google.cloud.dialogflow.v2.ConversationProfilesClient.ListLocationsPagedResponse; import com.google.api.core.BetaApi; import com.google.api.core.InternalApi; @@ -44,6 +45,10 @@ import com.google.cloud.dialogflow.v2.SetSuggestionFeatureConfigOperationMetadata; import com.google.cloud.dialogflow.v2.SetSuggestionFeatureConfigRequest; import com.google.cloud.dialogflow.v2.UpdateConversationProfileRequest; +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.ListLocationsResponse; +import com.google.cloud.location.Location; import com.google.longrunning.Operation; import com.google.protobuf.Empty; import com.google.protobuf.TypeRegistry; @@ -353,6 +358,72 @@ public class HttpJsonConversationProfilesStub extends ConversationProfilesStub { HttpJsonOperationSnapshot.create(response)) .build(); + private static final ApiMethodDescriptor + listLocationsMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("google.cloud.location.Locations/ListLocations") + .setHttpMethod("GET") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v2/{name=projects/*}/locations", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam(fields, "name", request.getName()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + return fields; + }) + .setRequestBodyExtractor(request -> null) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(ListLocationsResponse.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private static final ApiMethodDescriptor + getLocationMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("google.cloud.location.Locations/GetLocation") + .setHttpMethod("GET") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v2/{name=projects/*/locations/*}", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam(fields, "name", request.getName()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + return fields; + }) + .setRequestBodyExtractor(request -> null) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(Location.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + private final UnaryCallable listConversationProfilesCallable; private final UnaryCallable< @@ -380,6 +451,10 @@ public class HttpJsonConversationProfilesStub extends ConversationProfilesStub { ConversationProfile, ClearSuggestionFeatureConfigOperationMetadata> clearSuggestionFeatureConfigOperationCallable; + private final UnaryCallable listLocationsCallable; + private final UnaryCallable + listLocationsPagedCallable; + private final UnaryCallable getLocationCallable; private final BackgroundResource backgroundResources; private final HttpJsonOperationsStub httpJsonOperationsStub; @@ -471,6 +546,17 @@ protected HttpJsonConversationProfilesStub( .setMethodDescriptor(clearSuggestionFeatureConfigMethodDescriptor) .setTypeRegistry(typeRegistry) .build(); + HttpJsonCallSettings + listLocationsTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(listLocationsMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings getLocationTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(getLocationMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); this.listConversationProfilesCallable = callableFactory.createUnaryCallable( @@ -524,6 +610,15 @@ protected HttpJsonConversationProfilesStub( settings.clearSuggestionFeatureConfigOperationSettings(), clientContext, httpJsonOperationsStub); + this.listLocationsCallable = + callableFactory.createUnaryCallable( + listLocationsTransportSettings, settings.listLocationsSettings(), clientContext); + this.listLocationsPagedCallable = + callableFactory.createPagedCallable( + listLocationsTransportSettings, settings.listLocationsSettings(), clientContext); + this.getLocationCallable = + callableFactory.createUnaryCallable( + getLocationTransportSettings, settings.getLocationSettings(), clientContext); this.backgroundResources = new BackgroundResourceAggregation(clientContext.getBackgroundResources()); @@ -539,6 +634,8 @@ public static List getMethodDescriptors() { methodDescriptors.add(deleteConversationProfileMethodDescriptor); methodDescriptors.add(setSuggestionFeatureConfigMethodDescriptor); methodDescriptors.add(clearSuggestionFeatureConfigMethodDescriptor); + methodDescriptors.add(listLocationsMethodDescriptor); + methodDescriptors.add(getLocationMethodDescriptor); return methodDescriptors; } @@ -612,6 +709,22 @@ public HttpJsonOperationsStub getHttpJsonOperationsStub() { return clearSuggestionFeatureConfigOperationCallable; } + @Override + public UnaryCallable listLocationsCallable() { + return listLocationsCallable; + } + + @Override + public UnaryCallable + listLocationsPagedCallable() { + return listLocationsPagedCallable; + } + + @Override + public UnaryCallable getLocationCallable() { + return getLocationCallable; + } + @Override public final void close() { try { diff --git a/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2/stub/HttpJsonConversationsStub.java b/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2/stub/HttpJsonConversationsStub.java index 9cff45304..b78596c6a 100644 --- a/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2/stub/HttpJsonConversationsStub.java +++ b/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2/stub/HttpJsonConversationsStub.java @@ -17,6 +17,7 @@ package com.google.cloud.dialogflow.v2.stub; import static com.google.cloud.dialogflow.v2.ConversationsClient.ListConversationsPagedResponse; +import static com.google.cloud.dialogflow.v2.ConversationsClient.ListLocationsPagedResponse; import static com.google.cloud.dialogflow.v2.ConversationsClient.ListMessagesPagedResponse; import com.google.api.core.BetaApi; @@ -39,6 +40,10 @@ import com.google.cloud.dialogflow.v2.ListConversationsResponse; import com.google.cloud.dialogflow.v2.ListMessagesRequest; import com.google.cloud.dialogflow.v2.ListMessagesResponse; +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.ListLocationsResponse; +import com.google.cloud.location.Location; import com.google.protobuf.TypeRegistry; import java.io.IOException; import java.util.ArrayList; @@ -245,6 +250,72 @@ public class HttpJsonConversationsStub extends ConversationsStub { .build()) .build(); + private static final ApiMethodDescriptor + listLocationsMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("google.cloud.location.Locations/ListLocations") + .setHttpMethod("GET") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v2/{name=projects/*}/locations", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam(fields, "name", request.getName()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + return fields; + }) + .setRequestBodyExtractor(request -> null) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(ListLocationsResponse.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private static final ApiMethodDescriptor + getLocationMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("google.cloud.location.Locations/GetLocation") + .setHttpMethod("GET") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v2/{name=projects/*/locations/*}", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam(fields, "name", request.getName()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + return fields; + }) + .setRequestBodyExtractor(request -> null) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(Location.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + private final UnaryCallable createConversationCallable; private final UnaryCallable listConversationsCallable; @@ -256,6 +327,10 @@ public class HttpJsonConversationsStub extends ConversationsStub { private final UnaryCallable listMessagesCallable; private final UnaryCallable listMessagesPagedCallable; + private final UnaryCallable listLocationsCallable; + private final UnaryCallable + listLocationsPagedCallable; + private final UnaryCallable getLocationCallable; private final BackgroundResource backgroundResources; private final HttpJsonStubCallableFactory callableFactory; @@ -327,6 +402,17 @@ protected HttpJsonConversationsStub( .setMethodDescriptor(listMessagesMethodDescriptor) .setTypeRegistry(typeRegistry) .build(); + HttpJsonCallSettings + listLocationsTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(listLocationsMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings getLocationTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(getLocationMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); this.createConversationCallable = callableFactory.createUnaryCallable( @@ -357,6 +443,15 @@ protected HttpJsonConversationsStub( this.listMessagesPagedCallable = callableFactory.createPagedCallable( listMessagesTransportSettings, settings.listMessagesSettings(), clientContext); + this.listLocationsCallable = + callableFactory.createUnaryCallable( + listLocationsTransportSettings, settings.listLocationsSettings(), clientContext); + this.listLocationsPagedCallable = + callableFactory.createPagedCallable( + listLocationsTransportSettings, settings.listLocationsSettings(), clientContext); + this.getLocationCallable = + callableFactory.createUnaryCallable( + getLocationTransportSettings, settings.getLocationSettings(), clientContext); this.backgroundResources = new BackgroundResourceAggregation(clientContext.getBackgroundResources()); @@ -370,6 +465,8 @@ public static List getMethodDescriptors() { methodDescriptors.add(getConversationMethodDescriptor); methodDescriptors.add(completeConversationMethodDescriptor); methodDescriptors.add(listMessagesMethodDescriptor); + methodDescriptors.add(listLocationsMethodDescriptor); + methodDescriptors.add(getLocationMethodDescriptor); return methodDescriptors; } @@ -410,6 +507,22 @@ public UnaryCallable listMessage return listMessagesPagedCallable; } + @Override + public UnaryCallable listLocationsCallable() { + return listLocationsCallable; + } + + @Override + public UnaryCallable + listLocationsPagedCallable() { + return listLocationsPagedCallable; + } + + @Override + public UnaryCallable getLocationCallable() { + return getLocationCallable; + } + @Override public final void close() { try { diff --git a/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2/stub/HttpJsonDocumentsStub.java b/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2/stub/HttpJsonDocumentsStub.java index 6534cf030..1d73ee1dd 100644 --- a/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2/stub/HttpJsonDocumentsStub.java +++ b/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2/stub/HttpJsonDocumentsStub.java @@ -17,6 +17,7 @@ package com.google.cloud.dialogflow.v2.stub; import static com.google.cloud.dialogflow.v2.DocumentsClient.ListDocumentsPagedResponse; +import static com.google.cloud.dialogflow.v2.DocumentsClient.ListLocationsPagedResponse; import com.google.api.core.BetaApi; import com.google.api.core.InternalApi; @@ -45,6 +46,10 @@ import com.google.cloud.dialogflow.v2.ListDocumentsResponse; import com.google.cloud.dialogflow.v2.ReloadDocumentRequest; import com.google.cloud.dialogflow.v2.UpdateDocumentRequest; +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.ListLocationsResponse; +import com.google.cloud.location.Location; import com.google.longrunning.Operation; import com.google.protobuf.Empty; import com.google.protobuf.TypeRegistry; @@ -397,6 +402,72 @@ public class HttpJsonDocumentsStub extends DocumentsStub { HttpJsonOperationSnapshot.create(response)) .build(); + private static final ApiMethodDescriptor + listLocationsMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("google.cloud.location.Locations/ListLocations") + .setHttpMethod("GET") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v2/{name=projects/*}/locations", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam(fields, "name", request.getName()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + return fields; + }) + .setRequestBodyExtractor(request -> null) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(ListLocationsResponse.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private static final ApiMethodDescriptor + getLocationMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("google.cloud.location.Locations/GetLocation") + .setHttpMethod("GET") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v2/{name=projects/*/locations/*}", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam(fields, "name", request.getName()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + return fields; + }) + .setRequestBodyExtractor(request -> null) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(Location.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + private final UnaryCallable listDocumentsCallable; private final UnaryCallable listDocumentsPagedCallable; @@ -420,6 +491,10 @@ public class HttpJsonDocumentsStub extends DocumentsStub { private final UnaryCallable exportDocumentCallable; private final OperationCallable exportDocumentOperationCallable; + private final UnaryCallable listLocationsCallable; + private final UnaryCallable + listLocationsPagedCallable; + private final UnaryCallable getLocationCallable; private final BackgroundResource backgroundResources; private final HttpJsonOperationsStub httpJsonOperationsStub; @@ -506,6 +581,17 @@ protected HttpJsonDocumentsStub( .setMethodDescriptor(exportDocumentMethodDescriptor) .setTypeRegistry(typeRegistry) .build(); + HttpJsonCallSettings + listLocationsTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(listLocationsMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings getLocationTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(getLocationMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); this.listDocumentsCallable = callableFactory.createUnaryCallable( @@ -570,6 +656,15 @@ protected HttpJsonDocumentsStub( settings.exportDocumentOperationSettings(), clientContext, httpJsonOperationsStub); + this.listLocationsCallable = + callableFactory.createUnaryCallable( + listLocationsTransportSettings, settings.listLocationsSettings(), clientContext); + this.listLocationsPagedCallable = + callableFactory.createPagedCallable( + listLocationsTransportSettings, settings.listLocationsSettings(), clientContext); + this.getLocationCallable = + callableFactory.createUnaryCallable( + getLocationTransportSettings, settings.getLocationSettings(), clientContext); this.backgroundResources = new BackgroundResourceAggregation(clientContext.getBackgroundResources()); @@ -586,6 +681,8 @@ public static List getMethodDescriptors() { methodDescriptors.add(updateDocumentMethodDescriptor); methodDescriptors.add(reloadDocumentMethodDescriptor); methodDescriptors.add(exportDocumentMethodDescriptor); + methodDescriptors.add(listLocationsMethodDescriptor); + methodDescriptors.add(getLocationMethodDescriptor); return methodDescriptors; } @@ -676,6 +773,22 @@ public UnaryCallable exportDocumentCallable() return exportDocumentOperationCallable; } + @Override + public UnaryCallable listLocationsCallable() { + return listLocationsCallable; + } + + @Override + public UnaryCallable + listLocationsPagedCallable() { + return listLocationsPagedCallable; + } + + @Override + public UnaryCallable getLocationCallable() { + return getLocationCallable; + } + @Override public final void close() { try { diff --git a/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2/stub/HttpJsonEntityTypesStub.java b/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2/stub/HttpJsonEntityTypesStub.java index cdee50053..f73ae4f29 100644 --- a/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2/stub/HttpJsonEntityTypesStub.java +++ b/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2/stub/HttpJsonEntityTypesStub.java @@ -17,6 +17,7 @@ package com.google.cloud.dialogflow.v2.stub; import static com.google.cloud.dialogflow.v2.EntityTypesClient.ListEntityTypesPagedResponse; +import static com.google.cloud.dialogflow.v2.EntityTypesClient.ListLocationsPagedResponse; import com.google.api.core.BetaApi; import com.google.api.core.InternalApi; @@ -46,6 +47,10 @@ import com.google.cloud.dialogflow.v2.ListEntityTypesRequest; import com.google.cloud.dialogflow.v2.ListEntityTypesResponse; import com.google.cloud.dialogflow.v2.UpdateEntityTypeRequest; +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.ListLocationsResponse; +import com.google.cloud.location.Location; import com.google.longrunning.Operation; import com.google.protobuf.Empty; import com.google.protobuf.Struct; @@ -468,6 +473,72 @@ public class HttpJsonEntityTypesStub extends EntityTypesStub { HttpJsonOperationSnapshot.create(response)) .build(); + private static final ApiMethodDescriptor + listLocationsMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("google.cloud.location.Locations/ListLocations") + .setHttpMethod("GET") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v2/{name=projects/*}/locations", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam(fields, "name", request.getName()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + return fields; + }) + .setRequestBodyExtractor(request -> null) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(ListLocationsResponse.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private static final ApiMethodDescriptor + getLocationMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("google.cloud.location.Locations/GetLocation") + .setHttpMethod("GET") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v2/{name=projects/*/locations/*}", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam(fields, "name", request.getName()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + return fields; + }) + .setRequestBodyExtractor(request -> null) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(Location.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + private final UnaryCallable listEntityTypesCallable; private final UnaryCallable @@ -494,6 +565,10 @@ public class HttpJsonEntityTypesStub extends EntityTypesStub { private final UnaryCallable batchDeleteEntitiesCallable; private final OperationCallable batchDeleteEntitiesOperationCallable; + private final UnaryCallable listLocationsCallable; + private final UnaryCallable + listLocationsPagedCallable; + private final UnaryCallable getLocationCallable; private final BackgroundResource backgroundResources; private final HttpJsonOperationsStub httpJsonOperationsStub; @@ -596,6 +671,17 @@ protected HttpJsonEntityTypesStub( .setMethodDescriptor(batchDeleteEntitiesMethodDescriptor) .setTypeRegistry(typeRegistry) .build(); + HttpJsonCallSettings + listLocationsTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(listLocationsMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings getLocationTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(getLocationMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); this.listEntityTypesCallable = callableFactory.createUnaryCallable( @@ -670,6 +756,15 @@ protected HttpJsonEntityTypesStub( settings.batchDeleteEntitiesOperationSettings(), clientContext, httpJsonOperationsStub); + this.listLocationsCallable = + callableFactory.createUnaryCallable( + listLocationsTransportSettings, settings.listLocationsSettings(), clientContext); + this.listLocationsPagedCallable = + callableFactory.createPagedCallable( + listLocationsTransportSettings, settings.listLocationsSettings(), clientContext); + this.getLocationCallable = + callableFactory.createUnaryCallable( + getLocationTransportSettings, settings.getLocationSettings(), clientContext); this.backgroundResources = new BackgroundResourceAggregation(clientContext.getBackgroundResources()); @@ -688,6 +783,8 @@ public static List getMethodDescriptors() { methodDescriptors.add(batchCreateEntitiesMethodDescriptor); methodDescriptors.add(batchUpdateEntitiesMethodDescriptor); methodDescriptors.add(batchDeleteEntitiesMethodDescriptor); + methodDescriptors.add(listLocationsMethodDescriptor); + methodDescriptors.add(getLocationMethodDescriptor); return methodDescriptors; } @@ -781,6 +878,22 @@ public UnaryCallable batchDeleteEntitiesC return batchDeleteEntitiesOperationCallable; } + @Override + public UnaryCallable listLocationsCallable() { + return listLocationsCallable; + } + + @Override + public UnaryCallable + listLocationsPagedCallable() { + return listLocationsPagedCallable; + } + + @Override + public UnaryCallable getLocationCallable() { + return getLocationCallable; + } + @Override public final void close() { try { diff --git a/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2/stub/HttpJsonEnvironmentsStub.java b/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2/stub/HttpJsonEnvironmentsStub.java index 764fdacb6..899788687 100644 --- a/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2/stub/HttpJsonEnvironmentsStub.java +++ b/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2/stub/HttpJsonEnvironmentsStub.java @@ -18,6 +18,7 @@ import static com.google.cloud.dialogflow.v2.EnvironmentsClient.GetEnvironmentHistoryPagedResponse; import static com.google.cloud.dialogflow.v2.EnvironmentsClient.ListEnvironmentsPagedResponse; +import static com.google.cloud.dialogflow.v2.EnvironmentsClient.ListLocationsPagedResponse; import com.google.api.core.BetaApi; import com.google.api.core.InternalApi; @@ -40,6 +41,10 @@ import com.google.cloud.dialogflow.v2.ListEnvironmentsRequest; import com.google.cloud.dialogflow.v2.ListEnvironmentsResponse; import com.google.cloud.dialogflow.v2.UpdateEnvironmentRequest; +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.ListLocationsResponse; +import com.google.cloud.location.Location; import com.google.protobuf.Empty; import com.google.protobuf.TypeRegistry; import java.io.IOException; @@ -285,6 +290,72 @@ public class HttpJsonEnvironmentsStub extends EnvironmentsStub { .build()) .build(); + private static final ApiMethodDescriptor + listLocationsMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("google.cloud.location.Locations/ListLocations") + .setHttpMethod("GET") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v2/{name=projects/*}/locations", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam(fields, "name", request.getName()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + return fields; + }) + .setRequestBodyExtractor(request -> null) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(ListLocationsResponse.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private static final ApiMethodDescriptor + getLocationMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("google.cloud.location.Locations/GetLocation") + .setHttpMethod("GET") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v2/{name=projects/*/locations/*}", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam(fields, "name", request.getName()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + return fields; + }) + .setRequestBodyExtractor(request -> null) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(Location.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + private final UnaryCallable listEnvironmentsCallable; private final UnaryCallable @@ -297,6 +368,10 @@ public class HttpJsonEnvironmentsStub extends EnvironmentsStub { getEnvironmentHistoryCallable; private final UnaryCallable getEnvironmentHistoryPagedCallable; + private final UnaryCallable listLocationsCallable; + private final UnaryCallable + listLocationsPagedCallable; + private final UnaryCallable getLocationCallable; private final BackgroundResource backgroundResources; private final HttpJsonStubCallableFactory callableFactory; @@ -372,6 +447,17 @@ protected HttpJsonEnvironmentsStub( .setMethodDescriptor(getEnvironmentHistoryMethodDescriptor) .setTypeRegistry(typeRegistry) .build(); + HttpJsonCallSettings + listLocationsTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(listLocationsMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings getLocationTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(getLocationMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); this.listEnvironmentsCallable = callableFactory.createUnaryCallable( @@ -407,6 +493,15 @@ protected HttpJsonEnvironmentsStub( getEnvironmentHistoryTransportSettings, settings.getEnvironmentHistorySettings(), clientContext); + this.listLocationsCallable = + callableFactory.createUnaryCallable( + listLocationsTransportSettings, settings.listLocationsSettings(), clientContext); + this.listLocationsPagedCallable = + callableFactory.createPagedCallable( + listLocationsTransportSettings, settings.listLocationsSettings(), clientContext); + this.getLocationCallable = + callableFactory.createUnaryCallable( + getLocationTransportSettings, settings.getLocationSettings(), clientContext); this.backgroundResources = new BackgroundResourceAggregation(clientContext.getBackgroundResources()); @@ -421,6 +516,8 @@ public static List getMethodDescriptors() { methodDescriptors.add(updateEnvironmentMethodDescriptor); methodDescriptors.add(deleteEnvironmentMethodDescriptor); methodDescriptors.add(getEnvironmentHistoryMethodDescriptor); + methodDescriptors.add(listLocationsMethodDescriptor); + methodDescriptors.add(getLocationMethodDescriptor); return methodDescriptors; } @@ -468,6 +565,22 @@ public UnaryCallable deleteEnvironmentCallable( return getEnvironmentHistoryPagedCallable; } + @Override + public UnaryCallable listLocationsCallable() { + return listLocationsCallable; + } + + @Override + public UnaryCallable + listLocationsPagedCallable() { + return listLocationsPagedCallable; + } + + @Override + public UnaryCallable getLocationCallable() { + return getLocationCallable; + } + @Override public final void close() { try { diff --git a/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2/stub/HttpJsonFulfillmentsStub.java b/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2/stub/HttpJsonFulfillmentsStub.java index 550965224..f214fc794 100644 --- a/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2/stub/HttpJsonFulfillmentsStub.java +++ b/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2/stub/HttpJsonFulfillmentsStub.java @@ -16,6 +16,8 @@ package com.google.cloud.dialogflow.v2.stub; +import static com.google.cloud.dialogflow.v2.FulfillmentsClient.ListLocationsPagedResponse; + import com.google.api.core.BetaApi; import com.google.api.core.InternalApi; import com.google.api.gax.core.BackgroundResource; @@ -31,6 +33,10 @@ import com.google.cloud.dialogflow.v2.Fulfillment; import com.google.cloud.dialogflow.v2.GetFulfillmentRequest; import com.google.cloud.dialogflow.v2.UpdateFulfillmentRequest; +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.ListLocationsResponse; +import com.google.cloud.location.Location; import com.google.protobuf.TypeRegistry; import java.io.IOException; import java.util.ArrayList; @@ -125,8 +131,78 @@ public class HttpJsonFulfillmentsStub extends FulfillmentsStub { .build()) .build(); + private static final ApiMethodDescriptor + listLocationsMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("google.cloud.location.Locations/ListLocations") + .setHttpMethod("GET") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v2/{name=projects/*}/locations", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam(fields, "name", request.getName()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + return fields; + }) + .setRequestBodyExtractor(request -> null) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(ListLocationsResponse.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private static final ApiMethodDescriptor + getLocationMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("google.cloud.location.Locations/GetLocation") + .setHttpMethod("GET") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v2/{name=projects/*/locations/*}", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam(fields, "name", request.getName()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + return fields; + }) + .setRequestBodyExtractor(request -> null) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(Location.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + private final UnaryCallable getFulfillmentCallable; private final UnaryCallable updateFulfillmentCallable; + private final UnaryCallable listLocationsCallable; + private final UnaryCallable + listLocationsPagedCallable; + private final UnaryCallable getLocationCallable; private final BackgroundResource backgroundResources; private final HttpJsonStubCallableFactory callableFactory; @@ -180,6 +256,17 @@ protected HttpJsonFulfillmentsStub( .setMethodDescriptor(updateFulfillmentMethodDescriptor) .setTypeRegistry(typeRegistry) .build(); + HttpJsonCallSettings + listLocationsTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(listLocationsMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings getLocationTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(getLocationMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); this.getFulfillmentCallable = callableFactory.createUnaryCallable( @@ -189,6 +276,15 @@ protected HttpJsonFulfillmentsStub( updateFulfillmentTransportSettings, settings.updateFulfillmentSettings(), clientContext); + this.listLocationsCallable = + callableFactory.createUnaryCallable( + listLocationsTransportSettings, settings.listLocationsSettings(), clientContext); + this.listLocationsPagedCallable = + callableFactory.createPagedCallable( + listLocationsTransportSettings, settings.listLocationsSettings(), clientContext); + this.getLocationCallable = + callableFactory.createUnaryCallable( + getLocationTransportSettings, settings.getLocationSettings(), clientContext); this.backgroundResources = new BackgroundResourceAggregation(clientContext.getBackgroundResources()); @@ -199,6 +295,8 @@ public static List getMethodDescriptors() { List methodDescriptors = new ArrayList<>(); methodDescriptors.add(getFulfillmentMethodDescriptor); methodDescriptors.add(updateFulfillmentMethodDescriptor); + methodDescriptors.add(listLocationsMethodDescriptor); + methodDescriptors.add(getLocationMethodDescriptor); return methodDescriptors; } @@ -212,6 +310,22 @@ public UnaryCallable updateFulfillmentCal return updateFulfillmentCallable; } + @Override + public UnaryCallable listLocationsCallable() { + return listLocationsCallable; + } + + @Override + public UnaryCallable + listLocationsPagedCallable() { + return listLocationsPagedCallable; + } + + @Override + public UnaryCallable getLocationCallable() { + return getLocationCallable; + } + @Override public final void close() { try { diff --git a/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2/stub/HttpJsonIntentsStub.java b/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2/stub/HttpJsonIntentsStub.java index 2da88cd73..7a1dcbcb0 100644 --- a/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2/stub/HttpJsonIntentsStub.java +++ b/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2/stub/HttpJsonIntentsStub.java @@ -17,6 +17,7 @@ package com.google.cloud.dialogflow.v2.stub; import static com.google.cloud.dialogflow.v2.IntentsClient.ListIntentsPagedResponse; +import static com.google.cloud.dialogflow.v2.IntentsClient.ListLocationsPagedResponse; import com.google.api.core.BetaApi; import com.google.api.core.InternalApi; @@ -43,6 +44,10 @@ import com.google.cloud.dialogflow.v2.ListIntentsRequest; import com.google.cloud.dialogflow.v2.ListIntentsResponse; import com.google.cloud.dialogflow.v2.UpdateIntentRequest; +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.ListLocationsResponse; +import com.google.cloud.location.Location; import com.google.longrunning.Operation; import com.google.protobuf.Empty; import com.google.protobuf.Struct; @@ -345,6 +350,72 @@ public class HttpJsonIntentsStub extends IntentsStub { HttpJsonOperationSnapshot.create(response)) .build(); + private static final ApiMethodDescriptor + listLocationsMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("google.cloud.location.Locations/ListLocations") + .setHttpMethod("GET") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v2/{name=projects/*}/locations", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam(fields, "name", request.getName()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + return fields; + }) + .setRequestBodyExtractor(request -> null) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(ListLocationsResponse.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private static final ApiMethodDescriptor + getLocationMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("google.cloud.location.Locations/GetLocation") + .setHttpMethod("GET") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v2/{name=projects/*/locations/*}", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam(fields, "name", request.getName()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + return fields; + }) + .setRequestBodyExtractor(request -> null) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(Location.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + private final UnaryCallable listIntentsCallable; private final UnaryCallable listIntentsPagedCallable; @@ -358,6 +429,10 @@ public class HttpJsonIntentsStub extends IntentsStub { private final UnaryCallable batchDeleteIntentsCallable; private final OperationCallable batchDeleteIntentsOperationCallable; + private final UnaryCallable listLocationsCallable; + private final UnaryCallable + listLocationsPagedCallable; + private final UnaryCallable getLocationCallable; private final BackgroundResource backgroundResources; private final HttpJsonOperationsStub httpJsonOperationsStub; @@ -436,6 +511,17 @@ protected HttpJsonIntentsStub( .setMethodDescriptor(batchDeleteIntentsMethodDescriptor) .setTypeRegistry(typeRegistry) .build(); + HttpJsonCallSettings + listLocationsTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(listLocationsMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings getLocationTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(getLocationMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); this.listIntentsCallable = callableFactory.createUnaryCallable( @@ -477,6 +563,15 @@ protected HttpJsonIntentsStub( settings.batchDeleteIntentsOperationSettings(), clientContext, httpJsonOperationsStub); + this.listLocationsCallable = + callableFactory.createUnaryCallable( + listLocationsTransportSettings, settings.listLocationsSettings(), clientContext); + this.listLocationsPagedCallable = + callableFactory.createPagedCallable( + listLocationsTransportSettings, settings.listLocationsSettings(), clientContext); + this.getLocationCallable = + callableFactory.createUnaryCallable( + getLocationTransportSettings, settings.getLocationSettings(), clientContext); this.backgroundResources = new BackgroundResourceAggregation(clientContext.getBackgroundResources()); @@ -492,6 +587,8 @@ public static List getMethodDescriptors() { methodDescriptors.add(deleteIntentMethodDescriptor); methodDescriptors.add(batchUpdateIntentsMethodDescriptor); methodDescriptors.add(batchDeleteIntentsMethodDescriptor); + methodDescriptors.add(listLocationsMethodDescriptor); + methodDescriptors.add(getLocationMethodDescriptor); return methodDescriptors; } @@ -551,6 +648,22 @@ public UnaryCallable batchDeleteIntentsCal return batchDeleteIntentsOperationCallable; } + @Override + public UnaryCallable listLocationsCallable() { + return listLocationsCallable; + } + + @Override + public UnaryCallable + listLocationsPagedCallable() { + return listLocationsPagedCallable; + } + + @Override + public UnaryCallable getLocationCallable() { + return getLocationCallable; + } + @Override public final void close() { try { diff --git a/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2/stub/HttpJsonKnowledgeBasesStub.java b/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2/stub/HttpJsonKnowledgeBasesStub.java index 82c532b67..8be11f69b 100644 --- a/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2/stub/HttpJsonKnowledgeBasesStub.java +++ b/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2/stub/HttpJsonKnowledgeBasesStub.java @@ -17,6 +17,7 @@ package com.google.cloud.dialogflow.v2.stub; import static com.google.cloud.dialogflow.v2.KnowledgeBasesClient.ListKnowledgeBasesPagedResponse; +import static com.google.cloud.dialogflow.v2.KnowledgeBasesClient.ListLocationsPagedResponse; import com.google.api.core.BetaApi; import com.google.api.core.InternalApi; @@ -37,6 +38,10 @@ import com.google.cloud.dialogflow.v2.ListKnowledgeBasesRequest; import com.google.cloud.dialogflow.v2.ListKnowledgeBasesResponse; import com.google.cloud.dialogflow.v2.UpdateKnowledgeBaseRequest; +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.ListLocationsResponse; +import com.google.cloud.location.Location; import com.google.protobuf.Empty; import com.google.protobuf.TypeRegistry; import java.io.IOException; @@ -250,6 +255,72 @@ public class HttpJsonKnowledgeBasesStub extends KnowledgeBasesStub { .build()) .build(); + private static final ApiMethodDescriptor + listLocationsMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("google.cloud.location.Locations/ListLocations") + .setHttpMethod("GET") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v2/{name=projects/*}/locations", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam(fields, "name", request.getName()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + return fields; + }) + .setRequestBodyExtractor(request -> null) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(ListLocationsResponse.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private static final ApiMethodDescriptor + getLocationMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("google.cloud.location.Locations/GetLocation") + .setHttpMethod("GET") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v2/{name=projects/*/locations/*}", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam(fields, "name", request.getName()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + return fields; + }) + .setRequestBodyExtractor(request -> null) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(Location.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + private final UnaryCallable listKnowledgeBasesCallable; private final UnaryCallable @@ -260,6 +331,10 @@ public class HttpJsonKnowledgeBasesStub extends KnowledgeBasesStub { private final UnaryCallable deleteKnowledgeBaseCallable; private final UnaryCallable updateKnowledgeBaseCallable; + private final UnaryCallable listLocationsCallable; + private final UnaryCallable + listLocationsPagedCallable; + private final UnaryCallable getLocationCallable; private final BackgroundResource backgroundResources; private final HttpJsonStubCallableFactory callableFactory; @@ -331,6 +406,17 @@ protected HttpJsonKnowledgeBasesStub( .setMethodDescriptor(updateKnowledgeBaseMethodDescriptor) .setTypeRegistry(typeRegistry) .build(); + HttpJsonCallSettings + listLocationsTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(listLocationsMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings getLocationTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(getLocationMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); this.listKnowledgeBasesCallable = callableFactory.createUnaryCallable( @@ -360,6 +446,15 @@ protected HttpJsonKnowledgeBasesStub( updateKnowledgeBaseTransportSettings, settings.updateKnowledgeBaseSettings(), clientContext); + this.listLocationsCallable = + callableFactory.createUnaryCallable( + listLocationsTransportSettings, settings.listLocationsSettings(), clientContext); + this.listLocationsPagedCallable = + callableFactory.createPagedCallable( + listLocationsTransportSettings, settings.listLocationsSettings(), clientContext); + this.getLocationCallable = + callableFactory.createUnaryCallable( + getLocationTransportSettings, settings.getLocationSettings(), clientContext); this.backgroundResources = new BackgroundResourceAggregation(clientContext.getBackgroundResources()); @@ -373,6 +468,8 @@ public static List getMethodDescriptors() { methodDescriptors.add(createKnowledgeBaseMethodDescriptor); methodDescriptors.add(deleteKnowledgeBaseMethodDescriptor); methodDescriptors.add(updateKnowledgeBaseMethodDescriptor); + methodDescriptors.add(listLocationsMethodDescriptor); + methodDescriptors.add(getLocationMethodDescriptor); return methodDescriptors; } @@ -408,6 +505,22 @@ public UnaryCallable updateKnowledgeB return updateKnowledgeBaseCallable; } + @Override + public UnaryCallable listLocationsCallable() { + return listLocationsCallable; + } + + @Override + public UnaryCallable + listLocationsPagedCallable() { + return listLocationsPagedCallable; + } + + @Override + public UnaryCallable getLocationCallable() { + return getLocationCallable; + } + @Override public final void close() { try { diff --git a/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2/stub/HttpJsonParticipantsStub.java b/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2/stub/HttpJsonParticipantsStub.java index ff812ad3a..17ee77041 100644 --- a/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2/stub/HttpJsonParticipantsStub.java +++ b/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2/stub/HttpJsonParticipantsStub.java @@ -16,6 +16,7 @@ package com.google.cloud.dialogflow.v2.stub; +import static com.google.cloud.dialogflow.v2.ParticipantsClient.ListLocationsPagedResponse; import static com.google.cloud.dialogflow.v2.ParticipantsClient.ListParticipantsPagedResponse; import com.google.api.core.BetaApi; @@ -44,6 +45,10 @@ import com.google.cloud.dialogflow.v2.SuggestSmartRepliesRequest; import com.google.cloud.dialogflow.v2.SuggestSmartRepliesResponse; import com.google.cloud.dialogflow.v2.UpdateParticipantRequest; +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.ListLocationsResponse; +import com.google.cloud.location.Location; import com.google.protobuf.TypeRegistry; import java.io.IOException; import java.util.ArrayList; @@ -367,6 +372,72 @@ public class HttpJsonParticipantsStub extends ParticipantsStub { .build()) .build(); + private static final ApiMethodDescriptor + listLocationsMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("google.cloud.location.Locations/ListLocations") + .setHttpMethod("GET") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v2/{name=projects/*}/locations", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam(fields, "name", request.getName()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + return fields; + }) + .setRequestBodyExtractor(request -> null) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(ListLocationsResponse.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private static final ApiMethodDescriptor + getLocationMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("google.cloud.location.Locations/GetLocation") + .setHttpMethod("GET") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v2/{name=projects/*/locations/*}", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam(fields, "name", request.getName()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + return fields; + }) + .setRequestBodyExtractor(request -> null) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(Location.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + private final UnaryCallable createParticipantCallable; private final UnaryCallable getParticipantCallable; private final UnaryCallable @@ -381,6 +452,10 @@ public class HttpJsonParticipantsStub extends ParticipantsStub { suggestFaqAnswersCallable; private final UnaryCallable suggestSmartRepliesCallable; + private final UnaryCallable listLocationsCallable; + private final UnaryCallable + listLocationsPagedCallable; + private final UnaryCallable getLocationCallable; private final BackgroundResource backgroundResources; private final HttpJsonStubCallableFactory callableFactory; @@ -470,6 +545,17 @@ protected HttpJsonParticipantsStub( .setMethodDescriptor(suggestSmartRepliesMethodDescriptor) .setTypeRegistry(typeRegistry) .build(); + HttpJsonCallSettings + listLocationsTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(listLocationsMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings getLocationTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(getLocationMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); this.createParticipantCallable = callableFactory.createUnaryCallable( @@ -506,6 +592,15 @@ protected HttpJsonParticipantsStub( suggestSmartRepliesTransportSettings, settings.suggestSmartRepliesSettings(), clientContext); + this.listLocationsCallable = + callableFactory.createUnaryCallable( + listLocationsTransportSettings, settings.listLocationsSettings(), clientContext); + this.listLocationsPagedCallable = + callableFactory.createPagedCallable( + listLocationsTransportSettings, settings.listLocationsSettings(), clientContext); + this.getLocationCallable = + callableFactory.createUnaryCallable( + getLocationTransportSettings, settings.getLocationSettings(), clientContext); this.backgroundResources = new BackgroundResourceAggregation(clientContext.getBackgroundResources()); @@ -522,6 +617,8 @@ public static List getMethodDescriptors() { methodDescriptors.add(suggestArticlesMethodDescriptor); methodDescriptors.add(suggestFaqAnswersMethodDescriptor); methodDescriptors.add(suggestSmartRepliesMethodDescriptor); + methodDescriptors.add(listLocationsMethodDescriptor); + methodDescriptors.add(getLocationMethodDescriptor); return methodDescriptors; } @@ -574,6 +671,22 @@ public UnaryCallable suggestArt return suggestSmartRepliesCallable; } + @Override + public UnaryCallable listLocationsCallable() { + return listLocationsCallable; + } + + @Override + public UnaryCallable + listLocationsPagedCallable() { + return listLocationsPagedCallable; + } + + @Override + public UnaryCallable getLocationCallable() { + return getLocationCallable; + } + @Override public final void close() { try { diff --git a/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2/stub/HttpJsonSessionEntityTypesStub.java b/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2/stub/HttpJsonSessionEntityTypesStub.java index fd5fbf306..7332e92cf 100644 --- a/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2/stub/HttpJsonSessionEntityTypesStub.java +++ b/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2/stub/HttpJsonSessionEntityTypesStub.java @@ -16,6 +16,7 @@ package com.google.cloud.dialogflow.v2.stub; +import static com.google.cloud.dialogflow.v2.SessionEntityTypesClient.ListLocationsPagedResponse; import static com.google.cloud.dialogflow.v2.SessionEntityTypesClient.ListSessionEntityTypesPagedResponse; import com.google.api.core.BetaApi; @@ -37,6 +38,10 @@ import com.google.cloud.dialogflow.v2.ListSessionEntityTypesResponse; import com.google.cloud.dialogflow.v2.SessionEntityType; import com.google.cloud.dialogflow.v2.UpdateSessionEntityTypeRequest; +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.ListLocationsResponse; +import com.google.cloud.location.Location; import com.google.protobuf.Empty; import com.google.protobuf.TypeRegistry; import java.io.IOException; @@ -262,6 +267,72 @@ public class HttpJsonSessionEntityTypesStub extends SessionEntityTypesStub { .build()) .build(); + private static final ApiMethodDescriptor + listLocationsMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("google.cloud.location.Locations/ListLocations") + .setHttpMethod("GET") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v2/{name=projects/*}/locations", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam(fields, "name", request.getName()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + return fields; + }) + .setRequestBodyExtractor(request -> null) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(ListLocationsResponse.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private static final ApiMethodDescriptor + getLocationMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("google.cloud.location.Locations/GetLocation") + .setHttpMethod("GET") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v2/{name=projects/*/locations/*}", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam(fields, "name", request.getName()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + return fields; + }) + .setRequestBodyExtractor(request -> null) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(Location.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + private final UnaryCallable listSessionEntityTypesCallable; private final UnaryCallable @@ -274,6 +345,10 @@ public class HttpJsonSessionEntityTypesStub extends SessionEntityTypesStub { updateSessionEntityTypeCallable; private final UnaryCallable deleteSessionEntityTypeCallable; + private final UnaryCallable listLocationsCallable; + private final UnaryCallable + listLocationsPagedCallable; + private final UnaryCallable getLocationCallable; private final BackgroundResource backgroundResources; private final HttpJsonStubCallableFactory callableFactory; @@ -350,6 +425,17 @@ protected HttpJsonSessionEntityTypesStub( .setMethodDescriptor(deleteSessionEntityTypeMethodDescriptor) .setTypeRegistry(typeRegistry) .build(); + HttpJsonCallSettings + listLocationsTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(listLocationsMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings getLocationTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(getLocationMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); this.listSessionEntityTypesCallable = callableFactory.createUnaryCallable( @@ -381,6 +467,15 @@ protected HttpJsonSessionEntityTypesStub( deleteSessionEntityTypeTransportSettings, settings.deleteSessionEntityTypeSettings(), clientContext); + this.listLocationsCallable = + callableFactory.createUnaryCallable( + listLocationsTransportSettings, settings.listLocationsSettings(), clientContext); + this.listLocationsPagedCallable = + callableFactory.createPagedCallable( + listLocationsTransportSettings, settings.listLocationsSettings(), clientContext); + this.getLocationCallable = + callableFactory.createUnaryCallable( + getLocationTransportSettings, settings.getLocationSettings(), clientContext); this.backgroundResources = new BackgroundResourceAggregation(clientContext.getBackgroundResources()); @@ -394,6 +489,8 @@ public static List getMethodDescriptors() { methodDescriptors.add(createSessionEntityTypeMethodDescriptor); methodDescriptors.add(updateSessionEntityTypeMethodDescriptor); methodDescriptors.add(deleteSessionEntityTypeMethodDescriptor); + methodDescriptors.add(listLocationsMethodDescriptor); + methodDescriptors.add(getLocationMethodDescriptor); return methodDescriptors; } @@ -432,6 +529,22 @@ public UnaryCallable deleteSessionEntityT return deleteSessionEntityTypeCallable; } + @Override + public UnaryCallable listLocationsCallable() { + return listLocationsCallable; + } + + @Override + public UnaryCallable + listLocationsPagedCallable() { + return listLocationsPagedCallable; + } + + @Override + public UnaryCallable getLocationCallable() { + return getLocationCallable; + } + @Override public final void close() { try { diff --git a/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2/stub/HttpJsonSessionsStub.java b/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2/stub/HttpJsonSessionsStub.java index b6b09aaae..7a6737410 100644 --- a/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2/stub/HttpJsonSessionsStub.java +++ b/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2/stub/HttpJsonSessionsStub.java @@ -16,6 +16,8 @@ package com.google.cloud.dialogflow.v2.stub; +import static com.google.cloud.dialogflow.v2.SessionsClient.ListLocationsPagedResponse; + import com.google.api.core.BetaApi; import com.google.api.core.InternalApi; import com.google.api.gax.core.BackgroundResource; @@ -30,6 +32,10 @@ import com.google.api.gax.rpc.UnaryCallable; import com.google.cloud.dialogflow.v2.DetectIntentRequest; import com.google.cloud.dialogflow.v2.DetectIntentResponse; +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.ListLocationsResponse; +import com.google.cloud.location.Location; import com.google.protobuf.TypeRegistry; import java.io.IOException; import java.util.ArrayList; @@ -90,7 +96,77 @@ public class HttpJsonSessionsStub extends SessionsStub { .build()) .build(); + private static final ApiMethodDescriptor + listLocationsMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("google.cloud.location.Locations/ListLocations") + .setHttpMethod("GET") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v2/{name=projects/*}/locations", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam(fields, "name", request.getName()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + return fields; + }) + .setRequestBodyExtractor(request -> null) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(ListLocationsResponse.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private static final ApiMethodDescriptor + getLocationMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("google.cloud.location.Locations/GetLocation") + .setHttpMethod("GET") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v2/{name=projects/*/locations/*}", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam(fields, "name", request.getName()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + return fields; + }) + .setRequestBodyExtractor(request -> null) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(Location.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + private final UnaryCallable detectIntentCallable; + private final UnaryCallable listLocationsCallable; + private final UnaryCallable + listLocationsPagedCallable; + private final UnaryCallable getLocationCallable; private final BackgroundResource backgroundResources; private final HttpJsonStubCallableFactory callableFactory; @@ -138,10 +214,30 @@ protected HttpJsonSessionsStub( .setMethodDescriptor(detectIntentMethodDescriptor) .setTypeRegistry(typeRegistry) .build(); + HttpJsonCallSettings + listLocationsTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(listLocationsMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings getLocationTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(getLocationMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); this.detectIntentCallable = callableFactory.createUnaryCallable( detectIntentTransportSettings, settings.detectIntentSettings(), clientContext); + this.listLocationsCallable = + callableFactory.createUnaryCallable( + listLocationsTransportSettings, settings.listLocationsSettings(), clientContext); + this.listLocationsPagedCallable = + callableFactory.createPagedCallable( + listLocationsTransportSettings, settings.listLocationsSettings(), clientContext); + this.getLocationCallable = + callableFactory.createUnaryCallable( + getLocationTransportSettings, settings.getLocationSettings(), clientContext); this.backgroundResources = new BackgroundResourceAggregation(clientContext.getBackgroundResources()); @@ -151,6 +247,8 @@ protected HttpJsonSessionsStub( public static List getMethodDescriptors() { List methodDescriptors = new ArrayList<>(); methodDescriptors.add(detectIntentMethodDescriptor); + methodDescriptors.add(listLocationsMethodDescriptor); + methodDescriptors.add(getLocationMethodDescriptor); return methodDescriptors; } @@ -159,6 +257,22 @@ public UnaryCallable detectIntentCall return detectIntentCallable; } + @Override + public UnaryCallable listLocationsCallable() { + return listLocationsCallable; + } + + @Override + public UnaryCallable + listLocationsPagedCallable() { + return listLocationsPagedCallable; + } + + @Override + public UnaryCallable getLocationCallable() { + return getLocationCallable; + } + @Override public final void close() { try { diff --git a/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2/stub/HttpJsonVersionsStub.java b/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2/stub/HttpJsonVersionsStub.java index 0ce073fa1..1e39ecfde 100644 --- a/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2/stub/HttpJsonVersionsStub.java +++ b/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2/stub/HttpJsonVersionsStub.java @@ -16,6 +16,7 @@ package com.google.cloud.dialogflow.v2.stub; +import static com.google.cloud.dialogflow.v2.VersionsClient.ListLocationsPagedResponse; import static com.google.cloud.dialogflow.v2.VersionsClient.ListVersionsPagedResponse; import com.google.api.core.BetaApi; @@ -37,6 +38,10 @@ import com.google.cloud.dialogflow.v2.ListVersionsResponse; import com.google.cloud.dialogflow.v2.UpdateVersionRequest; import com.google.cloud.dialogflow.v2.Version; +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.ListLocationsResponse; +import com.google.cloud.location.Location; import com.google.protobuf.Empty; import com.google.protobuf.TypeRegistry; import java.io.IOException; @@ -236,6 +241,72 @@ public class HttpJsonVersionsStub extends VersionsStub { .build()) .build(); + private static final ApiMethodDescriptor + listLocationsMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("google.cloud.location.Locations/ListLocations") + .setHttpMethod("GET") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v2/{name=projects/*}/locations", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam(fields, "name", request.getName()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + return fields; + }) + .setRequestBodyExtractor(request -> null) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(ListLocationsResponse.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private static final ApiMethodDescriptor + getLocationMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("google.cloud.location.Locations/GetLocation") + .setHttpMethod("GET") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v2/{name=projects/*/locations/*}", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam(fields, "name", request.getName()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + return fields; + }) + .setRequestBodyExtractor(request -> null) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(Location.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + private final UnaryCallable listVersionsCallable; private final UnaryCallable listVersionsPagedCallable; @@ -243,6 +314,10 @@ public class HttpJsonVersionsStub extends VersionsStub { private final UnaryCallable createVersionCallable; private final UnaryCallable updateVersionCallable; private final UnaryCallable deleteVersionCallable; + private final UnaryCallable listLocationsCallable; + private final UnaryCallable + listLocationsPagedCallable; + private final UnaryCallable getLocationCallable; private final BackgroundResource backgroundResources; private final HttpJsonStubCallableFactory callableFactory; @@ -310,6 +385,17 @@ protected HttpJsonVersionsStub( .setMethodDescriptor(deleteVersionMethodDescriptor) .setTypeRegistry(typeRegistry) .build(); + HttpJsonCallSettings + listLocationsTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(listLocationsMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings getLocationTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(getLocationMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); this.listVersionsCallable = callableFactory.createUnaryCallable( @@ -329,6 +415,15 @@ protected HttpJsonVersionsStub( this.deleteVersionCallable = callableFactory.createUnaryCallable( deleteVersionTransportSettings, settings.deleteVersionSettings(), clientContext); + this.listLocationsCallable = + callableFactory.createUnaryCallable( + listLocationsTransportSettings, settings.listLocationsSettings(), clientContext); + this.listLocationsPagedCallable = + callableFactory.createPagedCallable( + listLocationsTransportSettings, settings.listLocationsSettings(), clientContext); + this.getLocationCallable = + callableFactory.createUnaryCallable( + getLocationTransportSettings, settings.getLocationSettings(), clientContext); this.backgroundResources = new BackgroundResourceAggregation(clientContext.getBackgroundResources()); @@ -342,6 +437,8 @@ public static List getMethodDescriptors() { methodDescriptors.add(createVersionMethodDescriptor); methodDescriptors.add(updateVersionMethodDescriptor); methodDescriptors.add(deleteVersionMethodDescriptor); + methodDescriptors.add(listLocationsMethodDescriptor); + methodDescriptors.add(getLocationMethodDescriptor); return methodDescriptors; } @@ -375,6 +472,22 @@ public UnaryCallable deleteVersionCallable() { return deleteVersionCallable; } + @Override + public UnaryCallable listLocationsCallable() { + return listLocationsCallable; + } + + @Override + public UnaryCallable + listLocationsPagedCallable() { + return listLocationsPagedCallable; + } + + @Override + public UnaryCallable getLocationCallable() { + return getLocationCallable; + } + @Override public final void close() { try { diff --git a/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2/stub/IntentsStub.java b/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2/stub/IntentsStub.java index 61447342c..4eb602465 100644 --- a/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2/stub/IntentsStub.java +++ b/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2/stub/IntentsStub.java @@ -17,6 +17,7 @@ package com.google.cloud.dialogflow.v2.stub; import static com.google.cloud.dialogflow.v2.IntentsClient.ListIntentsPagedResponse; +import static com.google.cloud.dialogflow.v2.IntentsClient.ListLocationsPagedResponse; import com.google.api.gax.core.BackgroundResource; import com.google.api.gax.rpc.OperationCallable; @@ -31,6 +32,10 @@ import com.google.cloud.dialogflow.v2.ListIntentsRequest; import com.google.cloud.dialogflow.v2.ListIntentsResponse; import com.google.cloud.dialogflow.v2.UpdateIntentRequest; +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.ListLocationsResponse; +import com.google.cloud.location.Location; import com.google.longrunning.Operation; import com.google.longrunning.stub.OperationsStub; import com.google.protobuf.Empty; @@ -98,6 +103,19 @@ public UnaryCallable batchDeleteIntentsCal throw new UnsupportedOperationException("Not implemented: batchDeleteIntentsCallable()"); } + public UnaryCallable + listLocationsPagedCallable() { + throw new UnsupportedOperationException("Not implemented: listLocationsPagedCallable()"); + } + + public UnaryCallable listLocationsCallable() { + throw new UnsupportedOperationException("Not implemented: listLocationsCallable()"); + } + + public UnaryCallable getLocationCallable() { + throw new UnsupportedOperationException("Not implemented: getLocationCallable()"); + } + @Override public abstract void close(); } diff --git a/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2/stub/IntentsStubSettings.java b/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2/stub/IntentsStubSettings.java index f057441aa..4a2ccc45f 100644 --- a/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2/stub/IntentsStubSettings.java +++ b/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2/stub/IntentsStubSettings.java @@ -17,6 +17,7 @@ package com.google.cloud.dialogflow.v2.stub; import static com.google.cloud.dialogflow.v2.IntentsClient.ListIntentsPagedResponse; +import static com.google.cloud.dialogflow.v2.IntentsClient.ListLocationsPagedResponse; import com.google.api.core.ApiFunction; import com.google.api.core.ApiFuture; @@ -57,6 +58,10 @@ import com.google.cloud.dialogflow.v2.ListIntentsRequest; import com.google.cloud.dialogflow.v2.ListIntentsResponse; import com.google.cloud.dialogflow.v2.UpdateIntentRequest; +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.ListLocationsResponse; +import com.google.cloud.location.Location; import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableMap; import com.google.common.collect.ImmutableSet; @@ -123,6 +128,10 @@ public class IntentsStubSettings extends StubSettings { private final UnaryCallSettings batchDeleteIntentsSettings; private final OperationCallSettings batchDeleteIntentsOperationSettings; + private final PagedCallSettings< + ListLocationsRequest, ListLocationsResponse, ListLocationsPagedResponse> + listLocationsSettings; + private final UnaryCallSettings getLocationSettings; private static final PagedListDescriptor LIST_INTENTS_PAGE_STR_DESC = @@ -160,6 +169,42 @@ public Iterable extractResources(ListIntentsResponse payload) { } }; + private static final PagedListDescriptor + LIST_LOCATIONS_PAGE_STR_DESC = + new PagedListDescriptor() { + @Override + public String emptyToken() { + return ""; + } + + @Override + public ListLocationsRequest injectToken(ListLocationsRequest payload, String token) { + return ListLocationsRequest.newBuilder(payload).setPageToken(token).build(); + } + + @Override + public ListLocationsRequest injectPageSize(ListLocationsRequest payload, int pageSize) { + return ListLocationsRequest.newBuilder(payload).setPageSize(pageSize).build(); + } + + @Override + public Integer extractPageSize(ListLocationsRequest payload) { + return payload.getPageSize(); + } + + @Override + public String extractNextToken(ListLocationsResponse payload) { + return payload.getNextPageToken(); + } + + @Override + public Iterable extractResources(ListLocationsResponse payload) { + return payload.getLocationsList() == null + ? ImmutableList.of() + : payload.getLocationsList(); + } + }; + private static final PagedListResponseFactory< ListIntentsRequest, ListIntentsResponse, ListIntentsPagedResponse> LIST_INTENTS_PAGE_STR_FACT = @@ -177,6 +222,23 @@ public ApiFuture getFuturePagedResponse( } }; + private static final PagedListResponseFactory< + ListLocationsRequest, ListLocationsResponse, ListLocationsPagedResponse> + LIST_LOCATIONS_PAGE_STR_FACT = + new PagedListResponseFactory< + ListLocationsRequest, ListLocationsResponse, ListLocationsPagedResponse>() { + @Override + public ApiFuture getFuturePagedResponse( + UnaryCallable callable, + ListLocationsRequest request, + ApiCallContext context, + ApiFuture futureResponse) { + PageContext pageContext = + PageContext.create(callable, LIST_LOCATIONS_PAGE_STR_DESC, request, context); + return ListLocationsPagedResponse.createAsync(pageContext, futureResponse); + } + }; + /** Returns the object with the settings used for calls to listIntents. */ public PagedCallSettings listIntentsSettings() { @@ -225,6 +287,17 @@ public UnaryCallSettings batchDeleteIntent return batchDeleteIntentsOperationSettings; } + /** Returns the object with the settings used for calls to listLocations. */ + public PagedCallSettings + listLocationsSettings() { + return listLocationsSettings; + } + + /** Returns the object with the settings used for calls to getLocation. */ + public UnaryCallSettings getLocationSettings() { + return getLocationSettings; + } + public IntentsStub createStub() throws IOException { if (getTransportChannelProvider() .getTransportName() @@ -340,6 +413,8 @@ protected IntentsStubSettings(Builder settingsBuilder) throws IOException { batchDeleteIntentsSettings = settingsBuilder.batchDeleteIntentsSettings().build(); batchDeleteIntentsOperationSettings = settingsBuilder.batchDeleteIntentsOperationSettings().build(); + listLocationsSettings = settingsBuilder.listLocationsSettings().build(); + getLocationSettings = settingsBuilder.getLocationSettings().build(); } /** Builder for IntentsStubSettings. */ @@ -361,6 +436,10 @@ public static class Builder extends StubSettings.Builder batchDeleteIntentsOperationSettings; + private final PagedCallSettings.Builder< + ListLocationsRequest, ListLocationsResponse, ListLocationsPagedResponse> + listLocationsSettings; + private final UnaryCallSettings.Builder getLocationSettings; private static final ImmutableMap> RETRYABLE_CODE_DEFINITIONS; @@ -408,6 +487,8 @@ protected Builder(ClientContext clientContext) { batchUpdateIntentsOperationSettings = OperationCallSettings.newBuilder(); batchDeleteIntentsSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); batchDeleteIntentsOperationSettings = OperationCallSettings.newBuilder(); + listLocationsSettings = PagedCallSettings.newBuilder(LIST_LOCATIONS_PAGE_STR_FACT); + getLocationSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); unaryMethodSettingsBuilders = ImmutableList.>of( @@ -417,7 +498,9 @@ protected Builder(ClientContext clientContext) { updateIntentSettings, deleteIntentSettings, batchUpdateIntentsSettings, - batchDeleteIntentsSettings); + batchDeleteIntentsSettings, + listLocationsSettings, + getLocationSettings); initDefaults(this); } @@ -435,6 +518,8 @@ protected Builder(IntentsStubSettings settings) { batchDeleteIntentsSettings = settings.batchDeleteIntentsSettings.toBuilder(); batchDeleteIntentsOperationSettings = settings.batchDeleteIntentsOperationSettings.toBuilder(); + listLocationsSettings = settings.listLocationsSettings.toBuilder(); + getLocationSettings = settings.getLocationSettings.toBuilder(); unaryMethodSettingsBuilders = ImmutableList.>of( @@ -444,7 +529,9 @@ protected Builder(IntentsStubSettings settings) { updateIntentSettings, deleteIntentSettings, batchUpdateIntentsSettings, - batchDeleteIntentsSettings); + batchDeleteIntentsSettings, + listLocationsSettings, + getLocationSettings); } private static Builder createDefault() { @@ -509,6 +596,16 @@ private static Builder initDefaults(Builder builder) { .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes")) .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params")); + builder + .listLocationsSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params")); + + builder + .getLocationSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params")); + builder .batchUpdateIntentsOperationSettings() .setInitialCallSettings( @@ -632,6 +729,18 @@ public UnaryCallSettings.Builder deleteIntentSetting return batchDeleteIntentsOperationSettings; } + /** Returns the builder for the settings used for calls to listLocations. */ + public PagedCallSettings.Builder< + ListLocationsRequest, ListLocationsResponse, ListLocationsPagedResponse> + listLocationsSettings() { + return listLocationsSettings; + } + + /** Returns the builder for the settings used for calls to getLocation. */ + public UnaryCallSettings.Builder getLocationSettings() { + return getLocationSettings; + } + @Override public IntentsStubSettings build() throws IOException { return new IntentsStubSettings(this); diff --git a/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2/stub/KnowledgeBasesStub.java b/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2/stub/KnowledgeBasesStub.java index 88aae97f8..637aaaa22 100644 --- a/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2/stub/KnowledgeBasesStub.java +++ b/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2/stub/KnowledgeBasesStub.java @@ -17,6 +17,7 @@ package com.google.cloud.dialogflow.v2.stub; import static com.google.cloud.dialogflow.v2.KnowledgeBasesClient.ListKnowledgeBasesPagedResponse; +import static com.google.cloud.dialogflow.v2.KnowledgeBasesClient.ListLocationsPagedResponse; import com.google.api.gax.core.BackgroundResource; import com.google.api.gax.rpc.UnaryCallable; @@ -27,6 +28,10 @@ import com.google.cloud.dialogflow.v2.ListKnowledgeBasesRequest; import com.google.cloud.dialogflow.v2.ListKnowledgeBasesResponse; import com.google.cloud.dialogflow.v2.UpdateKnowledgeBaseRequest; +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.ListLocationsResponse; +import com.google.cloud.location.Location; import com.google.protobuf.Empty; import javax.annotation.Generated; @@ -65,6 +70,19 @@ public UnaryCallable updateKnowledgeB throw new UnsupportedOperationException("Not implemented: updateKnowledgeBaseCallable()"); } + public UnaryCallable + listLocationsPagedCallable() { + throw new UnsupportedOperationException("Not implemented: listLocationsPagedCallable()"); + } + + public UnaryCallable listLocationsCallable() { + throw new UnsupportedOperationException("Not implemented: listLocationsCallable()"); + } + + public UnaryCallable getLocationCallable() { + throw new UnsupportedOperationException("Not implemented: getLocationCallable()"); + } + @Override public abstract void close(); } diff --git a/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2/stub/KnowledgeBasesStubSettings.java b/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2/stub/KnowledgeBasesStubSettings.java index 226f07cf3..fb455bebf 100644 --- a/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2/stub/KnowledgeBasesStubSettings.java +++ b/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2/stub/KnowledgeBasesStubSettings.java @@ -17,6 +17,7 @@ package com.google.cloud.dialogflow.v2.stub; import static com.google.cloud.dialogflow.v2.KnowledgeBasesClient.ListKnowledgeBasesPagedResponse; +import static com.google.cloud.dialogflow.v2.KnowledgeBasesClient.ListLocationsPagedResponse; import com.google.api.core.ApiFunction; import com.google.api.core.ApiFuture; @@ -50,6 +51,10 @@ import com.google.cloud.dialogflow.v2.ListKnowledgeBasesRequest; import com.google.cloud.dialogflow.v2.ListKnowledgeBasesResponse; import com.google.cloud.dialogflow.v2.UpdateKnowledgeBaseRequest; +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.ListLocationsResponse; +import com.google.cloud.location.Location; import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableMap; import com.google.common.collect.ImmutableSet; @@ -112,6 +117,10 @@ public class KnowledgeBasesStubSettings extends StubSettings deleteKnowledgeBaseSettings; private final UnaryCallSettings updateKnowledgeBaseSettings; + private final PagedCallSettings< + ListLocationsRequest, ListLocationsResponse, ListLocationsPagedResponse> + listLocationsSettings; + private final UnaryCallSettings getLocationSettings; private static final PagedListDescriptor< ListKnowledgeBasesRequest, ListKnowledgeBasesResponse, KnowledgeBase> @@ -153,6 +162,42 @@ public Iterable extractResources(ListKnowledgeBasesResponse paylo } }; + private static final PagedListDescriptor + LIST_LOCATIONS_PAGE_STR_DESC = + new PagedListDescriptor() { + @Override + public String emptyToken() { + return ""; + } + + @Override + public ListLocationsRequest injectToken(ListLocationsRequest payload, String token) { + return ListLocationsRequest.newBuilder(payload).setPageToken(token).build(); + } + + @Override + public ListLocationsRequest injectPageSize(ListLocationsRequest payload, int pageSize) { + return ListLocationsRequest.newBuilder(payload).setPageSize(pageSize).build(); + } + + @Override + public Integer extractPageSize(ListLocationsRequest payload) { + return payload.getPageSize(); + } + + @Override + public String extractNextToken(ListLocationsResponse payload) { + return payload.getNextPageToken(); + } + + @Override + public Iterable extractResources(ListLocationsResponse payload) { + return payload.getLocationsList() == null + ? ImmutableList.of() + : payload.getLocationsList(); + } + }; + private static final PagedListResponseFactory< ListKnowledgeBasesRequest, ListKnowledgeBasesResponse, ListKnowledgeBasesPagedResponse> LIST_KNOWLEDGE_BASES_PAGE_STR_FACT = @@ -174,6 +219,23 @@ public ApiFuture getFuturePagedResponse( } }; + private static final PagedListResponseFactory< + ListLocationsRequest, ListLocationsResponse, ListLocationsPagedResponse> + LIST_LOCATIONS_PAGE_STR_FACT = + new PagedListResponseFactory< + ListLocationsRequest, ListLocationsResponse, ListLocationsPagedResponse>() { + @Override + public ApiFuture getFuturePagedResponse( + UnaryCallable callable, + ListLocationsRequest request, + ApiCallContext context, + ApiFuture futureResponse) { + PageContext pageContext = + PageContext.create(callable, LIST_LOCATIONS_PAGE_STR_DESC, request, context); + return ListLocationsPagedResponse.createAsync(pageContext, futureResponse); + } + }; + /** Returns the object with the settings used for calls to listKnowledgeBases. */ public PagedCallSettings< ListKnowledgeBasesRequest, ListKnowledgeBasesResponse, ListKnowledgeBasesPagedResponse> @@ -203,6 +265,17 @@ public UnaryCallSettings deleteKnowledgeBaseS return updateKnowledgeBaseSettings; } + /** Returns the object with the settings used for calls to listLocations. */ + public PagedCallSettings + listLocationsSettings() { + return listLocationsSettings; + } + + /** Returns the object with the settings used for calls to getLocation. */ + public UnaryCallSettings getLocationSettings() { + return getLocationSettings; + } + public KnowledgeBasesStub createStub() throws IOException { if (getTransportChannelProvider() .getTransportName() @@ -314,6 +387,8 @@ protected KnowledgeBasesStubSettings(Builder settingsBuilder) throws IOException createKnowledgeBaseSettings = settingsBuilder.createKnowledgeBaseSettings().build(); deleteKnowledgeBaseSettings = settingsBuilder.deleteKnowledgeBaseSettings().build(); updateKnowledgeBaseSettings = settingsBuilder.updateKnowledgeBaseSettings().build(); + listLocationsSettings = settingsBuilder.listLocationsSettings().build(); + getLocationSettings = settingsBuilder.getLocationSettings().build(); } /** Builder for KnowledgeBasesStubSettings. */ @@ -330,6 +405,10 @@ public static class Builder extends StubSettings.Builder updateKnowledgeBaseSettings; + private final PagedCallSettings.Builder< + ListLocationsRequest, ListLocationsResponse, ListLocationsPagedResponse> + listLocationsSettings; + private final UnaryCallSettings.Builder getLocationSettings; private static final ImmutableMap> RETRYABLE_CODE_DEFINITIONS; @@ -373,6 +452,8 @@ protected Builder(ClientContext clientContext) { createKnowledgeBaseSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); deleteKnowledgeBaseSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); updateKnowledgeBaseSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + listLocationsSettings = PagedCallSettings.newBuilder(LIST_LOCATIONS_PAGE_STR_FACT); + getLocationSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); unaryMethodSettingsBuilders = ImmutableList.>of( @@ -380,7 +461,9 @@ protected Builder(ClientContext clientContext) { getKnowledgeBaseSettings, createKnowledgeBaseSettings, deleteKnowledgeBaseSettings, - updateKnowledgeBaseSettings); + updateKnowledgeBaseSettings, + listLocationsSettings, + getLocationSettings); initDefaults(this); } @@ -392,6 +475,8 @@ protected Builder(KnowledgeBasesStubSettings settings) { createKnowledgeBaseSettings = settings.createKnowledgeBaseSettings.toBuilder(); deleteKnowledgeBaseSettings = settings.deleteKnowledgeBaseSettings.toBuilder(); updateKnowledgeBaseSettings = settings.updateKnowledgeBaseSettings.toBuilder(); + listLocationsSettings = settings.listLocationsSettings.toBuilder(); + getLocationSettings = settings.getLocationSettings.toBuilder(); unaryMethodSettingsBuilders = ImmutableList.>of( @@ -399,7 +484,9 @@ protected Builder(KnowledgeBasesStubSettings settings) { getKnowledgeBaseSettings, createKnowledgeBaseSettings, deleteKnowledgeBaseSettings, - updateKnowledgeBaseSettings); + updateKnowledgeBaseSettings, + listLocationsSettings, + getLocationSettings); } private static Builder createDefault() { @@ -454,6 +541,16 @@ private static Builder initDefaults(Builder builder) { .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes")) .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params")); + builder + .listLocationsSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params")); + + builder + .getLocationSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params")); + return builder; } @@ -503,6 +600,18 @@ public Builder applyToAllUnaryMethods( return updateKnowledgeBaseSettings; } + /** Returns the builder for the settings used for calls to listLocations. */ + public PagedCallSettings.Builder< + ListLocationsRequest, ListLocationsResponse, ListLocationsPagedResponse> + listLocationsSettings() { + return listLocationsSettings; + } + + /** Returns the builder for the settings used for calls to getLocation. */ + public UnaryCallSettings.Builder getLocationSettings() { + return getLocationSettings; + } + @Override public KnowledgeBasesStubSettings build() throws IOException { return new KnowledgeBasesStubSettings(this); diff --git a/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2/stub/ParticipantsStub.java b/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2/stub/ParticipantsStub.java index 698d11c6b..757098d1c 100644 --- a/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2/stub/ParticipantsStub.java +++ b/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2/stub/ParticipantsStub.java @@ -16,6 +16,7 @@ package com.google.cloud.dialogflow.v2.stub; +import static com.google.cloud.dialogflow.v2.ParticipantsClient.ListLocationsPagedResponse; import static com.google.cloud.dialogflow.v2.ParticipantsClient.ListParticipantsPagedResponse; import com.google.api.gax.core.BackgroundResource; @@ -34,6 +35,10 @@ import com.google.cloud.dialogflow.v2.SuggestSmartRepliesRequest; import com.google.cloud.dialogflow.v2.SuggestSmartRepliesResponse; import com.google.cloud.dialogflow.v2.UpdateParticipantRequest; +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.ListLocationsResponse; +import com.google.cloud.location.Location; import javax.annotation.Generated; // AUTO-GENERATED DOCUMENTATION AND CLASS. @@ -85,6 +90,19 @@ public UnaryCallable suggestArt throw new UnsupportedOperationException("Not implemented: suggestSmartRepliesCallable()"); } + public UnaryCallable + listLocationsPagedCallable() { + throw new UnsupportedOperationException("Not implemented: listLocationsPagedCallable()"); + } + + public UnaryCallable listLocationsCallable() { + throw new UnsupportedOperationException("Not implemented: listLocationsCallable()"); + } + + public UnaryCallable getLocationCallable() { + throw new UnsupportedOperationException("Not implemented: getLocationCallable()"); + } + @Override public abstract void close(); } diff --git a/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2/stub/ParticipantsStubSettings.java b/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2/stub/ParticipantsStubSettings.java index cf1f79ed5..58a346d83 100644 --- a/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2/stub/ParticipantsStubSettings.java +++ b/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2/stub/ParticipantsStubSettings.java @@ -16,6 +16,7 @@ package com.google.cloud.dialogflow.v2.stub; +import static com.google.cloud.dialogflow.v2.ParticipantsClient.ListLocationsPagedResponse; import static com.google.cloud.dialogflow.v2.ParticipantsClient.ListParticipantsPagedResponse; import com.google.api.core.ApiFunction; @@ -57,6 +58,10 @@ import com.google.cloud.dialogflow.v2.SuggestSmartRepliesRequest; import com.google.cloud.dialogflow.v2.SuggestSmartRepliesResponse; import com.google.cloud.dialogflow.v2.UpdateParticipantRequest; +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.ListLocationsResponse; +import com.google.cloud.location.Location; import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableMap; import com.google.common.collect.ImmutableSet; @@ -123,6 +128,10 @@ public class ParticipantsStubSettings extends StubSettings suggestSmartRepliesSettings; + private final PagedCallSettings< + ListLocationsRequest, ListLocationsResponse, ListLocationsPagedResponse> + listLocationsSettings; + private final UnaryCallSettings getLocationSettings; private static final PagedListDescriptor< ListParticipantsRequest, ListParticipantsResponse, Participant> @@ -164,6 +173,42 @@ public Iterable extractResources(ListParticipantsResponse payload) } }; + private static final PagedListDescriptor + LIST_LOCATIONS_PAGE_STR_DESC = + new PagedListDescriptor() { + @Override + public String emptyToken() { + return ""; + } + + @Override + public ListLocationsRequest injectToken(ListLocationsRequest payload, String token) { + return ListLocationsRequest.newBuilder(payload).setPageToken(token).build(); + } + + @Override + public ListLocationsRequest injectPageSize(ListLocationsRequest payload, int pageSize) { + return ListLocationsRequest.newBuilder(payload).setPageSize(pageSize).build(); + } + + @Override + public Integer extractPageSize(ListLocationsRequest payload) { + return payload.getPageSize(); + } + + @Override + public String extractNextToken(ListLocationsResponse payload) { + return payload.getNextPageToken(); + } + + @Override + public Iterable extractResources(ListLocationsResponse payload) { + return payload.getLocationsList() == null + ? ImmutableList.of() + : payload.getLocationsList(); + } + }; + private static final PagedListResponseFactory< ListParticipantsRequest, ListParticipantsResponse, ListParticipantsPagedResponse> LIST_PARTICIPANTS_PAGE_STR_FACT = @@ -183,6 +228,23 @@ public ApiFuture getFuturePagedResponse( } }; + private static final PagedListResponseFactory< + ListLocationsRequest, ListLocationsResponse, ListLocationsPagedResponse> + LIST_LOCATIONS_PAGE_STR_FACT = + new PagedListResponseFactory< + ListLocationsRequest, ListLocationsResponse, ListLocationsPagedResponse>() { + @Override + public ApiFuture getFuturePagedResponse( + UnaryCallable callable, + ListLocationsRequest request, + ApiCallContext context, + ApiFuture futureResponse) { + PageContext pageContext = + PageContext.create(callable, LIST_LOCATIONS_PAGE_STR_DESC, request, context); + return ListLocationsPagedResponse.createAsync(pageContext, futureResponse); + } + }; + /** Returns the object with the settings used for calls to createParticipant. */ public UnaryCallSettings createParticipantSettings() { return createParticipantSettings; @@ -228,6 +290,17 @@ public UnaryCallSettings analyzeC return suggestSmartRepliesSettings; } + /** Returns the object with the settings used for calls to listLocations. */ + public PagedCallSettings + listLocationsSettings() { + return listLocationsSettings; + } + + /** Returns the object with the settings used for calls to getLocation. */ + public UnaryCallSettings getLocationSettings() { + return getLocationSettings; + } + public ParticipantsStub createStub() throws IOException { if (getTransportChannelProvider() .getTransportName() @@ -342,6 +415,8 @@ protected ParticipantsStubSettings(Builder settingsBuilder) throws IOException { suggestArticlesSettings = settingsBuilder.suggestArticlesSettings().build(); suggestFaqAnswersSettings = settingsBuilder.suggestFaqAnswersSettings().build(); suggestSmartRepliesSettings = settingsBuilder.suggestSmartRepliesSettings().build(); + listLocationsSettings = settingsBuilder.listLocationsSettings().build(); + getLocationSettings = settingsBuilder.getLocationSettings().build(); } /** Builder for ParticipantsStubSettings. */ @@ -364,6 +439,10 @@ public static class Builder extends StubSettings.Builder suggestSmartRepliesSettings; + private final PagedCallSettings.Builder< + ListLocationsRequest, ListLocationsResponse, ListLocationsPagedResponse> + listLocationsSettings; + private final UnaryCallSettings.Builder getLocationSettings; private static final ImmutableMap> RETRYABLE_CODE_DEFINITIONS; @@ -424,6 +503,8 @@ protected Builder(ClientContext clientContext) { suggestArticlesSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); suggestFaqAnswersSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); suggestSmartRepliesSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + listLocationsSettings = PagedCallSettings.newBuilder(LIST_LOCATIONS_PAGE_STR_FACT); + getLocationSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); unaryMethodSettingsBuilders = ImmutableList.>of( @@ -434,7 +515,9 @@ protected Builder(ClientContext clientContext) { analyzeContentSettings, suggestArticlesSettings, suggestFaqAnswersSettings, - suggestSmartRepliesSettings); + suggestSmartRepliesSettings, + listLocationsSettings, + getLocationSettings); initDefaults(this); } @@ -449,6 +532,8 @@ protected Builder(ParticipantsStubSettings settings) { suggestArticlesSettings = settings.suggestArticlesSettings.toBuilder(); suggestFaqAnswersSettings = settings.suggestFaqAnswersSettings.toBuilder(); suggestSmartRepliesSettings = settings.suggestSmartRepliesSettings.toBuilder(); + listLocationsSettings = settings.listLocationsSettings.toBuilder(); + getLocationSettings = settings.getLocationSettings.toBuilder(); unaryMethodSettingsBuilders = ImmutableList.>of( @@ -459,7 +544,9 @@ protected Builder(ParticipantsStubSettings settings) { analyzeContentSettings, suggestArticlesSettings, suggestFaqAnswersSettings, - suggestSmartRepliesSettings); + suggestSmartRepliesSettings, + listLocationsSettings, + getLocationSettings); } private static Builder createDefault() { @@ -529,6 +616,16 @@ private static Builder initDefaults(Builder builder) { .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes")) .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params")); + builder + .listLocationsSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params")); + + builder + .getLocationSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params")); + return builder; } @@ -595,6 +692,18 @@ public UnaryCallSettings.Builder getParticip return suggestSmartRepliesSettings; } + /** Returns the builder for the settings used for calls to listLocations. */ + public PagedCallSettings.Builder< + ListLocationsRequest, ListLocationsResponse, ListLocationsPagedResponse> + listLocationsSettings() { + return listLocationsSettings; + } + + /** Returns the builder for the settings used for calls to getLocation. */ + public UnaryCallSettings.Builder getLocationSettings() { + return getLocationSettings; + } + @Override public ParticipantsStubSettings build() throws IOException { return new ParticipantsStubSettings(this); diff --git a/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2/stub/SessionEntityTypesStub.java b/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2/stub/SessionEntityTypesStub.java index 663c69687..93a86ed4a 100644 --- a/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2/stub/SessionEntityTypesStub.java +++ b/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2/stub/SessionEntityTypesStub.java @@ -16,6 +16,7 @@ package com.google.cloud.dialogflow.v2.stub; +import static com.google.cloud.dialogflow.v2.SessionEntityTypesClient.ListLocationsPagedResponse; import static com.google.cloud.dialogflow.v2.SessionEntityTypesClient.ListSessionEntityTypesPagedResponse; import com.google.api.gax.core.BackgroundResource; @@ -27,6 +28,10 @@ import com.google.cloud.dialogflow.v2.ListSessionEntityTypesResponse; import com.google.cloud.dialogflow.v2.SessionEntityType; import com.google.cloud.dialogflow.v2.UpdateSessionEntityTypeRequest; +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.ListLocationsResponse; +import com.google.cloud.location.Location; import com.google.protobuf.Empty; import javax.annotation.Generated; @@ -69,6 +74,19 @@ public UnaryCallable deleteSessionEntityT throw new UnsupportedOperationException("Not implemented: deleteSessionEntityTypeCallable()"); } + public UnaryCallable + listLocationsPagedCallable() { + throw new UnsupportedOperationException("Not implemented: listLocationsPagedCallable()"); + } + + public UnaryCallable listLocationsCallable() { + throw new UnsupportedOperationException("Not implemented: listLocationsCallable()"); + } + + public UnaryCallable getLocationCallable() { + throw new UnsupportedOperationException("Not implemented: getLocationCallable()"); + } + @Override public abstract void close(); } diff --git a/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2/stub/SessionEntityTypesStubSettings.java b/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2/stub/SessionEntityTypesStubSettings.java index 4cd8600fc..a29fb25b8 100644 --- a/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2/stub/SessionEntityTypesStubSettings.java +++ b/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2/stub/SessionEntityTypesStubSettings.java @@ -16,6 +16,7 @@ package com.google.cloud.dialogflow.v2.stub; +import static com.google.cloud.dialogflow.v2.SessionEntityTypesClient.ListLocationsPagedResponse; import static com.google.cloud.dialogflow.v2.SessionEntityTypesClient.ListSessionEntityTypesPagedResponse; import com.google.api.core.ApiFunction; @@ -50,6 +51,10 @@ import com.google.cloud.dialogflow.v2.ListSessionEntityTypesResponse; import com.google.cloud.dialogflow.v2.SessionEntityType; import com.google.cloud.dialogflow.v2.UpdateSessionEntityTypeRequest; +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.ListLocationsResponse; +import com.google.cloud.location.Location; import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableMap; import com.google.common.collect.ImmutableSet; @@ -117,6 +122,10 @@ public class SessionEntityTypesStubSettings extends StubSettings deleteSessionEntityTypeSettings; + private final PagedCallSettings< + ListLocationsRequest, ListLocationsResponse, ListLocationsPagedResponse> + listLocationsSettings; + private final UnaryCallSettings getLocationSettings; private static final PagedListDescriptor< ListSessionEntityTypesRequest, ListSessionEntityTypesResponse, SessionEntityType> @@ -161,6 +170,42 @@ public Iterable extractResources( } }; + private static final PagedListDescriptor + LIST_LOCATIONS_PAGE_STR_DESC = + new PagedListDescriptor() { + @Override + public String emptyToken() { + return ""; + } + + @Override + public ListLocationsRequest injectToken(ListLocationsRequest payload, String token) { + return ListLocationsRequest.newBuilder(payload).setPageToken(token).build(); + } + + @Override + public ListLocationsRequest injectPageSize(ListLocationsRequest payload, int pageSize) { + return ListLocationsRequest.newBuilder(payload).setPageSize(pageSize).build(); + } + + @Override + public Integer extractPageSize(ListLocationsRequest payload) { + return payload.getPageSize(); + } + + @Override + public String extractNextToken(ListLocationsResponse payload) { + return payload.getNextPageToken(); + } + + @Override + public Iterable extractResources(ListLocationsResponse payload) { + return payload.getLocationsList() == null + ? ImmutableList.of() + : payload.getLocationsList(); + } + }; + private static final PagedListResponseFactory< ListSessionEntityTypesRequest, ListSessionEntityTypesResponse, @@ -188,6 +233,23 @@ public ApiFuture getFuturePagedResponse( } }; + private static final PagedListResponseFactory< + ListLocationsRequest, ListLocationsResponse, ListLocationsPagedResponse> + LIST_LOCATIONS_PAGE_STR_FACT = + new PagedListResponseFactory< + ListLocationsRequest, ListLocationsResponse, ListLocationsPagedResponse>() { + @Override + public ApiFuture getFuturePagedResponse( + UnaryCallable callable, + ListLocationsRequest request, + ApiCallContext context, + ApiFuture futureResponse) { + PageContext pageContext = + PageContext.create(callable, LIST_LOCATIONS_PAGE_STR_DESC, request, context); + return ListLocationsPagedResponse.createAsync(pageContext, futureResponse); + } + }; + /** Returns the object with the settings used for calls to listSessionEntityTypes. */ public PagedCallSettings< ListSessionEntityTypesRequest, @@ -221,6 +283,17 @@ public ApiFuture getFuturePagedResponse( return deleteSessionEntityTypeSettings; } + /** Returns the object with the settings used for calls to listLocations. */ + public PagedCallSettings + listLocationsSettings() { + return listLocationsSettings; + } + + /** Returns the object with the settings used for calls to getLocation. */ + public UnaryCallSettings getLocationSettings() { + return getLocationSettings; + } + public SessionEntityTypesStub createStub() throws IOException { if (getTransportChannelProvider() .getTransportName() @@ -332,6 +405,8 @@ protected SessionEntityTypesStubSettings(Builder settingsBuilder) throws IOExcep createSessionEntityTypeSettings = settingsBuilder.createSessionEntityTypeSettings().build(); updateSessionEntityTypeSettings = settingsBuilder.updateSessionEntityTypeSettings().build(); deleteSessionEntityTypeSettings = settingsBuilder.deleteSessionEntityTypeSettings().build(); + listLocationsSettings = settingsBuilder.listLocationsSettings().build(); + getLocationSettings = settingsBuilder.getLocationSettings().build(); } /** Builder for SessionEntityTypesStubSettings. */ @@ -351,6 +426,10 @@ public static class Builder updateSessionEntityTypeSettings; private final UnaryCallSettings.Builder deleteSessionEntityTypeSettings; + private final PagedCallSettings.Builder< + ListLocationsRequest, ListLocationsResponse, ListLocationsPagedResponse> + listLocationsSettings; + private final UnaryCallSettings.Builder getLocationSettings; private static final ImmutableMap> RETRYABLE_CODE_DEFINITIONS; @@ -395,6 +474,8 @@ protected Builder(ClientContext clientContext) { createSessionEntityTypeSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); updateSessionEntityTypeSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); deleteSessionEntityTypeSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + listLocationsSettings = PagedCallSettings.newBuilder(LIST_LOCATIONS_PAGE_STR_FACT); + getLocationSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); unaryMethodSettingsBuilders = ImmutableList.>of( @@ -402,7 +483,9 @@ protected Builder(ClientContext clientContext) { getSessionEntityTypeSettings, createSessionEntityTypeSettings, updateSessionEntityTypeSettings, - deleteSessionEntityTypeSettings); + deleteSessionEntityTypeSettings, + listLocationsSettings, + getLocationSettings); initDefaults(this); } @@ -414,6 +497,8 @@ protected Builder(SessionEntityTypesStubSettings settings) { createSessionEntityTypeSettings = settings.createSessionEntityTypeSettings.toBuilder(); updateSessionEntityTypeSettings = settings.updateSessionEntityTypeSettings.toBuilder(); deleteSessionEntityTypeSettings = settings.deleteSessionEntityTypeSettings.toBuilder(); + listLocationsSettings = settings.listLocationsSettings.toBuilder(); + getLocationSettings = settings.getLocationSettings.toBuilder(); unaryMethodSettingsBuilders = ImmutableList.>of( @@ -421,7 +506,9 @@ protected Builder(SessionEntityTypesStubSettings settings) { getSessionEntityTypeSettings, createSessionEntityTypeSettings, updateSessionEntityTypeSettings, - deleteSessionEntityTypeSettings); + deleteSessionEntityTypeSettings, + listLocationsSettings, + getLocationSettings); } private static Builder createDefault() { @@ -476,6 +563,16 @@ private static Builder initDefaults(Builder builder) { .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes")) .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params")); + builder + .listLocationsSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params")); + + builder + .getLocationSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params")); + return builder; } @@ -527,6 +624,18 @@ public Builder applyToAllUnaryMethods( return deleteSessionEntityTypeSettings; } + /** Returns the builder for the settings used for calls to listLocations. */ + public PagedCallSettings.Builder< + ListLocationsRequest, ListLocationsResponse, ListLocationsPagedResponse> + listLocationsSettings() { + return listLocationsSettings; + } + + /** Returns the builder for the settings used for calls to getLocation. */ + public UnaryCallSettings.Builder getLocationSettings() { + return getLocationSettings; + } + @Override public SessionEntityTypesStubSettings build() throws IOException { return new SessionEntityTypesStubSettings(this); diff --git a/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2/stub/SessionsStub.java b/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2/stub/SessionsStub.java index eb6ecc49b..bfb6813e6 100644 --- a/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2/stub/SessionsStub.java +++ b/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2/stub/SessionsStub.java @@ -16,6 +16,8 @@ package com.google.cloud.dialogflow.v2.stub; +import static com.google.cloud.dialogflow.v2.SessionsClient.ListLocationsPagedResponse; + import com.google.api.gax.core.BackgroundResource; import com.google.api.gax.rpc.BidiStreamingCallable; import com.google.api.gax.rpc.UnaryCallable; @@ -23,6 +25,10 @@ import com.google.cloud.dialogflow.v2.DetectIntentResponse; import com.google.cloud.dialogflow.v2.StreamingDetectIntentRequest; import com.google.cloud.dialogflow.v2.StreamingDetectIntentResponse; +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.ListLocationsResponse; +import com.google.cloud.location.Location; import javax.annotation.Generated; // AUTO-GENERATED DOCUMENTATION AND CLASS. @@ -43,6 +49,19 @@ public UnaryCallable detectIntentCall throw new UnsupportedOperationException("Not implemented: streamingDetectIntentCallable()"); } + public UnaryCallable + listLocationsPagedCallable() { + throw new UnsupportedOperationException("Not implemented: listLocationsPagedCallable()"); + } + + public UnaryCallable listLocationsCallable() { + throw new UnsupportedOperationException("Not implemented: listLocationsCallable()"); + } + + public UnaryCallable getLocationCallable() { + throw new UnsupportedOperationException("Not implemented: getLocationCallable()"); + } + @Override public abstract void close(); } diff --git a/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2/stub/SessionsStubSettings.java b/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2/stub/SessionsStubSettings.java index d343f80c4..a236bac2a 100644 --- a/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2/stub/SessionsStubSettings.java +++ b/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2/stub/SessionsStubSettings.java @@ -16,7 +16,10 @@ package com.google.cloud.dialogflow.v2.stub; +import static com.google.cloud.dialogflow.v2.SessionsClient.ListLocationsPagedResponse; + import com.google.api.core.ApiFunction; +import com.google.api.core.ApiFuture; import com.google.api.core.BetaApi; import com.google.api.gax.core.GaxProperties; import com.google.api.gax.core.GoogleCredentialsProvider; @@ -28,17 +31,27 @@ import com.google.api.gax.httpjson.HttpJsonTransportChannel; import com.google.api.gax.httpjson.InstantiatingHttpJsonChannelProvider; import com.google.api.gax.retrying.RetrySettings; +import com.google.api.gax.rpc.ApiCallContext; import com.google.api.gax.rpc.ApiClientHeaderProvider; import com.google.api.gax.rpc.ClientContext; +import com.google.api.gax.rpc.PageContext; +import com.google.api.gax.rpc.PagedCallSettings; +import com.google.api.gax.rpc.PagedListDescriptor; +import com.google.api.gax.rpc.PagedListResponseFactory; import com.google.api.gax.rpc.StatusCode; import com.google.api.gax.rpc.StreamingCallSettings; import com.google.api.gax.rpc.StubSettings; import com.google.api.gax.rpc.TransportChannelProvider; import com.google.api.gax.rpc.UnaryCallSettings; +import com.google.api.gax.rpc.UnaryCallable; import com.google.cloud.dialogflow.v2.DetectIntentRequest; import com.google.cloud.dialogflow.v2.DetectIntentResponse; import com.google.cloud.dialogflow.v2.StreamingDetectIntentRequest; import com.google.cloud.dialogflow.v2.StreamingDetectIntentResponse; +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.ListLocationsResponse; +import com.google.cloud.location.Location; import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableMap; import com.google.common.collect.ImmutableSet; @@ -93,6 +106,63 @@ public class SessionsStubSettings extends StubSettings { private final UnaryCallSettings detectIntentSettings; private final StreamingCallSettings streamingDetectIntentSettings; + private final PagedCallSettings< + ListLocationsRequest, ListLocationsResponse, ListLocationsPagedResponse> + listLocationsSettings; + private final UnaryCallSettings getLocationSettings; + + private static final PagedListDescriptor + LIST_LOCATIONS_PAGE_STR_DESC = + new PagedListDescriptor() { + @Override + public String emptyToken() { + return ""; + } + + @Override + public ListLocationsRequest injectToken(ListLocationsRequest payload, String token) { + return ListLocationsRequest.newBuilder(payload).setPageToken(token).build(); + } + + @Override + public ListLocationsRequest injectPageSize(ListLocationsRequest payload, int pageSize) { + return ListLocationsRequest.newBuilder(payload).setPageSize(pageSize).build(); + } + + @Override + public Integer extractPageSize(ListLocationsRequest payload) { + return payload.getPageSize(); + } + + @Override + public String extractNextToken(ListLocationsResponse payload) { + return payload.getNextPageToken(); + } + + @Override + public Iterable extractResources(ListLocationsResponse payload) { + return payload.getLocationsList() == null + ? ImmutableList.of() + : payload.getLocationsList(); + } + }; + + private static final PagedListResponseFactory< + ListLocationsRequest, ListLocationsResponse, ListLocationsPagedResponse> + LIST_LOCATIONS_PAGE_STR_FACT = + new PagedListResponseFactory< + ListLocationsRequest, ListLocationsResponse, ListLocationsPagedResponse>() { + @Override + public ApiFuture getFuturePagedResponse( + UnaryCallable callable, + ListLocationsRequest request, + ApiCallContext context, + ApiFuture futureResponse) { + PageContext pageContext = + PageContext.create(callable, LIST_LOCATIONS_PAGE_STR_DESC, request, context); + return ListLocationsPagedResponse.createAsync(pageContext, futureResponse); + } + }; /** Returns the object with the settings used for calls to detectIntent. */ public UnaryCallSettings detectIntentSettings() { @@ -105,6 +175,17 @@ public UnaryCallSettings detectIntent return streamingDetectIntentSettings; } + /** Returns the object with the settings used for calls to listLocations. */ + public PagedCallSettings + listLocationsSettings() { + return listLocationsSettings; + } + + /** Returns the object with the settings used for calls to getLocation. */ + public UnaryCallSettings getLocationSettings() { + return getLocationSettings; + } + public SessionsStub createStub() throws IOException { if (getTransportChannelProvider() .getTransportName() @@ -211,6 +292,8 @@ protected SessionsStubSettings(Builder settingsBuilder) throws IOException { detectIntentSettings = settingsBuilder.detectIntentSettings().build(); streamingDetectIntentSettings = settingsBuilder.streamingDetectIntentSettings().build(); + listLocationsSettings = settingsBuilder.listLocationsSettings().build(); + getLocationSettings = settingsBuilder.getLocationSettings().build(); } /** Builder for SessionsStubSettings. */ @@ -221,6 +304,10 @@ public static class Builder extends StubSettings.Builder streamingDetectIntentSettings; + private final PagedCallSettings.Builder< + ListLocationsRequest, ListLocationsResponse, ListLocationsPagedResponse> + listLocationsSettings; + private final UnaryCallSettings.Builder getLocationSettings; private static final ImmutableMap> RETRYABLE_CODE_DEFINITIONS; @@ -232,6 +319,9 @@ public static class Builder extends StubSettings.BuildernewArrayList(StatusCode.Code.UNAVAILABLE))); definitions.put( "no_retry_2_codes", ImmutableSet.copyOf(Lists.newArrayList())); + definitions.put( + "retry_policy_0_codes", + ImmutableSet.copyOf(Lists.newArrayList(StatusCode.Code.UNAVAILABLE))); RETRYABLE_CODE_DEFINITIONS = definitions.build(); } @@ -259,6 +349,17 @@ public static class Builder extends StubSettings.Builder>of(detectIntentSettings); + ImmutableList.>of( + detectIntentSettings, listLocationsSettings, getLocationSettings); initDefaults(this); } @@ -282,9 +386,12 @@ protected Builder(SessionsStubSettings settings) { detectIntentSettings = settings.detectIntentSettings.toBuilder(); streamingDetectIntentSettings = settings.streamingDetectIntentSettings.toBuilder(); + listLocationsSettings = settings.listLocationsSettings.toBuilder(); + getLocationSettings = settings.getLocationSettings.toBuilder(); unaryMethodSettingsBuilders = - ImmutableList.>of(detectIntentSettings); + ImmutableList.>of( + detectIntentSettings, listLocationsSettings, getLocationSettings); } private static Builder createDefault() { @@ -319,6 +426,16 @@ private static Builder initDefaults(Builder builder) { .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_1_codes")) .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_1_params")); + builder + .listLocationsSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params")); + + builder + .getLocationSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params")); + return builder; } @@ -350,6 +467,18 @@ public Builder applyToAllUnaryMethods( return streamingDetectIntentSettings; } + /** Returns the builder for the settings used for calls to listLocations. */ + public PagedCallSettings.Builder< + ListLocationsRequest, ListLocationsResponse, ListLocationsPagedResponse> + listLocationsSettings() { + return listLocationsSettings; + } + + /** Returns the builder for the settings used for calls to getLocation. */ + public UnaryCallSettings.Builder getLocationSettings() { + return getLocationSettings; + } + @Override public SessionsStubSettings build() throws IOException { return new SessionsStubSettings(this); diff --git a/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2/stub/VersionsStub.java b/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2/stub/VersionsStub.java index 47b39b808..7f6d3f505 100644 --- a/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2/stub/VersionsStub.java +++ b/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2/stub/VersionsStub.java @@ -16,6 +16,7 @@ package com.google.cloud.dialogflow.v2.stub; +import static com.google.cloud.dialogflow.v2.VersionsClient.ListLocationsPagedResponse; import static com.google.cloud.dialogflow.v2.VersionsClient.ListVersionsPagedResponse; import com.google.api.gax.core.BackgroundResource; @@ -27,6 +28,10 @@ import com.google.cloud.dialogflow.v2.ListVersionsResponse; import com.google.cloud.dialogflow.v2.UpdateVersionRequest; import com.google.cloud.dialogflow.v2.Version; +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.ListLocationsResponse; +import com.google.cloud.location.Location; import com.google.protobuf.Empty; import javax.annotation.Generated; @@ -63,6 +68,19 @@ public UnaryCallable deleteVersionCallable() { throw new UnsupportedOperationException("Not implemented: deleteVersionCallable()"); } + public UnaryCallable + listLocationsPagedCallable() { + throw new UnsupportedOperationException("Not implemented: listLocationsPagedCallable()"); + } + + public UnaryCallable listLocationsCallable() { + throw new UnsupportedOperationException("Not implemented: listLocationsCallable()"); + } + + public UnaryCallable getLocationCallable() { + throw new UnsupportedOperationException("Not implemented: getLocationCallable()"); + } + @Override public abstract void close(); } diff --git a/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2/stub/VersionsStubSettings.java b/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2/stub/VersionsStubSettings.java index e5bbb7cfd..e10d92d7b 100644 --- a/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2/stub/VersionsStubSettings.java +++ b/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2/stub/VersionsStubSettings.java @@ -16,6 +16,7 @@ package com.google.cloud.dialogflow.v2.stub; +import static com.google.cloud.dialogflow.v2.VersionsClient.ListLocationsPagedResponse; import static com.google.cloud.dialogflow.v2.VersionsClient.ListVersionsPagedResponse; import com.google.api.core.ApiFunction; @@ -50,6 +51,10 @@ import com.google.cloud.dialogflow.v2.ListVersionsResponse; import com.google.cloud.dialogflow.v2.UpdateVersionRequest; import com.google.cloud.dialogflow.v2.Version; +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.ListLocationsResponse; +import com.google.cloud.location.Location; import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableMap; import com.google.common.collect.ImmutableSet; @@ -109,6 +114,10 @@ public class VersionsStubSettings extends StubSettings { private final UnaryCallSettings createVersionSettings; private final UnaryCallSettings updateVersionSettings; private final UnaryCallSettings deleteVersionSettings; + private final PagedCallSettings< + ListLocationsRequest, ListLocationsResponse, ListLocationsPagedResponse> + listLocationsSettings; + private final UnaryCallSettings getLocationSettings; private static final PagedListDescriptor LIST_VERSIONS_PAGE_STR_DESC = @@ -146,6 +155,42 @@ public Iterable extractResources(ListVersionsResponse payload) { } }; + private static final PagedListDescriptor + LIST_LOCATIONS_PAGE_STR_DESC = + new PagedListDescriptor() { + @Override + public String emptyToken() { + return ""; + } + + @Override + public ListLocationsRequest injectToken(ListLocationsRequest payload, String token) { + return ListLocationsRequest.newBuilder(payload).setPageToken(token).build(); + } + + @Override + public ListLocationsRequest injectPageSize(ListLocationsRequest payload, int pageSize) { + return ListLocationsRequest.newBuilder(payload).setPageSize(pageSize).build(); + } + + @Override + public Integer extractPageSize(ListLocationsRequest payload) { + return payload.getPageSize(); + } + + @Override + public String extractNextToken(ListLocationsResponse payload) { + return payload.getNextPageToken(); + } + + @Override + public Iterable extractResources(ListLocationsResponse payload) { + return payload.getLocationsList() == null + ? ImmutableList.of() + : payload.getLocationsList(); + } + }; + private static final PagedListResponseFactory< ListVersionsRequest, ListVersionsResponse, ListVersionsPagedResponse> LIST_VERSIONS_PAGE_STR_FACT = @@ -163,6 +208,23 @@ public ApiFuture getFuturePagedResponse( } }; + private static final PagedListResponseFactory< + ListLocationsRequest, ListLocationsResponse, ListLocationsPagedResponse> + LIST_LOCATIONS_PAGE_STR_FACT = + new PagedListResponseFactory< + ListLocationsRequest, ListLocationsResponse, ListLocationsPagedResponse>() { + @Override + public ApiFuture getFuturePagedResponse( + UnaryCallable callable, + ListLocationsRequest request, + ApiCallContext context, + ApiFuture futureResponse) { + PageContext pageContext = + PageContext.create(callable, LIST_LOCATIONS_PAGE_STR_DESC, request, context); + return ListLocationsPagedResponse.createAsync(pageContext, futureResponse); + } + }; + /** Returns the object with the settings used for calls to listVersions. */ public PagedCallSettings listVersionsSettings() { @@ -189,6 +251,17 @@ public UnaryCallSettings deleteVersionSettings() { return deleteVersionSettings; } + /** Returns the object with the settings used for calls to listLocations. */ + public PagedCallSettings + listLocationsSettings() { + return listLocationsSettings; + } + + /** Returns the object with the settings used for calls to getLocation. */ + public UnaryCallSettings getLocationSettings() { + return getLocationSettings; + } + public VersionsStub createStub() throws IOException { if (getTransportChannelProvider() .getTransportName() @@ -298,6 +371,8 @@ protected VersionsStubSettings(Builder settingsBuilder) throws IOException { createVersionSettings = settingsBuilder.createVersionSettings().build(); updateVersionSettings = settingsBuilder.updateVersionSettings().build(); deleteVersionSettings = settingsBuilder.deleteVersionSettings().build(); + listLocationsSettings = settingsBuilder.listLocationsSettings().build(); + getLocationSettings = settingsBuilder.getLocationSettings().build(); } /** Builder for VersionsStubSettings. */ @@ -310,6 +385,10 @@ public static class Builder extends StubSettings.Builder createVersionSettings; private final UnaryCallSettings.Builder updateVersionSettings; private final UnaryCallSettings.Builder deleteVersionSettings; + private final PagedCallSettings.Builder< + ListLocationsRequest, ListLocationsResponse, ListLocationsPagedResponse> + listLocationsSettings; + private final UnaryCallSettings.Builder getLocationSettings; private static final ImmutableMap> RETRYABLE_CODE_DEFINITIONS; @@ -353,6 +432,8 @@ protected Builder(ClientContext clientContext) { createVersionSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); updateVersionSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); deleteVersionSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + listLocationsSettings = PagedCallSettings.newBuilder(LIST_LOCATIONS_PAGE_STR_FACT); + getLocationSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); unaryMethodSettingsBuilders = ImmutableList.>of( @@ -360,7 +441,9 @@ protected Builder(ClientContext clientContext) { getVersionSettings, createVersionSettings, updateVersionSettings, - deleteVersionSettings); + deleteVersionSettings, + listLocationsSettings, + getLocationSettings); initDefaults(this); } @@ -372,6 +455,8 @@ protected Builder(VersionsStubSettings settings) { createVersionSettings = settings.createVersionSettings.toBuilder(); updateVersionSettings = settings.updateVersionSettings.toBuilder(); deleteVersionSettings = settings.deleteVersionSettings.toBuilder(); + listLocationsSettings = settings.listLocationsSettings.toBuilder(); + getLocationSettings = settings.getLocationSettings.toBuilder(); unaryMethodSettingsBuilders = ImmutableList.>of( @@ -379,7 +464,9 @@ protected Builder(VersionsStubSettings settings) { getVersionSettings, createVersionSettings, updateVersionSettings, - deleteVersionSettings); + deleteVersionSettings, + listLocationsSettings, + getLocationSettings); } private static Builder createDefault() { @@ -434,6 +521,16 @@ private static Builder initDefaults(Builder builder) { .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes")) .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params")); + builder + .listLocationsSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params")); + + builder + .getLocationSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params")); + return builder; } @@ -479,6 +576,18 @@ public UnaryCallSettings.Builder deleteVersionSetti return deleteVersionSettings; } + /** Returns the builder for the settings used for calls to listLocations. */ + public PagedCallSettings.Builder< + ListLocationsRequest, ListLocationsResponse, ListLocationsPagedResponse> + listLocationsSettings() { + return listLocationsSettings; + } + + /** Returns the builder for the settings used for calls to getLocation. */ + public UnaryCallSettings.Builder getLocationSettings() { + return getLocationSettings; + } + @Override public VersionsStubSettings build() throws IOException { return new VersionsStubSettings(this); diff --git a/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2beta1/AgentsClient.java b/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2beta1/AgentsClient.java index 1661ad76f..b7e775290 100644 --- a/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2beta1/AgentsClient.java +++ b/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2beta1/AgentsClient.java @@ -30,6 +30,10 @@ import com.google.api.gax.rpc.UnaryCallable; import com.google.cloud.dialogflow.v2beta1.stub.AgentsStub; import com.google.cloud.dialogflow.v2beta1.stub.AgentsStubSettings; +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.ListLocationsResponse; +import com.google.cloud.location.Location; import com.google.common.util.concurrent.MoreExecutors; import com.google.longrunning.Operation; import com.google.protobuf.Empty; @@ -1470,6 +1474,145 @@ public final ValidationResult getValidationResult(GetValidationResultRequest req return stub.getValidationResultCallable(); } + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Lists information about the supported locations for this service. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
+   * try (AgentsClient agentsClient = AgentsClient.create()) {
+   *   ListLocationsRequest request =
+   *       ListLocationsRequest.newBuilder()
+   *           .setName("name3373707")
+   *           .setFilter("filter-1274492040")
+   *           .setPageSize(883849137)
+   *           .setPageToken("pageToken873572522")
+   *           .build();
+   *   for (Location element : agentsClient.listLocations(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 + */ + public final ListLocationsPagedResponse listLocations(ListLocationsRequest request) { + return listLocationsPagedCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Lists information about the supported locations for this service. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
+   * try (AgentsClient agentsClient = AgentsClient.create()) {
+   *   ListLocationsRequest request =
+   *       ListLocationsRequest.newBuilder()
+   *           .setName("name3373707")
+   *           .setFilter("filter-1274492040")
+   *           .setPageSize(883849137)
+   *           .setPageToken("pageToken873572522")
+   *           .build();
+   *   ApiFuture future = agentsClient.listLocationsPagedCallable().futureCall(request);
+   *   // Do something.
+   *   for (Location element : future.get().iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * }
+ */ + public final UnaryCallable + listLocationsPagedCallable() { + return stub.listLocationsPagedCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Lists information about the supported locations for this service. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
+   * try (AgentsClient agentsClient = AgentsClient.create()) {
+   *   ListLocationsRequest request =
+   *       ListLocationsRequest.newBuilder()
+   *           .setName("name3373707")
+   *           .setFilter("filter-1274492040")
+   *           .setPageSize(883849137)
+   *           .setPageToken("pageToken873572522")
+   *           .build();
+   *   while (true) {
+   *     ListLocationsResponse response = agentsClient.listLocationsCallable().call(request);
+   *     for (Location element : response.getLocationsList()) {
+   *       // doThingsWith(element);
+   *     }
+   *     String nextPageToken = response.getNextPageToken();
+   *     if (!Strings.isNullOrEmpty(nextPageToken)) {
+   *       request = request.toBuilder().setPageToken(nextPageToken).build();
+   *     } else {
+   *       break;
+   *     }
+   *   }
+   * }
+   * }
+ */ + public final UnaryCallable listLocationsCallable() { + return stub.listLocationsCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Gets information about a location. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
+   * try (AgentsClient agentsClient = AgentsClient.create()) {
+   *   GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build();
+   *   Location response = agentsClient.getLocation(request);
+   * }
+   * }
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final Location getLocation(GetLocationRequest request) { + return getLocationCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Gets information about a location. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
+   * try (AgentsClient agentsClient = AgentsClient.create()) {
+   *   GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build();
+   *   ApiFuture future = agentsClient.getLocationCallable().futureCall(request);
+   *   // Do something.
+   *   Location response = future.get();
+   * }
+   * }
+ */ + public final UnaryCallable getLocationCallable() { + return stub.getLocationCallable(); + } + @Override public final void close() { stub.close(); @@ -1574,4 +1717,80 @@ protected SearchAgentsFixedSizeCollection createCollection( return new SearchAgentsFixedSizeCollection(pages, collectionSize); } } + + public static class ListLocationsPagedResponse + extends AbstractPagedListResponse< + ListLocationsRequest, + ListLocationsResponse, + Location, + ListLocationsPage, + ListLocationsFixedSizeCollection> { + + public static ApiFuture createAsync( + PageContext context, + ApiFuture futureResponse) { + ApiFuture futurePage = + ListLocationsPage.createEmptyPage().createPageAsync(context, futureResponse); + return ApiFutures.transform( + futurePage, + input -> new ListLocationsPagedResponse(input), + MoreExecutors.directExecutor()); + } + + private ListLocationsPagedResponse(ListLocationsPage page) { + super(page, ListLocationsFixedSizeCollection.createEmptyCollection()); + } + } + + public static class ListLocationsPage + extends AbstractPage< + ListLocationsRequest, ListLocationsResponse, Location, ListLocationsPage> { + + private ListLocationsPage( + PageContext context, + ListLocationsResponse response) { + super(context, response); + } + + private static ListLocationsPage createEmptyPage() { + return new ListLocationsPage(null, null); + } + + @Override + protected ListLocationsPage createPage( + PageContext context, + ListLocationsResponse response) { + return new ListLocationsPage(context, response); + } + + @Override + public ApiFuture createPageAsync( + PageContext context, + ApiFuture futureResponse) { + return super.createPageAsync(context, futureResponse); + } + } + + public static class ListLocationsFixedSizeCollection + extends AbstractFixedSizeCollection< + ListLocationsRequest, + ListLocationsResponse, + Location, + ListLocationsPage, + ListLocationsFixedSizeCollection> { + + private ListLocationsFixedSizeCollection(List pages, int collectionSize) { + super(pages, collectionSize); + } + + private static ListLocationsFixedSizeCollection createEmptyCollection() { + return new ListLocationsFixedSizeCollection(null, 0); + } + + @Override + protected ListLocationsFixedSizeCollection createCollection( + List pages, int collectionSize) { + return new ListLocationsFixedSizeCollection(pages, collectionSize); + } + } } diff --git a/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2beta1/AgentsSettings.java b/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2beta1/AgentsSettings.java index 90d95ab1a..d3a348892 100644 --- a/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2beta1/AgentsSettings.java +++ b/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2beta1/AgentsSettings.java @@ -16,6 +16,7 @@ package com.google.cloud.dialogflow.v2beta1; +import static com.google.cloud.dialogflow.v2beta1.AgentsClient.ListLocationsPagedResponse; import static com.google.cloud.dialogflow.v2beta1.AgentsClient.SearchAgentsPagedResponse; import com.google.api.core.ApiFunction; @@ -32,6 +33,10 @@ import com.google.api.gax.rpc.TransportChannelProvider; import com.google.api.gax.rpc.UnaryCallSettings; import com.google.cloud.dialogflow.v2beta1.stub.AgentsStubSettings; +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.ListLocationsResponse; +import com.google.cloud.location.Location; import com.google.longrunning.Operation; import com.google.protobuf.Empty; import com.google.protobuf.Struct; @@ -144,6 +149,17 @@ public OperationCallSettings restoreAgentOpe return ((AgentsStubSettings) getStubSettings()).getValidationResultSettings(); } + /** Returns the object with the settings used for calls to listLocations. */ + public PagedCallSettings + listLocationsSettings() { + return ((AgentsStubSettings) getStubSettings()).listLocationsSettings(); + } + + /** Returns the object with the settings used for calls to getLocation. */ + public UnaryCallSettings getLocationSettings() { + return ((AgentsStubSettings) getStubSettings()).getLocationSettings(); + } + public static final AgentsSettings create(AgentsStubSettings stub) throws IOException { return new AgentsSettings.Builder(stub.toBuilder()).build(); } @@ -330,6 +346,18 @@ public UnaryCallSettings.Builder restoreAgentSet return getStubSettingsBuilder().getValidationResultSettings(); } + /** Returns the builder for the settings used for calls to listLocations. */ + public PagedCallSettings.Builder< + ListLocationsRequest, ListLocationsResponse, ListLocationsPagedResponse> + listLocationsSettings() { + return getStubSettingsBuilder().listLocationsSettings(); + } + + /** Returns the builder for the settings used for calls to getLocation. */ + public UnaryCallSettings.Builder getLocationSettings() { + return getStubSettingsBuilder().getLocationSettings(); + } + @Override public AgentsSettings build() throws IOException { return new AgentsSettings(this); diff --git a/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2beta1/AnswerRecordsClient.java b/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2beta1/AnswerRecordsClient.java index 1dd635dd7..c891f2a80 100644 --- a/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2beta1/AnswerRecordsClient.java +++ b/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2beta1/AnswerRecordsClient.java @@ -27,6 +27,10 @@ import com.google.api.gax.rpc.UnaryCallable; import com.google.cloud.dialogflow.v2beta1.stub.AnswerRecordsStub; import com.google.cloud.dialogflow.v2beta1.stub.AnswerRecordsStubSettings; +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.ListLocationsResponse; +import com.google.cloud.location.Location; import com.google.common.util.concurrent.MoreExecutors; import com.google.protobuf.FieldMask; import java.io.IOException; @@ -316,6 +320,7 @@ public final ListAnswerRecordsPagedResponse listAnswerRecords(String parent) { * ListAnswerRecordsRequest request = * ListAnswerRecordsRequest.newBuilder() * .setParent(ProjectName.of("[PROJECT]").toString()) + * .setFilter("filter-1274492040") * .setPageSize(883849137) * .setPageToken("pageToken873572522") * .build(); @@ -345,6 +350,7 @@ public final ListAnswerRecordsPagedResponse listAnswerRecords(ListAnswerRecordsR * ListAnswerRecordsRequest request = * ListAnswerRecordsRequest.newBuilder() * .setParent(ProjectName.of("[PROJECT]").toString()) + * .setFilter("filter-1274492040") * .setPageSize(883849137) * .setPageToken("pageToken873572522") * .build(); @@ -375,6 +381,7 @@ public final ListAnswerRecordsPagedResponse listAnswerRecords(ListAnswerRecordsR * ListAnswerRecordsRequest request = * ListAnswerRecordsRequest.newBuilder() * .setParent(ProjectName.of("[PROJECT]").toString()) + * .setFilter("filter-1274492040") * .setPageSize(883849137) * .setPageToken("pageToken873572522") * .build(); @@ -480,6 +487,146 @@ public final UnaryCallable updateAnswer return stub.updateAnswerRecordCallable(); } + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Lists information about the supported locations for this service. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
+   * try (AnswerRecordsClient answerRecordsClient = AnswerRecordsClient.create()) {
+   *   ListLocationsRequest request =
+   *       ListLocationsRequest.newBuilder()
+   *           .setName("name3373707")
+   *           .setFilter("filter-1274492040")
+   *           .setPageSize(883849137)
+   *           .setPageToken("pageToken873572522")
+   *           .build();
+   *   for (Location element : answerRecordsClient.listLocations(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 + */ + public final ListLocationsPagedResponse listLocations(ListLocationsRequest request) { + return listLocationsPagedCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Lists information about the supported locations for this service. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
+   * try (AnswerRecordsClient answerRecordsClient = AnswerRecordsClient.create()) {
+   *   ListLocationsRequest request =
+   *       ListLocationsRequest.newBuilder()
+   *           .setName("name3373707")
+   *           .setFilter("filter-1274492040")
+   *           .setPageSize(883849137)
+   *           .setPageToken("pageToken873572522")
+   *           .build();
+   *   ApiFuture future =
+   *       answerRecordsClient.listLocationsPagedCallable().futureCall(request);
+   *   // Do something.
+   *   for (Location element : future.get().iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * }
+ */ + public final UnaryCallable + listLocationsPagedCallable() { + return stub.listLocationsPagedCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Lists information about the supported locations for this service. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
+   * try (AnswerRecordsClient answerRecordsClient = AnswerRecordsClient.create()) {
+   *   ListLocationsRequest request =
+   *       ListLocationsRequest.newBuilder()
+   *           .setName("name3373707")
+   *           .setFilter("filter-1274492040")
+   *           .setPageSize(883849137)
+   *           .setPageToken("pageToken873572522")
+   *           .build();
+   *   while (true) {
+   *     ListLocationsResponse response = answerRecordsClient.listLocationsCallable().call(request);
+   *     for (Location element : response.getLocationsList()) {
+   *       // doThingsWith(element);
+   *     }
+   *     String nextPageToken = response.getNextPageToken();
+   *     if (!Strings.isNullOrEmpty(nextPageToken)) {
+   *       request = request.toBuilder().setPageToken(nextPageToken).build();
+   *     } else {
+   *       break;
+   *     }
+   *   }
+   * }
+   * }
+ */ + public final UnaryCallable listLocationsCallable() { + return stub.listLocationsCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Gets information about a location. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
+   * try (AnswerRecordsClient answerRecordsClient = AnswerRecordsClient.create()) {
+   *   GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build();
+   *   Location response = answerRecordsClient.getLocation(request);
+   * }
+   * }
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final Location getLocation(GetLocationRequest request) { + return getLocationCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Gets information about a location. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
+   * try (AnswerRecordsClient answerRecordsClient = AnswerRecordsClient.create()) {
+   *   GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build();
+   *   ApiFuture future = answerRecordsClient.getLocationCallable().futureCall(request);
+   *   // Do something.
+   *   Location response = future.get();
+   * }
+   * }
+ */ + public final UnaryCallable getLocationCallable() { + return stub.getLocationCallable(); + } + @Override public final void close() { stub.close(); @@ -589,4 +736,80 @@ protected ListAnswerRecordsFixedSizeCollection createCollection( return new ListAnswerRecordsFixedSizeCollection(pages, collectionSize); } } + + public static class ListLocationsPagedResponse + extends AbstractPagedListResponse< + ListLocationsRequest, + ListLocationsResponse, + Location, + ListLocationsPage, + ListLocationsFixedSizeCollection> { + + public static ApiFuture createAsync( + PageContext context, + ApiFuture futureResponse) { + ApiFuture futurePage = + ListLocationsPage.createEmptyPage().createPageAsync(context, futureResponse); + return ApiFutures.transform( + futurePage, + input -> new ListLocationsPagedResponse(input), + MoreExecutors.directExecutor()); + } + + private ListLocationsPagedResponse(ListLocationsPage page) { + super(page, ListLocationsFixedSizeCollection.createEmptyCollection()); + } + } + + public static class ListLocationsPage + extends AbstractPage< + ListLocationsRequest, ListLocationsResponse, Location, ListLocationsPage> { + + private ListLocationsPage( + PageContext context, + ListLocationsResponse response) { + super(context, response); + } + + private static ListLocationsPage createEmptyPage() { + return new ListLocationsPage(null, null); + } + + @Override + protected ListLocationsPage createPage( + PageContext context, + ListLocationsResponse response) { + return new ListLocationsPage(context, response); + } + + @Override + public ApiFuture createPageAsync( + PageContext context, + ApiFuture futureResponse) { + return super.createPageAsync(context, futureResponse); + } + } + + public static class ListLocationsFixedSizeCollection + extends AbstractFixedSizeCollection< + ListLocationsRequest, + ListLocationsResponse, + Location, + ListLocationsPage, + ListLocationsFixedSizeCollection> { + + private ListLocationsFixedSizeCollection(List pages, int collectionSize) { + super(pages, collectionSize); + } + + private static ListLocationsFixedSizeCollection createEmptyCollection() { + return new ListLocationsFixedSizeCollection(null, 0); + } + + @Override + protected ListLocationsFixedSizeCollection createCollection( + List pages, int collectionSize) { + return new ListLocationsFixedSizeCollection(pages, collectionSize); + } + } } diff --git a/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2beta1/AnswerRecordsSettings.java b/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2beta1/AnswerRecordsSettings.java index e78e4999c..46d1fb234 100644 --- a/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2beta1/AnswerRecordsSettings.java +++ b/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2beta1/AnswerRecordsSettings.java @@ -17,6 +17,7 @@ package com.google.cloud.dialogflow.v2beta1; import static com.google.cloud.dialogflow.v2beta1.AnswerRecordsClient.ListAnswerRecordsPagedResponse; +import static com.google.cloud.dialogflow.v2beta1.AnswerRecordsClient.ListLocationsPagedResponse; import com.google.api.core.ApiFunction; import com.google.api.core.BetaApi; @@ -31,6 +32,10 @@ import com.google.api.gax.rpc.TransportChannelProvider; import com.google.api.gax.rpc.UnaryCallSettings; import com.google.cloud.dialogflow.v2beta1.stub.AnswerRecordsStubSettings; +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.ListLocationsResponse; +import com.google.cloud.location.Location; import java.io.IOException; import java.util.List; import javax.annotation.Generated; @@ -94,6 +99,17 @@ public UnaryCallSettings updateAnswerRe return ((AnswerRecordsStubSettings) getStubSettings()).updateAnswerRecordSettings(); } + /** Returns the object with the settings used for calls to listLocations. */ + public PagedCallSettings + listLocationsSettings() { + return ((AnswerRecordsStubSettings) getStubSettings()).listLocationsSettings(); + } + + /** Returns the object with the settings used for calls to getLocation. */ + public UnaryCallSettings getLocationSettings() { + return ((AnswerRecordsStubSettings) getStubSettings()).getLocationSettings(); + } + public static final AnswerRecordsSettings create(AnswerRecordsStubSettings stub) throws IOException { return new AnswerRecordsSettings.Builder(stub.toBuilder()).build(); @@ -233,6 +249,18 @@ public Builder applyToAllUnaryMethods( return getStubSettingsBuilder().updateAnswerRecordSettings(); } + /** Returns the builder for the settings used for calls to listLocations. */ + public PagedCallSettings.Builder< + ListLocationsRequest, ListLocationsResponse, ListLocationsPagedResponse> + listLocationsSettings() { + return getStubSettingsBuilder().listLocationsSettings(); + } + + /** Returns the builder for the settings used for calls to getLocation. */ + public UnaryCallSettings.Builder getLocationSettings() { + return getStubSettingsBuilder().getLocationSettings(); + } + @Override public AnswerRecordsSettings build() throws IOException { return new AnswerRecordsSettings(this); diff --git a/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2beta1/ContextsClient.java b/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2beta1/ContextsClient.java index 73cd7e0aa..b9d14bea0 100644 --- a/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2beta1/ContextsClient.java +++ b/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2beta1/ContextsClient.java @@ -27,6 +27,10 @@ import com.google.api.gax.rpc.UnaryCallable; import com.google.cloud.dialogflow.v2beta1.stub.ContextsStub; import com.google.cloud.dialogflow.v2beta1.stub.ContextsStubSettings; +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.ListLocationsResponse; +import com.google.cloud.location.Location; import com.google.common.util.concurrent.MoreExecutors; import com.google.protobuf.Empty; import com.google.protobuf.FieldMask; @@ -922,6 +926,145 @@ public final UnaryCallable deleteAllContextsCal return stub.deleteAllContextsCallable(); } + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Lists information about the supported locations for this service. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
+   * try (ContextsClient contextsClient = ContextsClient.create()) {
+   *   ListLocationsRequest request =
+   *       ListLocationsRequest.newBuilder()
+   *           .setName("name3373707")
+   *           .setFilter("filter-1274492040")
+   *           .setPageSize(883849137)
+   *           .setPageToken("pageToken873572522")
+   *           .build();
+   *   for (Location element : contextsClient.listLocations(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 + */ + public final ListLocationsPagedResponse listLocations(ListLocationsRequest request) { + return listLocationsPagedCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Lists information about the supported locations for this service. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
+   * try (ContextsClient contextsClient = ContextsClient.create()) {
+   *   ListLocationsRequest request =
+   *       ListLocationsRequest.newBuilder()
+   *           .setName("name3373707")
+   *           .setFilter("filter-1274492040")
+   *           .setPageSize(883849137)
+   *           .setPageToken("pageToken873572522")
+   *           .build();
+   *   ApiFuture future = contextsClient.listLocationsPagedCallable().futureCall(request);
+   *   // Do something.
+   *   for (Location element : future.get().iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * }
+ */ + public final UnaryCallable + listLocationsPagedCallable() { + return stub.listLocationsPagedCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Lists information about the supported locations for this service. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
+   * try (ContextsClient contextsClient = ContextsClient.create()) {
+   *   ListLocationsRequest request =
+   *       ListLocationsRequest.newBuilder()
+   *           .setName("name3373707")
+   *           .setFilter("filter-1274492040")
+   *           .setPageSize(883849137)
+   *           .setPageToken("pageToken873572522")
+   *           .build();
+   *   while (true) {
+   *     ListLocationsResponse response = contextsClient.listLocationsCallable().call(request);
+   *     for (Location element : response.getLocationsList()) {
+   *       // doThingsWith(element);
+   *     }
+   *     String nextPageToken = response.getNextPageToken();
+   *     if (!Strings.isNullOrEmpty(nextPageToken)) {
+   *       request = request.toBuilder().setPageToken(nextPageToken).build();
+   *     } else {
+   *       break;
+   *     }
+   *   }
+   * }
+   * }
+ */ + public final UnaryCallable listLocationsCallable() { + return stub.listLocationsCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Gets information about a location. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
+   * try (ContextsClient contextsClient = ContextsClient.create()) {
+   *   GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build();
+   *   Location response = contextsClient.getLocation(request);
+   * }
+   * }
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final Location getLocation(GetLocationRequest request) { + return getLocationCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Gets information about a location. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
+   * try (ContextsClient contextsClient = ContextsClient.create()) {
+   *   GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build();
+   *   ApiFuture future = contextsClient.getLocationCallable().futureCall(request);
+   *   // Do something.
+   *   Location response = future.get();
+   * }
+   * }
+ */ + public final UnaryCallable getLocationCallable() { + return stub.getLocationCallable(); + } + @Override public final void close() { stub.close(); @@ -1026,4 +1169,80 @@ protected ListContextsFixedSizeCollection createCollection( return new ListContextsFixedSizeCollection(pages, collectionSize); } } + + public static class ListLocationsPagedResponse + extends AbstractPagedListResponse< + ListLocationsRequest, + ListLocationsResponse, + Location, + ListLocationsPage, + ListLocationsFixedSizeCollection> { + + public static ApiFuture createAsync( + PageContext context, + ApiFuture futureResponse) { + ApiFuture futurePage = + ListLocationsPage.createEmptyPage().createPageAsync(context, futureResponse); + return ApiFutures.transform( + futurePage, + input -> new ListLocationsPagedResponse(input), + MoreExecutors.directExecutor()); + } + + private ListLocationsPagedResponse(ListLocationsPage page) { + super(page, ListLocationsFixedSizeCollection.createEmptyCollection()); + } + } + + public static class ListLocationsPage + extends AbstractPage< + ListLocationsRequest, ListLocationsResponse, Location, ListLocationsPage> { + + private ListLocationsPage( + PageContext context, + ListLocationsResponse response) { + super(context, response); + } + + private static ListLocationsPage createEmptyPage() { + return new ListLocationsPage(null, null); + } + + @Override + protected ListLocationsPage createPage( + PageContext context, + ListLocationsResponse response) { + return new ListLocationsPage(context, response); + } + + @Override + public ApiFuture createPageAsync( + PageContext context, + ApiFuture futureResponse) { + return super.createPageAsync(context, futureResponse); + } + } + + public static class ListLocationsFixedSizeCollection + extends AbstractFixedSizeCollection< + ListLocationsRequest, + ListLocationsResponse, + Location, + ListLocationsPage, + ListLocationsFixedSizeCollection> { + + private ListLocationsFixedSizeCollection(List pages, int collectionSize) { + super(pages, collectionSize); + } + + private static ListLocationsFixedSizeCollection createEmptyCollection() { + return new ListLocationsFixedSizeCollection(null, 0); + } + + @Override + protected ListLocationsFixedSizeCollection createCollection( + List pages, int collectionSize) { + return new ListLocationsFixedSizeCollection(pages, collectionSize); + } + } } diff --git a/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2beta1/ContextsSettings.java b/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2beta1/ContextsSettings.java index 7ae67a770..bab02b7f1 100644 --- a/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2beta1/ContextsSettings.java +++ b/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2beta1/ContextsSettings.java @@ -17,6 +17,7 @@ package com.google.cloud.dialogflow.v2beta1; import static com.google.cloud.dialogflow.v2beta1.ContextsClient.ListContextsPagedResponse; +import static com.google.cloud.dialogflow.v2beta1.ContextsClient.ListLocationsPagedResponse; import com.google.api.core.ApiFunction; import com.google.api.core.BetaApi; @@ -31,6 +32,10 @@ import com.google.api.gax.rpc.TransportChannelProvider; import com.google.api.gax.rpc.UnaryCallSettings; import com.google.cloud.dialogflow.v2beta1.stub.ContextsStubSettings; +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.ListLocationsResponse; +import com.google.cloud.location.Location; import com.google.protobuf.Empty; import java.io.IOException; import java.util.List; @@ -104,6 +109,17 @@ public UnaryCallSettings deleteAllContextsSetti return ((ContextsStubSettings) getStubSettings()).deleteAllContextsSettings(); } + /** Returns the object with the settings used for calls to listLocations. */ + public PagedCallSettings + listLocationsSettings() { + return ((ContextsStubSettings) getStubSettings()).listLocationsSettings(); + } + + /** Returns the object with the settings used for calls to getLocation. */ + public UnaryCallSettings getLocationSettings() { + return ((ContextsStubSettings) getStubSettings()).getLocationSettings(); + } + public static final ContextsSettings create(ContextsStubSettings stub) throws IOException { return new ContextsSettings.Builder(stub.toBuilder()).build(); } @@ -250,6 +266,18 @@ public UnaryCallSettings.Builder deleteAllConte return getStubSettingsBuilder().deleteAllContextsSettings(); } + /** Returns the builder for the settings used for calls to listLocations. */ + public PagedCallSettings.Builder< + ListLocationsRequest, ListLocationsResponse, ListLocationsPagedResponse> + listLocationsSettings() { + return getStubSettingsBuilder().listLocationsSettings(); + } + + /** Returns the builder for the settings used for calls to getLocation. */ + public UnaryCallSettings.Builder getLocationSettings() { + return getStubSettingsBuilder().getLocationSettings(); + } + @Override public ContextsSettings build() throws IOException { return new ContextsSettings(this); diff --git a/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2beta1/ConversationProfilesClient.java b/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2beta1/ConversationProfilesClient.java index 28f3dde54..3423d5b82 100644 --- a/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2beta1/ConversationProfilesClient.java +++ b/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2beta1/ConversationProfilesClient.java @@ -30,6 +30,10 @@ import com.google.api.gax.rpc.UnaryCallable; import com.google.cloud.dialogflow.v2beta1.stub.ConversationProfilesStub; import com.google.cloud.dialogflow.v2beta1.stub.ConversationProfilesStubSettings; +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.ListLocationsResponse; +import com.google.cloud.location.Location; import com.google.common.util.concurrent.MoreExecutors; import com.google.longrunning.Operation; import com.google.protobuf.Empty; @@ -1252,6 +1256,153 @@ public final void deleteConversationProfile(DeleteConversationProfileRequest req return stub.clearSuggestionFeatureConfigCallable(); } + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Lists information about the supported locations for this service. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
+   * try (ConversationProfilesClient conversationProfilesClient =
+   *     ConversationProfilesClient.create()) {
+   *   ListLocationsRequest request =
+   *       ListLocationsRequest.newBuilder()
+   *           .setName("name3373707")
+   *           .setFilter("filter-1274492040")
+   *           .setPageSize(883849137)
+   *           .setPageToken("pageToken873572522")
+   *           .build();
+   *   for (Location element : conversationProfilesClient.listLocations(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 + */ + public final ListLocationsPagedResponse listLocations(ListLocationsRequest request) { + return listLocationsPagedCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Lists information about the supported locations for this service. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
+   * try (ConversationProfilesClient conversationProfilesClient =
+   *     ConversationProfilesClient.create()) {
+   *   ListLocationsRequest request =
+   *       ListLocationsRequest.newBuilder()
+   *           .setName("name3373707")
+   *           .setFilter("filter-1274492040")
+   *           .setPageSize(883849137)
+   *           .setPageToken("pageToken873572522")
+   *           .build();
+   *   ApiFuture future =
+   *       conversationProfilesClient.listLocationsPagedCallable().futureCall(request);
+   *   // Do something.
+   *   for (Location element : future.get().iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * }
+ */ + public final UnaryCallable + listLocationsPagedCallable() { + return stub.listLocationsPagedCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Lists information about the supported locations for this service. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
+   * try (ConversationProfilesClient conversationProfilesClient =
+   *     ConversationProfilesClient.create()) {
+   *   ListLocationsRequest request =
+   *       ListLocationsRequest.newBuilder()
+   *           .setName("name3373707")
+   *           .setFilter("filter-1274492040")
+   *           .setPageSize(883849137)
+   *           .setPageToken("pageToken873572522")
+   *           .build();
+   *   while (true) {
+   *     ListLocationsResponse response =
+   *         conversationProfilesClient.listLocationsCallable().call(request);
+   *     for (Location element : response.getLocationsList()) {
+   *       // doThingsWith(element);
+   *     }
+   *     String nextPageToken = response.getNextPageToken();
+   *     if (!Strings.isNullOrEmpty(nextPageToken)) {
+   *       request = request.toBuilder().setPageToken(nextPageToken).build();
+   *     } else {
+   *       break;
+   *     }
+   *   }
+   * }
+   * }
+ */ + public final UnaryCallable listLocationsCallable() { + return stub.listLocationsCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Gets information about a location. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
+   * try (ConversationProfilesClient conversationProfilesClient =
+   *     ConversationProfilesClient.create()) {
+   *   GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build();
+   *   Location response = conversationProfilesClient.getLocation(request);
+   * }
+   * }
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final Location getLocation(GetLocationRequest request) { + return getLocationCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Gets information about a location. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
+   * try (ConversationProfilesClient conversationProfilesClient =
+   *     ConversationProfilesClient.create()) {
+   *   GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build();
+   *   ApiFuture future =
+   *       conversationProfilesClient.getLocationCallable().futureCall(request);
+   *   // Do something.
+   *   Location response = future.get();
+   * }
+   * }
+ */ + public final UnaryCallable getLocationCallable() { + return stub.getLocationCallable(); + } + @Override public final void close() { stub.close(); @@ -1377,4 +1528,80 @@ protected ListConversationProfilesFixedSizeCollection createCollection( return new ListConversationProfilesFixedSizeCollection(pages, collectionSize); } } + + public static class ListLocationsPagedResponse + extends AbstractPagedListResponse< + ListLocationsRequest, + ListLocationsResponse, + Location, + ListLocationsPage, + ListLocationsFixedSizeCollection> { + + public static ApiFuture createAsync( + PageContext context, + ApiFuture futureResponse) { + ApiFuture futurePage = + ListLocationsPage.createEmptyPage().createPageAsync(context, futureResponse); + return ApiFutures.transform( + futurePage, + input -> new ListLocationsPagedResponse(input), + MoreExecutors.directExecutor()); + } + + private ListLocationsPagedResponse(ListLocationsPage page) { + super(page, ListLocationsFixedSizeCollection.createEmptyCollection()); + } + } + + public static class ListLocationsPage + extends AbstractPage< + ListLocationsRequest, ListLocationsResponse, Location, ListLocationsPage> { + + private ListLocationsPage( + PageContext context, + ListLocationsResponse response) { + super(context, response); + } + + private static ListLocationsPage createEmptyPage() { + return new ListLocationsPage(null, null); + } + + @Override + protected ListLocationsPage createPage( + PageContext context, + ListLocationsResponse response) { + return new ListLocationsPage(context, response); + } + + @Override + public ApiFuture createPageAsync( + PageContext context, + ApiFuture futureResponse) { + return super.createPageAsync(context, futureResponse); + } + } + + public static class ListLocationsFixedSizeCollection + extends AbstractFixedSizeCollection< + ListLocationsRequest, + ListLocationsResponse, + Location, + ListLocationsPage, + ListLocationsFixedSizeCollection> { + + private ListLocationsFixedSizeCollection(List pages, int collectionSize) { + super(pages, collectionSize); + } + + private static ListLocationsFixedSizeCollection createEmptyCollection() { + return new ListLocationsFixedSizeCollection(null, 0); + } + + @Override + protected ListLocationsFixedSizeCollection createCollection( + List pages, int collectionSize) { + return new ListLocationsFixedSizeCollection(pages, collectionSize); + } + } } diff --git a/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2beta1/ConversationProfilesSettings.java b/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2beta1/ConversationProfilesSettings.java index 3824cc129..56ed80ea2 100644 --- a/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2beta1/ConversationProfilesSettings.java +++ b/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2beta1/ConversationProfilesSettings.java @@ -17,6 +17,7 @@ package com.google.cloud.dialogflow.v2beta1; import static com.google.cloud.dialogflow.v2beta1.ConversationProfilesClient.ListConversationProfilesPagedResponse; +import static com.google.cloud.dialogflow.v2beta1.ConversationProfilesClient.ListLocationsPagedResponse; import com.google.api.core.ApiFunction; import com.google.api.core.BetaApi; @@ -32,6 +33,10 @@ import com.google.api.gax.rpc.TransportChannelProvider; import com.google.api.gax.rpc.UnaryCallSettings; import com.google.cloud.dialogflow.v2beta1.stub.ConversationProfilesStubSettings; +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.ListLocationsResponse; +import com.google.cloud.location.Location; import com.google.longrunning.Operation; import com.google.protobuf.Empty; import java.io.IOException; @@ -148,6 +153,17 @@ public class ConversationProfilesSettings extends ClientSettings + listLocationsSettings() { + return ((ConversationProfilesStubSettings) getStubSettings()).listLocationsSettings(); + } + + /** Returns the object with the settings used for calls to getLocation. */ + public UnaryCallSettings getLocationSettings() { + return ((ConversationProfilesStubSettings) getStubSettings()).getLocationSettings(); + } + public static final ConversationProfilesSettings create(ConversationProfilesStubSettings stub) throws IOException { return new ConversationProfilesSettings.Builder(stub.toBuilder()).build(); @@ -327,6 +343,18 @@ public Builder applyToAllUnaryMethods( return getStubSettingsBuilder().clearSuggestionFeatureConfigOperationSettings(); } + /** Returns the builder for the settings used for calls to listLocations. */ + public PagedCallSettings.Builder< + ListLocationsRequest, ListLocationsResponse, ListLocationsPagedResponse> + listLocationsSettings() { + return getStubSettingsBuilder().listLocationsSettings(); + } + + /** Returns the builder for the settings used for calls to getLocation. */ + public UnaryCallSettings.Builder getLocationSettings() { + return getStubSettingsBuilder().getLocationSettings(); + } + @Override public ConversationProfilesSettings build() throws IOException { return new ConversationProfilesSettings(this); diff --git a/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2beta1/ConversationsClient.java b/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2beta1/ConversationsClient.java index 5e26f5d69..e6e6c3f5e 100644 --- a/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2beta1/ConversationsClient.java +++ b/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2beta1/ConversationsClient.java @@ -27,6 +27,10 @@ import com.google.api.gax.rpc.UnaryCallable; import com.google.cloud.dialogflow.v2beta1.stub.ConversationsStub; import com.google.cloud.dialogflow.v2beta1.stub.ConversationsStubSettings; +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.ListLocationsResponse; +import com.google.cloud.location.Location; import com.google.common.util.concurrent.MoreExecutors; import java.io.IOException; import java.util.List; @@ -1088,6 +1092,146 @@ public final UnaryCallable listMessag return stub.listMessagesCallable(); } + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Lists information about the supported locations for this service. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
+   * try (ConversationsClient conversationsClient = ConversationsClient.create()) {
+   *   ListLocationsRequest request =
+   *       ListLocationsRequest.newBuilder()
+   *           .setName("name3373707")
+   *           .setFilter("filter-1274492040")
+   *           .setPageSize(883849137)
+   *           .setPageToken("pageToken873572522")
+   *           .build();
+   *   for (Location element : conversationsClient.listLocations(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 + */ + public final ListLocationsPagedResponse listLocations(ListLocationsRequest request) { + return listLocationsPagedCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Lists information about the supported locations for this service. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
+   * try (ConversationsClient conversationsClient = ConversationsClient.create()) {
+   *   ListLocationsRequest request =
+   *       ListLocationsRequest.newBuilder()
+   *           .setName("name3373707")
+   *           .setFilter("filter-1274492040")
+   *           .setPageSize(883849137)
+   *           .setPageToken("pageToken873572522")
+   *           .build();
+   *   ApiFuture future =
+   *       conversationsClient.listLocationsPagedCallable().futureCall(request);
+   *   // Do something.
+   *   for (Location element : future.get().iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * }
+ */ + public final UnaryCallable + listLocationsPagedCallable() { + return stub.listLocationsPagedCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Lists information about the supported locations for this service. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
+   * try (ConversationsClient conversationsClient = ConversationsClient.create()) {
+   *   ListLocationsRequest request =
+   *       ListLocationsRequest.newBuilder()
+   *           .setName("name3373707")
+   *           .setFilter("filter-1274492040")
+   *           .setPageSize(883849137)
+   *           .setPageToken("pageToken873572522")
+   *           .build();
+   *   while (true) {
+   *     ListLocationsResponse response = conversationsClient.listLocationsCallable().call(request);
+   *     for (Location element : response.getLocationsList()) {
+   *       // doThingsWith(element);
+   *     }
+   *     String nextPageToken = response.getNextPageToken();
+   *     if (!Strings.isNullOrEmpty(nextPageToken)) {
+   *       request = request.toBuilder().setPageToken(nextPageToken).build();
+   *     } else {
+   *       break;
+   *     }
+   *   }
+   * }
+   * }
+ */ + public final UnaryCallable listLocationsCallable() { + return stub.listLocationsCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Gets information about a location. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
+   * try (ConversationsClient conversationsClient = ConversationsClient.create()) {
+   *   GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build();
+   *   Location response = conversationsClient.getLocation(request);
+   * }
+   * }
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final Location getLocation(GetLocationRequest request) { + return getLocationCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Gets information about a location. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
+   * try (ConversationsClient conversationsClient = ConversationsClient.create()) {
+   *   GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build();
+   *   ApiFuture future = conversationsClient.getLocationCallable().futureCall(request);
+   *   // Do something.
+   *   Location response = future.get();
+   * }
+   * }
+ */ + public final UnaryCallable getLocationCallable() { + return stub.getLocationCallable(); + } + @Override public final void close() { stub.close(); @@ -1272,4 +1416,80 @@ protected ListMessagesFixedSizeCollection createCollection( return new ListMessagesFixedSizeCollection(pages, collectionSize); } } + + public static class ListLocationsPagedResponse + extends AbstractPagedListResponse< + ListLocationsRequest, + ListLocationsResponse, + Location, + ListLocationsPage, + ListLocationsFixedSizeCollection> { + + public static ApiFuture createAsync( + PageContext context, + ApiFuture futureResponse) { + ApiFuture futurePage = + ListLocationsPage.createEmptyPage().createPageAsync(context, futureResponse); + return ApiFutures.transform( + futurePage, + input -> new ListLocationsPagedResponse(input), + MoreExecutors.directExecutor()); + } + + private ListLocationsPagedResponse(ListLocationsPage page) { + super(page, ListLocationsFixedSizeCollection.createEmptyCollection()); + } + } + + public static class ListLocationsPage + extends AbstractPage< + ListLocationsRequest, ListLocationsResponse, Location, ListLocationsPage> { + + private ListLocationsPage( + PageContext context, + ListLocationsResponse response) { + super(context, response); + } + + private static ListLocationsPage createEmptyPage() { + return new ListLocationsPage(null, null); + } + + @Override + protected ListLocationsPage createPage( + PageContext context, + ListLocationsResponse response) { + return new ListLocationsPage(context, response); + } + + @Override + public ApiFuture createPageAsync( + PageContext context, + ApiFuture futureResponse) { + return super.createPageAsync(context, futureResponse); + } + } + + public static class ListLocationsFixedSizeCollection + extends AbstractFixedSizeCollection< + ListLocationsRequest, + ListLocationsResponse, + Location, + ListLocationsPage, + ListLocationsFixedSizeCollection> { + + private ListLocationsFixedSizeCollection(List pages, int collectionSize) { + super(pages, collectionSize); + } + + private static ListLocationsFixedSizeCollection createEmptyCollection() { + return new ListLocationsFixedSizeCollection(null, 0); + } + + @Override + protected ListLocationsFixedSizeCollection createCollection( + List pages, int collectionSize) { + return new ListLocationsFixedSizeCollection(pages, collectionSize); + } + } } diff --git a/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2beta1/ConversationsSettings.java b/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2beta1/ConversationsSettings.java index 24e20dd40..61151d4b0 100644 --- a/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2beta1/ConversationsSettings.java +++ b/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2beta1/ConversationsSettings.java @@ -17,6 +17,7 @@ package com.google.cloud.dialogflow.v2beta1; import static com.google.cloud.dialogflow.v2beta1.ConversationsClient.ListConversationsPagedResponse; +import static com.google.cloud.dialogflow.v2beta1.ConversationsClient.ListLocationsPagedResponse; import static com.google.cloud.dialogflow.v2beta1.ConversationsClient.ListMessagesPagedResponse; import com.google.api.core.ApiFunction; @@ -32,6 +33,10 @@ import com.google.api.gax.rpc.TransportChannelProvider; import com.google.api.gax.rpc.UnaryCallSettings; import com.google.cloud.dialogflow.v2beta1.stub.ConversationsStubSettings; +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.ListLocationsResponse; +import com.google.cloud.location.Location; import java.io.IOException; import java.util.List; import javax.annotation.Generated; @@ -108,6 +113,17 @@ public UnaryCallSettings getConversationSe return ((ConversationsStubSettings) getStubSettings()).listMessagesSettings(); } + /** Returns the object with the settings used for calls to listLocations. */ + public PagedCallSettings + listLocationsSettings() { + return ((ConversationsStubSettings) getStubSettings()).listLocationsSettings(); + } + + /** Returns the object with the settings used for calls to getLocation. */ + public UnaryCallSettings getLocationSettings() { + return ((ConversationsStubSettings) getStubSettings()).getLocationSettings(); + } + public static final ConversationsSettings create(ConversationsStubSettings stub) throws IOException { return new ConversationsSettings.Builder(stub.toBuilder()).build(); @@ -261,6 +277,18 @@ public Builder applyToAllUnaryMethods( return getStubSettingsBuilder().listMessagesSettings(); } + /** Returns the builder for the settings used for calls to listLocations. */ + public PagedCallSettings.Builder< + ListLocationsRequest, ListLocationsResponse, ListLocationsPagedResponse> + listLocationsSettings() { + return getStubSettingsBuilder().listLocationsSettings(); + } + + /** Returns the builder for the settings used for calls to getLocation. */ + public UnaryCallSettings.Builder getLocationSettings() { + return getStubSettingsBuilder().getLocationSettings(); + } + @Override public ConversationsSettings build() throws IOException { return new ConversationsSettings(this); diff --git a/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2beta1/DocumentsClient.java b/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2beta1/DocumentsClient.java index acc9b36e0..521cd3fdc 100644 --- a/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2beta1/DocumentsClient.java +++ b/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2beta1/DocumentsClient.java @@ -30,6 +30,10 @@ import com.google.api.gax.rpc.UnaryCallable; import com.google.cloud.dialogflow.v2beta1.stub.DocumentsStub; import com.google.cloud.dialogflow.v2beta1.stub.DocumentsStubSettings; +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.ListLocationsResponse; +import com.google.cloud.location.Location; import com.google.common.util.concurrent.MoreExecutors; import com.google.longrunning.Operation; import com.google.protobuf.Empty; @@ -1442,6 +1446,145 @@ public final UnaryCallable reloadDocumentCalla return stub.reloadDocumentCallable(); } + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Lists information about the supported locations for this service. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
+   * try (DocumentsClient documentsClient = DocumentsClient.create()) {
+   *   ListLocationsRequest request =
+   *       ListLocationsRequest.newBuilder()
+   *           .setName("name3373707")
+   *           .setFilter("filter-1274492040")
+   *           .setPageSize(883849137)
+   *           .setPageToken("pageToken873572522")
+   *           .build();
+   *   for (Location element : documentsClient.listLocations(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 + */ + public final ListLocationsPagedResponse listLocations(ListLocationsRequest request) { + return listLocationsPagedCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Lists information about the supported locations for this service. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
+   * try (DocumentsClient documentsClient = DocumentsClient.create()) {
+   *   ListLocationsRequest request =
+   *       ListLocationsRequest.newBuilder()
+   *           .setName("name3373707")
+   *           .setFilter("filter-1274492040")
+   *           .setPageSize(883849137)
+   *           .setPageToken("pageToken873572522")
+   *           .build();
+   *   ApiFuture future = documentsClient.listLocationsPagedCallable().futureCall(request);
+   *   // Do something.
+   *   for (Location element : future.get().iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * }
+ */ + public final UnaryCallable + listLocationsPagedCallable() { + return stub.listLocationsPagedCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Lists information about the supported locations for this service. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
+   * try (DocumentsClient documentsClient = DocumentsClient.create()) {
+   *   ListLocationsRequest request =
+   *       ListLocationsRequest.newBuilder()
+   *           .setName("name3373707")
+   *           .setFilter("filter-1274492040")
+   *           .setPageSize(883849137)
+   *           .setPageToken("pageToken873572522")
+   *           .build();
+   *   while (true) {
+   *     ListLocationsResponse response = documentsClient.listLocationsCallable().call(request);
+   *     for (Location element : response.getLocationsList()) {
+   *       // doThingsWith(element);
+   *     }
+   *     String nextPageToken = response.getNextPageToken();
+   *     if (!Strings.isNullOrEmpty(nextPageToken)) {
+   *       request = request.toBuilder().setPageToken(nextPageToken).build();
+   *     } else {
+   *       break;
+   *     }
+   *   }
+   * }
+   * }
+ */ + public final UnaryCallable listLocationsCallable() { + return stub.listLocationsCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Gets information about a location. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
+   * try (DocumentsClient documentsClient = DocumentsClient.create()) {
+   *   GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build();
+   *   Location response = documentsClient.getLocation(request);
+   * }
+   * }
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final Location getLocation(GetLocationRequest request) { + return getLocationCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Gets information about a location. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
+   * try (DocumentsClient documentsClient = DocumentsClient.create()) {
+   *   GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build();
+   *   ApiFuture future = documentsClient.getLocationCallable().futureCall(request);
+   *   // Do something.
+   *   Location response = future.get();
+   * }
+   * }
+ */ + public final UnaryCallable getLocationCallable() { + return stub.getLocationCallable(); + } + @Override public final void close() { stub.close(); @@ -1547,4 +1690,80 @@ protected ListDocumentsFixedSizeCollection createCollection( return new ListDocumentsFixedSizeCollection(pages, collectionSize); } } + + public static class ListLocationsPagedResponse + extends AbstractPagedListResponse< + ListLocationsRequest, + ListLocationsResponse, + Location, + ListLocationsPage, + ListLocationsFixedSizeCollection> { + + public static ApiFuture createAsync( + PageContext context, + ApiFuture futureResponse) { + ApiFuture futurePage = + ListLocationsPage.createEmptyPage().createPageAsync(context, futureResponse); + return ApiFutures.transform( + futurePage, + input -> new ListLocationsPagedResponse(input), + MoreExecutors.directExecutor()); + } + + private ListLocationsPagedResponse(ListLocationsPage page) { + super(page, ListLocationsFixedSizeCollection.createEmptyCollection()); + } + } + + public static class ListLocationsPage + extends AbstractPage< + ListLocationsRequest, ListLocationsResponse, Location, ListLocationsPage> { + + private ListLocationsPage( + PageContext context, + ListLocationsResponse response) { + super(context, response); + } + + private static ListLocationsPage createEmptyPage() { + return new ListLocationsPage(null, null); + } + + @Override + protected ListLocationsPage createPage( + PageContext context, + ListLocationsResponse response) { + return new ListLocationsPage(context, response); + } + + @Override + public ApiFuture createPageAsync( + PageContext context, + ApiFuture futureResponse) { + return super.createPageAsync(context, futureResponse); + } + } + + public static class ListLocationsFixedSizeCollection + extends AbstractFixedSizeCollection< + ListLocationsRequest, + ListLocationsResponse, + Location, + ListLocationsPage, + ListLocationsFixedSizeCollection> { + + private ListLocationsFixedSizeCollection(List pages, int collectionSize) { + super(pages, collectionSize); + } + + private static ListLocationsFixedSizeCollection createEmptyCollection() { + return new ListLocationsFixedSizeCollection(null, 0); + } + + @Override + protected ListLocationsFixedSizeCollection createCollection( + List pages, int collectionSize) { + return new ListLocationsFixedSizeCollection(pages, collectionSize); + } + } } diff --git a/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2beta1/DocumentsSettings.java b/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2beta1/DocumentsSettings.java index 04cc6cc1e..409a9d8a6 100644 --- a/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2beta1/DocumentsSettings.java +++ b/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2beta1/DocumentsSettings.java @@ -17,6 +17,7 @@ package com.google.cloud.dialogflow.v2beta1; import static com.google.cloud.dialogflow.v2beta1.DocumentsClient.ListDocumentsPagedResponse; +import static com.google.cloud.dialogflow.v2beta1.DocumentsClient.ListLocationsPagedResponse; import com.google.api.core.ApiFunction; import com.google.api.core.BetaApi; @@ -32,6 +33,10 @@ import com.google.api.gax.rpc.TransportChannelProvider; import com.google.api.gax.rpc.UnaryCallSettings; import com.google.cloud.dialogflow.v2beta1.stub.DocumentsStubSettings; +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.ListLocationsResponse; +import com.google.cloud.location.Location; import com.google.longrunning.Operation; import com.google.protobuf.Empty; import java.io.IOException; @@ -142,6 +147,17 @@ public UnaryCallSettings reloadDocumentSetting return ((DocumentsStubSettings) getStubSettings()).reloadDocumentOperationSettings(); } + /** Returns the object with the settings used for calls to listLocations. */ + public PagedCallSettings + listLocationsSettings() { + return ((DocumentsStubSettings) getStubSettings()).listLocationsSettings(); + } + + /** Returns the object with the settings used for calls to getLocation. */ + public UnaryCallSettings getLocationSettings() { + return ((DocumentsStubSettings) getStubSettings()).getLocationSettings(); + } + public static final DocumentsSettings create(DocumentsStubSettings stub) throws IOException { return new DocumentsSettings.Builder(stub.toBuilder()).build(); } @@ -327,6 +343,18 @@ public UnaryCallSettings.Builder reloadDocumen return getStubSettingsBuilder().reloadDocumentOperationSettings(); } + /** Returns the builder for the settings used for calls to listLocations. */ + public PagedCallSettings.Builder< + ListLocationsRequest, ListLocationsResponse, ListLocationsPagedResponse> + listLocationsSettings() { + return getStubSettingsBuilder().listLocationsSettings(); + } + + /** Returns the builder for the settings used for calls to getLocation. */ + public UnaryCallSettings.Builder getLocationSettings() { + return getStubSettingsBuilder().getLocationSettings(); + } + @Override public DocumentsSettings build() throws IOException { return new DocumentsSettings(this); diff --git a/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2beta1/EntityTypesClient.java b/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2beta1/EntityTypesClient.java index f938402b9..67e6e9095 100644 --- a/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2beta1/EntityTypesClient.java +++ b/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2beta1/EntityTypesClient.java @@ -30,6 +30,10 @@ import com.google.api.gax.rpc.UnaryCallable; import com.google.cloud.dialogflow.v2beta1.stub.EntityTypesStub; import com.google.cloud.dialogflow.v2beta1.stub.EntityTypesStubSettings; +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.ListLocationsResponse; +import com.google.cloud.location.Location; import com.google.common.util.concurrent.MoreExecutors; import com.google.longrunning.Operation; import com.google.protobuf.Empty; @@ -2362,6 +2366,146 @@ public final UnaryCallable batchDeleteEnt return stub.batchDeleteEntitiesCallable(); } + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Lists information about the supported locations for this service. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
+   * try (EntityTypesClient entityTypesClient = EntityTypesClient.create()) {
+   *   ListLocationsRequest request =
+   *       ListLocationsRequest.newBuilder()
+   *           .setName("name3373707")
+   *           .setFilter("filter-1274492040")
+   *           .setPageSize(883849137)
+   *           .setPageToken("pageToken873572522")
+   *           .build();
+   *   for (Location element : entityTypesClient.listLocations(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 + */ + public final ListLocationsPagedResponse listLocations(ListLocationsRequest request) { + return listLocationsPagedCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Lists information about the supported locations for this service. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
+   * try (EntityTypesClient entityTypesClient = EntityTypesClient.create()) {
+   *   ListLocationsRequest request =
+   *       ListLocationsRequest.newBuilder()
+   *           .setName("name3373707")
+   *           .setFilter("filter-1274492040")
+   *           .setPageSize(883849137)
+   *           .setPageToken("pageToken873572522")
+   *           .build();
+   *   ApiFuture future =
+   *       entityTypesClient.listLocationsPagedCallable().futureCall(request);
+   *   // Do something.
+   *   for (Location element : future.get().iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * }
+ */ + public final UnaryCallable + listLocationsPagedCallable() { + return stub.listLocationsPagedCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Lists information about the supported locations for this service. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
+   * try (EntityTypesClient entityTypesClient = EntityTypesClient.create()) {
+   *   ListLocationsRequest request =
+   *       ListLocationsRequest.newBuilder()
+   *           .setName("name3373707")
+   *           .setFilter("filter-1274492040")
+   *           .setPageSize(883849137)
+   *           .setPageToken("pageToken873572522")
+   *           .build();
+   *   while (true) {
+   *     ListLocationsResponse response = entityTypesClient.listLocationsCallable().call(request);
+   *     for (Location element : response.getLocationsList()) {
+   *       // doThingsWith(element);
+   *     }
+   *     String nextPageToken = response.getNextPageToken();
+   *     if (!Strings.isNullOrEmpty(nextPageToken)) {
+   *       request = request.toBuilder().setPageToken(nextPageToken).build();
+   *     } else {
+   *       break;
+   *     }
+   *   }
+   * }
+   * }
+ */ + public final UnaryCallable listLocationsCallable() { + return stub.listLocationsCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Gets information about a location. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
+   * try (EntityTypesClient entityTypesClient = EntityTypesClient.create()) {
+   *   GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build();
+   *   Location response = entityTypesClient.getLocation(request);
+   * }
+   * }
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final Location getLocation(GetLocationRequest request) { + return getLocationCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Gets information about a location. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
+   * try (EntityTypesClient entityTypesClient = EntityTypesClient.create()) {
+   *   GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build();
+   *   ApiFuture future = entityTypesClient.getLocationCallable().futureCall(request);
+   *   // Do something.
+   *   Location response = future.get();
+   * }
+   * }
+ */ + public final UnaryCallable getLocationCallable() { + return stub.getLocationCallable(); + } + @Override public final void close() { stub.close(); @@ -2468,4 +2612,80 @@ protected ListEntityTypesFixedSizeCollection createCollection( return new ListEntityTypesFixedSizeCollection(pages, collectionSize); } } + + public static class ListLocationsPagedResponse + extends AbstractPagedListResponse< + ListLocationsRequest, + ListLocationsResponse, + Location, + ListLocationsPage, + ListLocationsFixedSizeCollection> { + + public static ApiFuture createAsync( + PageContext context, + ApiFuture futureResponse) { + ApiFuture futurePage = + ListLocationsPage.createEmptyPage().createPageAsync(context, futureResponse); + return ApiFutures.transform( + futurePage, + input -> new ListLocationsPagedResponse(input), + MoreExecutors.directExecutor()); + } + + private ListLocationsPagedResponse(ListLocationsPage page) { + super(page, ListLocationsFixedSizeCollection.createEmptyCollection()); + } + } + + public static class ListLocationsPage + extends AbstractPage< + ListLocationsRequest, ListLocationsResponse, Location, ListLocationsPage> { + + private ListLocationsPage( + PageContext context, + ListLocationsResponse response) { + super(context, response); + } + + private static ListLocationsPage createEmptyPage() { + return new ListLocationsPage(null, null); + } + + @Override + protected ListLocationsPage createPage( + PageContext context, + ListLocationsResponse response) { + return new ListLocationsPage(context, response); + } + + @Override + public ApiFuture createPageAsync( + PageContext context, + ApiFuture futureResponse) { + return super.createPageAsync(context, futureResponse); + } + } + + public static class ListLocationsFixedSizeCollection + extends AbstractFixedSizeCollection< + ListLocationsRequest, + ListLocationsResponse, + Location, + ListLocationsPage, + ListLocationsFixedSizeCollection> { + + private ListLocationsFixedSizeCollection(List pages, int collectionSize) { + super(pages, collectionSize); + } + + private static ListLocationsFixedSizeCollection createEmptyCollection() { + return new ListLocationsFixedSizeCollection(null, 0); + } + + @Override + protected ListLocationsFixedSizeCollection createCollection( + List pages, int collectionSize) { + return new ListLocationsFixedSizeCollection(pages, collectionSize); + } + } } diff --git a/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2beta1/EntityTypesSettings.java b/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2beta1/EntityTypesSettings.java index ff00337f9..84dbe23fc 100644 --- a/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2beta1/EntityTypesSettings.java +++ b/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2beta1/EntityTypesSettings.java @@ -17,6 +17,7 @@ package com.google.cloud.dialogflow.v2beta1; import static com.google.cloud.dialogflow.v2beta1.EntityTypesClient.ListEntityTypesPagedResponse; +import static com.google.cloud.dialogflow.v2beta1.EntityTypesClient.ListLocationsPagedResponse; import com.google.api.core.ApiFunction; import com.google.api.core.BetaApi; @@ -32,6 +33,10 @@ import com.google.api.gax.rpc.TransportChannelProvider; import com.google.api.gax.rpc.UnaryCallSettings; import com.google.cloud.dialogflow.v2beta1.stub.EntityTypesStubSettings; +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.ListLocationsResponse; +import com.google.cloud.location.Location; import com.google.longrunning.Operation; import com.google.protobuf.Empty; import com.google.protobuf.Struct; @@ -161,6 +166,17 @@ public UnaryCallSettings batchDeleteEntit return ((EntityTypesStubSettings) getStubSettings()).batchDeleteEntitiesOperationSettings(); } + /** Returns the object with the settings used for calls to listLocations. */ + public PagedCallSettings + listLocationsSettings() { + return ((EntityTypesStubSettings) getStubSettings()).listLocationsSettings(); + } + + /** Returns the object with the settings used for calls to getLocation. */ + public UnaryCallSettings getLocationSettings() { + return ((EntityTypesStubSettings) getStubSettings()).getLocationSettings(); + } + public static final EntityTypesSettings create(EntityTypesStubSettings stub) throws IOException { return new EntityTypesSettings.Builder(stub.toBuilder()).build(); } @@ -365,6 +381,18 @@ public UnaryCallSettings.Builder deleteEntityTyp return getStubSettingsBuilder().batchDeleteEntitiesOperationSettings(); } + /** Returns the builder for the settings used for calls to listLocations. */ + public PagedCallSettings.Builder< + ListLocationsRequest, ListLocationsResponse, ListLocationsPagedResponse> + listLocationsSettings() { + return getStubSettingsBuilder().listLocationsSettings(); + } + + /** Returns the builder for the settings used for calls to getLocation. */ + public UnaryCallSettings.Builder getLocationSettings() { + return getStubSettingsBuilder().getLocationSettings(); + } + @Override public EntityTypesSettings build() throws IOException { return new EntityTypesSettings(this); diff --git a/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2beta1/EnvironmentsClient.java b/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2beta1/EnvironmentsClient.java index a31ebc711..c0f9a18ec 100644 --- a/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2beta1/EnvironmentsClient.java +++ b/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2beta1/EnvironmentsClient.java @@ -27,6 +27,10 @@ import com.google.api.gax.rpc.UnaryCallable; import com.google.cloud.dialogflow.v2beta1.stub.EnvironmentsStub; import com.google.cloud.dialogflow.v2beta1.stub.EnvironmentsStubSettings; +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.ListLocationsResponse; +import com.google.cloud.location.Location; import com.google.common.util.concurrent.MoreExecutors; import com.google.protobuf.Empty; import java.io.IOException; @@ -653,6 +657,146 @@ public final GetEnvironmentHistoryPagedResponse getEnvironmentHistory( return stub.getEnvironmentHistoryCallable(); } + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Lists information about the supported locations for this service. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
+   * try (EnvironmentsClient environmentsClient = EnvironmentsClient.create()) {
+   *   ListLocationsRequest request =
+   *       ListLocationsRequest.newBuilder()
+   *           .setName("name3373707")
+   *           .setFilter("filter-1274492040")
+   *           .setPageSize(883849137)
+   *           .setPageToken("pageToken873572522")
+   *           .build();
+   *   for (Location element : environmentsClient.listLocations(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 + */ + public final ListLocationsPagedResponse listLocations(ListLocationsRequest request) { + return listLocationsPagedCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Lists information about the supported locations for this service. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
+   * try (EnvironmentsClient environmentsClient = EnvironmentsClient.create()) {
+   *   ListLocationsRequest request =
+   *       ListLocationsRequest.newBuilder()
+   *           .setName("name3373707")
+   *           .setFilter("filter-1274492040")
+   *           .setPageSize(883849137)
+   *           .setPageToken("pageToken873572522")
+   *           .build();
+   *   ApiFuture future =
+   *       environmentsClient.listLocationsPagedCallable().futureCall(request);
+   *   // Do something.
+   *   for (Location element : future.get().iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * }
+ */ + public final UnaryCallable + listLocationsPagedCallable() { + return stub.listLocationsPagedCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Lists information about the supported locations for this service. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
+   * try (EnvironmentsClient environmentsClient = EnvironmentsClient.create()) {
+   *   ListLocationsRequest request =
+   *       ListLocationsRequest.newBuilder()
+   *           .setName("name3373707")
+   *           .setFilter("filter-1274492040")
+   *           .setPageSize(883849137)
+   *           .setPageToken("pageToken873572522")
+   *           .build();
+   *   while (true) {
+   *     ListLocationsResponse response = environmentsClient.listLocationsCallable().call(request);
+   *     for (Location element : response.getLocationsList()) {
+   *       // doThingsWith(element);
+   *     }
+   *     String nextPageToken = response.getNextPageToken();
+   *     if (!Strings.isNullOrEmpty(nextPageToken)) {
+   *       request = request.toBuilder().setPageToken(nextPageToken).build();
+   *     } else {
+   *       break;
+   *     }
+   *   }
+   * }
+   * }
+ */ + public final UnaryCallable listLocationsCallable() { + return stub.listLocationsCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Gets information about a location. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
+   * try (EnvironmentsClient environmentsClient = EnvironmentsClient.create()) {
+   *   GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build();
+   *   Location response = environmentsClient.getLocation(request);
+   * }
+   * }
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final Location getLocation(GetLocationRequest request) { + return getLocationCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Gets information about a location. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
+   * try (EnvironmentsClient environmentsClient = EnvironmentsClient.create()) {
+   *   GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build();
+   *   ApiFuture future = environmentsClient.getLocationCallable().futureCall(request);
+   *   // Do something.
+   *   Location response = future.get();
+   * }
+   * }
+ */ + public final UnaryCallable getLocationCallable() { + return stub.getLocationCallable(); + } + @Override public final void close() { stub.close(); @@ -843,4 +987,80 @@ protected GetEnvironmentHistoryFixedSizeCollection createCollection( return new GetEnvironmentHistoryFixedSizeCollection(pages, collectionSize); } } + + public static class ListLocationsPagedResponse + extends AbstractPagedListResponse< + ListLocationsRequest, + ListLocationsResponse, + Location, + ListLocationsPage, + ListLocationsFixedSizeCollection> { + + public static ApiFuture createAsync( + PageContext context, + ApiFuture futureResponse) { + ApiFuture futurePage = + ListLocationsPage.createEmptyPage().createPageAsync(context, futureResponse); + return ApiFutures.transform( + futurePage, + input -> new ListLocationsPagedResponse(input), + MoreExecutors.directExecutor()); + } + + private ListLocationsPagedResponse(ListLocationsPage page) { + super(page, ListLocationsFixedSizeCollection.createEmptyCollection()); + } + } + + public static class ListLocationsPage + extends AbstractPage< + ListLocationsRequest, ListLocationsResponse, Location, ListLocationsPage> { + + private ListLocationsPage( + PageContext context, + ListLocationsResponse response) { + super(context, response); + } + + private static ListLocationsPage createEmptyPage() { + return new ListLocationsPage(null, null); + } + + @Override + protected ListLocationsPage createPage( + PageContext context, + ListLocationsResponse response) { + return new ListLocationsPage(context, response); + } + + @Override + public ApiFuture createPageAsync( + PageContext context, + ApiFuture futureResponse) { + return super.createPageAsync(context, futureResponse); + } + } + + public static class ListLocationsFixedSizeCollection + extends AbstractFixedSizeCollection< + ListLocationsRequest, + ListLocationsResponse, + Location, + ListLocationsPage, + ListLocationsFixedSizeCollection> { + + private ListLocationsFixedSizeCollection(List pages, int collectionSize) { + super(pages, collectionSize); + } + + private static ListLocationsFixedSizeCollection createEmptyCollection() { + return new ListLocationsFixedSizeCollection(null, 0); + } + + @Override + protected ListLocationsFixedSizeCollection createCollection( + List pages, int collectionSize) { + return new ListLocationsFixedSizeCollection(pages, collectionSize); + } + } } diff --git a/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2beta1/EnvironmentsSettings.java b/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2beta1/EnvironmentsSettings.java index 50f3de85f..654d1601e 100644 --- a/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2beta1/EnvironmentsSettings.java +++ b/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2beta1/EnvironmentsSettings.java @@ -18,6 +18,7 @@ import static com.google.cloud.dialogflow.v2beta1.EnvironmentsClient.GetEnvironmentHistoryPagedResponse; import static com.google.cloud.dialogflow.v2beta1.EnvironmentsClient.ListEnvironmentsPagedResponse; +import static com.google.cloud.dialogflow.v2beta1.EnvironmentsClient.ListLocationsPagedResponse; import com.google.api.core.ApiFunction; import com.google.api.core.BetaApi; @@ -32,6 +33,10 @@ import com.google.api.gax.rpc.TransportChannelProvider; import com.google.api.gax.rpc.UnaryCallSettings; import com.google.cloud.dialogflow.v2beta1.stub.EnvironmentsStubSettings; +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.ListLocationsResponse; +import com.google.cloud.location.Location; import com.google.protobuf.Empty; import java.io.IOException; import java.util.List; @@ -108,6 +113,17 @@ public UnaryCallSettings deleteEnvironmentSetti return ((EnvironmentsStubSettings) getStubSettings()).getEnvironmentHistorySettings(); } + /** Returns the object with the settings used for calls to listLocations. */ + public PagedCallSettings + listLocationsSettings() { + return ((EnvironmentsStubSettings) getStubSettings()).listLocationsSettings(); + } + + /** Returns the object with the settings used for calls to getLocation. */ + public UnaryCallSettings getLocationSettings() { + return ((EnvironmentsStubSettings) getStubSettings()).getLocationSettings(); + } + public static final EnvironmentsSettings create(EnvironmentsStubSettings stub) throws IOException { return new EnvironmentsSettings.Builder(stub.toBuilder()).build(); @@ -259,6 +275,18 @@ public UnaryCallSettings.Builder deleteEnvironm return getStubSettingsBuilder().getEnvironmentHistorySettings(); } + /** Returns the builder for the settings used for calls to listLocations. */ + public PagedCallSettings.Builder< + ListLocationsRequest, ListLocationsResponse, ListLocationsPagedResponse> + listLocationsSettings() { + return getStubSettingsBuilder().listLocationsSettings(); + } + + /** Returns the builder for the settings used for calls to getLocation. */ + public UnaryCallSettings.Builder getLocationSettings() { + return getStubSettingsBuilder().getLocationSettings(); + } + @Override public EnvironmentsSettings build() throws IOException { return new EnvironmentsSettings(this); diff --git a/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2beta1/FulfillmentsClient.java b/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2beta1/FulfillmentsClient.java index 832acf2b6..05830cd6c 100644 --- a/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2beta1/FulfillmentsClient.java +++ b/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2beta1/FulfillmentsClient.java @@ -16,13 +16,25 @@ package com.google.cloud.dialogflow.v2beta1; +import com.google.api.core.ApiFuture; +import com.google.api.core.ApiFutures; import com.google.api.core.BetaApi; import com.google.api.gax.core.BackgroundResource; +import com.google.api.gax.paging.AbstractFixedSizeCollection; +import com.google.api.gax.paging.AbstractPage; +import com.google.api.gax.paging.AbstractPagedListResponse; +import com.google.api.gax.rpc.PageContext; import com.google.api.gax.rpc.UnaryCallable; import com.google.cloud.dialogflow.v2beta1.stub.FulfillmentsStub; import com.google.cloud.dialogflow.v2beta1.stub.FulfillmentsStubSettings; +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.ListLocationsResponse; +import com.google.cloud.location.Location; +import com.google.common.util.concurrent.MoreExecutors; import com.google.protobuf.FieldMask; import java.io.IOException; +import java.util.List; import java.util.concurrent.TimeUnit; import javax.annotation.Generated; @@ -340,6 +352,146 @@ public final UnaryCallable updateFulfillm return stub.updateFulfillmentCallable(); } + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Lists information about the supported locations for this service. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
+   * try (FulfillmentsClient fulfillmentsClient = FulfillmentsClient.create()) {
+   *   ListLocationsRequest request =
+   *       ListLocationsRequest.newBuilder()
+   *           .setName("name3373707")
+   *           .setFilter("filter-1274492040")
+   *           .setPageSize(883849137)
+   *           .setPageToken("pageToken873572522")
+   *           .build();
+   *   for (Location element : fulfillmentsClient.listLocations(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 + */ + public final ListLocationsPagedResponse listLocations(ListLocationsRequest request) { + return listLocationsPagedCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Lists information about the supported locations for this service. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
+   * try (FulfillmentsClient fulfillmentsClient = FulfillmentsClient.create()) {
+   *   ListLocationsRequest request =
+   *       ListLocationsRequest.newBuilder()
+   *           .setName("name3373707")
+   *           .setFilter("filter-1274492040")
+   *           .setPageSize(883849137)
+   *           .setPageToken("pageToken873572522")
+   *           .build();
+   *   ApiFuture future =
+   *       fulfillmentsClient.listLocationsPagedCallable().futureCall(request);
+   *   // Do something.
+   *   for (Location element : future.get().iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * }
+ */ + public final UnaryCallable + listLocationsPagedCallable() { + return stub.listLocationsPagedCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Lists information about the supported locations for this service. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
+   * try (FulfillmentsClient fulfillmentsClient = FulfillmentsClient.create()) {
+   *   ListLocationsRequest request =
+   *       ListLocationsRequest.newBuilder()
+   *           .setName("name3373707")
+   *           .setFilter("filter-1274492040")
+   *           .setPageSize(883849137)
+   *           .setPageToken("pageToken873572522")
+   *           .build();
+   *   while (true) {
+   *     ListLocationsResponse response = fulfillmentsClient.listLocationsCallable().call(request);
+   *     for (Location element : response.getLocationsList()) {
+   *       // doThingsWith(element);
+   *     }
+   *     String nextPageToken = response.getNextPageToken();
+   *     if (!Strings.isNullOrEmpty(nextPageToken)) {
+   *       request = request.toBuilder().setPageToken(nextPageToken).build();
+   *     } else {
+   *       break;
+   *     }
+   *   }
+   * }
+   * }
+ */ + public final UnaryCallable listLocationsCallable() { + return stub.listLocationsCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Gets information about a location. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
+   * try (FulfillmentsClient fulfillmentsClient = FulfillmentsClient.create()) {
+   *   GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build();
+   *   Location response = fulfillmentsClient.getLocation(request);
+   * }
+   * }
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final Location getLocation(GetLocationRequest request) { + return getLocationCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Gets information about a location. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
+   * try (FulfillmentsClient fulfillmentsClient = FulfillmentsClient.create()) {
+   *   GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build();
+   *   ApiFuture future = fulfillmentsClient.getLocationCallable().futureCall(request);
+   *   // Do something.
+   *   Location response = future.get();
+   * }
+   * }
+ */ + public final UnaryCallable getLocationCallable() { + return stub.getLocationCallable(); + } + @Override public final void close() { stub.close(); @@ -369,4 +521,80 @@ public void shutdownNow() { public boolean awaitTermination(long duration, TimeUnit unit) throws InterruptedException { return stub.awaitTermination(duration, unit); } + + public static class ListLocationsPagedResponse + extends AbstractPagedListResponse< + ListLocationsRequest, + ListLocationsResponse, + Location, + ListLocationsPage, + ListLocationsFixedSizeCollection> { + + public static ApiFuture createAsync( + PageContext context, + ApiFuture futureResponse) { + ApiFuture futurePage = + ListLocationsPage.createEmptyPage().createPageAsync(context, futureResponse); + return ApiFutures.transform( + futurePage, + input -> new ListLocationsPagedResponse(input), + MoreExecutors.directExecutor()); + } + + private ListLocationsPagedResponse(ListLocationsPage page) { + super(page, ListLocationsFixedSizeCollection.createEmptyCollection()); + } + } + + public static class ListLocationsPage + extends AbstractPage< + ListLocationsRequest, ListLocationsResponse, Location, ListLocationsPage> { + + private ListLocationsPage( + PageContext context, + ListLocationsResponse response) { + super(context, response); + } + + private static ListLocationsPage createEmptyPage() { + return new ListLocationsPage(null, null); + } + + @Override + protected ListLocationsPage createPage( + PageContext context, + ListLocationsResponse response) { + return new ListLocationsPage(context, response); + } + + @Override + public ApiFuture createPageAsync( + PageContext context, + ApiFuture futureResponse) { + return super.createPageAsync(context, futureResponse); + } + } + + public static class ListLocationsFixedSizeCollection + extends AbstractFixedSizeCollection< + ListLocationsRequest, + ListLocationsResponse, + Location, + ListLocationsPage, + ListLocationsFixedSizeCollection> { + + private ListLocationsFixedSizeCollection(List pages, int collectionSize) { + super(pages, collectionSize); + } + + private static ListLocationsFixedSizeCollection createEmptyCollection() { + return new ListLocationsFixedSizeCollection(null, 0); + } + + @Override + protected ListLocationsFixedSizeCollection createCollection( + List pages, int collectionSize) { + return new ListLocationsFixedSizeCollection(pages, collectionSize); + } + } } diff --git a/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2beta1/FulfillmentsSettings.java b/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2beta1/FulfillmentsSettings.java index 8576ba009..a5d65b120 100644 --- a/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2beta1/FulfillmentsSettings.java +++ b/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2beta1/FulfillmentsSettings.java @@ -16,6 +16,8 @@ package com.google.cloud.dialogflow.v2beta1; +import static com.google.cloud.dialogflow.v2beta1.FulfillmentsClient.ListLocationsPagedResponse; + import com.google.api.core.ApiFunction; import com.google.api.core.BetaApi; import com.google.api.gax.core.GoogleCredentialsProvider; @@ -25,9 +27,14 @@ import com.google.api.gax.rpc.ApiClientHeaderProvider; import com.google.api.gax.rpc.ClientContext; import com.google.api.gax.rpc.ClientSettings; +import com.google.api.gax.rpc.PagedCallSettings; import com.google.api.gax.rpc.TransportChannelProvider; import com.google.api.gax.rpc.UnaryCallSettings; import com.google.cloud.dialogflow.v2beta1.stub.FulfillmentsStubSettings; +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.ListLocationsResponse; +import com.google.cloud.location.Location; import java.io.IOException; import java.util.List; import javax.annotation.Generated; @@ -79,6 +86,17 @@ public UnaryCallSettings updateFulfillmen return ((FulfillmentsStubSettings) getStubSettings()).updateFulfillmentSettings(); } + /** Returns the object with the settings used for calls to listLocations. */ + public PagedCallSettings + listLocationsSettings() { + return ((FulfillmentsStubSettings) getStubSettings()).listLocationsSettings(); + } + + /** Returns the object with the settings used for calls to getLocation. */ + public UnaryCallSettings getLocationSettings() { + return ((FulfillmentsStubSettings) getStubSettings()).getLocationSettings(); + } + public static final FulfillmentsSettings create(FulfillmentsStubSettings stub) throws IOException { return new FulfillmentsSettings.Builder(stub.toBuilder()).build(); @@ -205,6 +223,18 @@ public UnaryCallSettings.Builder getFulfillm return getStubSettingsBuilder().updateFulfillmentSettings(); } + /** Returns the builder for the settings used for calls to listLocations. */ + public PagedCallSettings.Builder< + ListLocationsRequest, ListLocationsResponse, ListLocationsPagedResponse> + listLocationsSettings() { + return getStubSettingsBuilder().listLocationsSettings(); + } + + /** Returns the builder for the settings used for calls to getLocation. */ + public UnaryCallSettings.Builder getLocationSettings() { + return getStubSettingsBuilder().getLocationSettings(); + } + @Override public FulfillmentsSettings build() throws IOException { return new FulfillmentsSettings(this); diff --git a/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2beta1/IntentsClient.java b/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2beta1/IntentsClient.java index cba1b68fe..c7d821ca5 100644 --- a/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2beta1/IntentsClient.java +++ b/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2beta1/IntentsClient.java @@ -30,6 +30,10 @@ import com.google.api.gax.rpc.UnaryCallable; import com.google.cloud.dialogflow.v2beta1.stub.IntentsStub; import com.google.cloud.dialogflow.v2beta1.stub.IntentsStubSettings; +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.ListLocationsResponse; +import com.google.cloud.location.Location; import com.google.common.util.concurrent.MoreExecutors; import com.google.longrunning.Operation; import com.google.protobuf.Empty; @@ -1624,6 +1628,145 @@ public final UnaryCallable batchDeleteInte return stub.batchDeleteIntentsCallable(); } + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Lists information about the supported locations for this service. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
+   * try (IntentsClient intentsClient = IntentsClient.create()) {
+   *   ListLocationsRequest request =
+   *       ListLocationsRequest.newBuilder()
+   *           .setName("name3373707")
+   *           .setFilter("filter-1274492040")
+   *           .setPageSize(883849137)
+   *           .setPageToken("pageToken873572522")
+   *           .build();
+   *   for (Location element : intentsClient.listLocations(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 + */ + public final ListLocationsPagedResponse listLocations(ListLocationsRequest request) { + return listLocationsPagedCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Lists information about the supported locations for this service. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
+   * try (IntentsClient intentsClient = IntentsClient.create()) {
+   *   ListLocationsRequest request =
+   *       ListLocationsRequest.newBuilder()
+   *           .setName("name3373707")
+   *           .setFilter("filter-1274492040")
+   *           .setPageSize(883849137)
+   *           .setPageToken("pageToken873572522")
+   *           .build();
+   *   ApiFuture future = intentsClient.listLocationsPagedCallable().futureCall(request);
+   *   // Do something.
+   *   for (Location element : future.get().iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * }
+ */ + public final UnaryCallable + listLocationsPagedCallable() { + return stub.listLocationsPagedCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Lists information about the supported locations for this service. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
+   * try (IntentsClient intentsClient = IntentsClient.create()) {
+   *   ListLocationsRequest request =
+   *       ListLocationsRequest.newBuilder()
+   *           .setName("name3373707")
+   *           .setFilter("filter-1274492040")
+   *           .setPageSize(883849137)
+   *           .setPageToken("pageToken873572522")
+   *           .build();
+   *   while (true) {
+   *     ListLocationsResponse response = intentsClient.listLocationsCallable().call(request);
+   *     for (Location element : response.getLocationsList()) {
+   *       // doThingsWith(element);
+   *     }
+   *     String nextPageToken = response.getNextPageToken();
+   *     if (!Strings.isNullOrEmpty(nextPageToken)) {
+   *       request = request.toBuilder().setPageToken(nextPageToken).build();
+   *     } else {
+   *       break;
+   *     }
+   *   }
+   * }
+   * }
+ */ + public final UnaryCallable listLocationsCallable() { + return stub.listLocationsCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Gets information about a location. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
+   * try (IntentsClient intentsClient = IntentsClient.create()) {
+   *   GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build();
+   *   Location response = intentsClient.getLocation(request);
+   * }
+   * }
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final Location getLocation(GetLocationRequest request) { + return getLocationCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Gets information about a location. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
+   * try (IntentsClient intentsClient = IntentsClient.create()) {
+   *   GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build();
+   *   ApiFuture future = intentsClient.getLocationCallable().futureCall(request);
+   *   // Do something.
+   *   Location response = future.get();
+   * }
+   * }
+ */ + public final UnaryCallable getLocationCallable() { + return stub.getLocationCallable(); + } + @Override public final void close() { stub.close(); @@ -1726,4 +1869,80 @@ protected ListIntentsFixedSizeCollection createCollection( return new ListIntentsFixedSizeCollection(pages, collectionSize); } } + + public static class ListLocationsPagedResponse + extends AbstractPagedListResponse< + ListLocationsRequest, + ListLocationsResponse, + Location, + ListLocationsPage, + ListLocationsFixedSizeCollection> { + + public static ApiFuture createAsync( + PageContext context, + ApiFuture futureResponse) { + ApiFuture futurePage = + ListLocationsPage.createEmptyPage().createPageAsync(context, futureResponse); + return ApiFutures.transform( + futurePage, + input -> new ListLocationsPagedResponse(input), + MoreExecutors.directExecutor()); + } + + private ListLocationsPagedResponse(ListLocationsPage page) { + super(page, ListLocationsFixedSizeCollection.createEmptyCollection()); + } + } + + public static class ListLocationsPage + extends AbstractPage< + ListLocationsRequest, ListLocationsResponse, Location, ListLocationsPage> { + + private ListLocationsPage( + PageContext context, + ListLocationsResponse response) { + super(context, response); + } + + private static ListLocationsPage createEmptyPage() { + return new ListLocationsPage(null, null); + } + + @Override + protected ListLocationsPage createPage( + PageContext context, + ListLocationsResponse response) { + return new ListLocationsPage(context, response); + } + + @Override + public ApiFuture createPageAsync( + PageContext context, + ApiFuture futureResponse) { + return super.createPageAsync(context, futureResponse); + } + } + + public static class ListLocationsFixedSizeCollection + extends AbstractFixedSizeCollection< + ListLocationsRequest, + ListLocationsResponse, + Location, + ListLocationsPage, + ListLocationsFixedSizeCollection> { + + private ListLocationsFixedSizeCollection(List pages, int collectionSize) { + super(pages, collectionSize); + } + + private static ListLocationsFixedSizeCollection createEmptyCollection() { + return new ListLocationsFixedSizeCollection(null, 0); + } + + @Override + protected ListLocationsFixedSizeCollection createCollection( + List pages, int collectionSize) { + return new ListLocationsFixedSizeCollection(pages, collectionSize); + } + } } diff --git a/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2beta1/IntentsSettings.java b/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2beta1/IntentsSettings.java index 066e89c95..8e9280a19 100644 --- a/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2beta1/IntentsSettings.java +++ b/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2beta1/IntentsSettings.java @@ -17,6 +17,7 @@ package com.google.cloud.dialogflow.v2beta1; import static com.google.cloud.dialogflow.v2beta1.IntentsClient.ListIntentsPagedResponse; +import static com.google.cloud.dialogflow.v2beta1.IntentsClient.ListLocationsPagedResponse; import com.google.api.core.ApiFunction; import com.google.api.core.BetaApi; @@ -32,6 +33,10 @@ import com.google.api.gax.rpc.TransportChannelProvider; import com.google.api.gax.rpc.UnaryCallSettings; import com.google.cloud.dialogflow.v2beta1.stub.IntentsStubSettings; +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.ListLocationsResponse; +import com.google.cloud.location.Location; import com.google.longrunning.Operation; import com.google.protobuf.Empty; import com.google.protobuf.Struct; @@ -124,6 +129,17 @@ public UnaryCallSettings batchDeleteIntent return ((IntentsStubSettings) getStubSettings()).batchDeleteIntentsOperationSettings(); } + /** Returns the object with the settings used for calls to listLocations. */ + public PagedCallSettings + listLocationsSettings() { + return ((IntentsStubSettings) getStubSettings()).listLocationsSettings(); + } + + /** Returns the object with the settings used for calls to getLocation. */ + public UnaryCallSettings getLocationSettings() { + return ((IntentsStubSettings) getStubSettings()).getLocationSettings(); + } + public static final IntentsSettings create(IntentsStubSettings stub) throws IOException { return new IntentsSettings.Builder(stub.toBuilder()).build(); } @@ -290,6 +306,18 @@ public UnaryCallSettings.Builder deleteIntentSetting return getStubSettingsBuilder().batchDeleteIntentsOperationSettings(); } + /** Returns the builder for the settings used for calls to listLocations. */ + public PagedCallSettings.Builder< + ListLocationsRequest, ListLocationsResponse, ListLocationsPagedResponse> + listLocationsSettings() { + return getStubSettingsBuilder().listLocationsSettings(); + } + + /** Returns the builder for the settings used for calls to getLocation. */ + public UnaryCallSettings.Builder getLocationSettings() { + return getStubSettingsBuilder().getLocationSettings(); + } + @Override public IntentsSettings build() throws IOException { return new IntentsSettings(this); diff --git a/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2beta1/KnowledgeBasesClient.java b/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2beta1/KnowledgeBasesClient.java index 6222bf4c3..7ee317072 100644 --- a/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2beta1/KnowledgeBasesClient.java +++ b/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2beta1/KnowledgeBasesClient.java @@ -27,6 +27,10 @@ import com.google.api.gax.rpc.UnaryCallable; import com.google.cloud.dialogflow.v2beta1.stub.KnowledgeBasesStub; import com.google.cloud.dialogflow.v2beta1.stub.KnowledgeBasesStubSettings; +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.ListLocationsResponse; +import com.google.cloud.location.Location; import com.google.common.util.concurrent.MoreExecutors; import com.google.protobuf.Empty; import com.google.protobuf.FieldMask; @@ -888,6 +892,146 @@ public final KnowledgeBase updateKnowledgeBase(UpdateKnowledgeBaseRequest reques return stub.updateKnowledgeBaseCallable(); } + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Lists information about the supported locations for this service. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
+   * try (KnowledgeBasesClient knowledgeBasesClient = KnowledgeBasesClient.create()) {
+   *   ListLocationsRequest request =
+   *       ListLocationsRequest.newBuilder()
+   *           .setName("name3373707")
+   *           .setFilter("filter-1274492040")
+   *           .setPageSize(883849137)
+   *           .setPageToken("pageToken873572522")
+   *           .build();
+   *   for (Location element : knowledgeBasesClient.listLocations(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 + */ + public final ListLocationsPagedResponse listLocations(ListLocationsRequest request) { + return listLocationsPagedCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Lists information about the supported locations for this service. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
+   * try (KnowledgeBasesClient knowledgeBasesClient = KnowledgeBasesClient.create()) {
+   *   ListLocationsRequest request =
+   *       ListLocationsRequest.newBuilder()
+   *           .setName("name3373707")
+   *           .setFilter("filter-1274492040")
+   *           .setPageSize(883849137)
+   *           .setPageToken("pageToken873572522")
+   *           .build();
+   *   ApiFuture future =
+   *       knowledgeBasesClient.listLocationsPagedCallable().futureCall(request);
+   *   // Do something.
+   *   for (Location element : future.get().iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * }
+ */ + public final UnaryCallable + listLocationsPagedCallable() { + return stub.listLocationsPagedCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Lists information about the supported locations for this service. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
+   * try (KnowledgeBasesClient knowledgeBasesClient = KnowledgeBasesClient.create()) {
+   *   ListLocationsRequest request =
+   *       ListLocationsRequest.newBuilder()
+   *           .setName("name3373707")
+   *           .setFilter("filter-1274492040")
+   *           .setPageSize(883849137)
+   *           .setPageToken("pageToken873572522")
+   *           .build();
+   *   while (true) {
+   *     ListLocationsResponse response = knowledgeBasesClient.listLocationsCallable().call(request);
+   *     for (Location element : response.getLocationsList()) {
+   *       // doThingsWith(element);
+   *     }
+   *     String nextPageToken = response.getNextPageToken();
+   *     if (!Strings.isNullOrEmpty(nextPageToken)) {
+   *       request = request.toBuilder().setPageToken(nextPageToken).build();
+   *     } else {
+   *       break;
+   *     }
+   *   }
+   * }
+   * }
+ */ + public final UnaryCallable listLocationsCallable() { + return stub.listLocationsCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Gets information about a location. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
+   * try (KnowledgeBasesClient knowledgeBasesClient = KnowledgeBasesClient.create()) {
+   *   GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build();
+   *   Location response = knowledgeBasesClient.getLocation(request);
+   * }
+   * }
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final Location getLocation(GetLocationRequest request) { + return getLocationCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Gets information about a location. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
+   * try (KnowledgeBasesClient knowledgeBasesClient = KnowledgeBasesClient.create()) {
+   *   GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build();
+   *   ApiFuture future = knowledgeBasesClient.getLocationCallable().futureCall(request);
+   *   // Do something.
+   *   Location response = future.get();
+   * }
+   * }
+ */ + public final UnaryCallable getLocationCallable() { + return stub.getLocationCallable(); + } + @Override public final void close() { stub.close(); @@ -997,4 +1141,80 @@ protected ListKnowledgeBasesFixedSizeCollection createCollection( return new ListKnowledgeBasesFixedSizeCollection(pages, collectionSize); } } + + public static class ListLocationsPagedResponse + extends AbstractPagedListResponse< + ListLocationsRequest, + ListLocationsResponse, + Location, + ListLocationsPage, + ListLocationsFixedSizeCollection> { + + public static ApiFuture createAsync( + PageContext context, + ApiFuture futureResponse) { + ApiFuture futurePage = + ListLocationsPage.createEmptyPage().createPageAsync(context, futureResponse); + return ApiFutures.transform( + futurePage, + input -> new ListLocationsPagedResponse(input), + MoreExecutors.directExecutor()); + } + + private ListLocationsPagedResponse(ListLocationsPage page) { + super(page, ListLocationsFixedSizeCollection.createEmptyCollection()); + } + } + + public static class ListLocationsPage + extends AbstractPage< + ListLocationsRequest, ListLocationsResponse, Location, ListLocationsPage> { + + private ListLocationsPage( + PageContext context, + ListLocationsResponse response) { + super(context, response); + } + + private static ListLocationsPage createEmptyPage() { + return new ListLocationsPage(null, null); + } + + @Override + protected ListLocationsPage createPage( + PageContext context, + ListLocationsResponse response) { + return new ListLocationsPage(context, response); + } + + @Override + public ApiFuture createPageAsync( + PageContext context, + ApiFuture futureResponse) { + return super.createPageAsync(context, futureResponse); + } + } + + public static class ListLocationsFixedSizeCollection + extends AbstractFixedSizeCollection< + ListLocationsRequest, + ListLocationsResponse, + Location, + ListLocationsPage, + ListLocationsFixedSizeCollection> { + + private ListLocationsFixedSizeCollection(List pages, int collectionSize) { + super(pages, collectionSize); + } + + private static ListLocationsFixedSizeCollection createEmptyCollection() { + return new ListLocationsFixedSizeCollection(null, 0); + } + + @Override + protected ListLocationsFixedSizeCollection createCollection( + List pages, int collectionSize) { + return new ListLocationsFixedSizeCollection(pages, collectionSize); + } + } } diff --git a/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2beta1/KnowledgeBasesSettings.java b/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2beta1/KnowledgeBasesSettings.java index eb3155ca4..b56c1e933 100644 --- a/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2beta1/KnowledgeBasesSettings.java +++ b/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2beta1/KnowledgeBasesSettings.java @@ -17,6 +17,7 @@ package com.google.cloud.dialogflow.v2beta1; import static com.google.cloud.dialogflow.v2beta1.KnowledgeBasesClient.ListKnowledgeBasesPagedResponse; +import static com.google.cloud.dialogflow.v2beta1.KnowledgeBasesClient.ListLocationsPagedResponse; import com.google.api.core.ApiFunction; import com.google.api.core.BetaApi; @@ -31,6 +32,10 @@ import com.google.api.gax.rpc.TransportChannelProvider; import com.google.api.gax.rpc.UnaryCallSettings; import com.google.cloud.dialogflow.v2beta1.stub.KnowledgeBasesStubSettings; +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.ListLocationsResponse; +import com.google.cloud.location.Location; import com.google.protobuf.Empty; import java.io.IOException; import java.util.List; @@ -103,6 +108,17 @@ public UnaryCallSettings deleteKnowledgeBaseS return ((KnowledgeBasesStubSettings) getStubSettings()).updateKnowledgeBaseSettings(); } + /** Returns the object with the settings used for calls to listLocations. */ + public PagedCallSettings + listLocationsSettings() { + return ((KnowledgeBasesStubSettings) getStubSettings()).listLocationsSettings(); + } + + /** Returns the object with the settings used for calls to getLocation. */ + public UnaryCallSettings getLocationSettings() { + return ((KnowledgeBasesStubSettings) getStubSettings()).getLocationSettings(); + } + public static final KnowledgeBasesSettings create(KnowledgeBasesStubSettings stub) throws IOException { return new KnowledgeBasesSettings.Builder(stub.toBuilder()).build(); @@ -249,6 +265,18 @@ public Builder applyToAllUnaryMethods( return getStubSettingsBuilder().updateKnowledgeBaseSettings(); } + /** Returns the builder for the settings used for calls to listLocations. */ + public PagedCallSettings.Builder< + ListLocationsRequest, ListLocationsResponse, ListLocationsPagedResponse> + listLocationsSettings() { + return getStubSettingsBuilder().listLocationsSettings(); + } + + /** Returns the builder for the settings used for calls to getLocation. */ + public UnaryCallSettings.Builder getLocationSettings() { + return getStubSettingsBuilder().getLocationSettings(); + } + @Override public KnowledgeBasesSettings build() throws IOException { return new KnowledgeBasesSettings(this); diff --git a/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2beta1/ParticipantsClient.java b/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2beta1/ParticipantsClient.java index 99d20f9fd..93b9f7e92 100644 --- a/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2beta1/ParticipantsClient.java +++ b/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2beta1/ParticipantsClient.java @@ -28,6 +28,10 @@ import com.google.api.gax.rpc.UnaryCallable; import com.google.cloud.dialogflow.v2beta1.stub.ParticipantsStub; import com.google.cloud.dialogflow.v2beta1.stub.ParticipantsStubSettings; +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.ListLocationsResponse; +import com.google.cloud.location.Location; import com.google.common.util.concurrent.MoreExecutors; import com.google.protobuf.FieldMask; import java.io.IOException; @@ -640,6 +644,44 @@ public final UnaryCallable updateParticip return stub.updateParticipantCallable(); } + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Adds a text (chat, for example), or audio (phone recording, for example) message from a + * participant into the conversation. + * + *

Note: Always use agent versions for production traffic sent to virtual agents. See [Versions + * and environments](https://cloud.google.com/dialogflow/es/docs/agents-versions). + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
+   * try (ParticipantsClient participantsClient = ParticipantsClient.create()) {
+   *   ParticipantName participant =
+   *       ParticipantName.ofProjectConversationParticipantName(
+   *           "[PROJECT]", "[CONVERSATION]", "[PARTICIPANT]");
+   *   AudioInput audioInput = AudioInput.newBuilder().build();
+   *   AnalyzeContentResponse response = participantsClient.analyzeContent(participant, audioInput);
+   * }
+   * }
+ * + * @param participant Required. The name of the participant this text comes from. Format: + * `projects/<Project ID>/locations/<Location ID>/conversations/<Conversation + * ID>/participants/<Participant ID>`. + * @param audioInput The natural language speech audio to be processed. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final AnalyzeContentResponse analyzeContent( + ParticipantName participant, AudioInput audioInput) { + AnalyzeContentRequest request = + AnalyzeContentRequest.newBuilder() + .setParticipant(participant == null ? null : participant.toString()) + .setAudioInput(audioInput) + .build(); + return analyzeContent(request); + } + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Adds a text (chat, for example), or audio (phone recording, for example) message from a @@ -716,6 +758,44 @@ public final AnalyzeContentResponse analyzeContent( return analyzeContent(request); } + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Adds a text (chat, for example), or audio (phone recording, for example) message from a + * participant into the conversation. + * + *

Note: Always use agent versions for production traffic sent to virtual agents. See [Versions + * and environments](https://cloud.google.com/dialogflow/es/docs/agents-versions). + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
+   * try (ParticipantsClient participantsClient = ParticipantsClient.create()) {
+   *   String participant =
+   *       ParticipantName.ofProjectConversationParticipantName(
+   *               "[PROJECT]", "[CONVERSATION]", "[PARTICIPANT]")
+   *           .toString();
+   *   AudioInput audioInput = AudioInput.newBuilder().build();
+   *   AnalyzeContentResponse response = participantsClient.analyzeContent(participant, audioInput);
+   * }
+   * }
+ * + * @param participant Required. The name of the participant this text comes from. Format: + * `projects/<Project ID>/locations/<Location ID>/conversations/<Conversation + * ID>/participants/<Participant ID>`. + * @param audioInput The natural language speech audio to be processed. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final AnalyzeContentResponse analyzeContent(String participant, AudioInput audioInput) { + AnalyzeContentRequest request = + AnalyzeContentRequest.newBuilder() + .setParticipant(participant) + .setAudioInput(audioInput) + .build(); + return analyzeContent(request); + } + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Adds a text (chat, for example), or audio (phone recording, for example) message from a @@ -816,6 +896,7 @@ public final AnalyzeContentResponse analyzeContent(String participant, TextInput * .setQueryParams(QueryParameters.newBuilder().build()) * .setAssistQueryParams(AssistQueryParameters.newBuilder().build()) * .setCxParameters(Struct.newBuilder().build()) + * .setCxCurrentPage("cxCurrentPage1596907507") * .setMessageSendTime(Timestamp.newBuilder().build()) * .setRequestId("requestId693933066") * .build(); @@ -854,6 +935,7 @@ public final AnalyzeContentResponse analyzeContent(AnalyzeContentRequest request * .setQueryParams(QueryParameters.newBuilder().build()) * .setAssistQueryParams(AssistQueryParameters.newBuilder().build()) * .setCxParameters(Struct.newBuilder().build()) + * .setCxCurrentPage("cxCurrentPage1596907507") * .setMessageSendTime(Timestamp.newBuilder().build()) * .setRequestId("requestId693933066") * .build(); @@ -901,6 +983,7 @@ public final AnalyzeContentResponse analyzeContent(AnalyzeContentRequest request * .setQueryParams(QueryParameters.newBuilder().build()) * .setAssistQueryParams(AssistQueryParameters.newBuilder().build()) * .setCxParameters(Struct.newBuilder().build()) + * .setCxCurrentPage("cxCurrentPage1596907507") * .setEnablePartialAutomatedAgentReply(true) * .build(); * bidiStream.send(request); @@ -1546,6 +1629,146 @@ public final CompileSuggestionResponse compileSuggestion(CompileSuggestionReques return stub.compileSuggestionCallable(); } + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Lists information about the supported locations for this service. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
+   * try (ParticipantsClient participantsClient = ParticipantsClient.create()) {
+   *   ListLocationsRequest request =
+   *       ListLocationsRequest.newBuilder()
+   *           .setName("name3373707")
+   *           .setFilter("filter-1274492040")
+   *           .setPageSize(883849137)
+   *           .setPageToken("pageToken873572522")
+   *           .build();
+   *   for (Location element : participantsClient.listLocations(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 + */ + public final ListLocationsPagedResponse listLocations(ListLocationsRequest request) { + return listLocationsPagedCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Lists information about the supported locations for this service. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
+   * try (ParticipantsClient participantsClient = ParticipantsClient.create()) {
+   *   ListLocationsRequest request =
+   *       ListLocationsRequest.newBuilder()
+   *           .setName("name3373707")
+   *           .setFilter("filter-1274492040")
+   *           .setPageSize(883849137)
+   *           .setPageToken("pageToken873572522")
+   *           .build();
+   *   ApiFuture future =
+   *       participantsClient.listLocationsPagedCallable().futureCall(request);
+   *   // Do something.
+   *   for (Location element : future.get().iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * }
+ */ + public final UnaryCallable + listLocationsPagedCallable() { + return stub.listLocationsPagedCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Lists information about the supported locations for this service. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
+   * try (ParticipantsClient participantsClient = ParticipantsClient.create()) {
+   *   ListLocationsRequest request =
+   *       ListLocationsRequest.newBuilder()
+   *           .setName("name3373707")
+   *           .setFilter("filter-1274492040")
+   *           .setPageSize(883849137)
+   *           .setPageToken("pageToken873572522")
+   *           .build();
+   *   while (true) {
+   *     ListLocationsResponse response = participantsClient.listLocationsCallable().call(request);
+   *     for (Location element : response.getLocationsList()) {
+   *       // doThingsWith(element);
+   *     }
+   *     String nextPageToken = response.getNextPageToken();
+   *     if (!Strings.isNullOrEmpty(nextPageToken)) {
+   *       request = request.toBuilder().setPageToken(nextPageToken).build();
+   *     } else {
+   *       break;
+   *     }
+   *   }
+   * }
+   * }
+ */ + public final UnaryCallable listLocationsCallable() { + return stub.listLocationsCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Gets information about a location. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
+   * try (ParticipantsClient participantsClient = ParticipantsClient.create()) {
+   *   GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build();
+   *   Location response = participantsClient.getLocation(request);
+   * }
+   * }
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final Location getLocation(GetLocationRequest request) { + return getLocationCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Gets information about a location. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
+   * try (ParticipantsClient participantsClient = ParticipantsClient.create()) {
+   *   GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build();
+   *   ApiFuture future = participantsClient.getLocationCallable().futureCall(request);
+   *   // Do something.
+   *   Location response = future.get();
+   * }
+   * }
+ */ + public final UnaryCallable getLocationCallable() { + return stub.getLocationCallable(); + } + @Override public final void close() { stub.close(); @@ -1729,4 +1952,80 @@ protected ListSuggestionsFixedSizeCollection createCollection( return new ListSuggestionsFixedSizeCollection(pages, collectionSize); } } + + public static class ListLocationsPagedResponse + extends AbstractPagedListResponse< + ListLocationsRequest, + ListLocationsResponse, + Location, + ListLocationsPage, + ListLocationsFixedSizeCollection> { + + public static ApiFuture createAsync( + PageContext context, + ApiFuture futureResponse) { + ApiFuture futurePage = + ListLocationsPage.createEmptyPage().createPageAsync(context, futureResponse); + return ApiFutures.transform( + futurePage, + input -> new ListLocationsPagedResponse(input), + MoreExecutors.directExecutor()); + } + + private ListLocationsPagedResponse(ListLocationsPage page) { + super(page, ListLocationsFixedSizeCollection.createEmptyCollection()); + } + } + + public static class ListLocationsPage + extends AbstractPage< + ListLocationsRequest, ListLocationsResponse, Location, ListLocationsPage> { + + private ListLocationsPage( + PageContext context, + ListLocationsResponse response) { + super(context, response); + } + + private static ListLocationsPage createEmptyPage() { + return new ListLocationsPage(null, null); + } + + @Override + protected ListLocationsPage createPage( + PageContext context, + ListLocationsResponse response) { + return new ListLocationsPage(context, response); + } + + @Override + public ApiFuture createPageAsync( + PageContext context, + ApiFuture futureResponse) { + return super.createPageAsync(context, futureResponse); + } + } + + public static class ListLocationsFixedSizeCollection + extends AbstractFixedSizeCollection< + ListLocationsRequest, + ListLocationsResponse, + Location, + ListLocationsPage, + ListLocationsFixedSizeCollection> { + + private ListLocationsFixedSizeCollection(List pages, int collectionSize) { + super(pages, collectionSize); + } + + private static ListLocationsFixedSizeCollection createEmptyCollection() { + return new ListLocationsFixedSizeCollection(null, 0); + } + + @Override + protected ListLocationsFixedSizeCollection createCollection( + List pages, int collectionSize) { + return new ListLocationsFixedSizeCollection(pages, collectionSize); + } + } } diff --git a/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2beta1/ParticipantsSettings.java b/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2beta1/ParticipantsSettings.java index f84bb6fc5..623e51d44 100644 --- a/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2beta1/ParticipantsSettings.java +++ b/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2beta1/ParticipantsSettings.java @@ -16,6 +16,7 @@ package com.google.cloud.dialogflow.v2beta1; +import static com.google.cloud.dialogflow.v2beta1.ParticipantsClient.ListLocationsPagedResponse; import static com.google.cloud.dialogflow.v2beta1.ParticipantsClient.ListParticipantsPagedResponse; import static com.google.cloud.dialogflow.v2beta1.ParticipantsClient.ListSuggestionsPagedResponse; @@ -33,6 +34,10 @@ import com.google.api.gax.rpc.TransportChannelProvider; import com.google.api.gax.rpc.UnaryCallSettings; import com.google.cloud.dialogflow.v2beta1.stub.ParticipantsStubSettings; +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.ListLocationsResponse; +import com.google.cloud.location.Location; import java.io.IOException; import java.util.List; import javax.annotation.Generated; @@ -148,6 +153,17 @@ public UnaryCallSettings analyzeC return ((ParticipantsStubSettings) getStubSettings()).compileSuggestionSettings(); } + /** Returns the object with the settings used for calls to listLocations. */ + public PagedCallSettings + listLocationsSettings() { + return ((ParticipantsStubSettings) getStubSettings()).listLocationsSettings(); + } + + /** Returns the object with the settings used for calls to getLocation. */ + public UnaryCallSettings getLocationSettings() { + return ((ParticipantsStubSettings) getStubSettings()).getLocationSettings(); + } + public static final ParticipantsSettings create(ParticipantsStubSettings stub) throws IOException { return new ParticipantsSettings.Builder(stub.toBuilder()).build(); @@ -341,6 +357,18 @@ public UnaryCallSettings.Builder getParticip return getStubSettingsBuilder().compileSuggestionSettings(); } + /** Returns the builder for the settings used for calls to listLocations. */ + public PagedCallSettings.Builder< + ListLocationsRequest, ListLocationsResponse, ListLocationsPagedResponse> + listLocationsSettings() { + return getStubSettingsBuilder().listLocationsSettings(); + } + + /** Returns the builder for the settings used for calls to getLocation. */ + public UnaryCallSettings.Builder getLocationSettings() { + return getStubSettingsBuilder().getLocationSettings(); + } + @Override public ParticipantsSettings build() throws IOException { return new ParticipantsSettings(this); diff --git a/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2beta1/SessionEntityTypesClient.java b/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2beta1/SessionEntityTypesClient.java index 67a403d13..59579cc58 100644 --- a/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2beta1/SessionEntityTypesClient.java +++ b/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2beta1/SessionEntityTypesClient.java @@ -27,6 +27,10 @@ import com.google.api.gax.rpc.UnaryCallable; import com.google.cloud.dialogflow.v2beta1.stub.SessionEntityTypesStub; import com.google.cloud.dialogflow.v2beta1.stub.SessionEntityTypesStubSettings; +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.ListLocationsResponse; +import com.google.cloud.location.Location; import com.google.common.util.concurrent.MoreExecutors; import com.google.protobuf.Empty; import com.google.protobuf.FieldMask; @@ -926,6 +930,148 @@ public final void deleteSessionEntityType(DeleteSessionEntityTypeRequest request return stub.deleteSessionEntityTypeCallable(); } + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Lists information about the supported locations for this service. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
+   * try (SessionEntityTypesClient sessionEntityTypesClient = SessionEntityTypesClient.create()) {
+   *   ListLocationsRequest request =
+   *       ListLocationsRequest.newBuilder()
+   *           .setName("name3373707")
+   *           .setFilter("filter-1274492040")
+   *           .setPageSize(883849137)
+   *           .setPageToken("pageToken873572522")
+   *           .build();
+   *   for (Location element : sessionEntityTypesClient.listLocations(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 + */ + public final ListLocationsPagedResponse listLocations(ListLocationsRequest request) { + return listLocationsPagedCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Lists information about the supported locations for this service. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
+   * try (SessionEntityTypesClient sessionEntityTypesClient = SessionEntityTypesClient.create()) {
+   *   ListLocationsRequest request =
+   *       ListLocationsRequest.newBuilder()
+   *           .setName("name3373707")
+   *           .setFilter("filter-1274492040")
+   *           .setPageSize(883849137)
+   *           .setPageToken("pageToken873572522")
+   *           .build();
+   *   ApiFuture future =
+   *       sessionEntityTypesClient.listLocationsPagedCallable().futureCall(request);
+   *   // Do something.
+   *   for (Location element : future.get().iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * }
+ */ + public final UnaryCallable + listLocationsPagedCallable() { + return stub.listLocationsPagedCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Lists information about the supported locations for this service. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
+   * try (SessionEntityTypesClient sessionEntityTypesClient = SessionEntityTypesClient.create()) {
+   *   ListLocationsRequest request =
+   *       ListLocationsRequest.newBuilder()
+   *           .setName("name3373707")
+   *           .setFilter("filter-1274492040")
+   *           .setPageSize(883849137)
+   *           .setPageToken("pageToken873572522")
+   *           .build();
+   *   while (true) {
+   *     ListLocationsResponse response =
+   *         sessionEntityTypesClient.listLocationsCallable().call(request);
+   *     for (Location element : response.getLocationsList()) {
+   *       // doThingsWith(element);
+   *     }
+   *     String nextPageToken = response.getNextPageToken();
+   *     if (!Strings.isNullOrEmpty(nextPageToken)) {
+   *       request = request.toBuilder().setPageToken(nextPageToken).build();
+   *     } else {
+   *       break;
+   *     }
+   *   }
+   * }
+   * }
+ */ + public final UnaryCallable listLocationsCallable() { + return stub.listLocationsCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Gets information about a location. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
+   * try (SessionEntityTypesClient sessionEntityTypesClient = SessionEntityTypesClient.create()) {
+   *   GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build();
+   *   Location response = sessionEntityTypesClient.getLocation(request);
+   * }
+   * }
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final Location getLocation(GetLocationRequest request) { + return getLocationCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Gets information about a location. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
+   * try (SessionEntityTypesClient sessionEntityTypesClient = SessionEntityTypesClient.create()) {
+   *   GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build();
+   *   ApiFuture future =
+   *       sessionEntityTypesClient.getLocationCallable().futureCall(request);
+   *   // Do something.
+   *   Location response = future.get();
+   * }
+   * }
+ */ + public final UnaryCallable getLocationCallable() { + return stub.getLocationCallable(); + } + @Override public final void close() { stub.close(); @@ -1043,4 +1189,80 @@ protected ListSessionEntityTypesFixedSizeCollection createCollection( return new ListSessionEntityTypesFixedSizeCollection(pages, collectionSize); } } + + public static class ListLocationsPagedResponse + extends AbstractPagedListResponse< + ListLocationsRequest, + ListLocationsResponse, + Location, + ListLocationsPage, + ListLocationsFixedSizeCollection> { + + public static ApiFuture createAsync( + PageContext context, + ApiFuture futureResponse) { + ApiFuture futurePage = + ListLocationsPage.createEmptyPage().createPageAsync(context, futureResponse); + return ApiFutures.transform( + futurePage, + input -> new ListLocationsPagedResponse(input), + MoreExecutors.directExecutor()); + } + + private ListLocationsPagedResponse(ListLocationsPage page) { + super(page, ListLocationsFixedSizeCollection.createEmptyCollection()); + } + } + + public static class ListLocationsPage + extends AbstractPage< + ListLocationsRequest, ListLocationsResponse, Location, ListLocationsPage> { + + private ListLocationsPage( + PageContext context, + ListLocationsResponse response) { + super(context, response); + } + + private static ListLocationsPage createEmptyPage() { + return new ListLocationsPage(null, null); + } + + @Override + protected ListLocationsPage createPage( + PageContext context, + ListLocationsResponse response) { + return new ListLocationsPage(context, response); + } + + @Override + public ApiFuture createPageAsync( + PageContext context, + ApiFuture futureResponse) { + return super.createPageAsync(context, futureResponse); + } + } + + public static class ListLocationsFixedSizeCollection + extends AbstractFixedSizeCollection< + ListLocationsRequest, + ListLocationsResponse, + Location, + ListLocationsPage, + ListLocationsFixedSizeCollection> { + + private ListLocationsFixedSizeCollection(List pages, int collectionSize) { + super(pages, collectionSize); + } + + private static ListLocationsFixedSizeCollection createEmptyCollection() { + return new ListLocationsFixedSizeCollection(null, 0); + } + + @Override + protected ListLocationsFixedSizeCollection createCollection( + List pages, int collectionSize) { + return new ListLocationsFixedSizeCollection(pages, collectionSize); + } + } } diff --git a/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2beta1/SessionEntityTypesSettings.java b/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2beta1/SessionEntityTypesSettings.java index 42ae22ee5..6b36b667f 100644 --- a/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2beta1/SessionEntityTypesSettings.java +++ b/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2beta1/SessionEntityTypesSettings.java @@ -16,6 +16,7 @@ package com.google.cloud.dialogflow.v2beta1; +import static com.google.cloud.dialogflow.v2beta1.SessionEntityTypesClient.ListLocationsPagedResponse; import static com.google.cloud.dialogflow.v2beta1.SessionEntityTypesClient.ListSessionEntityTypesPagedResponse; import com.google.api.core.ApiFunction; @@ -31,6 +32,10 @@ import com.google.api.gax.rpc.TransportChannelProvider; import com.google.api.gax.rpc.UnaryCallSettings; import com.google.cloud.dialogflow.v2beta1.stub.SessionEntityTypesStubSettings; +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.ListLocationsResponse; +import com.google.cloud.location.Location; import com.google.protobuf.Empty; import java.io.IOException; import java.util.List; @@ -108,6 +113,17 @@ public class SessionEntityTypesSettings extends ClientSettings + listLocationsSettings() { + return ((SessionEntityTypesStubSettings) getStubSettings()).listLocationsSettings(); + } + + /** Returns the object with the settings used for calls to getLocation. */ + public UnaryCallSettings getLocationSettings() { + return ((SessionEntityTypesStubSettings) getStubSettings()).getLocationSettings(); + } + public static final SessionEntityTypesSettings create(SessionEntityTypesStubSettings stub) throws IOException { return new SessionEntityTypesSettings.Builder(stub.toBuilder()).build(); @@ -256,6 +272,18 @@ public Builder applyToAllUnaryMethods( return getStubSettingsBuilder().deleteSessionEntityTypeSettings(); } + /** Returns the builder for the settings used for calls to listLocations. */ + public PagedCallSettings.Builder< + ListLocationsRequest, ListLocationsResponse, ListLocationsPagedResponse> + listLocationsSettings() { + return getStubSettingsBuilder().listLocationsSettings(); + } + + /** Returns the builder for the settings used for calls to getLocation. */ + public UnaryCallSettings.Builder getLocationSettings() { + return getStubSettingsBuilder().getLocationSettings(); + } + @Override public SessionEntityTypesSettings build() throws IOException { return new SessionEntityTypesSettings(this); diff --git a/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2beta1/SessionsClient.java b/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2beta1/SessionsClient.java index 0614dea16..cc1a2fe92 100644 --- a/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2beta1/SessionsClient.java +++ b/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2beta1/SessionsClient.java @@ -16,13 +16,25 @@ package com.google.cloud.dialogflow.v2beta1; +import com.google.api.core.ApiFuture; +import com.google.api.core.ApiFutures; import com.google.api.core.BetaApi; import com.google.api.gax.core.BackgroundResource; +import com.google.api.gax.paging.AbstractFixedSizeCollection; +import com.google.api.gax.paging.AbstractPage; +import com.google.api.gax.paging.AbstractPagedListResponse; import com.google.api.gax.rpc.BidiStreamingCallable; +import com.google.api.gax.rpc.PageContext; import com.google.api.gax.rpc.UnaryCallable; import com.google.cloud.dialogflow.v2beta1.stub.SessionsStub; import com.google.cloud.dialogflow.v2beta1.stub.SessionsStubSettings; +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.ListLocationsResponse; +import com.google.cloud.location.Location; +import com.google.common.util.concurrent.MoreExecutors; import java.io.IOException; +import java.util.List; import java.util.concurrent.TimeUnit; import javax.annotation.Generated; @@ -403,6 +415,145 @@ public final UnaryCallable detectInte return stub.streamingDetectIntentCallable(); } + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Lists information about the supported locations for this service. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
+   * try (SessionsClient sessionsClient = SessionsClient.create()) {
+   *   ListLocationsRequest request =
+   *       ListLocationsRequest.newBuilder()
+   *           .setName("name3373707")
+   *           .setFilter("filter-1274492040")
+   *           .setPageSize(883849137)
+   *           .setPageToken("pageToken873572522")
+   *           .build();
+   *   for (Location element : sessionsClient.listLocations(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 + */ + public final ListLocationsPagedResponse listLocations(ListLocationsRequest request) { + return listLocationsPagedCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Lists information about the supported locations for this service. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
+   * try (SessionsClient sessionsClient = SessionsClient.create()) {
+   *   ListLocationsRequest request =
+   *       ListLocationsRequest.newBuilder()
+   *           .setName("name3373707")
+   *           .setFilter("filter-1274492040")
+   *           .setPageSize(883849137)
+   *           .setPageToken("pageToken873572522")
+   *           .build();
+   *   ApiFuture future = sessionsClient.listLocationsPagedCallable().futureCall(request);
+   *   // Do something.
+   *   for (Location element : future.get().iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * }
+ */ + public final UnaryCallable + listLocationsPagedCallable() { + return stub.listLocationsPagedCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Lists information about the supported locations for this service. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
+   * try (SessionsClient sessionsClient = SessionsClient.create()) {
+   *   ListLocationsRequest request =
+   *       ListLocationsRequest.newBuilder()
+   *           .setName("name3373707")
+   *           .setFilter("filter-1274492040")
+   *           .setPageSize(883849137)
+   *           .setPageToken("pageToken873572522")
+   *           .build();
+   *   while (true) {
+   *     ListLocationsResponse response = sessionsClient.listLocationsCallable().call(request);
+   *     for (Location element : response.getLocationsList()) {
+   *       // doThingsWith(element);
+   *     }
+   *     String nextPageToken = response.getNextPageToken();
+   *     if (!Strings.isNullOrEmpty(nextPageToken)) {
+   *       request = request.toBuilder().setPageToken(nextPageToken).build();
+   *     } else {
+   *       break;
+   *     }
+   *   }
+   * }
+   * }
+ */ + public final UnaryCallable listLocationsCallable() { + return stub.listLocationsCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Gets information about a location. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
+   * try (SessionsClient sessionsClient = SessionsClient.create()) {
+   *   GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build();
+   *   Location response = sessionsClient.getLocation(request);
+   * }
+   * }
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final Location getLocation(GetLocationRequest request) { + return getLocationCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Gets information about a location. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
+   * try (SessionsClient sessionsClient = SessionsClient.create()) {
+   *   GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build();
+   *   ApiFuture future = sessionsClient.getLocationCallable().futureCall(request);
+   *   // Do something.
+   *   Location response = future.get();
+   * }
+   * }
+ */ + public final UnaryCallable getLocationCallable() { + return stub.getLocationCallable(); + } + @Override public final void close() { stub.close(); @@ -432,4 +583,80 @@ public void shutdownNow() { public boolean awaitTermination(long duration, TimeUnit unit) throws InterruptedException { return stub.awaitTermination(duration, unit); } + + public static class ListLocationsPagedResponse + extends AbstractPagedListResponse< + ListLocationsRequest, + ListLocationsResponse, + Location, + ListLocationsPage, + ListLocationsFixedSizeCollection> { + + public static ApiFuture createAsync( + PageContext context, + ApiFuture futureResponse) { + ApiFuture futurePage = + ListLocationsPage.createEmptyPage().createPageAsync(context, futureResponse); + return ApiFutures.transform( + futurePage, + input -> new ListLocationsPagedResponse(input), + MoreExecutors.directExecutor()); + } + + private ListLocationsPagedResponse(ListLocationsPage page) { + super(page, ListLocationsFixedSizeCollection.createEmptyCollection()); + } + } + + public static class ListLocationsPage + extends AbstractPage< + ListLocationsRequest, ListLocationsResponse, Location, ListLocationsPage> { + + private ListLocationsPage( + PageContext context, + ListLocationsResponse response) { + super(context, response); + } + + private static ListLocationsPage createEmptyPage() { + return new ListLocationsPage(null, null); + } + + @Override + protected ListLocationsPage createPage( + PageContext context, + ListLocationsResponse response) { + return new ListLocationsPage(context, response); + } + + @Override + public ApiFuture createPageAsync( + PageContext context, + ApiFuture futureResponse) { + return super.createPageAsync(context, futureResponse); + } + } + + public static class ListLocationsFixedSizeCollection + extends AbstractFixedSizeCollection< + ListLocationsRequest, + ListLocationsResponse, + Location, + ListLocationsPage, + ListLocationsFixedSizeCollection> { + + private ListLocationsFixedSizeCollection(List pages, int collectionSize) { + super(pages, collectionSize); + } + + private static ListLocationsFixedSizeCollection createEmptyCollection() { + return new ListLocationsFixedSizeCollection(null, 0); + } + + @Override + protected ListLocationsFixedSizeCollection createCollection( + List pages, int collectionSize) { + return new ListLocationsFixedSizeCollection(pages, collectionSize); + } + } } diff --git a/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2beta1/SessionsSettings.java b/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2beta1/SessionsSettings.java index 55a6b3fa6..0eb391f2f 100644 --- a/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2beta1/SessionsSettings.java +++ b/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2beta1/SessionsSettings.java @@ -16,6 +16,8 @@ package com.google.cloud.dialogflow.v2beta1; +import static com.google.cloud.dialogflow.v2beta1.SessionsClient.ListLocationsPagedResponse; + import com.google.api.core.ApiFunction; import com.google.api.core.BetaApi; import com.google.api.gax.core.GoogleCredentialsProvider; @@ -25,10 +27,15 @@ import com.google.api.gax.rpc.ApiClientHeaderProvider; import com.google.api.gax.rpc.ClientContext; import com.google.api.gax.rpc.ClientSettings; +import com.google.api.gax.rpc.PagedCallSettings; import com.google.api.gax.rpc.StreamingCallSettings; import com.google.api.gax.rpc.TransportChannelProvider; import com.google.api.gax.rpc.UnaryCallSettings; import com.google.cloud.dialogflow.v2beta1.stub.SessionsStubSettings; +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.ListLocationsResponse; +import com.google.cloud.location.Location; import java.io.IOException; import java.util.List; import javax.annotation.Generated; @@ -81,6 +88,17 @@ public UnaryCallSettings detectIntent return ((SessionsStubSettings) getStubSettings()).streamingDetectIntentSettings(); } + /** Returns the object with the settings used for calls to listLocations. */ + public PagedCallSettings + listLocationsSettings() { + return ((SessionsStubSettings) getStubSettings()).listLocationsSettings(); + } + + /** Returns the object with the settings used for calls to getLocation. */ + public UnaryCallSettings getLocationSettings() { + return ((SessionsStubSettings) getStubSettings()).getLocationSettings(); + } + public static final SessionsSettings create(SessionsStubSettings stub) throws IOException { return new SessionsSettings.Builder(stub.toBuilder()).build(); } @@ -208,6 +226,18 @@ public Builder applyToAllUnaryMethods( return getStubSettingsBuilder().streamingDetectIntentSettings(); } + /** Returns the builder for the settings used for calls to listLocations. */ + public PagedCallSettings.Builder< + ListLocationsRequest, ListLocationsResponse, ListLocationsPagedResponse> + listLocationsSettings() { + return getStubSettingsBuilder().listLocationsSettings(); + } + + /** Returns the builder for the settings used for calls to getLocation. */ + public UnaryCallSettings.Builder getLocationSettings() { + return getStubSettingsBuilder().getLocationSettings(); + } + @Override public SessionsSettings build() throws IOException { return new SessionsSettings(this); diff --git a/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2beta1/VersionsClient.java b/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2beta1/VersionsClient.java index df030b3c0..b60c68742 100644 --- a/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2beta1/VersionsClient.java +++ b/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2beta1/VersionsClient.java @@ -27,6 +27,10 @@ import com.google.api.gax.rpc.UnaryCallable; import com.google.cloud.dialogflow.v2beta1.stub.VersionsStub; import com.google.cloud.dialogflow.v2beta1.stub.VersionsStubSettings; +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.ListLocationsResponse; +import com.google.cloud.location.Location; import com.google.common.util.concurrent.MoreExecutors; import com.google.protobuf.Empty; import com.google.protobuf.FieldMask; @@ -720,6 +724,145 @@ public final UnaryCallable deleteVersionCallable() return stub.deleteVersionCallable(); } + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Lists information about the supported locations for this service. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
+   * try (VersionsClient versionsClient = VersionsClient.create()) {
+   *   ListLocationsRequest request =
+   *       ListLocationsRequest.newBuilder()
+   *           .setName("name3373707")
+   *           .setFilter("filter-1274492040")
+   *           .setPageSize(883849137)
+   *           .setPageToken("pageToken873572522")
+   *           .build();
+   *   for (Location element : versionsClient.listLocations(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 + */ + public final ListLocationsPagedResponse listLocations(ListLocationsRequest request) { + return listLocationsPagedCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Lists information about the supported locations for this service. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
+   * try (VersionsClient versionsClient = VersionsClient.create()) {
+   *   ListLocationsRequest request =
+   *       ListLocationsRequest.newBuilder()
+   *           .setName("name3373707")
+   *           .setFilter("filter-1274492040")
+   *           .setPageSize(883849137)
+   *           .setPageToken("pageToken873572522")
+   *           .build();
+   *   ApiFuture future = versionsClient.listLocationsPagedCallable().futureCall(request);
+   *   // Do something.
+   *   for (Location element : future.get().iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * }
+ */ + public final UnaryCallable + listLocationsPagedCallable() { + return stub.listLocationsPagedCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Lists information about the supported locations for this service. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
+   * try (VersionsClient versionsClient = VersionsClient.create()) {
+   *   ListLocationsRequest request =
+   *       ListLocationsRequest.newBuilder()
+   *           .setName("name3373707")
+   *           .setFilter("filter-1274492040")
+   *           .setPageSize(883849137)
+   *           .setPageToken("pageToken873572522")
+   *           .build();
+   *   while (true) {
+   *     ListLocationsResponse response = versionsClient.listLocationsCallable().call(request);
+   *     for (Location element : response.getLocationsList()) {
+   *       // doThingsWith(element);
+   *     }
+   *     String nextPageToken = response.getNextPageToken();
+   *     if (!Strings.isNullOrEmpty(nextPageToken)) {
+   *       request = request.toBuilder().setPageToken(nextPageToken).build();
+   *     } else {
+   *       break;
+   *     }
+   *   }
+   * }
+   * }
+ */ + public final UnaryCallable listLocationsCallable() { + return stub.listLocationsCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Gets information about a location. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
+   * try (VersionsClient versionsClient = VersionsClient.create()) {
+   *   GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build();
+   *   Location response = versionsClient.getLocation(request);
+   * }
+   * }
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final Location getLocation(GetLocationRequest request) { + return getLocationCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Gets information about a location. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
+   * try (VersionsClient versionsClient = VersionsClient.create()) {
+   *   GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build();
+   *   ApiFuture future = versionsClient.getLocationCallable().futureCall(request);
+   *   // Do something.
+   *   Location response = future.get();
+   * }
+   * }
+ */ + public final UnaryCallable getLocationCallable() { + return stub.getLocationCallable(); + } + @Override public final void close() { stub.close(); @@ -824,4 +967,80 @@ protected ListVersionsFixedSizeCollection createCollection( return new ListVersionsFixedSizeCollection(pages, collectionSize); } } + + public static class ListLocationsPagedResponse + extends AbstractPagedListResponse< + ListLocationsRequest, + ListLocationsResponse, + Location, + ListLocationsPage, + ListLocationsFixedSizeCollection> { + + public static ApiFuture createAsync( + PageContext context, + ApiFuture futureResponse) { + ApiFuture futurePage = + ListLocationsPage.createEmptyPage().createPageAsync(context, futureResponse); + return ApiFutures.transform( + futurePage, + input -> new ListLocationsPagedResponse(input), + MoreExecutors.directExecutor()); + } + + private ListLocationsPagedResponse(ListLocationsPage page) { + super(page, ListLocationsFixedSizeCollection.createEmptyCollection()); + } + } + + public static class ListLocationsPage + extends AbstractPage< + ListLocationsRequest, ListLocationsResponse, Location, ListLocationsPage> { + + private ListLocationsPage( + PageContext context, + ListLocationsResponse response) { + super(context, response); + } + + private static ListLocationsPage createEmptyPage() { + return new ListLocationsPage(null, null); + } + + @Override + protected ListLocationsPage createPage( + PageContext context, + ListLocationsResponse response) { + return new ListLocationsPage(context, response); + } + + @Override + public ApiFuture createPageAsync( + PageContext context, + ApiFuture futureResponse) { + return super.createPageAsync(context, futureResponse); + } + } + + public static class ListLocationsFixedSizeCollection + extends AbstractFixedSizeCollection< + ListLocationsRequest, + ListLocationsResponse, + Location, + ListLocationsPage, + ListLocationsFixedSizeCollection> { + + private ListLocationsFixedSizeCollection(List pages, int collectionSize) { + super(pages, collectionSize); + } + + private static ListLocationsFixedSizeCollection createEmptyCollection() { + return new ListLocationsFixedSizeCollection(null, 0); + } + + @Override + protected ListLocationsFixedSizeCollection createCollection( + List pages, int collectionSize) { + return new ListLocationsFixedSizeCollection(pages, collectionSize); + } + } } diff --git a/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2beta1/VersionsSettings.java b/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2beta1/VersionsSettings.java index fc163e091..0edcdbc19 100644 --- a/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2beta1/VersionsSettings.java +++ b/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2beta1/VersionsSettings.java @@ -16,6 +16,7 @@ package com.google.cloud.dialogflow.v2beta1; +import static com.google.cloud.dialogflow.v2beta1.VersionsClient.ListLocationsPagedResponse; import static com.google.cloud.dialogflow.v2beta1.VersionsClient.ListVersionsPagedResponse; import com.google.api.core.ApiFunction; @@ -31,6 +32,10 @@ import com.google.api.gax.rpc.TransportChannelProvider; import com.google.api.gax.rpc.UnaryCallSettings; import com.google.cloud.dialogflow.v2beta1.stub.VersionsStubSettings; +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.ListLocationsResponse; +import com.google.cloud.location.Location; import com.google.protobuf.Empty; import java.io.IOException; import java.util.List; @@ -99,6 +104,17 @@ public UnaryCallSettings deleteVersionSettings() { return ((VersionsStubSettings) getStubSettings()).deleteVersionSettings(); } + /** Returns the object with the settings used for calls to listLocations. */ + public PagedCallSettings + listLocationsSettings() { + return ((VersionsStubSettings) getStubSettings()).listLocationsSettings(); + } + + /** Returns the object with the settings used for calls to getLocation. */ + public UnaryCallSettings getLocationSettings() { + return ((VersionsStubSettings) getStubSettings()).getLocationSettings(); + } + public static final VersionsSettings create(VersionsStubSettings stub) throws IOException { return new VersionsSettings.Builder(stub.toBuilder()).build(); } @@ -240,6 +256,18 @@ public UnaryCallSettings.Builder deleteVersionSetti return getStubSettingsBuilder().deleteVersionSettings(); } + /** Returns the builder for the settings used for calls to listLocations. */ + public PagedCallSettings.Builder< + ListLocationsRequest, ListLocationsResponse, ListLocationsPagedResponse> + listLocationsSettings() { + return getStubSettingsBuilder().listLocationsSettings(); + } + + /** Returns the builder for the settings used for calls to getLocation. */ + public UnaryCallSettings.Builder getLocationSettings() { + return getStubSettingsBuilder().getLocationSettings(); + } + @Override public VersionsSettings build() throws IOException { return new VersionsSettings(this); diff --git a/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2beta1/gapic_metadata.json b/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2beta1/gapic_metadata.json index c195a263e..2e0b5c45e 100644 --- a/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2beta1/gapic_metadata.json +++ b/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2beta1/gapic_metadata.json @@ -19,12 +19,18 @@ "GetAgent": { "methods": ["getAgent", "getAgent", "getAgent", "getAgent", "getAgentCallable"] }, + "GetLocation": { + "methods": ["getLocation", "getLocationCallable"] + }, "GetValidationResult": { "methods": ["getValidationResult", "getValidationResultCallable"] }, "ImportAgent": { "methods": ["importAgentAsync", "importAgentOperationCallable", "importAgentCallable"] }, + "ListLocations": { + "methods": ["listLocations", "listLocationsPagedCallable", "listLocationsCallable"] + }, "RestoreAgent": { "methods": ["restoreAgentAsync", "restoreAgentOperationCallable", "restoreAgentCallable"] }, @@ -49,9 +55,15 @@ "GetAnswerRecord": { "methods": ["getAnswerRecord", "getAnswerRecordCallable"] }, + "GetLocation": { + "methods": ["getLocation", "getLocationCallable"] + }, "ListAnswerRecords": { "methods": ["listAnswerRecords", "listAnswerRecords", "listAnswerRecords", "listAnswerRecords", "listAnswerRecordsPagedCallable", "listAnswerRecordsCallable"] }, + "ListLocations": { + "methods": ["listLocations", "listLocationsPagedCallable", "listLocationsCallable"] + }, "UpdateAnswerRecord": { "methods": ["updateAnswerRecord", "updateAnswerRecord", "updateAnswerRecordCallable"] } @@ -76,9 +88,15 @@ "GetContext": { "methods": ["getContext", "getContext", "getContext", "getContextCallable"] }, + "GetLocation": { + "methods": ["getLocation", "getLocationCallable"] + }, "ListContexts": { "methods": ["listContexts", "listContexts", "listContexts", "listContextsPagedCallable", "listContextsCallable"] }, + "ListLocations": { + "methods": ["listLocations", "listLocationsPagedCallable", "listLocationsCallable"] + }, "UpdateContext": { "methods": ["updateContext", "updateContext", "updateContext", "updateContextCallable"] } @@ -103,9 +121,15 @@ "GetConversation": { "methods": ["getConversation", "getConversation", "getConversation", "getConversationCallable"] }, + "GetLocation": { + "methods": ["getLocation", "getLocationCallable"] + }, "ListConversations": { "methods": ["listConversations", "listConversations", "listConversations", "listConversations", "listConversationsPagedCallable", "listConversationsCallable"] }, + "ListLocations": { + "methods": ["listLocations", "listLocationsPagedCallable", "listLocationsCallable"] + }, "ListMessages": { "methods": ["listMessages", "listMessages", "listMessages", "listMessagesPagedCallable", "listMessagesCallable"] } @@ -130,9 +154,15 @@ "GetConversationProfile": { "methods": ["getConversationProfile", "getConversationProfile", "getConversationProfile", "getConversationProfileCallable"] }, + "GetLocation": { + "methods": ["getLocation", "getLocationCallable"] + }, "ListConversationProfiles": { "methods": ["listConversationProfiles", "listConversationProfiles", "listConversationProfiles", "listConversationProfiles", "listConversationProfilesPagedCallable", "listConversationProfilesCallable"] }, + "ListLocations": { + "methods": ["listLocations", "listLocationsPagedCallable", "listLocationsCallable"] + }, "SetSuggestionFeatureConfig": { "methods": ["setSuggestionFeatureConfigAsync", "setSuggestionFeatureConfigAsync", "setSuggestionFeatureConfigOperationCallable", "setSuggestionFeatureConfigCallable"] }, @@ -157,12 +187,18 @@ "GetDocument": { "methods": ["getDocument", "getDocument", "getDocument", "getDocumentCallable"] }, + "GetLocation": { + "methods": ["getLocation", "getLocationCallable"] + }, "ImportDocuments": { "methods": ["importDocumentsAsync", "importDocumentsOperationCallable", "importDocumentsCallable"] }, "ListDocuments": { "methods": ["listDocuments", "listDocuments", "listDocuments", "listDocumentsPagedCallable", "listDocumentsCallable"] }, + "ListLocations": { + "methods": ["listLocations", "listLocationsPagedCallable", "listLocationsCallable"] + }, "ReloadDocument": { "methods": ["reloadDocumentAsync", "reloadDocumentAsync", "reloadDocumentAsync", "reloadDocumentOperationCallable", "reloadDocumentCallable"] }, @@ -202,9 +238,15 @@ "GetEntityType": { "methods": ["getEntityType", "getEntityType", "getEntityType", "getEntityType", "getEntityType", "getEntityTypeCallable"] }, + "GetLocation": { + "methods": ["getLocation", "getLocationCallable"] + }, "ListEntityTypes": { "methods": ["listEntityTypes", "listEntityTypes", "listEntityTypes", "listEntityTypes", "listEntityTypes", "listEntityTypesPagedCallable", "listEntityTypesCallable"] }, + "ListLocations": { + "methods": ["listLocations", "listLocationsPagedCallable", "listLocationsCallable"] + }, "UpdateEntityType": { "methods": ["updateEntityType", "updateEntityType", "updateEntityType", "updateEntityType", "updateEntityTypeCallable"] } @@ -229,9 +271,15 @@ "GetEnvironmentHistory": { "methods": ["getEnvironmentHistory", "getEnvironmentHistoryPagedCallable", "getEnvironmentHistoryCallable"] }, + "GetLocation": { + "methods": ["getLocation", "getLocationCallable"] + }, "ListEnvironments": { "methods": ["listEnvironments", "listEnvironments", "listEnvironments", "listEnvironmentsPagedCallable", "listEnvironmentsCallable"] }, + "ListLocations": { + "methods": ["listLocations", "listLocationsPagedCallable", "listLocationsCallable"] + }, "UpdateEnvironment": { "methods": ["updateEnvironment", "updateEnvironmentCallable"] } @@ -247,6 +295,12 @@ "GetFulfillment": { "methods": ["getFulfillment", "getFulfillment", "getFulfillment", "getFulfillmentCallable"] }, + "GetLocation": { + "methods": ["getLocation", "getLocationCallable"] + }, + "ListLocations": { + "methods": ["listLocations", "listLocationsPagedCallable", "listLocationsCallable"] + }, "UpdateFulfillment": { "methods": ["updateFulfillment", "updateFulfillment", "updateFulfillmentCallable"] } @@ -274,9 +328,15 @@ "GetIntent": { "methods": ["getIntent", "getIntent", "getIntent", "getIntent", "getIntent", "getIntentCallable"] }, + "GetLocation": { + "methods": ["getLocation", "getLocationCallable"] + }, "ListIntents": { "methods": ["listIntents", "listIntents", "listIntents", "listIntents", "listIntents", "listIntentsPagedCallable", "listIntentsCallable"] }, + "ListLocations": { + "methods": ["listLocations", "listLocationsPagedCallable", "listLocationsCallable"] + }, "UpdateIntent": { "methods": ["updateIntent", "updateIntent", "updateIntent", "updateIntent", "updateIntent", "updateIntentCallable"] } @@ -298,9 +358,15 @@ "GetKnowledgeBase": { "methods": ["getKnowledgeBase", "getKnowledgeBase", "getKnowledgeBase", "getKnowledgeBaseCallable"] }, + "GetLocation": { + "methods": ["getLocation", "getLocationCallable"] + }, "ListKnowledgeBases": { "methods": ["listKnowledgeBases", "listKnowledgeBases", "listKnowledgeBases", "listKnowledgeBases", "listKnowledgeBasesPagedCallable", "listKnowledgeBasesCallable"] }, + "ListLocations": { + "methods": ["listLocations", "listLocationsPagedCallable", "listLocationsCallable"] + }, "UpdateKnowledgeBase": { "methods": ["updateKnowledgeBase", "updateKnowledgeBase", "updateKnowledgeBase", "updateKnowledgeBaseCallable"] } @@ -314,7 +380,7 @@ "libraryClient": "ParticipantsClient", "rpcs": { "AnalyzeContent": { - "methods": ["analyzeContent", "analyzeContent", "analyzeContent", "analyzeContent", "analyzeContent", "analyzeContentCallable"] + "methods": ["analyzeContent", "analyzeContent", "analyzeContent", "analyzeContent", "analyzeContent", "analyzeContent", "analyzeContent", "analyzeContentCallable"] }, "CompileSuggestion": { "methods": ["compileSuggestion", "compileSuggestionCallable"] @@ -322,9 +388,15 @@ "CreateParticipant": { "methods": ["createParticipant", "createParticipant", "createParticipant", "createParticipantCallable"] }, + "GetLocation": { + "methods": ["getLocation", "getLocationCallable"] + }, "GetParticipant": { "methods": ["getParticipant", "getParticipant", "getParticipant", "getParticipantCallable"] }, + "ListLocations": { + "methods": ["listLocations", "listLocationsPagedCallable", "listLocationsCallable"] + }, "ListParticipants": { "methods": ["listParticipants", "listParticipants", "listParticipants", "listParticipantsPagedCallable", "listParticipantsCallable"] }, @@ -358,6 +430,12 @@ "DetectIntent": { "methods": ["detectIntent", "detectIntent", "detectIntent", "detectIntentCallable"] }, + "GetLocation": { + "methods": ["getLocation", "getLocationCallable"] + }, + "ListLocations": { + "methods": ["listLocations", "listLocationsPagedCallable", "listLocationsCallable"] + }, "StreamingDetectIntent": { "methods": ["streamingDetectIntentCallable"] } @@ -376,9 +454,15 @@ "DeleteSessionEntityType": { "methods": ["deleteSessionEntityType", "deleteSessionEntityType", "deleteSessionEntityType", "deleteSessionEntityTypeCallable"] }, + "GetLocation": { + "methods": ["getLocation", "getLocationCallable"] + }, "GetSessionEntityType": { "methods": ["getSessionEntityType", "getSessionEntityType", "getSessionEntityType", "getSessionEntityTypeCallable"] }, + "ListLocations": { + "methods": ["listLocations", "listLocationsPagedCallable", "listLocationsCallable"] + }, "ListSessionEntityTypes": { "methods": ["listSessionEntityTypes", "listSessionEntityTypes", "listSessionEntityTypes", "listSessionEntityTypesPagedCallable", "listSessionEntityTypesCallable"] }, @@ -400,9 +484,15 @@ "DeleteVersion": { "methods": ["deleteVersion", "deleteVersion", "deleteVersion", "deleteVersionCallable"] }, + "GetLocation": { + "methods": ["getLocation", "getLocationCallable"] + }, "GetVersion": { "methods": ["getVersion", "getVersion", "getVersion", "getVersionCallable"] }, + "ListLocations": { + "methods": ["listLocations", "listLocationsPagedCallable", "listLocationsCallable"] + }, "ListVersions": { "methods": ["listVersions", "listVersions", "listVersions", "listVersionsPagedCallable", "listVersionsCallable"] }, diff --git a/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2beta1/stub/AgentsStub.java b/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2beta1/stub/AgentsStub.java index e1655ebc2..87d617df2 100644 --- a/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2beta1/stub/AgentsStub.java +++ b/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2beta1/stub/AgentsStub.java @@ -16,6 +16,7 @@ package com.google.cloud.dialogflow.v2beta1.stub; +import static com.google.cloud.dialogflow.v2beta1.AgentsClient.ListLocationsPagedResponse; import static com.google.cloud.dialogflow.v2beta1.AgentsClient.SearchAgentsPagedResponse; import com.google.api.core.BetaApi; @@ -35,6 +36,10 @@ import com.google.cloud.dialogflow.v2beta1.SetAgentRequest; import com.google.cloud.dialogflow.v2beta1.TrainAgentRequest; import com.google.cloud.dialogflow.v2beta1.ValidationResult; +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.ListLocationsResponse; +import com.google.cloud.location.Location; import com.google.longrunning.Operation; import com.google.longrunning.stub.OperationsStub; import com.google.protobuf.Empty; @@ -116,6 +121,19 @@ public UnaryCallable getValidation throw new UnsupportedOperationException("Not implemented: getValidationResultCallable()"); } + public UnaryCallable + listLocationsPagedCallable() { + throw new UnsupportedOperationException("Not implemented: listLocationsPagedCallable()"); + } + + public UnaryCallable listLocationsCallable() { + throw new UnsupportedOperationException("Not implemented: listLocationsCallable()"); + } + + public UnaryCallable getLocationCallable() { + throw new UnsupportedOperationException("Not implemented: getLocationCallable()"); + } + @Override public abstract void close(); } diff --git a/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2beta1/stub/AgentsStubSettings.java b/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2beta1/stub/AgentsStubSettings.java index 52e820c52..898b12a1c 100644 --- a/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2beta1/stub/AgentsStubSettings.java +++ b/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2beta1/stub/AgentsStubSettings.java @@ -16,6 +16,7 @@ package com.google.cloud.dialogflow.v2beta1.stub; +import static com.google.cloud.dialogflow.v2beta1.AgentsClient.ListLocationsPagedResponse; import static com.google.cloud.dialogflow.v2beta1.AgentsClient.SearchAgentsPagedResponse; import com.google.api.core.ApiFunction; @@ -60,6 +61,10 @@ import com.google.cloud.dialogflow.v2beta1.SetAgentRequest; import com.google.cloud.dialogflow.v2beta1.TrainAgentRequest; import com.google.cloud.dialogflow.v2beta1.ValidationResult; +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.ListLocationsResponse; +import com.google.cloud.location.Location; import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableMap; import com.google.common.collect.ImmutableSet; @@ -134,6 +139,10 @@ public class AgentsStubSettings extends StubSettings { restoreAgentOperationSettings; private final UnaryCallSettings getValidationResultSettings; + private final PagedCallSettings< + ListLocationsRequest, ListLocationsResponse, ListLocationsPagedResponse> + listLocationsSettings; + private final UnaryCallSettings getLocationSettings; private static final PagedListDescriptor SEARCH_AGENTS_PAGE_STR_DESC = @@ -171,6 +180,42 @@ public Iterable extractResources(SearchAgentsResponse payload) { } }; + private static final PagedListDescriptor + LIST_LOCATIONS_PAGE_STR_DESC = + new PagedListDescriptor() { + @Override + public String emptyToken() { + return ""; + } + + @Override + public ListLocationsRequest injectToken(ListLocationsRequest payload, String token) { + return ListLocationsRequest.newBuilder(payload).setPageToken(token).build(); + } + + @Override + public ListLocationsRequest injectPageSize(ListLocationsRequest payload, int pageSize) { + return ListLocationsRequest.newBuilder(payload).setPageSize(pageSize).build(); + } + + @Override + public Integer extractPageSize(ListLocationsRequest payload) { + return payload.getPageSize(); + } + + @Override + public String extractNextToken(ListLocationsResponse payload) { + return payload.getNextPageToken(); + } + + @Override + public Iterable extractResources(ListLocationsResponse payload) { + return payload.getLocationsList() == null + ? ImmutableList.of() + : payload.getLocationsList(); + } + }; + private static final PagedListResponseFactory< SearchAgentsRequest, SearchAgentsResponse, SearchAgentsPagedResponse> SEARCH_AGENTS_PAGE_STR_FACT = @@ -188,6 +233,23 @@ public ApiFuture getFuturePagedResponse( } }; + private static final PagedListResponseFactory< + ListLocationsRequest, ListLocationsResponse, ListLocationsPagedResponse> + LIST_LOCATIONS_PAGE_STR_FACT = + new PagedListResponseFactory< + ListLocationsRequest, ListLocationsResponse, ListLocationsPagedResponse>() { + @Override + public ApiFuture getFuturePagedResponse( + UnaryCallable callable, + ListLocationsRequest request, + ApiCallContext context, + ApiFuture futureResponse) { + PageContext pageContext = + PageContext.create(callable, LIST_LOCATIONS_PAGE_STR_DESC, request, context); + return ListLocationsPagedResponse.createAsync(pageContext, futureResponse); + } + }; + /** Returns the object with the settings used for calls to getAgent. */ public UnaryCallSettings getAgentSettings() { return getAgentSettings; @@ -256,6 +318,17 @@ public OperationCallSettings restoreAgentOpe return getValidationResultSettings; } + /** Returns the object with the settings used for calls to listLocations. */ + public PagedCallSettings + listLocationsSettings() { + return listLocationsSettings; + } + + /** Returns the object with the settings used for calls to getLocation. */ + public UnaryCallSettings getLocationSettings() { + return getLocationSettings; + } + public AgentsStub createStub() throws IOException { if (getTransportChannelProvider() .getTransportName() @@ -373,6 +446,8 @@ protected AgentsStubSettings(Builder settingsBuilder) throws IOException { restoreAgentSettings = settingsBuilder.restoreAgentSettings().build(); restoreAgentOperationSettings = settingsBuilder.restoreAgentOperationSettings().build(); getValidationResultSettings = settingsBuilder.getValidationResultSettings().build(); + listLocationsSettings = settingsBuilder.listLocationsSettings().build(); + getLocationSettings = settingsBuilder.getLocationSettings().build(); } /** Builder for AgentsStubSettings. */ @@ -398,6 +473,10 @@ public static class Builder extends StubSettings.Builder getValidationResultSettings; + private final PagedCallSettings.Builder< + ListLocationsRequest, ListLocationsResponse, ListLocationsPagedResponse> + listLocationsSettings; + private final UnaryCallSettings.Builder getLocationSettings; private static final ImmutableMap> RETRYABLE_CODE_DEFINITIONS; @@ -449,6 +528,8 @@ protected Builder(ClientContext clientContext) { restoreAgentSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); restoreAgentOperationSettings = OperationCallSettings.newBuilder(); getValidationResultSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + listLocationsSettings = PagedCallSettings.newBuilder(LIST_LOCATIONS_PAGE_STR_FACT); + getLocationSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); unaryMethodSettingsBuilders = ImmutableList.>of( @@ -460,7 +541,9 @@ protected Builder(ClientContext clientContext) { exportAgentSettings, importAgentSettings, restoreAgentSettings, - getValidationResultSettings); + getValidationResultSettings, + listLocationsSettings, + getLocationSettings); initDefaults(this); } @@ -480,6 +563,8 @@ protected Builder(AgentsStubSettings settings) { restoreAgentSettings = settings.restoreAgentSettings.toBuilder(); restoreAgentOperationSettings = settings.restoreAgentOperationSettings.toBuilder(); getValidationResultSettings = settings.getValidationResultSettings.toBuilder(); + listLocationsSettings = settings.listLocationsSettings.toBuilder(); + getLocationSettings = settings.getLocationSettings.toBuilder(); unaryMethodSettingsBuilders = ImmutableList.>of( @@ -491,7 +576,9 @@ protected Builder(AgentsStubSettings settings) { exportAgentSettings, importAgentSettings, restoreAgentSettings, - getValidationResultSettings); + getValidationResultSettings, + listLocationsSettings, + getLocationSettings); } private static Builder createDefault() { @@ -566,6 +653,16 @@ private static Builder initDefaults(Builder builder) { .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes")) .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params")); + builder + .listLocationsSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params")); + + builder + .getLocationSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params")); + builder .trainAgentOperationSettings() .setInitialCallSettings( @@ -757,6 +854,18 @@ public UnaryCallSettings.Builder restoreAgentSet return getValidationResultSettings; } + /** Returns the builder for the settings used for calls to listLocations. */ + public PagedCallSettings.Builder< + ListLocationsRequest, ListLocationsResponse, ListLocationsPagedResponse> + listLocationsSettings() { + return listLocationsSettings; + } + + /** Returns the builder for the settings used for calls to getLocation. */ + public UnaryCallSettings.Builder getLocationSettings() { + return getLocationSettings; + } + @Override public AgentsStubSettings build() throws IOException { return new AgentsStubSettings(this); diff --git a/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2beta1/stub/AnswerRecordsStub.java b/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2beta1/stub/AnswerRecordsStub.java index f64ee2414..d0d0cc595 100644 --- a/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2beta1/stub/AnswerRecordsStub.java +++ b/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2beta1/stub/AnswerRecordsStub.java @@ -17,6 +17,7 @@ package com.google.cloud.dialogflow.v2beta1.stub; import static com.google.cloud.dialogflow.v2beta1.AnswerRecordsClient.ListAnswerRecordsPagedResponse; +import static com.google.cloud.dialogflow.v2beta1.AnswerRecordsClient.ListLocationsPagedResponse; import com.google.api.core.BetaApi; import com.google.api.gax.core.BackgroundResource; @@ -26,6 +27,10 @@ import com.google.cloud.dialogflow.v2beta1.ListAnswerRecordsRequest; import com.google.cloud.dialogflow.v2beta1.ListAnswerRecordsResponse; import com.google.cloud.dialogflow.v2beta1.UpdateAnswerRecordRequest; +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.ListLocationsResponse; +import com.google.cloud.location.Location; import javax.annotation.Generated; // AUTO-GENERATED DOCUMENTATION AND CLASS. @@ -57,6 +62,19 @@ public UnaryCallable updateAnswerRecord throw new UnsupportedOperationException("Not implemented: updateAnswerRecordCallable()"); } + public UnaryCallable + listLocationsPagedCallable() { + throw new UnsupportedOperationException("Not implemented: listLocationsPagedCallable()"); + } + + public UnaryCallable listLocationsCallable() { + throw new UnsupportedOperationException("Not implemented: listLocationsCallable()"); + } + + public UnaryCallable getLocationCallable() { + throw new UnsupportedOperationException("Not implemented: getLocationCallable()"); + } + @Override public abstract void close(); } diff --git a/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2beta1/stub/AnswerRecordsStubSettings.java b/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2beta1/stub/AnswerRecordsStubSettings.java index 917fc54c6..2c083e10f 100644 --- a/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2beta1/stub/AnswerRecordsStubSettings.java +++ b/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2beta1/stub/AnswerRecordsStubSettings.java @@ -17,6 +17,7 @@ package com.google.cloud.dialogflow.v2beta1.stub; import static com.google.cloud.dialogflow.v2beta1.AnswerRecordsClient.ListAnswerRecordsPagedResponse; +import static com.google.cloud.dialogflow.v2beta1.AnswerRecordsClient.ListLocationsPagedResponse; import com.google.api.core.ApiFunction; import com.google.api.core.ApiFuture; @@ -48,6 +49,10 @@ import com.google.cloud.dialogflow.v2beta1.ListAnswerRecordsRequest; import com.google.cloud.dialogflow.v2beta1.ListAnswerRecordsResponse; import com.google.cloud.dialogflow.v2beta1.UpdateAnswerRecordRequest; +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.ListLocationsResponse; +import com.google.cloud.location.Location; import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableMap; import com.google.common.collect.ImmutableSet; @@ -107,6 +112,10 @@ public class AnswerRecordsStubSettings extends StubSettings updateAnswerRecordSettings; + private final PagedCallSettings< + ListLocationsRequest, ListLocationsResponse, ListLocationsPagedResponse> + listLocationsSettings; + private final UnaryCallSettings getLocationSettings; private static final PagedListDescriptor< ListAnswerRecordsRequest, ListAnswerRecordsResponse, AnswerRecord> @@ -148,6 +157,42 @@ public Iterable extractResources(ListAnswerRecordsResponse payload } }; + private static final PagedListDescriptor + LIST_LOCATIONS_PAGE_STR_DESC = + new PagedListDescriptor() { + @Override + public String emptyToken() { + return ""; + } + + @Override + public ListLocationsRequest injectToken(ListLocationsRequest payload, String token) { + return ListLocationsRequest.newBuilder(payload).setPageToken(token).build(); + } + + @Override + public ListLocationsRequest injectPageSize(ListLocationsRequest payload, int pageSize) { + return ListLocationsRequest.newBuilder(payload).setPageSize(pageSize).build(); + } + + @Override + public Integer extractPageSize(ListLocationsRequest payload) { + return payload.getPageSize(); + } + + @Override + public String extractNextToken(ListLocationsResponse payload) { + return payload.getNextPageToken(); + } + + @Override + public Iterable extractResources(ListLocationsResponse payload) { + return payload.getLocationsList() == null + ? ImmutableList.of() + : payload.getLocationsList(); + } + }; + private static final PagedListResponseFactory< ListAnswerRecordsRequest, ListAnswerRecordsResponse, ListAnswerRecordsPagedResponse> LIST_ANSWER_RECORDS_PAGE_STR_FACT = @@ -169,6 +214,23 @@ public ApiFuture getFuturePagedResponse( } }; + private static final PagedListResponseFactory< + ListLocationsRequest, ListLocationsResponse, ListLocationsPagedResponse> + LIST_LOCATIONS_PAGE_STR_FACT = + new PagedListResponseFactory< + ListLocationsRequest, ListLocationsResponse, ListLocationsPagedResponse>() { + @Override + public ApiFuture getFuturePagedResponse( + UnaryCallable callable, + ListLocationsRequest request, + ApiCallContext context, + ApiFuture futureResponse) { + PageContext pageContext = + PageContext.create(callable, LIST_LOCATIONS_PAGE_STR_DESC, request, context); + return ListLocationsPagedResponse.createAsync(pageContext, futureResponse); + } + }; + /** * Returns the object with the settings used for calls to getAnswerRecord. * @@ -191,6 +253,17 @@ public UnaryCallSettings updateAnswerRe return updateAnswerRecordSettings; } + /** Returns the object with the settings used for calls to listLocations. */ + public PagedCallSettings + listLocationsSettings() { + return listLocationsSettings; + } + + /** Returns the object with the settings used for calls to getLocation. */ + public UnaryCallSettings getLocationSettings() { + return getLocationSettings; + } + public AnswerRecordsStub createStub() throws IOException { if (getTransportChannelProvider() .getTransportName() @@ -300,6 +373,8 @@ protected AnswerRecordsStubSettings(Builder settingsBuilder) throws IOException getAnswerRecordSettings = settingsBuilder.getAnswerRecordSettings().build(); listAnswerRecordsSettings = settingsBuilder.listAnswerRecordsSettings().build(); updateAnswerRecordSettings = settingsBuilder.updateAnswerRecordSettings().build(); + listLocationsSettings = settingsBuilder.listLocationsSettings().build(); + getLocationSettings = settingsBuilder.getLocationSettings().build(); } /** Builder for AnswerRecordsStubSettings. */ @@ -312,6 +387,10 @@ public static class Builder extends StubSettings.Builder updateAnswerRecordSettings; + private final PagedCallSettings.Builder< + ListLocationsRequest, ListLocationsResponse, ListLocationsPagedResponse> + listLocationsSettings; + private final UnaryCallSettings.Builder getLocationSettings; private static final ImmutableMap> RETRYABLE_CODE_DEFINITIONS; @@ -353,10 +432,16 @@ protected Builder(ClientContext clientContext) { getAnswerRecordSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); listAnswerRecordsSettings = PagedCallSettings.newBuilder(LIST_ANSWER_RECORDS_PAGE_STR_FACT); updateAnswerRecordSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + listLocationsSettings = PagedCallSettings.newBuilder(LIST_LOCATIONS_PAGE_STR_FACT); + getLocationSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); unaryMethodSettingsBuilders = ImmutableList.>of( - getAnswerRecordSettings, listAnswerRecordsSettings, updateAnswerRecordSettings); + getAnswerRecordSettings, + listAnswerRecordsSettings, + updateAnswerRecordSettings, + listLocationsSettings, + getLocationSettings); initDefaults(this); } @@ -366,10 +451,16 @@ protected Builder(AnswerRecordsStubSettings settings) { getAnswerRecordSettings = settings.getAnswerRecordSettings.toBuilder(); listAnswerRecordsSettings = settings.listAnswerRecordsSettings.toBuilder(); updateAnswerRecordSettings = settings.updateAnswerRecordSettings.toBuilder(); + listLocationsSettings = settings.listLocationsSettings.toBuilder(); + getLocationSettings = settings.getLocationSettings.toBuilder(); unaryMethodSettingsBuilders = ImmutableList.>of( - getAnswerRecordSettings, listAnswerRecordsSettings, updateAnswerRecordSettings); + getAnswerRecordSettings, + listAnswerRecordsSettings, + updateAnswerRecordSettings, + listLocationsSettings, + getLocationSettings); } private static Builder createDefault() { @@ -414,6 +505,16 @@ private static Builder initDefaults(Builder builder) { .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes")) .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params")); + builder + .listLocationsSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params")); + + builder + .getLocationSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params")); + return builder; } @@ -456,6 +557,18 @@ public Builder applyToAllUnaryMethods( return updateAnswerRecordSettings; } + /** Returns the builder for the settings used for calls to listLocations. */ + public PagedCallSettings.Builder< + ListLocationsRequest, ListLocationsResponse, ListLocationsPagedResponse> + listLocationsSettings() { + return listLocationsSettings; + } + + /** Returns the builder for the settings used for calls to getLocation. */ + public UnaryCallSettings.Builder getLocationSettings() { + return getLocationSettings; + } + @Override public AnswerRecordsStubSettings build() throws IOException { return new AnswerRecordsStubSettings(this); diff --git a/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2beta1/stub/ContextsStub.java b/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2beta1/stub/ContextsStub.java index a0a0182f5..118ac77c3 100644 --- a/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2beta1/stub/ContextsStub.java +++ b/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2beta1/stub/ContextsStub.java @@ -17,6 +17,7 @@ package com.google.cloud.dialogflow.v2beta1.stub; import static com.google.cloud.dialogflow.v2beta1.ContextsClient.ListContextsPagedResponse; +import static com.google.cloud.dialogflow.v2beta1.ContextsClient.ListLocationsPagedResponse; import com.google.api.core.BetaApi; import com.google.api.gax.core.BackgroundResource; @@ -29,6 +30,10 @@ import com.google.cloud.dialogflow.v2beta1.ListContextsRequest; import com.google.cloud.dialogflow.v2beta1.ListContextsResponse; import com.google.cloud.dialogflow.v2beta1.UpdateContextRequest; +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.ListLocationsResponse; +import com.google.cloud.location.Location; import com.google.protobuf.Empty; import javax.annotation.Generated; @@ -70,6 +75,19 @@ public UnaryCallable deleteAllContextsCallable( throw new UnsupportedOperationException("Not implemented: deleteAllContextsCallable()"); } + public UnaryCallable + listLocationsPagedCallable() { + throw new UnsupportedOperationException("Not implemented: listLocationsPagedCallable()"); + } + + public UnaryCallable listLocationsCallable() { + throw new UnsupportedOperationException("Not implemented: listLocationsCallable()"); + } + + public UnaryCallable getLocationCallable() { + throw new UnsupportedOperationException("Not implemented: getLocationCallable()"); + } + @Override public abstract void close(); } diff --git a/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2beta1/stub/ContextsStubSettings.java b/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2beta1/stub/ContextsStubSettings.java index ae0ad5fe5..20ef2afd0 100644 --- a/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2beta1/stub/ContextsStubSettings.java +++ b/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2beta1/stub/ContextsStubSettings.java @@ -17,6 +17,7 @@ package com.google.cloud.dialogflow.v2beta1.stub; import static com.google.cloud.dialogflow.v2beta1.ContextsClient.ListContextsPagedResponse; +import static com.google.cloud.dialogflow.v2beta1.ContextsClient.ListLocationsPagedResponse; import com.google.api.core.ApiFunction; import com.google.api.core.ApiFuture; @@ -51,6 +52,10 @@ import com.google.cloud.dialogflow.v2beta1.ListContextsRequest; import com.google.cloud.dialogflow.v2beta1.ListContextsResponse; import com.google.cloud.dialogflow.v2beta1.UpdateContextRequest; +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.ListLocationsResponse; +import com.google.cloud.location.Location; import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableMap; import com.google.common.collect.ImmutableSet; @@ -112,6 +117,10 @@ public class ContextsStubSettings extends StubSettings { private final UnaryCallSettings updateContextSettings; private final UnaryCallSettings deleteContextSettings; private final UnaryCallSettings deleteAllContextsSettings; + private final PagedCallSettings< + ListLocationsRequest, ListLocationsResponse, ListLocationsPagedResponse> + listLocationsSettings; + private final UnaryCallSettings getLocationSettings; private static final PagedListDescriptor LIST_CONTEXTS_PAGE_STR_DESC = @@ -149,6 +158,42 @@ public Iterable extractResources(ListContextsResponse payload) { } }; + private static final PagedListDescriptor + LIST_LOCATIONS_PAGE_STR_DESC = + new PagedListDescriptor() { + @Override + public String emptyToken() { + return ""; + } + + @Override + public ListLocationsRequest injectToken(ListLocationsRequest payload, String token) { + return ListLocationsRequest.newBuilder(payload).setPageToken(token).build(); + } + + @Override + public ListLocationsRequest injectPageSize(ListLocationsRequest payload, int pageSize) { + return ListLocationsRequest.newBuilder(payload).setPageSize(pageSize).build(); + } + + @Override + public Integer extractPageSize(ListLocationsRequest payload) { + return payload.getPageSize(); + } + + @Override + public String extractNextToken(ListLocationsResponse payload) { + return payload.getNextPageToken(); + } + + @Override + public Iterable extractResources(ListLocationsResponse payload) { + return payload.getLocationsList() == null + ? ImmutableList.of() + : payload.getLocationsList(); + } + }; + private static final PagedListResponseFactory< ListContextsRequest, ListContextsResponse, ListContextsPagedResponse> LIST_CONTEXTS_PAGE_STR_FACT = @@ -166,6 +211,23 @@ public ApiFuture getFuturePagedResponse( } }; + private static final PagedListResponseFactory< + ListLocationsRequest, ListLocationsResponse, ListLocationsPagedResponse> + LIST_LOCATIONS_PAGE_STR_FACT = + new PagedListResponseFactory< + ListLocationsRequest, ListLocationsResponse, ListLocationsPagedResponse>() { + @Override + public ApiFuture getFuturePagedResponse( + UnaryCallable callable, + ListLocationsRequest request, + ApiCallContext context, + ApiFuture futureResponse) { + PageContext pageContext = + PageContext.create(callable, LIST_LOCATIONS_PAGE_STR_DESC, request, context); + return ListLocationsPagedResponse.createAsync(pageContext, futureResponse); + } + }; + /** Returns the object with the settings used for calls to listContexts. */ public PagedCallSettings listContextsSettings() { @@ -197,6 +259,17 @@ public UnaryCallSettings deleteAllContextsSetti return deleteAllContextsSettings; } + /** Returns the object with the settings used for calls to listLocations. */ + public PagedCallSettings + listLocationsSettings() { + return listLocationsSettings; + } + + /** Returns the object with the settings used for calls to getLocation. */ + public UnaryCallSettings getLocationSettings() { + return getLocationSettings; + } + public ContextsStub createStub() throws IOException { if (getTransportChannelProvider() .getTransportName() @@ -307,6 +380,8 @@ protected ContextsStubSettings(Builder settingsBuilder) throws IOException { updateContextSettings = settingsBuilder.updateContextSettings().build(); deleteContextSettings = settingsBuilder.deleteContextSettings().build(); deleteAllContextsSettings = settingsBuilder.deleteAllContextsSettings().build(); + listLocationsSettings = settingsBuilder.listLocationsSettings().build(); + getLocationSettings = settingsBuilder.getLocationSettings().build(); } /** Builder for ContextsStubSettings. */ @@ -321,6 +396,10 @@ public static class Builder extends StubSettings.Builder deleteContextSettings; private final UnaryCallSettings.Builder deleteAllContextsSettings; + private final PagedCallSettings.Builder< + ListLocationsRequest, ListLocationsResponse, ListLocationsPagedResponse> + listLocationsSettings; + private final UnaryCallSettings.Builder getLocationSettings; private static final ImmutableMap> RETRYABLE_CODE_DEFINITIONS; @@ -365,6 +444,8 @@ protected Builder(ClientContext clientContext) { updateContextSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); deleteContextSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); deleteAllContextsSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + listLocationsSettings = PagedCallSettings.newBuilder(LIST_LOCATIONS_PAGE_STR_FACT); + getLocationSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); unaryMethodSettingsBuilders = ImmutableList.>of( @@ -373,7 +454,9 @@ protected Builder(ClientContext clientContext) { createContextSettings, updateContextSettings, deleteContextSettings, - deleteAllContextsSettings); + deleteAllContextsSettings, + listLocationsSettings, + getLocationSettings); initDefaults(this); } @@ -386,6 +469,8 @@ protected Builder(ContextsStubSettings settings) { updateContextSettings = settings.updateContextSettings.toBuilder(); deleteContextSettings = settings.deleteContextSettings.toBuilder(); deleteAllContextsSettings = settings.deleteAllContextsSettings.toBuilder(); + listLocationsSettings = settings.listLocationsSettings.toBuilder(); + getLocationSettings = settings.getLocationSettings.toBuilder(); unaryMethodSettingsBuilders = ImmutableList.>of( @@ -394,7 +479,9 @@ protected Builder(ContextsStubSettings settings) { createContextSettings, updateContextSettings, deleteContextSettings, - deleteAllContextsSettings); + deleteAllContextsSettings, + listLocationsSettings, + getLocationSettings); } private static Builder createDefault() { @@ -454,6 +541,16 @@ private static Builder initDefaults(Builder builder) { .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes")) .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params")); + builder + .listLocationsSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params")); + + builder + .getLocationSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params")); + return builder; } @@ -504,6 +601,18 @@ public UnaryCallSettings.Builder deleteAllConte return deleteAllContextsSettings; } + /** Returns the builder for the settings used for calls to listLocations. */ + public PagedCallSettings.Builder< + ListLocationsRequest, ListLocationsResponse, ListLocationsPagedResponse> + listLocationsSettings() { + return listLocationsSettings; + } + + /** Returns the builder for the settings used for calls to getLocation. */ + public UnaryCallSettings.Builder getLocationSettings() { + return getLocationSettings; + } + @Override public ContextsStubSettings build() throws IOException { return new ContextsStubSettings(this); diff --git a/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2beta1/stub/ConversationProfilesStub.java b/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2beta1/stub/ConversationProfilesStub.java index f9b1c0785..0bfe83620 100644 --- a/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2beta1/stub/ConversationProfilesStub.java +++ b/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2beta1/stub/ConversationProfilesStub.java @@ -17,6 +17,7 @@ package com.google.cloud.dialogflow.v2beta1.stub; import static com.google.cloud.dialogflow.v2beta1.ConversationProfilesClient.ListConversationProfilesPagedResponse; +import static com.google.cloud.dialogflow.v2beta1.ConversationProfilesClient.ListLocationsPagedResponse; import com.google.api.core.BetaApi; import com.google.api.gax.core.BackgroundResource; @@ -33,6 +34,10 @@ import com.google.cloud.dialogflow.v2beta1.SetSuggestionFeatureConfigOperationMetadata; import com.google.cloud.dialogflow.v2beta1.SetSuggestionFeatureConfigRequest; import com.google.cloud.dialogflow.v2beta1.UpdateConversationProfileRequest; +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.ListLocationsResponse; +import com.google.cloud.location.Location; import com.google.longrunning.Operation; import com.google.longrunning.stub.OperationsStub; import com.google.protobuf.Empty; @@ -117,6 +122,19 @@ public com.google.api.gax.httpjson.longrunning.stub.OperationsStub getHttpJsonOp "Not implemented: clearSuggestionFeatureConfigCallable()"); } + public UnaryCallable + listLocationsPagedCallable() { + throw new UnsupportedOperationException("Not implemented: listLocationsPagedCallable()"); + } + + public UnaryCallable listLocationsCallable() { + throw new UnsupportedOperationException("Not implemented: listLocationsCallable()"); + } + + public UnaryCallable getLocationCallable() { + throw new UnsupportedOperationException("Not implemented: getLocationCallable()"); + } + @Override public abstract void close(); } diff --git a/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2beta1/stub/ConversationProfilesStubSettings.java b/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2beta1/stub/ConversationProfilesStubSettings.java index 5de2a7f01..3d69f894d 100644 --- a/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2beta1/stub/ConversationProfilesStubSettings.java +++ b/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2beta1/stub/ConversationProfilesStubSettings.java @@ -17,6 +17,7 @@ package com.google.cloud.dialogflow.v2beta1.stub; import static com.google.cloud.dialogflow.v2beta1.ConversationProfilesClient.ListConversationProfilesPagedResponse; +import static com.google.cloud.dialogflow.v2beta1.ConversationProfilesClient.ListLocationsPagedResponse; import com.google.api.core.ApiFunction; import com.google.api.core.ApiFuture; @@ -58,6 +59,10 @@ import com.google.cloud.dialogflow.v2beta1.SetSuggestionFeatureConfigOperationMetadata; import com.google.cloud.dialogflow.v2beta1.SetSuggestionFeatureConfigRequest; import com.google.cloud.dialogflow.v2beta1.UpdateConversationProfileRequest; +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.ListLocationsResponse; +import com.google.cloud.location.Location; import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableMap; import com.google.common.collect.ImmutableSet; @@ -142,6 +147,10 @@ public class ConversationProfilesStubSettings ConversationProfile, ClearSuggestionFeatureConfigOperationMetadata> clearSuggestionFeatureConfigOperationSettings; + private final PagedCallSettings< + ListLocationsRequest, ListLocationsResponse, ListLocationsPagedResponse> + listLocationsSettings; + private final UnaryCallSettings getLocationSettings; private static final PagedListDescriptor< ListConversationProfilesRequest, ListConversationProfilesResponse, ConversationProfile> @@ -190,6 +199,42 @@ public Iterable extractResources( } }; + private static final PagedListDescriptor + LIST_LOCATIONS_PAGE_STR_DESC = + new PagedListDescriptor() { + @Override + public String emptyToken() { + return ""; + } + + @Override + public ListLocationsRequest injectToken(ListLocationsRequest payload, String token) { + return ListLocationsRequest.newBuilder(payload).setPageToken(token).build(); + } + + @Override + public ListLocationsRequest injectPageSize(ListLocationsRequest payload, int pageSize) { + return ListLocationsRequest.newBuilder(payload).setPageSize(pageSize).build(); + } + + @Override + public Integer extractPageSize(ListLocationsRequest payload) { + return payload.getPageSize(); + } + + @Override + public String extractNextToken(ListLocationsResponse payload) { + return payload.getNextPageToken(); + } + + @Override + public Iterable extractResources(ListLocationsResponse payload) { + return payload.getLocationsList() == null + ? ImmutableList.of() + : payload.getLocationsList(); + } + }; + private static final PagedListResponseFactory< ListConversationProfilesRequest, ListConversationProfilesResponse, @@ -217,6 +262,23 @@ public ApiFuture getFuturePagedResponse( } }; + private static final PagedListResponseFactory< + ListLocationsRequest, ListLocationsResponse, ListLocationsPagedResponse> + LIST_LOCATIONS_PAGE_STR_FACT = + new PagedListResponseFactory< + ListLocationsRequest, ListLocationsResponse, ListLocationsPagedResponse>() { + @Override + public ApiFuture getFuturePagedResponse( + UnaryCallable callable, + ListLocationsRequest request, + ApiCallContext context, + ApiFuture futureResponse) { + PageContext pageContext = + PageContext.create(callable, LIST_LOCATIONS_PAGE_STR_DESC, request, context); + return ListLocationsPagedResponse.createAsync(pageContext, futureResponse); + } + }; + /** Returns the object with the settings used for calls to listConversationProfiles. */ public PagedCallSettings< ListConversationProfilesRequest, @@ -280,6 +342,17 @@ public ApiFuture getFuturePagedResponse( return clearSuggestionFeatureConfigOperationSettings; } + /** Returns the object with the settings used for calls to listLocations. */ + public PagedCallSettings + listLocationsSettings() { + return listLocationsSettings; + } + + /** Returns the object with the settings used for calls to getLocation. */ + public UnaryCallSettings getLocationSettings() { + return getLocationSettings; + } + public ConversationProfilesStub createStub() throws IOException { if (getTransportChannelProvider() .getTransportName() @@ -399,6 +472,8 @@ protected ConversationProfilesStubSettings(Builder settingsBuilder) throws IOExc settingsBuilder.clearSuggestionFeatureConfigSettings().build(); clearSuggestionFeatureConfigOperationSettings = settingsBuilder.clearSuggestionFeatureConfigOperationSettings().build(); + listLocationsSettings = settingsBuilder.listLocationsSettings().build(); + getLocationSettings = settingsBuilder.getLocationSettings().build(); } /** Builder for ConversationProfilesStubSettings. */ @@ -432,6 +507,10 @@ public static class Builder ConversationProfile, ClearSuggestionFeatureConfigOperationMetadata> clearSuggestionFeatureConfigOperationSettings; + private final PagedCallSettings.Builder< + ListLocationsRequest, ListLocationsResponse, ListLocationsPagedResponse> + listLocationsSettings; + private final UnaryCallSettings.Builder getLocationSettings; private static final ImmutableMap> RETRYABLE_CODE_DEFINITIONS; @@ -480,6 +559,8 @@ protected Builder(ClientContext clientContext) { setSuggestionFeatureConfigOperationSettings = OperationCallSettings.newBuilder(); clearSuggestionFeatureConfigSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); clearSuggestionFeatureConfigOperationSettings = OperationCallSettings.newBuilder(); + listLocationsSettings = PagedCallSettings.newBuilder(LIST_LOCATIONS_PAGE_STR_FACT); + getLocationSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); unaryMethodSettingsBuilders = ImmutableList.>of( @@ -489,7 +570,9 @@ protected Builder(ClientContext clientContext) { updateConversationProfileSettings, deleteConversationProfileSettings, setSuggestionFeatureConfigSettings, - clearSuggestionFeatureConfigSettings); + clearSuggestionFeatureConfigSettings, + listLocationsSettings, + getLocationSettings); initDefaults(this); } @@ -508,6 +591,8 @@ protected Builder(ConversationProfilesStubSettings settings) { settings.clearSuggestionFeatureConfigSettings.toBuilder(); clearSuggestionFeatureConfigOperationSettings = settings.clearSuggestionFeatureConfigOperationSettings.toBuilder(); + listLocationsSettings = settings.listLocationsSettings.toBuilder(); + getLocationSettings = settings.getLocationSettings.toBuilder(); unaryMethodSettingsBuilders = ImmutableList.>of( @@ -517,7 +602,9 @@ protected Builder(ConversationProfilesStubSettings settings) { updateConversationProfileSettings, deleteConversationProfileSettings, setSuggestionFeatureConfigSettings, - clearSuggestionFeatureConfigSettings); + clearSuggestionFeatureConfigSettings, + listLocationsSettings, + getLocationSettings); } private static Builder createDefault() { @@ -582,6 +669,16 @@ private static Builder initDefaults(Builder builder) { .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes")) .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params")); + builder + .listLocationsSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params")); + + builder + .getLocationSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params")); + builder .setSuggestionFeatureConfigOperationSettings() .setInitialCallSettings( @@ -719,6 +816,18 @@ public Builder applyToAllUnaryMethods( return clearSuggestionFeatureConfigOperationSettings; } + /** Returns the builder for the settings used for calls to listLocations. */ + public PagedCallSettings.Builder< + ListLocationsRequest, ListLocationsResponse, ListLocationsPagedResponse> + listLocationsSettings() { + return listLocationsSettings; + } + + /** Returns the builder for the settings used for calls to getLocation. */ + public UnaryCallSettings.Builder getLocationSettings() { + return getLocationSettings; + } + @Override public ConversationProfilesStubSettings build() throws IOException { return new ConversationProfilesStubSettings(this); diff --git a/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2beta1/stub/ConversationsStub.java b/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2beta1/stub/ConversationsStub.java index 0c0d7438b..46269a8f0 100644 --- a/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2beta1/stub/ConversationsStub.java +++ b/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2beta1/stub/ConversationsStub.java @@ -17,6 +17,7 @@ package com.google.cloud.dialogflow.v2beta1.stub; import static com.google.cloud.dialogflow.v2beta1.ConversationsClient.ListConversationsPagedResponse; +import static com.google.cloud.dialogflow.v2beta1.ConversationsClient.ListLocationsPagedResponse; import static com.google.cloud.dialogflow.v2beta1.ConversationsClient.ListMessagesPagedResponse; import com.google.api.core.BetaApi; @@ -32,6 +33,10 @@ import com.google.cloud.dialogflow.v2beta1.ListConversationsResponse; import com.google.cloud.dialogflow.v2beta1.ListMessagesRequest; import com.google.cloud.dialogflow.v2beta1.ListMessagesResponse; +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.ListLocationsResponse; +import com.google.cloud.location.Location; import javax.annotation.Generated; // AUTO-GENERATED DOCUMENTATION AND CLASS. @@ -79,6 +84,19 @@ public UnaryCallable listMessagesCall throw new UnsupportedOperationException("Not implemented: listMessagesCallable()"); } + public UnaryCallable + listLocationsPagedCallable() { + throw new UnsupportedOperationException("Not implemented: listLocationsPagedCallable()"); + } + + public UnaryCallable listLocationsCallable() { + throw new UnsupportedOperationException("Not implemented: listLocationsCallable()"); + } + + public UnaryCallable getLocationCallable() { + throw new UnsupportedOperationException("Not implemented: getLocationCallable()"); + } + @Override public abstract void close(); } diff --git a/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2beta1/stub/ConversationsStubSettings.java b/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2beta1/stub/ConversationsStubSettings.java index b2e7772fe..cfdbbbea0 100644 --- a/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2beta1/stub/ConversationsStubSettings.java +++ b/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2beta1/stub/ConversationsStubSettings.java @@ -17,6 +17,7 @@ package com.google.cloud.dialogflow.v2beta1.stub; import static com.google.cloud.dialogflow.v2beta1.ConversationsClient.ListConversationsPagedResponse; +import static com.google.cloud.dialogflow.v2beta1.ConversationsClient.ListLocationsPagedResponse; import static com.google.cloud.dialogflow.v2beta1.ConversationsClient.ListMessagesPagedResponse; import com.google.api.core.ApiFunction; @@ -55,6 +56,10 @@ import com.google.cloud.dialogflow.v2beta1.ListMessagesRequest; import com.google.cloud.dialogflow.v2beta1.ListMessagesResponse; import com.google.cloud.dialogflow.v2beta1.Message; +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.ListLocationsResponse; +import com.google.cloud.location.Location; import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableMap; import com.google.common.collect.ImmutableSet; @@ -121,6 +126,10 @@ public class ConversationsStubSettings extends StubSettings listMessagesSettings; + private final PagedCallSettings< + ListLocationsRequest, ListLocationsResponse, ListLocationsPagedResponse> + listLocationsSettings; + private final UnaryCallSettings getLocationSettings; private static final PagedListDescriptor< ListConversationsRequest, ListConversationsResponse, Conversation> @@ -198,6 +207,42 @@ public Iterable extractResources(ListMessagesResponse payload) { } }; + private static final PagedListDescriptor + LIST_LOCATIONS_PAGE_STR_DESC = + new PagedListDescriptor() { + @Override + public String emptyToken() { + return ""; + } + + @Override + public ListLocationsRequest injectToken(ListLocationsRequest payload, String token) { + return ListLocationsRequest.newBuilder(payload).setPageToken(token).build(); + } + + @Override + public ListLocationsRequest injectPageSize(ListLocationsRequest payload, int pageSize) { + return ListLocationsRequest.newBuilder(payload).setPageSize(pageSize).build(); + } + + @Override + public Integer extractPageSize(ListLocationsRequest payload) { + return payload.getPageSize(); + } + + @Override + public String extractNextToken(ListLocationsResponse payload) { + return payload.getNextPageToken(); + } + + @Override + public Iterable extractResources(ListLocationsResponse payload) { + return payload.getLocationsList() == null + ? ImmutableList.of() + : payload.getLocationsList(); + } + }; + private static final PagedListResponseFactory< ListConversationsRequest, ListConversationsResponse, ListConversationsPagedResponse> LIST_CONVERSATIONS_PAGE_STR_FACT = @@ -236,6 +281,23 @@ public ApiFuture getFuturePagedResponse( } }; + private static final PagedListResponseFactory< + ListLocationsRequest, ListLocationsResponse, ListLocationsPagedResponse> + LIST_LOCATIONS_PAGE_STR_FACT = + new PagedListResponseFactory< + ListLocationsRequest, ListLocationsResponse, ListLocationsPagedResponse>() { + @Override + public ApiFuture getFuturePagedResponse( + UnaryCallable callable, + ListLocationsRequest request, + ApiCallContext context, + ApiFuture futureResponse) { + PageContext pageContext = + PageContext.create(callable, LIST_LOCATIONS_PAGE_STR_DESC, request, context); + return ListLocationsPagedResponse.createAsync(pageContext, futureResponse); + } + }; + /** Returns the object with the settings used for calls to createConversation. */ public UnaryCallSettings createConversationSettings() { return createConversationSettings; @@ -271,6 +333,17 @@ public UnaryCallSettings getConversationSe return listMessagesSettings; } + /** Returns the object with the settings used for calls to listLocations. */ + public PagedCallSettings + listLocationsSettings() { + return listLocationsSettings; + } + + /** Returns the object with the settings used for calls to getLocation. */ + public UnaryCallSettings getLocationSettings() { + return getLocationSettings; + } + public ConversationsStub createStub() throws IOException { if (getTransportChannelProvider() .getTransportName() @@ -383,6 +456,8 @@ protected ConversationsStubSettings(Builder settingsBuilder) throws IOException completeConversationSettings = settingsBuilder.completeConversationSettings().build(); batchCreateMessagesSettings = settingsBuilder.batchCreateMessagesSettings().build(); listMessagesSettings = settingsBuilder.listMessagesSettings().build(); + listLocationsSettings = settingsBuilder.listLocationsSettings().build(); + getLocationSettings = settingsBuilder.getLocationSettings().build(); } /** Builder for ConversationsStubSettings. */ @@ -402,6 +477,10 @@ public static class Builder extends StubSettings.Builder listMessagesSettings; + private final PagedCallSettings.Builder< + ListLocationsRequest, ListLocationsResponse, ListLocationsPagedResponse> + listLocationsSettings; + private final UnaryCallSettings.Builder getLocationSettings; private static final ImmutableMap> RETRYABLE_CODE_DEFINITIONS; @@ -446,6 +525,8 @@ protected Builder(ClientContext clientContext) { completeConversationSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); batchCreateMessagesSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); listMessagesSettings = PagedCallSettings.newBuilder(LIST_MESSAGES_PAGE_STR_FACT); + listLocationsSettings = PagedCallSettings.newBuilder(LIST_LOCATIONS_PAGE_STR_FACT); + getLocationSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); unaryMethodSettingsBuilders = ImmutableList.>of( @@ -454,7 +535,9 @@ protected Builder(ClientContext clientContext) { getConversationSettings, completeConversationSettings, batchCreateMessagesSettings, - listMessagesSettings); + listMessagesSettings, + listLocationsSettings, + getLocationSettings); initDefaults(this); } @@ -467,6 +550,8 @@ protected Builder(ConversationsStubSettings settings) { completeConversationSettings = settings.completeConversationSettings.toBuilder(); batchCreateMessagesSettings = settings.batchCreateMessagesSettings.toBuilder(); listMessagesSettings = settings.listMessagesSettings.toBuilder(); + listLocationsSettings = settings.listLocationsSettings.toBuilder(); + getLocationSettings = settings.getLocationSettings.toBuilder(); unaryMethodSettingsBuilders = ImmutableList.>of( @@ -475,7 +560,9 @@ protected Builder(ConversationsStubSettings settings) { getConversationSettings, completeConversationSettings, batchCreateMessagesSettings, - listMessagesSettings); + listMessagesSettings, + listLocationsSettings, + getLocationSettings); } private static Builder createDefault() { @@ -535,6 +622,16 @@ private static Builder initDefaults(Builder builder) { .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes")) .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params")); + builder + .listLocationsSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params")); + + builder + .getLocationSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params")); + return builder; } @@ -591,6 +688,18 @@ public Builder applyToAllUnaryMethods( return listMessagesSettings; } + /** Returns the builder for the settings used for calls to listLocations. */ + public PagedCallSettings.Builder< + ListLocationsRequest, ListLocationsResponse, ListLocationsPagedResponse> + listLocationsSettings() { + return listLocationsSettings; + } + + /** Returns the builder for the settings used for calls to getLocation. */ + public UnaryCallSettings.Builder getLocationSettings() { + return getLocationSettings; + } + @Override public ConversationsStubSettings build() throws IOException { return new ConversationsStubSettings(this); diff --git a/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2beta1/stub/DocumentsStub.java b/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2beta1/stub/DocumentsStub.java index 54f53627b..690f933ea 100644 --- a/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2beta1/stub/DocumentsStub.java +++ b/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2beta1/stub/DocumentsStub.java @@ -17,6 +17,7 @@ package com.google.cloud.dialogflow.v2beta1.stub; import static com.google.cloud.dialogflow.v2beta1.DocumentsClient.ListDocumentsPagedResponse; +import static com.google.cloud.dialogflow.v2beta1.DocumentsClient.ListLocationsPagedResponse; import com.google.api.core.BetaApi; import com.google.api.gax.core.BackgroundResource; @@ -33,6 +34,10 @@ import com.google.cloud.dialogflow.v2beta1.ListDocumentsResponse; import com.google.cloud.dialogflow.v2beta1.ReloadDocumentRequest; import com.google.cloud.dialogflow.v2beta1.UpdateDocumentRequest; +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.ListLocationsResponse; +import com.google.cloud.location.Location; import com.google.longrunning.Operation; import com.google.longrunning.stub.OperationsStub; import com.google.protobuf.Empty; @@ -115,6 +120,19 @@ public UnaryCallable reloadDocumentCallable() throw new UnsupportedOperationException("Not implemented: reloadDocumentCallable()"); } + public UnaryCallable + listLocationsPagedCallable() { + throw new UnsupportedOperationException("Not implemented: listLocationsPagedCallable()"); + } + + public UnaryCallable listLocationsCallable() { + throw new UnsupportedOperationException("Not implemented: listLocationsCallable()"); + } + + public UnaryCallable getLocationCallable() { + throw new UnsupportedOperationException("Not implemented: getLocationCallable()"); + } + @Override public abstract void close(); } diff --git a/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2beta1/stub/DocumentsStubSettings.java b/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2beta1/stub/DocumentsStubSettings.java index 9741ceeed..b50c6056f 100644 --- a/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2beta1/stub/DocumentsStubSettings.java +++ b/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2beta1/stub/DocumentsStubSettings.java @@ -17,6 +17,7 @@ package com.google.cloud.dialogflow.v2beta1.stub; import static com.google.cloud.dialogflow.v2beta1.DocumentsClient.ListDocumentsPagedResponse; +import static com.google.cloud.dialogflow.v2beta1.DocumentsClient.ListLocationsPagedResponse; import com.google.api.core.ApiFunction; import com.google.api.core.ApiFuture; @@ -58,6 +59,10 @@ import com.google.cloud.dialogflow.v2beta1.ListDocumentsResponse; import com.google.cloud.dialogflow.v2beta1.ReloadDocumentRequest; import com.google.cloud.dialogflow.v2beta1.UpdateDocumentRequest; +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.ListLocationsResponse; +import com.google.cloud.location.Location; import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableMap; import com.google.common.collect.ImmutableSet; @@ -132,6 +137,10 @@ public class DocumentsStubSettings extends StubSettings { private final UnaryCallSettings reloadDocumentSettings; private final OperationCallSettings reloadDocumentOperationSettings; + private final PagedCallSettings< + ListLocationsRequest, ListLocationsResponse, ListLocationsPagedResponse> + listLocationsSettings; + private final UnaryCallSettings getLocationSettings; private static final PagedListDescriptor LIST_DOCUMENTS_PAGE_STR_DESC = @@ -169,6 +178,42 @@ public Iterable extractResources(ListDocumentsResponse payload) { } }; + private static final PagedListDescriptor + LIST_LOCATIONS_PAGE_STR_DESC = + new PagedListDescriptor() { + @Override + public String emptyToken() { + return ""; + } + + @Override + public ListLocationsRequest injectToken(ListLocationsRequest payload, String token) { + return ListLocationsRequest.newBuilder(payload).setPageToken(token).build(); + } + + @Override + public ListLocationsRequest injectPageSize(ListLocationsRequest payload, int pageSize) { + return ListLocationsRequest.newBuilder(payload).setPageSize(pageSize).build(); + } + + @Override + public Integer extractPageSize(ListLocationsRequest payload) { + return payload.getPageSize(); + } + + @Override + public String extractNextToken(ListLocationsResponse payload) { + return payload.getNextPageToken(); + } + + @Override + public Iterable extractResources(ListLocationsResponse payload) { + return payload.getLocationsList() == null + ? ImmutableList.of() + : payload.getLocationsList(); + } + }; + private static final PagedListResponseFactory< ListDocumentsRequest, ListDocumentsResponse, ListDocumentsPagedResponse> LIST_DOCUMENTS_PAGE_STR_FACT = @@ -186,6 +231,23 @@ public ApiFuture getFuturePagedResponse( } }; + private static final PagedListResponseFactory< + ListLocationsRequest, ListLocationsResponse, ListLocationsPagedResponse> + LIST_LOCATIONS_PAGE_STR_FACT = + new PagedListResponseFactory< + ListLocationsRequest, ListLocationsResponse, ListLocationsPagedResponse>() { + @Override + public ApiFuture getFuturePagedResponse( + UnaryCallable callable, + ListLocationsRequest request, + ApiCallContext context, + ApiFuture futureResponse) { + PageContext pageContext = + PageContext.create(callable, LIST_LOCATIONS_PAGE_STR_DESC, request, context); + return ListLocationsPagedResponse.createAsync(pageContext, futureResponse); + } + }; + /** Returns the object with the settings used for calls to listDocuments. */ public PagedCallSettings listDocumentsSettings() { @@ -253,6 +315,17 @@ public UnaryCallSettings reloadDocumentSetting return reloadDocumentOperationSettings; } + /** Returns the object with the settings used for calls to listLocations. */ + public PagedCallSettings + listLocationsSettings() { + return listLocationsSettings; + } + + /** Returns the object with the settings used for calls to getLocation. */ + public UnaryCallSettings getLocationSettings() { + return getLocationSettings; + } + public DocumentsStub createStub() throws IOException { if (getTransportChannelProvider() .getTransportName() @@ -369,6 +442,8 @@ protected DocumentsStubSettings(Builder settingsBuilder) throws IOException { updateDocumentOperationSettings = settingsBuilder.updateDocumentOperationSettings().build(); reloadDocumentSettings = settingsBuilder.reloadDocumentSettings().build(); reloadDocumentOperationSettings = settingsBuilder.reloadDocumentOperationSettings().build(); + listLocationsSettings = settingsBuilder.listLocationsSettings().build(); + getLocationSettings = settingsBuilder.getLocationSettings().build(); } /** Builder for DocumentsStubSettings. */ @@ -403,6 +478,10 @@ public static class Builder extends StubSettings.Builder reloadDocumentOperationSettings; + private final PagedCallSettings.Builder< + ListLocationsRequest, ListLocationsResponse, ListLocationsPagedResponse> + listLocationsSettings; + private final UnaryCallSettings.Builder getLocationSettings; private static final ImmutableMap> RETRYABLE_CODE_DEFINITIONS; @@ -453,6 +532,8 @@ protected Builder(ClientContext clientContext) { updateDocumentOperationSettings = OperationCallSettings.newBuilder(); reloadDocumentSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); reloadDocumentOperationSettings = OperationCallSettings.newBuilder(); + listLocationsSettings = PagedCallSettings.newBuilder(LIST_LOCATIONS_PAGE_STR_FACT); + getLocationSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); unaryMethodSettingsBuilders = ImmutableList.>of( @@ -462,7 +543,9 @@ protected Builder(ClientContext clientContext) { importDocumentsSettings, deleteDocumentSettings, updateDocumentSettings, - reloadDocumentSettings); + reloadDocumentSettings, + listLocationsSettings, + getLocationSettings); initDefaults(this); } @@ -481,6 +564,8 @@ protected Builder(DocumentsStubSettings settings) { updateDocumentOperationSettings = settings.updateDocumentOperationSettings.toBuilder(); reloadDocumentSettings = settings.reloadDocumentSettings.toBuilder(); reloadDocumentOperationSettings = settings.reloadDocumentOperationSettings.toBuilder(); + listLocationsSettings = settings.listLocationsSettings.toBuilder(); + getLocationSettings = settings.getLocationSettings.toBuilder(); unaryMethodSettingsBuilders = ImmutableList.>of( @@ -490,7 +575,9 @@ protected Builder(DocumentsStubSettings settings) { importDocumentsSettings, deleteDocumentSettings, updateDocumentSettings, - reloadDocumentSettings); + reloadDocumentSettings, + listLocationsSettings, + getLocationSettings); } private static Builder createDefault() { @@ -555,6 +642,16 @@ private static Builder initDefaults(Builder builder) { .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes")) .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params")); + builder + .listLocationsSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params")); + + builder + .getLocationSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params")); + builder .createDocumentOperationSettings() .setInitialCallSettings( @@ -779,6 +876,18 @@ public UnaryCallSettings.Builder reloadDocumen return reloadDocumentOperationSettings; } + /** Returns the builder for the settings used for calls to listLocations. */ + public PagedCallSettings.Builder< + ListLocationsRequest, ListLocationsResponse, ListLocationsPagedResponse> + listLocationsSettings() { + return listLocationsSettings; + } + + /** Returns the builder for the settings used for calls to getLocation. */ + public UnaryCallSettings.Builder getLocationSettings() { + return getLocationSettings; + } + @Override public DocumentsStubSettings build() throws IOException { return new DocumentsStubSettings(this); diff --git a/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2beta1/stub/EntityTypesStub.java b/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2beta1/stub/EntityTypesStub.java index c864a364e..cf99632f2 100644 --- a/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2beta1/stub/EntityTypesStub.java +++ b/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2beta1/stub/EntityTypesStub.java @@ -17,6 +17,7 @@ package com.google.cloud.dialogflow.v2beta1.stub; import static com.google.cloud.dialogflow.v2beta1.EntityTypesClient.ListEntityTypesPagedResponse; +import static com.google.cloud.dialogflow.v2beta1.EntityTypesClient.ListLocationsPagedResponse; import com.google.api.core.BetaApi; import com.google.api.gax.core.BackgroundResource; @@ -35,6 +36,10 @@ import com.google.cloud.dialogflow.v2beta1.ListEntityTypesRequest; import com.google.cloud.dialogflow.v2beta1.ListEntityTypesResponse; import com.google.cloud.dialogflow.v2beta1.UpdateEntityTypeRequest; +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.ListLocationsResponse; +import com.google.cloud.location.Location; import com.google.longrunning.Operation; import com.google.longrunning.stub.OperationsStub; import com.google.protobuf.Empty; @@ -134,6 +139,19 @@ public UnaryCallable batchDeleteEntitiesC throw new UnsupportedOperationException("Not implemented: batchDeleteEntitiesCallable()"); } + public UnaryCallable + listLocationsPagedCallable() { + throw new UnsupportedOperationException("Not implemented: listLocationsPagedCallable()"); + } + + public UnaryCallable listLocationsCallable() { + throw new UnsupportedOperationException("Not implemented: listLocationsCallable()"); + } + + public UnaryCallable getLocationCallable() { + throw new UnsupportedOperationException("Not implemented: getLocationCallable()"); + } + @Override public abstract void close(); } diff --git a/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2beta1/stub/EntityTypesStubSettings.java b/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2beta1/stub/EntityTypesStubSettings.java index 0dee1a613..be3bed4c6 100644 --- a/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2beta1/stub/EntityTypesStubSettings.java +++ b/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2beta1/stub/EntityTypesStubSettings.java @@ -17,6 +17,7 @@ package com.google.cloud.dialogflow.v2beta1.stub; import static com.google.cloud.dialogflow.v2beta1.EntityTypesClient.ListEntityTypesPagedResponse; +import static com.google.cloud.dialogflow.v2beta1.EntityTypesClient.ListLocationsPagedResponse; import com.google.api.core.ApiFunction; import com.google.api.core.ApiFuture; @@ -60,6 +61,10 @@ import com.google.cloud.dialogflow.v2beta1.ListEntityTypesRequest; import com.google.cloud.dialogflow.v2beta1.ListEntityTypesResponse; import com.google.cloud.dialogflow.v2beta1.UpdateEntityTypeRequest; +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.ListLocationsResponse; +import com.google.cloud.location.Location; import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableMap; import com.google.common.collect.ImmutableSet; @@ -144,6 +149,10 @@ public class EntityTypesStubSettings extends StubSettings batchDeleteEntitiesOperationSettings; + private final PagedCallSettings< + ListLocationsRequest, ListLocationsResponse, ListLocationsPagedResponse> + listLocationsSettings; + private final UnaryCallSettings getLocationSettings; private static final PagedListDescriptor< ListEntityTypesRequest, ListEntityTypesResponse, EntityType> @@ -184,6 +193,42 @@ public Iterable extractResources(ListEntityTypesResponse payload) { } }; + private static final PagedListDescriptor + LIST_LOCATIONS_PAGE_STR_DESC = + new PagedListDescriptor() { + @Override + public String emptyToken() { + return ""; + } + + @Override + public ListLocationsRequest injectToken(ListLocationsRequest payload, String token) { + return ListLocationsRequest.newBuilder(payload).setPageToken(token).build(); + } + + @Override + public ListLocationsRequest injectPageSize(ListLocationsRequest payload, int pageSize) { + return ListLocationsRequest.newBuilder(payload).setPageSize(pageSize).build(); + } + + @Override + public Integer extractPageSize(ListLocationsRequest payload) { + return payload.getPageSize(); + } + + @Override + public String extractNextToken(ListLocationsResponse payload) { + return payload.getNextPageToken(); + } + + @Override + public Iterable extractResources(ListLocationsResponse payload) { + return payload.getLocationsList() == null + ? ImmutableList.of() + : payload.getLocationsList(); + } + }; + private static final PagedListResponseFactory< ListEntityTypesRequest, ListEntityTypesResponse, ListEntityTypesPagedResponse> LIST_ENTITY_TYPES_PAGE_STR_FACT = @@ -201,6 +246,23 @@ public ApiFuture getFuturePagedResponse( } }; + private static final PagedListResponseFactory< + ListLocationsRequest, ListLocationsResponse, ListLocationsPagedResponse> + LIST_LOCATIONS_PAGE_STR_FACT = + new PagedListResponseFactory< + ListLocationsRequest, ListLocationsResponse, ListLocationsPagedResponse>() { + @Override + public ApiFuture getFuturePagedResponse( + UnaryCallable callable, + ListLocationsRequest request, + ApiCallContext context, + ApiFuture futureResponse) { + PageContext pageContext = + PageContext.create(callable, LIST_LOCATIONS_PAGE_STR_DESC, request, context); + return ListLocationsPagedResponse.createAsync(pageContext, futureResponse); + } + }; + /** Returns the object with the settings used for calls to listEntityTypes. */ public PagedCallSettings< ListEntityTypesRequest, ListEntityTypesResponse, ListEntityTypesPagedResponse> @@ -286,6 +348,17 @@ public UnaryCallSettings batchDeleteEntit return batchDeleteEntitiesOperationSettings; } + /** Returns the object with the settings used for calls to listLocations. */ + public PagedCallSettings + listLocationsSettings() { + return listLocationsSettings; + } + + /** Returns the object with the settings used for calls to getLocation. */ + public UnaryCallSettings getLocationSettings() { + return getLocationSettings; + } + public EntityTypesStub createStub() throws IOException { if (getTransportChannelProvider() .getTransportName() @@ -412,6 +485,8 @@ protected EntityTypesStubSettings(Builder settingsBuilder) throws IOException { batchDeleteEntitiesSettings = settingsBuilder.batchDeleteEntitiesSettings().build(); batchDeleteEntitiesOperationSettings = settingsBuilder.batchDeleteEntitiesOperationSettings().build(); + listLocationsSettings = settingsBuilder.listLocationsSettings().build(); + getLocationSettings = settingsBuilder.getLocationSettings().build(); } /** Builder for EntityTypesStubSettings. */ @@ -448,6 +523,10 @@ public static class Builder extends StubSettings.Builder batchDeleteEntitiesOperationSettings; + private final PagedCallSettings.Builder< + ListLocationsRequest, ListLocationsResponse, ListLocationsPagedResponse> + listLocationsSettings; + private final UnaryCallSettings.Builder getLocationSettings; private static final ImmutableMap> RETRYABLE_CODE_DEFINITIONS; @@ -501,6 +580,8 @@ protected Builder(ClientContext clientContext) { batchUpdateEntitiesOperationSettings = OperationCallSettings.newBuilder(); batchDeleteEntitiesSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); batchDeleteEntitiesOperationSettings = OperationCallSettings.newBuilder(); + listLocationsSettings = PagedCallSettings.newBuilder(LIST_LOCATIONS_PAGE_STR_FACT); + getLocationSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); unaryMethodSettingsBuilders = ImmutableList.>of( @@ -513,7 +594,9 @@ protected Builder(ClientContext clientContext) { batchDeleteEntityTypesSettings, batchCreateEntitiesSettings, batchUpdateEntitiesSettings, - batchDeleteEntitiesSettings); + batchDeleteEntitiesSettings, + listLocationsSettings, + getLocationSettings); initDefaults(this); } @@ -540,6 +623,8 @@ protected Builder(EntityTypesStubSettings settings) { batchDeleteEntitiesSettings = settings.batchDeleteEntitiesSettings.toBuilder(); batchDeleteEntitiesOperationSettings = settings.batchDeleteEntitiesOperationSettings.toBuilder(); + listLocationsSettings = settings.listLocationsSettings.toBuilder(); + getLocationSettings = settings.getLocationSettings.toBuilder(); unaryMethodSettingsBuilders = ImmutableList.>of( @@ -552,7 +637,9 @@ protected Builder(EntityTypesStubSettings settings) { batchDeleteEntityTypesSettings, batchCreateEntitiesSettings, batchUpdateEntitiesSettings, - batchDeleteEntitiesSettings); + batchDeleteEntitiesSettings, + listLocationsSettings, + getLocationSettings); } private static Builder createDefault() { @@ -632,6 +719,16 @@ private static Builder initDefaults(Builder builder) { .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes")) .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params")); + builder + .listLocationsSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params")); + + builder + .getLocationSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params")); + builder .batchUpdateEntityTypesOperationSettings() .setInitialCallSettings( @@ -871,6 +968,18 @@ public UnaryCallSettings.Builder deleteEntityTyp return batchDeleteEntitiesOperationSettings; } + /** Returns the builder for the settings used for calls to listLocations. */ + public PagedCallSettings.Builder< + ListLocationsRequest, ListLocationsResponse, ListLocationsPagedResponse> + listLocationsSettings() { + return listLocationsSettings; + } + + /** Returns the builder for the settings used for calls to getLocation. */ + public UnaryCallSettings.Builder getLocationSettings() { + return getLocationSettings; + } + @Override public EntityTypesStubSettings build() throws IOException { return new EntityTypesStubSettings(this); diff --git a/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2beta1/stub/EnvironmentsStub.java b/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2beta1/stub/EnvironmentsStub.java index b952371ae..f7070f87a 100644 --- a/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2beta1/stub/EnvironmentsStub.java +++ b/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2beta1/stub/EnvironmentsStub.java @@ -18,6 +18,7 @@ import static com.google.cloud.dialogflow.v2beta1.EnvironmentsClient.GetEnvironmentHistoryPagedResponse; import static com.google.cloud.dialogflow.v2beta1.EnvironmentsClient.ListEnvironmentsPagedResponse; +import static com.google.cloud.dialogflow.v2beta1.EnvironmentsClient.ListLocationsPagedResponse; import com.google.api.core.BetaApi; import com.google.api.gax.core.BackgroundResource; @@ -31,6 +32,10 @@ import com.google.cloud.dialogflow.v2beta1.ListEnvironmentsRequest; import com.google.cloud.dialogflow.v2beta1.ListEnvironmentsResponse; import com.google.cloud.dialogflow.v2beta1.UpdateEnvironmentRequest; +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.ListLocationsResponse; +import com.google.cloud.location.Location; import com.google.protobuf.Empty; import javax.annotation.Generated; @@ -81,6 +86,19 @@ public UnaryCallable deleteEnvironmentCallable( throw new UnsupportedOperationException("Not implemented: getEnvironmentHistoryCallable()"); } + public UnaryCallable + listLocationsPagedCallable() { + throw new UnsupportedOperationException("Not implemented: listLocationsPagedCallable()"); + } + + public UnaryCallable listLocationsCallable() { + throw new UnsupportedOperationException("Not implemented: listLocationsCallable()"); + } + + public UnaryCallable getLocationCallable() { + throw new UnsupportedOperationException("Not implemented: getLocationCallable()"); + } + @Override public abstract void close(); } diff --git a/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2beta1/stub/EnvironmentsStubSettings.java b/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2beta1/stub/EnvironmentsStubSettings.java index ad2a4b623..1d81dff5f 100644 --- a/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2beta1/stub/EnvironmentsStubSettings.java +++ b/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2beta1/stub/EnvironmentsStubSettings.java @@ -18,6 +18,7 @@ import static com.google.cloud.dialogflow.v2beta1.EnvironmentsClient.GetEnvironmentHistoryPagedResponse; import static com.google.cloud.dialogflow.v2beta1.EnvironmentsClient.ListEnvironmentsPagedResponse; +import static com.google.cloud.dialogflow.v2beta1.EnvironmentsClient.ListLocationsPagedResponse; import com.google.api.core.ApiFunction; import com.google.api.core.ApiFuture; @@ -53,6 +54,10 @@ import com.google.cloud.dialogflow.v2beta1.ListEnvironmentsRequest; import com.google.cloud.dialogflow.v2beta1.ListEnvironmentsResponse; import com.google.cloud.dialogflow.v2beta1.UpdateEnvironmentRequest; +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.ListLocationsResponse; +import com.google.cloud.location.Location; import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableMap; import com.google.common.collect.ImmutableSet; @@ -117,6 +122,10 @@ public class EnvironmentsStubSettings extends StubSettings getEnvironmentHistorySettings; + private final PagedCallSettings< + ListLocationsRequest, ListLocationsResponse, ListLocationsPagedResponse> + listLocationsSettings; + private final UnaryCallSettings getLocationSettings; private static final PagedListDescriptor< ListEnvironmentsRequest, ListEnvironmentsResponse, Environment> @@ -198,6 +207,42 @@ public Iterable extractResources(EnvironmentHistory pa } }; + private static final PagedListDescriptor + LIST_LOCATIONS_PAGE_STR_DESC = + new PagedListDescriptor() { + @Override + public String emptyToken() { + return ""; + } + + @Override + public ListLocationsRequest injectToken(ListLocationsRequest payload, String token) { + return ListLocationsRequest.newBuilder(payload).setPageToken(token).build(); + } + + @Override + public ListLocationsRequest injectPageSize(ListLocationsRequest payload, int pageSize) { + return ListLocationsRequest.newBuilder(payload).setPageSize(pageSize).build(); + } + + @Override + public Integer extractPageSize(ListLocationsRequest payload) { + return payload.getPageSize(); + } + + @Override + public String extractNextToken(ListLocationsResponse payload) { + return payload.getNextPageToken(); + } + + @Override + public Iterable extractResources(ListLocationsResponse payload) { + return payload.getLocationsList() == null + ? ImmutableList.of() + : payload.getLocationsList(); + } + }; + private static final PagedListResponseFactory< ListEnvironmentsRequest, ListEnvironmentsResponse, ListEnvironmentsPagedResponse> LIST_ENVIRONMENTS_PAGE_STR_FACT = @@ -239,6 +284,23 @@ public ApiFuture getFuturePagedResponse( } }; + private static final PagedListResponseFactory< + ListLocationsRequest, ListLocationsResponse, ListLocationsPagedResponse> + LIST_LOCATIONS_PAGE_STR_FACT = + new PagedListResponseFactory< + ListLocationsRequest, ListLocationsResponse, ListLocationsPagedResponse>() { + @Override + public ApiFuture getFuturePagedResponse( + UnaryCallable callable, + ListLocationsRequest request, + ApiCallContext context, + ApiFuture futureResponse) { + PageContext pageContext = + PageContext.create(callable, LIST_LOCATIONS_PAGE_STR_DESC, request, context); + return ListLocationsPagedResponse.createAsync(pageContext, futureResponse); + } + }; + /** Returns the object with the settings used for calls to listEnvironments. */ public PagedCallSettings< ListEnvironmentsRequest, ListEnvironmentsResponse, ListEnvironmentsPagedResponse> @@ -273,6 +335,17 @@ public UnaryCallSettings deleteEnvironmentSetti return getEnvironmentHistorySettings; } + /** Returns the object with the settings used for calls to listLocations. */ + public PagedCallSettings + listLocationsSettings() { + return listLocationsSettings; + } + + /** Returns the object with the settings used for calls to getLocation. */ + public UnaryCallSettings getLocationSettings() { + return getLocationSettings; + } + public EnvironmentsStub createStub() throws IOException { if (getTransportChannelProvider() .getTransportName() @@ -385,6 +458,8 @@ protected EnvironmentsStubSettings(Builder settingsBuilder) throws IOException { updateEnvironmentSettings = settingsBuilder.updateEnvironmentSettings().build(); deleteEnvironmentSettings = settingsBuilder.deleteEnvironmentSettings().build(); getEnvironmentHistorySettings = settingsBuilder.getEnvironmentHistorySettings().build(); + listLocationsSettings = settingsBuilder.listLocationsSettings().build(); + getLocationSettings = settingsBuilder.getLocationSettings().build(); } /** Builder for EnvironmentsStubSettings. */ @@ -404,6 +479,10 @@ public static class Builder extends StubSettings.Builder getEnvironmentHistorySettings; + private final PagedCallSettings.Builder< + ListLocationsRequest, ListLocationsResponse, ListLocationsPagedResponse> + listLocationsSettings; + private final UnaryCallSettings.Builder getLocationSettings; private static final ImmutableMap> RETRYABLE_CODE_DEFINITIONS; @@ -449,6 +528,8 @@ protected Builder(ClientContext clientContext) { deleteEnvironmentSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); getEnvironmentHistorySettings = PagedCallSettings.newBuilder(GET_ENVIRONMENT_HISTORY_PAGE_STR_FACT); + listLocationsSettings = PagedCallSettings.newBuilder(LIST_LOCATIONS_PAGE_STR_FACT); + getLocationSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); unaryMethodSettingsBuilders = ImmutableList.>of( @@ -457,7 +538,9 @@ protected Builder(ClientContext clientContext) { createEnvironmentSettings, updateEnvironmentSettings, deleteEnvironmentSettings, - getEnvironmentHistorySettings); + getEnvironmentHistorySettings, + listLocationsSettings, + getLocationSettings); initDefaults(this); } @@ -470,6 +553,8 @@ protected Builder(EnvironmentsStubSettings settings) { updateEnvironmentSettings = settings.updateEnvironmentSettings.toBuilder(); deleteEnvironmentSettings = settings.deleteEnvironmentSettings.toBuilder(); getEnvironmentHistorySettings = settings.getEnvironmentHistorySettings.toBuilder(); + listLocationsSettings = settings.listLocationsSettings.toBuilder(); + getLocationSettings = settings.getLocationSettings.toBuilder(); unaryMethodSettingsBuilders = ImmutableList.>of( @@ -478,7 +563,9 @@ protected Builder(EnvironmentsStubSettings settings) { createEnvironmentSettings, updateEnvironmentSettings, deleteEnvironmentSettings, - getEnvironmentHistorySettings); + getEnvironmentHistorySettings, + listLocationsSettings, + getLocationSettings); } private static Builder createDefault() { @@ -538,6 +625,16 @@ private static Builder initDefaults(Builder builder) { .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes")) .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params")); + builder + .listLocationsSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params")); + + builder + .getLocationSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params")); + return builder; } @@ -592,6 +689,18 @@ public UnaryCallSettings.Builder deleteEnvironm return getEnvironmentHistorySettings; } + /** Returns the builder for the settings used for calls to listLocations. */ + public PagedCallSettings.Builder< + ListLocationsRequest, ListLocationsResponse, ListLocationsPagedResponse> + listLocationsSettings() { + return listLocationsSettings; + } + + /** Returns the builder for the settings used for calls to getLocation. */ + public UnaryCallSettings.Builder getLocationSettings() { + return getLocationSettings; + } + @Override public EnvironmentsStubSettings build() throws IOException { return new EnvironmentsStubSettings(this); diff --git a/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2beta1/stub/FulfillmentsStub.java b/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2beta1/stub/FulfillmentsStub.java index 167cf2568..0f788ec97 100644 --- a/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2beta1/stub/FulfillmentsStub.java +++ b/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2beta1/stub/FulfillmentsStub.java @@ -16,12 +16,18 @@ package com.google.cloud.dialogflow.v2beta1.stub; +import static com.google.cloud.dialogflow.v2beta1.FulfillmentsClient.ListLocationsPagedResponse; + import com.google.api.core.BetaApi; import com.google.api.gax.core.BackgroundResource; import com.google.api.gax.rpc.UnaryCallable; import com.google.cloud.dialogflow.v2beta1.Fulfillment; import com.google.cloud.dialogflow.v2beta1.GetFulfillmentRequest; import com.google.cloud.dialogflow.v2beta1.UpdateFulfillmentRequest; +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.ListLocationsResponse; +import com.google.cloud.location.Location; import javax.annotation.Generated; // AUTO-GENERATED DOCUMENTATION AND CLASS. @@ -42,6 +48,19 @@ public UnaryCallable updateFulfillmentCal throw new UnsupportedOperationException("Not implemented: updateFulfillmentCallable()"); } + public UnaryCallable + listLocationsPagedCallable() { + throw new UnsupportedOperationException("Not implemented: listLocationsPagedCallable()"); + } + + public UnaryCallable listLocationsCallable() { + throw new UnsupportedOperationException("Not implemented: listLocationsCallable()"); + } + + public UnaryCallable getLocationCallable() { + throw new UnsupportedOperationException("Not implemented: getLocationCallable()"); + } + @Override public abstract void close(); } diff --git a/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2beta1/stub/FulfillmentsStubSettings.java b/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2beta1/stub/FulfillmentsStubSettings.java index 8fae52e21..8df40f7f6 100644 --- a/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2beta1/stub/FulfillmentsStubSettings.java +++ b/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2beta1/stub/FulfillmentsStubSettings.java @@ -16,7 +16,10 @@ package com.google.cloud.dialogflow.v2beta1.stub; +import static com.google.cloud.dialogflow.v2beta1.FulfillmentsClient.ListLocationsPagedResponse; + import com.google.api.core.ApiFunction; +import com.google.api.core.ApiFuture; import com.google.api.core.BetaApi; import com.google.api.gax.core.GaxProperties; import com.google.api.gax.core.GoogleCredentialsProvider; @@ -28,15 +31,25 @@ import com.google.api.gax.httpjson.HttpJsonTransportChannel; import com.google.api.gax.httpjson.InstantiatingHttpJsonChannelProvider; import com.google.api.gax.retrying.RetrySettings; +import com.google.api.gax.rpc.ApiCallContext; import com.google.api.gax.rpc.ApiClientHeaderProvider; import com.google.api.gax.rpc.ClientContext; +import com.google.api.gax.rpc.PageContext; +import com.google.api.gax.rpc.PagedCallSettings; +import com.google.api.gax.rpc.PagedListDescriptor; +import com.google.api.gax.rpc.PagedListResponseFactory; import com.google.api.gax.rpc.StatusCode; import com.google.api.gax.rpc.StubSettings; import com.google.api.gax.rpc.TransportChannelProvider; import com.google.api.gax.rpc.UnaryCallSettings; +import com.google.api.gax.rpc.UnaryCallable; import com.google.cloud.dialogflow.v2beta1.Fulfillment; import com.google.cloud.dialogflow.v2beta1.GetFulfillmentRequest; import com.google.cloud.dialogflow.v2beta1.UpdateFulfillmentRequest; +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.ListLocationsResponse; +import com.google.cloud.location.Location; import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableMap; import com.google.common.collect.ImmutableSet; @@ -92,6 +105,63 @@ public class FulfillmentsStubSettings extends StubSettings getFulfillmentSettings; private final UnaryCallSettings updateFulfillmentSettings; + private final PagedCallSettings< + ListLocationsRequest, ListLocationsResponse, ListLocationsPagedResponse> + listLocationsSettings; + private final UnaryCallSettings getLocationSettings; + + private static final PagedListDescriptor + LIST_LOCATIONS_PAGE_STR_DESC = + new PagedListDescriptor() { + @Override + public String emptyToken() { + return ""; + } + + @Override + public ListLocationsRequest injectToken(ListLocationsRequest payload, String token) { + return ListLocationsRequest.newBuilder(payload).setPageToken(token).build(); + } + + @Override + public ListLocationsRequest injectPageSize(ListLocationsRequest payload, int pageSize) { + return ListLocationsRequest.newBuilder(payload).setPageSize(pageSize).build(); + } + + @Override + public Integer extractPageSize(ListLocationsRequest payload) { + return payload.getPageSize(); + } + + @Override + public String extractNextToken(ListLocationsResponse payload) { + return payload.getNextPageToken(); + } + + @Override + public Iterable extractResources(ListLocationsResponse payload) { + return payload.getLocationsList() == null + ? ImmutableList.of() + : payload.getLocationsList(); + } + }; + + private static final PagedListResponseFactory< + ListLocationsRequest, ListLocationsResponse, ListLocationsPagedResponse> + LIST_LOCATIONS_PAGE_STR_FACT = + new PagedListResponseFactory< + ListLocationsRequest, ListLocationsResponse, ListLocationsPagedResponse>() { + @Override + public ApiFuture getFuturePagedResponse( + UnaryCallable callable, + ListLocationsRequest request, + ApiCallContext context, + ApiFuture futureResponse) { + PageContext pageContext = + PageContext.create(callable, LIST_LOCATIONS_PAGE_STR_DESC, request, context); + return ListLocationsPagedResponse.createAsync(pageContext, futureResponse); + } + }; /** Returns the object with the settings used for calls to getFulfillment. */ public UnaryCallSettings getFulfillmentSettings() { @@ -103,6 +173,17 @@ public UnaryCallSettings updateFulfillmen return updateFulfillmentSettings; } + /** Returns the object with the settings used for calls to listLocations. */ + public PagedCallSettings + listLocationsSettings() { + return listLocationsSettings; + } + + /** Returns the object with the settings used for calls to getLocation. */ + public UnaryCallSettings getLocationSettings() { + return getLocationSettings; + } + public FulfillmentsStub createStub() throws IOException { if (getTransportChannelProvider() .getTransportName() @@ -211,6 +292,8 @@ protected FulfillmentsStubSettings(Builder settingsBuilder) throws IOException { getFulfillmentSettings = settingsBuilder.getFulfillmentSettings().build(); updateFulfillmentSettings = settingsBuilder.updateFulfillmentSettings().build(); + listLocationsSettings = settingsBuilder.listLocationsSettings().build(); + getLocationSettings = settingsBuilder.getLocationSettings().build(); } /** Builder for FulfillmentsStubSettings. */ @@ -220,6 +303,10 @@ public static class Builder extends StubSettings.Builder updateFulfillmentSettings; + private final PagedCallSettings.Builder< + ListLocationsRequest, ListLocationsResponse, ListLocationsPagedResponse> + listLocationsSettings; + private final UnaryCallSettings.Builder getLocationSettings; private static final ImmutableMap> RETRYABLE_CODE_DEFINITIONS; @@ -260,10 +347,15 @@ protected Builder(ClientContext clientContext) { getFulfillmentSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); updateFulfillmentSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + listLocationsSettings = PagedCallSettings.newBuilder(LIST_LOCATIONS_PAGE_STR_FACT); + getLocationSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); unaryMethodSettingsBuilders = ImmutableList.>of( - getFulfillmentSettings, updateFulfillmentSettings); + getFulfillmentSettings, + updateFulfillmentSettings, + listLocationsSettings, + getLocationSettings); initDefaults(this); } @@ -272,10 +364,15 @@ protected Builder(FulfillmentsStubSettings settings) { getFulfillmentSettings = settings.getFulfillmentSettings.toBuilder(); updateFulfillmentSettings = settings.updateFulfillmentSettings.toBuilder(); + listLocationsSettings = settings.listLocationsSettings.toBuilder(); + getLocationSettings = settings.getLocationSettings.toBuilder(); unaryMethodSettingsBuilders = ImmutableList.>of( - getFulfillmentSettings, updateFulfillmentSettings); + getFulfillmentSettings, + updateFulfillmentSettings, + listLocationsSettings, + getLocationSettings); } private static Builder createDefault() { @@ -315,6 +412,16 @@ private static Builder initDefaults(Builder builder) { .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes")) .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params")); + builder + .listLocationsSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params")); + + builder + .getLocationSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params")); + return builder; } @@ -344,6 +451,18 @@ public UnaryCallSettings.Builder getFulfillm return updateFulfillmentSettings; } + /** Returns the builder for the settings used for calls to listLocations. */ + public PagedCallSettings.Builder< + ListLocationsRequest, ListLocationsResponse, ListLocationsPagedResponse> + listLocationsSettings() { + return listLocationsSettings; + } + + /** Returns the builder for the settings used for calls to getLocation. */ + public UnaryCallSettings.Builder getLocationSettings() { + return getLocationSettings; + } + @Override public FulfillmentsStubSettings build() throws IOException { return new FulfillmentsStubSettings(this); diff --git a/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2beta1/stub/GrpcAgentsStub.java b/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2beta1/stub/GrpcAgentsStub.java index 00ec753f1..474a97ced 100644 --- a/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2beta1/stub/GrpcAgentsStub.java +++ b/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2beta1/stub/GrpcAgentsStub.java @@ -16,6 +16,7 @@ package com.google.cloud.dialogflow.v2beta1.stub; +import static com.google.cloud.dialogflow.v2beta1.AgentsClient.ListLocationsPagedResponse; import static com.google.cloud.dialogflow.v2beta1.AgentsClient.SearchAgentsPagedResponse; import com.google.api.core.BetaApi; @@ -39,6 +40,10 @@ import com.google.cloud.dialogflow.v2beta1.SetAgentRequest; import com.google.cloud.dialogflow.v2beta1.TrainAgentRequest; import com.google.cloud.dialogflow.v2beta1.ValidationResult; +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.ListLocationsResponse; +import com.google.cloud.location.Location; import com.google.common.collect.ImmutableMap; import com.google.longrunning.Operation; import com.google.longrunning.stub.GrpcOperationsStub; @@ -136,6 +141,25 @@ public class GrpcAgentsStub extends AgentsStub { .setResponseMarshaller(ProtoUtils.marshaller(ValidationResult.getDefaultInstance())) .build(); + private static final MethodDescriptor + listLocationsMethodDescriptor = + MethodDescriptor.newBuilder() + .setType(MethodDescriptor.MethodType.UNARY) + .setFullMethodName("google.cloud.location.Locations/ListLocations") + .setRequestMarshaller( + ProtoUtils.marshaller(ListLocationsRequest.getDefaultInstance())) + .setResponseMarshaller( + ProtoUtils.marshaller(ListLocationsResponse.getDefaultInstance())) + .build(); + + private static final MethodDescriptor getLocationMethodDescriptor = + MethodDescriptor.newBuilder() + .setType(MethodDescriptor.MethodType.UNARY) + .setFullMethodName("google.cloud.location.Locations/GetLocation") + .setRequestMarshaller(ProtoUtils.marshaller(GetLocationRequest.getDefaultInstance())) + .setResponseMarshaller(ProtoUtils.marshaller(Location.getDefaultInstance())) + .build(); + private final UnaryCallable getAgentCallable; private final UnaryCallable setAgentCallable; private final UnaryCallable deleteAgentCallable; @@ -153,6 +177,10 @@ public class GrpcAgentsStub extends AgentsStub { private final OperationCallable restoreAgentOperationCallable; private final UnaryCallable getValidationResultCallable; + private final UnaryCallable listLocationsCallable; + private final UnaryCallable + listLocationsPagedCallable; + private final UnaryCallable getLocationCallable; private final BackgroundResource backgroundResources; private final GrpcOperationsStub operationsStub; @@ -284,6 +312,26 @@ protected GrpcAgentsStub( return params.build(); }) .build(); + GrpcCallSettings listLocationsTransportSettings = + GrpcCallSettings.newBuilder() + .setMethodDescriptor(listLocationsMethodDescriptor) + .setParamsExtractor( + request -> { + ImmutableMap.Builder params = ImmutableMap.builder(); + params.put("name", String.valueOf(request.getName())); + return params.build(); + }) + .build(); + GrpcCallSettings getLocationTransportSettings = + GrpcCallSettings.newBuilder() + .setMethodDescriptor(getLocationMethodDescriptor) + .setParamsExtractor( + request -> { + ImmutableMap.Builder params = ImmutableMap.builder(); + params.put("name", String.valueOf(request.getName())); + return params.build(); + }) + .build(); this.getAgentCallable = callableFactory.createUnaryCallable( @@ -341,6 +389,15 @@ protected GrpcAgentsStub( getValidationResultTransportSettings, settings.getValidationResultSettings(), clientContext); + this.listLocationsCallable = + callableFactory.createUnaryCallable( + listLocationsTransportSettings, settings.listLocationsSettings(), clientContext); + this.listLocationsPagedCallable = + callableFactory.createPagedCallable( + listLocationsTransportSettings, settings.listLocationsSettings(), clientContext); + this.getLocationCallable = + callableFactory.createUnaryCallable( + getLocationTransportSettings, settings.getLocationSettings(), clientContext); this.backgroundResources = new BackgroundResourceAggregation(clientContext.getBackgroundResources()); @@ -421,6 +478,22 @@ public UnaryCallable getValidation return getValidationResultCallable; } + @Override + public UnaryCallable listLocationsCallable() { + return listLocationsCallable; + } + + @Override + public UnaryCallable + listLocationsPagedCallable() { + return listLocationsPagedCallable; + } + + @Override + public UnaryCallable getLocationCallable() { + return getLocationCallable; + } + @Override public final void close() { try { diff --git a/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2beta1/stub/GrpcAnswerRecordsStub.java b/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2beta1/stub/GrpcAnswerRecordsStub.java index 7ed36b81c..c49880c46 100644 --- a/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2beta1/stub/GrpcAnswerRecordsStub.java +++ b/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2beta1/stub/GrpcAnswerRecordsStub.java @@ -17,6 +17,7 @@ package com.google.cloud.dialogflow.v2beta1.stub; import static com.google.cloud.dialogflow.v2beta1.AnswerRecordsClient.ListAnswerRecordsPagedResponse; +import static com.google.cloud.dialogflow.v2beta1.AnswerRecordsClient.ListLocationsPagedResponse; import com.google.api.core.BetaApi; import com.google.api.gax.core.BackgroundResource; @@ -30,6 +31,10 @@ import com.google.cloud.dialogflow.v2beta1.ListAnswerRecordsRequest; import com.google.cloud.dialogflow.v2beta1.ListAnswerRecordsResponse; import com.google.cloud.dialogflow.v2beta1.UpdateAnswerRecordRequest; +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.ListLocationsResponse; +import com.google.cloud.location.Location; import com.google.common.collect.ImmutableMap; import com.google.longrunning.stub.GrpcOperationsStub; import io.grpc.MethodDescriptor; @@ -78,12 +83,35 @@ public class GrpcAnswerRecordsStub extends AnswerRecordsStub { .setResponseMarshaller(ProtoUtils.marshaller(AnswerRecord.getDefaultInstance())) .build(); + private static final MethodDescriptor + listLocationsMethodDescriptor = + MethodDescriptor.newBuilder() + .setType(MethodDescriptor.MethodType.UNARY) + .setFullMethodName("google.cloud.location.Locations/ListLocations") + .setRequestMarshaller( + ProtoUtils.marshaller(ListLocationsRequest.getDefaultInstance())) + .setResponseMarshaller( + ProtoUtils.marshaller(ListLocationsResponse.getDefaultInstance())) + .build(); + + private static final MethodDescriptor getLocationMethodDescriptor = + MethodDescriptor.newBuilder() + .setType(MethodDescriptor.MethodType.UNARY) + .setFullMethodName("google.cloud.location.Locations/GetLocation") + .setRequestMarshaller(ProtoUtils.marshaller(GetLocationRequest.getDefaultInstance())) + .setResponseMarshaller(ProtoUtils.marshaller(Location.getDefaultInstance())) + .build(); + private final UnaryCallable getAnswerRecordCallable; private final UnaryCallable listAnswerRecordsCallable; private final UnaryCallable listAnswerRecordsPagedCallable; private final UnaryCallable updateAnswerRecordCallable; + private final UnaryCallable listLocationsCallable; + private final UnaryCallable + listLocationsPagedCallable; + private final UnaryCallable getLocationCallable; private final BackgroundResource backgroundResources; private final GrpcOperationsStub operationsStub; @@ -159,6 +187,26 @@ protected GrpcAnswerRecordsStub( return params.build(); }) .build(); + GrpcCallSettings listLocationsTransportSettings = + GrpcCallSettings.newBuilder() + .setMethodDescriptor(listLocationsMethodDescriptor) + .setParamsExtractor( + request -> { + ImmutableMap.Builder params = ImmutableMap.builder(); + params.put("name", String.valueOf(request.getName())); + return params.build(); + }) + .build(); + GrpcCallSettings getLocationTransportSettings = + GrpcCallSettings.newBuilder() + .setMethodDescriptor(getLocationMethodDescriptor) + .setParamsExtractor( + request -> { + ImmutableMap.Builder params = ImmutableMap.builder(); + params.put("name", String.valueOf(request.getName())); + return params.build(); + }) + .build(); this.getAnswerRecordCallable = callableFactory.createUnaryCallable( @@ -178,6 +226,15 @@ protected GrpcAnswerRecordsStub( updateAnswerRecordTransportSettings, settings.updateAnswerRecordSettings(), clientContext); + this.listLocationsCallable = + callableFactory.createUnaryCallable( + listLocationsTransportSettings, settings.listLocationsSettings(), clientContext); + this.listLocationsPagedCallable = + callableFactory.createPagedCallable( + listLocationsTransportSettings, settings.listLocationsSettings(), clientContext); + this.getLocationCallable = + callableFactory.createUnaryCallable( + getLocationTransportSettings, settings.getLocationSettings(), clientContext); this.backgroundResources = new BackgroundResourceAggregation(clientContext.getBackgroundResources()); @@ -209,6 +266,22 @@ public UnaryCallable updateAnswerRecord return updateAnswerRecordCallable; } + @Override + public UnaryCallable listLocationsCallable() { + return listLocationsCallable; + } + + @Override + public UnaryCallable + listLocationsPagedCallable() { + return listLocationsPagedCallable; + } + + @Override + public UnaryCallable getLocationCallable() { + return getLocationCallable; + } + @Override public final void close() { try { diff --git a/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2beta1/stub/GrpcContextsStub.java b/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2beta1/stub/GrpcContextsStub.java index 3ebde4e3d..7ed7764d1 100644 --- a/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2beta1/stub/GrpcContextsStub.java +++ b/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2beta1/stub/GrpcContextsStub.java @@ -17,6 +17,7 @@ package com.google.cloud.dialogflow.v2beta1.stub; import static com.google.cloud.dialogflow.v2beta1.ContextsClient.ListContextsPagedResponse; +import static com.google.cloud.dialogflow.v2beta1.ContextsClient.ListLocationsPagedResponse; import com.google.api.core.BetaApi; import com.google.api.gax.core.BackgroundResource; @@ -33,6 +34,10 @@ import com.google.cloud.dialogflow.v2beta1.ListContextsRequest; import com.google.cloud.dialogflow.v2beta1.ListContextsResponse; import com.google.cloud.dialogflow.v2beta1.UpdateContextRequest; +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.ListLocationsResponse; +import com.google.cloud.location.Location; import com.google.common.collect.ImmutableMap; import com.google.longrunning.stub.GrpcOperationsStub; import com.google.protobuf.Empty; @@ -107,6 +112,25 @@ public class GrpcContextsStub extends ContextsStub { .setResponseMarshaller(ProtoUtils.marshaller(Empty.getDefaultInstance())) .build(); + private static final MethodDescriptor + listLocationsMethodDescriptor = + MethodDescriptor.newBuilder() + .setType(MethodDescriptor.MethodType.UNARY) + .setFullMethodName("google.cloud.location.Locations/ListLocations") + .setRequestMarshaller( + ProtoUtils.marshaller(ListLocationsRequest.getDefaultInstance())) + .setResponseMarshaller( + ProtoUtils.marshaller(ListLocationsResponse.getDefaultInstance())) + .build(); + + private static final MethodDescriptor getLocationMethodDescriptor = + MethodDescriptor.newBuilder() + .setType(MethodDescriptor.MethodType.UNARY) + .setFullMethodName("google.cloud.location.Locations/GetLocation") + .setRequestMarshaller(ProtoUtils.marshaller(GetLocationRequest.getDefaultInstance())) + .setResponseMarshaller(ProtoUtils.marshaller(Location.getDefaultInstance())) + .build(); + private final UnaryCallable listContextsCallable; private final UnaryCallable listContextsPagedCallable; @@ -115,6 +139,10 @@ public class GrpcContextsStub extends ContextsStub { private final UnaryCallable updateContextCallable; private final UnaryCallable deleteContextCallable; private final UnaryCallable deleteAllContextsCallable; + private final UnaryCallable listLocationsCallable; + private final UnaryCallable + listLocationsPagedCallable; + private final UnaryCallable getLocationCallable; private final BackgroundResource backgroundResources; private final GrpcOperationsStub operationsStub; @@ -215,6 +243,26 @@ protected GrpcContextsStub( return params.build(); }) .build(); + GrpcCallSettings listLocationsTransportSettings = + GrpcCallSettings.newBuilder() + .setMethodDescriptor(listLocationsMethodDescriptor) + .setParamsExtractor( + request -> { + ImmutableMap.Builder params = ImmutableMap.builder(); + params.put("name", String.valueOf(request.getName())); + return params.build(); + }) + .build(); + GrpcCallSettings getLocationTransportSettings = + GrpcCallSettings.newBuilder() + .setMethodDescriptor(getLocationMethodDescriptor) + .setParamsExtractor( + request -> { + ImmutableMap.Builder params = ImmutableMap.builder(); + params.put("name", String.valueOf(request.getName())); + return params.build(); + }) + .build(); this.listContextsCallable = callableFactory.createUnaryCallable( @@ -239,6 +287,15 @@ protected GrpcContextsStub( deleteAllContextsTransportSettings, settings.deleteAllContextsSettings(), clientContext); + this.listLocationsCallable = + callableFactory.createUnaryCallable( + listLocationsTransportSettings, settings.listLocationsSettings(), clientContext); + this.listLocationsPagedCallable = + callableFactory.createPagedCallable( + listLocationsTransportSettings, settings.listLocationsSettings(), clientContext); + this.getLocationCallable = + callableFactory.createUnaryCallable( + getLocationTransportSettings, settings.getLocationSettings(), clientContext); this.backgroundResources = new BackgroundResourceAggregation(clientContext.getBackgroundResources()); @@ -283,6 +340,22 @@ public UnaryCallable deleteAllContextsCallable( return deleteAllContextsCallable; } + @Override + public UnaryCallable listLocationsCallable() { + return listLocationsCallable; + } + + @Override + public UnaryCallable + listLocationsPagedCallable() { + return listLocationsPagedCallable; + } + + @Override + public UnaryCallable getLocationCallable() { + return getLocationCallable; + } + @Override public final void close() { try { diff --git a/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2beta1/stub/GrpcConversationProfilesStub.java b/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2beta1/stub/GrpcConversationProfilesStub.java index cd215ff8d..e73dde1e5 100644 --- a/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2beta1/stub/GrpcConversationProfilesStub.java +++ b/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2beta1/stub/GrpcConversationProfilesStub.java @@ -17,6 +17,7 @@ package com.google.cloud.dialogflow.v2beta1.stub; import static com.google.cloud.dialogflow.v2beta1.ConversationProfilesClient.ListConversationProfilesPagedResponse; +import static com.google.cloud.dialogflow.v2beta1.ConversationProfilesClient.ListLocationsPagedResponse; import com.google.api.core.BetaApi; import com.google.api.gax.core.BackgroundResource; @@ -37,6 +38,10 @@ import com.google.cloud.dialogflow.v2beta1.SetSuggestionFeatureConfigOperationMetadata; import com.google.cloud.dialogflow.v2beta1.SetSuggestionFeatureConfigRequest; import com.google.cloud.dialogflow.v2beta1.UpdateConversationProfileRequest; +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.ListLocationsResponse; +import com.google.cloud.location.Location; import com.google.common.collect.ImmutableMap; import com.google.longrunning.Operation; import com.google.longrunning.stub.GrpcOperationsStub; @@ -139,6 +144,25 @@ public class GrpcConversationProfilesStub extends ConversationProfilesStub { .setResponseMarshaller(ProtoUtils.marshaller(Operation.getDefaultInstance())) .build(); + private static final MethodDescriptor + listLocationsMethodDescriptor = + MethodDescriptor.newBuilder() + .setType(MethodDescriptor.MethodType.UNARY) + .setFullMethodName("google.cloud.location.Locations/ListLocations") + .setRequestMarshaller( + ProtoUtils.marshaller(ListLocationsRequest.getDefaultInstance())) + .setResponseMarshaller( + ProtoUtils.marshaller(ListLocationsResponse.getDefaultInstance())) + .build(); + + private static final MethodDescriptor getLocationMethodDescriptor = + MethodDescriptor.newBuilder() + .setType(MethodDescriptor.MethodType.UNARY) + .setFullMethodName("google.cloud.location.Locations/GetLocation") + .setRequestMarshaller(ProtoUtils.marshaller(GetLocationRequest.getDefaultInstance())) + .setResponseMarshaller(ProtoUtils.marshaller(Location.getDefaultInstance())) + .build(); + private final UnaryCallable listConversationProfilesCallable; private final UnaryCallable< @@ -166,6 +190,10 @@ public class GrpcConversationProfilesStub extends ConversationProfilesStub { ConversationProfile, ClearSuggestionFeatureConfigOperationMetadata> clearSuggestionFeatureConfigOperationCallable; + private final UnaryCallable listLocationsCallable; + private final UnaryCallable + listLocationsPagedCallable; + private final UnaryCallable getLocationCallable; private final BackgroundResource backgroundResources; private final GrpcOperationsStub operationsStub; @@ -293,6 +321,26 @@ protected GrpcConversationProfilesStub( return params.build(); }) .build(); + GrpcCallSettings listLocationsTransportSettings = + GrpcCallSettings.newBuilder() + .setMethodDescriptor(listLocationsMethodDescriptor) + .setParamsExtractor( + request -> { + ImmutableMap.Builder params = ImmutableMap.builder(); + params.put("name", String.valueOf(request.getName())); + return params.build(); + }) + .build(); + GrpcCallSettings getLocationTransportSettings = + GrpcCallSettings.newBuilder() + .setMethodDescriptor(getLocationMethodDescriptor) + .setParamsExtractor( + request -> { + ImmutableMap.Builder params = ImmutableMap.builder(); + params.put("name", String.valueOf(request.getName())); + return params.build(); + }) + .build(); this.listConversationProfilesCallable = callableFactory.createUnaryCallable( @@ -346,6 +394,15 @@ protected GrpcConversationProfilesStub( settings.clearSuggestionFeatureConfigOperationSettings(), clientContext, operationsStub); + this.listLocationsCallable = + callableFactory.createUnaryCallable( + listLocationsTransportSettings, settings.listLocationsSettings(), clientContext); + this.listLocationsPagedCallable = + callableFactory.createPagedCallable( + listLocationsTransportSettings, settings.listLocationsSettings(), clientContext); + this.getLocationCallable = + callableFactory.createUnaryCallable( + getLocationTransportSettings, settings.getLocationSettings(), clientContext); this.backgroundResources = new BackgroundResourceAggregation(clientContext.getBackgroundResources()); @@ -421,6 +478,22 @@ public GrpcOperationsStub getOperationsStub() { return clearSuggestionFeatureConfigOperationCallable; } + @Override + public UnaryCallable listLocationsCallable() { + return listLocationsCallable; + } + + @Override + public UnaryCallable + listLocationsPagedCallable() { + return listLocationsPagedCallable; + } + + @Override + public UnaryCallable getLocationCallable() { + return getLocationCallable; + } + @Override public final void close() { try { diff --git a/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2beta1/stub/GrpcConversationsStub.java b/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2beta1/stub/GrpcConversationsStub.java index d41aa0ff3..b91483820 100644 --- a/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2beta1/stub/GrpcConversationsStub.java +++ b/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2beta1/stub/GrpcConversationsStub.java @@ -17,6 +17,7 @@ package com.google.cloud.dialogflow.v2beta1.stub; import static com.google.cloud.dialogflow.v2beta1.ConversationsClient.ListConversationsPagedResponse; +import static com.google.cloud.dialogflow.v2beta1.ConversationsClient.ListLocationsPagedResponse; import static com.google.cloud.dialogflow.v2beta1.ConversationsClient.ListMessagesPagedResponse; import com.google.api.core.BetaApi; @@ -36,6 +37,10 @@ import com.google.cloud.dialogflow.v2beta1.ListConversationsResponse; import com.google.cloud.dialogflow.v2beta1.ListMessagesRequest; import com.google.cloud.dialogflow.v2beta1.ListMessagesResponse; +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.ListLocationsResponse; +import com.google.cloud.location.Location; import com.google.common.collect.ImmutableMap; import com.google.longrunning.stub.GrpcOperationsStub; import io.grpc.MethodDescriptor; @@ -117,6 +122,25 @@ public class GrpcConversationsStub extends ConversationsStub { ProtoUtils.marshaller(ListMessagesResponse.getDefaultInstance())) .build(); + private static final MethodDescriptor + listLocationsMethodDescriptor = + MethodDescriptor.newBuilder() + .setType(MethodDescriptor.MethodType.UNARY) + .setFullMethodName("google.cloud.location.Locations/ListLocations") + .setRequestMarshaller( + ProtoUtils.marshaller(ListLocationsRequest.getDefaultInstance())) + .setResponseMarshaller( + ProtoUtils.marshaller(ListLocationsResponse.getDefaultInstance())) + .build(); + + private static final MethodDescriptor getLocationMethodDescriptor = + MethodDescriptor.newBuilder() + .setType(MethodDescriptor.MethodType.UNARY) + .setFullMethodName("google.cloud.location.Locations/GetLocation") + .setRequestMarshaller(ProtoUtils.marshaller(GetLocationRequest.getDefaultInstance())) + .setResponseMarshaller(ProtoUtils.marshaller(Location.getDefaultInstance())) + .build(); + private final UnaryCallable createConversationCallable; private final UnaryCallable listConversationsCallable; @@ -130,6 +154,10 @@ public class GrpcConversationsStub extends ConversationsStub { private final UnaryCallable listMessagesCallable; private final UnaryCallable listMessagesPagedCallable; + private final UnaryCallable listLocationsCallable; + private final UnaryCallable + listLocationsPagedCallable; + private final UnaryCallable getLocationCallable; private final BackgroundResource backgroundResources; private final GrpcOperationsStub operationsStub; @@ -236,6 +264,26 @@ protected GrpcConversationsStub( return params.build(); }) .build(); + GrpcCallSettings listLocationsTransportSettings = + GrpcCallSettings.newBuilder() + .setMethodDescriptor(listLocationsMethodDescriptor) + .setParamsExtractor( + request -> { + ImmutableMap.Builder params = ImmutableMap.builder(); + params.put("name", String.valueOf(request.getName())); + return params.build(); + }) + .build(); + GrpcCallSettings getLocationTransportSettings = + GrpcCallSettings.newBuilder() + .setMethodDescriptor(getLocationMethodDescriptor) + .setParamsExtractor( + request -> { + ImmutableMap.Builder params = ImmutableMap.builder(); + params.put("name", String.valueOf(request.getName())); + return params.build(); + }) + .build(); this.createConversationCallable = callableFactory.createUnaryCallable( @@ -271,6 +319,15 @@ protected GrpcConversationsStub( this.listMessagesPagedCallable = callableFactory.createPagedCallable( listMessagesTransportSettings, settings.listMessagesSettings(), clientContext); + this.listLocationsCallable = + callableFactory.createUnaryCallable( + listLocationsTransportSettings, settings.listLocationsSettings(), clientContext); + this.listLocationsPagedCallable = + callableFactory.createPagedCallable( + listLocationsTransportSettings, settings.listLocationsSettings(), clientContext); + this.getLocationCallable = + callableFactory.createUnaryCallable( + getLocationTransportSettings, settings.getLocationSettings(), clientContext); this.backgroundResources = new BackgroundResourceAggregation(clientContext.getBackgroundResources()); @@ -323,6 +380,22 @@ public UnaryCallable listMessage return listMessagesPagedCallable; } + @Override + public UnaryCallable listLocationsCallable() { + return listLocationsCallable; + } + + @Override + public UnaryCallable + listLocationsPagedCallable() { + return listLocationsPagedCallable; + } + + @Override + public UnaryCallable getLocationCallable() { + return getLocationCallable; + } + @Override public final void close() { try { diff --git a/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2beta1/stub/GrpcDocumentsStub.java b/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2beta1/stub/GrpcDocumentsStub.java index 03d42a3b4..4d69266ce 100644 --- a/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2beta1/stub/GrpcDocumentsStub.java +++ b/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2beta1/stub/GrpcDocumentsStub.java @@ -17,6 +17,7 @@ package com.google.cloud.dialogflow.v2beta1.stub; import static com.google.cloud.dialogflow.v2beta1.DocumentsClient.ListDocumentsPagedResponse; +import static com.google.cloud.dialogflow.v2beta1.DocumentsClient.ListLocationsPagedResponse; import com.google.api.core.BetaApi; import com.google.api.gax.core.BackgroundResource; @@ -37,6 +38,10 @@ import com.google.cloud.dialogflow.v2beta1.ListDocumentsResponse; import com.google.cloud.dialogflow.v2beta1.ReloadDocumentRequest; import com.google.cloud.dialogflow.v2beta1.UpdateDocumentRequest; +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.ListLocationsResponse; +import com.google.cloud.location.Location; import com.google.common.collect.ImmutableMap; import com.google.longrunning.Operation; import com.google.longrunning.stub.GrpcOperationsStub; @@ -125,6 +130,25 @@ public class GrpcDocumentsStub extends DocumentsStub { .setResponseMarshaller(ProtoUtils.marshaller(Operation.getDefaultInstance())) .build(); + private static final MethodDescriptor + listLocationsMethodDescriptor = + MethodDescriptor.newBuilder() + .setType(MethodDescriptor.MethodType.UNARY) + .setFullMethodName("google.cloud.location.Locations/ListLocations") + .setRequestMarshaller( + ProtoUtils.marshaller(ListLocationsRequest.getDefaultInstance())) + .setResponseMarshaller( + ProtoUtils.marshaller(ListLocationsResponse.getDefaultInstance())) + .build(); + + private static final MethodDescriptor getLocationMethodDescriptor = + MethodDescriptor.newBuilder() + .setType(MethodDescriptor.MethodType.UNARY) + .setFullMethodName("google.cloud.location.Locations/GetLocation") + .setRequestMarshaller(ProtoUtils.marshaller(GetLocationRequest.getDefaultInstance())) + .setResponseMarshaller(ProtoUtils.marshaller(Location.getDefaultInstance())) + .build(); + private final UnaryCallable listDocumentsCallable; private final UnaryCallable listDocumentsPagedCallable; @@ -145,6 +169,10 @@ public class GrpcDocumentsStub extends DocumentsStub { private final UnaryCallable reloadDocumentCallable; private final OperationCallable reloadDocumentOperationCallable; + private final UnaryCallable listLocationsCallable; + private final UnaryCallable + listLocationsPagedCallable; + private final UnaryCallable getLocationCallable; private final BackgroundResource backgroundResources; private final GrpcOperationsStub operationsStub; @@ -257,6 +285,26 @@ protected GrpcDocumentsStub( return params.build(); }) .build(); + GrpcCallSettings listLocationsTransportSettings = + GrpcCallSettings.newBuilder() + .setMethodDescriptor(listLocationsMethodDescriptor) + .setParamsExtractor( + request -> { + ImmutableMap.Builder params = ImmutableMap.builder(); + params.put("name", String.valueOf(request.getName())); + return params.build(); + }) + .build(); + GrpcCallSettings getLocationTransportSettings = + GrpcCallSettings.newBuilder() + .setMethodDescriptor(getLocationMethodDescriptor) + .setParamsExtractor( + request -> { + ImmutableMap.Builder params = ImmutableMap.builder(); + params.put("name", String.valueOf(request.getName())); + return params.build(); + }) + .build(); this.listDocumentsCallable = callableFactory.createUnaryCallable( @@ -312,6 +360,15 @@ protected GrpcDocumentsStub( settings.reloadDocumentOperationSettings(), clientContext, operationsStub); + this.listLocationsCallable = + callableFactory.createUnaryCallable( + listLocationsTransportSettings, settings.listLocationsSettings(), clientContext); + this.listLocationsPagedCallable = + callableFactory.createPagedCallable( + listLocationsTransportSettings, settings.listLocationsSettings(), clientContext); + this.getLocationCallable = + callableFactory.createUnaryCallable( + getLocationTransportSettings, settings.getLocationSettings(), clientContext); this.backgroundResources = new BackgroundResourceAggregation(clientContext.getBackgroundResources()); @@ -393,6 +450,22 @@ public UnaryCallable reloadDocumentCallable() return reloadDocumentOperationCallable; } + @Override + public UnaryCallable listLocationsCallable() { + return listLocationsCallable; + } + + @Override + public UnaryCallable + listLocationsPagedCallable() { + return listLocationsPagedCallable; + } + + @Override + public UnaryCallable getLocationCallable() { + return getLocationCallable; + } + @Override public final void close() { try { diff --git a/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2beta1/stub/GrpcEntityTypesStub.java b/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2beta1/stub/GrpcEntityTypesStub.java index 30b0449a8..f38c9ac2c 100644 --- a/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2beta1/stub/GrpcEntityTypesStub.java +++ b/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2beta1/stub/GrpcEntityTypesStub.java @@ -17,6 +17,7 @@ package com.google.cloud.dialogflow.v2beta1.stub; import static com.google.cloud.dialogflow.v2beta1.EntityTypesClient.ListEntityTypesPagedResponse; +import static com.google.cloud.dialogflow.v2beta1.EntityTypesClient.ListLocationsPagedResponse; import com.google.api.core.BetaApi; import com.google.api.gax.core.BackgroundResource; @@ -39,6 +40,10 @@ import com.google.cloud.dialogflow.v2beta1.ListEntityTypesRequest; import com.google.cloud.dialogflow.v2beta1.ListEntityTypesResponse; import com.google.cloud.dialogflow.v2beta1.UpdateEntityTypeRequest; +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.ListLocationsResponse; +import com.google.cloud.location.Location; import com.google.common.collect.ImmutableMap; import com.google.longrunning.Operation; import com.google.longrunning.stub.GrpcOperationsStub; @@ -162,6 +167,25 @@ public class GrpcEntityTypesStub extends EntityTypesStub { .setResponseMarshaller(ProtoUtils.marshaller(Operation.getDefaultInstance())) .build(); + private static final MethodDescriptor + listLocationsMethodDescriptor = + MethodDescriptor.newBuilder() + .setType(MethodDescriptor.MethodType.UNARY) + .setFullMethodName("google.cloud.location.Locations/ListLocations") + .setRequestMarshaller( + ProtoUtils.marshaller(ListLocationsRequest.getDefaultInstance())) + .setResponseMarshaller( + ProtoUtils.marshaller(ListLocationsResponse.getDefaultInstance())) + .build(); + + private static final MethodDescriptor getLocationMethodDescriptor = + MethodDescriptor.newBuilder() + .setType(MethodDescriptor.MethodType.UNARY) + .setFullMethodName("google.cloud.location.Locations/GetLocation") + .setRequestMarshaller(ProtoUtils.marshaller(GetLocationRequest.getDefaultInstance())) + .setResponseMarshaller(ProtoUtils.marshaller(Location.getDefaultInstance())) + .build(); + private final UnaryCallable listEntityTypesCallable; private final UnaryCallable @@ -188,6 +212,10 @@ public class GrpcEntityTypesStub extends EntityTypesStub { private final UnaryCallable batchDeleteEntitiesCallable; private final OperationCallable batchDeleteEntitiesOperationCallable; + private final UnaryCallable listLocationsCallable; + private final UnaryCallable + listLocationsPagedCallable; + private final UnaryCallable getLocationCallable; private final BackgroundResource backgroundResources; private final GrpcOperationsStub operationsStub; @@ -334,6 +362,26 @@ protected GrpcEntityTypesStub( return params.build(); }) .build(); + GrpcCallSettings listLocationsTransportSettings = + GrpcCallSettings.newBuilder() + .setMethodDescriptor(listLocationsMethodDescriptor) + .setParamsExtractor( + request -> { + ImmutableMap.Builder params = ImmutableMap.builder(); + params.put("name", String.valueOf(request.getName())); + return params.build(); + }) + .build(); + GrpcCallSettings getLocationTransportSettings = + GrpcCallSettings.newBuilder() + .setMethodDescriptor(getLocationMethodDescriptor) + .setParamsExtractor( + request -> { + ImmutableMap.Builder params = ImmutableMap.builder(); + params.put("name", String.valueOf(request.getName())); + return params.build(); + }) + .build(); this.listEntityTypesCallable = callableFactory.createUnaryCallable( @@ -408,6 +456,15 @@ protected GrpcEntityTypesStub( settings.batchDeleteEntitiesOperationSettings(), clientContext, operationsStub); + this.listLocationsCallable = + callableFactory.createUnaryCallable( + listLocationsTransportSettings, settings.listLocationsSettings(), clientContext); + this.listLocationsPagedCallable = + callableFactory.createPagedCallable( + listLocationsTransportSettings, settings.listLocationsSettings(), clientContext); + this.getLocationCallable = + callableFactory.createUnaryCallable( + getLocationTransportSettings, settings.getLocationSettings(), clientContext); this.backgroundResources = new BackgroundResourceAggregation(clientContext.getBackgroundResources()); @@ -503,6 +560,22 @@ public UnaryCallable batchDeleteEntitiesC return batchDeleteEntitiesOperationCallable; } + @Override + public UnaryCallable listLocationsCallable() { + return listLocationsCallable; + } + + @Override + public UnaryCallable + listLocationsPagedCallable() { + return listLocationsPagedCallable; + } + + @Override + public UnaryCallable getLocationCallable() { + return getLocationCallable; + } + @Override public final void close() { try { diff --git a/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2beta1/stub/GrpcEnvironmentsStub.java b/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2beta1/stub/GrpcEnvironmentsStub.java index e20c8d0ca..289cd9075 100644 --- a/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2beta1/stub/GrpcEnvironmentsStub.java +++ b/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2beta1/stub/GrpcEnvironmentsStub.java @@ -18,6 +18,7 @@ import static com.google.cloud.dialogflow.v2beta1.EnvironmentsClient.GetEnvironmentHistoryPagedResponse; import static com.google.cloud.dialogflow.v2beta1.EnvironmentsClient.ListEnvironmentsPagedResponse; +import static com.google.cloud.dialogflow.v2beta1.EnvironmentsClient.ListLocationsPagedResponse; import com.google.api.core.BetaApi; import com.google.api.gax.core.BackgroundResource; @@ -35,6 +36,10 @@ import com.google.cloud.dialogflow.v2beta1.ListEnvironmentsRequest; import com.google.cloud.dialogflow.v2beta1.ListEnvironmentsResponse; import com.google.cloud.dialogflow.v2beta1.UpdateEnvironmentRequest; +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.ListLocationsResponse; +import com.google.cloud.location.Location; import com.google.common.collect.ImmutableMap; import com.google.longrunning.stub.GrpcOperationsStub; import com.google.protobuf.Empty; @@ -115,6 +120,25 @@ public class GrpcEnvironmentsStub extends EnvironmentsStub { .setResponseMarshaller(ProtoUtils.marshaller(EnvironmentHistory.getDefaultInstance())) .build(); + private static final MethodDescriptor + listLocationsMethodDescriptor = + MethodDescriptor.newBuilder() + .setType(MethodDescriptor.MethodType.UNARY) + .setFullMethodName("google.cloud.location.Locations/ListLocations") + .setRequestMarshaller( + ProtoUtils.marshaller(ListLocationsRequest.getDefaultInstance())) + .setResponseMarshaller( + ProtoUtils.marshaller(ListLocationsResponse.getDefaultInstance())) + .build(); + + private static final MethodDescriptor getLocationMethodDescriptor = + MethodDescriptor.newBuilder() + .setType(MethodDescriptor.MethodType.UNARY) + .setFullMethodName("google.cloud.location.Locations/GetLocation") + .setRequestMarshaller(ProtoUtils.marshaller(GetLocationRequest.getDefaultInstance())) + .setResponseMarshaller(ProtoUtils.marshaller(Location.getDefaultInstance())) + .build(); + private final UnaryCallable listEnvironmentsCallable; private final UnaryCallable @@ -127,6 +151,10 @@ public class GrpcEnvironmentsStub extends EnvironmentsStub { getEnvironmentHistoryCallable; private final UnaryCallable getEnvironmentHistoryPagedCallable; + private final UnaryCallable listLocationsCallable; + private final UnaryCallable + listLocationsPagedCallable; + private final UnaryCallable getLocationCallable; private final BackgroundResource backgroundResources; private final GrpcOperationsStub operationsStub; @@ -233,6 +261,26 @@ protected GrpcEnvironmentsStub( return params.build(); }) .build(); + GrpcCallSettings listLocationsTransportSettings = + GrpcCallSettings.newBuilder() + .setMethodDescriptor(listLocationsMethodDescriptor) + .setParamsExtractor( + request -> { + ImmutableMap.Builder params = ImmutableMap.builder(); + params.put("name", String.valueOf(request.getName())); + return params.build(); + }) + .build(); + GrpcCallSettings getLocationTransportSettings = + GrpcCallSettings.newBuilder() + .setMethodDescriptor(getLocationMethodDescriptor) + .setParamsExtractor( + request -> { + ImmutableMap.Builder params = ImmutableMap.builder(); + params.put("name", String.valueOf(request.getName())); + return params.build(); + }) + .build(); this.listEnvironmentsCallable = callableFactory.createUnaryCallable( @@ -268,6 +316,15 @@ protected GrpcEnvironmentsStub( getEnvironmentHistoryTransportSettings, settings.getEnvironmentHistorySettings(), clientContext); + this.listLocationsCallable = + callableFactory.createUnaryCallable( + listLocationsTransportSettings, settings.listLocationsSettings(), clientContext); + this.listLocationsPagedCallable = + callableFactory.createPagedCallable( + listLocationsTransportSettings, settings.listLocationsSettings(), clientContext); + this.getLocationCallable = + callableFactory.createUnaryCallable( + getLocationTransportSettings, settings.getLocationSettings(), clientContext); this.backgroundResources = new BackgroundResourceAggregation(clientContext.getBackgroundResources()); @@ -321,6 +378,22 @@ public UnaryCallable deleteEnvironmentCallable( return getEnvironmentHistoryPagedCallable; } + @Override + public UnaryCallable listLocationsCallable() { + return listLocationsCallable; + } + + @Override + public UnaryCallable + listLocationsPagedCallable() { + return listLocationsPagedCallable; + } + + @Override + public UnaryCallable getLocationCallable() { + return getLocationCallable; + } + @Override public final void close() { try { diff --git a/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2beta1/stub/GrpcFulfillmentsStub.java b/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2beta1/stub/GrpcFulfillmentsStub.java index 883882f70..a7ea25732 100644 --- a/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2beta1/stub/GrpcFulfillmentsStub.java +++ b/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2beta1/stub/GrpcFulfillmentsStub.java @@ -16,6 +16,8 @@ package com.google.cloud.dialogflow.v2beta1.stub; +import static com.google.cloud.dialogflow.v2beta1.FulfillmentsClient.ListLocationsPagedResponse; + import com.google.api.core.BetaApi; import com.google.api.gax.core.BackgroundResource; import com.google.api.gax.core.BackgroundResourceAggregation; @@ -26,6 +28,10 @@ import com.google.cloud.dialogflow.v2beta1.Fulfillment; import com.google.cloud.dialogflow.v2beta1.GetFulfillmentRequest; import com.google.cloud.dialogflow.v2beta1.UpdateFulfillmentRequest; +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.ListLocationsResponse; +import com.google.cloud.location.Location; import com.google.common.collect.ImmutableMap; import com.google.longrunning.stub.GrpcOperationsStub; import io.grpc.MethodDescriptor; @@ -63,8 +69,31 @@ public class GrpcFulfillmentsStub extends FulfillmentsStub { .setResponseMarshaller(ProtoUtils.marshaller(Fulfillment.getDefaultInstance())) .build(); + private static final MethodDescriptor + listLocationsMethodDescriptor = + MethodDescriptor.newBuilder() + .setType(MethodDescriptor.MethodType.UNARY) + .setFullMethodName("google.cloud.location.Locations/ListLocations") + .setRequestMarshaller( + ProtoUtils.marshaller(ListLocationsRequest.getDefaultInstance())) + .setResponseMarshaller( + ProtoUtils.marshaller(ListLocationsResponse.getDefaultInstance())) + .build(); + + private static final MethodDescriptor getLocationMethodDescriptor = + MethodDescriptor.newBuilder() + .setType(MethodDescriptor.MethodType.UNARY) + .setFullMethodName("google.cloud.location.Locations/GetLocation") + .setRequestMarshaller(ProtoUtils.marshaller(GetLocationRequest.getDefaultInstance())) + .setResponseMarshaller(ProtoUtils.marshaller(Location.getDefaultInstance())) + .build(); + private final UnaryCallable getFulfillmentCallable; private final UnaryCallable updateFulfillmentCallable; + private final UnaryCallable listLocationsCallable; + private final UnaryCallable + listLocationsPagedCallable; + private final UnaryCallable getLocationCallable; private final BackgroundResource backgroundResources; private final GrpcOperationsStub operationsStub; @@ -129,6 +158,26 @@ protected GrpcFulfillmentsStub( return params.build(); }) .build(); + GrpcCallSettings listLocationsTransportSettings = + GrpcCallSettings.newBuilder() + .setMethodDescriptor(listLocationsMethodDescriptor) + .setParamsExtractor( + request -> { + ImmutableMap.Builder params = ImmutableMap.builder(); + params.put("name", String.valueOf(request.getName())); + return params.build(); + }) + .build(); + GrpcCallSettings getLocationTransportSettings = + GrpcCallSettings.newBuilder() + .setMethodDescriptor(getLocationMethodDescriptor) + .setParamsExtractor( + request -> { + ImmutableMap.Builder params = ImmutableMap.builder(); + params.put("name", String.valueOf(request.getName())); + return params.build(); + }) + .build(); this.getFulfillmentCallable = callableFactory.createUnaryCallable( @@ -138,6 +187,15 @@ protected GrpcFulfillmentsStub( updateFulfillmentTransportSettings, settings.updateFulfillmentSettings(), clientContext); + this.listLocationsCallable = + callableFactory.createUnaryCallable( + listLocationsTransportSettings, settings.listLocationsSettings(), clientContext); + this.listLocationsPagedCallable = + callableFactory.createPagedCallable( + listLocationsTransportSettings, settings.listLocationsSettings(), clientContext); + this.getLocationCallable = + callableFactory.createUnaryCallable( + getLocationTransportSettings, settings.getLocationSettings(), clientContext); this.backgroundResources = new BackgroundResourceAggregation(clientContext.getBackgroundResources()); @@ -157,6 +215,22 @@ public UnaryCallable updateFulfillmentCal return updateFulfillmentCallable; } + @Override + public UnaryCallable listLocationsCallable() { + return listLocationsCallable; + } + + @Override + public UnaryCallable + listLocationsPagedCallable() { + return listLocationsPagedCallable; + } + + @Override + public UnaryCallable getLocationCallable() { + return getLocationCallable; + } + @Override public final void close() { try { diff --git a/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2beta1/stub/GrpcIntentsStub.java b/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2beta1/stub/GrpcIntentsStub.java index e64197c15..2873a085f 100644 --- a/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2beta1/stub/GrpcIntentsStub.java +++ b/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2beta1/stub/GrpcIntentsStub.java @@ -17,6 +17,7 @@ package com.google.cloud.dialogflow.v2beta1.stub; import static com.google.cloud.dialogflow.v2beta1.IntentsClient.ListIntentsPagedResponse; +import static com.google.cloud.dialogflow.v2beta1.IntentsClient.ListLocationsPagedResponse; import com.google.api.core.BetaApi; import com.google.api.gax.core.BackgroundResource; @@ -36,6 +37,10 @@ import com.google.cloud.dialogflow.v2beta1.ListIntentsRequest; import com.google.cloud.dialogflow.v2beta1.ListIntentsResponse; import com.google.cloud.dialogflow.v2beta1.UpdateIntentRequest; +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.ListLocationsResponse; +import com.google.cloud.location.Location; import com.google.common.collect.ImmutableMap; import com.google.longrunning.Operation; import com.google.longrunning.stub.GrpcOperationsStub; @@ -118,6 +123,25 @@ public class GrpcIntentsStub extends IntentsStub { .setResponseMarshaller(ProtoUtils.marshaller(Operation.getDefaultInstance())) .build(); + private static final MethodDescriptor + listLocationsMethodDescriptor = + MethodDescriptor.newBuilder() + .setType(MethodDescriptor.MethodType.UNARY) + .setFullMethodName("google.cloud.location.Locations/ListLocations") + .setRequestMarshaller( + ProtoUtils.marshaller(ListLocationsRequest.getDefaultInstance())) + .setResponseMarshaller( + ProtoUtils.marshaller(ListLocationsResponse.getDefaultInstance())) + .build(); + + private static final MethodDescriptor getLocationMethodDescriptor = + MethodDescriptor.newBuilder() + .setType(MethodDescriptor.MethodType.UNARY) + .setFullMethodName("google.cloud.location.Locations/GetLocation") + .setRequestMarshaller(ProtoUtils.marshaller(GetLocationRequest.getDefaultInstance())) + .setResponseMarshaller(ProtoUtils.marshaller(Location.getDefaultInstance())) + .build(); + private final UnaryCallable listIntentsCallable; private final UnaryCallable listIntentsPagedCallable; @@ -131,6 +155,10 @@ public class GrpcIntentsStub extends IntentsStub { private final UnaryCallable batchDeleteIntentsCallable; private final OperationCallable batchDeleteIntentsOperationCallable; + private final UnaryCallable listLocationsCallable; + private final UnaryCallable + listLocationsPagedCallable; + private final UnaryCallable getLocationCallable; private final BackgroundResource backgroundResources; private final GrpcOperationsStub operationsStub; @@ -241,6 +269,26 @@ protected GrpcIntentsStub( return params.build(); }) .build(); + GrpcCallSettings listLocationsTransportSettings = + GrpcCallSettings.newBuilder() + .setMethodDescriptor(listLocationsMethodDescriptor) + .setParamsExtractor( + request -> { + ImmutableMap.Builder params = ImmutableMap.builder(); + params.put("name", String.valueOf(request.getName())); + return params.build(); + }) + .build(); + GrpcCallSettings getLocationTransportSettings = + GrpcCallSettings.newBuilder() + .setMethodDescriptor(getLocationMethodDescriptor) + .setParamsExtractor( + request -> { + ImmutableMap.Builder params = ImmutableMap.builder(); + params.put("name", String.valueOf(request.getName())); + return params.build(); + }) + .build(); this.listIntentsCallable = callableFactory.createUnaryCallable( @@ -282,6 +330,15 @@ protected GrpcIntentsStub( settings.batchDeleteIntentsOperationSettings(), clientContext, operationsStub); + this.listLocationsCallable = + callableFactory.createUnaryCallable( + listLocationsTransportSettings, settings.listLocationsSettings(), clientContext); + this.listLocationsPagedCallable = + callableFactory.createPagedCallable( + listLocationsTransportSettings, settings.listLocationsSettings(), clientContext); + this.getLocationCallable = + callableFactory.createUnaryCallable( + getLocationTransportSettings, settings.getLocationSettings(), clientContext); this.backgroundResources = new BackgroundResourceAggregation(clientContext.getBackgroundResources()); @@ -343,6 +400,22 @@ public UnaryCallable batchDeleteIntentsCal return batchDeleteIntentsOperationCallable; } + @Override + public UnaryCallable listLocationsCallable() { + return listLocationsCallable; + } + + @Override + public UnaryCallable + listLocationsPagedCallable() { + return listLocationsPagedCallable; + } + + @Override + public UnaryCallable getLocationCallable() { + return getLocationCallable; + } + @Override public final void close() { try { diff --git a/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2beta1/stub/GrpcKnowledgeBasesStub.java b/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2beta1/stub/GrpcKnowledgeBasesStub.java index 7f0758681..b502d9289 100644 --- a/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2beta1/stub/GrpcKnowledgeBasesStub.java +++ b/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2beta1/stub/GrpcKnowledgeBasesStub.java @@ -17,6 +17,7 @@ package com.google.cloud.dialogflow.v2beta1.stub; import static com.google.cloud.dialogflow.v2beta1.KnowledgeBasesClient.ListKnowledgeBasesPagedResponse; +import static com.google.cloud.dialogflow.v2beta1.KnowledgeBasesClient.ListLocationsPagedResponse; import com.google.api.core.BetaApi; import com.google.api.gax.core.BackgroundResource; @@ -32,6 +33,10 @@ import com.google.cloud.dialogflow.v2beta1.ListKnowledgeBasesRequest; import com.google.cloud.dialogflow.v2beta1.ListKnowledgeBasesResponse; import com.google.cloud.dialogflow.v2beta1.UpdateKnowledgeBaseRequest; +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.ListLocationsResponse; +import com.google.cloud.location.Location; import com.google.common.collect.ImmutableMap; import com.google.longrunning.stub.GrpcOperationsStub; import com.google.protobuf.Empty; @@ -105,6 +110,25 @@ public class GrpcKnowledgeBasesStub extends KnowledgeBasesStub { .setResponseMarshaller(ProtoUtils.marshaller(KnowledgeBase.getDefaultInstance())) .build(); + private static final MethodDescriptor + listLocationsMethodDescriptor = + MethodDescriptor.newBuilder() + .setType(MethodDescriptor.MethodType.UNARY) + .setFullMethodName("google.cloud.location.Locations/ListLocations") + .setRequestMarshaller( + ProtoUtils.marshaller(ListLocationsRequest.getDefaultInstance())) + .setResponseMarshaller( + ProtoUtils.marshaller(ListLocationsResponse.getDefaultInstance())) + .build(); + + private static final MethodDescriptor getLocationMethodDescriptor = + MethodDescriptor.newBuilder() + .setType(MethodDescriptor.MethodType.UNARY) + .setFullMethodName("google.cloud.location.Locations/GetLocation") + .setRequestMarshaller(ProtoUtils.marshaller(GetLocationRequest.getDefaultInstance())) + .setResponseMarshaller(ProtoUtils.marshaller(Location.getDefaultInstance())) + .build(); + private final UnaryCallable listKnowledgeBasesCallable; private final UnaryCallable @@ -115,6 +139,10 @@ public class GrpcKnowledgeBasesStub extends KnowledgeBasesStub { private final UnaryCallable deleteKnowledgeBaseCallable; private final UnaryCallable updateKnowledgeBaseCallable; + private final UnaryCallable listLocationsCallable; + private final UnaryCallable + listLocationsPagedCallable; + private final UnaryCallable getLocationCallable; private final BackgroundResource backgroundResources; private final GrpcOperationsStub operationsStub; @@ -215,6 +243,26 @@ protected GrpcKnowledgeBasesStub( return params.build(); }) .build(); + GrpcCallSettings listLocationsTransportSettings = + GrpcCallSettings.newBuilder() + .setMethodDescriptor(listLocationsMethodDescriptor) + .setParamsExtractor( + request -> { + ImmutableMap.Builder params = ImmutableMap.builder(); + params.put("name", String.valueOf(request.getName())); + return params.build(); + }) + .build(); + GrpcCallSettings getLocationTransportSettings = + GrpcCallSettings.newBuilder() + .setMethodDescriptor(getLocationMethodDescriptor) + .setParamsExtractor( + request -> { + ImmutableMap.Builder params = ImmutableMap.builder(); + params.put("name", String.valueOf(request.getName())); + return params.build(); + }) + .build(); this.listKnowledgeBasesCallable = callableFactory.createUnaryCallable( @@ -244,6 +292,15 @@ protected GrpcKnowledgeBasesStub( updateKnowledgeBaseTransportSettings, settings.updateKnowledgeBaseSettings(), clientContext); + this.listLocationsCallable = + callableFactory.createUnaryCallable( + listLocationsTransportSettings, settings.listLocationsSettings(), clientContext); + this.listLocationsPagedCallable = + callableFactory.createPagedCallable( + listLocationsTransportSettings, settings.listLocationsSettings(), clientContext); + this.getLocationCallable = + callableFactory.createUnaryCallable( + getLocationTransportSettings, settings.getLocationSettings(), clientContext); this.backgroundResources = new BackgroundResourceAggregation(clientContext.getBackgroundResources()); @@ -285,6 +342,22 @@ public UnaryCallable updateKnowledgeB return updateKnowledgeBaseCallable; } + @Override + public UnaryCallable listLocationsCallable() { + return listLocationsCallable; + } + + @Override + public UnaryCallable + listLocationsPagedCallable() { + return listLocationsPagedCallable; + } + + @Override + public UnaryCallable getLocationCallable() { + return getLocationCallable; + } + @Override public final void close() { try { diff --git a/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2beta1/stub/GrpcParticipantsStub.java b/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2beta1/stub/GrpcParticipantsStub.java index 6df770594..147820e25 100644 --- a/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2beta1/stub/GrpcParticipantsStub.java +++ b/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2beta1/stub/GrpcParticipantsStub.java @@ -16,6 +16,7 @@ package com.google.cloud.dialogflow.v2beta1.stub; +import static com.google.cloud.dialogflow.v2beta1.ParticipantsClient.ListLocationsPagedResponse; import static com.google.cloud.dialogflow.v2beta1.ParticipantsClient.ListParticipantsPagedResponse; import static com.google.cloud.dialogflow.v2beta1.ParticipantsClient.ListSuggestionsPagedResponse; @@ -47,6 +48,10 @@ import com.google.cloud.dialogflow.v2beta1.SuggestSmartRepliesRequest; import com.google.cloud.dialogflow.v2beta1.SuggestSmartRepliesResponse; import com.google.cloud.dialogflow.v2beta1.UpdateParticipantRequest; +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.ListLocationsResponse; +import com.google.cloud.location.Location; import com.google.common.collect.ImmutableMap; import com.google.longrunning.stub.GrpcOperationsStub; import io.grpc.MethodDescriptor; @@ -185,6 +190,25 @@ public class GrpcParticipantsStub extends ParticipantsStub { ProtoUtils.marshaller(CompileSuggestionResponse.getDefaultInstance())) .build(); + private static final MethodDescriptor + listLocationsMethodDescriptor = + MethodDescriptor.newBuilder() + .setType(MethodDescriptor.MethodType.UNARY) + .setFullMethodName("google.cloud.location.Locations/ListLocations") + .setRequestMarshaller( + ProtoUtils.marshaller(ListLocationsRequest.getDefaultInstance())) + .setResponseMarshaller( + ProtoUtils.marshaller(ListLocationsResponse.getDefaultInstance())) + .build(); + + private static final MethodDescriptor getLocationMethodDescriptor = + MethodDescriptor.newBuilder() + .setType(MethodDescriptor.MethodType.UNARY) + .setFullMethodName("google.cloud.location.Locations/GetLocation") + .setRequestMarshaller(ProtoUtils.marshaller(GetLocationRequest.getDefaultInstance())) + .setResponseMarshaller(ProtoUtils.marshaller(Location.getDefaultInstance())) + .build(); + private final UnaryCallable createParticipantCallable; private final UnaryCallable getParticipantCallable; private final UnaryCallable @@ -208,6 +232,10 @@ public class GrpcParticipantsStub extends ParticipantsStub { listSuggestionsPagedCallable; private final UnaryCallable compileSuggestionCallable; + private final UnaryCallable listLocationsCallable; + private final UnaryCallable + listLocationsPagedCallable; + private final UnaryCallable getLocationCallable; private final BackgroundResource backgroundResources; private final GrpcOperationsStub operationsStub; @@ -365,6 +393,26 @@ protected GrpcParticipantsStub( return params.build(); }) .build(); + GrpcCallSettings listLocationsTransportSettings = + GrpcCallSettings.newBuilder() + .setMethodDescriptor(listLocationsMethodDescriptor) + .setParamsExtractor( + request -> { + ImmutableMap.Builder params = ImmutableMap.builder(); + params.put("name", String.valueOf(request.getName())); + return params.build(); + }) + .build(); + GrpcCallSettings getLocationTransportSettings = + GrpcCallSettings.newBuilder() + .setMethodDescriptor(getLocationMethodDescriptor) + .setParamsExtractor( + request -> { + ImmutableMap.Builder params = ImmutableMap.builder(); + params.put("name", String.valueOf(request.getName())); + return params.build(); + }) + .build(); this.createParticipantCallable = callableFactory.createUnaryCallable( @@ -417,6 +465,15 @@ protected GrpcParticipantsStub( compileSuggestionTransportSettings, settings.compileSuggestionSettings(), clientContext); + this.listLocationsCallable = + callableFactory.createUnaryCallable( + listLocationsTransportSettings, settings.listLocationsSettings(), clientContext); + this.listLocationsPagedCallable = + callableFactory.createPagedCallable( + listLocationsTransportSettings, settings.listLocationsSettings(), clientContext); + this.getLocationCallable = + callableFactory.createUnaryCallable( + getLocationTransportSettings, settings.getLocationSettings(), clientContext); this.backgroundResources = new BackgroundResourceAggregation(clientContext.getBackgroundResources()); @@ -498,6 +555,22 @@ public UnaryCallable listSugges return compileSuggestionCallable; } + @Override + public UnaryCallable listLocationsCallable() { + return listLocationsCallable; + } + + @Override + public UnaryCallable + listLocationsPagedCallable() { + return listLocationsPagedCallable; + } + + @Override + public UnaryCallable getLocationCallable() { + return getLocationCallable; + } + @Override public final void close() { try { diff --git a/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2beta1/stub/GrpcSessionEntityTypesStub.java b/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2beta1/stub/GrpcSessionEntityTypesStub.java index 3d3e5871f..2490531e6 100644 --- a/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2beta1/stub/GrpcSessionEntityTypesStub.java +++ b/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2beta1/stub/GrpcSessionEntityTypesStub.java @@ -16,6 +16,7 @@ package com.google.cloud.dialogflow.v2beta1.stub; +import static com.google.cloud.dialogflow.v2beta1.SessionEntityTypesClient.ListLocationsPagedResponse; import static com.google.cloud.dialogflow.v2beta1.SessionEntityTypesClient.ListSessionEntityTypesPagedResponse; import com.google.api.core.BetaApi; @@ -32,6 +33,10 @@ import com.google.cloud.dialogflow.v2beta1.ListSessionEntityTypesResponse; import com.google.cloud.dialogflow.v2beta1.SessionEntityType; import com.google.cloud.dialogflow.v2beta1.UpdateSessionEntityTypeRequest; +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.ListLocationsResponse; +import com.google.cloud.location.Location; import com.google.common.collect.ImmutableMap; import com.google.longrunning.stub.GrpcOperationsStub; import com.google.protobuf.Empty; @@ -108,6 +113,25 @@ public class GrpcSessionEntityTypesStub extends SessionEntityTypesStub { .setResponseMarshaller(ProtoUtils.marshaller(Empty.getDefaultInstance())) .build(); + private static final MethodDescriptor + listLocationsMethodDescriptor = + MethodDescriptor.newBuilder() + .setType(MethodDescriptor.MethodType.UNARY) + .setFullMethodName("google.cloud.location.Locations/ListLocations") + .setRequestMarshaller( + ProtoUtils.marshaller(ListLocationsRequest.getDefaultInstance())) + .setResponseMarshaller( + ProtoUtils.marshaller(ListLocationsResponse.getDefaultInstance())) + .build(); + + private static final MethodDescriptor getLocationMethodDescriptor = + MethodDescriptor.newBuilder() + .setType(MethodDescriptor.MethodType.UNARY) + .setFullMethodName("google.cloud.location.Locations/GetLocation") + .setRequestMarshaller(ProtoUtils.marshaller(GetLocationRequest.getDefaultInstance())) + .setResponseMarshaller(ProtoUtils.marshaller(Location.getDefaultInstance())) + .build(); + private final UnaryCallable listSessionEntityTypesCallable; private final UnaryCallable @@ -120,6 +144,10 @@ public class GrpcSessionEntityTypesStub extends SessionEntityTypesStub { updateSessionEntityTypeCallable; private final UnaryCallable deleteSessionEntityTypeCallable; + private final UnaryCallable listLocationsCallable; + private final UnaryCallable + listLocationsPagedCallable; + private final UnaryCallable getLocationCallable; private final BackgroundResource backgroundResources; private final GrpcOperationsStub operationsStub; @@ -223,6 +251,26 @@ protected GrpcSessionEntityTypesStub( return params.build(); }) .build(); + GrpcCallSettings listLocationsTransportSettings = + GrpcCallSettings.newBuilder() + .setMethodDescriptor(listLocationsMethodDescriptor) + .setParamsExtractor( + request -> { + ImmutableMap.Builder params = ImmutableMap.builder(); + params.put("name", String.valueOf(request.getName())); + return params.build(); + }) + .build(); + GrpcCallSettings getLocationTransportSettings = + GrpcCallSettings.newBuilder() + .setMethodDescriptor(getLocationMethodDescriptor) + .setParamsExtractor( + request -> { + ImmutableMap.Builder params = ImmutableMap.builder(); + params.put("name", String.valueOf(request.getName())); + return params.build(); + }) + .build(); this.listSessionEntityTypesCallable = callableFactory.createUnaryCallable( @@ -254,6 +302,15 @@ protected GrpcSessionEntityTypesStub( deleteSessionEntityTypeTransportSettings, settings.deleteSessionEntityTypeSettings(), clientContext); + this.listLocationsCallable = + callableFactory.createUnaryCallable( + listLocationsTransportSettings, settings.listLocationsSettings(), clientContext); + this.listLocationsPagedCallable = + callableFactory.createPagedCallable( + listLocationsTransportSettings, settings.listLocationsSettings(), clientContext); + this.getLocationCallable = + callableFactory.createUnaryCallable( + getLocationTransportSettings, settings.getLocationSettings(), clientContext); this.backgroundResources = new BackgroundResourceAggregation(clientContext.getBackgroundResources()); @@ -298,6 +355,22 @@ public UnaryCallable deleteSessionEntityT return deleteSessionEntityTypeCallable; } + @Override + public UnaryCallable listLocationsCallable() { + return listLocationsCallable; + } + + @Override + public UnaryCallable + listLocationsPagedCallable() { + return listLocationsPagedCallable; + } + + @Override + public UnaryCallable getLocationCallable() { + return getLocationCallable; + } + @Override public final void close() { try { diff --git a/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2beta1/stub/GrpcSessionsStub.java b/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2beta1/stub/GrpcSessionsStub.java index 40fae0aca..06993c894 100644 --- a/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2beta1/stub/GrpcSessionsStub.java +++ b/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2beta1/stub/GrpcSessionsStub.java @@ -16,6 +16,8 @@ package com.google.cloud.dialogflow.v2beta1.stub; +import static com.google.cloud.dialogflow.v2beta1.SessionsClient.ListLocationsPagedResponse; + import com.google.api.core.BetaApi; import com.google.api.gax.core.BackgroundResource; import com.google.api.gax.core.BackgroundResourceAggregation; @@ -28,6 +30,10 @@ import com.google.cloud.dialogflow.v2beta1.DetectIntentResponse; import com.google.cloud.dialogflow.v2beta1.StreamingDetectIntentRequest; import com.google.cloud.dialogflow.v2beta1.StreamingDetectIntentResponse; +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.ListLocationsResponse; +import com.google.cloud.location.Location; import com.google.common.collect.ImmutableMap; import com.google.longrunning.stub.GrpcOperationsStub; import io.grpc.MethodDescriptor; @@ -66,9 +72,32 @@ public class GrpcSessionsStub extends SessionsStub { ProtoUtils.marshaller(StreamingDetectIntentResponse.getDefaultInstance())) .build(); + private static final MethodDescriptor + listLocationsMethodDescriptor = + MethodDescriptor.newBuilder() + .setType(MethodDescriptor.MethodType.UNARY) + .setFullMethodName("google.cloud.location.Locations/ListLocations") + .setRequestMarshaller( + ProtoUtils.marshaller(ListLocationsRequest.getDefaultInstance())) + .setResponseMarshaller( + ProtoUtils.marshaller(ListLocationsResponse.getDefaultInstance())) + .build(); + + private static final MethodDescriptor getLocationMethodDescriptor = + MethodDescriptor.newBuilder() + .setType(MethodDescriptor.MethodType.UNARY) + .setFullMethodName("google.cloud.location.Locations/GetLocation") + .setRequestMarshaller(ProtoUtils.marshaller(GetLocationRequest.getDefaultInstance())) + .setResponseMarshaller(ProtoUtils.marshaller(Location.getDefaultInstance())) + .build(); + private final UnaryCallable detectIntentCallable; private final BidiStreamingCallable streamingDetectIntentCallable; + private final UnaryCallable listLocationsCallable; + private final UnaryCallable + listLocationsPagedCallable; + private final UnaryCallable getLocationCallable; private final BackgroundResource backgroundResources; private final GrpcOperationsStub operationsStub; @@ -125,6 +154,26 @@ protected GrpcSessionsStub( .newBuilder() .setMethodDescriptor(streamingDetectIntentMethodDescriptor) .build(); + GrpcCallSettings listLocationsTransportSettings = + GrpcCallSettings.newBuilder() + .setMethodDescriptor(listLocationsMethodDescriptor) + .setParamsExtractor( + request -> { + ImmutableMap.Builder params = ImmutableMap.builder(); + params.put("name", String.valueOf(request.getName())); + return params.build(); + }) + .build(); + GrpcCallSettings getLocationTransportSettings = + GrpcCallSettings.newBuilder() + .setMethodDescriptor(getLocationMethodDescriptor) + .setParamsExtractor( + request -> { + ImmutableMap.Builder params = ImmutableMap.builder(); + params.put("name", String.valueOf(request.getName())); + return params.build(); + }) + .build(); this.detectIntentCallable = callableFactory.createUnaryCallable( @@ -134,6 +183,15 @@ protected GrpcSessionsStub( streamingDetectIntentTransportSettings, settings.streamingDetectIntentSettings(), clientContext); + this.listLocationsCallable = + callableFactory.createUnaryCallable( + listLocationsTransportSettings, settings.listLocationsSettings(), clientContext); + this.listLocationsPagedCallable = + callableFactory.createPagedCallable( + listLocationsTransportSettings, settings.listLocationsSettings(), clientContext); + this.getLocationCallable = + callableFactory.createUnaryCallable( + getLocationTransportSettings, settings.getLocationSettings(), clientContext); this.backgroundResources = new BackgroundResourceAggregation(clientContext.getBackgroundResources()); @@ -154,6 +212,22 @@ public UnaryCallable detectIntentCall return streamingDetectIntentCallable; } + @Override + public UnaryCallable listLocationsCallable() { + return listLocationsCallable; + } + + @Override + public UnaryCallable + listLocationsPagedCallable() { + return listLocationsPagedCallable; + } + + @Override + public UnaryCallable getLocationCallable() { + return getLocationCallable; + } + @Override public final void close() { try { diff --git a/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2beta1/stub/GrpcVersionsStub.java b/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2beta1/stub/GrpcVersionsStub.java index b60708577..4f181fdee 100644 --- a/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2beta1/stub/GrpcVersionsStub.java +++ b/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2beta1/stub/GrpcVersionsStub.java @@ -16,6 +16,7 @@ package com.google.cloud.dialogflow.v2beta1.stub; +import static com.google.cloud.dialogflow.v2beta1.VersionsClient.ListLocationsPagedResponse; import static com.google.cloud.dialogflow.v2beta1.VersionsClient.ListVersionsPagedResponse; import com.google.api.core.BetaApi; @@ -32,6 +33,10 @@ import com.google.cloud.dialogflow.v2beta1.ListVersionsResponse; import com.google.cloud.dialogflow.v2beta1.UpdateVersionRequest; import com.google.cloud.dialogflow.v2beta1.Version; +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.ListLocationsResponse; +import com.google.cloud.location.Location; import com.google.common.collect.ImmutableMap; import com.google.longrunning.stub.GrpcOperationsStub; import com.google.protobuf.Empty; @@ -96,6 +101,25 @@ public class GrpcVersionsStub extends VersionsStub { .setResponseMarshaller(ProtoUtils.marshaller(Empty.getDefaultInstance())) .build(); + private static final MethodDescriptor + listLocationsMethodDescriptor = + MethodDescriptor.newBuilder() + .setType(MethodDescriptor.MethodType.UNARY) + .setFullMethodName("google.cloud.location.Locations/ListLocations") + .setRequestMarshaller( + ProtoUtils.marshaller(ListLocationsRequest.getDefaultInstance())) + .setResponseMarshaller( + ProtoUtils.marshaller(ListLocationsResponse.getDefaultInstance())) + .build(); + + private static final MethodDescriptor getLocationMethodDescriptor = + MethodDescriptor.newBuilder() + .setType(MethodDescriptor.MethodType.UNARY) + .setFullMethodName("google.cloud.location.Locations/GetLocation") + .setRequestMarshaller(ProtoUtils.marshaller(GetLocationRequest.getDefaultInstance())) + .setResponseMarshaller(ProtoUtils.marshaller(Location.getDefaultInstance())) + .build(); + private final UnaryCallable listVersionsCallable; private final UnaryCallable listVersionsPagedCallable; @@ -103,6 +127,10 @@ public class GrpcVersionsStub extends VersionsStub { private final UnaryCallable createVersionCallable; private final UnaryCallable updateVersionCallable; private final UnaryCallable deleteVersionCallable; + private final UnaryCallable listLocationsCallable; + private final UnaryCallable + listLocationsPagedCallable; + private final UnaryCallable getLocationCallable; private final BackgroundResource backgroundResources; private final GrpcOperationsStub operationsStub; @@ -193,6 +221,26 @@ protected GrpcVersionsStub( return params.build(); }) .build(); + GrpcCallSettings listLocationsTransportSettings = + GrpcCallSettings.newBuilder() + .setMethodDescriptor(listLocationsMethodDescriptor) + .setParamsExtractor( + request -> { + ImmutableMap.Builder params = ImmutableMap.builder(); + params.put("name", String.valueOf(request.getName())); + return params.build(); + }) + .build(); + GrpcCallSettings getLocationTransportSettings = + GrpcCallSettings.newBuilder() + .setMethodDescriptor(getLocationMethodDescriptor) + .setParamsExtractor( + request -> { + ImmutableMap.Builder params = ImmutableMap.builder(); + params.put("name", String.valueOf(request.getName())); + return params.build(); + }) + .build(); this.listVersionsCallable = callableFactory.createUnaryCallable( @@ -212,6 +260,15 @@ protected GrpcVersionsStub( this.deleteVersionCallable = callableFactory.createUnaryCallable( deleteVersionTransportSettings, settings.deleteVersionSettings(), clientContext); + this.listLocationsCallable = + callableFactory.createUnaryCallable( + listLocationsTransportSettings, settings.listLocationsSettings(), clientContext); + this.listLocationsPagedCallable = + callableFactory.createPagedCallable( + listLocationsTransportSettings, settings.listLocationsSettings(), clientContext); + this.getLocationCallable = + callableFactory.createUnaryCallable( + getLocationTransportSettings, settings.getLocationSettings(), clientContext); this.backgroundResources = new BackgroundResourceAggregation(clientContext.getBackgroundResources()); @@ -251,6 +308,22 @@ public UnaryCallable deleteVersionCallable() { return deleteVersionCallable; } + @Override + public UnaryCallable listLocationsCallable() { + return listLocationsCallable; + } + + @Override + public UnaryCallable + listLocationsPagedCallable() { + return listLocationsPagedCallable; + } + + @Override + public UnaryCallable getLocationCallable() { + return getLocationCallable; + } + @Override public final void close() { try { diff --git a/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2beta1/stub/HttpJsonAgentsStub.java b/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2beta1/stub/HttpJsonAgentsStub.java index 3b1fdeb14..13e6ddb3f 100644 --- a/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2beta1/stub/HttpJsonAgentsStub.java +++ b/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2beta1/stub/HttpJsonAgentsStub.java @@ -16,6 +16,7 @@ package com.google.cloud.dialogflow.v2beta1.stub; +import static com.google.cloud.dialogflow.v2beta1.AgentsClient.ListLocationsPagedResponse; import static com.google.cloud.dialogflow.v2beta1.AgentsClient.SearchAgentsPagedResponse; import com.google.api.core.BetaApi; @@ -46,6 +47,10 @@ import com.google.cloud.dialogflow.v2beta1.SetAgentRequest; import com.google.cloud.dialogflow.v2beta1.TrainAgentRequest; import com.google.cloud.dialogflow.v2beta1.ValidationResult; +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.ListLocationsResponse; +import com.google.cloud.location.Location; import com.google.longrunning.Operation; import com.google.protobuf.Empty; import com.google.protobuf.Struct; @@ -409,6 +414,72 @@ public class HttpJsonAgentsStub extends AgentsStub { .build()) .build(); + private static final ApiMethodDescriptor + listLocationsMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("google.cloud.location.Locations/ListLocations") + .setHttpMethod("GET") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v2beta1/{name=projects/*}/locations", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam(fields, "name", request.getName()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + return fields; + }) + .setRequestBodyExtractor(request -> null) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(ListLocationsResponse.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private static final ApiMethodDescriptor + getLocationMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("google.cloud.location.Locations/GetLocation") + .setHttpMethod("GET") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v2beta1/{name=projects/*/locations/*}", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam(fields, "name", request.getName()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + return fields; + }) + .setRequestBodyExtractor(request -> null) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(Location.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + private final UnaryCallable getAgentCallable; private final UnaryCallable setAgentCallable; private final UnaryCallable deleteAgentCallable; @@ -426,6 +497,10 @@ public class HttpJsonAgentsStub extends AgentsStub { private final OperationCallable restoreAgentOperationCallable; private final UnaryCallable getValidationResultCallable; + private final UnaryCallable listLocationsCallable; + private final UnaryCallable + listLocationsPagedCallable; + private final UnaryCallable getLocationCallable; private final BackgroundResource backgroundResources; private final HttpJsonOperationsStub httpJsonOperationsStub; @@ -515,6 +590,17 @@ protected HttpJsonAgentsStub( .setMethodDescriptor(getValidationResultMethodDescriptor) .setTypeRegistry(typeRegistry) .build(); + HttpJsonCallSettings + listLocationsTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(listLocationsMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings getLocationTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(getLocationMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); this.getAgentCallable = callableFactory.createUnaryCallable( @@ -572,6 +658,15 @@ protected HttpJsonAgentsStub( getValidationResultTransportSettings, settings.getValidationResultSettings(), clientContext); + this.listLocationsCallable = + callableFactory.createUnaryCallable( + listLocationsTransportSettings, settings.listLocationsSettings(), clientContext); + this.listLocationsPagedCallable = + callableFactory.createPagedCallable( + listLocationsTransportSettings, settings.listLocationsSettings(), clientContext); + this.getLocationCallable = + callableFactory.createUnaryCallable( + getLocationTransportSettings, settings.getLocationSettings(), clientContext); this.backgroundResources = new BackgroundResourceAggregation(clientContext.getBackgroundResources()); @@ -589,6 +684,8 @@ public static List getMethodDescriptors() { methodDescriptors.add(importAgentMethodDescriptor); methodDescriptors.add(restoreAgentMethodDescriptor); methodDescriptors.add(getValidationResultMethodDescriptor); + methodDescriptors.add(listLocationsMethodDescriptor); + methodDescriptors.add(getLocationMethodDescriptor); return methodDescriptors; } @@ -667,6 +764,22 @@ public UnaryCallable getValidation return getValidationResultCallable; } + @Override + public UnaryCallable listLocationsCallable() { + return listLocationsCallable; + } + + @Override + public UnaryCallable + listLocationsPagedCallable() { + return listLocationsPagedCallable; + } + + @Override + public UnaryCallable getLocationCallable() { + return getLocationCallable; + } + @Override public final void close() { try { diff --git a/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2beta1/stub/HttpJsonAnswerRecordsStub.java b/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2beta1/stub/HttpJsonAnswerRecordsStub.java index 87e09a49f..22c39c789 100644 --- a/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2beta1/stub/HttpJsonAnswerRecordsStub.java +++ b/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2beta1/stub/HttpJsonAnswerRecordsStub.java @@ -17,6 +17,7 @@ package com.google.cloud.dialogflow.v2beta1.stub; import static com.google.cloud.dialogflow.v2beta1.AnswerRecordsClient.ListAnswerRecordsPagedResponse; +import static com.google.cloud.dialogflow.v2beta1.AnswerRecordsClient.ListLocationsPagedResponse; import com.google.api.core.BetaApi; import com.google.api.core.InternalApi; @@ -35,6 +36,10 @@ import com.google.cloud.dialogflow.v2beta1.ListAnswerRecordsRequest; import com.google.cloud.dialogflow.v2beta1.ListAnswerRecordsResponse; import com.google.cloud.dialogflow.v2beta1.UpdateAnswerRecordRequest; +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.ListLocationsResponse; +import com.google.cloud.location.Location; import com.google.protobuf.TypeRegistry; import java.io.IOException; import java.util.ArrayList; @@ -112,6 +117,7 @@ public class HttpJsonAnswerRecordsStub extends AnswerRecordsStub { Map> fields = new HashMap<>(); ProtoRestSerializer serializer = ProtoRestSerializer.create(); + serializer.putQueryParam(fields, "filter", request.getFilter()); serializer.putQueryParam(fields, "pageSize", request.getPageSize()); serializer.putQueryParam(fields, "pageToken", request.getPageToken()); return fields; @@ -165,12 +171,82 @@ public class HttpJsonAnswerRecordsStub extends AnswerRecordsStub { .build()) .build(); + private static final ApiMethodDescriptor + listLocationsMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("google.cloud.location.Locations/ListLocations") + .setHttpMethod("GET") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v2beta1/{name=projects/*}/locations", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam(fields, "name", request.getName()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + return fields; + }) + .setRequestBodyExtractor(request -> null) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(ListLocationsResponse.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private static final ApiMethodDescriptor + getLocationMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("google.cloud.location.Locations/GetLocation") + .setHttpMethod("GET") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v2beta1/{name=projects/*/locations/*}", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam(fields, "name", request.getName()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + return fields; + }) + .setRequestBodyExtractor(request -> null) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(Location.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + private final UnaryCallable getAnswerRecordCallable; private final UnaryCallable listAnswerRecordsCallable; private final UnaryCallable listAnswerRecordsPagedCallable; private final UnaryCallable updateAnswerRecordCallable; + private final UnaryCallable listLocationsCallable; + private final UnaryCallable + listLocationsPagedCallable; + private final UnaryCallable getLocationCallable; private final BackgroundResource backgroundResources; private final HttpJsonStubCallableFactory callableFactory; @@ -231,6 +307,17 @@ protected HttpJsonAnswerRecordsStub( .setMethodDescriptor(updateAnswerRecordMethodDescriptor) .setTypeRegistry(typeRegistry) .build(); + HttpJsonCallSettings + listLocationsTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(listLocationsMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings getLocationTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(getLocationMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); this.getAnswerRecordCallable = callableFactory.createUnaryCallable( @@ -250,6 +337,15 @@ protected HttpJsonAnswerRecordsStub( updateAnswerRecordTransportSettings, settings.updateAnswerRecordSettings(), clientContext); + this.listLocationsCallable = + callableFactory.createUnaryCallable( + listLocationsTransportSettings, settings.listLocationsSettings(), clientContext); + this.listLocationsPagedCallable = + callableFactory.createPagedCallable( + listLocationsTransportSettings, settings.listLocationsSettings(), clientContext); + this.getLocationCallable = + callableFactory.createUnaryCallable( + getLocationTransportSettings, settings.getLocationSettings(), clientContext); this.backgroundResources = new BackgroundResourceAggregation(clientContext.getBackgroundResources()); @@ -261,6 +357,8 @@ public static List getMethodDescriptors() { methodDescriptors.add(getAnswerRecordMethodDescriptor); methodDescriptors.add(listAnswerRecordsMethodDescriptor); methodDescriptors.add(updateAnswerRecordMethodDescriptor); + methodDescriptors.add(listLocationsMethodDescriptor); + methodDescriptors.add(getLocationMethodDescriptor); return methodDescriptors; } @@ -286,6 +384,22 @@ public UnaryCallable updateAnswerRecord return updateAnswerRecordCallable; } + @Override + public UnaryCallable listLocationsCallable() { + return listLocationsCallable; + } + + @Override + public UnaryCallable + listLocationsPagedCallable() { + return listLocationsPagedCallable; + } + + @Override + public UnaryCallable getLocationCallable() { + return getLocationCallable; + } + @Override public final void close() { try { diff --git a/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2beta1/stub/HttpJsonContextsStub.java b/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2beta1/stub/HttpJsonContextsStub.java index 761106f58..63b43db9d 100644 --- a/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2beta1/stub/HttpJsonContextsStub.java +++ b/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2beta1/stub/HttpJsonContextsStub.java @@ -17,6 +17,7 @@ package com.google.cloud.dialogflow.v2beta1.stub; import static com.google.cloud.dialogflow.v2beta1.ContextsClient.ListContextsPagedResponse; +import static com.google.cloud.dialogflow.v2beta1.ContextsClient.ListLocationsPagedResponse; import com.google.api.core.BetaApi; import com.google.api.core.InternalApi; @@ -38,6 +39,10 @@ import com.google.cloud.dialogflow.v2beta1.ListContextsRequest; import com.google.cloud.dialogflow.v2beta1.ListContextsResponse; import com.google.cloud.dialogflow.v2beta1.UpdateContextRequest; +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.ListLocationsResponse; +import com.google.cloud.location.Location; import com.google.protobuf.Empty; import com.google.protobuf.TypeRegistry; import java.io.IOException; @@ -288,6 +293,72 @@ public class HttpJsonContextsStub extends ContextsStub { .build()) .build(); + private static final ApiMethodDescriptor + listLocationsMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("google.cloud.location.Locations/ListLocations") + .setHttpMethod("GET") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v2beta1/{name=projects/*}/locations", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam(fields, "name", request.getName()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + return fields; + }) + .setRequestBodyExtractor(request -> null) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(ListLocationsResponse.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private static final ApiMethodDescriptor + getLocationMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("google.cloud.location.Locations/GetLocation") + .setHttpMethod("GET") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v2beta1/{name=projects/*/locations/*}", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam(fields, "name", request.getName()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + return fields; + }) + .setRequestBodyExtractor(request -> null) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(Location.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + private final UnaryCallable listContextsCallable; private final UnaryCallable listContextsPagedCallable; @@ -296,6 +367,10 @@ public class HttpJsonContextsStub extends ContextsStub { private final UnaryCallable updateContextCallable; private final UnaryCallable deleteContextCallable; private final UnaryCallable deleteAllContextsCallable; + private final UnaryCallable listLocationsCallable; + private final UnaryCallable + listLocationsPagedCallable; + private final UnaryCallable getLocationCallable; private final BackgroundResource backgroundResources; private final HttpJsonStubCallableFactory callableFactory; @@ -368,6 +443,17 @@ protected HttpJsonContextsStub( .setMethodDescriptor(deleteAllContextsMethodDescriptor) .setTypeRegistry(typeRegistry) .build(); + HttpJsonCallSettings + listLocationsTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(listLocationsMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings getLocationTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(getLocationMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); this.listContextsCallable = callableFactory.createUnaryCallable( @@ -392,6 +478,15 @@ protected HttpJsonContextsStub( deleteAllContextsTransportSettings, settings.deleteAllContextsSettings(), clientContext); + this.listLocationsCallable = + callableFactory.createUnaryCallable( + listLocationsTransportSettings, settings.listLocationsSettings(), clientContext); + this.listLocationsPagedCallable = + callableFactory.createPagedCallable( + listLocationsTransportSettings, settings.listLocationsSettings(), clientContext); + this.getLocationCallable = + callableFactory.createUnaryCallable( + getLocationTransportSettings, settings.getLocationSettings(), clientContext); this.backgroundResources = new BackgroundResourceAggregation(clientContext.getBackgroundResources()); @@ -406,6 +501,8 @@ public static List getMethodDescriptors() { methodDescriptors.add(updateContextMethodDescriptor); methodDescriptors.add(deleteContextMethodDescriptor); methodDescriptors.add(deleteAllContextsMethodDescriptor); + methodDescriptors.add(listLocationsMethodDescriptor); + methodDescriptors.add(getLocationMethodDescriptor); return methodDescriptors; } @@ -444,6 +541,22 @@ public UnaryCallable deleteAllContextsCallable( return deleteAllContextsCallable; } + @Override + public UnaryCallable listLocationsCallable() { + return listLocationsCallable; + } + + @Override + public UnaryCallable + listLocationsPagedCallable() { + return listLocationsPagedCallable; + } + + @Override + public UnaryCallable getLocationCallable() { + return getLocationCallable; + } + @Override public final void close() { try { diff --git a/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2beta1/stub/HttpJsonConversationProfilesStub.java b/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2beta1/stub/HttpJsonConversationProfilesStub.java index 11997f76c..dcb07c5f7 100644 --- a/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2beta1/stub/HttpJsonConversationProfilesStub.java +++ b/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2beta1/stub/HttpJsonConversationProfilesStub.java @@ -17,6 +17,7 @@ package com.google.cloud.dialogflow.v2beta1.stub; import static com.google.cloud.dialogflow.v2beta1.ConversationProfilesClient.ListConversationProfilesPagedResponse; +import static com.google.cloud.dialogflow.v2beta1.ConversationProfilesClient.ListLocationsPagedResponse; import com.google.api.core.BetaApi; import com.google.api.core.InternalApi; @@ -44,6 +45,10 @@ import com.google.cloud.dialogflow.v2beta1.SetSuggestionFeatureConfigOperationMetadata; import com.google.cloud.dialogflow.v2beta1.SetSuggestionFeatureConfigRequest; import com.google.cloud.dialogflow.v2beta1.UpdateConversationProfileRequest; +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.ListLocationsResponse; +import com.google.cloud.location.Location; import com.google.longrunning.Operation; import com.google.protobuf.Empty; import com.google.protobuf.TypeRegistry; @@ -353,6 +358,72 @@ public class HttpJsonConversationProfilesStub extends ConversationProfilesStub { HttpJsonOperationSnapshot.create(response)) .build(); + private static final ApiMethodDescriptor + listLocationsMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("google.cloud.location.Locations/ListLocations") + .setHttpMethod("GET") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v2beta1/{name=projects/*}/locations", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam(fields, "name", request.getName()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + return fields; + }) + .setRequestBodyExtractor(request -> null) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(ListLocationsResponse.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private static final ApiMethodDescriptor + getLocationMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("google.cloud.location.Locations/GetLocation") + .setHttpMethod("GET") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v2beta1/{name=projects/*/locations/*}", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam(fields, "name", request.getName()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + return fields; + }) + .setRequestBodyExtractor(request -> null) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(Location.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + private final UnaryCallable listConversationProfilesCallable; private final UnaryCallable< @@ -380,6 +451,10 @@ public class HttpJsonConversationProfilesStub extends ConversationProfilesStub { ConversationProfile, ClearSuggestionFeatureConfigOperationMetadata> clearSuggestionFeatureConfigOperationCallable; + private final UnaryCallable listLocationsCallable; + private final UnaryCallable + listLocationsPagedCallable; + private final UnaryCallable getLocationCallable; private final BackgroundResource backgroundResources; private final HttpJsonOperationsStub httpJsonOperationsStub; @@ -471,6 +546,17 @@ protected HttpJsonConversationProfilesStub( .setMethodDescriptor(clearSuggestionFeatureConfigMethodDescriptor) .setTypeRegistry(typeRegistry) .build(); + HttpJsonCallSettings + listLocationsTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(listLocationsMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings getLocationTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(getLocationMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); this.listConversationProfilesCallable = callableFactory.createUnaryCallable( @@ -524,6 +610,15 @@ protected HttpJsonConversationProfilesStub( settings.clearSuggestionFeatureConfigOperationSettings(), clientContext, httpJsonOperationsStub); + this.listLocationsCallable = + callableFactory.createUnaryCallable( + listLocationsTransportSettings, settings.listLocationsSettings(), clientContext); + this.listLocationsPagedCallable = + callableFactory.createPagedCallable( + listLocationsTransportSettings, settings.listLocationsSettings(), clientContext); + this.getLocationCallable = + callableFactory.createUnaryCallable( + getLocationTransportSettings, settings.getLocationSettings(), clientContext); this.backgroundResources = new BackgroundResourceAggregation(clientContext.getBackgroundResources()); @@ -539,6 +634,8 @@ public static List getMethodDescriptors() { methodDescriptors.add(deleteConversationProfileMethodDescriptor); methodDescriptors.add(setSuggestionFeatureConfigMethodDescriptor); methodDescriptors.add(clearSuggestionFeatureConfigMethodDescriptor); + methodDescriptors.add(listLocationsMethodDescriptor); + methodDescriptors.add(getLocationMethodDescriptor); return methodDescriptors; } @@ -612,6 +709,22 @@ public HttpJsonOperationsStub getHttpJsonOperationsStub() { return clearSuggestionFeatureConfigOperationCallable; } + @Override + public UnaryCallable listLocationsCallable() { + return listLocationsCallable; + } + + @Override + public UnaryCallable + listLocationsPagedCallable() { + return listLocationsPagedCallable; + } + + @Override + public UnaryCallable getLocationCallable() { + return getLocationCallable; + } + @Override public final void close() { try { diff --git a/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2beta1/stub/HttpJsonConversationsStub.java b/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2beta1/stub/HttpJsonConversationsStub.java index 5cdc4a6f8..2ccd2e697 100644 --- a/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2beta1/stub/HttpJsonConversationsStub.java +++ b/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2beta1/stub/HttpJsonConversationsStub.java @@ -17,6 +17,7 @@ package com.google.cloud.dialogflow.v2beta1.stub; import static com.google.cloud.dialogflow.v2beta1.ConversationsClient.ListConversationsPagedResponse; +import static com.google.cloud.dialogflow.v2beta1.ConversationsClient.ListLocationsPagedResponse; import static com.google.cloud.dialogflow.v2beta1.ConversationsClient.ListMessagesPagedResponse; import com.google.api.core.BetaApi; @@ -41,6 +42,10 @@ import com.google.cloud.dialogflow.v2beta1.ListConversationsResponse; import com.google.cloud.dialogflow.v2beta1.ListMessagesRequest; import com.google.cloud.dialogflow.v2beta1.ListMessagesResponse; +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.ListLocationsResponse; +import com.google.cloud.location.Location; import com.google.protobuf.TypeRegistry; import java.io.IOException; import java.util.ArrayList; @@ -287,6 +292,72 @@ public class HttpJsonConversationsStub extends ConversationsStub { .build()) .build(); + private static final ApiMethodDescriptor + listLocationsMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("google.cloud.location.Locations/ListLocations") + .setHttpMethod("GET") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v2beta1/{name=projects/*}/locations", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam(fields, "name", request.getName()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + return fields; + }) + .setRequestBodyExtractor(request -> null) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(ListLocationsResponse.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private static final ApiMethodDescriptor + getLocationMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("google.cloud.location.Locations/GetLocation") + .setHttpMethod("GET") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v2beta1/{name=projects/*/locations/*}", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam(fields, "name", request.getName()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + return fields; + }) + .setRequestBodyExtractor(request -> null) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(Location.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + private final UnaryCallable createConversationCallable; private final UnaryCallable listConversationsCallable; @@ -300,6 +371,10 @@ public class HttpJsonConversationsStub extends ConversationsStub { private final UnaryCallable listMessagesCallable; private final UnaryCallable listMessagesPagedCallable; + private final UnaryCallable listLocationsCallable; + private final UnaryCallable + listLocationsPagedCallable; + private final UnaryCallable getLocationCallable; private final BackgroundResource backgroundResources; private final HttpJsonStubCallableFactory callableFactory; @@ -378,6 +453,17 @@ protected HttpJsonConversationsStub( .setMethodDescriptor(listMessagesMethodDescriptor) .setTypeRegistry(typeRegistry) .build(); + HttpJsonCallSettings + listLocationsTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(listLocationsMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings getLocationTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(getLocationMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); this.createConversationCallable = callableFactory.createUnaryCallable( @@ -413,6 +499,15 @@ protected HttpJsonConversationsStub( this.listMessagesPagedCallable = callableFactory.createPagedCallable( listMessagesTransportSettings, settings.listMessagesSettings(), clientContext); + this.listLocationsCallable = + callableFactory.createUnaryCallable( + listLocationsTransportSettings, settings.listLocationsSettings(), clientContext); + this.listLocationsPagedCallable = + callableFactory.createPagedCallable( + listLocationsTransportSettings, settings.listLocationsSettings(), clientContext); + this.getLocationCallable = + callableFactory.createUnaryCallable( + getLocationTransportSettings, settings.getLocationSettings(), clientContext); this.backgroundResources = new BackgroundResourceAggregation(clientContext.getBackgroundResources()); @@ -427,6 +522,8 @@ public static List getMethodDescriptors() { methodDescriptors.add(completeConversationMethodDescriptor); methodDescriptors.add(batchCreateMessagesMethodDescriptor); methodDescriptors.add(listMessagesMethodDescriptor); + methodDescriptors.add(listLocationsMethodDescriptor); + methodDescriptors.add(getLocationMethodDescriptor); return methodDescriptors; } @@ -473,6 +570,22 @@ public UnaryCallable listMessage return listMessagesPagedCallable; } + @Override + public UnaryCallable listLocationsCallable() { + return listLocationsCallable; + } + + @Override + public UnaryCallable + listLocationsPagedCallable() { + return listLocationsPagedCallable; + } + + @Override + public UnaryCallable getLocationCallable() { + return getLocationCallable; + } + @Override public final void close() { try { diff --git a/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2beta1/stub/HttpJsonDocumentsStub.java b/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2beta1/stub/HttpJsonDocumentsStub.java index c37427378..176426cfa 100644 --- a/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2beta1/stub/HttpJsonDocumentsStub.java +++ b/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2beta1/stub/HttpJsonDocumentsStub.java @@ -17,6 +17,7 @@ package com.google.cloud.dialogflow.v2beta1.stub; import static com.google.cloud.dialogflow.v2beta1.DocumentsClient.ListDocumentsPagedResponse; +import static com.google.cloud.dialogflow.v2beta1.DocumentsClient.ListLocationsPagedResponse; import com.google.api.core.BetaApi; import com.google.api.core.InternalApi; @@ -44,6 +45,10 @@ import com.google.cloud.dialogflow.v2beta1.ListDocumentsResponse; import com.google.cloud.dialogflow.v2beta1.ReloadDocumentRequest; import com.google.cloud.dialogflow.v2beta1.UpdateDocumentRequest; +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.ListLocationsResponse; +import com.google.cloud.location.Location; import com.google.longrunning.Operation; import com.google.protobuf.Empty; import com.google.protobuf.TypeRegistry; @@ -359,6 +364,72 @@ public class HttpJsonDocumentsStub extends DocumentsStub { HttpJsonOperationSnapshot.create(response)) .build(); + private static final ApiMethodDescriptor + listLocationsMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("google.cloud.location.Locations/ListLocations") + .setHttpMethod("GET") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v2beta1/{name=projects/*}/locations", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam(fields, "name", request.getName()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + return fields; + }) + .setRequestBodyExtractor(request -> null) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(ListLocationsResponse.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private static final ApiMethodDescriptor + getLocationMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("google.cloud.location.Locations/GetLocation") + .setHttpMethod("GET") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v2beta1/{name=projects/*/locations/*}", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam(fields, "name", request.getName()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + return fields; + }) + .setRequestBodyExtractor(request -> null) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(Location.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + private final UnaryCallable listDocumentsCallable; private final UnaryCallable listDocumentsPagedCallable; @@ -379,6 +450,10 @@ public class HttpJsonDocumentsStub extends DocumentsStub { private final UnaryCallable reloadDocumentCallable; private final OperationCallable reloadDocumentOperationCallable; + private final UnaryCallable listLocationsCallable; + private final UnaryCallable + listLocationsPagedCallable; + private final UnaryCallable getLocationCallable; private final BackgroundResource backgroundResources; private final HttpJsonOperationsStub httpJsonOperationsStub; @@ -460,6 +535,17 @@ protected HttpJsonDocumentsStub( .setMethodDescriptor(reloadDocumentMethodDescriptor) .setTypeRegistry(typeRegistry) .build(); + HttpJsonCallSettings + listLocationsTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(listLocationsMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings getLocationTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(getLocationMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); this.listDocumentsCallable = callableFactory.createUnaryCallable( @@ -515,6 +601,15 @@ protected HttpJsonDocumentsStub( settings.reloadDocumentOperationSettings(), clientContext, httpJsonOperationsStub); + this.listLocationsCallable = + callableFactory.createUnaryCallable( + listLocationsTransportSettings, settings.listLocationsSettings(), clientContext); + this.listLocationsPagedCallable = + callableFactory.createPagedCallable( + listLocationsTransportSettings, settings.listLocationsSettings(), clientContext); + this.getLocationCallable = + callableFactory.createUnaryCallable( + getLocationTransportSettings, settings.getLocationSettings(), clientContext); this.backgroundResources = new BackgroundResourceAggregation(clientContext.getBackgroundResources()); @@ -530,6 +625,8 @@ public static List getMethodDescriptors() { methodDescriptors.add(deleteDocumentMethodDescriptor); methodDescriptors.add(updateDocumentMethodDescriptor); methodDescriptors.add(reloadDocumentMethodDescriptor); + methodDescriptors.add(listLocationsMethodDescriptor); + methodDescriptors.add(getLocationMethodDescriptor); return methodDescriptors; } @@ -609,6 +706,22 @@ public UnaryCallable reloadDocumentCallable() return reloadDocumentOperationCallable; } + @Override + public UnaryCallable listLocationsCallable() { + return listLocationsCallable; + } + + @Override + public UnaryCallable + listLocationsPagedCallable() { + return listLocationsPagedCallable; + } + + @Override + public UnaryCallable getLocationCallable() { + return getLocationCallable; + } + @Override public final void close() { try { diff --git a/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2beta1/stub/HttpJsonEntityTypesStub.java b/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2beta1/stub/HttpJsonEntityTypesStub.java index 6c1b26592..6b99e56c9 100644 --- a/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2beta1/stub/HttpJsonEntityTypesStub.java +++ b/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2beta1/stub/HttpJsonEntityTypesStub.java @@ -17,6 +17,7 @@ package com.google.cloud.dialogflow.v2beta1.stub; import static com.google.cloud.dialogflow.v2beta1.EntityTypesClient.ListEntityTypesPagedResponse; +import static com.google.cloud.dialogflow.v2beta1.EntityTypesClient.ListLocationsPagedResponse; import com.google.api.core.BetaApi; import com.google.api.core.InternalApi; @@ -46,6 +47,10 @@ import com.google.cloud.dialogflow.v2beta1.ListEntityTypesRequest; import com.google.cloud.dialogflow.v2beta1.ListEntityTypesResponse; import com.google.cloud.dialogflow.v2beta1.UpdateEntityTypeRequest; +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.ListLocationsResponse; +import com.google.cloud.location.Location; import com.google.longrunning.Operation; import com.google.protobuf.Empty; import com.google.protobuf.Struct; @@ -474,6 +479,72 @@ public class HttpJsonEntityTypesStub extends EntityTypesStub { HttpJsonOperationSnapshot.create(response)) .build(); + private static final ApiMethodDescriptor + listLocationsMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("google.cloud.location.Locations/ListLocations") + .setHttpMethod("GET") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v2beta1/{name=projects/*}/locations", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam(fields, "name", request.getName()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + return fields; + }) + .setRequestBodyExtractor(request -> null) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(ListLocationsResponse.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private static final ApiMethodDescriptor + getLocationMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("google.cloud.location.Locations/GetLocation") + .setHttpMethod("GET") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v2beta1/{name=projects/*/locations/*}", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam(fields, "name", request.getName()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + return fields; + }) + .setRequestBodyExtractor(request -> null) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(Location.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + private final UnaryCallable listEntityTypesCallable; private final UnaryCallable @@ -500,6 +571,10 @@ public class HttpJsonEntityTypesStub extends EntityTypesStub { private final UnaryCallable batchDeleteEntitiesCallable; private final OperationCallable batchDeleteEntitiesOperationCallable; + private final UnaryCallable listLocationsCallable; + private final UnaryCallable + listLocationsPagedCallable; + private final UnaryCallable getLocationCallable; private final BackgroundResource backgroundResources; private final HttpJsonOperationsStub httpJsonOperationsStub; @@ -602,6 +677,17 @@ protected HttpJsonEntityTypesStub( .setMethodDescriptor(batchDeleteEntitiesMethodDescriptor) .setTypeRegistry(typeRegistry) .build(); + HttpJsonCallSettings + listLocationsTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(listLocationsMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings getLocationTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(getLocationMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); this.listEntityTypesCallable = callableFactory.createUnaryCallable( @@ -676,6 +762,15 @@ protected HttpJsonEntityTypesStub( settings.batchDeleteEntitiesOperationSettings(), clientContext, httpJsonOperationsStub); + this.listLocationsCallable = + callableFactory.createUnaryCallable( + listLocationsTransportSettings, settings.listLocationsSettings(), clientContext); + this.listLocationsPagedCallable = + callableFactory.createPagedCallable( + listLocationsTransportSettings, settings.listLocationsSettings(), clientContext); + this.getLocationCallable = + callableFactory.createUnaryCallable( + getLocationTransportSettings, settings.getLocationSettings(), clientContext); this.backgroundResources = new BackgroundResourceAggregation(clientContext.getBackgroundResources()); @@ -694,6 +789,8 @@ public static List getMethodDescriptors() { methodDescriptors.add(batchCreateEntitiesMethodDescriptor); methodDescriptors.add(batchUpdateEntitiesMethodDescriptor); methodDescriptors.add(batchDeleteEntitiesMethodDescriptor); + methodDescriptors.add(listLocationsMethodDescriptor); + methodDescriptors.add(getLocationMethodDescriptor); return methodDescriptors; } @@ -787,6 +884,22 @@ public UnaryCallable batchDeleteEntitiesC return batchDeleteEntitiesOperationCallable; } + @Override + public UnaryCallable listLocationsCallable() { + return listLocationsCallable; + } + + @Override + public UnaryCallable + listLocationsPagedCallable() { + return listLocationsPagedCallable; + } + + @Override + public UnaryCallable getLocationCallable() { + return getLocationCallable; + } + @Override public final void close() { try { diff --git a/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2beta1/stub/HttpJsonEnvironmentsStub.java b/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2beta1/stub/HttpJsonEnvironmentsStub.java index f5c0c3bec..c53c10bbe 100644 --- a/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2beta1/stub/HttpJsonEnvironmentsStub.java +++ b/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2beta1/stub/HttpJsonEnvironmentsStub.java @@ -18,6 +18,7 @@ import static com.google.cloud.dialogflow.v2beta1.EnvironmentsClient.GetEnvironmentHistoryPagedResponse; import static com.google.cloud.dialogflow.v2beta1.EnvironmentsClient.ListEnvironmentsPagedResponse; +import static com.google.cloud.dialogflow.v2beta1.EnvironmentsClient.ListLocationsPagedResponse; import com.google.api.core.BetaApi; import com.google.api.core.InternalApi; @@ -40,6 +41,10 @@ import com.google.cloud.dialogflow.v2beta1.ListEnvironmentsRequest; import com.google.cloud.dialogflow.v2beta1.ListEnvironmentsResponse; import com.google.cloud.dialogflow.v2beta1.UpdateEnvironmentRequest; +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.ListLocationsResponse; +import com.google.cloud.location.Location; import com.google.protobuf.Empty; import com.google.protobuf.TypeRegistry; import java.io.IOException; @@ -290,6 +295,72 @@ public class HttpJsonEnvironmentsStub extends EnvironmentsStub { .build()) .build(); + private static final ApiMethodDescriptor + listLocationsMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("google.cloud.location.Locations/ListLocations") + .setHttpMethod("GET") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v2beta1/{name=projects/*}/locations", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam(fields, "name", request.getName()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + return fields; + }) + .setRequestBodyExtractor(request -> null) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(ListLocationsResponse.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private static final ApiMethodDescriptor + getLocationMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("google.cloud.location.Locations/GetLocation") + .setHttpMethod("GET") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v2beta1/{name=projects/*/locations/*}", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam(fields, "name", request.getName()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + return fields; + }) + .setRequestBodyExtractor(request -> null) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(Location.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + private final UnaryCallable listEnvironmentsCallable; private final UnaryCallable @@ -302,6 +373,10 @@ public class HttpJsonEnvironmentsStub extends EnvironmentsStub { getEnvironmentHistoryCallable; private final UnaryCallable getEnvironmentHistoryPagedCallable; + private final UnaryCallable listLocationsCallable; + private final UnaryCallable + listLocationsPagedCallable; + private final UnaryCallable getLocationCallable; private final BackgroundResource backgroundResources; private final HttpJsonStubCallableFactory callableFactory; @@ -377,6 +452,17 @@ protected HttpJsonEnvironmentsStub( .setMethodDescriptor(getEnvironmentHistoryMethodDescriptor) .setTypeRegistry(typeRegistry) .build(); + HttpJsonCallSettings + listLocationsTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(listLocationsMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings getLocationTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(getLocationMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); this.listEnvironmentsCallable = callableFactory.createUnaryCallable( @@ -412,6 +498,15 @@ protected HttpJsonEnvironmentsStub( getEnvironmentHistoryTransportSettings, settings.getEnvironmentHistorySettings(), clientContext); + this.listLocationsCallable = + callableFactory.createUnaryCallable( + listLocationsTransportSettings, settings.listLocationsSettings(), clientContext); + this.listLocationsPagedCallable = + callableFactory.createPagedCallable( + listLocationsTransportSettings, settings.listLocationsSettings(), clientContext); + this.getLocationCallable = + callableFactory.createUnaryCallable( + getLocationTransportSettings, settings.getLocationSettings(), clientContext); this.backgroundResources = new BackgroundResourceAggregation(clientContext.getBackgroundResources()); @@ -426,6 +521,8 @@ public static List getMethodDescriptors() { methodDescriptors.add(updateEnvironmentMethodDescriptor); methodDescriptors.add(deleteEnvironmentMethodDescriptor); methodDescriptors.add(getEnvironmentHistoryMethodDescriptor); + methodDescriptors.add(listLocationsMethodDescriptor); + methodDescriptors.add(getLocationMethodDescriptor); return methodDescriptors; } @@ -473,6 +570,22 @@ public UnaryCallable deleteEnvironmentCallable( return getEnvironmentHistoryPagedCallable; } + @Override + public UnaryCallable listLocationsCallable() { + return listLocationsCallable; + } + + @Override + public UnaryCallable + listLocationsPagedCallable() { + return listLocationsPagedCallable; + } + + @Override + public UnaryCallable getLocationCallable() { + return getLocationCallable; + } + @Override public final void close() { try { diff --git a/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2beta1/stub/HttpJsonFulfillmentsStub.java b/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2beta1/stub/HttpJsonFulfillmentsStub.java index 900ce9684..750c919fa 100644 --- a/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2beta1/stub/HttpJsonFulfillmentsStub.java +++ b/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2beta1/stub/HttpJsonFulfillmentsStub.java @@ -16,6 +16,8 @@ package com.google.cloud.dialogflow.v2beta1.stub; +import static com.google.cloud.dialogflow.v2beta1.FulfillmentsClient.ListLocationsPagedResponse; + import com.google.api.core.BetaApi; import com.google.api.core.InternalApi; import com.google.api.gax.core.BackgroundResource; @@ -31,6 +33,10 @@ import com.google.cloud.dialogflow.v2beta1.Fulfillment; import com.google.cloud.dialogflow.v2beta1.GetFulfillmentRequest; import com.google.cloud.dialogflow.v2beta1.UpdateFulfillmentRequest; +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.ListLocationsResponse; +import com.google.cloud.location.Location; import com.google.protobuf.TypeRegistry; import java.io.IOException; import java.util.ArrayList; @@ -126,8 +132,78 @@ public class HttpJsonFulfillmentsStub extends FulfillmentsStub { .build()) .build(); + private static final ApiMethodDescriptor + listLocationsMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("google.cloud.location.Locations/ListLocations") + .setHttpMethod("GET") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v2beta1/{name=projects/*}/locations", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam(fields, "name", request.getName()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + return fields; + }) + .setRequestBodyExtractor(request -> null) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(ListLocationsResponse.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private static final ApiMethodDescriptor + getLocationMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("google.cloud.location.Locations/GetLocation") + .setHttpMethod("GET") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v2beta1/{name=projects/*/locations/*}", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam(fields, "name", request.getName()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + return fields; + }) + .setRequestBodyExtractor(request -> null) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(Location.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + private final UnaryCallable getFulfillmentCallable; private final UnaryCallable updateFulfillmentCallable; + private final UnaryCallable listLocationsCallable; + private final UnaryCallable + listLocationsPagedCallable; + private final UnaryCallable getLocationCallable; private final BackgroundResource backgroundResources; private final HttpJsonStubCallableFactory callableFactory; @@ -181,6 +257,17 @@ protected HttpJsonFulfillmentsStub( .setMethodDescriptor(updateFulfillmentMethodDescriptor) .setTypeRegistry(typeRegistry) .build(); + HttpJsonCallSettings + listLocationsTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(listLocationsMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings getLocationTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(getLocationMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); this.getFulfillmentCallable = callableFactory.createUnaryCallable( @@ -190,6 +277,15 @@ protected HttpJsonFulfillmentsStub( updateFulfillmentTransportSettings, settings.updateFulfillmentSettings(), clientContext); + this.listLocationsCallable = + callableFactory.createUnaryCallable( + listLocationsTransportSettings, settings.listLocationsSettings(), clientContext); + this.listLocationsPagedCallable = + callableFactory.createPagedCallable( + listLocationsTransportSettings, settings.listLocationsSettings(), clientContext); + this.getLocationCallable = + callableFactory.createUnaryCallable( + getLocationTransportSettings, settings.getLocationSettings(), clientContext); this.backgroundResources = new BackgroundResourceAggregation(clientContext.getBackgroundResources()); @@ -200,6 +296,8 @@ public static List getMethodDescriptors() { List methodDescriptors = new ArrayList<>(); methodDescriptors.add(getFulfillmentMethodDescriptor); methodDescriptors.add(updateFulfillmentMethodDescriptor); + methodDescriptors.add(listLocationsMethodDescriptor); + methodDescriptors.add(getLocationMethodDescriptor); return methodDescriptors; } @@ -213,6 +311,22 @@ public UnaryCallable updateFulfillmentCal return updateFulfillmentCallable; } + @Override + public UnaryCallable listLocationsCallable() { + return listLocationsCallable; + } + + @Override + public UnaryCallable + listLocationsPagedCallable() { + return listLocationsPagedCallable; + } + + @Override + public UnaryCallable getLocationCallable() { + return getLocationCallable; + } + @Override public final void close() { try { diff --git a/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2beta1/stub/HttpJsonIntentsStub.java b/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2beta1/stub/HttpJsonIntentsStub.java index 2f4b7ff14..78d2df7d2 100644 --- a/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2beta1/stub/HttpJsonIntentsStub.java +++ b/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2beta1/stub/HttpJsonIntentsStub.java @@ -17,6 +17,7 @@ package com.google.cloud.dialogflow.v2beta1.stub; import static com.google.cloud.dialogflow.v2beta1.IntentsClient.ListIntentsPagedResponse; +import static com.google.cloud.dialogflow.v2beta1.IntentsClient.ListLocationsPagedResponse; import com.google.api.core.BetaApi; import com.google.api.core.InternalApi; @@ -43,6 +44,10 @@ import com.google.cloud.dialogflow.v2beta1.ListIntentsRequest; import com.google.cloud.dialogflow.v2beta1.ListIntentsResponse; import com.google.cloud.dialogflow.v2beta1.UpdateIntentRequest; +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.ListLocationsResponse; +import com.google.cloud.location.Location; import com.google.longrunning.Operation; import com.google.protobuf.Empty; import com.google.protobuf.Struct; @@ -345,6 +350,72 @@ public class HttpJsonIntentsStub extends IntentsStub { HttpJsonOperationSnapshot.create(response)) .build(); + private static final ApiMethodDescriptor + listLocationsMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("google.cloud.location.Locations/ListLocations") + .setHttpMethod("GET") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v2beta1/{name=projects/*}/locations", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam(fields, "name", request.getName()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + return fields; + }) + .setRequestBodyExtractor(request -> null) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(ListLocationsResponse.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private static final ApiMethodDescriptor + getLocationMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("google.cloud.location.Locations/GetLocation") + .setHttpMethod("GET") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v2beta1/{name=projects/*/locations/*}", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam(fields, "name", request.getName()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + return fields; + }) + .setRequestBodyExtractor(request -> null) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(Location.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + private final UnaryCallable listIntentsCallable; private final UnaryCallable listIntentsPagedCallable; @@ -358,6 +429,10 @@ public class HttpJsonIntentsStub extends IntentsStub { private final UnaryCallable batchDeleteIntentsCallable; private final OperationCallable batchDeleteIntentsOperationCallable; + private final UnaryCallable listLocationsCallable; + private final UnaryCallable + listLocationsPagedCallable; + private final UnaryCallable getLocationCallable; private final BackgroundResource backgroundResources; private final HttpJsonOperationsStub httpJsonOperationsStub; @@ -436,6 +511,17 @@ protected HttpJsonIntentsStub( .setMethodDescriptor(batchDeleteIntentsMethodDescriptor) .setTypeRegistry(typeRegistry) .build(); + HttpJsonCallSettings + listLocationsTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(listLocationsMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings getLocationTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(getLocationMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); this.listIntentsCallable = callableFactory.createUnaryCallable( @@ -477,6 +563,15 @@ protected HttpJsonIntentsStub( settings.batchDeleteIntentsOperationSettings(), clientContext, httpJsonOperationsStub); + this.listLocationsCallable = + callableFactory.createUnaryCallable( + listLocationsTransportSettings, settings.listLocationsSettings(), clientContext); + this.listLocationsPagedCallable = + callableFactory.createPagedCallable( + listLocationsTransportSettings, settings.listLocationsSettings(), clientContext); + this.getLocationCallable = + callableFactory.createUnaryCallable( + getLocationTransportSettings, settings.getLocationSettings(), clientContext); this.backgroundResources = new BackgroundResourceAggregation(clientContext.getBackgroundResources()); @@ -492,6 +587,8 @@ public static List getMethodDescriptors() { methodDescriptors.add(deleteIntentMethodDescriptor); methodDescriptors.add(batchUpdateIntentsMethodDescriptor); methodDescriptors.add(batchDeleteIntentsMethodDescriptor); + methodDescriptors.add(listLocationsMethodDescriptor); + methodDescriptors.add(getLocationMethodDescriptor); return methodDescriptors; } @@ -551,6 +648,22 @@ public UnaryCallable batchDeleteIntentsCal return batchDeleteIntentsOperationCallable; } + @Override + public UnaryCallable listLocationsCallable() { + return listLocationsCallable; + } + + @Override + public UnaryCallable + listLocationsPagedCallable() { + return listLocationsPagedCallable; + } + + @Override + public UnaryCallable getLocationCallable() { + return getLocationCallable; + } + @Override public final void close() { try { diff --git a/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2beta1/stub/HttpJsonKnowledgeBasesStub.java b/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2beta1/stub/HttpJsonKnowledgeBasesStub.java index a6fa57342..da643372a 100644 --- a/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2beta1/stub/HttpJsonKnowledgeBasesStub.java +++ b/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2beta1/stub/HttpJsonKnowledgeBasesStub.java @@ -17,6 +17,7 @@ package com.google.cloud.dialogflow.v2beta1.stub; import static com.google.cloud.dialogflow.v2beta1.KnowledgeBasesClient.ListKnowledgeBasesPagedResponse; +import static com.google.cloud.dialogflow.v2beta1.KnowledgeBasesClient.ListLocationsPagedResponse; import com.google.api.core.BetaApi; import com.google.api.core.InternalApi; @@ -37,6 +38,10 @@ import com.google.cloud.dialogflow.v2beta1.ListKnowledgeBasesRequest; import com.google.cloud.dialogflow.v2beta1.ListKnowledgeBasesResponse; import com.google.cloud.dialogflow.v2beta1.UpdateKnowledgeBaseRequest; +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.ListLocationsResponse; +import com.google.cloud.location.Location; import com.google.protobuf.Empty; import com.google.protobuf.TypeRegistry; import java.io.IOException; @@ -254,6 +259,72 @@ public class HttpJsonKnowledgeBasesStub extends KnowledgeBasesStub { .build()) .build(); + private static final ApiMethodDescriptor + listLocationsMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("google.cloud.location.Locations/ListLocations") + .setHttpMethod("GET") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v2beta1/{name=projects/*}/locations", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam(fields, "name", request.getName()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + return fields; + }) + .setRequestBodyExtractor(request -> null) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(ListLocationsResponse.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private static final ApiMethodDescriptor + getLocationMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("google.cloud.location.Locations/GetLocation") + .setHttpMethod("GET") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v2beta1/{name=projects/*/locations/*}", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam(fields, "name", request.getName()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + return fields; + }) + .setRequestBodyExtractor(request -> null) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(Location.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + private final UnaryCallable listKnowledgeBasesCallable; private final UnaryCallable @@ -264,6 +335,10 @@ public class HttpJsonKnowledgeBasesStub extends KnowledgeBasesStub { private final UnaryCallable deleteKnowledgeBaseCallable; private final UnaryCallable updateKnowledgeBaseCallable; + private final UnaryCallable listLocationsCallable; + private final UnaryCallable + listLocationsPagedCallable; + private final UnaryCallable getLocationCallable; private final BackgroundResource backgroundResources; private final HttpJsonStubCallableFactory callableFactory; @@ -335,6 +410,17 @@ protected HttpJsonKnowledgeBasesStub( .setMethodDescriptor(updateKnowledgeBaseMethodDescriptor) .setTypeRegistry(typeRegistry) .build(); + HttpJsonCallSettings + listLocationsTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(listLocationsMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings getLocationTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(getLocationMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); this.listKnowledgeBasesCallable = callableFactory.createUnaryCallable( @@ -364,6 +450,15 @@ protected HttpJsonKnowledgeBasesStub( updateKnowledgeBaseTransportSettings, settings.updateKnowledgeBaseSettings(), clientContext); + this.listLocationsCallable = + callableFactory.createUnaryCallable( + listLocationsTransportSettings, settings.listLocationsSettings(), clientContext); + this.listLocationsPagedCallable = + callableFactory.createPagedCallable( + listLocationsTransportSettings, settings.listLocationsSettings(), clientContext); + this.getLocationCallable = + callableFactory.createUnaryCallable( + getLocationTransportSettings, settings.getLocationSettings(), clientContext); this.backgroundResources = new BackgroundResourceAggregation(clientContext.getBackgroundResources()); @@ -377,6 +472,8 @@ public static List getMethodDescriptors() { methodDescriptors.add(createKnowledgeBaseMethodDescriptor); methodDescriptors.add(deleteKnowledgeBaseMethodDescriptor); methodDescriptors.add(updateKnowledgeBaseMethodDescriptor); + methodDescriptors.add(listLocationsMethodDescriptor); + methodDescriptors.add(getLocationMethodDescriptor); return methodDescriptors; } @@ -412,6 +509,22 @@ public UnaryCallable updateKnowledgeB return updateKnowledgeBaseCallable; } + @Override + public UnaryCallable listLocationsCallable() { + return listLocationsCallable; + } + + @Override + public UnaryCallable + listLocationsPagedCallable() { + return listLocationsPagedCallable; + } + + @Override + public UnaryCallable getLocationCallable() { + return getLocationCallable; + } + @Override public final void close() { try { diff --git a/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2beta1/stub/HttpJsonParticipantsStub.java b/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2beta1/stub/HttpJsonParticipantsStub.java index 0135b3614..50e8860df 100644 --- a/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2beta1/stub/HttpJsonParticipantsStub.java +++ b/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2beta1/stub/HttpJsonParticipantsStub.java @@ -16,6 +16,7 @@ package com.google.cloud.dialogflow.v2beta1.stub; +import static com.google.cloud.dialogflow.v2beta1.ParticipantsClient.ListLocationsPagedResponse; import static com.google.cloud.dialogflow.v2beta1.ParticipantsClient.ListParticipantsPagedResponse; import static com.google.cloud.dialogflow.v2beta1.ParticipantsClient.ListSuggestionsPagedResponse; @@ -49,6 +50,10 @@ import com.google.cloud.dialogflow.v2beta1.SuggestSmartRepliesRequest; import com.google.cloud.dialogflow.v2beta1.SuggestSmartRepliesResponse; import com.google.cloud.dialogflow.v2beta1.UpdateParticipantRequest; +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.ListLocationsResponse; +import com.google.cloud.location.Location; import com.google.protobuf.TypeRegistry; import java.io.IOException; import java.util.ArrayList; @@ -444,6 +449,72 @@ public class HttpJsonParticipantsStub extends ParticipantsStub { .build()) .build(); + private static final ApiMethodDescriptor + listLocationsMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("google.cloud.location.Locations/ListLocations") + .setHttpMethod("GET") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v2beta1/{name=projects/*}/locations", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam(fields, "name", request.getName()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + return fields; + }) + .setRequestBodyExtractor(request -> null) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(ListLocationsResponse.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private static final ApiMethodDescriptor + getLocationMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("google.cloud.location.Locations/GetLocation") + .setHttpMethod("GET") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v2beta1/{name=projects/*/locations/*}", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam(fields, "name", request.getName()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + return fields; + }) + .setRequestBodyExtractor(request -> null) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(Location.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + private final UnaryCallable createParticipantCallable; private final UnaryCallable getParticipantCallable; private final UnaryCallable @@ -464,6 +535,10 @@ public class HttpJsonParticipantsStub extends ParticipantsStub { listSuggestionsPagedCallable; private final UnaryCallable compileSuggestionCallable; + private final UnaryCallable listLocationsCallable; + private final UnaryCallable + listLocationsPagedCallable; + private final UnaryCallable getLocationCallable; private final BackgroundResource backgroundResources; private final HttpJsonStubCallableFactory callableFactory; @@ -565,6 +640,17 @@ protected HttpJsonParticipantsStub( .setMethodDescriptor(compileSuggestionMethodDescriptor) .setTypeRegistry(typeRegistry) .build(); + HttpJsonCallSettings + listLocationsTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(listLocationsMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings getLocationTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(getLocationMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); this.createParticipantCallable = callableFactory.createUnaryCallable( @@ -612,6 +698,15 @@ protected HttpJsonParticipantsStub( compileSuggestionTransportSettings, settings.compileSuggestionSettings(), clientContext); + this.listLocationsCallable = + callableFactory.createUnaryCallable( + listLocationsTransportSettings, settings.listLocationsSettings(), clientContext); + this.listLocationsPagedCallable = + callableFactory.createPagedCallable( + listLocationsTransportSettings, settings.listLocationsSettings(), clientContext); + this.getLocationCallable = + callableFactory.createUnaryCallable( + getLocationTransportSettings, settings.getLocationSettings(), clientContext); this.backgroundResources = new BackgroundResourceAggregation(clientContext.getBackgroundResources()); @@ -630,6 +725,8 @@ public static List getMethodDescriptors() { methodDescriptors.add(suggestSmartRepliesMethodDescriptor); methodDescriptors.add(listSuggestionsMethodDescriptor); methodDescriptors.add(compileSuggestionMethodDescriptor); + methodDescriptors.add(listLocationsMethodDescriptor); + methodDescriptors.add(getLocationMethodDescriptor); return methodDescriptors; } @@ -699,6 +796,22 @@ public UnaryCallable listSugges return compileSuggestionCallable; } + @Override + public UnaryCallable listLocationsCallable() { + return listLocationsCallable; + } + + @Override + public UnaryCallable + listLocationsPagedCallable() { + return listLocationsPagedCallable; + } + + @Override + public UnaryCallable getLocationCallable() { + return getLocationCallable; + } + @Override public final void close() { try { diff --git a/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2beta1/stub/HttpJsonSessionEntityTypesStub.java b/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2beta1/stub/HttpJsonSessionEntityTypesStub.java index 834e864df..9ceb049fb 100644 --- a/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2beta1/stub/HttpJsonSessionEntityTypesStub.java +++ b/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2beta1/stub/HttpJsonSessionEntityTypesStub.java @@ -16,6 +16,7 @@ package com.google.cloud.dialogflow.v2beta1.stub; +import static com.google.cloud.dialogflow.v2beta1.SessionEntityTypesClient.ListLocationsPagedResponse; import static com.google.cloud.dialogflow.v2beta1.SessionEntityTypesClient.ListSessionEntityTypesPagedResponse; import com.google.api.core.BetaApi; @@ -37,6 +38,10 @@ import com.google.cloud.dialogflow.v2beta1.ListSessionEntityTypesResponse; import com.google.cloud.dialogflow.v2beta1.SessionEntityType; import com.google.cloud.dialogflow.v2beta1.UpdateSessionEntityTypeRequest; +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.ListLocationsResponse; +import com.google.cloud.location.Location; import com.google.protobuf.Empty; import com.google.protobuf.TypeRegistry; import java.io.IOException; @@ -262,6 +267,72 @@ public class HttpJsonSessionEntityTypesStub extends SessionEntityTypesStub { .build()) .build(); + private static final ApiMethodDescriptor + listLocationsMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("google.cloud.location.Locations/ListLocations") + .setHttpMethod("GET") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v2beta1/{name=projects/*}/locations", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam(fields, "name", request.getName()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + return fields; + }) + .setRequestBodyExtractor(request -> null) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(ListLocationsResponse.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private static final ApiMethodDescriptor + getLocationMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("google.cloud.location.Locations/GetLocation") + .setHttpMethod("GET") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v2beta1/{name=projects/*/locations/*}", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam(fields, "name", request.getName()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + return fields; + }) + .setRequestBodyExtractor(request -> null) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(Location.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + private final UnaryCallable listSessionEntityTypesCallable; private final UnaryCallable @@ -274,6 +345,10 @@ public class HttpJsonSessionEntityTypesStub extends SessionEntityTypesStub { updateSessionEntityTypeCallable; private final UnaryCallable deleteSessionEntityTypeCallable; + private final UnaryCallable listLocationsCallable; + private final UnaryCallable + listLocationsPagedCallable; + private final UnaryCallable getLocationCallable; private final BackgroundResource backgroundResources; private final HttpJsonStubCallableFactory callableFactory; @@ -350,6 +425,17 @@ protected HttpJsonSessionEntityTypesStub( .setMethodDescriptor(deleteSessionEntityTypeMethodDescriptor) .setTypeRegistry(typeRegistry) .build(); + HttpJsonCallSettings + listLocationsTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(listLocationsMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings getLocationTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(getLocationMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); this.listSessionEntityTypesCallable = callableFactory.createUnaryCallable( @@ -381,6 +467,15 @@ protected HttpJsonSessionEntityTypesStub( deleteSessionEntityTypeTransportSettings, settings.deleteSessionEntityTypeSettings(), clientContext); + this.listLocationsCallable = + callableFactory.createUnaryCallable( + listLocationsTransportSettings, settings.listLocationsSettings(), clientContext); + this.listLocationsPagedCallable = + callableFactory.createPagedCallable( + listLocationsTransportSettings, settings.listLocationsSettings(), clientContext); + this.getLocationCallable = + callableFactory.createUnaryCallable( + getLocationTransportSettings, settings.getLocationSettings(), clientContext); this.backgroundResources = new BackgroundResourceAggregation(clientContext.getBackgroundResources()); @@ -394,6 +489,8 @@ public static List getMethodDescriptors() { methodDescriptors.add(createSessionEntityTypeMethodDescriptor); methodDescriptors.add(updateSessionEntityTypeMethodDescriptor); methodDescriptors.add(deleteSessionEntityTypeMethodDescriptor); + methodDescriptors.add(listLocationsMethodDescriptor); + methodDescriptors.add(getLocationMethodDescriptor); return methodDescriptors; } @@ -432,6 +529,22 @@ public UnaryCallable deleteSessionEntityT return deleteSessionEntityTypeCallable; } + @Override + public UnaryCallable listLocationsCallable() { + return listLocationsCallable; + } + + @Override + public UnaryCallable + listLocationsPagedCallable() { + return listLocationsPagedCallable; + } + + @Override + public UnaryCallable getLocationCallable() { + return getLocationCallable; + } + @Override public final void close() { try { diff --git a/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2beta1/stub/HttpJsonSessionsStub.java b/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2beta1/stub/HttpJsonSessionsStub.java index 89cc28f75..ac0487656 100644 --- a/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2beta1/stub/HttpJsonSessionsStub.java +++ b/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2beta1/stub/HttpJsonSessionsStub.java @@ -16,6 +16,8 @@ package com.google.cloud.dialogflow.v2beta1.stub; +import static com.google.cloud.dialogflow.v2beta1.SessionsClient.ListLocationsPagedResponse; + import com.google.api.core.BetaApi; import com.google.api.core.InternalApi; import com.google.api.gax.core.BackgroundResource; @@ -30,6 +32,10 @@ import com.google.api.gax.rpc.UnaryCallable; import com.google.cloud.dialogflow.v2beta1.DetectIntentRequest; import com.google.cloud.dialogflow.v2beta1.DetectIntentResponse; +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.ListLocationsResponse; +import com.google.cloud.location.Location; import com.google.protobuf.TypeRegistry; import java.io.IOException; import java.util.ArrayList; @@ -90,7 +96,77 @@ public class HttpJsonSessionsStub extends SessionsStub { .build()) .build(); + private static final ApiMethodDescriptor + listLocationsMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("google.cloud.location.Locations/ListLocations") + .setHttpMethod("GET") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v2beta1/{name=projects/*}/locations", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam(fields, "name", request.getName()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + return fields; + }) + .setRequestBodyExtractor(request -> null) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(ListLocationsResponse.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private static final ApiMethodDescriptor + getLocationMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("google.cloud.location.Locations/GetLocation") + .setHttpMethod("GET") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v2beta1/{name=projects/*/locations/*}", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam(fields, "name", request.getName()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + return fields; + }) + .setRequestBodyExtractor(request -> null) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(Location.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + private final UnaryCallable detectIntentCallable; + private final UnaryCallable listLocationsCallable; + private final UnaryCallable + listLocationsPagedCallable; + private final UnaryCallable getLocationCallable; private final BackgroundResource backgroundResources; private final HttpJsonStubCallableFactory callableFactory; @@ -138,10 +214,30 @@ protected HttpJsonSessionsStub( .setMethodDescriptor(detectIntentMethodDescriptor) .setTypeRegistry(typeRegistry) .build(); + HttpJsonCallSettings + listLocationsTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(listLocationsMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings getLocationTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(getLocationMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); this.detectIntentCallable = callableFactory.createUnaryCallable( detectIntentTransportSettings, settings.detectIntentSettings(), clientContext); + this.listLocationsCallable = + callableFactory.createUnaryCallable( + listLocationsTransportSettings, settings.listLocationsSettings(), clientContext); + this.listLocationsPagedCallable = + callableFactory.createPagedCallable( + listLocationsTransportSettings, settings.listLocationsSettings(), clientContext); + this.getLocationCallable = + callableFactory.createUnaryCallable( + getLocationTransportSettings, settings.getLocationSettings(), clientContext); this.backgroundResources = new BackgroundResourceAggregation(clientContext.getBackgroundResources()); @@ -151,6 +247,8 @@ protected HttpJsonSessionsStub( public static List getMethodDescriptors() { List methodDescriptors = new ArrayList<>(); methodDescriptors.add(detectIntentMethodDescriptor); + methodDescriptors.add(listLocationsMethodDescriptor); + methodDescriptors.add(getLocationMethodDescriptor); return methodDescriptors; } @@ -159,6 +257,22 @@ public UnaryCallable detectIntentCall return detectIntentCallable; } + @Override + public UnaryCallable listLocationsCallable() { + return listLocationsCallable; + } + + @Override + public UnaryCallable + listLocationsPagedCallable() { + return listLocationsPagedCallable; + } + + @Override + public UnaryCallable getLocationCallable() { + return getLocationCallable; + } + @Override public final void close() { try { diff --git a/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2beta1/stub/HttpJsonVersionsStub.java b/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2beta1/stub/HttpJsonVersionsStub.java index d097595f4..7188c5e4b 100644 --- a/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2beta1/stub/HttpJsonVersionsStub.java +++ b/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2beta1/stub/HttpJsonVersionsStub.java @@ -16,6 +16,7 @@ package com.google.cloud.dialogflow.v2beta1.stub; +import static com.google.cloud.dialogflow.v2beta1.VersionsClient.ListLocationsPagedResponse; import static com.google.cloud.dialogflow.v2beta1.VersionsClient.ListVersionsPagedResponse; import com.google.api.core.BetaApi; @@ -37,6 +38,10 @@ import com.google.cloud.dialogflow.v2beta1.ListVersionsResponse; import com.google.cloud.dialogflow.v2beta1.UpdateVersionRequest; import com.google.cloud.dialogflow.v2beta1.Version; +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.ListLocationsResponse; +import com.google.cloud.location.Location; import com.google.protobuf.Empty; import com.google.protobuf.TypeRegistry; import java.io.IOException; @@ -236,6 +241,72 @@ public class HttpJsonVersionsStub extends VersionsStub { .build()) .build(); + private static final ApiMethodDescriptor + listLocationsMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("google.cloud.location.Locations/ListLocations") + .setHttpMethod("GET") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v2beta1/{name=projects/*}/locations", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam(fields, "name", request.getName()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + return fields; + }) + .setRequestBodyExtractor(request -> null) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(ListLocationsResponse.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private static final ApiMethodDescriptor + getLocationMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("google.cloud.location.Locations/GetLocation") + .setHttpMethod("GET") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v2beta1/{name=projects/*/locations/*}", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam(fields, "name", request.getName()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + return fields; + }) + .setRequestBodyExtractor(request -> null) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(Location.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + private final UnaryCallable listVersionsCallable; private final UnaryCallable listVersionsPagedCallable; @@ -243,6 +314,10 @@ public class HttpJsonVersionsStub extends VersionsStub { private final UnaryCallable createVersionCallable; private final UnaryCallable updateVersionCallable; private final UnaryCallable deleteVersionCallable; + private final UnaryCallable listLocationsCallable; + private final UnaryCallable + listLocationsPagedCallable; + private final UnaryCallable getLocationCallable; private final BackgroundResource backgroundResources; private final HttpJsonStubCallableFactory callableFactory; @@ -310,6 +385,17 @@ protected HttpJsonVersionsStub( .setMethodDescriptor(deleteVersionMethodDescriptor) .setTypeRegistry(typeRegistry) .build(); + HttpJsonCallSettings + listLocationsTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(listLocationsMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings getLocationTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(getLocationMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); this.listVersionsCallable = callableFactory.createUnaryCallable( @@ -329,6 +415,15 @@ protected HttpJsonVersionsStub( this.deleteVersionCallable = callableFactory.createUnaryCallable( deleteVersionTransportSettings, settings.deleteVersionSettings(), clientContext); + this.listLocationsCallable = + callableFactory.createUnaryCallable( + listLocationsTransportSettings, settings.listLocationsSettings(), clientContext); + this.listLocationsPagedCallable = + callableFactory.createPagedCallable( + listLocationsTransportSettings, settings.listLocationsSettings(), clientContext); + this.getLocationCallable = + callableFactory.createUnaryCallable( + getLocationTransportSettings, settings.getLocationSettings(), clientContext); this.backgroundResources = new BackgroundResourceAggregation(clientContext.getBackgroundResources()); @@ -342,6 +437,8 @@ public static List getMethodDescriptors() { methodDescriptors.add(createVersionMethodDescriptor); methodDescriptors.add(updateVersionMethodDescriptor); methodDescriptors.add(deleteVersionMethodDescriptor); + methodDescriptors.add(listLocationsMethodDescriptor); + methodDescriptors.add(getLocationMethodDescriptor); return methodDescriptors; } @@ -375,6 +472,22 @@ public UnaryCallable deleteVersionCallable() { return deleteVersionCallable; } + @Override + public UnaryCallable listLocationsCallable() { + return listLocationsCallable; + } + + @Override + public UnaryCallable + listLocationsPagedCallable() { + return listLocationsPagedCallable; + } + + @Override + public UnaryCallable getLocationCallable() { + return getLocationCallable; + } + @Override public final void close() { try { diff --git a/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2beta1/stub/IntentsStub.java b/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2beta1/stub/IntentsStub.java index 599de90f1..f3d3c94a7 100644 --- a/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2beta1/stub/IntentsStub.java +++ b/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2beta1/stub/IntentsStub.java @@ -17,6 +17,7 @@ package com.google.cloud.dialogflow.v2beta1.stub; import static com.google.cloud.dialogflow.v2beta1.IntentsClient.ListIntentsPagedResponse; +import static com.google.cloud.dialogflow.v2beta1.IntentsClient.ListLocationsPagedResponse; import com.google.api.core.BetaApi; import com.google.api.gax.core.BackgroundResource; @@ -32,6 +33,10 @@ import com.google.cloud.dialogflow.v2beta1.ListIntentsRequest; import com.google.cloud.dialogflow.v2beta1.ListIntentsResponse; import com.google.cloud.dialogflow.v2beta1.UpdateIntentRequest; +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.ListLocationsResponse; +import com.google.cloud.location.Location; import com.google.longrunning.Operation; import com.google.longrunning.stub.OperationsStub; import com.google.protobuf.Empty; @@ -100,6 +105,19 @@ public UnaryCallable batchDeleteIntentsCal throw new UnsupportedOperationException("Not implemented: batchDeleteIntentsCallable()"); } + public UnaryCallable + listLocationsPagedCallable() { + throw new UnsupportedOperationException("Not implemented: listLocationsPagedCallable()"); + } + + public UnaryCallable listLocationsCallable() { + throw new UnsupportedOperationException("Not implemented: listLocationsCallable()"); + } + + public UnaryCallable getLocationCallable() { + throw new UnsupportedOperationException("Not implemented: getLocationCallable()"); + } + @Override public abstract void close(); } diff --git a/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2beta1/stub/IntentsStubSettings.java b/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2beta1/stub/IntentsStubSettings.java index bc3ea13a0..f51102926 100644 --- a/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2beta1/stub/IntentsStubSettings.java +++ b/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2beta1/stub/IntentsStubSettings.java @@ -17,6 +17,7 @@ package com.google.cloud.dialogflow.v2beta1.stub; import static com.google.cloud.dialogflow.v2beta1.IntentsClient.ListIntentsPagedResponse; +import static com.google.cloud.dialogflow.v2beta1.IntentsClient.ListLocationsPagedResponse; import com.google.api.core.ApiFunction; import com.google.api.core.ApiFuture; @@ -57,6 +58,10 @@ import com.google.cloud.dialogflow.v2beta1.ListIntentsRequest; import com.google.cloud.dialogflow.v2beta1.ListIntentsResponse; import com.google.cloud.dialogflow.v2beta1.UpdateIntentRequest; +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.ListLocationsResponse; +import com.google.cloud.location.Location; import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableMap; import com.google.common.collect.ImmutableSet; @@ -124,6 +129,10 @@ public class IntentsStubSettings extends StubSettings { private final UnaryCallSettings batchDeleteIntentsSettings; private final OperationCallSettings batchDeleteIntentsOperationSettings; + private final PagedCallSettings< + ListLocationsRequest, ListLocationsResponse, ListLocationsPagedResponse> + listLocationsSettings; + private final UnaryCallSettings getLocationSettings; private static final PagedListDescriptor LIST_INTENTS_PAGE_STR_DESC = @@ -161,6 +170,42 @@ public Iterable extractResources(ListIntentsResponse payload) { } }; + private static final PagedListDescriptor + LIST_LOCATIONS_PAGE_STR_DESC = + new PagedListDescriptor() { + @Override + public String emptyToken() { + return ""; + } + + @Override + public ListLocationsRequest injectToken(ListLocationsRequest payload, String token) { + return ListLocationsRequest.newBuilder(payload).setPageToken(token).build(); + } + + @Override + public ListLocationsRequest injectPageSize(ListLocationsRequest payload, int pageSize) { + return ListLocationsRequest.newBuilder(payload).setPageSize(pageSize).build(); + } + + @Override + public Integer extractPageSize(ListLocationsRequest payload) { + return payload.getPageSize(); + } + + @Override + public String extractNextToken(ListLocationsResponse payload) { + return payload.getNextPageToken(); + } + + @Override + public Iterable extractResources(ListLocationsResponse payload) { + return payload.getLocationsList() == null + ? ImmutableList.of() + : payload.getLocationsList(); + } + }; + private static final PagedListResponseFactory< ListIntentsRequest, ListIntentsResponse, ListIntentsPagedResponse> LIST_INTENTS_PAGE_STR_FACT = @@ -178,6 +223,23 @@ public ApiFuture getFuturePagedResponse( } }; + private static final PagedListResponseFactory< + ListLocationsRequest, ListLocationsResponse, ListLocationsPagedResponse> + LIST_LOCATIONS_PAGE_STR_FACT = + new PagedListResponseFactory< + ListLocationsRequest, ListLocationsResponse, ListLocationsPagedResponse>() { + @Override + public ApiFuture getFuturePagedResponse( + UnaryCallable callable, + ListLocationsRequest request, + ApiCallContext context, + ApiFuture futureResponse) { + PageContext pageContext = + PageContext.create(callable, LIST_LOCATIONS_PAGE_STR_DESC, request, context); + return ListLocationsPagedResponse.createAsync(pageContext, futureResponse); + } + }; + /** Returns the object with the settings used for calls to listIntents. */ public PagedCallSettings listIntentsSettings() { @@ -226,6 +288,17 @@ public UnaryCallSettings batchDeleteIntent return batchDeleteIntentsOperationSettings; } + /** Returns the object with the settings used for calls to listLocations. */ + public PagedCallSettings + listLocationsSettings() { + return listLocationsSettings; + } + + /** Returns the object with the settings used for calls to getLocation. */ + public UnaryCallSettings getLocationSettings() { + return getLocationSettings; + } + public IntentsStub createStub() throws IOException { if (getTransportChannelProvider() .getTransportName() @@ -341,6 +414,8 @@ protected IntentsStubSettings(Builder settingsBuilder) throws IOException { batchDeleteIntentsSettings = settingsBuilder.batchDeleteIntentsSettings().build(); batchDeleteIntentsOperationSettings = settingsBuilder.batchDeleteIntentsOperationSettings().build(); + listLocationsSettings = settingsBuilder.listLocationsSettings().build(); + getLocationSettings = settingsBuilder.getLocationSettings().build(); } /** Builder for IntentsStubSettings. */ @@ -362,6 +437,10 @@ public static class Builder extends StubSettings.Builder batchDeleteIntentsOperationSettings; + private final PagedCallSettings.Builder< + ListLocationsRequest, ListLocationsResponse, ListLocationsPagedResponse> + listLocationsSettings; + private final UnaryCallSettings.Builder getLocationSettings; private static final ImmutableMap> RETRYABLE_CODE_DEFINITIONS; @@ -409,6 +488,8 @@ protected Builder(ClientContext clientContext) { batchUpdateIntentsOperationSettings = OperationCallSettings.newBuilder(); batchDeleteIntentsSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); batchDeleteIntentsOperationSettings = OperationCallSettings.newBuilder(); + listLocationsSettings = PagedCallSettings.newBuilder(LIST_LOCATIONS_PAGE_STR_FACT); + getLocationSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); unaryMethodSettingsBuilders = ImmutableList.>of( @@ -418,7 +499,9 @@ protected Builder(ClientContext clientContext) { updateIntentSettings, deleteIntentSettings, batchUpdateIntentsSettings, - batchDeleteIntentsSettings); + batchDeleteIntentsSettings, + listLocationsSettings, + getLocationSettings); initDefaults(this); } @@ -436,6 +519,8 @@ protected Builder(IntentsStubSettings settings) { batchDeleteIntentsSettings = settings.batchDeleteIntentsSettings.toBuilder(); batchDeleteIntentsOperationSettings = settings.batchDeleteIntentsOperationSettings.toBuilder(); + listLocationsSettings = settings.listLocationsSettings.toBuilder(); + getLocationSettings = settings.getLocationSettings.toBuilder(); unaryMethodSettingsBuilders = ImmutableList.>of( @@ -445,7 +530,9 @@ protected Builder(IntentsStubSettings settings) { updateIntentSettings, deleteIntentSettings, batchUpdateIntentsSettings, - batchDeleteIntentsSettings); + batchDeleteIntentsSettings, + listLocationsSettings, + getLocationSettings); } private static Builder createDefault() { @@ -510,6 +597,16 @@ private static Builder initDefaults(Builder builder) { .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes")) .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params")); + builder + .listLocationsSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params")); + + builder + .getLocationSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params")); + builder .batchUpdateIntentsOperationSettings() .setInitialCallSettings( @@ -633,6 +730,18 @@ public UnaryCallSettings.Builder deleteIntentSetting return batchDeleteIntentsOperationSettings; } + /** Returns the builder for the settings used for calls to listLocations. */ + public PagedCallSettings.Builder< + ListLocationsRequest, ListLocationsResponse, ListLocationsPagedResponse> + listLocationsSettings() { + return listLocationsSettings; + } + + /** Returns the builder for the settings used for calls to getLocation. */ + public UnaryCallSettings.Builder getLocationSettings() { + return getLocationSettings; + } + @Override public IntentsStubSettings build() throws IOException { return new IntentsStubSettings(this); diff --git a/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2beta1/stub/KnowledgeBasesStub.java b/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2beta1/stub/KnowledgeBasesStub.java index 4846dd720..f698a0f27 100644 --- a/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2beta1/stub/KnowledgeBasesStub.java +++ b/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2beta1/stub/KnowledgeBasesStub.java @@ -17,6 +17,7 @@ package com.google.cloud.dialogflow.v2beta1.stub; import static com.google.cloud.dialogflow.v2beta1.KnowledgeBasesClient.ListKnowledgeBasesPagedResponse; +import static com.google.cloud.dialogflow.v2beta1.KnowledgeBasesClient.ListLocationsPagedResponse; import com.google.api.core.BetaApi; import com.google.api.gax.core.BackgroundResource; @@ -28,6 +29,10 @@ import com.google.cloud.dialogflow.v2beta1.ListKnowledgeBasesRequest; import com.google.cloud.dialogflow.v2beta1.ListKnowledgeBasesResponse; import com.google.cloud.dialogflow.v2beta1.UpdateKnowledgeBaseRequest; +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.ListLocationsResponse; +import com.google.cloud.location.Location; import com.google.protobuf.Empty; import javax.annotation.Generated; @@ -67,6 +72,19 @@ public UnaryCallable updateKnowledgeB throw new UnsupportedOperationException("Not implemented: updateKnowledgeBaseCallable()"); } + public UnaryCallable + listLocationsPagedCallable() { + throw new UnsupportedOperationException("Not implemented: listLocationsPagedCallable()"); + } + + public UnaryCallable listLocationsCallable() { + throw new UnsupportedOperationException("Not implemented: listLocationsCallable()"); + } + + public UnaryCallable getLocationCallable() { + throw new UnsupportedOperationException("Not implemented: getLocationCallable()"); + } + @Override public abstract void close(); } diff --git a/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2beta1/stub/KnowledgeBasesStubSettings.java b/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2beta1/stub/KnowledgeBasesStubSettings.java index 291187036..15e305249 100644 --- a/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2beta1/stub/KnowledgeBasesStubSettings.java +++ b/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2beta1/stub/KnowledgeBasesStubSettings.java @@ -17,6 +17,7 @@ package com.google.cloud.dialogflow.v2beta1.stub; import static com.google.cloud.dialogflow.v2beta1.KnowledgeBasesClient.ListKnowledgeBasesPagedResponse; +import static com.google.cloud.dialogflow.v2beta1.KnowledgeBasesClient.ListLocationsPagedResponse; import com.google.api.core.ApiFunction; import com.google.api.core.ApiFuture; @@ -50,6 +51,10 @@ import com.google.cloud.dialogflow.v2beta1.ListKnowledgeBasesRequest; import com.google.cloud.dialogflow.v2beta1.ListKnowledgeBasesResponse; import com.google.cloud.dialogflow.v2beta1.UpdateKnowledgeBaseRequest; +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.ListLocationsResponse; +import com.google.cloud.location.Location; import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableMap; import com.google.common.collect.ImmutableSet; @@ -113,6 +118,10 @@ public class KnowledgeBasesStubSettings extends StubSettings deleteKnowledgeBaseSettings; private final UnaryCallSettings updateKnowledgeBaseSettings; + private final PagedCallSettings< + ListLocationsRequest, ListLocationsResponse, ListLocationsPagedResponse> + listLocationsSettings; + private final UnaryCallSettings getLocationSettings; private static final PagedListDescriptor< ListKnowledgeBasesRequest, ListKnowledgeBasesResponse, KnowledgeBase> @@ -154,6 +163,42 @@ public Iterable extractResources(ListKnowledgeBasesResponse paylo } }; + private static final PagedListDescriptor + LIST_LOCATIONS_PAGE_STR_DESC = + new PagedListDescriptor() { + @Override + public String emptyToken() { + return ""; + } + + @Override + public ListLocationsRequest injectToken(ListLocationsRequest payload, String token) { + return ListLocationsRequest.newBuilder(payload).setPageToken(token).build(); + } + + @Override + public ListLocationsRequest injectPageSize(ListLocationsRequest payload, int pageSize) { + return ListLocationsRequest.newBuilder(payload).setPageSize(pageSize).build(); + } + + @Override + public Integer extractPageSize(ListLocationsRequest payload) { + return payload.getPageSize(); + } + + @Override + public String extractNextToken(ListLocationsResponse payload) { + return payload.getNextPageToken(); + } + + @Override + public Iterable extractResources(ListLocationsResponse payload) { + return payload.getLocationsList() == null + ? ImmutableList.of() + : payload.getLocationsList(); + } + }; + private static final PagedListResponseFactory< ListKnowledgeBasesRequest, ListKnowledgeBasesResponse, ListKnowledgeBasesPagedResponse> LIST_KNOWLEDGE_BASES_PAGE_STR_FACT = @@ -175,6 +220,23 @@ public ApiFuture getFuturePagedResponse( } }; + private static final PagedListResponseFactory< + ListLocationsRequest, ListLocationsResponse, ListLocationsPagedResponse> + LIST_LOCATIONS_PAGE_STR_FACT = + new PagedListResponseFactory< + ListLocationsRequest, ListLocationsResponse, ListLocationsPagedResponse>() { + @Override + public ApiFuture getFuturePagedResponse( + UnaryCallable callable, + ListLocationsRequest request, + ApiCallContext context, + ApiFuture futureResponse) { + PageContext pageContext = + PageContext.create(callable, LIST_LOCATIONS_PAGE_STR_DESC, request, context); + return ListLocationsPagedResponse.createAsync(pageContext, futureResponse); + } + }; + /** Returns the object with the settings used for calls to listKnowledgeBases. */ public PagedCallSettings< ListKnowledgeBasesRequest, ListKnowledgeBasesResponse, ListKnowledgeBasesPagedResponse> @@ -204,6 +266,17 @@ public UnaryCallSettings deleteKnowledgeBaseS return updateKnowledgeBaseSettings; } + /** Returns the object with the settings used for calls to listLocations. */ + public PagedCallSettings + listLocationsSettings() { + return listLocationsSettings; + } + + /** Returns the object with the settings used for calls to getLocation. */ + public UnaryCallSettings getLocationSettings() { + return getLocationSettings; + } + public KnowledgeBasesStub createStub() throws IOException { if (getTransportChannelProvider() .getTransportName() @@ -315,6 +388,8 @@ protected KnowledgeBasesStubSettings(Builder settingsBuilder) throws IOException createKnowledgeBaseSettings = settingsBuilder.createKnowledgeBaseSettings().build(); deleteKnowledgeBaseSettings = settingsBuilder.deleteKnowledgeBaseSettings().build(); updateKnowledgeBaseSettings = settingsBuilder.updateKnowledgeBaseSettings().build(); + listLocationsSettings = settingsBuilder.listLocationsSettings().build(); + getLocationSettings = settingsBuilder.getLocationSettings().build(); } /** Builder for KnowledgeBasesStubSettings. */ @@ -331,6 +406,10 @@ public static class Builder extends StubSettings.Builder updateKnowledgeBaseSettings; + private final PagedCallSettings.Builder< + ListLocationsRequest, ListLocationsResponse, ListLocationsPagedResponse> + listLocationsSettings; + private final UnaryCallSettings.Builder getLocationSettings; private static final ImmutableMap> RETRYABLE_CODE_DEFINITIONS; @@ -374,6 +453,8 @@ protected Builder(ClientContext clientContext) { createKnowledgeBaseSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); deleteKnowledgeBaseSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); updateKnowledgeBaseSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + listLocationsSettings = PagedCallSettings.newBuilder(LIST_LOCATIONS_PAGE_STR_FACT); + getLocationSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); unaryMethodSettingsBuilders = ImmutableList.>of( @@ -381,7 +462,9 @@ protected Builder(ClientContext clientContext) { getKnowledgeBaseSettings, createKnowledgeBaseSettings, deleteKnowledgeBaseSettings, - updateKnowledgeBaseSettings); + updateKnowledgeBaseSettings, + listLocationsSettings, + getLocationSettings); initDefaults(this); } @@ -393,6 +476,8 @@ protected Builder(KnowledgeBasesStubSettings settings) { createKnowledgeBaseSettings = settings.createKnowledgeBaseSettings.toBuilder(); deleteKnowledgeBaseSettings = settings.deleteKnowledgeBaseSettings.toBuilder(); updateKnowledgeBaseSettings = settings.updateKnowledgeBaseSettings.toBuilder(); + listLocationsSettings = settings.listLocationsSettings.toBuilder(); + getLocationSettings = settings.getLocationSettings.toBuilder(); unaryMethodSettingsBuilders = ImmutableList.>of( @@ -400,7 +485,9 @@ protected Builder(KnowledgeBasesStubSettings settings) { getKnowledgeBaseSettings, createKnowledgeBaseSettings, deleteKnowledgeBaseSettings, - updateKnowledgeBaseSettings); + updateKnowledgeBaseSettings, + listLocationsSettings, + getLocationSettings); } private static Builder createDefault() { @@ -455,6 +542,16 @@ private static Builder initDefaults(Builder builder) { .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes")) .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params")); + builder + .listLocationsSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params")); + + builder + .getLocationSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params")); + return builder; } @@ -504,6 +601,18 @@ public Builder applyToAllUnaryMethods( return updateKnowledgeBaseSettings; } + /** Returns the builder for the settings used for calls to listLocations. */ + public PagedCallSettings.Builder< + ListLocationsRequest, ListLocationsResponse, ListLocationsPagedResponse> + listLocationsSettings() { + return listLocationsSettings; + } + + /** Returns the builder for the settings used for calls to getLocation. */ + public UnaryCallSettings.Builder getLocationSettings() { + return getLocationSettings; + } + @Override public KnowledgeBasesStubSettings build() throws IOException { return new KnowledgeBasesStubSettings(this); diff --git a/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2beta1/stub/ParticipantsStub.java b/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2beta1/stub/ParticipantsStub.java index 87ea2727c..2b9ac7b48 100644 --- a/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2beta1/stub/ParticipantsStub.java +++ b/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2beta1/stub/ParticipantsStub.java @@ -16,6 +16,7 @@ package com.google.cloud.dialogflow.v2beta1.stub; +import static com.google.cloud.dialogflow.v2beta1.ParticipantsClient.ListLocationsPagedResponse; import static com.google.cloud.dialogflow.v2beta1.ParticipantsClient.ListParticipantsPagedResponse; import static com.google.cloud.dialogflow.v2beta1.ParticipantsClient.ListSuggestionsPagedResponse; @@ -43,6 +44,10 @@ import com.google.cloud.dialogflow.v2beta1.SuggestSmartRepliesRequest; import com.google.cloud.dialogflow.v2beta1.SuggestSmartRepliesResponse; import com.google.cloud.dialogflow.v2beta1.UpdateParticipantRequest; +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.ListLocationsResponse; +import com.google.cloud.location.Location; import javax.annotation.Generated; // AUTO-GENERATED DOCUMENTATION AND CLASS. @@ -117,6 +122,19 @@ public UnaryCallable listSugges throw new UnsupportedOperationException("Not implemented: compileSuggestionCallable()"); } + public UnaryCallable + listLocationsPagedCallable() { + throw new UnsupportedOperationException("Not implemented: listLocationsPagedCallable()"); + } + + public UnaryCallable listLocationsCallable() { + throw new UnsupportedOperationException("Not implemented: listLocationsCallable()"); + } + + public UnaryCallable getLocationCallable() { + throw new UnsupportedOperationException("Not implemented: getLocationCallable()"); + } + @Override public abstract void close(); } diff --git a/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2beta1/stub/ParticipantsStubSettings.java b/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2beta1/stub/ParticipantsStubSettings.java index bcfec466a..6ec8a784a 100644 --- a/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2beta1/stub/ParticipantsStubSettings.java +++ b/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2beta1/stub/ParticipantsStubSettings.java @@ -16,6 +16,7 @@ package com.google.cloud.dialogflow.v2beta1.stub; +import static com.google.cloud.dialogflow.v2beta1.ParticipantsClient.ListLocationsPagedResponse; import static com.google.cloud.dialogflow.v2beta1.ParticipantsClient.ListParticipantsPagedResponse; import static com.google.cloud.dialogflow.v2beta1.ParticipantsClient.ListSuggestionsPagedResponse; @@ -66,6 +67,10 @@ import com.google.cloud.dialogflow.v2beta1.SuggestSmartRepliesResponse; import com.google.cloud.dialogflow.v2beta1.Suggestion; import com.google.cloud.dialogflow.v2beta1.UpdateParticipantRequest; +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.ListLocationsResponse; +import com.google.cloud.location.Location; import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableMap; import com.google.common.collect.ImmutableSet; @@ -141,6 +146,10 @@ public class ParticipantsStubSettings extends StubSettings compileSuggestionSettings; + private final PagedCallSettings< + ListLocationsRequest, ListLocationsResponse, ListLocationsPagedResponse> + listLocationsSettings; + private final UnaryCallSettings getLocationSettings; private static final PagedListDescriptor< ListParticipantsRequest, ListParticipantsResponse, Participant> @@ -221,6 +230,42 @@ public Iterable extractResources(ListSuggestionsResponse payload) { } }; + private static final PagedListDescriptor + LIST_LOCATIONS_PAGE_STR_DESC = + new PagedListDescriptor() { + @Override + public String emptyToken() { + return ""; + } + + @Override + public ListLocationsRequest injectToken(ListLocationsRequest payload, String token) { + return ListLocationsRequest.newBuilder(payload).setPageToken(token).build(); + } + + @Override + public ListLocationsRequest injectPageSize(ListLocationsRequest payload, int pageSize) { + return ListLocationsRequest.newBuilder(payload).setPageSize(pageSize).build(); + } + + @Override + public Integer extractPageSize(ListLocationsRequest payload) { + return payload.getPageSize(); + } + + @Override + public String extractNextToken(ListLocationsResponse payload) { + return payload.getNextPageToken(); + } + + @Override + public Iterable extractResources(ListLocationsResponse payload) { + return payload.getLocationsList() == null + ? ImmutableList.of() + : payload.getLocationsList(); + } + }; + private static final PagedListResponseFactory< ListParticipantsRequest, ListParticipantsResponse, ListParticipantsPagedResponse> LIST_PARTICIPANTS_PAGE_STR_FACT = @@ -257,6 +302,23 @@ public ApiFuture getFuturePagedResponse( } }; + private static final PagedListResponseFactory< + ListLocationsRequest, ListLocationsResponse, ListLocationsPagedResponse> + LIST_LOCATIONS_PAGE_STR_FACT = + new PagedListResponseFactory< + ListLocationsRequest, ListLocationsResponse, ListLocationsPagedResponse>() { + @Override + public ApiFuture getFuturePagedResponse( + UnaryCallable callable, + ListLocationsRequest request, + ApiCallContext context, + ApiFuture futureResponse) { + PageContext pageContext = + PageContext.create(callable, LIST_LOCATIONS_PAGE_STR_DESC, request, context); + return ListLocationsPagedResponse.createAsync(pageContext, futureResponse); + } + }; + /** Returns the object with the settings used for calls to createParticipant. */ public UnaryCallSettings createParticipantSettings() { return createParticipantSettings; @@ -331,6 +393,17 @@ public UnaryCallSettings analyzeC return compileSuggestionSettings; } + /** Returns the object with the settings used for calls to listLocations. */ + public PagedCallSettings + listLocationsSettings() { + return listLocationsSettings; + } + + /** Returns the object with the settings used for calls to getLocation. */ + public UnaryCallSettings getLocationSettings() { + return getLocationSettings; + } + public ParticipantsStub createStub() throws IOException { if (getTransportChannelProvider() .getTransportName() @@ -448,6 +521,8 @@ protected ParticipantsStubSettings(Builder settingsBuilder) throws IOException { suggestSmartRepliesSettings = settingsBuilder.suggestSmartRepliesSettings().build(); listSuggestionsSettings = settingsBuilder.listSuggestionsSettings().build(); compileSuggestionSettings = settingsBuilder.compileSuggestionSettings().build(); + listLocationsSettings = settingsBuilder.listLocationsSettings().build(); + getLocationSettings = settingsBuilder.getLocationSettings().build(); } /** Builder for ParticipantsStubSettings. */ @@ -478,6 +553,10 @@ public static class Builder extends StubSettings.Builder compileSuggestionSettings; + private final PagedCallSettings.Builder< + ListLocationsRequest, ListLocationsResponse, ListLocationsPagedResponse> + listLocationsSettings; + private final UnaryCallSettings.Builder getLocationSettings; private static final ImmutableMap> RETRYABLE_CODE_DEFINITIONS; @@ -551,6 +630,8 @@ protected Builder(ClientContext clientContext) { suggestSmartRepliesSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); listSuggestionsSettings = PagedCallSettings.newBuilder(LIST_SUGGESTIONS_PAGE_STR_FACT); compileSuggestionSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + listLocationsSettings = PagedCallSettings.newBuilder(LIST_LOCATIONS_PAGE_STR_FACT); + getLocationSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); unaryMethodSettingsBuilders = ImmutableList.>of( @@ -563,7 +644,9 @@ protected Builder(ClientContext clientContext) { suggestFaqAnswersSettings, suggestSmartRepliesSettings, listSuggestionsSettings, - compileSuggestionSettings); + compileSuggestionSettings, + listLocationsSettings, + getLocationSettings); initDefaults(this); } @@ -581,6 +664,8 @@ protected Builder(ParticipantsStubSettings settings) { suggestSmartRepliesSettings = settings.suggestSmartRepliesSettings.toBuilder(); listSuggestionsSettings = settings.listSuggestionsSettings.toBuilder(); compileSuggestionSettings = settings.compileSuggestionSettings.toBuilder(); + listLocationsSettings = settings.listLocationsSettings.toBuilder(); + getLocationSettings = settings.getLocationSettings.toBuilder(); unaryMethodSettingsBuilders = ImmutableList.>of( @@ -593,7 +678,9 @@ protected Builder(ParticipantsStubSettings settings) { suggestFaqAnswersSettings, suggestSmartRepliesSettings, listSuggestionsSettings, - compileSuggestionSettings); + compileSuggestionSettings, + listLocationsSettings, + getLocationSettings); } private static Builder createDefault() { @@ -673,6 +760,16 @@ private static Builder initDefaults(Builder builder) { .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes")) .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params")); + builder + .listLocationsSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params")); + + builder + .getLocationSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params")); + return builder; } @@ -769,6 +866,18 @@ public UnaryCallSettings.Builder getParticip return compileSuggestionSettings; } + /** Returns the builder for the settings used for calls to listLocations. */ + public PagedCallSettings.Builder< + ListLocationsRequest, ListLocationsResponse, ListLocationsPagedResponse> + listLocationsSettings() { + return listLocationsSettings; + } + + /** Returns the builder for the settings used for calls to getLocation. */ + public UnaryCallSettings.Builder getLocationSettings() { + return getLocationSettings; + } + @Override public ParticipantsStubSettings build() throws IOException { return new ParticipantsStubSettings(this); diff --git a/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2beta1/stub/SessionEntityTypesStub.java b/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2beta1/stub/SessionEntityTypesStub.java index 38c9fc155..86c204908 100644 --- a/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2beta1/stub/SessionEntityTypesStub.java +++ b/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2beta1/stub/SessionEntityTypesStub.java @@ -16,6 +16,7 @@ package com.google.cloud.dialogflow.v2beta1.stub; +import static com.google.cloud.dialogflow.v2beta1.SessionEntityTypesClient.ListLocationsPagedResponse; import static com.google.cloud.dialogflow.v2beta1.SessionEntityTypesClient.ListSessionEntityTypesPagedResponse; import com.google.api.core.BetaApi; @@ -28,6 +29,10 @@ import com.google.cloud.dialogflow.v2beta1.ListSessionEntityTypesResponse; import com.google.cloud.dialogflow.v2beta1.SessionEntityType; import com.google.cloud.dialogflow.v2beta1.UpdateSessionEntityTypeRequest; +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.ListLocationsResponse; +import com.google.cloud.location.Location; import com.google.protobuf.Empty; import javax.annotation.Generated; @@ -71,6 +76,19 @@ public UnaryCallable deleteSessionEntityT throw new UnsupportedOperationException("Not implemented: deleteSessionEntityTypeCallable()"); } + public UnaryCallable + listLocationsPagedCallable() { + throw new UnsupportedOperationException("Not implemented: listLocationsPagedCallable()"); + } + + public UnaryCallable listLocationsCallable() { + throw new UnsupportedOperationException("Not implemented: listLocationsCallable()"); + } + + public UnaryCallable getLocationCallable() { + throw new UnsupportedOperationException("Not implemented: getLocationCallable()"); + } + @Override public abstract void close(); } diff --git a/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2beta1/stub/SessionEntityTypesStubSettings.java b/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2beta1/stub/SessionEntityTypesStubSettings.java index d0d7fae9e..8d1b2e42c 100644 --- a/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2beta1/stub/SessionEntityTypesStubSettings.java +++ b/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2beta1/stub/SessionEntityTypesStubSettings.java @@ -16,6 +16,7 @@ package com.google.cloud.dialogflow.v2beta1.stub; +import static com.google.cloud.dialogflow.v2beta1.SessionEntityTypesClient.ListLocationsPagedResponse; import static com.google.cloud.dialogflow.v2beta1.SessionEntityTypesClient.ListSessionEntityTypesPagedResponse; import com.google.api.core.ApiFunction; @@ -50,6 +51,10 @@ import com.google.cloud.dialogflow.v2beta1.ListSessionEntityTypesResponse; import com.google.cloud.dialogflow.v2beta1.SessionEntityType; import com.google.cloud.dialogflow.v2beta1.UpdateSessionEntityTypeRequest; +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.ListLocationsResponse; +import com.google.cloud.location.Location; import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableMap; import com.google.common.collect.ImmutableSet; @@ -118,6 +123,10 @@ public class SessionEntityTypesStubSettings extends StubSettings deleteSessionEntityTypeSettings; + private final PagedCallSettings< + ListLocationsRequest, ListLocationsResponse, ListLocationsPagedResponse> + listLocationsSettings; + private final UnaryCallSettings getLocationSettings; private static final PagedListDescriptor< ListSessionEntityTypesRequest, ListSessionEntityTypesResponse, SessionEntityType> @@ -162,6 +171,42 @@ public Iterable extractResources( } }; + private static final PagedListDescriptor + LIST_LOCATIONS_PAGE_STR_DESC = + new PagedListDescriptor() { + @Override + public String emptyToken() { + return ""; + } + + @Override + public ListLocationsRequest injectToken(ListLocationsRequest payload, String token) { + return ListLocationsRequest.newBuilder(payload).setPageToken(token).build(); + } + + @Override + public ListLocationsRequest injectPageSize(ListLocationsRequest payload, int pageSize) { + return ListLocationsRequest.newBuilder(payload).setPageSize(pageSize).build(); + } + + @Override + public Integer extractPageSize(ListLocationsRequest payload) { + return payload.getPageSize(); + } + + @Override + public String extractNextToken(ListLocationsResponse payload) { + return payload.getNextPageToken(); + } + + @Override + public Iterable extractResources(ListLocationsResponse payload) { + return payload.getLocationsList() == null + ? ImmutableList.of() + : payload.getLocationsList(); + } + }; + private static final PagedListResponseFactory< ListSessionEntityTypesRequest, ListSessionEntityTypesResponse, @@ -189,6 +234,23 @@ public ApiFuture getFuturePagedResponse( } }; + private static final PagedListResponseFactory< + ListLocationsRequest, ListLocationsResponse, ListLocationsPagedResponse> + LIST_LOCATIONS_PAGE_STR_FACT = + new PagedListResponseFactory< + ListLocationsRequest, ListLocationsResponse, ListLocationsPagedResponse>() { + @Override + public ApiFuture getFuturePagedResponse( + UnaryCallable callable, + ListLocationsRequest request, + ApiCallContext context, + ApiFuture futureResponse) { + PageContext pageContext = + PageContext.create(callable, LIST_LOCATIONS_PAGE_STR_DESC, request, context); + return ListLocationsPagedResponse.createAsync(pageContext, futureResponse); + } + }; + /** Returns the object with the settings used for calls to listSessionEntityTypes. */ public PagedCallSettings< ListSessionEntityTypesRequest, @@ -222,6 +284,17 @@ public ApiFuture getFuturePagedResponse( return deleteSessionEntityTypeSettings; } + /** Returns the object with the settings used for calls to listLocations. */ + public PagedCallSettings + listLocationsSettings() { + return listLocationsSettings; + } + + /** Returns the object with the settings used for calls to getLocation. */ + public UnaryCallSettings getLocationSettings() { + return getLocationSettings; + } + public SessionEntityTypesStub createStub() throws IOException { if (getTransportChannelProvider() .getTransportName() @@ -333,6 +406,8 @@ protected SessionEntityTypesStubSettings(Builder settingsBuilder) throws IOExcep createSessionEntityTypeSettings = settingsBuilder.createSessionEntityTypeSettings().build(); updateSessionEntityTypeSettings = settingsBuilder.updateSessionEntityTypeSettings().build(); deleteSessionEntityTypeSettings = settingsBuilder.deleteSessionEntityTypeSettings().build(); + listLocationsSettings = settingsBuilder.listLocationsSettings().build(); + getLocationSettings = settingsBuilder.getLocationSettings().build(); } /** Builder for SessionEntityTypesStubSettings. */ @@ -352,6 +427,10 @@ public static class Builder updateSessionEntityTypeSettings; private final UnaryCallSettings.Builder deleteSessionEntityTypeSettings; + private final PagedCallSettings.Builder< + ListLocationsRequest, ListLocationsResponse, ListLocationsPagedResponse> + listLocationsSettings; + private final UnaryCallSettings.Builder getLocationSettings; private static final ImmutableMap> RETRYABLE_CODE_DEFINITIONS; @@ -396,6 +475,8 @@ protected Builder(ClientContext clientContext) { createSessionEntityTypeSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); updateSessionEntityTypeSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); deleteSessionEntityTypeSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + listLocationsSettings = PagedCallSettings.newBuilder(LIST_LOCATIONS_PAGE_STR_FACT); + getLocationSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); unaryMethodSettingsBuilders = ImmutableList.>of( @@ -403,7 +484,9 @@ protected Builder(ClientContext clientContext) { getSessionEntityTypeSettings, createSessionEntityTypeSettings, updateSessionEntityTypeSettings, - deleteSessionEntityTypeSettings); + deleteSessionEntityTypeSettings, + listLocationsSettings, + getLocationSettings); initDefaults(this); } @@ -415,6 +498,8 @@ protected Builder(SessionEntityTypesStubSettings settings) { createSessionEntityTypeSettings = settings.createSessionEntityTypeSettings.toBuilder(); updateSessionEntityTypeSettings = settings.updateSessionEntityTypeSettings.toBuilder(); deleteSessionEntityTypeSettings = settings.deleteSessionEntityTypeSettings.toBuilder(); + listLocationsSettings = settings.listLocationsSettings.toBuilder(); + getLocationSettings = settings.getLocationSettings.toBuilder(); unaryMethodSettingsBuilders = ImmutableList.>of( @@ -422,7 +507,9 @@ protected Builder(SessionEntityTypesStubSettings settings) { getSessionEntityTypeSettings, createSessionEntityTypeSettings, updateSessionEntityTypeSettings, - deleteSessionEntityTypeSettings); + deleteSessionEntityTypeSettings, + listLocationsSettings, + getLocationSettings); } private static Builder createDefault() { @@ -477,6 +564,16 @@ private static Builder initDefaults(Builder builder) { .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes")) .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params")); + builder + .listLocationsSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params")); + + builder + .getLocationSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params")); + return builder; } @@ -528,6 +625,18 @@ public Builder applyToAllUnaryMethods( return deleteSessionEntityTypeSettings; } + /** Returns the builder for the settings used for calls to listLocations. */ + public PagedCallSettings.Builder< + ListLocationsRequest, ListLocationsResponse, ListLocationsPagedResponse> + listLocationsSettings() { + return listLocationsSettings; + } + + /** Returns the builder for the settings used for calls to getLocation. */ + public UnaryCallSettings.Builder getLocationSettings() { + return getLocationSettings; + } + @Override public SessionEntityTypesStubSettings build() throws IOException { return new SessionEntityTypesStubSettings(this); diff --git a/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2beta1/stub/SessionsStub.java b/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2beta1/stub/SessionsStub.java index 3b358e606..f48ebd5ad 100644 --- a/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2beta1/stub/SessionsStub.java +++ b/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2beta1/stub/SessionsStub.java @@ -16,6 +16,8 @@ package com.google.cloud.dialogflow.v2beta1.stub; +import static com.google.cloud.dialogflow.v2beta1.SessionsClient.ListLocationsPagedResponse; + import com.google.api.core.BetaApi; import com.google.api.gax.core.BackgroundResource; import com.google.api.gax.rpc.BidiStreamingCallable; @@ -24,6 +26,10 @@ import com.google.cloud.dialogflow.v2beta1.DetectIntentResponse; import com.google.cloud.dialogflow.v2beta1.StreamingDetectIntentRequest; import com.google.cloud.dialogflow.v2beta1.StreamingDetectIntentResponse; +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.ListLocationsResponse; +import com.google.cloud.location.Location; import javax.annotation.Generated; // AUTO-GENERATED DOCUMENTATION AND CLASS. @@ -45,6 +51,19 @@ public UnaryCallable detectIntentCall throw new UnsupportedOperationException("Not implemented: streamingDetectIntentCallable()"); } + public UnaryCallable + listLocationsPagedCallable() { + throw new UnsupportedOperationException("Not implemented: listLocationsPagedCallable()"); + } + + public UnaryCallable listLocationsCallable() { + throw new UnsupportedOperationException("Not implemented: listLocationsCallable()"); + } + + public UnaryCallable getLocationCallable() { + throw new UnsupportedOperationException("Not implemented: getLocationCallable()"); + } + @Override public abstract void close(); } diff --git a/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2beta1/stub/SessionsStubSettings.java b/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2beta1/stub/SessionsStubSettings.java index bc8303ccd..aa27edbc6 100644 --- a/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2beta1/stub/SessionsStubSettings.java +++ b/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2beta1/stub/SessionsStubSettings.java @@ -16,7 +16,10 @@ package com.google.cloud.dialogflow.v2beta1.stub; +import static com.google.cloud.dialogflow.v2beta1.SessionsClient.ListLocationsPagedResponse; + import com.google.api.core.ApiFunction; +import com.google.api.core.ApiFuture; import com.google.api.core.BetaApi; import com.google.api.gax.core.GaxProperties; import com.google.api.gax.core.GoogleCredentialsProvider; @@ -28,17 +31,27 @@ import com.google.api.gax.httpjson.HttpJsonTransportChannel; import com.google.api.gax.httpjson.InstantiatingHttpJsonChannelProvider; import com.google.api.gax.retrying.RetrySettings; +import com.google.api.gax.rpc.ApiCallContext; import com.google.api.gax.rpc.ApiClientHeaderProvider; import com.google.api.gax.rpc.ClientContext; +import com.google.api.gax.rpc.PageContext; +import com.google.api.gax.rpc.PagedCallSettings; +import com.google.api.gax.rpc.PagedListDescriptor; +import com.google.api.gax.rpc.PagedListResponseFactory; import com.google.api.gax.rpc.StatusCode; import com.google.api.gax.rpc.StreamingCallSettings; import com.google.api.gax.rpc.StubSettings; import com.google.api.gax.rpc.TransportChannelProvider; import com.google.api.gax.rpc.UnaryCallSettings; +import com.google.api.gax.rpc.UnaryCallable; import com.google.cloud.dialogflow.v2beta1.DetectIntentRequest; import com.google.cloud.dialogflow.v2beta1.DetectIntentResponse; import com.google.cloud.dialogflow.v2beta1.StreamingDetectIntentRequest; import com.google.cloud.dialogflow.v2beta1.StreamingDetectIntentResponse; +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.ListLocationsResponse; +import com.google.cloud.location.Location; import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableMap; import com.google.common.collect.ImmutableSet; @@ -94,6 +107,63 @@ public class SessionsStubSettings extends StubSettings { private final UnaryCallSettings detectIntentSettings; private final StreamingCallSettings streamingDetectIntentSettings; + private final PagedCallSettings< + ListLocationsRequest, ListLocationsResponse, ListLocationsPagedResponse> + listLocationsSettings; + private final UnaryCallSettings getLocationSettings; + + private static final PagedListDescriptor + LIST_LOCATIONS_PAGE_STR_DESC = + new PagedListDescriptor() { + @Override + public String emptyToken() { + return ""; + } + + @Override + public ListLocationsRequest injectToken(ListLocationsRequest payload, String token) { + return ListLocationsRequest.newBuilder(payload).setPageToken(token).build(); + } + + @Override + public ListLocationsRequest injectPageSize(ListLocationsRequest payload, int pageSize) { + return ListLocationsRequest.newBuilder(payload).setPageSize(pageSize).build(); + } + + @Override + public Integer extractPageSize(ListLocationsRequest payload) { + return payload.getPageSize(); + } + + @Override + public String extractNextToken(ListLocationsResponse payload) { + return payload.getNextPageToken(); + } + + @Override + public Iterable extractResources(ListLocationsResponse payload) { + return payload.getLocationsList() == null + ? ImmutableList.of() + : payload.getLocationsList(); + } + }; + + private static final PagedListResponseFactory< + ListLocationsRequest, ListLocationsResponse, ListLocationsPagedResponse> + LIST_LOCATIONS_PAGE_STR_FACT = + new PagedListResponseFactory< + ListLocationsRequest, ListLocationsResponse, ListLocationsPagedResponse>() { + @Override + public ApiFuture getFuturePagedResponse( + UnaryCallable callable, + ListLocationsRequest request, + ApiCallContext context, + ApiFuture futureResponse) { + PageContext pageContext = + PageContext.create(callable, LIST_LOCATIONS_PAGE_STR_DESC, request, context); + return ListLocationsPagedResponse.createAsync(pageContext, futureResponse); + } + }; /** Returns the object with the settings used for calls to detectIntent. */ public UnaryCallSettings detectIntentSettings() { @@ -106,6 +176,17 @@ public UnaryCallSettings detectIntent return streamingDetectIntentSettings; } + /** Returns the object with the settings used for calls to listLocations. */ + public PagedCallSettings + listLocationsSettings() { + return listLocationsSettings; + } + + /** Returns the object with the settings used for calls to getLocation. */ + public UnaryCallSettings getLocationSettings() { + return getLocationSettings; + } + public SessionsStub createStub() throws IOException { if (getTransportChannelProvider() .getTransportName() @@ -212,6 +293,8 @@ protected SessionsStubSettings(Builder settingsBuilder) throws IOException { detectIntentSettings = settingsBuilder.detectIntentSettings().build(); streamingDetectIntentSettings = settingsBuilder.streamingDetectIntentSettings().build(); + listLocationsSettings = settingsBuilder.listLocationsSettings().build(); + getLocationSettings = settingsBuilder.getLocationSettings().build(); } /** Builder for SessionsStubSettings. */ @@ -222,6 +305,10 @@ public static class Builder extends StubSettings.Builder streamingDetectIntentSettings; + private final PagedCallSettings.Builder< + ListLocationsRequest, ListLocationsResponse, ListLocationsPagedResponse> + listLocationsSettings; + private final UnaryCallSettings.Builder getLocationSettings; private static final ImmutableMap> RETRYABLE_CODE_DEFINITIONS; @@ -233,6 +320,9 @@ public static class Builder extends StubSettings.BuildernewArrayList(StatusCode.Code.UNAVAILABLE))); definitions.put( "no_retry_3_codes", ImmutableSet.copyOf(Lists.newArrayList())); + definitions.put( + "retry_policy_0_codes", + ImmutableSet.copyOf(Lists.newArrayList(StatusCode.Code.UNAVAILABLE))); RETRYABLE_CODE_DEFINITIONS = definitions.build(); } @@ -260,6 +350,17 @@ public static class Builder extends StubSettings.Builder>of(detectIntentSettings); + ImmutableList.>of( + detectIntentSettings, listLocationsSettings, getLocationSettings); initDefaults(this); } @@ -283,9 +387,12 @@ protected Builder(SessionsStubSettings settings) { detectIntentSettings = settings.detectIntentSettings.toBuilder(); streamingDetectIntentSettings = settings.streamingDetectIntentSettings.toBuilder(); + listLocationsSettings = settings.listLocationsSettings.toBuilder(); + getLocationSettings = settings.getLocationSettings.toBuilder(); unaryMethodSettingsBuilders = - ImmutableList.>of(detectIntentSettings); + ImmutableList.>of( + detectIntentSettings, listLocationsSettings, getLocationSettings); } private static Builder createDefault() { @@ -320,6 +427,16 @@ private static Builder initDefaults(Builder builder) { .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_2_codes")) .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_2_params")); + builder + .listLocationsSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params")); + + builder + .getLocationSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params")); + return builder; } @@ -351,6 +468,18 @@ public Builder applyToAllUnaryMethods( return streamingDetectIntentSettings; } + /** Returns the builder for the settings used for calls to listLocations. */ + public PagedCallSettings.Builder< + ListLocationsRequest, ListLocationsResponse, ListLocationsPagedResponse> + listLocationsSettings() { + return listLocationsSettings; + } + + /** Returns the builder for the settings used for calls to getLocation. */ + public UnaryCallSettings.Builder getLocationSettings() { + return getLocationSettings; + } + @Override public SessionsStubSettings build() throws IOException { return new SessionsStubSettings(this); diff --git a/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2beta1/stub/VersionsStub.java b/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2beta1/stub/VersionsStub.java index c70884782..0217a7d8c 100644 --- a/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2beta1/stub/VersionsStub.java +++ b/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2beta1/stub/VersionsStub.java @@ -16,6 +16,7 @@ package com.google.cloud.dialogflow.v2beta1.stub; +import static com.google.cloud.dialogflow.v2beta1.VersionsClient.ListLocationsPagedResponse; import static com.google.cloud.dialogflow.v2beta1.VersionsClient.ListVersionsPagedResponse; import com.google.api.core.BetaApi; @@ -28,6 +29,10 @@ import com.google.cloud.dialogflow.v2beta1.ListVersionsResponse; import com.google.cloud.dialogflow.v2beta1.UpdateVersionRequest; import com.google.cloud.dialogflow.v2beta1.Version; +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.ListLocationsResponse; +import com.google.cloud.location.Location; import com.google.protobuf.Empty; import javax.annotation.Generated; @@ -65,6 +70,19 @@ public UnaryCallable deleteVersionCallable() { throw new UnsupportedOperationException("Not implemented: deleteVersionCallable()"); } + public UnaryCallable + listLocationsPagedCallable() { + throw new UnsupportedOperationException("Not implemented: listLocationsPagedCallable()"); + } + + public UnaryCallable listLocationsCallable() { + throw new UnsupportedOperationException("Not implemented: listLocationsCallable()"); + } + + public UnaryCallable getLocationCallable() { + throw new UnsupportedOperationException("Not implemented: getLocationCallable()"); + } + @Override public abstract void close(); } diff --git a/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2beta1/stub/VersionsStubSettings.java b/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2beta1/stub/VersionsStubSettings.java index 2ef329644..24c96a72c 100644 --- a/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2beta1/stub/VersionsStubSettings.java +++ b/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2beta1/stub/VersionsStubSettings.java @@ -16,6 +16,7 @@ package com.google.cloud.dialogflow.v2beta1.stub; +import static com.google.cloud.dialogflow.v2beta1.VersionsClient.ListLocationsPagedResponse; import static com.google.cloud.dialogflow.v2beta1.VersionsClient.ListVersionsPagedResponse; import com.google.api.core.ApiFunction; @@ -50,6 +51,10 @@ import com.google.cloud.dialogflow.v2beta1.ListVersionsResponse; import com.google.cloud.dialogflow.v2beta1.UpdateVersionRequest; import com.google.cloud.dialogflow.v2beta1.Version; +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.ListLocationsResponse; +import com.google.cloud.location.Location; import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableMap; import com.google.common.collect.ImmutableSet; @@ -110,6 +115,10 @@ public class VersionsStubSettings extends StubSettings { private final UnaryCallSettings createVersionSettings; private final UnaryCallSettings updateVersionSettings; private final UnaryCallSettings deleteVersionSettings; + private final PagedCallSettings< + ListLocationsRequest, ListLocationsResponse, ListLocationsPagedResponse> + listLocationsSettings; + private final UnaryCallSettings getLocationSettings; private static final PagedListDescriptor LIST_VERSIONS_PAGE_STR_DESC = @@ -147,6 +156,42 @@ public Iterable extractResources(ListVersionsResponse payload) { } }; + private static final PagedListDescriptor + LIST_LOCATIONS_PAGE_STR_DESC = + new PagedListDescriptor() { + @Override + public String emptyToken() { + return ""; + } + + @Override + public ListLocationsRequest injectToken(ListLocationsRequest payload, String token) { + return ListLocationsRequest.newBuilder(payload).setPageToken(token).build(); + } + + @Override + public ListLocationsRequest injectPageSize(ListLocationsRequest payload, int pageSize) { + return ListLocationsRequest.newBuilder(payload).setPageSize(pageSize).build(); + } + + @Override + public Integer extractPageSize(ListLocationsRequest payload) { + return payload.getPageSize(); + } + + @Override + public String extractNextToken(ListLocationsResponse payload) { + return payload.getNextPageToken(); + } + + @Override + public Iterable extractResources(ListLocationsResponse payload) { + return payload.getLocationsList() == null + ? ImmutableList.of() + : payload.getLocationsList(); + } + }; + private static final PagedListResponseFactory< ListVersionsRequest, ListVersionsResponse, ListVersionsPagedResponse> LIST_VERSIONS_PAGE_STR_FACT = @@ -164,6 +209,23 @@ public ApiFuture getFuturePagedResponse( } }; + private static final PagedListResponseFactory< + ListLocationsRequest, ListLocationsResponse, ListLocationsPagedResponse> + LIST_LOCATIONS_PAGE_STR_FACT = + new PagedListResponseFactory< + ListLocationsRequest, ListLocationsResponse, ListLocationsPagedResponse>() { + @Override + public ApiFuture getFuturePagedResponse( + UnaryCallable callable, + ListLocationsRequest request, + ApiCallContext context, + ApiFuture futureResponse) { + PageContext pageContext = + PageContext.create(callable, LIST_LOCATIONS_PAGE_STR_DESC, request, context); + return ListLocationsPagedResponse.createAsync(pageContext, futureResponse); + } + }; + /** Returns the object with the settings used for calls to listVersions. */ public PagedCallSettings listVersionsSettings() { @@ -190,6 +252,17 @@ public UnaryCallSettings deleteVersionSettings() { return deleteVersionSettings; } + /** Returns the object with the settings used for calls to listLocations. */ + public PagedCallSettings + listLocationsSettings() { + return listLocationsSettings; + } + + /** Returns the object with the settings used for calls to getLocation. */ + public UnaryCallSettings getLocationSettings() { + return getLocationSettings; + } + public VersionsStub createStub() throws IOException { if (getTransportChannelProvider() .getTransportName() @@ -299,6 +372,8 @@ protected VersionsStubSettings(Builder settingsBuilder) throws IOException { createVersionSettings = settingsBuilder.createVersionSettings().build(); updateVersionSettings = settingsBuilder.updateVersionSettings().build(); deleteVersionSettings = settingsBuilder.deleteVersionSettings().build(); + listLocationsSettings = settingsBuilder.listLocationsSettings().build(); + getLocationSettings = settingsBuilder.getLocationSettings().build(); } /** Builder for VersionsStubSettings. */ @@ -311,6 +386,10 @@ public static class Builder extends StubSettings.Builder createVersionSettings; private final UnaryCallSettings.Builder updateVersionSettings; private final UnaryCallSettings.Builder deleteVersionSettings; + private final PagedCallSettings.Builder< + ListLocationsRequest, ListLocationsResponse, ListLocationsPagedResponse> + listLocationsSettings; + private final UnaryCallSettings.Builder getLocationSettings; private static final ImmutableMap> RETRYABLE_CODE_DEFINITIONS; @@ -354,6 +433,8 @@ protected Builder(ClientContext clientContext) { createVersionSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); updateVersionSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); deleteVersionSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + listLocationsSettings = PagedCallSettings.newBuilder(LIST_LOCATIONS_PAGE_STR_FACT); + getLocationSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); unaryMethodSettingsBuilders = ImmutableList.>of( @@ -361,7 +442,9 @@ protected Builder(ClientContext clientContext) { getVersionSettings, createVersionSettings, updateVersionSettings, - deleteVersionSettings); + deleteVersionSettings, + listLocationsSettings, + getLocationSettings); initDefaults(this); } @@ -373,6 +456,8 @@ protected Builder(VersionsStubSettings settings) { createVersionSettings = settings.createVersionSettings.toBuilder(); updateVersionSettings = settings.updateVersionSettings.toBuilder(); deleteVersionSettings = settings.deleteVersionSettings.toBuilder(); + listLocationsSettings = settings.listLocationsSettings.toBuilder(); + getLocationSettings = settings.getLocationSettings.toBuilder(); unaryMethodSettingsBuilders = ImmutableList.>of( @@ -380,7 +465,9 @@ protected Builder(VersionsStubSettings settings) { getVersionSettings, createVersionSettings, updateVersionSettings, - deleteVersionSettings); + deleteVersionSettings, + listLocationsSettings, + getLocationSettings); } private static Builder createDefault() { @@ -435,6 +522,16 @@ private static Builder initDefaults(Builder builder) { .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes")) .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params")); + builder + .listLocationsSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params")); + + builder + .getLocationSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params")); + return builder; } @@ -480,6 +577,18 @@ public UnaryCallSettings.Builder deleteVersionSetti return deleteVersionSettings; } + /** Returns the builder for the settings used for calls to listLocations. */ + public PagedCallSettings.Builder< + ListLocationsRequest, ListLocationsResponse, ListLocationsPagedResponse> + listLocationsSettings() { + return listLocationsSettings; + } + + /** Returns the builder for the settings used for calls to getLocation. */ + public UnaryCallSettings.Builder getLocationSettings() { + return getLocationSettings; + } + @Override public VersionsStubSettings build() throws IOException { return new VersionsStubSettings(this); diff --git a/google-cloud-dialogflow/src/test/java/com/google/cloud/dialogflow/v2/AgentsClientHttpJsonTest.java b/google-cloud-dialogflow/src/test/java/com/google/cloud/dialogflow/v2/AgentsClientHttpJsonTest.java index cf00bff08..aab13ef9d 100644 --- a/google-cloud-dialogflow/src/test/java/com/google/cloud/dialogflow/v2/AgentsClientHttpJsonTest.java +++ b/google-cloud-dialogflow/src/test/java/com/google/cloud/dialogflow/v2/AgentsClientHttpJsonTest.java @@ -16,6 +16,7 @@ package com.google.cloud.dialogflow.v2; +import static com.google.cloud.dialogflow.v2.AgentsClient.ListLocationsPagedResponse; import static com.google.cloud.dialogflow.v2.AgentsClient.SearchAgentsPagedResponse; import com.google.api.gax.core.NoCredentialsProvider; @@ -28,6 +29,10 @@ import com.google.api.gax.rpc.StatusCode; import com.google.api.gax.rpc.testing.FakeStatusCode; import com.google.cloud.dialogflow.v2.stub.HttpJsonAgentsStub; +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.ListLocationsResponse; +import com.google.cloud.location.Location; import com.google.common.collect.Lists; import com.google.longrunning.Operation; import com.google.protobuf.Any; @@ -35,6 +40,7 @@ import java.io.IOException; import java.util.ArrayList; import java.util.Arrays; +import java.util.HashMap; import java.util.List; import java.util.concurrent.ExecutionException; import javax.annotation.Generated; @@ -999,4 +1005,120 @@ public void getValidationResultExceptionTest() throws Exception { // Expected exception. } } + + @Test + public void listLocationsTest() throws Exception { + Location responsesElement = Location.newBuilder().build(); + ListLocationsResponse expectedResponse = + ListLocationsResponse.newBuilder() + .setNextPageToken("") + .addAllLocations(Arrays.asList(responsesElement)) + .build(); + mockService.addResponse(expectedResponse); + + ListLocationsRequest request = + ListLocationsRequest.newBuilder() + .setName("projects/project-3664") + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + + ListLocationsPagedResponse pagedListResponse = client.listLocations(request); + + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getLocationsList().get(0), resources.get(0)); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void listLocationsExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + ListLocationsRequest request = + ListLocationsRequest.newBuilder() + .setName("projects/project-3664") + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + client.listLocations(request); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void getLocationTest() throws Exception { + Location expectedResponse = + Location.newBuilder() + .setName("name3373707") + .setLocationId("locationId1541836720") + .setDisplayName("displayName1714148973") + .putAllLabels(new HashMap()) + .setMetadata(Any.newBuilder().build()) + .build(); + mockService.addResponse(expectedResponse); + + GetLocationRequest request = + GetLocationRequest.newBuilder() + .setName("projects/project-9062/locations/location-9062") + .build(); + + Location actualResponse = client.getLocation(request); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void getLocationExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + GetLocationRequest request = + GetLocationRequest.newBuilder() + .setName("projects/project-9062/locations/location-9062") + .build(); + client.getLocation(request); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } } diff --git a/google-cloud-dialogflow/src/test/java/com/google/cloud/dialogflow/v2/AgentsClientTest.java b/google-cloud-dialogflow/src/test/java/com/google/cloud/dialogflow/v2/AgentsClientTest.java index a02352a0a..a648e3207 100644 --- a/google-cloud-dialogflow/src/test/java/com/google/cloud/dialogflow/v2/AgentsClientTest.java +++ b/google-cloud-dialogflow/src/test/java/com/google/cloud/dialogflow/v2/AgentsClientTest.java @@ -16,6 +16,7 @@ package com.google.cloud.dialogflow.v2; +import static com.google.cloud.dialogflow.v2.AgentsClient.ListLocationsPagedResponse; import static com.google.cloud.dialogflow.v2.AgentsClient.SearchAgentsPagedResponse; import com.google.api.gax.core.NoCredentialsProvider; @@ -26,6 +27,10 @@ import com.google.api.gax.rpc.ApiClientHeaderProvider; import com.google.api.gax.rpc.InvalidArgumentException; import com.google.api.gax.rpc.StatusCode; +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.ListLocationsResponse; +import com.google.cloud.location.Location; import com.google.common.collect.Lists; import com.google.longrunning.Operation; import com.google.protobuf.AbstractMessage; @@ -35,6 +40,7 @@ import java.io.IOException; import java.util.ArrayList; import java.util.Arrays; +import java.util.HashMap; import java.util.List; import java.util.UUID; import java.util.concurrent.ExecutionException; @@ -49,6 +55,7 @@ @Generated("by gapic-generator-java") public class AgentsClientTest { private static MockAgents mockAgents; + private static MockLocations mockLocations; private static MockServiceHelper mockServiceHelper; private LocalChannelProvider channelProvider; private AgentsClient client; @@ -56,9 +63,11 @@ public class AgentsClientTest { @BeforeClass public static void startStaticServer() { mockAgents = new MockAgents(); + mockLocations = new MockLocations(); mockServiceHelper = new MockServiceHelper( - UUID.randomUUID().toString(), Arrays.asList(mockAgents)); + UUID.randomUUID().toString(), + Arrays.asList(mockAgents, mockLocations)); mockServiceHelper.start(); } @@ -897,4 +906,105 @@ public void getValidationResultExceptionTest() throws Exception { // Expected exception. } } + + @Test + public void listLocationsTest() throws Exception { + Location responsesElement = Location.newBuilder().build(); + ListLocationsResponse expectedResponse = + ListLocationsResponse.newBuilder() + .setNextPageToken("") + .addAllLocations(Arrays.asList(responsesElement)) + .build(); + mockLocations.addResponse(expectedResponse); + + ListLocationsRequest request = + ListLocationsRequest.newBuilder() + .setName("name3373707") + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + + ListLocationsPagedResponse pagedListResponse = client.listLocations(request); + + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getLocationsList().get(0), resources.get(0)); + + List actualRequests = mockLocations.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + ListLocationsRequest actualRequest = ((ListLocationsRequest) actualRequests.get(0)); + + Assert.assertEquals(request.getName(), actualRequest.getName()); + Assert.assertEquals(request.getFilter(), actualRequest.getFilter()); + Assert.assertEquals(request.getPageSize(), actualRequest.getPageSize()); + Assert.assertEquals(request.getPageToken(), actualRequest.getPageToken()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void listLocationsExceptionTest() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockLocations.addException(exception); + + try { + ListLocationsRequest request = + ListLocationsRequest.newBuilder() + .setName("name3373707") + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + client.listLocations(request); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void getLocationTest() throws Exception { + Location expectedResponse = + Location.newBuilder() + .setName("name3373707") + .setLocationId("locationId1541836720") + .setDisplayName("displayName1714148973") + .putAllLabels(new HashMap()) + .setMetadata(Any.newBuilder().build()) + .build(); + mockLocations.addResponse(expectedResponse); + + GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build(); + + Location actualResponse = client.getLocation(request); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockLocations.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + GetLocationRequest actualRequest = ((GetLocationRequest) actualRequests.get(0)); + + Assert.assertEquals(request.getName(), actualRequest.getName()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void getLocationExceptionTest() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockLocations.addException(exception); + + try { + GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build(); + client.getLocation(request); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } } diff --git a/google-cloud-dialogflow/src/test/java/com/google/cloud/dialogflow/v2/AnswerRecordsClientHttpJsonTest.java b/google-cloud-dialogflow/src/test/java/com/google/cloud/dialogflow/v2/AnswerRecordsClientHttpJsonTest.java index 6ef2b4865..293220695 100644 --- a/google-cloud-dialogflow/src/test/java/com/google/cloud/dialogflow/v2/AnswerRecordsClientHttpJsonTest.java +++ b/google-cloud-dialogflow/src/test/java/com/google/cloud/dialogflow/v2/AnswerRecordsClientHttpJsonTest.java @@ -17,6 +17,7 @@ package com.google.cloud.dialogflow.v2; import static com.google.cloud.dialogflow.v2.AnswerRecordsClient.ListAnswerRecordsPagedResponse; +import static com.google.cloud.dialogflow.v2.AnswerRecordsClient.ListLocationsPagedResponse; import com.google.api.gax.core.NoCredentialsProvider; import com.google.api.gax.httpjson.GaxHttpJsonProperties; @@ -28,10 +29,16 @@ import com.google.api.gax.rpc.StatusCode; import com.google.api.gax.rpc.testing.FakeStatusCode; import com.google.cloud.dialogflow.v2.stub.HttpJsonAnswerRecordsStub; +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.ListLocationsResponse; +import com.google.cloud.location.Location; import com.google.common.collect.Lists; +import com.google.protobuf.Any; import com.google.protobuf.FieldMask; import java.io.IOException; import java.util.Arrays; +import java.util.HashMap; import java.util.List; import javax.annotation.Generated; import org.junit.After; @@ -286,4 +293,120 @@ public void updateAnswerRecordExceptionTest() throws Exception { // Expected exception. } } + + @Test + public void listLocationsTest() throws Exception { + Location responsesElement = Location.newBuilder().build(); + ListLocationsResponse expectedResponse = + ListLocationsResponse.newBuilder() + .setNextPageToken("") + .addAllLocations(Arrays.asList(responsesElement)) + .build(); + mockService.addResponse(expectedResponse); + + ListLocationsRequest request = + ListLocationsRequest.newBuilder() + .setName("projects/project-3664") + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + + ListLocationsPagedResponse pagedListResponse = client.listLocations(request); + + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getLocationsList().get(0), resources.get(0)); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void listLocationsExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + ListLocationsRequest request = + ListLocationsRequest.newBuilder() + .setName("projects/project-3664") + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + client.listLocations(request); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void getLocationTest() throws Exception { + Location expectedResponse = + Location.newBuilder() + .setName("name3373707") + .setLocationId("locationId1541836720") + .setDisplayName("displayName1714148973") + .putAllLabels(new HashMap()) + .setMetadata(Any.newBuilder().build()) + .build(); + mockService.addResponse(expectedResponse); + + GetLocationRequest request = + GetLocationRequest.newBuilder() + .setName("projects/project-9062/locations/location-9062") + .build(); + + Location actualResponse = client.getLocation(request); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void getLocationExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + GetLocationRequest request = + GetLocationRequest.newBuilder() + .setName("projects/project-9062/locations/location-9062") + .build(); + client.getLocation(request); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } } diff --git a/google-cloud-dialogflow/src/test/java/com/google/cloud/dialogflow/v2/AnswerRecordsClientTest.java b/google-cloud-dialogflow/src/test/java/com/google/cloud/dialogflow/v2/AnswerRecordsClientTest.java index 3621803ba..e82bca647 100644 --- a/google-cloud-dialogflow/src/test/java/com/google/cloud/dialogflow/v2/AnswerRecordsClientTest.java +++ b/google-cloud-dialogflow/src/test/java/com/google/cloud/dialogflow/v2/AnswerRecordsClientTest.java @@ -17,6 +17,7 @@ package com.google.cloud.dialogflow.v2; import static com.google.cloud.dialogflow.v2.AnswerRecordsClient.ListAnswerRecordsPagedResponse; +import static com.google.cloud.dialogflow.v2.AnswerRecordsClient.ListLocationsPagedResponse; import com.google.api.gax.core.NoCredentialsProvider; import com.google.api.gax.grpc.GaxGrpcProperties; @@ -25,12 +26,18 @@ import com.google.api.gax.grpc.testing.MockServiceHelper; import com.google.api.gax.rpc.ApiClientHeaderProvider; import com.google.api.gax.rpc.InvalidArgumentException; +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.ListLocationsResponse; +import com.google.cloud.location.Location; import com.google.common.collect.Lists; import com.google.protobuf.AbstractMessage; +import com.google.protobuf.Any; import com.google.protobuf.FieldMask; import io.grpc.StatusRuntimeException; import java.io.IOException; import java.util.Arrays; +import java.util.HashMap; import java.util.List; import java.util.UUID; import javax.annotation.Generated; @@ -44,6 +51,7 @@ @Generated("by gapic-generator-java") public class AnswerRecordsClientTest { private static MockAnswerRecords mockAnswerRecords; + private static MockLocations mockLocations; private static MockServiceHelper mockServiceHelper; private LocalChannelProvider channelProvider; private AnswerRecordsClient client; @@ -51,9 +59,11 @@ public class AnswerRecordsClientTest { @BeforeClass public static void startStaticServer() { mockAnswerRecords = new MockAnswerRecords(); + mockLocations = new MockLocations(); mockServiceHelper = new MockServiceHelper( - UUID.randomUUID().toString(), Arrays.asList(mockAnswerRecords)); + UUID.randomUUID().toString(), + Arrays.asList(mockAnswerRecords, mockLocations)); mockServiceHelper.start(); } @@ -254,4 +264,105 @@ public void updateAnswerRecordExceptionTest() throws Exception { // Expected exception. } } + + @Test + public void listLocationsTest() throws Exception { + Location responsesElement = Location.newBuilder().build(); + ListLocationsResponse expectedResponse = + ListLocationsResponse.newBuilder() + .setNextPageToken("") + .addAllLocations(Arrays.asList(responsesElement)) + .build(); + mockLocations.addResponse(expectedResponse); + + ListLocationsRequest request = + ListLocationsRequest.newBuilder() + .setName("name3373707") + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + + ListLocationsPagedResponse pagedListResponse = client.listLocations(request); + + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getLocationsList().get(0), resources.get(0)); + + List actualRequests = mockLocations.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + ListLocationsRequest actualRequest = ((ListLocationsRequest) actualRequests.get(0)); + + Assert.assertEquals(request.getName(), actualRequest.getName()); + Assert.assertEquals(request.getFilter(), actualRequest.getFilter()); + Assert.assertEquals(request.getPageSize(), actualRequest.getPageSize()); + Assert.assertEquals(request.getPageToken(), actualRequest.getPageToken()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void listLocationsExceptionTest() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockLocations.addException(exception); + + try { + ListLocationsRequest request = + ListLocationsRequest.newBuilder() + .setName("name3373707") + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + client.listLocations(request); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void getLocationTest() throws Exception { + Location expectedResponse = + Location.newBuilder() + .setName("name3373707") + .setLocationId("locationId1541836720") + .setDisplayName("displayName1714148973") + .putAllLabels(new HashMap()) + .setMetadata(Any.newBuilder().build()) + .build(); + mockLocations.addResponse(expectedResponse); + + GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build(); + + Location actualResponse = client.getLocation(request); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockLocations.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + GetLocationRequest actualRequest = ((GetLocationRequest) actualRequests.get(0)); + + Assert.assertEquals(request.getName(), actualRequest.getName()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void getLocationExceptionTest() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockLocations.addException(exception); + + try { + GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build(); + client.getLocation(request); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } } diff --git a/google-cloud-dialogflow/src/test/java/com/google/cloud/dialogflow/v2/ContextsClientHttpJsonTest.java b/google-cloud-dialogflow/src/test/java/com/google/cloud/dialogflow/v2/ContextsClientHttpJsonTest.java index dff62b938..296f9179a 100644 --- a/google-cloud-dialogflow/src/test/java/com/google/cloud/dialogflow/v2/ContextsClientHttpJsonTest.java +++ b/google-cloud-dialogflow/src/test/java/com/google/cloud/dialogflow/v2/ContextsClientHttpJsonTest.java @@ -17,6 +17,7 @@ package com.google.cloud.dialogflow.v2; import static com.google.cloud.dialogflow.v2.ContextsClient.ListContextsPagedResponse; +import static com.google.cloud.dialogflow.v2.ContextsClient.ListLocationsPagedResponse; import com.google.api.gax.core.NoCredentialsProvider; import com.google.api.gax.httpjson.GaxHttpJsonProperties; @@ -28,12 +29,18 @@ import com.google.api.gax.rpc.StatusCode; import com.google.api.gax.rpc.testing.FakeStatusCode; import com.google.cloud.dialogflow.v2.stub.HttpJsonContextsStub; +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.ListLocationsResponse; +import com.google.cloud.location.Location; import com.google.common.collect.Lists; +import com.google.protobuf.Any; import com.google.protobuf.Empty; import com.google.protobuf.FieldMask; import com.google.protobuf.Struct; import java.io.IOException; import java.util.Arrays; +import java.util.HashMap; import java.util.List; import javax.annotation.Generated; import org.junit.After; @@ -600,4 +607,120 @@ public void deleteAllContextsExceptionTest2() throws Exception { // Expected exception. } } + + @Test + public void listLocationsTest() throws Exception { + Location responsesElement = Location.newBuilder().build(); + ListLocationsResponse expectedResponse = + ListLocationsResponse.newBuilder() + .setNextPageToken("") + .addAllLocations(Arrays.asList(responsesElement)) + .build(); + mockService.addResponse(expectedResponse); + + ListLocationsRequest request = + ListLocationsRequest.newBuilder() + .setName("projects/project-3664") + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + + ListLocationsPagedResponse pagedListResponse = client.listLocations(request); + + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getLocationsList().get(0), resources.get(0)); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void listLocationsExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + ListLocationsRequest request = + ListLocationsRequest.newBuilder() + .setName("projects/project-3664") + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + client.listLocations(request); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void getLocationTest() throws Exception { + Location expectedResponse = + Location.newBuilder() + .setName("name3373707") + .setLocationId("locationId1541836720") + .setDisplayName("displayName1714148973") + .putAllLabels(new HashMap()) + .setMetadata(Any.newBuilder().build()) + .build(); + mockService.addResponse(expectedResponse); + + GetLocationRequest request = + GetLocationRequest.newBuilder() + .setName("projects/project-9062/locations/location-9062") + .build(); + + Location actualResponse = client.getLocation(request); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void getLocationExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + GetLocationRequest request = + GetLocationRequest.newBuilder() + .setName("projects/project-9062/locations/location-9062") + .build(); + client.getLocation(request); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } } diff --git a/google-cloud-dialogflow/src/test/java/com/google/cloud/dialogflow/v2/ContextsClientTest.java b/google-cloud-dialogflow/src/test/java/com/google/cloud/dialogflow/v2/ContextsClientTest.java index b1440a53b..b40146e00 100644 --- a/google-cloud-dialogflow/src/test/java/com/google/cloud/dialogflow/v2/ContextsClientTest.java +++ b/google-cloud-dialogflow/src/test/java/com/google/cloud/dialogflow/v2/ContextsClientTest.java @@ -17,6 +17,7 @@ package com.google.cloud.dialogflow.v2; import static com.google.cloud.dialogflow.v2.ContextsClient.ListContextsPagedResponse; +import static com.google.cloud.dialogflow.v2.ContextsClient.ListLocationsPagedResponse; import com.google.api.gax.core.NoCredentialsProvider; import com.google.api.gax.grpc.GaxGrpcProperties; @@ -25,14 +26,20 @@ import com.google.api.gax.grpc.testing.MockServiceHelper; import com.google.api.gax.rpc.ApiClientHeaderProvider; import com.google.api.gax.rpc.InvalidArgumentException; +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.ListLocationsResponse; +import com.google.cloud.location.Location; import com.google.common.collect.Lists; import com.google.protobuf.AbstractMessage; +import com.google.protobuf.Any; import com.google.protobuf.Empty; import com.google.protobuf.FieldMask; import com.google.protobuf.Struct; import io.grpc.StatusRuntimeException; import java.io.IOException; import java.util.Arrays; +import java.util.HashMap; import java.util.List; import java.util.UUID; import javax.annotation.Generated; @@ -46,6 +53,7 @@ @Generated("by gapic-generator-java") public class ContextsClientTest { private static MockContexts mockContexts; + private static MockLocations mockLocations; private static MockServiceHelper mockServiceHelper; private LocalChannelProvider channelProvider; private ContextsClient client; @@ -53,9 +61,11 @@ public class ContextsClientTest { @BeforeClass public static void startStaticServer() { mockContexts = new MockContexts(); + mockLocations = new MockLocations(); mockServiceHelper = new MockServiceHelper( - UUID.randomUUID().toString(), Arrays.asList(mockContexts)); + UUID.randomUUID().toString(), + Arrays.asList(mockContexts, mockLocations)); mockServiceHelper.start(); } @@ -527,4 +537,105 @@ public void deleteAllContextsExceptionTest2() throws Exception { // Expected exception. } } + + @Test + public void listLocationsTest() throws Exception { + Location responsesElement = Location.newBuilder().build(); + ListLocationsResponse expectedResponse = + ListLocationsResponse.newBuilder() + .setNextPageToken("") + .addAllLocations(Arrays.asList(responsesElement)) + .build(); + mockLocations.addResponse(expectedResponse); + + ListLocationsRequest request = + ListLocationsRequest.newBuilder() + .setName("name3373707") + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + + ListLocationsPagedResponse pagedListResponse = client.listLocations(request); + + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getLocationsList().get(0), resources.get(0)); + + List actualRequests = mockLocations.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + ListLocationsRequest actualRequest = ((ListLocationsRequest) actualRequests.get(0)); + + Assert.assertEquals(request.getName(), actualRequest.getName()); + Assert.assertEquals(request.getFilter(), actualRequest.getFilter()); + Assert.assertEquals(request.getPageSize(), actualRequest.getPageSize()); + Assert.assertEquals(request.getPageToken(), actualRequest.getPageToken()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void listLocationsExceptionTest() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockLocations.addException(exception); + + try { + ListLocationsRequest request = + ListLocationsRequest.newBuilder() + .setName("name3373707") + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + client.listLocations(request); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void getLocationTest() throws Exception { + Location expectedResponse = + Location.newBuilder() + .setName("name3373707") + .setLocationId("locationId1541836720") + .setDisplayName("displayName1714148973") + .putAllLabels(new HashMap()) + .setMetadata(Any.newBuilder().build()) + .build(); + mockLocations.addResponse(expectedResponse); + + GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build(); + + Location actualResponse = client.getLocation(request); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockLocations.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + GetLocationRequest actualRequest = ((GetLocationRequest) actualRequests.get(0)); + + Assert.assertEquals(request.getName(), actualRequest.getName()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void getLocationExceptionTest() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockLocations.addException(exception); + + try { + GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build(); + client.getLocation(request); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } } diff --git a/google-cloud-dialogflow/src/test/java/com/google/cloud/dialogflow/v2/ConversationDatasetsClientHttpJsonTest.java b/google-cloud-dialogflow/src/test/java/com/google/cloud/dialogflow/v2/ConversationDatasetsClientHttpJsonTest.java index a0b2498d2..046fca3bd 100644 --- a/google-cloud-dialogflow/src/test/java/com/google/cloud/dialogflow/v2/ConversationDatasetsClientHttpJsonTest.java +++ b/google-cloud-dialogflow/src/test/java/com/google/cloud/dialogflow/v2/ConversationDatasetsClientHttpJsonTest.java @@ -17,6 +17,7 @@ package com.google.cloud.dialogflow.v2; import static com.google.cloud.dialogflow.v2.ConversationDatasetsClient.ListConversationDatasetsPagedResponse; +import static com.google.cloud.dialogflow.v2.ConversationDatasetsClient.ListLocationsPagedResponse; import com.google.api.gax.core.NoCredentialsProvider; import com.google.api.gax.httpjson.GaxHttpJsonProperties; @@ -28,6 +29,10 @@ import com.google.api.gax.rpc.StatusCode; import com.google.api.gax.rpc.testing.FakeStatusCode; import com.google.cloud.dialogflow.v2.stub.HttpJsonConversationDatasetsStub; +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.ListLocationsResponse; +import com.google.cloud.location.Location; import com.google.common.collect.Lists; import com.google.longrunning.Operation; import com.google.protobuf.Any; @@ -35,6 +40,7 @@ import com.google.protobuf.Timestamp; import java.io.IOException; import java.util.Arrays; +import java.util.HashMap; import java.util.List; import java.util.concurrent.ExecutionException; import javax.annotation.Generated; @@ -506,4 +512,120 @@ public void importConversationDataExceptionTest() throws Exception { } catch (ExecutionException e) { } } + + @Test + public void listLocationsTest() throws Exception { + Location responsesElement = Location.newBuilder().build(); + ListLocationsResponse expectedResponse = + ListLocationsResponse.newBuilder() + .setNextPageToken("") + .addAllLocations(Arrays.asList(responsesElement)) + .build(); + mockService.addResponse(expectedResponse); + + ListLocationsRequest request = + ListLocationsRequest.newBuilder() + .setName("projects/project-3664") + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + + ListLocationsPagedResponse pagedListResponse = client.listLocations(request); + + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getLocationsList().get(0), resources.get(0)); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void listLocationsExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + ListLocationsRequest request = + ListLocationsRequest.newBuilder() + .setName("projects/project-3664") + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + client.listLocations(request); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void getLocationTest() throws Exception { + Location expectedResponse = + Location.newBuilder() + .setName("name3373707") + .setLocationId("locationId1541836720") + .setDisplayName("displayName1714148973") + .putAllLabels(new HashMap()) + .setMetadata(Any.newBuilder().build()) + .build(); + mockService.addResponse(expectedResponse); + + GetLocationRequest request = + GetLocationRequest.newBuilder() + .setName("projects/project-9062/locations/location-9062") + .build(); + + Location actualResponse = client.getLocation(request); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void getLocationExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + GetLocationRequest request = + GetLocationRequest.newBuilder() + .setName("projects/project-9062/locations/location-9062") + .build(); + client.getLocation(request); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } } diff --git a/google-cloud-dialogflow/src/test/java/com/google/cloud/dialogflow/v2/ConversationDatasetsClientTest.java b/google-cloud-dialogflow/src/test/java/com/google/cloud/dialogflow/v2/ConversationDatasetsClientTest.java index 35c77ad37..5ad318382 100644 --- a/google-cloud-dialogflow/src/test/java/com/google/cloud/dialogflow/v2/ConversationDatasetsClientTest.java +++ b/google-cloud-dialogflow/src/test/java/com/google/cloud/dialogflow/v2/ConversationDatasetsClientTest.java @@ -17,6 +17,7 @@ package com.google.cloud.dialogflow.v2; import static com.google.cloud.dialogflow.v2.ConversationDatasetsClient.ListConversationDatasetsPagedResponse; +import static com.google.cloud.dialogflow.v2.ConversationDatasetsClient.ListLocationsPagedResponse; import com.google.api.gax.core.NoCredentialsProvider; import com.google.api.gax.grpc.GaxGrpcProperties; @@ -26,6 +27,10 @@ import com.google.api.gax.rpc.ApiClientHeaderProvider; import com.google.api.gax.rpc.InvalidArgumentException; import com.google.api.gax.rpc.StatusCode; +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.ListLocationsResponse; +import com.google.cloud.location.Location; import com.google.common.collect.Lists; import com.google.longrunning.Operation; import com.google.protobuf.AbstractMessage; @@ -35,6 +40,7 @@ import io.grpc.StatusRuntimeException; import java.io.IOException; import java.util.Arrays; +import java.util.HashMap; import java.util.List; import java.util.UUID; import java.util.concurrent.ExecutionException; @@ -49,6 +55,7 @@ @Generated("by gapic-generator-java") public class ConversationDatasetsClientTest { private static MockConversationDatasets mockConversationDatasets; + private static MockLocations mockLocations; private static MockServiceHelper mockServiceHelper; private LocalChannelProvider channelProvider; private ConversationDatasetsClient client; @@ -56,9 +63,11 @@ public class ConversationDatasetsClientTest { @BeforeClass public static void startStaticServer() { mockConversationDatasets = new MockConversationDatasets(); + mockLocations = new MockLocations(); mockServiceHelper = new MockServiceHelper( - UUID.randomUUID().toString(), Arrays.asList(mockConversationDatasets)); + UUID.randomUUID().toString(), + Arrays.asList(mockConversationDatasets, mockLocations)); mockServiceHelper.start(); } @@ -482,4 +491,105 @@ public void importConversationDataExceptionTest() throws Exception { Assert.assertEquals(StatusCode.Code.INVALID_ARGUMENT, apiException.getStatusCode().getCode()); } } + + @Test + public void listLocationsTest() throws Exception { + Location responsesElement = Location.newBuilder().build(); + ListLocationsResponse expectedResponse = + ListLocationsResponse.newBuilder() + .setNextPageToken("") + .addAllLocations(Arrays.asList(responsesElement)) + .build(); + mockLocations.addResponse(expectedResponse); + + ListLocationsRequest request = + ListLocationsRequest.newBuilder() + .setName("name3373707") + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + + ListLocationsPagedResponse pagedListResponse = client.listLocations(request); + + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getLocationsList().get(0), resources.get(0)); + + List actualRequests = mockLocations.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + ListLocationsRequest actualRequest = ((ListLocationsRequest) actualRequests.get(0)); + + Assert.assertEquals(request.getName(), actualRequest.getName()); + Assert.assertEquals(request.getFilter(), actualRequest.getFilter()); + Assert.assertEquals(request.getPageSize(), actualRequest.getPageSize()); + Assert.assertEquals(request.getPageToken(), actualRequest.getPageToken()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void listLocationsExceptionTest() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockLocations.addException(exception); + + try { + ListLocationsRequest request = + ListLocationsRequest.newBuilder() + .setName("name3373707") + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + client.listLocations(request); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void getLocationTest() throws Exception { + Location expectedResponse = + Location.newBuilder() + .setName("name3373707") + .setLocationId("locationId1541836720") + .setDisplayName("displayName1714148973") + .putAllLabels(new HashMap()) + .setMetadata(Any.newBuilder().build()) + .build(); + mockLocations.addResponse(expectedResponse); + + GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build(); + + Location actualResponse = client.getLocation(request); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockLocations.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + GetLocationRequest actualRequest = ((GetLocationRequest) actualRequests.get(0)); + + Assert.assertEquals(request.getName(), actualRequest.getName()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void getLocationExceptionTest() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockLocations.addException(exception); + + try { + GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build(); + client.getLocation(request); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } } diff --git a/google-cloud-dialogflow/src/test/java/com/google/cloud/dialogflow/v2/ConversationModelsClientHttpJsonTest.java b/google-cloud-dialogflow/src/test/java/com/google/cloud/dialogflow/v2/ConversationModelsClientHttpJsonTest.java index 63378a83d..11e9413b6 100644 --- a/google-cloud-dialogflow/src/test/java/com/google/cloud/dialogflow/v2/ConversationModelsClientHttpJsonTest.java +++ b/google-cloud-dialogflow/src/test/java/com/google/cloud/dialogflow/v2/ConversationModelsClientHttpJsonTest.java @@ -18,6 +18,7 @@ import static com.google.cloud.dialogflow.v2.ConversationModelsClient.ListConversationModelEvaluationsPagedResponse; import static com.google.cloud.dialogflow.v2.ConversationModelsClient.ListConversationModelsPagedResponse; +import static com.google.cloud.dialogflow.v2.ConversationModelsClient.ListLocationsPagedResponse; import com.google.api.gax.core.NoCredentialsProvider; import com.google.api.gax.httpjson.GaxHttpJsonProperties; @@ -29,6 +30,10 @@ import com.google.api.gax.rpc.StatusCode; import com.google.api.gax.rpc.testing.FakeStatusCode; import com.google.cloud.dialogflow.v2.stub.HttpJsonConversationModelsStub; +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.ListLocationsResponse; +import com.google.cloud.location.Location; import com.google.common.collect.Lists; import com.google.longrunning.Operation; import com.google.protobuf.Any; @@ -37,6 +42,7 @@ import java.io.IOException; import java.util.ArrayList; import java.util.Arrays; +import java.util.HashMap; import java.util.List; import java.util.concurrent.ExecutionException; import javax.annotation.Generated; @@ -619,4 +625,120 @@ public void createConversationModelEvaluationExceptionTest2() throws Exception { } catch (ExecutionException e) { } } + + @Test + public void listLocationsTest() throws Exception { + Location responsesElement = Location.newBuilder().build(); + ListLocationsResponse expectedResponse = + ListLocationsResponse.newBuilder() + .setNextPageToken("") + .addAllLocations(Arrays.asList(responsesElement)) + .build(); + mockService.addResponse(expectedResponse); + + ListLocationsRequest request = + ListLocationsRequest.newBuilder() + .setName("projects/project-3664") + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + + ListLocationsPagedResponse pagedListResponse = client.listLocations(request); + + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getLocationsList().get(0), resources.get(0)); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void listLocationsExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + ListLocationsRequest request = + ListLocationsRequest.newBuilder() + .setName("projects/project-3664") + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + client.listLocations(request); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void getLocationTest() throws Exception { + Location expectedResponse = + Location.newBuilder() + .setName("name3373707") + .setLocationId("locationId1541836720") + .setDisplayName("displayName1714148973") + .putAllLabels(new HashMap()) + .setMetadata(Any.newBuilder().build()) + .build(); + mockService.addResponse(expectedResponse); + + GetLocationRequest request = + GetLocationRequest.newBuilder() + .setName("projects/project-9062/locations/location-9062") + .build(); + + Location actualResponse = client.getLocation(request); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void getLocationExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + GetLocationRequest request = + GetLocationRequest.newBuilder() + .setName("projects/project-9062/locations/location-9062") + .build(); + client.getLocation(request); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } } diff --git a/google-cloud-dialogflow/src/test/java/com/google/cloud/dialogflow/v2/ConversationModelsClientTest.java b/google-cloud-dialogflow/src/test/java/com/google/cloud/dialogflow/v2/ConversationModelsClientTest.java index 5082b82f4..10191f6e1 100644 --- a/google-cloud-dialogflow/src/test/java/com/google/cloud/dialogflow/v2/ConversationModelsClientTest.java +++ b/google-cloud-dialogflow/src/test/java/com/google/cloud/dialogflow/v2/ConversationModelsClientTest.java @@ -18,6 +18,7 @@ import static com.google.cloud.dialogflow.v2.ConversationModelsClient.ListConversationModelEvaluationsPagedResponse; import static com.google.cloud.dialogflow.v2.ConversationModelsClient.ListConversationModelsPagedResponse; +import static com.google.cloud.dialogflow.v2.ConversationModelsClient.ListLocationsPagedResponse; import com.google.api.gax.core.NoCredentialsProvider; import com.google.api.gax.grpc.GaxGrpcProperties; @@ -27,6 +28,10 @@ import com.google.api.gax.rpc.ApiClientHeaderProvider; import com.google.api.gax.rpc.InvalidArgumentException; import com.google.api.gax.rpc.StatusCode; +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.ListLocationsResponse; +import com.google.cloud.location.Location; import com.google.common.collect.Lists; import com.google.longrunning.Operation; import com.google.protobuf.AbstractMessage; @@ -37,6 +42,7 @@ import java.io.IOException; import java.util.ArrayList; import java.util.Arrays; +import java.util.HashMap; import java.util.List; import java.util.UUID; import java.util.concurrent.ExecutionException; @@ -51,6 +57,7 @@ @Generated("by gapic-generator-java") public class ConversationModelsClientTest { private static MockConversationModels mockConversationModels; + private static MockLocations mockLocations; private static MockServiceHelper mockServiceHelper; private LocalChannelProvider channelProvider; private ConversationModelsClient client; @@ -58,9 +65,11 @@ public class ConversationModelsClientTest { @BeforeClass public static void startStaticServer() { mockConversationModels = new MockConversationModels(); + mockLocations = new MockLocations(); mockServiceHelper = new MockServiceHelper( - UUID.randomUUID().toString(), Arrays.asList(mockConversationModels)); + UUID.randomUUID().toString(), + Arrays.asList(mockConversationModels, mockLocations)); mockServiceHelper.start(); } @@ -584,4 +593,105 @@ public void createConversationModelEvaluationExceptionTest2() throws Exception { Assert.assertEquals(StatusCode.Code.INVALID_ARGUMENT, apiException.getStatusCode().getCode()); } } + + @Test + public void listLocationsTest() throws Exception { + Location responsesElement = Location.newBuilder().build(); + ListLocationsResponse expectedResponse = + ListLocationsResponse.newBuilder() + .setNextPageToken("") + .addAllLocations(Arrays.asList(responsesElement)) + .build(); + mockLocations.addResponse(expectedResponse); + + ListLocationsRequest request = + ListLocationsRequest.newBuilder() + .setName("name3373707") + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + + ListLocationsPagedResponse pagedListResponse = client.listLocations(request); + + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getLocationsList().get(0), resources.get(0)); + + List actualRequests = mockLocations.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + ListLocationsRequest actualRequest = ((ListLocationsRequest) actualRequests.get(0)); + + Assert.assertEquals(request.getName(), actualRequest.getName()); + Assert.assertEquals(request.getFilter(), actualRequest.getFilter()); + Assert.assertEquals(request.getPageSize(), actualRequest.getPageSize()); + Assert.assertEquals(request.getPageToken(), actualRequest.getPageToken()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void listLocationsExceptionTest() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockLocations.addException(exception); + + try { + ListLocationsRequest request = + ListLocationsRequest.newBuilder() + .setName("name3373707") + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + client.listLocations(request); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void getLocationTest() throws Exception { + Location expectedResponse = + Location.newBuilder() + .setName("name3373707") + .setLocationId("locationId1541836720") + .setDisplayName("displayName1714148973") + .putAllLabels(new HashMap()) + .setMetadata(Any.newBuilder().build()) + .build(); + mockLocations.addResponse(expectedResponse); + + GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build(); + + Location actualResponse = client.getLocation(request); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockLocations.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + GetLocationRequest actualRequest = ((GetLocationRequest) actualRequests.get(0)); + + Assert.assertEquals(request.getName(), actualRequest.getName()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void getLocationExceptionTest() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockLocations.addException(exception); + + try { + GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build(); + client.getLocation(request); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } } diff --git a/google-cloud-dialogflow/src/test/java/com/google/cloud/dialogflow/v2/ConversationProfilesClientHttpJsonTest.java b/google-cloud-dialogflow/src/test/java/com/google/cloud/dialogflow/v2/ConversationProfilesClientHttpJsonTest.java index 6b69fd904..4ac80d9c8 100644 --- a/google-cloud-dialogflow/src/test/java/com/google/cloud/dialogflow/v2/ConversationProfilesClientHttpJsonTest.java +++ b/google-cloud-dialogflow/src/test/java/com/google/cloud/dialogflow/v2/ConversationProfilesClientHttpJsonTest.java @@ -17,6 +17,7 @@ package com.google.cloud.dialogflow.v2; import static com.google.cloud.dialogflow.v2.ConversationProfilesClient.ListConversationProfilesPagedResponse; +import static com.google.cloud.dialogflow.v2.ConversationProfilesClient.ListLocationsPagedResponse; import com.google.api.gax.core.NoCredentialsProvider; import com.google.api.gax.httpjson.GaxHttpJsonProperties; @@ -28,6 +29,10 @@ import com.google.api.gax.rpc.StatusCode; import com.google.api.gax.rpc.testing.FakeStatusCode; import com.google.cloud.dialogflow.v2.stub.HttpJsonConversationProfilesStub; +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.ListLocationsResponse; +import com.google.cloud.location.Location; import com.google.common.collect.Lists; import com.google.longrunning.Operation; import com.google.protobuf.Any; @@ -36,6 +41,7 @@ import com.google.protobuf.Timestamp; import java.io.IOException; import java.util.Arrays; +import java.util.HashMap; import java.util.List; import java.util.concurrent.ExecutionException; import javax.annotation.Generated; @@ -867,4 +873,120 @@ public void clearSuggestionFeatureConfigExceptionTest() throws Exception { } catch (ExecutionException e) { } } + + @Test + public void listLocationsTest() throws Exception { + Location responsesElement = Location.newBuilder().build(); + ListLocationsResponse expectedResponse = + ListLocationsResponse.newBuilder() + .setNextPageToken("") + .addAllLocations(Arrays.asList(responsesElement)) + .build(); + mockService.addResponse(expectedResponse); + + ListLocationsRequest request = + ListLocationsRequest.newBuilder() + .setName("projects/project-3664") + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + + ListLocationsPagedResponse pagedListResponse = client.listLocations(request); + + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getLocationsList().get(0), resources.get(0)); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void listLocationsExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + ListLocationsRequest request = + ListLocationsRequest.newBuilder() + .setName("projects/project-3664") + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + client.listLocations(request); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void getLocationTest() throws Exception { + Location expectedResponse = + Location.newBuilder() + .setName("name3373707") + .setLocationId("locationId1541836720") + .setDisplayName("displayName1714148973") + .putAllLabels(new HashMap()) + .setMetadata(Any.newBuilder().build()) + .build(); + mockService.addResponse(expectedResponse); + + GetLocationRequest request = + GetLocationRequest.newBuilder() + .setName("projects/project-9062/locations/location-9062") + .build(); + + Location actualResponse = client.getLocation(request); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void getLocationExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + GetLocationRequest request = + GetLocationRequest.newBuilder() + .setName("projects/project-9062/locations/location-9062") + .build(); + client.getLocation(request); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } } diff --git a/google-cloud-dialogflow/src/test/java/com/google/cloud/dialogflow/v2/ConversationProfilesClientTest.java b/google-cloud-dialogflow/src/test/java/com/google/cloud/dialogflow/v2/ConversationProfilesClientTest.java index 86235f201..8c21ca20f 100644 --- a/google-cloud-dialogflow/src/test/java/com/google/cloud/dialogflow/v2/ConversationProfilesClientTest.java +++ b/google-cloud-dialogflow/src/test/java/com/google/cloud/dialogflow/v2/ConversationProfilesClientTest.java @@ -17,6 +17,7 @@ package com.google.cloud.dialogflow.v2; import static com.google.cloud.dialogflow.v2.ConversationProfilesClient.ListConversationProfilesPagedResponse; +import static com.google.cloud.dialogflow.v2.ConversationProfilesClient.ListLocationsPagedResponse; import com.google.api.gax.core.NoCredentialsProvider; import com.google.api.gax.grpc.GaxGrpcProperties; @@ -26,6 +27,10 @@ import com.google.api.gax.rpc.ApiClientHeaderProvider; import com.google.api.gax.rpc.InvalidArgumentException; import com.google.api.gax.rpc.StatusCode; +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.ListLocationsResponse; +import com.google.cloud.location.Location; import com.google.common.collect.Lists; import com.google.longrunning.Operation; import com.google.protobuf.AbstractMessage; @@ -36,6 +41,7 @@ import io.grpc.StatusRuntimeException; import java.io.IOException; import java.util.Arrays; +import java.util.HashMap; import java.util.List; import java.util.UUID; import java.util.concurrent.ExecutionException; @@ -50,6 +56,7 @@ @Generated("by gapic-generator-java") public class ConversationProfilesClientTest { private static MockConversationProfiles mockConversationProfiles; + private static MockLocations mockLocations; private static MockServiceHelper mockServiceHelper; private LocalChannelProvider channelProvider; private ConversationProfilesClient client; @@ -57,9 +64,11 @@ public class ConversationProfilesClientTest { @BeforeClass public static void startStaticServer() { mockConversationProfiles = new MockConversationProfiles(); + mockLocations = new MockLocations(); mockServiceHelper = new MockServiceHelper( - UUID.randomUUID().toString(), Arrays.asList(mockConversationProfiles)); + UUID.randomUUID().toString(), + Arrays.asList(mockConversationProfiles, mockLocations)); mockServiceHelper.start(); } @@ -774,4 +783,105 @@ public void clearSuggestionFeatureConfigExceptionTest() throws Exception { Assert.assertEquals(StatusCode.Code.INVALID_ARGUMENT, apiException.getStatusCode().getCode()); } } + + @Test + public void listLocationsTest() throws Exception { + Location responsesElement = Location.newBuilder().build(); + ListLocationsResponse expectedResponse = + ListLocationsResponse.newBuilder() + .setNextPageToken("") + .addAllLocations(Arrays.asList(responsesElement)) + .build(); + mockLocations.addResponse(expectedResponse); + + ListLocationsRequest request = + ListLocationsRequest.newBuilder() + .setName("name3373707") + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + + ListLocationsPagedResponse pagedListResponse = client.listLocations(request); + + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getLocationsList().get(0), resources.get(0)); + + List actualRequests = mockLocations.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + ListLocationsRequest actualRequest = ((ListLocationsRequest) actualRequests.get(0)); + + Assert.assertEquals(request.getName(), actualRequest.getName()); + Assert.assertEquals(request.getFilter(), actualRequest.getFilter()); + Assert.assertEquals(request.getPageSize(), actualRequest.getPageSize()); + Assert.assertEquals(request.getPageToken(), actualRequest.getPageToken()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void listLocationsExceptionTest() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockLocations.addException(exception); + + try { + ListLocationsRequest request = + ListLocationsRequest.newBuilder() + .setName("name3373707") + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + client.listLocations(request); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void getLocationTest() throws Exception { + Location expectedResponse = + Location.newBuilder() + .setName("name3373707") + .setLocationId("locationId1541836720") + .setDisplayName("displayName1714148973") + .putAllLabels(new HashMap()) + .setMetadata(Any.newBuilder().build()) + .build(); + mockLocations.addResponse(expectedResponse); + + GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build(); + + Location actualResponse = client.getLocation(request); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockLocations.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + GetLocationRequest actualRequest = ((GetLocationRequest) actualRequests.get(0)); + + Assert.assertEquals(request.getName(), actualRequest.getName()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void getLocationExceptionTest() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockLocations.addException(exception); + + try { + GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build(); + client.getLocation(request); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } } diff --git a/google-cloud-dialogflow/src/test/java/com/google/cloud/dialogflow/v2/ConversationsClientHttpJsonTest.java b/google-cloud-dialogflow/src/test/java/com/google/cloud/dialogflow/v2/ConversationsClientHttpJsonTest.java index cced75524..b713377e6 100644 --- a/google-cloud-dialogflow/src/test/java/com/google/cloud/dialogflow/v2/ConversationsClientHttpJsonTest.java +++ b/google-cloud-dialogflow/src/test/java/com/google/cloud/dialogflow/v2/ConversationsClientHttpJsonTest.java @@ -17,6 +17,7 @@ package com.google.cloud.dialogflow.v2; import static com.google.cloud.dialogflow.v2.ConversationsClient.ListConversationsPagedResponse; +import static com.google.cloud.dialogflow.v2.ConversationsClient.ListLocationsPagedResponse; import static com.google.cloud.dialogflow.v2.ConversationsClient.ListMessagesPagedResponse; import com.google.api.gax.core.NoCredentialsProvider; @@ -29,10 +30,16 @@ import com.google.api.gax.rpc.StatusCode; import com.google.api.gax.rpc.testing.FakeStatusCode; import com.google.cloud.dialogflow.v2.stub.HttpJsonConversationsStub; +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.ListLocationsResponse; +import com.google.cloud.location.Location; import com.google.common.collect.Lists; +import com.google.protobuf.Any; import com.google.protobuf.Timestamp; import java.io.IOException; import java.util.Arrays; +import java.util.HashMap; import java.util.List; import javax.annotation.Generated; import org.junit.After; @@ -709,4 +716,120 @@ public void listMessagesExceptionTest2() throws Exception { // Expected exception. } } + + @Test + public void listLocationsTest() throws Exception { + Location responsesElement = Location.newBuilder().build(); + ListLocationsResponse expectedResponse = + ListLocationsResponse.newBuilder() + .setNextPageToken("") + .addAllLocations(Arrays.asList(responsesElement)) + .build(); + mockService.addResponse(expectedResponse); + + ListLocationsRequest request = + ListLocationsRequest.newBuilder() + .setName("projects/project-3664") + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + + ListLocationsPagedResponse pagedListResponse = client.listLocations(request); + + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getLocationsList().get(0), resources.get(0)); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void listLocationsExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + ListLocationsRequest request = + ListLocationsRequest.newBuilder() + .setName("projects/project-3664") + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + client.listLocations(request); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void getLocationTest() throws Exception { + Location expectedResponse = + Location.newBuilder() + .setName("name3373707") + .setLocationId("locationId1541836720") + .setDisplayName("displayName1714148973") + .putAllLabels(new HashMap()) + .setMetadata(Any.newBuilder().build()) + .build(); + mockService.addResponse(expectedResponse); + + GetLocationRequest request = + GetLocationRequest.newBuilder() + .setName("projects/project-9062/locations/location-9062") + .build(); + + Location actualResponse = client.getLocation(request); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void getLocationExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + GetLocationRequest request = + GetLocationRequest.newBuilder() + .setName("projects/project-9062/locations/location-9062") + .build(); + client.getLocation(request); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } } diff --git a/google-cloud-dialogflow/src/test/java/com/google/cloud/dialogflow/v2/ConversationsClientTest.java b/google-cloud-dialogflow/src/test/java/com/google/cloud/dialogflow/v2/ConversationsClientTest.java index c7705c489..3e6cb8fdd 100644 --- a/google-cloud-dialogflow/src/test/java/com/google/cloud/dialogflow/v2/ConversationsClientTest.java +++ b/google-cloud-dialogflow/src/test/java/com/google/cloud/dialogflow/v2/ConversationsClientTest.java @@ -17,6 +17,7 @@ package com.google.cloud.dialogflow.v2; import static com.google.cloud.dialogflow.v2.ConversationsClient.ListConversationsPagedResponse; +import static com.google.cloud.dialogflow.v2.ConversationsClient.ListLocationsPagedResponse; import static com.google.cloud.dialogflow.v2.ConversationsClient.ListMessagesPagedResponse; import com.google.api.gax.core.NoCredentialsProvider; @@ -26,12 +27,18 @@ import com.google.api.gax.grpc.testing.MockServiceHelper; import com.google.api.gax.rpc.ApiClientHeaderProvider; import com.google.api.gax.rpc.InvalidArgumentException; +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.ListLocationsResponse; +import com.google.cloud.location.Location; import com.google.common.collect.Lists; import com.google.protobuf.AbstractMessage; +import com.google.protobuf.Any; import com.google.protobuf.Timestamp; import io.grpc.StatusRuntimeException; import java.io.IOException; import java.util.Arrays; +import java.util.HashMap; import java.util.List; import java.util.UUID; import javax.annotation.Generated; @@ -45,6 +52,7 @@ @Generated("by gapic-generator-java") public class ConversationsClientTest { private static MockConversations mockConversations; + private static MockLocations mockLocations; private static MockServiceHelper mockServiceHelper; private LocalChannelProvider channelProvider; private ConversationsClient client; @@ -52,9 +60,11 @@ public class ConversationsClientTest { @BeforeClass public static void startStaticServer() { mockConversations = new MockConversations(); + mockLocations = new MockLocations(); mockServiceHelper = new MockServiceHelper( - UUID.randomUUID().toString(), Arrays.asList(mockConversations)); + UUID.randomUUID().toString(), + Arrays.asList(mockConversations, mockLocations)); mockServiceHelper.start(); } @@ -645,4 +655,105 @@ public void listMessagesExceptionTest2() throws Exception { // Expected exception. } } + + @Test + public void listLocationsTest() throws Exception { + Location responsesElement = Location.newBuilder().build(); + ListLocationsResponse expectedResponse = + ListLocationsResponse.newBuilder() + .setNextPageToken("") + .addAllLocations(Arrays.asList(responsesElement)) + .build(); + mockLocations.addResponse(expectedResponse); + + ListLocationsRequest request = + ListLocationsRequest.newBuilder() + .setName("name3373707") + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + + ListLocationsPagedResponse pagedListResponse = client.listLocations(request); + + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getLocationsList().get(0), resources.get(0)); + + List actualRequests = mockLocations.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + ListLocationsRequest actualRequest = ((ListLocationsRequest) actualRequests.get(0)); + + Assert.assertEquals(request.getName(), actualRequest.getName()); + Assert.assertEquals(request.getFilter(), actualRequest.getFilter()); + Assert.assertEquals(request.getPageSize(), actualRequest.getPageSize()); + Assert.assertEquals(request.getPageToken(), actualRequest.getPageToken()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void listLocationsExceptionTest() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockLocations.addException(exception); + + try { + ListLocationsRequest request = + ListLocationsRequest.newBuilder() + .setName("name3373707") + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + client.listLocations(request); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void getLocationTest() throws Exception { + Location expectedResponse = + Location.newBuilder() + .setName("name3373707") + .setLocationId("locationId1541836720") + .setDisplayName("displayName1714148973") + .putAllLabels(new HashMap()) + .setMetadata(Any.newBuilder().build()) + .build(); + mockLocations.addResponse(expectedResponse); + + GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build(); + + Location actualResponse = client.getLocation(request); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockLocations.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + GetLocationRequest actualRequest = ((GetLocationRequest) actualRequests.get(0)); + + Assert.assertEquals(request.getName(), actualRequest.getName()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void getLocationExceptionTest() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockLocations.addException(exception); + + try { + GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build(); + client.getLocation(request); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } } diff --git a/google-cloud-dialogflow/src/test/java/com/google/cloud/dialogflow/v2/DocumentsClientHttpJsonTest.java b/google-cloud-dialogflow/src/test/java/com/google/cloud/dialogflow/v2/DocumentsClientHttpJsonTest.java index 9eccf8d59..c8ecaacd9 100644 --- a/google-cloud-dialogflow/src/test/java/com/google/cloud/dialogflow/v2/DocumentsClientHttpJsonTest.java +++ b/google-cloud-dialogflow/src/test/java/com/google/cloud/dialogflow/v2/DocumentsClientHttpJsonTest.java @@ -17,6 +17,7 @@ package com.google.cloud.dialogflow.v2; import static com.google.cloud.dialogflow.v2.DocumentsClient.ListDocumentsPagedResponse; +import static com.google.cloud.dialogflow.v2.DocumentsClient.ListLocationsPagedResponse; import com.google.api.gax.core.NoCredentialsProvider; import com.google.api.gax.httpjson.GaxHttpJsonProperties; @@ -28,6 +29,10 @@ import com.google.api.gax.rpc.StatusCode; import com.google.api.gax.rpc.testing.FakeStatusCode; import com.google.cloud.dialogflow.v2.stub.HttpJsonDocumentsStub; +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.ListLocationsResponse; +import com.google.cloud.location.Location; import com.google.common.collect.Lists; import com.google.longrunning.Operation; import com.google.protobuf.Any; @@ -855,4 +860,120 @@ public void exportDocumentExceptionTest() throws Exception { } catch (ExecutionException e) { } } + + @Test + public void listLocationsTest() throws Exception { + Location responsesElement = Location.newBuilder().build(); + ListLocationsResponse expectedResponse = + ListLocationsResponse.newBuilder() + .setNextPageToken("") + .addAllLocations(Arrays.asList(responsesElement)) + .build(); + mockService.addResponse(expectedResponse); + + ListLocationsRequest request = + ListLocationsRequest.newBuilder() + .setName("projects/project-3664") + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + + ListLocationsPagedResponse pagedListResponse = client.listLocations(request); + + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getLocationsList().get(0), resources.get(0)); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void listLocationsExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + ListLocationsRequest request = + ListLocationsRequest.newBuilder() + .setName("projects/project-3664") + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + client.listLocations(request); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void getLocationTest() throws Exception { + Location expectedResponse = + Location.newBuilder() + .setName("name3373707") + .setLocationId("locationId1541836720") + .setDisplayName("displayName1714148973") + .putAllLabels(new HashMap()) + .setMetadata(Any.newBuilder().build()) + .build(); + mockService.addResponse(expectedResponse); + + GetLocationRequest request = + GetLocationRequest.newBuilder() + .setName("projects/project-9062/locations/location-9062") + .build(); + + Location actualResponse = client.getLocation(request); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void getLocationExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + GetLocationRequest request = + GetLocationRequest.newBuilder() + .setName("projects/project-9062/locations/location-9062") + .build(); + client.getLocation(request); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } } diff --git a/google-cloud-dialogflow/src/test/java/com/google/cloud/dialogflow/v2/DocumentsClientTest.java b/google-cloud-dialogflow/src/test/java/com/google/cloud/dialogflow/v2/DocumentsClientTest.java index aa3864d28..d7124191c 100644 --- a/google-cloud-dialogflow/src/test/java/com/google/cloud/dialogflow/v2/DocumentsClientTest.java +++ b/google-cloud-dialogflow/src/test/java/com/google/cloud/dialogflow/v2/DocumentsClientTest.java @@ -17,6 +17,7 @@ package com.google.cloud.dialogflow.v2; import static com.google.cloud.dialogflow.v2.DocumentsClient.ListDocumentsPagedResponse; +import static com.google.cloud.dialogflow.v2.DocumentsClient.ListLocationsPagedResponse; import com.google.api.gax.core.NoCredentialsProvider; import com.google.api.gax.grpc.GaxGrpcProperties; @@ -26,6 +27,10 @@ import com.google.api.gax.rpc.ApiClientHeaderProvider; import com.google.api.gax.rpc.InvalidArgumentException; import com.google.api.gax.rpc.StatusCode; +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.ListLocationsResponse; +import com.google.cloud.location.Location; import com.google.common.collect.Lists; import com.google.longrunning.Operation; import com.google.protobuf.AbstractMessage; @@ -52,6 +57,7 @@ @Generated("by gapic-generator-java") public class DocumentsClientTest { private static MockDocuments mockDocuments; + private static MockLocations mockLocations; private static MockServiceHelper mockServiceHelper; private LocalChannelProvider channelProvider; private DocumentsClient client; @@ -59,9 +65,11 @@ public class DocumentsClientTest { @BeforeClass public static void startStaticServer() { mockDocuments = new MockDocuments(); + mockLocations = new MockLocations(); mockServiceHelper = new MockServiceHelper( - UUID.randomUUID().toString(), Arrays.asList(mockDocuments)); + UUID.randomUUID().toString(), + Arrays.asList(mockDocuments, mockLocations)); mockServiceHelper.start(); } @@ -795,4 +803,105 @@ public void exportDocumentExceptionTest() throws Exception { Assert.assertEquals(StatusCode.Code.INVALID_ARGUMENT, apiException.getStatusCode().getCode()); } } + + @Test + public void listLocationsTest() throws Exception { + Location responsesElement = Location.newBuilder().build(); + ListLocationsResponse expectedResponse = + ListLocationsResponse.newBuilder() + .setNextPageToken("") + .addAllLocations(Arrays.asList(responsesElement)) + .build(); + mockLocations.addResponse(expectedResponse); + + ListLocationsRequest request = + ListLocationsRequest.newBuilder() + .setName("name3373707") + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + + ListLocationsPagedResponse pagedListResponse = client.listLocations(request); + + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getLocationsList().get(0), resources.get(0)); + + List actualRequests = mockLocations.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + ListLocationsRequest actualRequest = ((ListLocationsRequest) actualRequests.get(0)); + + Assert.assertEquals(request.getName(), actualRequest.getName()); + Assert.assertEquals(request.getFilter(), actualRequest.getFilter()); + Assert.assertEquals(request.getPageSize(), actualRequest.getPageSize()); + Assert.assertEquals(request.getPageToken(), actualRequest.getPageToken()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void listLocationsExceptionTest() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockLocations.addException(exception); + + try { + ListLocationsRequest request = + ListLocationsRequest.newBuilder() + .setName("name3373707") + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + client.listLocations(request); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void getLocationTest() throws Exception { + Location expectedResponse = + Location.newBuilder() + .setName("name3373707") + .setLocationId("locationId1541836720") + .setDisplayName("displayName1714148973") + .putAllLabels(new HashMap()) + .setMetadata(Any.newBuilder().build()) + .build(); + mockLocations.addResponse(expectedResponse); + + GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build(); + + Location actualResponse = client.getLocation(request); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockLocations.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + GetLocationRequest actualRequest = ((GetLocationRequest) actualRequests.get(0)); + + Assert.assertEquals(request.getName(), actualRequest.getName()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void getLocationExceptionTest() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockLocations.addException(exception); + + try { + GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build(); + client.getLocation(request); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } } diff --git a/google-cloud-dialogflow/src/test/java/com/google/cloud/dialogflow/v2/EntityTypesClientHttpJsonTest.java b/google-cloud-dialogflow/src/test/java/com/google/cloud/dialogflow/v2/EntityTypesClientHttpJsonTest.java index 0a2f48918..4c38388a1 100644 --- a/google-cloud-dialogflow/src/test/java/com/google/cloud/dialogflow/v2/EntityTypesClientHttpJsonTest.java +++ b/google-cloud-dialogflow/src/test/java/com/google/cloud/dialogflow/v2/EntityTypesClientHttpJsonTest.java @@ -17,6 +17,7 @@ package com.google.cloud.dialogflow.v2; import static com.google.cloud.dialogflow.v2.EntityTypesClient.ListEntityTypesPagedResponse; +import static com.google.cloud.dialogflow.v2.EntityTypesClient.ListLocationsPagedResponse; import com.google.api.gax.core.NoCredentialsProvider; import com.google.api.gax.httpjson.GaxHttpJsonProperties; @@ -28,6 +29,10 @@ import com.google.api.gax.rpc.StatusCode; import com.google.api.gax.rpc.testing.FakeStatusCode; import com.google.cloud.dialogflow.v2.stub.HttpJsonEntityTypesStub; +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.ListLocationsResponse; +import com.google.cloud.location.Location; import com.google.common.collect.Lists; import com.google.longrunning.Operation; import com.google.protobuf.Any; @@ -36,6 +41,7 @@ import java.io.IOException; import java.util.ArrayList; import java.util.Arrays; +import java.util.HashMap; import java.util.List; import java.util.concurrent.ExecutionException; import javax.annotation.Generated; @@ -1620,4 +1626,120 @@ public void batchDeleteEntitiesExceptionTest4() throws Exception { } catch (ExecutionException e) { } } + + @Test + public void listLocationsTest() throws Exception { + Location responsesElement = Location.newBuilder().build(); + ListLocationsResponse expectedResponse = + ListLocationsResponse.newBuilder() + .setNextPageToken("") + .addAllLocations(Arrays.asList(responsesElement)) + .build(); + mockService.addResponse(expectedResponse); + + ListLocationsRequest request = + ListLocationsRequest.newBuilder() + .setName("projects/project-3664") + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + + ListLocationsPagedResponse pagedListResponse = client.listLocations(request); + + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getLocationsList().get(0), resources.get(0)); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void listLocationsExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + ListLocationsRequest request = + ListLocationsRequest.newBuilder() + .setName("projects/project-3664") + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + client.listLocations(request); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void getLocationTest() throws Exception { + Location expectedResponse = + Location.newBuilder() + .setName("name3373707") + .setLocationId("locationId1541836720") + .setDisplayName("displayName1714148973") + .putAllLabels(new HashMap()) + .setMetadata(Any.newBuilder().build()) + .build(); + mockService.addResponse(expectedResponse); + + GetLocationRequest request = + GetLocationRequest.newBuilder() + .setName("projects/project-9062/locations/location-9062") + .build(); + + Location actualResponse = client.getLocation(request); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void getLocationExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + GetLocationRequest request = + GetLocationRequest.newBuilder() + .setName("projects/project-9062/locations/location-9062") + .build(); + client.getLocation(request); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } } diff --git a/google-cloud-dialogflow/src/test/java/com/google/cloud/dialogflow/v2/EntityTypesClientTest.java b/google-cloud-dialogflow/src/test/java/com/google/cloud/dialogflow/v2/EntityTypesClientTest.java index 90592cdfa..89ad2fbd0 100644 --- a/google-cloud-dialogflow/src/test/java/com/google/cloud/dialogflow/v2/EntityTypesClientTest.java +++ b/google-cloud-dialogflow/src/test/java/com/google/cloud/dialogflow/v2/EntityTypesClientTest.java @@ -17,6 +17,7 @@ package com.google.cloud.dialogflow.v2; import static com.google.cloud.dialogflow.v2.EntityTypesClient.ListEntityTypesPagedResponse; +import static com.google.cloud.dialogflow.v2.EntityTypesClient.ListLocationsPagedResponse; import com.google.api.gax.core.NoCredentialsProvider; import com.google.api.gax.grpc.GaxGrpcProperties; @@ -26,6 +27,10 @@ import com.google.api.gax.rpc.ApiClientHeaderProvider; import com.google.api.gax.rpc.InvalidArgumentException; import com.google.api.gax.rpc.StatusCode; +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.ListLocationsResponse; +import com.google.cloud.location.Location; import com.google.common.collect.Lists; import com.google.longrunning.Operation; import com.google.protobuf.AbstractMessage; @@ -36,6 +41,7 @@ import java.io.IOException; import java.util.ArrayList; import java.util.Arrays; +import java.util.HashMap; import java.util.List; import java.util.UUID; import java.util.concurrent.ExecutionException; @@ -50,6 +56,7 @@ @Generated("by gapic-generator-java") public class EntityTypesClientTest { private static MockEntityTypes mockEntityTypes; + private static MockLocations mockLocations; private static MockServiceHelper mockServiceHelper; private LocalChannelProvider channelProvider; private EntityTypesClient client; @@ -57,9 +64,11 @@ public class EntityTypesClientTest { @BeforeClass public static void startStaticServer() { mockEntityTypes = new MockEntityTypes(); + mockLocations = new MockLocations(); mockServiceHelper = new MockServiceHelper( - UUID.randomUUID().toString(), Arrays.asList(mockEntityTypes)); + UUID.randomUUID().toString(), + Arrays.asList(mockEntityTypes, mockLocations)); mockServiceHelper.start(); } @@ -1494,4 +1503,105 @@ public void batchDeleteEntitiesExceptionTest4() throws Exception { Assert.assertEquals(StatusCode.Code.INVALID_ARGUMENT, apiException.getStatusCode().getCode()); } } + + @Test + public void listLocationsTest() throws Exception { + Location responsesElement = Location.newBuilder().build(); + ListLocationsResponse expectedResponse = + ListLocationsResponse.newBuilder() + .setNextPageToken("") + .addAllLocations(Arrays.asList(responsesElement)) + .build(); + mockLocations.addResponse(expectedResponse); + + ListLocationsRequest request = + ListLocationsRequest.newBuilder() + .setName("name3373707") + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + + ListLocationsPagedResponse pagedListResponse = client.listLocations(request); + + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getLocationsList().get(0), resources.get(0)); + + List actualRequests = mockLocations.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + ListLocationsRequest actualRequest = ((ListLocationsRequest) actualRequests.get(0)); + + Assert.assertEquals(request.getName(), actualRequest.getName()); + Assert.assertEquals(request.getFilter(), actualRequest.getFilter()); + Assert.assertEquals(request.getPageSize(), actualRequest.getPageSize()); + Assert.assertEquals(request.getPageToken(), actualRequest.getPageToken()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void listLocationsExceptionTest() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockLocations.addException(exception); + + try { + ListLocationsRequest request = + ListLocationsRequest.newBuilder() + .setName("name3373707") + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + client.listLocations(request); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void getLocationTest() throws Exception { + Location expectedResponse = + Location.newBuilder() + .setName("name3373707") + .setLocationId("locationId1541836720") + .setDisplayName("displayName1714148973") + .putAllLabels(new HashMap()) + .setMetadata(Any.newBuilder().build()) + .build(); + mockLocations.addResponse(expectedResponse); + + GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build(); + + Location actualResponse = client.getLocation(request); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockLocations.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + GetLocationRequest actualRequest = ((GetLocationRequest) actualRequests.get(0)); + + Assert.assertEquals(request.getName(), actualRequest.getName()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void getLocationExceptionTest() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockLocations.addException(exception); + + try { + GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build(); + client.getLocation(request); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } } diff --git a/google-cloud-dialogflow/src/test/java/com/google/cloud/dialogflow/v2/EnvironmentsClientHttpJsonTest.java b/google-cloud-dialogflow/src/test/java/com/google/cloud/dialogflow/v2/EnvironmentsClientHttpJsonTest.java index 766d7b23e..71045e023 100644 --- a/google-cloud-dialogflow/src/test/java/com/google/cloud/dialogflow/v2/EnvironmentsClientHttpJsonTest.java +++ b/google-cloud-dialogflow/src/test/java/com/google/cloud/dialogflow/v2/EnvironmentsClientHttpJsonTest.java @@ -18,6 +18,7 @@ import static com.google.cloud.dialogflow.v2.EnvironmentsClient.GetEnvironmentHistoryPagedResponse; import static com.google.cloud.dialogflow.v2.EnvironmentsClient.ListEnvironmentsPagedResponse; +import static com.google.cloud.dialogflow.v2.EnvironmentsClient.ListLocationsPagedResponse; import com.google.api.gax.core.NoCredentialsProvider; import com.google.api.gax.httpjson.GaxHttpJsonProperties; @@ -29,12 +30,18 @@ import com.google.api.gax.rpc.StatusCode; import com.google.api.gax.rpc.testing.FakeStatusCode; import com.google.cloud.dialogflow.v2.stub.HttpJsonEnvironmentsStub; +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.ListLocationsResponse; +import com.google.cloud.location.Location; import com.google.common.collect.Lists; +import com.google.protobuf.Any; import com.google.protobuf.Empty; import com.google.protobuf.FieldMask; import com.google.protobuf.Timestamp; import java.io.IOException; import java.util.Arrays; +import java.util.HashMap; import java.util.List; import javax.annotation.Generated; import org.junit.After; @@ -488,4 +495,120 @@ public void getEnvironmentHistoryExceptionTest() throws Exception { // Expected exception. } } + + @Test + public void listLocationsTest() throws Exception { + Location responsesElement = Location.newBuilder().build(); + ListLocationsResponse expectedResponse = + ListLocationsResponse.newBuilder() + .setNextPageToken("") + .addAllLocations(Arrays.asList(responsesElement)) + .build(); + mockService.addResponse(expectedResponse); + + ListLocationsRequest request = + ListLocationsRequest.newBuilder() + .setName("projects/project-3664") + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + + ListLocationsPagedResponse pagedListResponse = client.listLocations(request); + + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getLocationsList().get(0), resources.get(0)); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void listLocationsExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + ListLocationsRequest request = + ListLocationsRequest.newBuilder() + .setName("projects/project-3664") + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + client.listLocations(request); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void getLocationTest() throws Exception { + Location expectedResponse = + Location.newBuilder() + .setName("name3373707") + .setLocationId("locationId1541836720") + .setDisplayName("displayName1714148973") + .putAllLabels(new HashMap()) + .setMetadata(Any.newBuilder().build()) + .build(); + mockService.addResponse(expectedResponse); + + GetLocationRequest request = + GetLocationRequest.newBuilder() + .setName("projects/project-9062/locations/location-9062") + .build(); + + Location actualResponse = client.getLocation(request); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void getLocationExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + GetLocationRequest request = + GetLocationRequest.newBuilder() + .setName("projects/project-9062/locations/location-9062") + .build(); + client.getLocation(request); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } } diff --git a/google-cloud-dialogflow/src/test/java/com/google/cloud/dialogflow/v2/EnvironmentsClientTest.java b/google-cloud-dialogflow/src/test/java/com/google/cloud/dialogflow/v2/EnvironmentsClientTest.java index e7f8390d7..fdc8766c7 100644 --- a/google-cloud-dialogflow/src/test/java/com/google/cloud/dialogflow/v2/EnvironmentsClientTest.java +++ b/google-cloud-dialogflow/src/test/java/com/google/cloud/dialogflow/v2/EnvironmentsClientTest.java @@ -18,6 +18,7 @@ import static com.google.cloud.dialogflow.v2.EnvironmentsClient.GetEnvironmentHistoryPagedResponse; import static com.google.cloud.dialogflow.v2.EnvironmentsClient.ListEnvironmentsPagedResponse; +import static com.google.cloud.dialogflow.v2.EnvironmentsClient.ListLocationsPagedResponse; import com.google.api.gax.core.NoCredentialsProvider; import com.google.api.gax.grpc.GaxGrpcProperties; @@ -26,14 +27,20 @@ import com.google.api.gax.grpc.testing.MockServiceHelper; import com.google.api.gax.rpc.ApiClientHeaderProvider; import com.google.api.gax.rpc.InvalidArgumentException; +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.ListLocationsResponse; +import com.google.cloud.location.Location; import com.google.common.collect.Lists; import com.google.protobuf.AbstractMessage; +import com.google.protobuf.Any; import com.google.protobuf.Empty; import com.google.protobuf.FieldMask; import com.google.protobuf.Timestamp; import io.grpc.StatusRuntimeException; import java.io.IOException; import java.util.Arrays; +import java.util.HashMap; import java.util.List; import java.util.UUID; import javax.annotation.Generated; @@ -47,6 +54,7 @@ @Generated("by gapic-generator-java") public class EnvironmentsClientTest { private static MockEnvironments mockEnvironments; + private static MockLocations mockLocations; private static MockServiceHelper mockServiceHelper; private LocalChannelProvider channelProvider; private EnvironmentsClient client; @@ -54,9 +62,11 @@ public class EnvironmentsClientTest { @BeforeClass public static void startStaticServer() { mockEnvironments = new MockEnvironments(); + mockLocations = new MockLocations(); mockServiceHelper = new MockServiceHelper( - UUID.randomUUID().toString(), Arrays.asList(mockEnvironments)); + UUID.randomUUID().toString(), + Arrays.asList(mockEnvironments, mockLocations)); mockServiceHelper.start(); } @@ -436,4 +446,105 @@ public void getEnvironmentHistoryExceptionTest() throws Exception { // Expected exception. } } + + @Test + public void listLocationsTest() throws Exception { + Location responsesElement = Location.newBuilder().build(); + ListLocationsResponse expectedResponse = + ListLocationsResponse.newBuilder() + .setNextPageToken("") + .addAllLocations(Arrays.asList(responsesElement)) + .build(); + mockLocations.addResponse(expectedResponse); + + ListLocationsRequest request = + ListLocationsRequest.newBuilder() + .setName("name3373707") + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + + ListLocationsPagedResponse pagedListResponse = client.listLocations(request); + + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getLocationsList().get(0), resources.get(0)); + + List actualRequests = mockLocations.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + ListLocationsRequest actualRequest = ((ListLocationsRequest) actualRequests.get(0)); + + Assert.assertEquals(request.getName(), actualRequest.getName()); + Assert.assertEquals(request.getFilter(), actualRequest.getFilter()); + Assert.assertEquals(request.getPageSize(), actualRequest.getPageSize()); + Assert.assertEquals(request.getPageToken(), actualRequest.getPageToken()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void listLocationsExceptionTest() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockLocations.addException(exception); + + try { + ListLocationsRequest request = + ListLocationsRequest.newBuilder() + .setName("name3373707") + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + client.listLocations(request); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void getLocationTest() throws Exception { + Location expectedResponse = + Location.newBuilder() + .setName("name3373707") + .setLocationId("locationId1541836720") + .setDisplayName("displayName1714148973") + .putAllLabels(new HashMap()) + .setMetadata(Any.newBuilder().build()) + .build(); + mockLocations.addResponse(expectedResponse); + + GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build(); + + Location actualResponse = client.getLocation(request); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockLocations.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + GetLocationRequest actualRequest = ((GetLocationRequest) actualRequests.get(0)); + + Assert.assertEquals(request.getName(), actualRequest.getName()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void getLocationExceptionTest() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockLocations.addException(exception); + + try { + GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build(); + client.getLocation(request); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } } diff --git a/google-cloud-dialogflow/src/test/java/com/google/cloud/dialogflow/v2/FulfillmentsClientHttpJsonTest.java b/google-cloud-dialogflow/src/test/java/com/google/cloud/dialogflow/v2/FulfillmentsClientHttpJsonTest.java index 0a683a011..69c39cd02 100644 --- a/google-cloud-dialogflow/src/test/java/com/google/cloud/dialogflow/v2/FulfillmentsClientHttpJsonTest.java +++ b/google-cloud-dialogflow/src/test/java/com/google/cloud/dialogflow/v2/FulfillmentsClientHttpJsonTest.java @@ -16,6 +16,8 @@ package com.google.cloud.dialogflow.v2; +import static com.google.cloud.dialogflow.v2.FulfillmentsClient.ListLocationsPagedResponse; + import com.google.api.gax.core.NoCredentialsProvider; import com.google.api.gax.httpjson.GaxHttpJsonProperties; import com.google.api.gax.httpjson.testing.MockHttpService; @@ -26,9 +28,17 @@ import com.google.api.gax.rpc.StatusCode; import com.google.api.gax.rpc.testing.FakeStatusCode; import com.google.cloud.dialogflow.v2.stub.HttpJsonFulfillmentsStub; +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.ListLocationsResponse; +import com.google.cloud.location.Location; +import com.google.common.collect.Lists; +import com.google.protobuf.Any; import com.google.protobuf.FieldMask; import java.io.IOException; import java.util.ArrayList; +import java.util.Arrays; +import java.util.HashMap; import java.util.List; import javax.annotation.Generated; import org.junit.After; @@ -227,4 +237,120 @@ public void updateFulfillmentExceptionTest() throws Exception { // Expected exception. } } + + @Test + public void listLocationsTest() throws Exception { + Location responsesElement = Location.newBuilder().build(); + ListLocationsResponse expectedResponse = + ListLocationsResponse.newBuilder() + .setNextPageToken("") + .addAllLocations(Arrays.asList(responsesElement)) + .build(); + mockService.addResponse(expectedResponse); + + ListLocationsRequest request = + ListLocationsRequest.newBuilder() + .setName("projects/project-3664") + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + + ListLocationsPagedResponse pagedListResponse = client.listLocations(request); + + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getLocationsList().get(0), resources.get(0)); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void listLocationsExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + ListLocationsRequest request = + ListLocationsRequest.newBuilder() + .setName("projects/project-3664") + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + client.listLocations(request); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void getLocationTest() throws Exception { + Location expectedResponse = + Location.newBuilder() + .setName("name3373707") + .setLocationId("locationId1541836720") + .setDisplayName("displayName1714148973") + .putAllLabels(new HashMap()) + .setMetadata(Any.newBuilder().build()) + .build(); + mockService.addResponse(expectedResponse); + + GetLocationRequest request = + GetLocationRequest.newBuilder() + .setName("projects/project-9062/locations/location-9062") + .build(); + + Location actualResponse = client.getLocation(request); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void getLocationExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + GetLocationRequest request = + GetLocationRequest.newBuilder() + .setName("projects/project-9062/locations/location-9062") + .build(); + client.getLocation(request); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } } diff --git a/google-cloud-dialogflow/src/test/java/com/google/cloud/dialogflow/v2/FulfillmentsClientTest.java b/google-cloud-dialogflow/src/test/java/com/google/cloud/dialogflow/v2/FulfillmentsClientTest.java index 225904a27..86a22d55c 100644 --- a/google-cloud-dialogflow/src/test/java/com/google/cloud/dialogflow/v2/FulfillmentsClientTest.java +++ b/google-cloud-dialogflow/src/test/java/com/google/cloud/dialogflow/v2/FulfillmentsClientTest.java @@ -16,6 +16,8 @@ package com.google.cloud.dialogflow.v2; +import static com.google.cloud.dialogflow.v2.FulfillmentsClient.ListLocationsPagedResponse; + import com.google.api.gax.core.NoCredentialsProvider; import com.google.api.gax.grpc.GaxGrpcProperties; import com.google.api.gax.grpc.testing.LocalChannelProvider; @@ -23,12 +25,19 @@ import com.google.api.gax.grpc.testing.MockServiceHelper; import com.google.api.gax.rpc.ApiClientHeaderProvider; import com.google.api.gax.rpc.InvalidArgumentException; +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.ListLocationsResponse; +import com.google.cloud.location.Location; +import com.google.common.collect.Lists; import com.google.protobuf.AbstractMessage; +import com.google.protobuf.Any; import com.google.protobuf.FieldMask; import io.grpc.StatusRuntimeException; import java.io.IOException; import java.util.ArrayList; import java.util.Arrays; +import java.util.HashMap; import java.util.List; import java.util.UUID; import javax.annotation.Generated; @@ -42,6 +51,7 @@ @Generated("by gapic-generator-java") public class FulfillmentsClientTest { private static MockFulfillments mockFulfillments; + private static MockLocations mockLocations; private static MockServiceHelper mockServiceHelper; private LocalChannelProvider channelProvider; private FulfillmentsClient client; @@ -49,9 +59,11 @@ public class FulfillmentsClientTest { @BeforeClass public static void startStaticServer() { mockFulfillments = new MockFulfillments(); + mockLocations = new MockLocations(); mockServiceHelper = new MockServiceHelper( - UUID.randomUUID().toString(), Arrays.asList(mockFulfillments)); + UUID.randomUUID().toString(), + Arrays.asList(mockFulfillments, mockLocations)); mockServiceHelper.start(); } @@ -202,4 +214,105 @@ public void updateFulfillmentExceptionTest() throws Exception { // Expected exception. } } + + @Test + public void listLocationsTest() throws Exception { + Location responsesElement = Location.newBuilder().build(); + ListLocationsResponse expectedResponse = + ListLocationsResponse.newBuilder() + .setNextPageToken("") + .addAllLocations(Arrays.asList(responsesElement)) + .build(); + mockLocations.addResponse(expectedResponse); + + ListLocationsRequest request = + ListLocationsRequest.newBuilder() + .setName("name3373707") + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + + ListLocationsPagedResponse pagedListResponse = client.listLocations(request); + + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getLocationsList().get(0), resources.get(0)); + + List actualRequests = mockLocations.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + ListLocationsRequest actualRequest = ((ListLocationsRequest) actualRequests.get(0)); + + Assert.assertEquals(request.getName(), actualRequest.getName()); + Assert.assertEquals(request.getFilter(), actualRequest.getFilter()); + Assert.assertEquals(request.getPageSize(), actualRequest.getPageSize()); + Assert.assertEquals(request.getPageToken(), actualRequest.getPageToken()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void listLocationsExceptionTest() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockLocations.addException(exception); + + try { + ListLocationsRequest request = + ListLocationsRequest.newBuilder() + .setName("name3373707") + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + client.listLocations(request); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void getLocationTest() throws Exception { + Location expectedResponse = + Location.newBuilder() + .setName("name3373707") + .setLocationId("locationId1541836720") + .setDisplayName("displayName1714148973") + .putAllLabels(new HashMap()) + .setMetadata(Any.newBuilder().build()) + .build(); + mockLocations.addResponse(expectedResponse); + + GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build(); + + Location actualResponse = client.getLocation(request); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockLocations.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + GetLocationRequest actualRequest = ((GetLocationRequest) actualRequests.get(0)); + + Assert.assertEquals(request.getName(), actualRequest.getName()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void getLocationExceptionTest() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockLocations.addException(exception); + + try { + GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build(); + client.getLocation(request); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } } diff --git a/google-cloud-dialogflow/src/test/java/com/google/cloud/dialogflow/v2/IntentsClientHttpJsonTest.java b/google-cloud-dialogflow/src/test/java/com/google/cloud/dialogflow/v2/IntentsClientHttpJsonTest.java index bbc66aba4..7eebc494f 100644 --- a/google-cloud-dialogflow/src/test/java/com/google/cloud/dialogflow/v2/IntentsClientHttpJsonTest.java +++ b/google-cloud-dialogflow/src/test/java/com/google/cloud/dialogflow/v2/IntentsClientHttpJsonTest.java @@ -17,6 +17,7 @@ package com.google.cloud.dialogflow.v2; import static com.google.cloud.dialogflow.v2.IntentsClient.ListIntentsPagedResponse; +import static com.google.cloud.dialogflow.v2.IntentsClient.ListLocationsPagedResponse; import com.google.api.gax.core.NoCredentialsProvider; import com.google.api.gax.httpjson.GaxHttpJsonProperties; @@ -28,6 +29,10 @@ import com.google.api.gax.rpc.StatusCode; import com.google.api.gax.rpc.testing.FakeStatusCode; import com.google.cloud.dialogflow.v2.stub.HttpJsonIntentsStub; +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.ListLocationsResponse; +import com.google.cloud.location.Location; import com.google.common.collect.Lists; import com.google.longrunning.Operation; import com.google.protobuf.Any; @@ -36,6 +41,7 @@ import java.io.IOException; import java.util.ArrayList; import java.util.Arrays; +import java.util.HashMap; import java.util.List; import java.util.concurrent.ExecutionException; import javax.annotation.Generated; @@ -1383,4 +1389,120 @@ public void batchDeleteIntentsExceptionTest2() throws Exception { } catch (ExecutionException e) { } } + + @Test + public void listLocationsTest() throws Exception { + Location responsesElement = Location.newBuilder().build(); + ListLocationsResponse expectedResponse = + ListLocationsResponse.newBuilder() + .setNextPageToken("") + .addAllLocations(Arrays.asList(responsesElement)) + .build(); + mockService.addResponse(expectedResponse); + + ListLocationsRequest request = + ListLocationsRequest.newBuilder() + .setName("projects/project-3664") + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + + ListLocationsPagedResponse pagedListResponse = client.listLocations(request); + + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getLocationsList().get(0), resources.get(0)); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void listLocationsExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + ListLocationsRequest request = + ListLocationsRequest.newBuilder() + .setName("projects/project-3664") + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + client.listLocations(request); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void getLocationTest() throws Exception { + Location expectedResponse = + Location.newBuilder() + .setName("name3373707") + .setLocationId("locationId1541836720") + .setDisplayName("displayName1714148973") + .putAllLabels(new HashMap()) + .setMetadata(Any.newBuilder().build()) + .build(); + mockService.addResponse(expectedResponse); + + GetLocationRequest request = + GetLocationRequest.newBuilder() + .setName("projects/project-9062/locations/location-9062") + .build(); + + Location actualResponse = client.getLocation(request); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void getLocationExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + GetLocationRequest request = + GetLocationRequest.newBuilder() + .setName("projects/project-9062/locations/location-9062") + .build(); + client.getLocation(request); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } } diff --git a/google-cloud-dialogflow/src/test/java/com/google/cloud/dialogflow/v2/IntentsClientTest.java b/google-cloud-dialogflow/src/test/java/com/google/cloud/dialogflow/v2/IntentsClientTest.java index 62f128da9..d00e982f4 100644 --- a/google-cloud-dialogflow/src/test/java/com/google/cloud/dialogflow/v2/IntentsClientTest.java +++ b/google-cloud-dialogflow/src/test/java/com/google/cloud/dialogflow/v2/IntentsClientTest.java @@ -17,6 +17,7 @@ package com.google.cloud.dialogflow.v2; import static com.google.cloud.dialogflow.v2.IntentsClient.ListIntentsPagedResponse; +import static com.google.cloud.dialogflow.v2.IntentsClient.ListLocationsPagedResponse; import com.google.api.gax.core.NoCredentialsProvider; import com.google.api.gax.grpc.GaxGrpcProperties; @@ -26,6 +27,10 @@ import com.google.api.gax.rpc.ApiClientHeaderProvider; import com.google.api.gax.rpc.InvalidArgumentException; import com.google.api.gax.rpc.StatusCode; +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.ListLocationsResponse; +import com.google.cloud.location.Location; import com.google.common.collect.Lists; import com.google.longrunning.Operation; import com.google.protobuf.AbstractMessage; @@ -36,6 +41,7 @@ import java.io.IOException; import java.util.ArrayList; import java.util.Arrays; +import java.util.HashMap; import java.util.List; import java.util.UUID; import java.util.concurrent.ExecutionException; @@ -50,6 +56,7 @@ @Generated("by gapic-generator-java") public class IntentsClientTest { private static MockIntents mockIntents; + private static MockLocations mockLocations; private static MockServiceHelper mockServiceHelper; private LocalChannelProvider channelProvider; private IntentsClient client; @@ -57,9 +64,11 @@ public class IntentsClientTest { @BeforeClass public static void startStaticServer() { mockIntents = new MockIntents(); + mockLocations = new MockLocations(); mockServiceHelper = new MockServiceHelper( - UUID.randomUUID().toString(), Arrays.asList(mockIntents)); + UUID.randomUUID().toString(), + Arrays.asList(mockIntents, mockLocations)); mockServiceHelper.start(); } @@ -1209,4 +1218,105 @@ public void batchDeleteIntentsExceptionTest2() throws Exception { Assert.assertEquals(StatusCode.Code.INVALID_ARGUMENT, apiException.getStatusCode().getCode()); } } + + @Test + public void listLocationsTest() throws Exception { + Location responsesElement = Location.newBuilder().build(); + ListLocationsResponse expectedResponse = + ListLocationsResponse.newBuilder() + .setNextPageToken("") + .addAllLocations(Arrays.asList(responsesElement)) + .build(); + mockLocations.addResponse(expectedResponse); + + ListLocationsRequest request = + ListLocationsRequest.newBuilder() + .setName("name3373707") + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + + ListLocationsPagedResponse pagedListResponse = client.listLocations(request); + + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getLocationsList().get(0), resources.get(0)); + + List actualRequests = mockLocations.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + ListLocationsRequest actualRequest = ((ListLocationsRequest) actualRequests.get(0)); + + Assert.assertEquals(request.getName(), actualRequest.getName()); + Assert.assertEquals(request.getFilter(), actualRequest.getFilter()); + Assert.assertEquals(request.getPageSize(), actualRequest.getPageSize()); + Assert.assertEquals(request.getPageToken(), actualRequest.getPageToken()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void listLocationsExceptionTest() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockLocations.addException(exception); + + try { + ListLocationsRequest request = + ListLocationsRequest.newBuilder() + .setName("name3373707") + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + client.listLocations(request); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void getLocationTest() throws Exception { + Location expectedResponse = + Location.newBuilder() + .setName("name3373707") + .setLocationId("locationId1541836720") + .setDisplayName("displayName1714148973") + .putAllLabels(new HashMap()) + .setMetadata(Any.newBuilder().build()) + .build(); + mockLocations.addResponse(expectedResponse); + + GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build(); + + Location actualResponse = client.getLocation(request); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockLocations.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + GetLocationRequest actualRequest = ((GetLocationRequest) actualRequests.get(0)); + + Assert.assertEquals(request.getName(), actualRequest.getName()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void getLocationExceptionTest() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockLocations.addException(exception); + + try { + GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build(); + client.getLocation(request); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } } diff --git a/google-cloud-dialogflow/src/test/java/com/google/cloud/dialogflow/v2/KnowledgeBasesClientHttpJsonTest.java b/google-cloud-dialogflow/src/test/java/com/google/cloud/dialogflow/v2/KnowledgeBasesClientHttpJsonTest.java index 1d9f3dc84..f3d6ea77e 100644 --- a/google-cloud-dialogflow/src/test/java/com/google/cloud/dialogflow/v2/KnowledgeBasesClientHttpJsonTest.java +++ b/google-cloud-dialogflow/src/test/java/com/google/cloud/dialogflow/v2/KnowledgeBasesClientHttpJsonTest.java @@ -17,6 +17,7 @@ package com.google.cloud.dialogflow.v2; import static com.google.cloud.dialogflow.v2.KnowledgeBasesClient.ListKnowledgeBasesPagedResponse; +import static com.google.cloud.dialogflow.v2.KnowledgeBasesClient.ListLocationsPagedResponse; import com.google.api.gax.core.NoCredentialsProvider; import com.google.api.gax.httpjson.GaxHttpJsonProperties; @@ -28,11 +29,17 @@ import com.google.api.gax.rpc.StatusCode; import com.google.api.gax.rpc.testing.FakeStatusCode; import com.google.cloud.dialogflow.v2.stub.HttpJsonKnowledgeBasesStub; +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.ListLocationsResponse; +import com.google.cloud.location.Location; import com.google.common.collect.Lists; +import com.google.protobuf.Any; import com.google.protobuf.Empty; import com.google.protobuf.FieldMask; import java.io.IOException; import java.util.Arrays; +import java.util.HashMap; import java.util.List; import javax.annotation.Generated; import org.junit.After; @@ -620,4 +627,120 @@ public void updateKnowledgeBaseExceptionTest() throws Exception { // Expected exception. } } + + @Test + public void listLocationsTest() throws Exception { + Location responsesElement = Location.newBuilder().build(); + ListLocationsResponse expectedResponse = + ListLocationsResponse.newBuilder() + .setNextPageToken("") + .addAllLocations(Arrays.asList(responsesElement)) + .build(); + mockService.addResponse(expectedResponse); + + ListLocationsRequest request = + ListLocationsRequest.newBuilder() + .setName("projects/project-3664") + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + + ListLocationsPagedResponse pagedListResponse = client.listLocations(request); + + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getLocationsList().get(0), resources.get(0)); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void listLocationsExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + ListLocationsRequest request = + ListLocationsRequest.newBuilder() + .setName("projects/project-3664") + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + client.listLocations(request); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void getLocationTest() throws Exception { + Location expectedResponse = + Location.newBuilder() + .setName("name3373707") + .setLocationId("locationId1541836720") + .setDisplayName("displayName1714148973") + .putAllLabels(new HashMap()) + .setMetadata(Any.newBuilder().build()) + .build(); + mockService.addResponse(expectedResponse); + + GetLocationRequest request = + GetLocationRequest.newBuilder() + .setName("projects/project-9062/locations/location-9062") + .build(); + + Location actualResponse = client.getLocation(request); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void getLocationExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + GetLocationRequest request = + GetLocationRequest.newBuilder() + .setName("projects/project-9062/locations/location-9062") + .build(); + client.getLocation(request); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } } diff --git a/google-cloud-dialogflow/src/test/java/com/google/cloud/dialogflow/v2/KnowledgeBasesClientTest.java b/google-cloud-dialogflow/src/test/java/com/google/cloud/dialogflow/v2/KnowledgeBasesClientTest.java index 045416395..4117653c3 100644 --- a/google-cloud-dialogflow/src/test/java/com/google/cloud/dialogflow/v2/KnowledgeBasesClientTest.java +++ b/google-cloud-dialogflow/src/test/java/com/google/cloud/dialogflow/v2/KnowledgeBasesClientTest.java @@ -17,6 +17,7 @@ package com.google.cloud.dialogflow.v2; import static com.google.cloud.dialogflow.v2.KnowledgeBasesClient.ListKnowledgeBasesPagedResponse; +import static com.google.cloud.dialogflow.v2.KnowledgeBasesClient.ListLocationsPagedResponse; import com.google.api.gax.core.NoCredentialsProvider; import com.google.api.gax.grpc.GaxGrpcProperties; @@ -25,13 +26,19 @@ import com.google.api.gax.grpc.testing.MockServiceHelper; import com.google.api.gax.rpc.ApiClientHeaderProvider; import com.google.api.gax.rpc.InvalidArgumentException; +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.ListLocationsResponse; +import com.google.cloud.location.Location; import com.google.common.collect.Lists; import com.google.protobuf.AbstractMessage; +import com.google.protobuf.Any; import com.google.protobuf.Empty; import com.google.protobuf.FieldMask; import io.grpc.StatusRuntimeException; import java.io.IOException; import java.util.Arrays; +import java.util.HashMap; import java.util.List; import java.util.UUID; import javax.annotation.Generated; @@ -45,6 +52,7 @@ @Generated("by gapic-generator-java") public class KnowledgeBasesClientTest { private static MockKnowledgeBases mockKnowledgeBases; + private static MockLocations mockLocations; private static MockServiceHelper mockServiceHelper; private LocalChannelProvider channelProvider; private KnowledgeBasesClient client; @@ -52,9 +60,11 @@ public class KnowledgeBasesClientTest { @BeforeClass public static void startStaticServer() { mockKnowledgeBases = new MockKnowledgeBases(); + mockLocations = new MockLocations(); mockServiceHelper = new MockServiceHelper( - UUID.randomUUID().toString(), Arrays.asList(mockKnowledgeBases)); + UUID.randomUUID().toString(), + Arrays.asList(mockKnowledgeBases, mockLocations)); mockServiceHelper.start(); } @@ -547,4 +557,105 @@ public void updateKnowledgeBaseExceptionTest() throws Exception { // Expected exception. } } + + @Test + public void listLocationsTest() throws Exception { + Location responsesElement = Location.newBuilder().build(); + ListLocationsResponse expectedResponse = + ListLocationsResponse.newBuilder() + .setNextPageToken("") + .addAllLocations(Arrays.asList(responsesElement)) + .build(); + mockLocations.addResponse(expectedResponse); + + ListLocationsRequest request = + ListLocationsRequest.newBuilder() + .setName("name3373707") + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + + ListLocationsPagedResponse pagedListResponse = client.listLocations(request); + + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getLocationsList().get(0), resources.get(0)); + + List actualRequests = mockLocations.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + ListLocationsRequest actualRequest = ((ListLocationsRequest) actualRequests.get(0)); + + Assert.assertEquals(request.getName(), actualRequest.getName()); + Assert.assertEquals(request.getFilter(), actualRequest.getFilter()); + Assert.assertEquals(request.getPageSize(), actualRequest.getPageSize()); + Assert.assertEquals(request.getPageToken(), actualRequest.getPageToken()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void listLocationsExceptionTest() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockLocations.addException(exception); + + try { + ListLocationsRequest request = + ListLocationsRequest.newBuilder() + .setName("name3373707") + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + client.listLocations(request); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void getLocationTest() throws Exception { + Location expectedResponse = + Location.newBuilder() + .setName("name3373707") + .setLocationId("locationId1541836720") + .setDisplayName("displayName1714148973") + .putAllLabels(new HashMap()) + .setMetadata(Any.newBuilder().build()) + .build(); + mockLocations.addResponse(expectedResponse); + + GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build(); + + Location actualResponse = client.getLocation(request); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockLocations.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + GetLocationRequest actualRequest = ((GetLocationRequest) actualRequests.get(0)); + + Assert.assertEquals(request.getName(), actualRequest.getName()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void getLocationExceptionTest() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockLocations.addException(exception); + + try { + GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build(); + client.getLocation(request); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } } diff --git a/google-cloud-dialogflow/src/test/java/com/google/cloud/dialogflow/v2/MockLocations.java b/google-cloud-dialogflow/src/test/java/com/google/cloud/dialogflow/v2/MockLocations.java new file mode 100644 index 000000000..65cf0f8c0 --- /dev/null +++ b/google-cloud-dialogflow/src/test/java/com/google/cloud/dialogflow/v2/MockLocations.java @@ -0,0 +1,59 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.dialogflow.v2; + +import com.google.api.core.BetaApi; +import com.google.api.gax.grpc.testing.MockGrpcService; +import com.google.protobuf.AbstractMessage; +import io.grpc.ServerServiceDefinition; +import java.util.List; +import javax.annotation.Generated; + +@BetaApi +@Generated("by gapic-generator-java") +public class MockLocations implements MockGrpcService { + private final MockLocationsImpl serviceImpl; + + public MockLocations() { + serviceImpl = new MockLocationsImpl(); + } + + @Override + public List getRequests() { + return serviceImpl.getRequests(); + } + + @Override + public void addResponse(AbstractMessage response) { + serviceImpl.addResponse(response); + } + + @Override + public void addException(Exception exception) { + serviceImpl.addException(exception); + } + + @Override + public ServerServiceDefinition getServiceDefinition() { + return serviceImpl.bindService(); + } + + @Override + public void reset() { + serviceImpl.reset(); + } +} diff --git a/google-cloud-dialogflow/src/test/java/com/google/cloud/dialogflow/v2/MockLocationsImpl.java b/google-cloud-dialogflow/src/test/java/com/google/cloud/dialogflow/v2/MockLocationsImpl.java new file mode 100644 index 000000000..12e4acd07 --- /dev/null +++ b/google-cloud-dialogflow/src/test/java/com/google/cloud/dialogflow/v2/MockLocationsImpl.java @@ -0,0 +1,105 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.dialogflow.v2; + +import com.google.api.core.BetaApi; +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.ListLocationsResponse; +import com.google.cloud.location.Location; +import com.google.cloud.location.LocationsGrpc.LocationsImplBase; +import com.google.protobuf.AbstractMessage; +import io.grpc.stub.StreamObserver; +import java.util.ArrayList; +import java.util.LinkedList; +import java.util.List; +import java.util.Queue; +import javax.annotation.Generated; + +@BetaApi +@Generated("by gapic-generator-java") +public class MockLocationsImpl extends LocationsImplBase { + private List requests; + private Queue responses; + + public MockLocationsImpl() { + requests = new ArrayList<>(); + responses = new LinkedList<>(); + } + + public List getRequests() { + return requests; + } + + public void addResponse(AbstractMessage response) { + responses.add(response); + } + + public void setResponses(List responses) { + this.responses = new LinkedList(responses); + } + + public void addException(Exception exception) { + responses.add(exception); + } + + public void reset() { + requests = new ArrayList<>(); + responses = new LinkedList<>(); + } + + @Override + public void listLocations( + ListLocationsRequest request, StreamObserver responseObserver) { + Object response = responses.poll(); + if (response instanceof ListLocationsResponse) { + requests.add(request); + responseObserver.onNext(((ListLocationsResponse) response)); + responseObserver.onCompleted(); + } else if (response instanceof Exception) { + responseObserver.onError(((Exception) response)); + } else { + responseObserver.onError( + new IllegalArgumentException( + String.format( + "Unrecognized response type %s for method ListLocations, expected %s or %s", + response == null ? "null" : response.getClass().getName(), + ListLocationsResponse.class.getName(), + Exception.class.getName()))); + } + } + + @Override + public void getLocation(GetLocationRequest request, StreamObserver responseObserver) { + Object response = responses.poll(); + if (response instanceof Location) { + requests.add(request); + responseObserver.onNext(((Location) response)); + responseObserver.onCompleted(); + } else if (response instanceof Exception) { + responseObserver.onError(((Exception) response)); + } else { + responseObserver.onError( + new IllegalArgumentException( + String.format( + "Unrecognized response type %s for method GetLocation, expected %s or %s", + response == null ? "null" : response.getClass().getName(), + Location.class.getName(), + Exception.class.getName()))); + } + } +} diff --git a/google-cloud-dialogflow/src/test/java/com/google/cloud/dialogflow/v2/ParticipantsClientHttpJsonTest.java b/google-cloud-dialogflow/src/test/java/com/google/cloud/dialogflow/v2/ParticipantsClientHttpJsonTest.java index 6b54face4..96a16e42f 100644 --- a/google-cloud-dialogflow/src/test/java/com/google/cloud/dialogflow/v2/ParticipantsClientHttpJsonTest.java +++ b/google-cloud-dialogflow/src/test/java/com/google/cloud/dialogflow/v2/ParticipantsClientHttpJsonTest.java @@ -16,6 +16,7 @@ package com.google.cloud.dialogflow.v2; +import static com.google.cloud.dialogflow.v2.ParticipantsClient.ListLocationsPagedResponse; import static com.google.cloud.dialogflow.v2.ParticipantsClient.ListParticipantsPagedResponse; import com.google.api.gax.core.NoCredentialsProvider; @@ -28,7 +29,12 @@ import com.google.api.gax.rpc.StatusCode; import com.google.api.gax.rpc.testing.FakeStatusCode; import com.google.cloud.dialogflow.v2.stub.HttpJsonParticipantsStub; +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.ListLocationsResponse; +import com.google.cloud.location.Location; import com.google.common.collect.Lists; +import com.google.protobuf.Any; import com.google.protobuf.FieldMask; import java.io.IOException; import java.util.ArrayList; @@ -974,4 +980,120 @@ public void suggestSmartRepliesExceptionTest2() throws Exception { // Expected exception. } } + + @Test + public void listLocationsTest() throws Exception { + Location responsesElement = Location.newBuilder().build(); + ListLocationsResponse expectedResponse = + ListLocationsResponse.newBuilder() + .setNextPageToken("") + .addAllLocations(Arrays.asList(responsesElement)) + .build(); + mockService.addResponse(expectedResponse); + + ListLocationsRequest request = + ListLocationsRequest.newBuilder() + .setName("projects/project-3664") + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + + ListLocationsPagedResponse pagedListResponse = client.listLocations(request); + + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getLocationsList().get(0), resources.get(0)); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void listLocationsExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + ListLocationsRequest request = + ListLocationsRequest.newBuilder() + .setName("projects/project-3664") + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + client.listLocations(request); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void getLocationTest() throws Exception { + Location expectedResponse = + Location.newBuilder() + .setName("name3373707") + .setLocationId("locationId1541836720") + .setDisplayName("displayName1714148973") + .putAllLabels(new HashMap()) + .setMetadata(Any.newBuilder().build()) + .build(); + mockService.addResponse(expectedResponse); + + GetLocationRequest request = + GetLocationRequest.newBuilder() + .setName("projects/project-9062/locations/location-9062") + .build(); + + Location actualResponse = client.getLocation(request); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void getLocationExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + GetLocationRequest request = + GetLocationRequest.newBuilder() + .setName("projects/project-9062/locations/location-9062") + .build(); + client.getLocation(request); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } } diff --git a/google-cloud-dialogflow/src/test/java/com/google/cloud/dialogflow/v2/ParticipantsClientTest.java b/google-cloud-dialogflow/src/test/java/com/google/cloud/dialogflow/v2/ParticipantsClientTest.java index 5717b5fe7..1c41292b7 100644 --- a/google-cloud-dialogflow/src/test/java/com/google/cloud/dialogflow/v2/ParticipantsClientTest.java +++ b/google-cloud-dialogflow/src/test/java/com/google/cloud/dialogflow/v2/ParticipantsClientTest.java @@ -16,6 +16,7 @@ package com.google.cloud.dialogflow.v2; +import static com.google.cloud.dialogflow.v2.ParticipantsClient.ListLocationsPagedResponse; import static com.google.cloud.dialogflow.v2.ParticipantsClient.ListParticipantsPagedResponse; import com.google.api.gax.core.NoCredentialsProvider; @@ -25,8 +26,13 @@ import com.google.api.gax.grpc.testing.MockServiceHelper; import com.google.api.gax.rpc.ApiClientHeaderProvider; import com.google.api.gax.rpc.InvalidArgumentException; +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.ListLocationsResponse; +import com.google.cloud.location.Location; import com.google.common.collect.Lists; import com.google.protobuf.AbstractMessage; +import com.google.protobuf.Any; import com.google.protobuf.FieldMask; import io.grpc.StatusRuntimeException; import java.io.IOException; @@ -45,6 +51,7 @@ @Generated("by gapic-generator-java") public class ParticipantsClientTest { + private static MockLocations mockLocations; private static MockParticipants mockParticipants; private static MockServiceHelper mockServiceHelper; private LocalChannelProvider channelProvider; @@ -53,9 +60,11 @@ public class ParticipantsClientTest { @BeforeClass public static void startStaticServer() { mockParticipants = new MockParticipants(); + mockLocations = new MockLocations(); mockServiceHelper = new MockServiceHelper( - UUID.randomUUID().toString(), Arrays.asList(mockParticipants)); + UUID.randomUUID().toString(), + Arrays.asList(mockParticipants, mockLocations)); mockServiceHelper.start(); } @@ -854,4 +863,105 @@ public void suggestSmartRepliesExceptionTest2() throws Exception { // Expected exception. } } + + @Test + public void listLocationsTest() throws Exception { + Location responsesElement = Location.newBuilder().build(); + ListLocationsResponse expectedResponse = + ListLocationsResponse.newBuilder() + .setNextPageToken("") + .addAllLocations(Arrays.asList(responsesElement)) + .build(); + mockLocations.addResponse(expectedResponse); + + ListLocationsRequest request = + ListLocationsRequest.newBuilder() + .setName("name3373707") + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + + ListLocationsPagedResponse pagedListResponse = client.listLocations(request); + + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getLocationsList().get(0), resources.get(0)); + + List actualRequests = mockLocations.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + ListLocationsRequest actualRequest = ((ListLocationsRequest) actualRequests.get(0)); + + Assert.assertEquals(request.getName(), actualRequest.getName()); + Assert.assertEquals(request.getFilter(), actualRequest.getFilter()); + Assert.assertEquals(request.getPageSize(), actualRequest.getPageSize()); + Assert.assertEquals(request.getPageToken(), actualRequest.getPageToken()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void listLocationsExceptionTest() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockLocations.addException(exception); + + try { + ListLocationsRequest request = + ListLocationsRequest.newBuilder() + .setName("name3373707") + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + client.listLocations(request); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void getLocationTest() throws Exception { + Location expectedResponse = + Location.newBuilder() + .setName("name3373707") + .setLocationId("locationId1541836720") + .setDisplayName("displayName1714148973") + .putAllLabels(new HashMap()) + .setMetadata(Any.newBuilder().build()) + .build(); + mockLocations.addResponse(expectedResponse); + + GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build(); + + Location actualResponse = client.getLocation(request); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockLocations.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + GetLocationRequest actualRequest = ((GetLocationRequest) actualRequests.get(0)); + + Assert.assertEquals(request.getName(), actualRequest.getName()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void getLocationExceptionTest() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockLocations.addException(exception); + + try { + GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build(); + client.getLocation(request); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } } diff --git a/google-cloud-dialogflow/src/test/java/com/google/cloud/dialogflow/v2/SessionEntityTypesClientHttpJsonTest.java b/google-cloud-dialogflow/src/test/java/com/google/cloud/dialogflow/v2/SessionEntityTypesClientHttpJsonTest.java index f03f0da87..ab6bb4cfa 100644 --- a/google-cloud-dialogflow/src/test/java/com/google/cloud/dialogflow/v2/SessionEntityTypesClientHttpJsonTest.java +++ b/google-cloud-dialogflow/src/test/java/com/google/cloud/dialogflow/v2/SessionEntityTypesClientHttpJsonTest.java @@ -16,6 +16,7 @@ package com.google.cloud.dialogflow.v2; +import static com.google.cloud.dialogflow.v2.SessionEntityTypesClient.ListLocationsPagedResponse; import static com.google.cloud.dialogflow.v2.SessionEntityTypesClient.ListSessionEntityTypesPagedResponse; import com.google.api.gax.core.NoCredentialsProvider; @@ -28,12 +29,18 @@ import com.google.api.gax.rpc.StatusCode; import com.google.api.gax.rpc.testing.FakeStatusCode; import com.google.cloud.dialogflow.v2.stub.HttpJsonSessionEntityTypesStub; +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.ListLocationsResponse; +import com.google.cloud.location.Location; import com.google.common.collect.Lists; +import com.google.protobuf.Any; import com.google.protobuf.Empty; import com.google.protobuf.FieldMask; import java.io.IOException; import java.util.ArrayList; import java.util.Arrays; +import java.util.HashMap; import java.util.List; import javax.annotation.Generated; import org.junit.After; @@ -588,4 +595,120 @@ public void deleteSessionEntityTypeExceptionTest2() throws Exception { // Expected exception. } } + + @Test + public void listLocationsTest() throws Exception { + Location responsesElement = Location.newBuilder().build(); + ListLocationsResponse expectedResponse = + ListLocationsResponse.newBuilder() + .setNextPageToken("") + .addAllLocations(Arrays.asList(responsesElement)) + .build(); + mockService.addResponse(expectedResponse); + + ListLocationsRequest request = + ListLocationsRequest.newBuilder() + .setName("projects/project-3664") + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + + ListLocationsPagedResponse pagedListResponse = client.listLocations(request); + + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getLocationsList().get(0), resources.get(0)); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void listLocationsExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + ListLocationsRequest request = + ListLocationsRequest.newBuilder() + .setName("projects/project-3664") + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + client.listLocations(request); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void getLocationTest() throws Exception { + Location expectedResponse = + Location.newBuilder() + .setName("name3373707") + .setLocationId("locationId1541836720") + .setDisplayName("displayName1714148973") + .putAllLabels(new HashMap()) + .setMetadata(Any.newBuilder().build()) + .build(); + mockService.addResponse(expectedResponse); + + GetLocationRequest request = + GetLocationRequest.newBuilder() + .setName("projects/project-9062/locations/location-9062") + .build(); + + Location actualResponse = client.getLocation(request); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void getLocationExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + GetLocationRequest request = + GetLocationRequest.newBuilder() + .setName("projects/project-9062/locations/location-9062") + .build(); + client.getLocation(request); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } } diff --git a/google-cloud-dialogflow/src/test/java/com/google/cloud/dialogflow/v2/SessionEntityTypesClientTest.java b/google-cloud-dialogflow/src/test/java/com/google/cloud/dialogflow/v2/SessionEntityTypesClientTest.java index ea7b03d72..16faaa83f 100644 --- a/google-cloud-dialogflow/src/test/java/com/google/cloud/dialogflow/v2/SessionEntityTypesClientTest.java +++ b/google-cloud-dialogflow/src/test/java/com/google/cloud/dialogflow/v2/SessionEntityTypesClientTest.java @@ -16,6 +16,7 @@ package com.google.cloud.dialogflow.v2; +import static com.google.cloud.dialogflow.v2.SessionEntityTypesClient.ListLocationsPagedResponse; import static com.google.cloud.dialogflow.v2.SessionEntityTypesClient.ListSessionEntityTypesPagedResponse; import com.google.api.gax.core.NoCredentialsProvider; @@ -25,14 +26,20 @@ import com.google.api.gax.grpc.testing.MockServiceHelper; import com.google.api.gax.rpc.ApiClientHeaderProvider; import com.google.api.gax.rpc.InvalidArgumentException; +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.ListLocationsResponse; +import com.google.cloud.location.Location; import com.google.common.collect.Lists; import com.google.protobuf.AbstractMessage; +import com.google.protobuf.Any; import com.google.protobuf.Empty; import com.google.protobuf.FieldMask; import io.grpc.StatusRuntimeException; import java.io.IOException; import java.util.ArrayList; import java.util.Arrays; +import java.util.HashMap; import java.util.List; import java.util.UUID; import javax.annotation.Generated; @@ -45,6 +52,7 @@ @Generated("by gapic-generator-java") public class SessionEntityTypesClientTest { + private static MockLocations mockLocations; private static MockServiceHelper mockServiceHelper; private static MockSessionEntityTypes mockSessionEntityTypes; private LocalChannelProvider channelProvider; @@ -53,9 +61,11 @@ public class SessionEntityTypesClientTest { @BeforeClass public static void startStaticServer() { mockSessionEntityTypes = new MockSessionEntityTypes(); + mockLocations = new MockLocations(); mockServiceHelper = new MockServiceHelper( - UUID.randomUUID().toString(), Arrays.asList(mockSessionEntityTypes)); + UUID.randomUUID().toString(), + Arrays.asList(mockSessionEntityTypes, mockLocations)); mockServiceHelper.start(); } @@ -516,4 +526,105 @@ public void deleteSessionEntityTypeExceptionTest2() throws Exception { // Expected exception. } } + + @Test + public void listLocationsTest() throws Exception { + Location responsesElement = Location.newBuilder().build(); + ListLocationsResponse expectedResponse = + ListLocationsResponse.newBuilder() + .setNextPageToken("") + .addAllLocations(Arrays.asList(responsesElement)) + .build(); + mockLocations.addResponse(expectedResponse); + + ListLocationsRequest request = + ListLocationsRequest.newBuilder() + .setName("name3373707") + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + + ListLocationsPagedResponse pagedListResponse = client.listLocations(request); + + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getLocationsList().get(0), resources.get(0)); + + List actualRequests = mockLocations.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + ListLocationsRequest actualRequest = ((ListLocationsRequest) actualRequests.get(0)); + + Assert.assertEquals(request.getName(), actualRequest.getName()); + Assert.assertEquals(request.getFilter(), actualRequest.getFilter()); + Assert.assertEquals(request.getPageSize(), actualRequest.getPageSize()); + Assert.assertEquals(request.getPageToken(), actualRequest.getPageToken()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void listLocationsExceptionTest() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockLocations.addException(exception); + + try { + ListLocationsRequest request = + ListLocationsRequest.newBuilder() + .setName("name3373707") + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + client.listLocations(request); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void getLocationTest() throws Exception { + Location expectedResponse = + Location.newBuilder() + .setName("name3373707") + .setLocationId("locationId1541836720") + .setDisplayName("displayName1714148973") + .putAllLabels(new HashMap()) + .setMetadata(Any.newBuilder().build()) + .build(); + mockLocations.addResponse(expectedResponse); + + GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build(); + + Location actualResponse = client.getLocation(request); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockLocations.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + GetLocationRequest actualRequest = ((GetLocationRequest) actualRequests.get(0)); + + Assert.assertEquals(request.getName(), actualRequest.getName()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void getLocationExceptionTest() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockLocations.addException(exception); + + try { + GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build(); + client.getLocation(request); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } } diff --git a/google-cloud-dialogflow/src/test/java/com/google/cloud/dialogflow/v2/SessionsClientHttpJsonTest.java b/google-cloud-dialogflow/src/test/java/com/google/cloud/dialogflow/v2/SessionsClientHttpJsonTest.java index c6e7fd36c..fc1a6584f 100644 --- a/google-cloud-dialogflow/src/test/java/com/google/cloud/dialogflow/v2/SessionsClientHttpJsonTest.java +++ b/google-cloud-dialogflow/src/test/java/com/google/cloud/dialogflow/v2/SessionsClientHttpJsonTest.java @@ -16,6 +16,8 @@ package com.google.cloud.dialogflow.v2; +import static com.google.cloud.dialogflow.v2.SessionsClient.ListLocationsPagedResponse; + import com.google.api.gax.core.NoCredentialsProvider; import com.google.api.gax.httpjson.GaxHttpJsonProperties; import com.google.api.gax.httpjson.testing.MockHttpService; @@ -26,9 +28,17 @@ import com.google.api.gax.rpc.StatusCode; import com.google.api.gax.rpc.testing.FakeStatusCode; import com.google.cloud.dialogflow.v2.stub.HttpJsonSessionsStub; +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.ListLocationsResponse; +import com.google.cloud.location.Location; +import com.google.common.collect.Lists; +import com.google.protobuf.Any; import com.google.protobuf.ByteString; import com.google.rpc.Status; import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; import java.util.List; import javax.annotation.Generated; import org.junit.After; @@ -177,4 +187,120 @@ public void streamingDetectIntentUnsupportedMethodTest() throws Exception { // The streamingDetectIntent() method is not supported in REST transport. // This empty test is generated for technical reasons. } + + @Test + public void listLocationsTest() throws Exception { + Location responsesElement = Location.newBuilder().build(); + ListLocationsResponse expectedResponse = + ListLocationsResponse.newBuilder() + .setNextPageToken("") + .addAllLocations(Arrays.asList(responsesElement)) + .build(); + mockService.addResponse(expectedResponse); + + ListLocationsRequest request = + ListLocationsRequest.newBuilder() + .setName("projects/project-3664") + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + + ListLocationsPagedResponse pagedListResponse = client.listLocations(request); + + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getLocationsList().get(0), resources.get(0)); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void listLocationsExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + ListLocationsRequest request = + ListLocationsRequest.newBuilder() + .setName("projects/project-3664") + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + client.listLocations(request); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void getLocationTest() throws Exception { + Location expectedResponse = + Location.newBuilder() + .setName("name3373707") + .setLocationId("locationId1541836720") + .setDisplayName("displayName1714148973") + .putAllLabels(new HashMap()) + .setMetadata(Any.newBuilder().build()) + .build(); + mockService.addResponse(expectedResponse); + + GetLocationRequest request = + GetLocationRequest.newBuilder() + .setName("projects/project-9062/locations/location-9062") + .build(); + + Location actualResponse = client.getLocation(request); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void getLocationExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + GetLocationRequest request = + GetLocationRequest.newBuilder() + .setName("projects/project-9062/locations/location-9062") + .build(); + client.getLocation(request); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } } diff --git a/google-cloud-dialogflow/src/test/java/com/google/cloud/dialogflow/v2/SessionsClientTest.java b/google-cloud-dialogflow/src/test/java/com/google/cloud/dialogflow/v2/SessionsClientTest.java index d844d6031..ed88392dd 100644 --- a/google-cloud-dialogflow/src/test/java/com/google/cloud/dialogflow/v2/SessionsClientTest.java +++ b/google-cloud-dialogflow/src/test/java/com/google/cloud/dialogflow/v2/SessionsClientTest.java @@ -16,6 +16,8 @@ package com.google.cloud.dialogflow.v2; +import static com.google.cloud.dialogflow.v2.SessionsClient.ListLocationsPagedResponse; + import com.google.api.gax.core.NoCredentialsProvider; import com.google.api.gax.grpc.GaxGrpcProperties; import com.google.api.gax.grpc.testing.LocalChannelProvider; @@ -27,13 +29,20 @@ import com.google.api.gax.rpc.BidiStreamingCallable; import com.google.api.gax.rpc.InvalidArgumentException; import com.google.api.gax.rpc.StatusCode; +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.ListLocationsResponse; +import com.google.cloud.location.Location; +import com.google.common.collect.Lists; import com.google.protobuf.AbstractMessage; +import com.google.protobuf.Any; import com.google.protobuf.ByteString; import com.google.protobuf.FieldMask; import com.google.rpc.Status; import io.grpc.StatusRuntimeException; import java.io.IOException; import java.util.Arrays; +import java.util.HashMap; import java.util.List; import java.util.UUID; import java.util.concurrent.ExecutionException; @@ -47,6 +56,7 @@ @Generated("by gapic-generator-java") public class SessionsClientTest { + private static MockLocations mockLocations; private static MockServiceHelper mockServiceHelper; private static MockSessions mockSessions; private LocalChannelProvider channelProvider; @@ -55,9 +65,11 @@ public class SessionsClientTest { @BeforeClass public static void startStaticServer() { mockSessions = new MockSessions(); + mockLocations = new MockLocations(); mockServiceHelper = new MockServiceHelper( - UUID.randomUUID().toString(), Arrays.asList(mockSessions)); + UUID.randomUUID().toString(), + Arrays.asList(mockSessions, mockLocations)); mockServiceHelper.start(); } @@ -244,4 +256,105 @@ public void streamingDetectIntentExceptionTest() throws Exception { Assert.assertEquals(StatusCode.Code.INVALID_ARGUMENT, apiException.getStatusCode().getCode()); } } + + @Test + public void listLocationsTest() throws Exception { + Location responsesElement = Location.newBuilder().build(); + ListLocationsResponse expectedResponse = + ListLocationsResponse.newBuilder() + .setNextPageToken("") + .addAllLocations(Arrays.asList(responsesElement)) + .build(); + mockLocations.addResponse(expectedResponse); + + ListLocationsRequest request = + ListLocationsRequest.newBuilder() + .setName("name3373707") + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + + ListLocationsPagedResponse pagedListResponse = client.listLocations(request); + + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getLocationsList().get(0), resources.get(0)); + + List actualRequests = mockLocations.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + ListLocationsRequest actualRequest = ((ListLocationsRequest) actualRequests.get(0)); + + Assert.assertEquals(request.getName(), actualRequest.getName()); + Assert.assertEquals(request.getFilter(), actualRequest.getFilter()); + Assert.assertEquals(request.getPageSize(), actualRequest.getPageSize()); + Assert.assertEquals(request.getPageToken(), actualRequest.getPageToken()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void listLocationsExceptionTest() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockLocations.addException(exception); + + try { + ListLocationsRequest request = + ListLocationsRequest.newBuilder() + .setName("name3373707") + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + client.listLocations(request); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void getLocationTest() throws Exception { + Location expectedResponse = + Location.newBuilder() + .setName("name3373707") + .setLocationId("locationId1541836720") + .setDisplayName("displayName1714148973") + .putAllLabels(new HashMap()) + .setMetadata(Any.newBuilder().build()) + .build(); + mockLocations.addResponse(expectedResponse); + + GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build(); + + Location actualResponse = client.getLocation(request); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockLocations.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + GetLocationRequest actualRequest = ((GetLocationRequest) actualRequests.get(0)); + + Assert.assertEquals(request.getName(), actualRequest.getName()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void getLocationExceptionTest() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockLocations.addException(exception); + + try { + GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build(); + client.getLocation(request); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } } diff --git a/google-cloud-dialogflow/src/test/java/com/google/cloud/dialogflow/v2/VersionsClientHttpJsonTest.java b/google-cloud-dialogflow/src/test/java/com/google/cloud/dialogflow/v2/VersionsClientHttpJsonTest.java index 3a207263a..5a496e77e 100644 --- a/google-cloud-dialogflow/src/test/java/com/google/cloud/dialogflow/v2/VersionsClientHttpJsonTest.java +++ b/google-cloud-dialogflow/src/test/java/com/google/cloud/dialogflow/v2/VersionsClientHttpJsonTest.java @@ -16,6 +16,7 @@ package com.google.cloud.dialogflow.v2; +import static com.google.cloud.dialogflow.v2.VersionsClient.ListLocationsPagedResponse; import static com.google.cloud.dialogflow.v2.VersionsClient.ListVersionsPagedResponse; import com.google.api.gax.core.NoCredentialsProvider; @@ -28,12 +29,18 @@ import com.google.api.gax.rpc.StatusCode; import com.google.api.gax.rpc.testing.FakeStatusCode; import com.google.cloud.dialogflow.v2.stub.HttpJsonVersionsStub; +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.ListLocationsResponse; +import com.google.cloud.location.Location; import com.google.common.collect.Lists; +import com.google.protobuf.Any; import com.google.protobuf.Empty; import com.google.protobuf.FieldMask; import com.google.protobuf.Timestamp; import java.io.IOException; import java.util.Arrays; +import java.util.HashMap; import java.util.List; import javax.annotation.Generated; import org.junit.After; @@ -509,4 +516,120 @@ public void deleteVersionExceptionTest2() throws Exception { // Expected exception. } } + + @Test + public void listLocationsTest() throws Exception { + Location responsesElement = Location.newBuilder().build(); + ListLocationsResponse expectedResponse = + ListLocationsResponse.newBuilder() + .setNextPageToken("") + .addAllLocations(Arrays.asList(responsesElement)) + .build(); + mockService.addResponse(expectedResponse); + + ListLocationsRequest request = + ListLocationsRequest.newBuilder() + .setName("projects/project-3664") + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + + ListLocationsPagedResponse pagedListResponse = client.listLocations(request); + + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getLocationsList().get(0), resources.get(0)); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void listLocationsExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + ListLocationsRequest request = + ListLocationsRequest.newBuilder() + .setName("projects/project-3664") + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + client.listLocations(request); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void getLocationTest() throws Exception { + Location expectedResponse = + Location.newBuilder() + .setName("name3373707") + .setLocationId("locationId1541836720") + .setDisplayName("displayName1714148973") + .putAllLabels(new HashMap()) + .setMetadata(Any.newBuilder().build()) + .build(); + mockService.addResponse(expectedResponse); + + GetLocationRequest request = + GetLocationRequest.newBuilder() + .setName("projects/project-9062/locations/location-9062") + .build(); + + Location actualResponse = client.getLocation(request); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void getLocationExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + GetLocationRequest request = + GetLocationRequest.newBuilder() + .setName("projects/project-9062/locations/location-9062") + .build(); + client.getLocation(request); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } } diff --git a/google-cloud-dialogflow/src/test/java/com/google/cloud/dialogflow/v2/VersionsClientTest.java b/google-cloud-dialogflow/src/test/java/com/google/cloud/dialogflow/v2/VersionsClientTest.java index 8278c441e..f8f307cf5 100644 --- a/google-cloud-dialogflow/src/test/java/com/google/cloud/dialogflow/v2/VersionsClientTest.java +++ b/google-cloud-dialogflow/src/test/java/com/google/cloud/dialogflow/v2/VersionsClientTest.java @@ -16,6 +16,7 @@ package com.google.cloud.dialogflow.v2; +import static com.google.cloud.dialogflow.v2.VersionsClient.ListLocationsPagedResponse; import static com.google.cloud.dialogflow.v2.VersionsClient.ListVersionsPagedResponse; import com.google.api.gax.core.NoCredentialsProvider; @@ -25,14 +26,20 @@ import com.google.api.gax.grpc.testing.MockServiceHelper; import com.google.api.gax.rpc.ApiClientHeaderProvider; import com.google.api.gax.rpc.InvalidArgumentException; +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.ListLocationsResponse; +import com.google.cloud.location.Location; import com.google.common.collect.Lists; import com.google.protobuf.AbstractMessage; +import com.google.protobuf.Any; import com.google.protobuf.Empty; import com.google.protobuf.FieldMask; import com.google.protobuf.Timestamp; import io.grpc.StatusRuntimeException; import java.io.IOException; import java.util.Arrays; +import java.util.HashMap; import java.util.List; import java.util.UUID; import javax.annotation.Generated; @@ -45,6 +52,7 @@ @Generated("by gapic-generator-java") public class VersionsClientTest { + private static MockLocations mockLocations; private static MockServiceHelper mockServiceHelper; private static MockVersions mockVersions; private LocalChannelProvider channelProvider; @@ -53,9 +61,11 @@ public class VersionsClientTest { @BeforeClass public static void startStaticServer() { mockVersions = new MockVersions(); + mockLocations = new MockLocations(); mockServiceHelper = new MockServiceHelper( - UUID.randomUUID().toString(), Arrays.asList(mockVersions)); + UUID.randomUUID().toString(), + Arrays.asList(mockVersions, mockLocations)); mockServiceHelper.start(); } @@ -450,4 +460,105 @@ public void deleteVersionExceptionTest2() throws Exception { // Expected exception. } } + + @Test + public void listLocationsTest() throws Exception { + Location responsesElement = Location.newBuilder().build(); + ListLocationsResponse expectedResponse = + ListLocationsResponse.newBuilder() + .setNextPageToken("") + .addAllLocations(Arrays.asList(responsesElement)) + .build(); + mockLocations.addResponse(expectedResponse); + + ListLocationsRequest request = + ListLocationsRequest.newBuilder() + .setName("name3373707") + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + + ListLocationsPagedResponse pagedListResponse = client.listLocations(request); + + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getLocationsList().get(0), resources.get(0)); + + List actualRequests = mockLocations.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + ListLocationsRequest actualRequest = ((ListLocationsRequest) actualRequests.get(0)); + + Assert.assertEquals(request.getName(), actualRequest.getName()); + Assert.assertEquals(request.getFilter(), actualRequest.getFilter()); + Assert.assertEquals(request.getPageSize(), actualRequest.getPageSize()); + Assert.assertEquals(request.getPageToken(), actualRequest.getPageToken()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void listLocationsExceptionTest() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockLocations.addException(exception); + + try { + ListLocationsRequest request = + ListLocationsRequest.newBuilder() + .setName("name3373707") + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + client.listLocations(request); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void getLocationTest() throws Exception { + Location expectedResponse = + Location.newBuilder() + .setName("name3373707") + .setLocationId("locationId1541836720") + .setDisplayName("displayName1714148973") + .putAllLabels(new HashMap()) + .setMetadata(Any.newBuilder().build()) + .build(); + mockLocations.addResponse(expectedResponse); + + GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build(); + + Location actualResponse = client.getLocation(request); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockLocations.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + GetLocationRequest actualRequest = ((GetLocationRequest) actualRequests.get(0)); + + Assert.assertEquals(request.getName(), actualRequest.getName()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void getLocationExceptionTest() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockLocations.addException(exception); + + try { + GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build(); + client.getLocation(request); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } } diff --git a/google-cloud-dialogflow/src/test/java/com/google/cloud/dialogflow/v2beta1/AgentsClientHttpJsonTest.java b/google-cloud-dialogflow/src/test/java/com/google/cloud/dialogflow/v2beta1/AgentsClientHttpJsonTest.java index 65f5f3607..6bccb0ebf 100644 --- a/google-cloud-dialogflow/src/test/java/com/google/cloud/dialogflow/v2beta1/AgentsClientHttpJsonTest.java +++ b/google-cloud-dialogflow/src/test/java/com/google/cloud/dialogflow/v2beta1/AgentsClientHttpJsonTest.java @@ -16,6 +16,7 @@ package com.google.cloud.dialogflow.v2beta1; +import static com.google.cloud.dialogflow.v2beta1.AgentsClient.ListLocationsPagedResponse; import static com.google.cloud.dialogflow.v2beta1.AgentsClient.SearchAgentsPagedResponse; import com.google.api.gax.core.NoCredentialsProvider; @@ -28,6 +29,10 @@ import com.google.api.gax.rpc.StatusCode; import com.google.api.gax.rpc.testing.FakeStatusCode; import com.google.cloud.dialogflow.v2beta1.stub.HttpJsonAgentsStub; +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.ListLocationsResponse; +import com.google.cloud.location.Location; import com.google.common.collect.Lists; import com.google.longrunning.Operation; import com.google.protobuf.Any; @@ -35,6 +40,7 @@ import java.io.IOException; import java.util.ArrayList; import java.util.Arrays; +import java.util.HashMap; import java.util.List; import java.util.concurrent.ExecutionException; import javax.annotation.Generated; @@ -999,4 +1005,120 @@ public void getValidationResultExceptionTest() throws Exception { // Expected exception. } } + + @Test + public void listLocationsTest() throws Exception { + Location responsesElement = Location.newBuilder().build(); + ListLocationsResponse expectedResponse = + ListLocationsResponse.newBuilder() + .setNextPageToken("") + .addAllLocations(Arrays.asList(responsesElement)) + .build(); + mockService.addResponse(expectedResponse); + + ListLocationsRequest request = + ListLocationsRequest.newBuilder() + .setName("projects/project-3664") + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + + ListLocationsPagedResponse pagedListResponse = client.listLocations(request); + + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getLocationsList().get(0), resources.get(0)); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void listLocationsExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + ListLocationsRequest request = + ListLocationsRequest.newBuilder() + .setName("projects/project-3664") + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + client.listLocations(request); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void getLocationTest() throws Exception { + Location expectedResponse = + Location.newBuilder() + .setName("name3373707") + .setLocationId("locationId1541836720") + .setDisplayName("displayName1714148973") + .putAllLabels(new HashMap()) + .setMetadata(Any.newBuilder().build()) + .build(); + mockService.addResponse(expectedResponse); + + GetLocationRequest request = + GetLocationRequest.newBuilder() + .setName("projects/project-9062/locations/location-9062") + .build(); + + Location actualResponse = client.getLocation(request); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void getLocationExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + GetLocationRequest request = + GetLocationRequest.newBuilder() + .setName("projects/project-9062/locations/location-9062") + .build(); + client.getLocation(request); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } } diff --git a/google-cloud-dialogflow/src/test/java/com/google/cloud/dialogflow/v2beta1/AgentsClientTest.java b/google-cloud-dialogflow/src/test/java/com/google/cloud/dialogflow/v2beta1/AgentsClientTest.java index 74058071f..486f5b268 100644 --- a/google-cloud-dialogflow/src/test/java/com/google/cloud/dialogflow/v2beta1/AgentsClientTest.java +++ b/google-cloud-dialogflow/src/test/java/com/google/cloud/dialogflow/v2beta1/AgentsClientTest.java @@ -16,6 +16,7 @@ package com.google.cloud.dialogflow.v2beta1; +import static com.google.cloud.dialogflow.v2beta1.AgentsClient.ListLocationsPagedResponse; import static com.google.cloud.dialogflow.v2beta1.AgentsClient.SearchAgentsPagedResponse; import com.google.api.gax.core.NoCredentialsProvider; @@ -26,6 +27,10 @@ import com.google.api.gax.rpc.ApiClientHeaderProvider; import com.google.api.gax.rpc.InvalidArgumentException; import com.google.api.gax.rpc.StatusCode; +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.ListLocationsResponse; +import com.google.cloud.location.Location; import com.google.common.collect.Lists; import com.google.longrunning.Operation; import com.google.protobuf.AbstractMessage; @@ -35,6 +40,7 @@ import java.io.IOException; import java.util.ArrayList; import java.util.Arrays; +import java.util.HashMap; import java.util.List; import java.util.UUID; import java.util.concurrent.ExecutionException; @@ -49,6 +55,7 @@ @Generated("by gapic-generator-java") public class AgentsClientTest { private static MockAgents mockAgents; + private static MockLocations mockLocations; private static MockServiceHelper mockServiceHelper; private LocalChannelProvider channelProvider; private AgentsClient client; @@ -56,9 +63,11 @@ public class AgentsClientTest { @BeforeClass public static void startStaticServer() { mockAgents = new MockAgents(); + mockLocations = new MockLocations(); mockServiceHelper = new MockServiceHelper( - UUID.randomUUID().toString(), Arrays.asList(mockAgents)); + UUID.randomUUID().toString(), + Arrays.asList(mockAgents, mockLocations)); mockServiceHelper.start(); } @@ -897,4 +906,105 @@ public void getValidationResultExceptionTest() throws Exception { // Expected exception. } } + + @Test + public void listLocationsTest() throws Exception { + Location responsesElement = Location.newBuilder().build(); + ListLocationsResponse expectedResponse = + ListLocationsResponse.newBuilder() + .setNextPageToken("") + .addAllLocations(Arrays.asList(responsesElement)) + .build(); + mockLocations.addResponse(expectedResponse); + + ListLocationsRequest request = + ListLocationsRequest.newBuilder() + .setName("name3373707") + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + + ListLocationsPagedResponse pagedListResponse = client.listLocations(request); + + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getLocationsList().get(0), resources.get(0)); + + List actualRequests = mockLocations.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + ListLocationsRequest actualRequest = ((ListLocationsRequest) actualRequests.get(0)); + + Assert.assertEquals(request.getName(), actualRequest.getName()); + Assert.assertEquals(request.getFilter(), actualRequest.getFilter()); + Assert.assertEquals(request.getPageSize(), actualRequest.getPageSize()); + Assert.assertEquals(request.getPageToken(), actualRequest.getPageToken()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void listLocationsExceptionTest() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockLocations.addException(exception); + + try { + ListLocationsRequest request = + ListLocationsRequest.newBuilder() + .setName("name3373707") + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + client.listLocations(request); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void getLocationTest() throws Exception { + Location expectedResponse = + Location.newBuilder() + .setName("name3373707") + .setLocationId("locationId1541836720") + .setDisplayName("displayName1714148973") + .putAllLabels(new HashMap()) + .setMetadata(Any.newBuilder().build()) + .build(); + mockLocations.addResponse(expectedResponse); + + GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build(); + + Location actualResponse = client.getLocation(request); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockLocations.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + GetLocationRequest actualRequest = ((GetLocationRequest) actualRequests.get(0)); + + Assert.assertEquals(request.getName(), actualRequest.getName()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void getLocationExceptionTest() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockLocations.addException(exception); + + try { + GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build(); + client.getLocation(request); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } } diff --git a/google-cloud-dialogflow/src/test/java/com/google/cloud/dialogflow/v2beta1/AnswerRecordsClientHttpJsonTest.java b/google-cloud-dialogflow/src/test/java/com/google/cloud/dialogflow/v2beta1/AnswerRecordsClientHttpJsonTest.java index 5157aa9c8..47e4d2378 100644 --- a/google-cloud-dialogflow/src/test/java/com/google/cloud/dialogflow/v2beta1/AnswerRecordsClientHttpJsonTest.java +++ b/google-cloud-dialogflow/src/test/java/com/google/cloud/dialogflow/v2beta1/AnswerRecordsClientHttpJsonTest.java @@ -17,6 +17,7 @@ package com.google.cloud.dialogflow.v2beta1; import static com.google.cloud.dialogflow.v2beta1.AnswerRecordsClient.ListAnswerRecordsPagedResponse; +import static com.google.cloud.dialogflow.v2beta1.AnswerRecordsClient.ListLocationsPagedResponse; import com.google.api.gax.core.NoCredentialsProvider; import com.google.api.gax.httpjson.GaxHttpJsonProperties; @@ -28,10 +29,16 @@ import com.google.api.gax.rpc.StatusCode; import com.google.api.gax.rpc.testing.FakeStatusCode; import com.google.cloud.dialogflow.v2beta1.stub.HttpJsonAnswerRecordsStub; +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.ListLocationsResponse; +import com.google.cloud.location.Location; import com.google.common.collect.Lists; +import com.google.protobuf.Any; import com.google.protobuf.FieldMask; import java.io.IOException; import java.util.Arrays; +import java.util.HashMap; import java.util.List; import javax.annotation.Generated; import org.junit.After; @@ -339,4 +346,120 @@ public void updateAnswerRecordExceptionTest() throws Exception { // Expected exception. } } + + @Test + public void listLocationsTest() throws Exception { + Location responsesElement = Location.newBuilder().build(); + ListLocationsResponse expectedResponse = + ListLocationsResponse.newBuilder() + .setNextPageToken("") + .addAllLocations(Arrays.asList(responsesElement)) + .build(); + mockService.addResponse(expectedResponse); + + ListLocationsRequest request = + ListLocationsRequest.newBuilder() + .setName("projects/project-3664") + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + + ListLocationsPagedResponse pagedListResponse = client.listLocations(request); + + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getLocationsList().get(0), resources.get(0)); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void listLocationsExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + ListLocationsRequest request = + ListLocationsRequest.newBuilder() + .setName("projects/project-3664") + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + client.listLocations(request); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void getLocationTest() throws Exception { + Location expectedResponse = + Location.newBuilder() + .setName("name3373707") + .setLocationId("locationId1541836720") + .setDisplayName("displayName1714148973") + .putAllLabels(new HashMap()) + .setMetadata(Any.newBuilder().build()) + .build(); + mockService.addResponse(expectedResponse); + + GetLocationRequest request = + GetLocationRequest.newBuilder() + .setName("projects/project-9062/locations/location-9062") + .build(); + + Location actualResponse = client.getLocation(request); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void getLocationExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + GetLocationRequest request = + GetLocationRequest.newBuilder() + .setName("projects/project-9062/locations/location-9062") + .build(); + client.getLocation(request); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } } diff --git a/google-cloud-dialogflow/src/test/java/com/google/cloud/dialogflow/v2beta1/AnswerRecordsClientTest.java b/google-cloud-dialogflow/src/test/java/com/google/cloud/dialogflow/v2beta1/AnswerRecordsClientTest.java index 9cc77af9b..a52fa3206 100644 --- a/google-cloud-dialogflow/src/test/java/com/google/cloud/dialogflow/v2beta1/AnswerRecordsClientTest.java +++ b/google-cloud-dialogflow/src/test/java/com/google/cloud/dialogflow/v2beta1/AnswerRecordsClientTest.java @@ -17,6 +17,7 @@ package com.google.cloud.dialogflow.v2beta1; import static com.google.cloud.dialogflow.v2beta1.AnswerRecordsClient.ListAnswerRecordsPagedResponse; +import static com.google.cloud.dialogflow.v2beta1.AnswerRecordsClient.ListLocationsPagedResponse; import com.google.api.gax.core.NoCredentialsProvider; import com.google.api.gax.grpc.GaxGrpcProperties; @@ -25,12 +26,18 @@ import com.google.api.gax.grpc.testing.MockServiceHelper; import com.google.api.gax.rpc.ApiClientHeaderProvider; import com.google.api.gax.rpc.InvalidArgumentException; +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.ListLocationsResponse; +import com.google.cloud.location.Location; import com.google.common.collect.Lists; import com.google.protobuf.AbstractMessage; +import com.google.protobuf.Any; import com.google.protobuf.FieldMask; import io.grpc.StatusRuntimeException; import java.io.IOException; import java.util.Arrays; +import java.util.HashMap; import java.util.List; import java.util.UUID; import javax.annotation.Generated; @@ -44,6 +51,7 @@ @Generated("by gapic-generator-java") public class AnswerRecordsClientTest { private static MockAnswerRecords mockAnswerRecords; + private static MockLocations mockLocations; private static MockServiceHelper mockServiceHelper; private LocalChannelProvider channelProvider; private AnswerRecordsClient client; @@ -51,9 +59,11 @@ public class AnswerRecordsClientTest { @BeforeClass public static void startStaticServer() { mockAnswerRecords = new MockAnswerRecords(); + mockLocations = new MockLocations(); mockServiceHelper = new MockServiceHelper( - UUID.randomUUID().toString(), Arrays.asList(mockAnswerRecords)); + UUID.randomUUID().toString(), + Arrays.asList(mockAnswerRecords, mockLocations)); mockServiceHelper.start(); } @@ -297,4 +307,105 @@ public void updateAnswerRecordExceptionTest() throws Exception { // Expected exception. } } + + @Test + public void listLocationsTest() throws Exception { + Location responsesElement = Location.newBuilder().build(); + ListLocationsResponse expectedResponse = + ListLocationsResponse.newBuilder() + .setNextPageToken("") + .addAllLocations(Arrays.asList(responsesElement)) + .build(); + mockLocations.addResponse(expectedResponse); + + ListLocationsRequest request = + ListLocationsRequest.newBuilder() + .setName("name3373707") + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + + ListLocationsPagedResponse pagedListResponse = client.listLocations(request); + + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getLocationsList().get(0), resources.get(0)); + + List actualRequests = mockLocations.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + ListLocationsRequest actualRequest = ((ListLocationsRequest) actualRequests.get(0)); + + Assert.assertEquals(request.getName(), actualRequest.getName()); + Assert.assertEquals(request.getFilter(), actualRequest.getFilter()); + Assert.assertEquals(request.getPageSize(), actualRequest.getPageSize()); + Assert.assertEquals(request.getPageToken(), actualRequest.getPageToken()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void listLocationsExceptionTest() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockLocations.addException(exception); + + try { + ListLocationsRequest request = + ListLocationsRequest.newBuilder() + .setName("name3373707") + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + client.listLocations(request); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void getLocationTest() throws Exception { + Location expectedResponse = + Location.newBuilder() + .setName("name3373707") + .setLocationId("locationId1541836720") + .setDisplayName("displayName1714148973") + .putAllLabels(new HashMap()) + .setMetadata(Any.newBuilder().build()) + .build(); + mockLocations.addResponse(expectedResponse); + + GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build(); + + Location actualResponse = client.getLocation(request); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockLocations.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + GetLocationRequest actualRequest = ((GetLocationRequest) actualRequests.get(0)); + + Assert.assertEquals(request.getName(), actualRequest.getName()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void getLocationExceptionTest() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockLocations.addException(exception); + + try { + GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build(); + client.getLocation(request); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } } diff --git a/google-cloud-dialogflow/src/test/java/com/google/cloud/dialogflow/v2beta1/ContextsClientHttpJsonTest.java b/google-cloud-dialogflow/src/test/java/com/google/cloud/dialogflow/v2beta1/ContextsClientHttpJsonTest.java index b47b5c8af..73b31281b 100644 --- a/google-cloud-dialogflow/src/test/java/com/google/cloud/dialogflow/v2beta1/ContextsClientHttpJsonTest.java +++ b/google-cloud-dialogflow/src/test/java/com/google/cloud/dialogflow/v2beta1/ContextsClientHttpJsonTest.java @@ -17,6 +17,7 @@ package com.google.cloud.dialogflow.v2beta1; import static com.google.cloud.dialogflow.v2beta1.ContextsClient.ListContextsPagedResponse; +import static com.google.cloud.dialogflow.v2beta1.ContextsClient.ListLocationsPagedResponse; import com.google.api.gax.core.NoCredentialsProvider; import com.google.api.gax.httpjson.GaxHttpJsonProperties; @@ -28,12 +29,18 @@ import com.google.api.gax.rpc.StatusCode; import com.google.api.gax.rpc.testing.FakeStatusCode; import com.google.cloud.dialogflow.v2beta1.stub.HttpJsonContextsStub; +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.ListLocationsResponse; +import com.google.cloud.location.Location; import com.google.common.collect.Lists; +import com.google.protobuf.Any; import com.google.protobuf.Empty; import com.google.protobuf.FieldMask; import com.google.protobuf.Struct; import java.io.IOException; import java.util.Arrays; +import java.util.HashMap; import java.util.List; import javax.annotation.Generated; import org.junit.After; @@ -662,4 +669,120 @@ public void deleteAllContextsExceptionTest2() throws Exception { // Expected exception. } } + + @Test + public void listLocationsTest() throws Exception { + Location responsesElement = Location.newBuilder().build(); + ListLocationsResponse expectedResponse = + ListLocationsResponse.newBuilder() + .setNextPageToken("") + .addAllLocations(Arrays.asList(responsesElement)) + .build(); + mockService.addResponse(expectedResponse); + + ListLocationsRequest request = + ListLocationsRequest.newBuilder() + .setName("projects/project-3664") + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + + ListLocationsPagedResponse pagedListResponse = client.listLocations(request); + + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getLocationsList().get(0), resources.get(0)); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void listLocationsExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + ListLocationsRequest request = + ListLocationsRequest.newBuilder() + .setName("projects/project-3664") + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + client.listLocations(request); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void getLocationTest() throws Exception { + Location expectedResponse = + Location.newBuilder() + .setName("name3373707") + .setLocationId("locationId1541836720") + .setDisplayName("displayName1714148973") + .putAllLabels(new HashMap()) + .setMetadata(Any.newBuilder().build()) + .build(); + mockService.addResponse(expectedResponse); + + GetLocationRequest request = + GetLocationRequest.newBuilder() + .setName("projects/project-9062/locations/location-9062") + .build(); + + Location actualResponse = client.getLocation(request); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void getLocationExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + GetLocationRequest request = + GetLocationRequest.newBuilder() + .setName("projects/project-9062/locations/location-9062") + .build(); + client.getLocation(request); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } } diff --git a/google-cloud-dialogflow/src/test/java/com/google/cloud/dialogflow/v2beta1/ContextsClientTest.java b/google-cloud-dialogflow/src/test/java/com/google/cloud/dialogflow/v2beta1/ContextsClientTest.java index 7577ab6f7..8f651cc53 100644 --- a/google-cloud-dialogflow/src/test/java/com/google/cloud/dialogflow/v2beta1/ContextsClientTest.java +++ b/google-cloud-dialogflow/src/test/java/com/google/cloud/dialogflow/v2beta1/ContextsClientTest.java @@ -17,6 +17,7 @@ package com.google.cloud.dialogflow.v2beta1; import static com.google.cloud.dialogflow.v2beta1.ContextsClient.ListContextsPagedResponse; +import static com.google.cloud.dialogflow.v2beta1.ContextsClient.ListLocationsPagedResponse; import com.google.api.gax.core.NoCredentialsProvider; import com.google.api.gax.grpc.GaxGrpcProperties; @@ -25,14 +26,20 @@ import com.google.api.gax.grpc.testing.MockServiceHelper; import com.google.api.gax.rpc.ApiClientHeaderProvider; import com.google.api.gax.rpc.InvalidArgumentException; +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.ListLocationsResponse; +import com.google.cloud.location.Location; import com.google.common.collect.Lists; import com.google.protobuf.AbstractMessage; +import com.google.protobuf.Any; import com.google.protobuf.Empty; import com.google.protobuf.FieldMask; import com.google.protobuf.Struct; import io.grpc.StatusRuntimeException; import java.io.IOException; import java.util.Arrays; +import java.util.HashMap; import java.util.List; import java.util.UUID; import javax.annotation.Generated; @@ -46,6 +53,7 @@ @Generated("by gapic-generator-java") public class ContextsClientTest { private static MockContexts mockContexts; + private static MockLocations mockLocations; private static MockServiceHelper mockServiceHelper; private LocalChannelProvider channelProvider; private ContextsClient client; @@ -53,9 +61,11 @@ public class ContextsClientTest { @BeforeClass public static void startStaticServer() { mockContexts = new MockContexts(); + mockLocations = new MockLocations(); mockServiceHelper = new MockServiceHelper( - UUID.randomUUID().toString(), Arrays.asList(mockContexts)); + UUID.randomUUID().toString(), + Arrays.asList(mockContexts, mockLocations)); mockServiceHelper.start(); } @@ -569,4 +579,105 @@ public void deleteAllContextsExceptionTest2() throws Exception { // Expected exception. } } + + @Test + public void listLocationsTest() throws Exception { + Location responsesElement = Location.newBuilder().build(); + ListLocationsResponse expectedResponse = + ListLocationsResponse.newBuilder() + .setNextPageToken("") + .addAllLocations(Arrays.asList(responsesElement)) + .build(); + mockLocations.addResponse(expectedResponse); + + ListLocationsRequest request = + ListLocationsRequest.newBuilder() + .setName("name3373707") + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + + ListLocationsPagedResponse pagedListResponse = client.listLocations(request); + + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getLocationsList().get(0), resources.get(0)); + + List actualRequests = mockLocations.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + ListLocationsRequest actualRequest = ((ListLocationsRequest) actualRequests.get(0)); + + Assert.assertEquals(request.getName(), actualRequest.getName()); + Assert.assertEquals(request.getFilter(), actualRequest.getFilter()); + Assert.assertEquals(request.getPageSize(), actualRequest.getPageSize()); + Assert.assertEquals(request.getPageToken(), actualRequest.getPageToken()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void listLocationsExceptionTest() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockLocations.addException(exception); + + try { + ListLocationsRequest request = + ListLocationsRequest.newBuilder() + .setName("name3373707") + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + client.listLocations(request); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void getLocationTest() throws Exception { + Location expectedResponse = + Location.newBuilder() + .setName("name3373707") + .setLocationId("locationId1541836720") + .setDisplayName("displayName1714148973") + .putAllLabels(new HashMap()) + .setMetadata(Any.newBuilder().build()) + .build(); + mockLocations.addResponse(expectedResponse); + + GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build(); + + Location actualResponse = client.getLocation(request); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockLocations.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + GetLocationRequest actualRequest = ((GetLocationRequest) actualRequests.get(0)); + + Assert.assertEquals(request.getName(), actualRequest.getName()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void getLocationExceptionTest() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockLocations.addException(exception); + + try { + GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build(); + client.getLocation(request); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } } diff --git a/google-cloud-dialogflow/src/test/java/com/google/cloud/dialogflow/v2beta1/ConversationProfilesClientHttpJsonTest.java b/google-cloud-dialogflow/src/test/java/com/google/cloud/dialogflow/v2beta1/ConversationProfilesClientHttpJsonTest.java index f8f07c0e6..725a4bda5 100644 --- a/google-cloud-dialogflow/src/test/java/com/google/cloud/dialogflow/v2beta1/ConversationProfilesClientHttpJsonTest.java +++ b/google-cloud-dialogflow/src/test/java/com/google/cloud/dialogflow/v2beta1/ConversationProfilesClientHttpJsonTest.java @@ -17,6 +17,7 @@ package com.google.cloud.dialogflow.v2beta1; import static com.google.cloud.dialogflow.v2beta1.ConversationProfilesClient.ListConversationProfilesPagedResponse; +import static com.google.cloud.dialogflow.v2beta1.ConversationProfilesClient.ListLocationsPagedResponse; import com.google.api.gax.core.NoCredentialsProvider; import com.google.api.gax.httpjson.GaxHttpJsonProperties; @@ -28,6 +29,10 @@ import com.google.api.gax.rpc.StatusCode; import com.google.api.gax.rpc.testing.FakeStatusCode; import com.google.cloud.dialogflow.v2beta1.stub.HttpJsonConversationProfilesStub; +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.ListLocationsResponse; +import com.google.cloud.location.Location; import com.google.common.collect.Lists; import com.google.longrunning.Operation; import com.google.protobuf.Any; @@ -36,6 +41,7 @@ import com.google.protobuf.Timestamp; import java.io.IOException; import java.util.Arrays; +import java.util.HashMap; import java.util.List; import java.util.concurrent.ExecutionException; import javax.annotation.Generated; @@ -867,4 +873,120 @@ public void clearSuggestionFeatureConfigExceptionTest() throws Exception { } catch (ExecutionException e) { } } + + @Test + public void listLocationsTest() throws Exception { + Location responsesElement = Location.newBuilder().build(); + ListLocationsResponse expectedResponse = + ListLocationsResponse.newBuilder() + .setNextPageToken("") + .addAllLocations(Arrays.asList(responsesElement)) + .build(); + mockService.addResponse(expectedResponse); + + ListLocationsRequest request = + ListLocationsRequest.newBuilder() + .setName("projects/project-3664") + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + + ListLocationsPagedResponse pagedListResponse = client.listLocations(request); + + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getLocationsList().get(0), resources.get(0)); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void listLocationsExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + ListLocationsRequest request = + ListLocationsRequest.newBuilder() + .setName("projects/project-3664") + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + client.listLocations(request); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void getLocationTest() throws Exception { + Location expectedResponse = + Location.newBuilder() + .setName("name3373707") + .setLocationId("locationId1541836720") + .setDisplayName("displayName1714148973") + .putAllLabels(new HashMap()) + .setMetadata(Any.newBuilder().build()) + .build(); + mockService.addResponse(expectedResponse); + + GetLocationRequest request = + GetLocationRequest.newBuilder() + .setName("projects/project-9062/locations/location-9062") + .build(); + + Location actualResponse = client.getLocation(request); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void getLocationExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + GetLocationRequest request = + GetLocationRequest.newBuilder() + .setName("projects/project-9062/locations/location-9062") + .build(); + client.getLocation(request); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } } diff --git a/google-cloud-dialogflow/src/test/java/com/google/cloud/dialogflow/v2beta1/ConversationProfilesClientTest.java b/google-cloud-dialogflow/src/test/java/com/google/cloud/dialogflow/v2beta1/ConversationProfilesClientTest.java index ff68d01c5..8fc288fba 100644 --- a/google-cloud-dialogflow/src/test/java/com/google/cloud/dialogflow/v2beta1/ConversationProfilesClientTest.java +++ b/google-cloud-dialogflow/src/test/java/com/google/cloud/dialogflow/v2beta1/ConversationProfilesClientTest.java @@ -17,6 +17,7 @@ package com.google.cloud.dialogflow.v2beta1; import static com.google.cloud.dialogflow.v2beta1.ConversationProfilesClient.ListConversationProfilesPagedResponse; +import static com.google.cloud.dialogflow.v2beta1.ConversationProfilesClient.ListLocationsPagedResponse; import com.google.api.gax.core.NoCredentialsProvider; import com.google.api.gax.grpc.GaxGrpcProperties; @@ -26,6 +27,10 @@ import com.google.api.gax.rpc.ApiClientHeaderProvider; import com.google.api.gax.rpc.InvalidArgumentException; import com.google.api.gax.rpc.StatusCode; +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.ListLocationsResponse; +import com.google.cloud.location.Location; import com.google.common.collect.Lists; import com.google.longrunning.Operation; import com.google.protobuf.AbstractMessage; @@ -36,6 +41,7 @@ import io.grpc.StatusRuntimeException; import java.io.IOException; import java.util.Arrays; +import java.util.HashMap; import java.util.List; import java.util.UUID; import java.util.concurrent.ExecutionException; @@ -50,6 +56,7 @@ @Generated("by gapic-generator-java") public class ConversationProfilesClientTest { private static MockConversationProfiles mockConversationProfiles; + private static MockLocations mockLocations; private static MockServiceHelper mockServiceHelper; private LocalChannelProvider channelProvider; private ConversationProfilesClient client; @@ -57,9 +64,11 @@ public class ConversationProfilesClientTest { @BeforeClass public static void startStaticServer() { mockConversationProfiles = new MockConversationProfiles(); + mockLocations = new MockLocations(); mockServiceHelper = new MockServiceHelper( - UUID.randomUUID().toString(), Arrays.asList(mockConversationProfiles)); + UUID.randomUUID().toString(), + Arrays.asList(mockConversationProfiles, mockLocations)); mockServiceHelper.start(); } @@ -774,4 +783,105 @@ public void clearSuggestionFeatureConfigExceptionTest() throws Exception { Assert.assertEquals(StatusCode.Code.INVALID_ARGUMENT, apiException.getStatusCode().getCode()); } } + + @Test + public void listLocationsTest() throws Exception { + Location responsesElement = Location.newBuilder().build(); + ListLocationsResponse expectedResponse = + ListLocationsResponse.newBuilder() + .setNextPageToken("") + .addAllLocations(Arrays.asList(responsesElement)) + .build(); + mockLocations.addResponse(expectedResponse); + + ListLocationsRequest request = + ListLocationsRequest.newBuilder() + .setName("name3373707") + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + + ListLocationsPagedResponse pagedListResponse = client.listLocations(request); + + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getLocationsList().get(0), resources.get(0)); + + List actualRequests = mockLocations.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + ListLocationsRequest actualRequest = ((ListLocationsRequest) actualRequests.get(0)); + + Assert.assertEquals(request.getName(), actualRequest.getName()); + Assert.assertEquals(request.getFilter(), actualRequest.getFilter()); + Assert.assertEquals(request.getPageSize(), actualRequest.getPageSize()); + Assert.assertEquals(request.getPageToken(), actualRequest.getPageToken()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void listLocationsExceptionTest() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockLocations.addException(exception); + + try { + ListLocationsRequest request = + ListLocationsRequest.newBuilder() + .setName("name3373707") + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + client.listLocations(request); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void getLocationTest() throws Exception { + Location expectedResponse = + Location.newBuilder() + .setName("name3373707") + .setLocationId("locationId1541836720") + .setDisplayName("displayName1714148973") + .putAllLabels(new HashMap()) + .setMetadata(Any.newBuilder().build()) + .build(); + mockLocations.addResponse(expectedResponse); + + GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build(); + + Location actualResponse = client.getLocation(request); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockLocations.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + GetLocationRequest actualRequest = ((GetLocationRequest) actualRequests.get(0)); + + Assert.assertEquals(request.getName(), actualRequest.getName()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void getLocationExceptionTest() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockLocations.addException(exception); + + try { + GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build(); + client.getLocation(request); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } } diff --git a/google-cloud-dialogflow/src/test/java/com/google/cloud/dialogflow/v2beta1/ConversationsClientHttpJsonTest.java b/google-cloud-dialogflow/src/test/java/com/google/cloud/dialogflow/v2beta1/ConversationsClientHttpJsonTest.java index cb4046202..a21983648 100644 --- a/google-cloud-dialogflow/src/test/java/com/google/cloud/dialogflow/v2beta1/ConversationsClientHttpJsonTest.java +++ b/google-cloud-dialogflow/src/test/java/com/google/cloud/dialogflow/v2beta1/ConversationsClientHttpJsonTest.java @@ -17,6 +17,7 @@ package com.google.cloud.dialogflow.v2beta1; import static com.google.cloud.dialogflow.v2beta1.ConversationsClient.ListConversationsPagedResponse; +import static com.google.cloud.dialogflow.v2beta1.ConversationsClient.ListLocationsPagedResponse; import static com.google.cloud.dialogflow.v2beta1.ConversationsClient.ListMessagesPagedResponse; import com.google.api.gax.core.NoCredentialsProvider; @@ -29,11 +30,17 @@ import com.google.api.gax.rpc.StatusCode; import com.google.api.gax.rpc.testing.FakeStatusCode; import com.google.cloud.dialogflow.v2beta1.stub.HttpJsonConversationsStub; +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.ListLocationsResponse; +import com.google.cloud.location.Location; import com.google.common.collect.Lists; +import com.google.protobuf.Any; import com.google.protobuf.Timestamp; import java.io.IOException; import java.util.ArrayList; import java.util.Arrays; +import java.util.HashMap; import java.util.List; import javax.annotation.Generated; import org.junit.After; @@ -796,4 +803,120 @@ public void listMessagesExceptionTest2() throws Exception { // Expected exception. } } + + @Test + public void listLocationsTest() throws Exception { + Location responsesElement = Location.newBuilder().build(); + ListLocationsResponse expectedResponse = + ListLocationsResponse.newBuilder() + .setNextPageToken("") + .addAllLocations(Arrays.asList(responsesElement)) + .build(); + mockService.addResponse(expectedResponse); + + ListLocationsRequest request = + ListLocationsRequest.newBuilder() + .setName("projects/project-3664") + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + + ListLocationsPagedResponse pagedListResponse = client.listLocations(request); + + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getLocationsList().get(0), resources.get(0)); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void listLocationsExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + ListLocationsRequest request = + ListLocationsRequest.newBuilder() + .setName("projects/project-3664") + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + client.listLocations(request); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void getLocationTest() throws Exception { + Location expectedResponse = + Location.newBuilder() + .setName("name3373707") + .setLocationId("locationId1541836720") + .setDisplayName("displayName1714148973") + .putAllLabels(new HashMap()) + .setMetadata(Any.newBuilder().build()) + .build(); + mockService.addResponse(expectedResponse); + + GetLocationRequest request = + GetLocationRequest.newBuilder() + .setName("projects/project-9062/locations/location-9062") + .build(); + + Location actualResponse = client.getLocation(request); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void getLocationExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + GetLocationRequest request = + GetLocationRequest.newBuilder() + .setName("projects/project-9062/locations/location-9062") + .build(); + client.getLocation(request); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } } diff --git a/google-cloud-dialogflow/src/test/java/com/google/cloud/dialogflow/v2beta1/ConversationsClientTest.java b/google-cloud-dialogflow/src/test/java/com/google/cloud/dialogflow/v2beta1/ConversationsClientTest.java index 87d29d7f7..22ba1cd1a 100644 --- a/google-cloud-dialogflow/src/test/java/com/google/cloud/dialogflow/v2beta1/ConversationsClientTest.java +++ b/google-cloud-dialogflow/src/test/java/com/google/cloud/dialogflow/v2beta1/ConversationsClientTest.java @@ -17,6 +17,7 @@ package com.google.cloud.dialogflow.v2beta1; import static com.google.cloud.dialogflow.v2beta1.ConversationsClient.ListConversationsPagedResponse; +import static com.google.cloud.dialogflow.v2beta1.ConversationsClient.ListLocationsPagedResponse; import static com.google.cloud.dialogflow.v2beta1.ConversationsClient.ListMessagesPagedResponse; import com.google.api.gax.core.NoCredentialsProvider; @@ -26,13 +27,19 @@ import com.google.api.gax.grpc.testing.MockServiceHelper; import com.google.api.gax.rpc.ApiClientHeaderProvider; import com.google.api.gax.rpc.InvalidArgumentException; +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.ListLocationsResponse; +import com.google.cloud.location.Location; import com.google.common.collect.Lists; import com.google.protobuf.AbstractMessage; +import com.google.protobuf.Any; import com.google.protobuf.Timestamp; import io.grpc.StatusRuntimeException; import java.io.IOException; import java.util.ArrayList; import java.util.Arrays; +import java.util.HashMap; import java.util.List; import java.util.UUID; import javax.annotation.Generated; @@ -46,6 +53,7 @@ @Generated("by gapic-generator-java") public class ConversationsClientTest { private static MockConversations mockConversations; + private static MockLocations mockLocations; private static MockServiceHelper mockServiceHelper; private LocalChannelProvider channelProvider; private ConversationsClient client; @@ -53,9 +61,11 @@ public class ConversationsClientTest { @BeforeClass public static void startStaticServer() { mockConversations = new MockConversations(); + mockLocations = new MockLocations(); mockServiceHelper = new MockServiceHelper( - UUID.randomUUID().toString(), Arrays.asList(mockConversations)); + UUID.randomUUID().toString(), + Arrays.asList(mockConversations, mockLocations)); mockServiceHelper.start(); } @@ -720,4 +730,105 @@ public void listMessagesExceptionTest2() throws Exception { // Expected exception. } } + + @Test + public void listLocationsTest() throws Exception { + Location responsesElement = Location.newBuilder().build(); + ListLocationsResponse expectedResponse = + ListLocationsResponse.newBuilder() + .setNextPageToken("") + .addAllLocations(Arrays.asList(responsesElement)) + .build(); + mockLocations.addResponse(expectedResponse); + + ListLocationsRequest request = + ListLocationsRequest.newBuilder() + .setName("name3373707") + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + + ListLocationsPagedResponse pagedListResponse = client.listLocations(request); + + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getLocationsList().get(0), resources.get(0)); + + List actualRequests = mockLocations.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + ListLocationsRequest actualRequest = ((ListLocationsRequest) actualRequests.get(0)); + + Assert.assertEquals(request.getName(), actualRequest.getName()); + Assert.assertEquals(request.getFilter(), actualRequest.getFilter()); + Assert.assertEquals(request.getPageSize(), actualRequest.getPageSize()); + Assert.assertEquals(request.getPageToken(), actualRequest.getPageToken()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void listLocationsExceptionTest() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockLocations.addException(exception); + + try { + ListLocationsRequest request = + ListLocationsRequest.newBuilder() + .setName("name3373707") + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + client.listLocations(request); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void getLocationTest() throws Exception { + Location expectedResponse = + Location.newBuilder() + .setName("name3373707") + .setLocationId("locationId1541836720") + .setDisplayName("displayName1714148973") + .putAllLabels(new HashMap()) + .setMetadata(Any.newBuilder().build()) + .build(); + mockLocations.addResponse(expectedResponse); + + GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build(); + + Location actualResponse = client.getLocation(request); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockLocations.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + GetLocationRequest actualRequest = ((GetLocationRequest) actualRequests.get(0)); + + Assert.assertEquals(request.getName(), actualRequest.getName()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void getLocationExceptionTest() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockLocations.addException(exception); + + try { + GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build(); + client.getLocation(request); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } } diff --git a/google-cloud-dialogflow/src/test/java/com/google/cloud/dialogflow/v2beta1/DocumentsClientHttpJsonTest.java b/google-cloud-dialogflow/src/test/java/com/google/cloud/dialogflow/v2beta1/DocumentsClientHttpJsonTest.java index 0192016cb..daed839e2 100644 --- a/google-cloud-dialogflow/src/test/java/com/google/cloud/dialogflow/v2beta1/DocumentsClientHttpJsonTest.java +++ b/google-cloud-dialogflow/src/test/java/com/google/cloud/dialogflow/v2beta1/DocumentsClientHttpJsonTest.java @@ -17,6 +17,7 @@ package com.google.cloud.dialogflow.v2beta1; import static com.google.cloud.dialogflow.v2beta1.DocumentsClient.ListDocumentsPagedResponse; +import static com.google.cloud.dialogflow.v2beta1.DocumentsClient.ListLocationsPagedResponse; import com.google.api.gax.core.NoCredentialsProvider; import com.google.api.gax.httpjson.GaxHttpJsonProperties; @@ -28,6 +29,10 @@ import com.google.api.gax.rpc.StatusCode; import com.google.api.gax.rpc.testing.FakeStatusCode; import com.google.cloud.dialogflow.v2beta1.stub.HttpJsonDocumentsStub; +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.ListLocationsResponse; +import com.google.cloud.location.Location; import com.google.common.collect.Lists; import com.google.longrunning.Operation; import com.google.protobuf.Any; @@ -863,4 +868,120 @@ public void reloadDocumentExceptionTest2() throws Exception { } catch (ExecutionException e) { } } + + @Test + public void listLocationsTest() throws Exception { + Location responsesElement = Location.newBuilder().build(); + ListLocationsResponse expectedResponse = + ListLocationsResponse.newBuilder() + .setNextPageToken("") + .addAllLocations(Arrays.asList(responsesElement)) + .build(); + mockService.addResponse(expectedResponse); + + ListLocationsRequest request = + ListLocationsRequest.newBuilder() + .setName("projects/project-3664") + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + + ListLocationsPagedResponse pagedListResponse = client.listLocations(request); + + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getLocationsList().get(0), resources.get(0)); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void listLocationsExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + ListLocationsRequest request = + ListLocationsRequest.newBuilder() + .setName("projects/project-3664") + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + client.listLocations(request); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void getLocationTest() throws Exception { + Location expectedResponse = + Location.newBuilder() + .setName("name3373707") + .setLocationId("locationId1541836720") + .setDisplayName("displayName1714148973") + .putAllLabels(new HashMap()) + .setMetadata(Any.newBuilder().build()) + .build(); + mockService.addResponse(expectedResponse); + + GetLocationRequest request = + GetLocationRequest.newBuilder() + .setName("projects/project-9062/locations/location-9062") + .build(); + + Location actualResponse = client.getLocation(request); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void getLocationExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + GetLocationRequest request = + GetLocationRequest.newBuilder() + .setName("projects/project-9062/locations/location-9062") + .build(); + client.getLocation(request); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } } diff --git a/google-cloud-dialogflow/src/test/java/com/google/cloud/dialogflow/v2beta1/DocumentsClientTest.java b/google-cloud-dialogflow/src/test/java/com/google/cloud/dialogflow/v2beta1/DocumentsClientTest.java index 88dd054d4..85bd76705 100644 --- a/google-cloud-dialogflow/src/test/java/com/google/cloud/dialogflow/v2beta1/DocumentsClientTest.java +++ b/google-cloud-dialogflow/src/test/java/com/google/cloud/dialogflow/v2beta1/DocumentsClientTest.java @@ -17,6 +17,7 @@ package com.google.cloud.dialogflow.v2beta1; import static com.google.cloud.dialogflow.v2beta1.DocumentsClient.ListDocumentsPagedResponse; +import static com.google.cloud.dialogflow.v2beta1.DocumentsClient.ListLocationsPagedResponse; import com.google.api.gax.core.NoCredentialsProvider; import com.google.api.gax.grpc.GaxGrpcProperties; @@ -26,6 +27,10 @@ import com.google.api.gax.rpc.ApiClientHeaderProvider; import com.google.api.gax.rpc.InvalidArgumentException; import com.google.api.gax.rpc.StatusCode; +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.ListLocationsResponse; +import com.google.cloud.location.Location; import com.google.common.collect.Lists; import com.google.longrunning.Operation; import com.google.protobuf.AbstractMessage; @@ -52,6 +57,7 @@ @Generated("by gapic-generator-java") public class DocumentsClientTest { private static MockDocuments mockDocuments; + private static MockLocations mockLocations; private static MockServiceHelper mockServiceHelper; private LocalChannelProvider channelProvider; private DocumentsClient client; @@ -59,9 +65,11 @@ public class DocumentsClientTest { @BeforeClass public static void startStaticServer() { mockDocuments = new MockDocuments(); + mockLocations = new MockLocations(); mockServiceHelper = new MockServiceHelper( - UUID.randomUUID().toString(), Arrays.asList(mockDocuments)); + UUID.randomUUID().toString(), + Arrays.asList(mockDocuments, mockLocations)); mockServiceHelper.start(); } @@ -775,4 +783,105 @@ public void reloadDocumentExceptionTest2() throws Exception { Assert.assertEquals(StatusCode.Code.INVALID_ARGUMENT, apiException.getStatusCode().getCode()); } } + + @Test + public void listLocationsTest() throws Exception { + Location responsesElement = Location.newBuilder().build(); + ListLocationsResponse expectedResponse = + ListLocationsResponse.newBuilder() + .setNextPageToken("") + .addAllLocations(Arrays.asList(responsesElement)) + .build(); + mockLocations.addResponse(expectedResponse); + + ListLocationsRequest request = + ListLocationsRequest.newBuilder() + .setName("name3373707") + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + + ListLocationsPagedResponse pagedListResponse = client.listLocations(request); + + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getLocationsList().get(0), resources.get(0)); + + List actualRequests = mockLocations.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + ListLocationsRequest actualRequest = ((ListLocationsRequest) actualRequests.get(0)); + + Assert.assertEquals(request.getName(), actualRequest.getName()); + Assert.assertEquals(request.getFilter(), actualRequest.getFilter()); + Assert.assertEquals(request.getPageSize(), actualRequest.getPageSize()); + Assert.assertEquals(request.getPageToken(), actualRequest.getPageToken()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void listLocationsExceptionTest() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockLocations.addException(exception); + + try { + ListLocationsRequest request = + ListLocationsRequest.newBuilder() + .setName("name3373707") + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + client.listLocations(request); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void getLocationTest() throws Exception { + Location expectedResponse = + Location.newBuilder() + .setName("name3373707") + .setLocationId("locationId1541836720") + .setDisplayName("displayName1714148973") + .putAllLabels(new HashMap()) + .setMetadata(Any.newBuilder().build()) + .build(); + mockLocations.addResponse(expectedResponse); + + GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build(); + + Location actualResponse = client.getLocation(request); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockLocations.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + GetLocationRequest actualRequest = ((GetLocationRequest) actualRequests.get(0)); + + Assert.assertEquals(request.getName(), actualRequest.getName()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void getLocationExceptionTest() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockLocations.addException(exception); + + try { + GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build(); + client.getLocation(request); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } } diff --git a/google-cloud-dialogflow/src/test/java/com/google/cloud/dialogflow/v2beta1/EntityTypesClientHttpJsonTest.java b/google-cloud-dialogflow/src/test/java/com/google/cloud/dialogflow/v2beta1/EntityTypesClientHttpJsonTest.java index 90d486715..84b955194 100644 --- a/google-cloud-dialogflow/src/test/java/com/google/cloud/dialogflow/v2beta1/EntityTypesClientHttpJsonTest.java +++ b/google-cloud-dialogflow/src/test/java/com/google/cloud/dialogflow/v2beta1/EntityTypesClientHttpJsonTest.java @@ -17,6 +17,7 @@ package com.google.cloud.dialogflow.v2beta1; import static com.google.cloud.dialogflow.v2beta1.EntityTypesClient.ListEntityTypesPagedResponse; +import static com.google.cloud.dialogflow.v2beta1.EntityTypesClient.ListLocationsPagedResponse; import com.google.api.gax.core.NoCredentialsProvider; import com.google.api.gax.httpjson.GaxHttpJsonProperties; @@ -28,6 +29,10 @@ import com.google.api.gax.rpc.StatusCode; import com.google.api.gax.rpc.testing.FakeStatusCode; import com.google.cloud.dialogflow.v2beta1.stub.HttpJsonEntityTypesStub; +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.ListLocationsResponse; +import com.google.cloud.location.Location; import com.google.common.collect.Lists; import com.google.longrunning.Operation; import com.google.protobuf.Any; @@ -36,6 +41,7 @@ import java.io.IOException; import java.util.ArrayList; import java.util.Arrays; +import java.util.HashMap; import java.util.List; import java.util.concurrent.ExecutionException; import javax.annotation.Generated; @@ -1686,4 +1692,120 @@ public void batchDeleteEntitiesExceptionTest4() throws Exception { } catch (ExecutionException e) { } } + + @Test + public void listLocationsTest() throws Exception { + Location responsesElement = Location.newBuilder().build(); + ListLocationsResponse expectedResponse = + ListLocationsResponse.newBuilder() + .setNextPageToken("") + .addAllLocations(Arrays.asList(responsesElement)) + .build(); + mockService.addResponse(expectedResponse); + + ListLocationsRequest request = + ListLocationsRequest.newBuilder() + .setName("projects/project-3664") + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + + ListLocationsPagedResponse pagedListResponse = client.listLocations(request); + + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getLocationsList().get(0), resources.get(0)); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void listLocationsExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + ListLocationsRequest request = + ListLocationsRequest.newBuilder() + .setName("projects/project-3664") + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + client.listLocations(request); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void getLocationTest() throws Exception { + Location expectedResponse = + Location.newBuilder() + .setName("name3373707") + .setLocationId("locationId1541836720") + .setDisplayName("displayName1714148973") + .putAllLabels(new HashMap()) + .setMetadata(Any.newBuilder().build()) + .build(); + mockService.addResponse(expectedResponse); + + GetLocationRequest request = + GetLocationRequest.newBuilder() + .setName("projects/project-9062/locations/location-9062") + .build(); + + Location actualResponse = client.getLocation(request); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void getLocationExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + GetLocationRequest request = + GetLocationRequest.newBuilder() + .setName("projects/project-9062/locations/location-9062") + .build(); + client.getLocation(request); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } } diff --git a/google-cloud-dialogflow/src/test/java/com/google/cloud/dialogflow/v2beta1/EntityTypesClientTest.java b/google-cloud-dialogflow/src/test/java/com/google/cloud/dialogflow/v2beta1/EntityTypesClientTest.java index 14df62ce9..14daa0071 100644 --- a/google-cloud-dialogflow/src/test/java/com/google/cloud/dialogflow/v2beta1/EntityTypesClientTest.java +++ b/google-cloud-dialogflow/src/test/java/com/google/cloud/dialogflow/v2beta1/EntityTypesClientTest.java @@ -17,6 +17,7 @@ package com.google.cloud.dialogflow.v2beta1; import static com.google.cloud.dialogflow.v2beta1.EntityTypesClient.ListEntityTypesPagedResponse; +import static com.google.cloud.dialogflow.v2beta1.EntityTypesClient.ListLocationsPagedResponse; import com.google.api.gax.core.NoCredentialsProvider; import com.google.api.gax.grpc.GaxGrpcProperties; @@ -26,6 +27,10 @@ import com.google.api.gax.rpc.ApiClientHeaderProvider; import com.google.api.gax.rpc.InvalidArgumentException; import com.google.api.gax.rpc.StatusCode; +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.ListLocationsResponse; +import com.google.cloud.location.Location; import com.google.common.collect.Lists; import com.google.longrunning.Operation; import com.google.protobuf.AbstractMessage; @@ -36,6 +41,7 @@ import java.io.IOException; import java.util.ArrayList; import java.util.Arrays; +import java.util.HashMap; import java.util.List; import java.util.UUID; import java.util.concurrent.ExecutionException; @@ -50,6 +56,7 @@ @Generated("by gapic-generator-java") public class EntityTypesClientTest { private static MockEntityTypes mockEntityTypes; + private static MockLocations mockLocations; private static MockServiceHelper mockServiceHelper; private LocalChannelProvider channelProvider; private EntityTypesClient client; @@ -57,9 +64,11 @@ public class EntityTypesClientTest { @BeforeClass public static void startStaticServer() { mockEntityTypes = new MockEntityTypes(); + mockLocations = new MockLocations(); mockServiceHelper = new MockServiceHelper( - UUID.randomUUID().toString(), Arrays.asList(mockEntityTypes)); + UUID.randomUUID().toString(), + Arrays.asList(mockEntityTypes, mockLocations)); mockServiceHelper.start(); } @@ -1542,4 +1551,105 @@ public void batchDeleteEntitiesExceptionTest4() throws Exception { Assert.assertEquals(StatusCode.Code.INVALID_ARGUMENT, apiException.getStatusCode().getCode()); } } + + @Test + public void listLocationsTest() throws Exception { + Location responsesElement = Location.newBuilder().build(); + ListLocationsResponse expectedResponse = + ListLocationsResponse.newBuilder() + .setNextPageToken("") + .addAllLocations(Arrays.asList(responsesElement)) + .build(); + mockLocations.addResponse(expectedResponse); + + ListLocationsRequest request = + ListLocationsRequest.newBuilder() + .setName("name3373707") + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + + ListLocationsPagedResponse pagedListResponse = client.listLocations(request); + + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getLocationsList().get(0), resources.get(0)); + + List actualRequests = mockLocations.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + ListLocationsRequest actualRequest = ((ListLocationsRequest) actualRequests.get(0)); + + Assert.assertEquals(request.getName(), actualRequest.getName()); + Assert.assertEquals(request.getFilter(), actualRequest.getFilter()); + Assert.assertEquals(request.getPageSize(), actualRequest.getPageSize()); + Assert.assertEquals(request.getPageToken(), actualRequest.getPageToken()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void listLocationsExceptionTest() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockLocations.addException(exception); + + try { + ListLocationsRequest request = + ListLocationsRequest.newBuilder() + .setName("name3373707") + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + client.listLocations(request); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void getLocationTest() throws Exception { + Location expectedResponse = + Location.newBuilder() + .setName("name3373707") + .setLocationId("locationId1541836720") + .setDisplayName("displayName1714148973") + .putAllLabels(new HashMap()) + .setMetadata(Any.newBuilder().build()) + .build(); + mockLocations.addResponse(expectedResponse); + + GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build(); + + Location actualResponse = client.getLocation(request); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockLocations.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + GetLocationRequest actualRequest = ((GetLocationRequest) actualRequests.get(0)); + + Assert.assertEquals(request.getName(), actualRequest.getName()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void getLocationExceptionTest() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockLocations.addException(exception); + + try { + GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build(); + client.getLocation(request); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } } diff --git a/google-cloud-dialogflow/src/test/java/com/google/cloud/dialogflow/v2beta1/EnvironmentsClientHttpJsonTest.java b/google-cloud-dialogflow/src/test/java/com/google/cloud/dialogflow/v2beta1/EnvironmentsClientHttpJsonTest.java index 3879e82e5..b8ce4fe75 100644 --- a/google-cloud-dialogflow/src/test/java/com/google/cloud/dialogflow/v2beta1/EnvironmentsClientHttpJsonTest.java +++ b/google-cloud-dialogflow/src/test/java/com/google/cloud/dialogflow/v2beta1/EnvironmentsClientHttpJsonTest.java @@ -18,6 +18,7 @@ import static com.google.cloud.dialogflow.v2beta1.EnvironmentsClient.GetEnvironmentHistoryPagedResponse; import static com.google.cloud.dialogflow.v2beta1.EnvironmentsClient.ListEnvironmentsPagedResponse; +import static com.google.cloud.dialogflow.v2beta1.EnvironmentsClient.ListLocationsPagedResponse; import com.google.api.gax.core.NoCredentialsProvider; import com.google.api.gax.httpjson.GaxHttpJsonProperties; @@ -29,12 +30,18 @@ import com.google.api.gax.rpc.StatusCode; import com.google.api.gax.rpc.testing.FakeStatusCode; import com.google.cloud.dialogflow.v2beta1.stub.HttpJsonEnvironmentsStub; +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.ListLocationsResponse; +import com.google.cloud.location.Location; import com.google.common.collect.Lists; +import com.google.protobuf.Any; import com.google.protobuf.Empty; import com.google.protobuf.FieldMask; import com.google.protobuf.Timestamp; import java.io.IOException; import java.util.Arrays; +import java.util.HashMap; import java.util.List; import javax.annotation.Generated; import org.junit.After; @@ -488,4 +495,120 @@ public void getEnvironmentHistoryExceptionTest() throws Exception { // Expected exception. } } + + @Test + public void listLocationsTest() throws Exception { + Location responsesElement = Location.newBuilder().build(); + ListLocationsResponse expectedResponse = + ListLocationsResponse.newBuilder() + .setNextPageToken("") + .addAllLocations(Arrays.asList(responsesElement)) + .build(); + mockService.addResponse(expectedResponse); + + ListLocationsRequest request = + ListLocationsRequest.newBuilder() + .setName("projects/project-3664") + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + + ListLocationsPagedResponse pagedListResponse = client.listLocations(request); + + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getLocationsList().get(0), resources.get(0)); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void listLocationsExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + ListLocationsRequest request = + ListLocationsRequest.newBuilder() + .setName("projects/project-3664") + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + client.listLocations(request); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void getLocationTest() throws Exception { + Location expectedResponse = + Location.newBuilder() + .setName("name3373707") + .setLocationId("locationId1541836720") + .setDisplayName("displayName1714148973") + .putAllLabels(new HashMap()) + .setMetadata(Any.newBuilder().build()) + .build(); + mockService.addResponse(expectedResponse); + + GetLocationRequest request = + GetLocationRequest.newBuilder() + .setName("projects/project-9062/locations/location-9062") + .build(); + + Location actualResponse = client.getLocation(request); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void getLocationExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + GetLocationRequest request = + GetLocationRequest.newBuilder() + .setName("projects/project-9062/locations/location-9062") + .build(); + client.getLocation(request); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } } diff --git a/google-cloud-dialogflow/src/test/java/com/google/cloud/dialogflow/v2beta1/EnvironmentsClientTest.java b/google-cloud-dialogflow/src/test/java/com/google/cloud/dialogflow/v2beta1/EnvironmentsClientTest.java index 0809299fa..e1042d817 100644 --- a/google-cloud-dialogflow/src/test/java/com/google/cloud/dialogflow/v2beta1/EnvironmentsClientTest.java +++ b/google-cloud-dialogflow/src/test/java/com/google/cloud/dialogflow/v2beta1/EnvironmentsClientTest.java @@ -18,6 +18,7 @@ import static com.google.cloud.dialogflow.v2beta1.EnvironmentsClient.GetEnvironmentHistoryPagedResponse; import static com.google.cloud.dialogflow.v2beta1.EnvironmentsClient.ListEnvironmentsPagedResponse; +import static com.google.cloud.dialogflow.v2beta1.EnvironmentsClient.ListLocationsPagedResponse; import com.google.api.gax.core.NoCredentialsProvider; import com.google.api.gax.grpc.GaxGrpcProperties; @@ -26,14 +27,20 @@ import com.google.api.gax.grpc.testing.MockServiceHelper; import com.google.api.gax.rpc.ApiClientHeaderProvider; import com.google.api.gax.rpc.InvalidArgumentException; +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.ListLocationsResponse; +import com.google.cloud.location.Location; import com.google.common.collect.Lists; import com.google.protobuf.AbstractMessage; +import com.google.protobuf.Any; import com.google.protobuf.Empty; import com.google.protobuf.FieldMask; import com.google.protobuf.Timestamp; import io.grpc.StatusRuntimeException; import java.io.IOException; import java.util.Arrays; +import java.util.HashMap; import java.util.List; import java.util.UUID; import javax.annotation.Generated; @@ -47,6 +54,7 @@ @Generated("by gapic-generator-java") public class EnvironmentsClientTest { private static MockEnvironments mockEnvironments; + private static MockLocations mockLocations; private static MockServiceHelper mockServiceHelper; private LocalChannelProvider channelProvider; private EnvironmentsClient client; @@ -54,9 +62,11 @@ public class EnvironmentsClientTest { @BeforeClass public static void startStaticServer() { mockEnvironments = new MockEnvironments(); + mockLocations = new MockLocations(); mockServiceHelper = new MockServiceHelper( - UUID.randomUUID().toString(), Arrays.asList(mockEnvironments)); + UUID.randomUUID().toString(), + Arrays.asList(mockEnvironments, mockLocations)); mockServiceHelper.start(); } @@ -436,4 +446,105 @@ public void getEnvironmentHistoryExceptionTest() throws Exception { // Expected exception. } } + + @Test + public void listLocationsTest() throws Exception { + Location responsesElement = Location.newBuilder().build(); + ListLocationsResponse expectedResponse = + ListLocationsResponse.newBuilder() + .setNextPageToken("") + .addAllLocations(Arrays.asList(responsesElement)) + .build(); + mockLocations.addResponse(expectedResponse); + + ListLocationsRequest request = + ListLocationsRequest.newBuilder() + .setName("name3373707") + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + + ListLocationsPagedResponse pagedListResponse = client.listLocations(request); + + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getLocationsList().get(0), resources.get(0)); + + List actualRequests = mockLocations.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + ListLocationsRequest actualRequest = ((ListLocationsRequest) actualRequests.get(0)); + + Assert.assertEquals(request.getName(), actualRequest.getName()); + Assert.assertEquals(request.getFilter(), actualRequest.getFilter()); + Assert.assertEquals(request.getPageSize(), actualRequest.getPageSize()); + Assert.assertEquals(request.getPageToken(), actualRequest.getPageToken()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void listLocationsExceptionTest() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockLocations.addException(exception); + + try { + ListLocationsRequest request = + ListLocationsRequest.newBuilder() + .setName("name3373707") + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + client.listLocations(request); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void getLocationTest() throws Exception { + Location expectedResponse = + Location.newBuilder() + .setName("name3373707") + .setLocationId("locationId1541836720") + .setDisplayName("displayName1714148973") + .putAllLabels(new HashMap()) + .setMetadata(Any.newBuilder().build()) + .build(); + mockLocations.addResponse(expectedResponse); + + GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build(); + + Location actualResponse = client.getLocation(request); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockLocations.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + GetLocationRequest actualRequest = ((GetLocationRequest) actualRequests.get(0)); + + Assert.assertEquals(request.getName(), actualRequest.getName()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void getLocationExceptionTest() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockLocations.addException(exception); + + try { + GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build(); + client.getLocation(request); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } } diff --git a/google-cloud-dialogflow/src/test/java/com/google/cloud/dialogflow/v2beta1/FulfillmentsClientHttpJsonTest.java b/google-cloud-dialogflow/src/test/java/com/google/cloud/dialogflow/v2beta1/FulfillmentsClientHttpJsonTest.java index 62e1222c3..eb765d30f 100644 --- a/google-cloud-dialogflow/src/test/java/com/google/cloud/dialogflow/v2beta1/FulfillmentsClientHttpJsonTest.java +++ b/google-cloud-dialogflow/src/test/java/com/google/cloud/dialogflow/v2beta1/FulfillmentsClientHttpJsonTest.java @@ -16,6 +16,8 @@ package com.google.cloud.dialogflow.v2beta1; +import static com.google.cloud.dialogflow.v2beta1.FulfillmentsClient.ListLocationsPagedResponse; + import com.google.api.gax.core.NoCredentialsProvider; import com.google.api.gax.httpjson.GaxHttpJsonProperties; import com.google.api.gax.httpjson.testing.MockHttpService; @@ -26,9 +28,17 @@ import com.google.api.gax.rpc.StatusCode; import com.google.api.gax.rpc.testing.FakeStatusCode; import com.google.cloud.dialogflow.v2beta1.stub.HttpJsonFulfillmentsStub; +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.ListLocationsResponse; +import com.google.cloud.location.Location; +import com.google.common.collect.Lists; +import com.google.protobuf.Any; import com.google.protobuf.FieldMask; import java.io.IOException; import java.util.ArrayList; +import java.util.Arrays; +import java.util.HashMap; import java.util.List; import javax.annotation.Generated; import org.junit.After; @@ -227,4 +237,120 @@ public void updateFulfillmentExceptionTest() throws Exception { // Expected exception. } } + + @Test + public void listLocationsTest() throws Exception { + Location responsesElement = Location.newBuilder().build(); + ListLocationsResponse expectedResponse = + ListLocationsResponse.newBuilder() + .setNextPageToken("") + .addAllLocations(Arrays.asList(responsesElement)) + .build(); + mockService.addResponse(expectedResponse); + + ListLocationsRequest request = + ListLocationsRequest.newBuilder() + .setName("projects/project-3664") + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + + ListLocationsPagedResponse pagedListResponse = client.listLocations(request); + + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getLocationsList().get(0), resources.get(0)); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void listLocationsExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + ListLocationsRequest request = + ListLocationsRequest.newBuilder() + .setName("projects/project-3664") + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + client.listLocations(request); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void getLocationTest() throws Exception { + Location expectedResponse = + Location.newBuilder() + .setName("name3373707") + .setLocationId("locationId1541836720") + .setDisplayName("displayName1714148973") + .putAllLabels(new HashMap()) + .setMetadata(Any.newBuilder().build()) + .build(); + mockService.addResponse(expectedResponse); + + GetLocationRequest request = + GetLocationRequest.newBuilder() + .setName("projects/project-9062/locations/location-9062") + .build(); + + Location actualResponse = client.getLocation(request); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void getLocationExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + GetLocationRequest request = + GetLocationRequest.newBuilder() + .setName("projects/project-9062/locations/location-9062") + .build(); + client.getLocation(request); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } } diff --git a/google-cloud-dialogflow/src/test/java/com/google/cloud/dialogflow/v2beta1/FulfillmentsClientTest.java b/google-cloud-dialogflow/src/test/java/com/google/cloud/dialogflow/v2beta1/FulfillmentsClientTest.java index f47bdf925..e221b69cb 100644 --- a/google-cloud-dialogflow/src/test/java/com/google/cloud/dialogflow/v2beta1/FulfillmentsClientTest.java +++ b/google-cloud-dialogflow/src/test/java/com/google/cloud/dialogflow/v2beta1/FulfillmentsClientTest.java @@ -16,6 +16,8 @@ package com.google.cloud.dialogflow.v2beta1; +import static com.google.cloud.dialogflow.v2beta1.FulfillmentsClient.ListLocationsPagedResponse; + import com.google.api.gax.core.NoCredentialsProvider; import com.google.api.gax.grpc.GaxGrpcProperties; import com.google.api.gax.grpc.testing.LocalChannelProvider; @@ -23,12 +25,19 @@ import com.google.api.gax.grpc.testing.MockServiceHelper; import com.google.api.gax.rpc.ApiClientHeaderProvider; import com.google.api.gax.rpc.InvalidArgumentException; +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.ListLocationsResponse; +import com.google.cloud.location.Location; +import com.google.common.collect.Lists; import com.google.protobuf.AbstractMessage; +import com.google.protobuf.Any; import com.google.protobuf.FieldMask; import io.grpc.StatusRuntimeException; import java.io.IOException; import java.util.ArrayList; import java.util.Arrays; +import java.util.HashMap; import java.util.List; import java.util.UUID; import javax.annotation.Generated; @@ -42,6 +51,7 @@ @Generated("by gapic-generator-java") public class FulfillmentsClientTest { private static MockFulfillments mockFulfillments; + private static MockLocations mockLocations; private static MockServiceHelper mockServiceHelper; private LocalChannelProvider channelProvider; private FulfillmentsClient client; @@ -49,9 +59,11 @@ public class FulfillmentsClientTest { @BeforeClass public static void startStaticServer() { mockFulfillments = new MockFulfillments(); + mockLocations = new MockLocations(); mockServiceHelper = new MockServiceHelper( - UUID.randomUUID().toString(), Arrays.asList(mockFulfillments)); + UUID.randomUUID().toString(), + Arrays.asList(mockFulfillments, mockLocations)); mockServiceHelper.start(); } @@ -202,4 +214,105 @@ public void updateFulfillmentExceptionTest() throws Exception { // Expected exception. } } + + @Test + public void listLocationsTest() throws Exception { + Location responsesElement = Location.newBuilder().build(); + ListLocationsResponse expectedResponse = + ListLocationsResponse.newBuilder() + .setNextPageToken("") + .addAllLocations(Arrays.asList(responsesElement)) + .build(); + mockLocations.addResponse(expectedResponse); + + ListLocationsRequest request = + ListLocationsRequest.newBuilder() + .setName("name3373707") + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + + ListLocationsPagedResponse pagedListResponse = client.listLocations(request); + + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getLocationsList().get(0), resources.get(0)); + + List actualRequests = mockLocations.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + ListLocationsRequest actualRequest = ((ListLocationsRequest) actualRequests.get(0)); + + Assert.assertEquals(request.getName(), actualRequest.getName()); + Assert.assertEquals(request.getFilter(), actualRequest.getFilter()); + Assert.assertEquals(request.getPageSize(), actualRequest.getPageSize()); + Assert.assertEquals(request.getPageToken(), actualRequest.getPageToken()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void listLocationsExceptionTest() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockLocations.addException(exception); + + try { + ListLocationsRequest request = + ListLocationsRequest.newBuilder() + .setName("name3373707") + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + client.listLocations(request); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void getLocationTest() throws Exception { + Location expectedResponse = + Location.newBuilder() + .setName("name3373707") + .setLocationId("locationId1541836720") + .setDisplayName("displayName1714148973") + .putAllLabels(new HashMap()) + .setMetadata(Any.newBuilder().build()) + .build(); + mockLocations.addResponse(expectedResponse); + + GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build(); + + Location actualResponse = client.getLocation(request); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockLocations.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + GetLocationRequest actualRequest = ((GetLocationRequest) actualRequests.get(0)); + + Assert.assertEquals(request.getName(), actualRequest.getName()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void getLocationExceptionTest() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockLocations.addException(exception); + + try { + GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build(); + client.getLocation(request); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } } diff --git a/google-cloud-dialogflow/src/test/java/com/google/cloud/dialogflow/v2beta1/IntentsClientHttpJsonTest.java b/google-cloud-dialogflow/src/test/java/com/google/cloud/dialogflow/v2beta1/IntentsClientHttpJsonTest.java index ea5ad5296..f274bb4f9 100644 --- a/google-cloud-dialogflow/src/test/java/com/google/cloud/dialogflow/v2beta1/IntentsClientHttpJsonTest.java +++ b/google-cloud-dialogflow/src/test/java/com/google/cloud/dialogflow/v2beta1/IntentsClientHttpJsonTest.java @@ -17,6 +17,7 @@ package com.google.cloud.dialogflow.v2beta1; import static com.google.cloud.dialogflow.v2beta1.IntentsClient.ListIntentsPagedResponse; +import static com.google.cloud.dialogflow.v2beta1.IntentsClient.ListLocationsPagedResponse; import com.google.api.gax.core.NoCredentialsProvider; import com.google.api.gax.httpjson.GaxHttpJsonProperties; @@ -28,6 +29,10 @@ import com.google.api.gax.rpc.StatusCode; import com.google.api.gax.rpc.testing.FakeStatusCode; import com.google.cloud.dialogflow.v2beta1.stub.HttpJsonIntentsStub; +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.ListLocationsResponse; +import com.google.cloud.location.Location; import com.google.common.collect.Lists; import com.google.longrunning.Operation; import com.google.protobuf.Any; @@ -36,6 +41,7 @@ import java.io.IOException; import java.util.ArrayList; import java.util.Arrays; +import java.util.HashMap; import java.util.List; import java.util.concurrent.ExecutionException; import javax.annotation.Generated; @@ -1613,4 +1619,120 @@ public void batchDeleteIntentsExceptionTest2() throws Exception { } catch (ExecutionException e) { } } + + @Test + public void listLocationsTest() throws Exception { + Location responsesElement = Location.newBuilder().build(); + ListLocationsResponse expectedResponse = + ListLocationsResponse.newBuilder() + .setNextPageToken("") + .addAllLocations(Arrays.asList(responsesElement)) + .build(); + mockService.addResponse(expectedResponse); + + ListLocationsRequest request = + ListLocationsRequest.newBuilder() + .setName("projects/project-3664") + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + + ListLocationsPagedResponse pagedListResponse = client.listLocations(request); + + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getLocationsList().get(0), resources.get(0)); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void listLocationsExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + ListLocationsRequest request = + ListLocationsRequest.newBuilder() + .setName("projects/project-3664") + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + client.listLocations(request); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void getLocationTest() throws Exception { + Location expectedResponse = + Location.newBuilder() + .setName("name3373707") + .setLocationId("locationId1541836720") + .setDisplayName("displayName1714148973") + .putAllLabels(new HashMap()) + .setMetadata(Any.newBuilder().build()) + .build(); + mockService.addResponse(expectedResponse); + + GetLocationRequest request = + GetLocationRequest.newBuilder() + .setName("projects/project-9062/locations/location-9062") + .build(); + + Location actualResponse = client.getLocation(request); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void getLocationExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + GetLocationRequest request = + GetLocationRequest.newBuilder() + .setName("projects/project-9062/locations/location-9062") + .build(); + client.getLocation(request); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } } diff --git a/google-cloud-dialogflow/src/test/java/com/google/cloud/dialogflow/v2beta1/IntentsClientTest.java b/google-cloud-dialogflow/src/test/java/com/google/cloud/dialogflow/v2beta1/IntentsClientTest.java index 561a30927..cfa4dfcb3 100644 --- a/google-cloud-dialogflow/src/test/java/com/google/cloud/dialogflow/v2beta1/IntentsClientTest.java +++ b/google-cloud-dialogflow/src/test/java/com/google/cloud/dialogflow/v2beta1/IntentsClientTest.java @@ -17,6 +17,7 @@ package com.google.cloud.dialogflow.v2beta1; import static com.google.cloud.dialogflow.v2beta1.IntentsClient.ListIntentsPagedResponse; +import static com.google.cloud.dialogflow.v2beta1.IntentsClient.ListLocationsPagedResponse; import com.google.api.gax.core.NoCredentialsProvider; import com.google.api.gax.grpc.GaxGrpcProperties; @@ -26,6 +27,10 @@ import com.google.api.gax.rpc.ApiClientHeaderProvider; import com.google.api.gax.rpc.InvalidArgumentException; import com.google.api.gax.rpc.StatusCode; +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.ListLocationsResponse; +import com.google.cloud.location.Location; import com.google.common.collect.Lists; import com.google.longrunning.Operation; import com.google.protobuf.AbstractMessage; @@ -36,6 +41,7 @@ import java.io.IOException; import java.util.ArrayList; import java.util.Arrays; +import java.util.HashMap; import java.util.List; import java.util.UUID; import java.util.concurrent.ExecutionException; @@ -50,6 +56,7 @@ @Generated("by gapic-generator-java") public class IntentsClientTest { private static MockIntents mockIntents; + private static MockLocations mockLocations; private static MockServiceHelper mockServiceHelper; private LocalChannelProvider channelProvider; private IntentsClient client; @@ -57,9 +64,11 @@ public class IntentsClientTest { @BeforeClass public static void startStaticServer() { mockIntents = new MockIntents(); + mockLocations = new MockLocations(); mockServiceHelper = new MockServiceHelper( - UUID.randomUUID().toString(), Arrays.asList(mockIntents)); + UUID.randomUUID().toString(), + Arrays.asList(mockIntents, mockLocations)); mockServiceHelper.start(); } @@ -1336,4 +1345,105 @@ public void batchDeleteIntentsExceptionTest2() throws Exception { Assert.assertEquals(StatusCode.Code.INVALID_ARGUMENT, apiException.getStatusCode().getCode()); } } + + @Test + public void listLocationsTest() throws Exception { + Location responsesElement = Location.newBuilder().build(); + ListLocationsResponse expectedResponse = + ListLocationsResponse.newBuilder() + .setNextPageToken("") + .addAllLocations(Arrays.asList(responsesElement)) + .build(); + mockLocations.addResponse(expectedResponse); + + ListLocationsRequest request = + ListLocationsRequest.newBuilder() + .setName("name3373707") + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + + ListLocationsPagedResponse pagedListResponse = client.listLocations(request); + + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getLocationsList().get(0), resources.get(0)); + + List actualRequests = mockLocations.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + ListLocationsRequest actualRequest = ((ListLocationsRequest) actualRequests.get(0)); + + Assert.assertEquals(request.getName(), actualRequest.getName()); + Assert.assertEquals(request.getFilter(), actualRequest.getFilter()); + Assert.assertEquals(request.getPageSize(), actualRequest.getPageSize()); + Assert.assertEquals(request.getPageToken(), actualRequest.getPageToken()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void listLocationsExceptionTest() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockLocations.addException(exception); + + try { + ListLocationsRequest request = + ListLocationsRequest.newBuilder() + .setName("name3373707") + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + client.listLocations(request); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void getLocationTest() throws Exception { + Location expectedResponse = + Location.newBuilder() + .setName("name3373707") + .setLocationId("locationId1541836720") + .setDisplayName("displayName1714148973") + .putAllLabels(new HashMap()) + .setMetadata(Any.newBuilder().build()) + .build(); + mockLocations.addResponse(expectedResponse); + + GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build(); + + Location actualResponse = client.getLocation(request); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockLocations.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + GetLocationRequest actualRequest = ((GetLocationRequest) actualRequests.get(0)); + + Assert.assertEquals(request.getName(), actualRequest.getName()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void getLocationExceptionTest() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockLocations.addException(exception); + + try { + GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build(); + client.getLocation(request); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } } diff --git a/google-cloud-dialogflow/src/test/java/com/google/cloud/dialogflow/v2beta1/KnowledgeBasesClientHttpJsonTest.java b/google-cloud-dialogflow/src/test/java/com/google/cloud/dialogflow/v2beta1/KnowledgeBasesClientHttpJsonTest.java index 9fd52c42e..e277f0d57 100644 --- a/google-cloud-dialogflow/src/test/java/com/google/cloud/dialogflow/v2beta1/KnowledgeBasesClientHttpJsonTest.java +++ b/google-cloud-dialogflow/src/test/java/com/google/cloud/dialogflow/v2beta1/KnowledgeBasesClientHttpJsonTest.java @@ -17,6 +17,7 @@ package com.google.cloud.dialogflow.v2beta1; import static com.google.cloud.dialogflow.v2beta1.KnowledgeBasesClient.ListKnowledgeBasesPagedResponse; +import static com.google.cloud.dialogflow.v2beta1.KnowledgeBasesClient.ListLocationsPagedResponse; import com.google.api.gax.core.NoCredentialsProvider; import com.google.api.gax.httpjson.GaxHttpJsonProperties; @@ -28,11 +29,17 @@ import com.google.api.gax.rpc.StatusCode; import com.google.api.gax.rpc.testing.FakeStatusCode; import com.google.cloud.dialogflow.v2beta1.stub.HttpJsonKnowledgeBasesStub; +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.ListLocationsResponse; +import com.google.cloud.location.Location; import com.google.common.collect.Lists; +import com.google.protobuf.Any; import com.google.protobuf.Empty; import com.google.protobuf.FieldMask; import java.io.IOException; import java.util.Arrays; +import java.util.HashMap; import java.util.List; import javax.annotation.Generated; import org.junit.After; @@ -682,4 +689,120 @@ public void updateKnowledgeBaseExceptionTest2() throws Exception { // Expected exception. } } + + @Test + public void listLocationsTest() throws Exception { + Location responsesElement = Location.newBuilder().build(); + ListLocationsResponse expectedResponse = + ListLocationsResponse.newBuilder() + .setNextPageToken("") + .addAllLocations(Arrays.asList(responsesElement)) + .build(); + mockService.addResponse(expectedResponse); + + ListLocationsRequest request = + ListLocationsRequest.newBuilder() + .setName("projects/project-3664") + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + + ListLocationsPagedResponse pagedListResponse = client.listLocations(request); + + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getLocationsList().get(0), resources.get(0)); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void listLocationsExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + ListLocationsRequest request = + ListLocationsRequest.newBuilder() + .setName("projects/project-3664") + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + client.listLocations(request); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void getLocationTest() throws Exception { + Location expectedResponse = + Location.newBuilder() + .setName("name3373707") + .setLocationId("locationId1541836720") + .setDisplayName("displayName1714148973") + .putAllLabels(new HashMap()) + .setMetadata(Any.newBuilder().build()) + .build(); + mockService.addResponse(expectedResponse); + + GetLocationRequest request = + GetLocationRequest.newBuilder() + .setName("projects/project-9062/locations/location-9062") + .build(); + + Location actualResponse = client.getLocation(request); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void getLocationExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + GetLocationRequest request = + GetLocationRequest.newBuilder() + .setName("projects/project-9062/locations/location-9062") + .build(); + client.getLocation(request); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } } diff --git a/google-cloud-dialogflow/src/test/java/com/google/cloud/dialogflow/v2beta1/KnowledgeBasesClientTest.java b/google-cloud-dialogflow/src/test/java/com/google/cloud/dialogflow/v2beta1/KnowledgeBasesClientTest.java index caf4530a2..969ce4458 100644 --- a/google-cloud-dialogflow/src/test/java/com/google/cloud/dialogflow/v2beta1/KnowledgeBasesClientTest.java +++ b/google-cloud-dialogflow/src/test/java/com/google/cloud/dialogflow/v2beta1/KnowledgeBasesClientTest.java @@ -17,6 +17,7 @@ package com.google.cloud.dialogflow.v2beta1; import static com.google.cloud.dialogflow.v2beta1.KnowledgeBasesClient.ListKnowledgeBasesPagedResponse; +import static com.google.cloud.dialogflow.v2beta1.KnowledgeBasesClient.ListLocationsPagedResponse; import com.google.api.gax.core.NoCredentialsProvider; import com.google.api.gax.grpc.GaxGrpcProperties; @@ -25,13 +26,19 @@ import com.google.api.gax.grpc.testing.MockServiceHelper; import com.google.api.gax.rpc.ApiClientHeaderProvider; import com.google.api.gax.rpc.InvalidArgumentException; +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.ListLocationsResponse; +import com.google.cloud.location.Location; import com.google.common.collect.Lists; import com.google.protobuf.AbstractMessage; +import com.google.protobuf.Any; import com.google.protobuf.Empty; import com.google.protobuf.FieldMask; import io.grpc.StatusRuntimeException; import java.io.IOException; import java.util.Arrays; +import java.util.HashMap; import java.util.List; import java.util.UUID; import javax.annotation.Generated; @@ -45,6 +52,7 @@ @Generated("by gapic-generator-java") public class KnowledgeBasesClientTest { private static MockKnowledgeBases mockKnowledgeBases; + private static MockLocations mockLocations; private static MockServiceHelper mockServiceHelper; private LocalChannelProvider channelProvider; private KnowledgeBasesClient client; @@ -52,9 +60,11 @@ public class KnowledgeBasesClientTest { @BeforeClass public static void startStaticServer() { mockKnowledgeBases = new MockKnowledgeBases(); + mockLocations = new MockLocations(); mockServiceHelper = new MockServiceHelper( - UUID.randomUUID().toString(), Arrays.asList(mockKnowledgeBases)); + UUID.randomUUID().toString(), + Arrays.asList(mockKnowledgeBases, mockLocations)); mockServiceHelper.start(); } @@ -589,4 +599,105 @@ public void updateKnowledgeBaseExceptionTest2() throws Exception { // Expected exception. } } + + @Test + public void listLocationsTest() throws Exception { + Location responsesElement = Location.newBuilder().build(); + ListLocationsResponse expectedResponse = + ListLocationsResponse.newBuilder() + .setNextPageToken("") + .addAllLocations(Arrays.asList(responsesElement)) + .build(); + mockLocations.addResponse(expectedResponse); + + ListLocationsRequest request = + ListLocationsRequest.newBuilder() + .setName("name3373707") + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + + ListLocationsPagedResponse pagedListResponse = client.listLocations(request); + + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getLocationsList().get(0), resources.get(0)); + + List actualRequests = mockLocations.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + ListLocationsRequest actualRequest = ((ListLocationsRequest) actualRequests.get(0)); + + Assert.assertEquals(request.getName(), actualRequest.getName()); + Assert.assertEquals(request.getFilter(), actualRequest.getFilter()); + Assert.assertEquals(request.getPageSize(), actualRequest.getPageSize()); + Assert.assertEquals(request.getPageToken(), actualRequest.getPageToken()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void listLocationsExceptionTest() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockLocations.addException(exception); + + try { + ListLocationsRequest request = + ListLocationsRequest.newBuilder() + .setName("name3373707") + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + client.listLocations(request); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void getLocationTest() throws Exception { + Location expectedResponse = + Location.newBuilder() + .setName("name3373707") + .setLocationId("locationId1541836720") + .setDisplayName("displayName1714148973") + .putAllLabels(new HashMap()) + .setMetadata(Any.newBuilder().build()) + .build(); + mockLocations.addResponse(expectedResponse); + + GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build(); + + Location actualResponse = client.getLocation(request); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockLocations.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + GetLocationRequest actualRequest = ((GetLocationRequest) actualRequests.get(0)); + + Assert.assertEquals(request.getName(), actualRequest.getName()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void getLocationExceptionTest() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockLocations.addException(exception); + + try { + GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build(); + client.getLocation(request); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } } diff --git a/google-cloud-dialogflow/src/test/java/com/google/cloud/dialogflow/v2beta1/MockLocations.java b/google-cloud-dialogflow/src/test/java/com/google/cloud/dialogflow/v2beta1/MockLocations.java new file mode 100644 index 000000000..6d82a5a76 --- /dev/null +++ b/google-cloud-dialogflow/src/test/java/com/google/cloud/dialogflow/v2beta1/MockLocations.java @@ -0,0 +1,59 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.dialogflow.v2beta1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.grpc.testing.MockGrpcService; +import com.google.protobuf.AbstractMessage; +import io.grpc.ServerServiceDefinition; +import java.util.List; +import javax.annotation.Generated; + +@BetaApi +@Generated("by gapic-generator-java") +public class MockLocations implements MockGrpcService { + private final MockLocationsImpl serviceImpl; + + public MockLocations() { + serviceImpl = new MockLocationsImpl(); + } + + @Override + public List getRequests() { + return serviceImpl.getRequests(); + } + + @Override + public void addResponse(AbstractMessage response) { + serviceImpl.addResponse(response); + } + + @Override + public void addException(Exception exception) { + serviceImpl.addException(exception); + } + + @Override + public ServerServiceDefinition getServiceDefinition() { + return serviceImpl.bindService(); + } + + @Override + public void reset() { + serviceImpl.reset(); + } +} diff --git a/google-cloud-dialogflow/src/test/java/com/google/cloud/dialogflow/v2beta1/MockLocationsImpl.java b/google-cloud-dialogflow/src/test/java/com/google/cloud/dialogflow/v2beta1/MockLocationsImpl.java new file mode 100644 index 000000000..59038e294 --- /dev/null +++ b/google-cloud-dialogflow/src/test/java/com/google/cloud/dialogflow/v2beta1/MockLocationsImpl.java @@ -0,0 +1,105 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.dialogflow.v2beta1; + +import com.google.api.core.BetaApi; +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.ListLocationsResponse; +import com.google.cloud.location.Location; +import com.google.cloud.location.LocationsGrpc.LocationsImplBase; +import com.google.protobuf.AbstractMessage; +import io.grpc.stub.StreamObserver; +import java.util.ArrayList; +import java.util.LinkedList; +import java.util.List; +import java.util.Queue; +import javax.annotation.Generated; + +@BetaApi +@Generated("by gapic-generator-java") +public class MockLocationsImpl extends LocationsImplBase { + private List requests; + private Queue responses; + + public MockLocationsImpl() { + requests = new ArrayList<>(); + responses = new LinkedList<>(); + } + + public List getRequests() { + return requests; + } + + public void addResponse(AbstractMessage response) { + responses.add(response); + } + + public void setResponses(List responses) { + this.responses = new LinkedList(responses); + } + + public void addException(Exception exception) { + responses.add(exception); + } + + public void reset() { + requests = new ArrayList<>(); + responses = new LinkedList<>(); + } + + @Override + public void listLocations( + ListLocationsRequest request, StreamObserver responseObserver) { + Object response = responses.poll(); + if (response instanceof ListLocationsResponse) { + requests.add(request); + responseObserver.onNext(((ListLocationsResponse) response)); + responseObserver.onCompleted(); + } else if (response instanceof Exception) { + responseObserver.onError(((Exception) response)); + } else { + responseObserver.onError( + new IllegalArgumentException( + String.format( + "Unrecognized response type %s for method ListLocations, expected %s or %s", + response == null ? "null" : response.getClass().getName(), + ListLocationsResponse.class.getName(), + Exception.class.getName()))); + } + } + + @Override + public void getLocation(GetLocationRequest request, StreamObserver responseObserver) { + Object response = responses.poll(); + if (response instanceof Location) { + requests.add(request); + responseObserver.onNext(((Location) response)); + responseObserver.onCompleted(); + } else if (response instanceof Exception) { + responseObserver.onError(((Exception) response)); + } else { + responseObserver.onError( + new IllegalArgumentException( + String.format( + "Unrecognized response type %s for method GetLocation, expected %s or %s", + response == null ? "null" : response.getClass().getName(), + Location.class.getName(), + Exception.class.getName()))); + } + } +} diff --git a/google-cloud-dialogflow/src/test/java/com/google/cloud/dialogflow/v2beta1/ParticipantsClientHttpJsonTest.java b/google-cloud-dialogflow/src/test/java/com/google/cloud/dialogflow/v2beta1/ParticipantsClientHttpJsonTest.java index 9c1d66c2b..95c0ec7b5 100644 --- a/google-cloud-dialogflow/src/test/java/com/google/cloud/dialogflow/v2beta1/ParticipantsClientHttpJsonTest.java +++ b/google-cloud-dialogflow/src/test/java/com/google/cloud/dialogflow/v2beta1/ParticipantsClientHttpJsonTest.java @@ -16,6 +16,7 @@ package com.google.cloud.dialogflow.v2beta1; +import static com.google.cloud.dialogflow.v2beta1.ParticipantsClient.ListLocationsPagedResponse; import static com.google.cloud.dialogflow.v2beta1.ParticipantsClient.ListParticipantsPagedResponse; import static com.google.cloud.dialogflow.v2beta1.ParticipantsClient.ListSuggestionsPagedResponse; @@ -29,7 +30,12 @@ import com.google.api.gax.rpc.StatusCode; import com.google.api.gax.rpc.testing.FakeStatusCode; import com.google.cloud.dialogflow.v2beta1.stub.HttpJsonParticipantsStub; +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.ListLocationsResponse; +import com.google.cloud.location.Location; import com.google.common.collect.Lists; +import com.google.protobuf.Any; import com.google.protobuf.FieldMask; import java.io.IOException; import java.util.ArrayList; @@ -470,6 +476,62 @@ public void analyzeContentTest() throws Exception { .build(); mockService.addResponse(expectedResponse); + ParticipantName participant = + ParticipantName.ofProjectConversationParticipantName( + "[PROJECT]", "[CONVERSATION]", "[PARTICIPANT]"); + AudioInput audioInput = AudioInput.newBuilder().build(); + + AnalyzeContentResponse actualResponse = client.analyzeContent(participant, audioInput); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void analyzeContentExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + ParticipantName participant = + ParticipantName.ofProjectConversationParticipantName( + "[PROJECT]", "[CONVERSATION]", "[PARTICIPANT]"); + AudioInput audioInput = AudioInput.newBuilder().build(); + client.analyzeContent(participant, audioInput); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void analyzeContentTest2() throws Exception { + AnalyzeContentResponse expectedResponse = + AnalyzeContentResponse.newBuilder() + .setReplyText("replyText-433699017") + .setReplyAudio(OutputAudio.newBuilder().build()) + .setAutomatedAgentReply(AutomatedAgentReply.newBuilder().build()) + .setMessage(Message.newBuilder().build()) + .addAllHumanAgentSuggestionResults(new ArrayList()) + .addAllEndUserSuggestionResults(new ArrayList()) + .setDtmfParameters(DtmfParameters.newBuilder().build()) + .build(); + mockService.addResponse(expectedResponse); + ParticipantName participant = ParticipantName.ofProjectConversationParticipantName( "[PROJECT]", "[CONVERSATION]", "[PARTICIPANT]"); @@ -494,7 +556,7 @@ public void analyzeContentTest() throws Exception { } @Test - public void analyzeContentExceptionTest() throws Exception { + public void analyzeContentExceptionTest2() throws Exception { ApiException exception = ApiExceptionFactory.createException( new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); @@ -513,7 +575,7 @@ public void analyzeContentExceptionTest() throws Exception { } @Test - public void analyzeContentTest2() throws Exception { + public void analyzeContentTest3() throws Exception { AnalyzeContentResponse expectedResponse = AnalyzeContentResponse.newBuilder() .setReplyText("replyText-433699017") @@ -550,7 +612,7 @@ public void analyzeContentTest2() throws Exception { } @Test - public void analyzeContentExceptionTest2() throws Exception { + public void analyzeContentExceptionTest3() throws Exception { ApiException exception = ApiExceptionFactory.createException( new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); @@ -569,7 +631,61 @@ public void analyzeContentExceptionTest2() throws Exception { } @Test - public void analyzeContentTest3() throws Exception { + public void analyzeContentTest4() throws Exception { + AnalyzeContentResponse expectedResponse = + AnalyzeContentResponse.newBuilder() + .setReplyText("replyText-433699017") + .setReplyAudio(OutputAudio.newBuilder().build()) + .setAutomatedAgentReply(AutomatedAgentReply.newBuilder().build()) + .setMessage(Message.newBuilder().build()) + .addAllHumanAgentSuggestionResults(new ArrayList()) + .addAllEndUserSuggestionResults(new ArrayList()) + .setDtmfParameters(DtmfParameters.newBuilder().build()) + .build(); + mockService.addResponse(expectedResponse); + + String participant = + "projects/project-8054/conversations/conversation-8054/participants/participant-8054"; + AudioInput audioInput = AudioInput.newBuilder().build(); + + AnalyzeContentResponse actualResponse = client.analyzeContent(participant, audioInput); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void analyzeContentExceptionTest4() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + String participant = + "projects/project-8054/conversations/conversation-8054/participants/participant-8054"; + AudioInput audioInput = AudioInput.newBuilder().build(); + client.analyzeContent(participant, audioInput); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void analyzeContentTest5() throws Exception { AnalyzeContentResponse expectedResponse = AnalyzeContentResponse.newBuilder() .setReplyText("replyText-433699017") @@ -605,7 +721,7 @@ public void analyzeContentTest3() throws Exception { } @Test - public void analyzeContentExceptionTest3() throws Exception { + public void analyzeContentExceptionTest5() throws Exception { ApiException exception = ApiExceptionFactory.createException( new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); @@ -623,7 +739,7 @@ public void analyzeContentExceptionTest3() throws Exception { } @Test - public void analyzeContentTest4() throws Exception { + public void analyzeContentTest6() throws Exception { AnalyzeContentResponse expectedResponse = AnalyzeContentResponse.newBuilder() .setReplyText("replyText-433699017") @@ -659,7 +775,7 @@ public void analyzeContentTest4() throws Exception { } @Test - public void analyzeContentExceptionTest4() throws Exception { + public void analyzeContentExceptionTest6() throws Exception { ApiException exception = ApiExceptionFactory.createException( new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); @@ -1103,4 +1219,120 @@ public void compileSuggestionExceptionTest() throws Exception { // Expected exception. } } + + @Test + public void listLocationsTest() throws Exception { + Location responsesElement = Location.newBuilder().build(); + ListLocationsResponse expectedResponse = + ListLocationsResponse.newBuilder() + .setNextPageToken("") + .addAllLocations(Arrays.asList(responsesElement)) + .build(); + mockService.addResponse(expectedResponse); + + ListLocationsRequest request = + ListLocationsRequest.newBuilder() + .setName("projects/project-3664") + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + + ListLocationsPagedResponse pagedListResponse = client.listLocations(request); + + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getLocationsList().get(0), resources.get(0)); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void listLocationsExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + ListLocationsRequest request = + ListLocationsRequest.newBuilder() + .setName("projects/project-3664") + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + client.listLocations(request); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void getLocationTest() throws Exception { + Location expectedResponse = + Location.newBuilder() + .setName("name3373707") + .setLocationId("locationId1541836720") + .setDisplayName("displayName1714148973") + .putAllLabels(new HashMap()) + .setMetadata(Any.newBuilder().build()) + .build(); + mockService.addResponse(expectedResponse); + + GetLocationRequest request = + GetLocationRequest.newBuilder() + .setName("projects/project-9062/locations/location-9062") + .build(); + + Location actualResponse = client.getLocation(request); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void getLocationExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + GetLocationRequest request = + GetLocationRequest.newBuilder() + .setName("projects/project-9062/locations/location-9062") + .build(); + client.getLocation(request); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } } diff --git a/google-cloud-dialogflow/src/test/java/com/google/cloud/dialogflow/v2beta1/ParticipantsClientTest.java b/google-cloud-dialogflow/src/test/java/com/google/cloud/dialogflow/v2beta1/ParticipantsClientTest.java index 45fdbba0c..654d9f1f5 100644 --- a/google-cloud-dialogflow/src/test/java/com/google/cloud/dialogflow/v2beta1/ParticipantsClientTest.java +++ b/google-cloud-dialogflow/src/test/java/com/google/cloud/dialogflow/v2beta1/ParticipantsClientTest.java @@ -16,6 +16,7 @@ package com.google.cloud.dialogflow.v2beta1; +import static com.google.cloud.dialogflow.v2beta1.ParticipantsClient.ListLocationsPagedResponse; import static com.google.cloud.dialogflow.v2beta1.ParticipantsClient.ListParticipantsPagedResponse; import static com.google.cloud.dialogflow.v2beta1.ParticipantsClient.ListSuggestionsPagedResponse; @@ -30,8 +31,13 @@ import com.google.api.gax.rpc.BidiStreamingCallable; import com.google.api.gax.rpc.InvalidArgumentException; import com.google.api.gax.rpc.StatusCode; +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.ListLocationsResponse; +import com.google.cloud.location.Location; import com.google.common.collect.Lists; import com.google.protobuf.AbstractMessage; +import com.google.protobuf.Any; import com.google.protobuf.FieldMask; import com.google.protobuf.Struct; import io.grpc.StatusRuntimeException; @@ -52,6 +58,7 @@ @Generated("by gapic-generator-java") public class ParticipantsClientTest { + private static MockLocations mockLocations; private static MockParticipants mockParticipants; private static MockServiceHelper mockServiceHelper; private LocalChannelProvider channelProvider; @@ -60,9 +67,11 @@ public class ParticipantsClientTest { @BeforeClass public static void startStaticServer() { mockParticipants = new MockParticipants(); + mockLocations = new MockLocations(); mockServiceHelper = new MockServiceHelper( - UUID.randomUUID().toString(), Arrays.asList(mockParticipants)); + UUID.randomUUID().toString(), + Arrays.asList(mockParticipants, mockLocations)); mockServiceHelper.start(); } @@ -422,6 +431,57 @@ public void analyzeContentTest() throws Exception { .build(); mockParticipants.addResponse(expectedResponse); + ParticipantName participant = + ParticipantName.ofProjectConversationParticipantName( + "[PROJECT]", "[CONVERSATION]", "[PARTICIPANT]"); + AudioInput audioInput = AudioInput.newBuilder().build(); + + AnalyzeContentResponse actualResponse = client.analyzeContent(participant, audioInput); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockParticipants.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + AnalyzeContentRequest actualRequest = ((AnalyzeContentRequest) actualRequests.get(0)); + + Assert.assertEquals(participant.toString(), actualRequest.getParticipant()); + Assert.assertEquals(audioInput, actualRequest.getAudioInput()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void analyzeContentExceptionTest() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockParticipants.addException(exception); + + try { + ParticipantName participant = + ParticipantName.ofProjectConversationParticipantName( + "[PROJECT]", "[CONVERSATION]", "[PARTICIPANT]"); + AudioInput audioInput = AudioInput.newBuilder().build(); + client.analyzeContent(participant, audioInput); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void analyzeContentTest2() throws Exception { + AnalyzeContentResponse expectedResponse = + AnalyzeContentResponse.newBuilder() + .setReplyText("replyText-433699017") + .setReplyAudio(OutputAudio.newBuilder().build()) + .setAutomatedAgentReply(AutomatedAgentReply.newBuilder().build()) + .setMessage(Message.newBuilder().build()) + .addAllHumanAgentSuggestionResults(new ArrayList()) + .addAllEndUserSuggestionResults(new ArrayList()) + .setDtmfParameters(DtmfParameters.newBuilder().build()) + .build(); + mockParticipants.addResponse(expectedResponse); + ParticipantName participant = ParticipantName.ofProjectConversationParticipantName( "[PROJECT]", "[CONVERSATION]", "[PARTICIPANT]"); @@ -443,7 +503,7 @@ public void analyzeContentTest() throws Exception { } @Test - public void analyzeContentExceptionTest() throws Exception { + public void analyzeContentExceptionTest2() throws Exception { StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockParticipants.addException(exception); @@ -460,7 +520,7 @@ public void analyzeContentExceptionTest() throws Exception { } @Test - public void analyzeContentTest2() throws Exception { + public void analyzeContentTest3() throws Exception { AnalyzeContentResponse expectedResponse = AnalyzeContentResponse.newBuilder() .setReplyText("replyText-433699017") @@ -494,7 +554,7 @@ public void analyzeContentTest2() throws Exception { } @Test - public void analyzeContentExceptionTest2() throws Exception { + public void analyzeContentExceptionTest3() throws Exception { StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockParticipants.addException(exception); @@ -511,7 +571,54 @@ public void analyzeContentExceptionTest2() throws Exception { } @Test - public void analyzeContentTest3() throws Exception { + public void analyzeContentTest4() throws Exception { + AnalyzeContentResponse expectedResponse = + AnalyzeContentResponse.newBuilder() + .setReplyText("replyText-433699017") + .setReplyAudio(OutputAudio.newBuilder().build()) + .setAutomatedAgentReply(AutomatedAgentReply.newBuilder().build()) + .setMessage(Message.newBuilder().build()) + .addAllHumanAgentSuggestionResults(new ArrayList()) + .addAllEndUserSuggestionResults(new ArrayList()) + .setDtmfParameters(DtmfParameters.newBuilder().build()) + .build(); + mockParticipants.addResponse(expectedResponse); + + String participant = "participant767422259"; + AudioInput audioInput = AudioInput.newBuilder().build(); + + AnalyzeContentResponse actualResponse = client.analyzeContent(participant, audioInput); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockParticipants.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + AnalyzeContentRequest actualRequest = ((AnalyzeContentRequest) actualRequests.get(0)); + + Assert.assertEquals(participant, actualRequest.getParticipant()); + Assert.assertEquals(audioInput, actualRequest.getAudioInput()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void analyzeContentExceptionTest4() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockParticipants.addException(exception); + + try { + String participant = "participant767422259"; + AudioInput audioInput = AudioInput.newBuilder().build(); + client.analyzeContent(participant, audioInput); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void analyzeContentTest5() throws Exception { AnalyzeContentResponse expectedResponse = AnalyzeContentResponse.newBuilder() .setReplyText("replyText-433699017") @@ -543,7 +650,7 @@ public void analyzeContentTest3() throws Exception { } @Test - public void analyzeContentExceptionTest3() throws Exception { + public void analyzeContentExceptionTest5() throws Exception { StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockParticipants.addException(exception); @@ -558,7 +665,7 @@ public void analyzeContentExceptionTest3() throws Exception { } @Test - public void analyzeContentTest4() throws Exception { + public void analyzeContentTest6() throws Exception { AnalyzeContentResponse expectedResponse = AnalyzeContentResponse.newBuilder() .setReplyText("replyText-433699017") @@ -590,7 +697,7 @@ public void analyzeContentTest4() throws Exception { } @Test - public void analyzeContentExceptionTest4() throws Exception { + public void analyzeContentExceptionTest6() throws Exception { StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockParticipants.addException(exception); @@ -628,6 +735,7 @@ public void streamingAnalyzeContentTest() throws Exception { .setQueryParams(QueryParameters.newBuilder().build()) .setAssistQueryParams(AssistQueryParameters.newBuilder().build()) .setCxParameters(Struct.newBuilder().build()) + .setCxCurrentPage("cxCurrentPage1596907507") .setEnablePartialAutomatedAgentReply(true) .build(); @@ -661,6 +769,7 @@ public void streamingAnalyzeContentExceptionTest() throws Exception { .setQueryParams(QueryParameters.newBuilder().build()) .setAssistQueryParams(AssistQueryParameters.newBuilder().build()) .setCxParameters(Struct.newBuilder().build()) + .setCxCurrentPage("cxCurrentPage1596907507") .setEnablePartialAutomatedAgentReply(true) .build(); @@ -1052,4 +1161,105 @@ public void compileSuggestionExceptionTest() throws Exception { // Expected exception. } } + + @Test + public void listLocationsTest() throws Exception { + Location responsesElement = Location.newBuilder().build(); + ListLocationsResponse expectedResponse = + ListLocationsResponse.newBuilder() + .setNextPageToken("") + .addAllLocations(Arrays.asList(responsesElement)) + .build(); + mockLocations.addResponse(expectedResponse); + + ListLocationsRequest request = + ListLocationsRequest.newBuilder() + .setName("name3373707") + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + + ListLocationsPagedResponse pagedListResponse = client.listLocations(request); + + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getLocationsList().get(0), resources.get(0)); + + List actualRequests = mockLocations.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + ListLocationsRequest actualRequest = ((ListLocationsRequest) actualRequests.get(0)); + + Assert.assertEquals(request.getName(), actualRequest.getName()); + Assert.assertEquals(request.getFilter(), actualRequest.getFilter()); + Assert.assertEquals(request.getPageSize(), actualRequest.getPageSize()); + Assert.assertEquals(request.getPageToken(), actualRequest.getPageToken()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void listLocationsExceptionTest() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockLocations.addException(exception); + + try { + ListLocationsRequest request = + ListLocationsRequest.newBuilder() + .setName("name3373707") + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + client.listLocations(request); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void getLocationTest() throws Exception { + Location expectedResponse = + Location.newBuilder() + .setName("name3373707") + .setLocationId("locationId1541836720") + .setDisplayName("displayName1714148973") + .putAllLabels(new HashMap()) + .setMetadata(Any.newBuilder().build()) + .build(); + mockLocations.addResponse(expectedResponse); + + GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build(); + + Location actualResponse = client.getLocation(request); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockLocations.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + GetLocationRequest actualRequest = ((GetLocationRequest) actualRequests.get(0)); + + Assert.assertEquals(request.getName(), actualRequest.getName()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void getLocationExceptionTest() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockLocations.addException(exception); + + try { + GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build(); + client.getLocation(request); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } } diff --git a/google-cloud-dialogflow/src/test/java/com/google/cloud/dialogflow/v2beta1/SessionEntityTypesClientHttpJsonTest.java b/google-cloud-dialogflow/src/test/java/com/google/cloud/dialogflow/v2beta1/SessionEntityTypesClientHttpJsonTest.java index 359ae489f..e1e0c9941 100644 --- a/google-cloud-dialogflow/src/test/java/com/google/cloud/dialogflow/v2beta1/SessionEntityTypesClientHttpJsonTest.java +++ b/google-cloud-dialogflow/src/test/java/com/google/cloud/dialogflow/v2beta1/SessionEntityTypesClientHttpJsonTest.java @@ -16,6 +16,7 @@ package com.google.cloud.dialogflow.v2beta1; +import static com.google.cloud.dialogflow.v2beta1.SessionEntityTypesClient.ListLocationsPagedResponse; import static com.google.cloud.dialogflow.v2beta1.SessionEntityTypesClient.ListSessionEntityTypesPagedResponse; import com.google.api.gax.core.NoCredentialsProvider; @@ -28,12 +29,18 @@ import com.google.api.gax.rpc.StatusCode; import com.google.api.gax.rpc.testing.FakeStatusCode; import com.google.cloud.dialogflow.v2beta1.stub.HttpJsonSessionEntityTypesStub; +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.ListLocationsResponse; +import com.google.cloud.location.Location; import com.google.common.collect.Lists; +import com.google.protobuf.Any; import com.google.protobuf.Empty; import com.google.protobuf.FieldMask; import java.io.IOException; import java.util.ArrayList; import java.util.Arrays; +import java.util.HashMap; import java.util.List; import javax.annotation.Generated; import org.junit.After; @@ -588,4 +595,120 @@ public void deleteSessionEntityTypeExceptionTest2() throws Exception { // Expected exception. } } + + @Test + public void listLocationsTest() throws Exception { + Location responsesElement = Location.newBuilder().build(); + ListLocationsResponse expectedResponse = + ListLocationsResponse.newBuilder() + .setNextPageToken("") + .addAllLocations(Arrays.asList(responsesElement)) + .build(); + mockService.addResponse(expectedResponse); + + ListLocationsRequest request = + ListLocationsRequest.newBuilder() + .setName("projects/project-3664") + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + + ListLocationsPagedResponse pagedListResponse = client.listLocations(request); + + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getLocationsList().get(0), resources.get(0)); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void listLocationsExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + ListLocationsRequest request = + ListLocationsRequest.newBuilder() + .setName("projects/project-3664") + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + client.listLocations(request); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void getLocationTest() throws Exception { + Location expectedResponse = + Location.newBuilder() + .setName("name3373707") + .setLocationId("locationId1541836720") + .setDisplayName("displayName1714148973") + .putAllLabels(new HashMap()) + .setMetadata(Any.newBuilder().build()) + .build(); + mockService.addResponse(expectedResponse); + + GetLocationRequest request = + GetLocationRequest.newBuilder() + .setName("projects/project-9062/locations/location-9062") + .build(); + + Location actualResponse = client.getLocation(request); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void getLocationExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + GetLocationRequest request = + GetLocationRequest.newBuilder() + .setName("projects/project-9062/locations/location-9062") + .build(); + client.getLocation(request); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } } diff --git a/google-cloud-dialogflow/src/test/java/com/google/cloud/dialogflow/v2beta1/SessionEntityTypesClientTest.java b/google-cloud-dialogflow/src/test/java/com/google/cloud/dialogflow/v2beta1/SessionEntityTypesClientTest.java index ff04db2e7..e80aa0850 100644 --- a/google-cloud-dialogflow/src/test/java/com/google/cloud/dialogflow/v2beta1/SessionEntityTypesClientTest.java +++ b/google-cloud-dialogflow/src/test/java/com/google/cloud/dialogflow/v2beta1/SessionEntityTypesClientTest.java @@ -16,6 +16,7 @@ package com.google.cloud.dialogflow.v2beta1; +import static com.google.cloud.dialogflow.v2beta1.SessionEntityTypesClient.ListLocationsPagedResponse; import static com.google.cloud.dialogflow.v2beta1.SessionEntityTypesClient.ListSessionEntityTypesPagedResponse; import com.google.api.gax.core.NoCredentialsProvider; @@ -25,14 +26,20 @@ import com.google.api.gax.grpc.testing.MockServiceHelper; import com.google.api.gax.rpc.ApiClientHeaderProvider; import com.google.api.gax.rpc.InvalidArgumentException; +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.ListLocationsResponse; +import com.google.cloud.location.Location; import com.google.common.collect.Lists; import com.google.protobuf.AbstractMessage; +import com.google.protobuf.Any; import com.google.protobuf.Empty; import com.google.protobuf.FieldMask; import io.grpc.StatusRuntimeException; import java.io.IOException; import java.util.ArrayList; import java.util.Arrays; +import java.util.HashMap; import java.util.List; import java.util.UUID; import javax.annotation.Generated; @@ -45,6 +52,7 @@ @Generated("by gapic-generator-java") public class SessionEntityTypesClientTest { + private static MockLocations mockLocations; private static MockServiceHelper mockServiceHelper; private static MockSessionEntityTypes mockSessionEntityTypes; private LocalChannelProvider channelProvider; @@ -53,9 +61,11 @@ public class SessionEntityTypesClientTest { @BeforeClass public static void startStaticServer() { mockSessionEntityTypes = new MockSessionEntityTypes(); + mockLocations = new MockLocations(); mockServiceHelper = new MockServiceHelper( - UUID.randomUUID().toString(), Arrays.asList(mockSessionEntityTypes)); + UUID.randomUUID().toString(), + Arrays.asList(mockSessionEntityTypes, mockLocations)); mockServiceHelper.start(); } @@ -516,4 +526,105 @@ public void deleteSessionEntityTypeExceptionTest2() throws Exception { // Expected exception. } } + + @Test + public void listLocationsTest() throws Exception { + Location responsesElement = Location.newBuilder().build(); + ListLocationsResponse expectedResponse = + ListLocationsResponse.newBuilder() + .setNextPageToken("") + .addAllLocations(Arrays.asList(responsesElement)) + .build(); + mockLocations.addResponse(expectedResponse); + + ListLocationsRequest request = + ListLocationsRequest.newBuilder() + .setName("name3373707") + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + + ListLocationsPagedResponse pagedListResponse = client.listLocations(request); + + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getLocationsList().get(0), resources.get(0)); + + List actualRequests = mockLocations.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + ListLocationsRequest actualRequest = ((ListLocationsRequest) actualRequests.get(0)); + + Assert.assertEquals(request.getName(), actualRequest.getName()); + Assert.assertEquals(request.getFilter(), actualRequest.getFilter()); + Assert.assertEquals(request.getPageSize(), actualRequest.getPageSize()); + Assert.assertEquals(request.getPageToken(), actualRequest.getPageToken()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void listLocationsExceptionTest() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockLocations.addException(exception); + + try { + ListLocationsRequest request = + ListLocationsRequest.newBuilder() + .setName("name3373707") + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + client.listLocations(request); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void getLocationTest() throws Exception { + Location expectedResponse = + Location.newBuilder() + .setName("name3373707") + .setLocationId("locationId1541836720") + .setDisplayName("displayName1714148973") + .putAllLabels(new HashMap()) + .setMetadata(Any.newBuilder().build()) + .build(); + mockLocations.addResponse(expectedResponse); + + GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build(); + + Location actualResponse = client.getLocation(request); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockLocations.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + GetLocationRequest actualRequest = ((GetLocationRequest) actualRequests.get(0)); + + Assert.assertEquals(request.getName(), actualRequest.getName()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void getLocationExceptionTest() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockLocations.addException(exception); + + try { + GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build(); + client.getLocation(request); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } } diff --git a/google-cloud-dialogflow/src/test/java/com/google/cloud/dialogflow/v2beta1/SessionsClientHttpJsonTest.java b/google-cloud-dialogflow/src/test/java/com/google/cloud/dialogflow/v2beta1/SessionsClientHttpJsonTest.java index 87b986d08..1b183628c 100644 --- a/google-cloud-dialogflow/src/test/java/com/google/cloud/dialogflow/v2beta1/SessionsClientHttpJsonTest.java +++ b/google-cloud-dialogflow/src/test/java/com/google/cloud/dialogflow/v2beta1/SessionsClientHttpJsonTest.java @@ -16,6 +16,8 @@ package com.google.cloud.dialogflow.v2beta1; +import static com.google.cloud.dialogflow.v2beta1.SessionsClient.ListLocationsPagedResponse; + import com.google.api.gax.core.NoCredentialsProvider; import com.google.api.gax.httpjson.GaxHttpJsonProperties; import com.google.api.gax.httpjson.testing.MockHttpService; @@ -26,10 +28,18 @@ import com.google.api.gax.rpc.StatusCode; import com.google.api.gax.rpc.testing.FakeStatusCode; import com.google.cloud.dialogflow.v2beta1.stub.HttpJsonSessionsStub; +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.ListLocationsResponse; +import com.google.cloud.location.Location; +import com.google.common.collect.Lists; +import com.google.protobuf.Any; import com.google.protobuf.ByteString; import com.google.rpc.Status; import java.io.IOException; import java.util.ArrayList; +import java.util.Arrays; +import java.util.HashMap; import java.util.List; import javax.annotation.Generated; import org.junit.After; @@ -180,4 +190,120 @@ public void streamingDetectIntentUnsupportedMethodTest() throws Exception { // The streamingDetectIntent() method is not supported in REST transport. // This empty test is generated for technical reasons. } + + @Test + public void listLocationsTest() throws Exception { + Location responsesElement = Location.newBuilder().build(); + ListLocationsResponse expectedResponse = + ListLocationsResponse.newBuilder() + .setNextPageToken("") + .addAllLocations(Arrays.asList(responsesElement)) + .build(); + mockService.addResponse(expectedResponse); + + ListLocationsRequest request = + ListLocationsRequest.newBuilder() + .setName("projects/project-3664") + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + + ListLocationsPagedResponse pagedListResponse = client.listLocations(request); + + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getLocationsList().get(0), resources.get(0)); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void listLocationsExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + ListLocationsRequest request = + ListLocationsRequest.newBuilder() + .setName("projects/project-3664") + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + client.listLocations(request); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void getLocationTest() throws Exception { + Location expectedResponse = + Location.newBuilder() + .setName("name3373707") + .setLocationId("locationId1541836720") + .setDisplayName("displayName1714148973") + .putAllLabels(new HashMap()) + .setMetadata(Any.newBuilder().build()) + .build(); + mockService.addResponse(expectedResponse); + + GetLocationRequest request = + GetLocationRequest.newBuilder() + .setName("projects/project-9062/locations/location-9062") + .build(); + + Location actualResponse = client.getLocation(request); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void getLocationExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + GetLocationRequest request = + GetLocationRequest.newBuilder() + .setName("projects/project-9062/locations/location-9062") + .build(); + client.getLocation(request); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } } diff --git a/google-cloud-dialogflow/src/test/java/com/google/cloud/dialogflow/v2beta1/SessionsClientTest.java b/google-cloud-dialogflow/src/test/java/com/google/cloud/dialogflow/v2beta1/SessionsClientTest.java index bdba8f948..47279dbc0 100644 --- a/google-cloud-dialogflow/src/test/java/com/google/cloud/dialogflow/v2beta1/SessionsClientTest.java +++ b/google-cloud-dialogflow/src/test/java/com/google/cloud/dialogflow/v2beta1/SessionsClientTest.java @@ -16,6 +16,8 @@ package com.google.cloud.dialogflow.v2beta1; +import static com.google.cloud.dialogflow.v2beta1.SessionsClient.ListLocationsPagedResponse; + import com.google.api.gax.core.NoCredentialsProvider; import com.google.api.gax.grpc.GaxGrpcProperties; import com.google.api.gax.grpc.testing.LocalChannelProvider; @@ -27,7 +29,13 @@ import com.google.api.gax.rpc.BidiStreamingCallable; import com.google.api.gax.rpc.InvalidArgumentException; import com.google.api.gax.rpc.StatusCode; +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.ListLocationsResponse; +import com.google.cloud.location.Location; +import com.google.common.collect.Lists; import com.google.protobuf.AbstractMessage; +import com.google.protobuf.Any; import com.google.protobuf.ByteString; import com.google.protobuf.FieldMask; import com.google.rpc.Status; @@ -35,6 +43,7 @@ import java.io.IOException; import java.util.ArrayList; import java.util.Arrays; +import java.util.HashMap; import java.util.List; import java.util.UUID; import java.util.concurrent.ExecutionException; @@ -48,6 +57,7 @@ @Generated("by gapic-generator-java") public class SessionsClientTest { + private static MockLocations mockLocations; private static MockServiceHelper mockServiceHelper; private static MockSessions mockSessions; private LocalChannelProvider channelProvider; @@ -56,9 +66,11 @@ public class SessionsClientTest { @BeforeClass public static void startStaticServer() { mockSessions = new MockSessions(); + mockLocations = new MockLocations(); mockServiceHelper = new MockServiceHelper( - UUID.randomUUID().toString(), Arrays.asList(mockSessions)); + UUID.randomUUID().toString(), + Arrays.asList(mockSessions, mockLocations)); mockServiceHelper.start(); } @@ -248,4 +260,105 @@ public void streamingDetectIntentExceptionTest() throws Exception { Assert.assertEquals(StatusCode.Code.INVALID_ARGUMENT, apiException.getStatusCode().getCode()); } } + + @Test + public void listLocationsTest() throws Exception { + Location responsesElement = Location.newBuilder().build(); + ListLocationsResponse expectedResponse = + ListLocationsResponse.newBuilder() + .setNextPageToken("") + .addAllLocations(Arrays.asList(responsesElement)) + .build(); + mockLocations.addResponse(expectedResponse); + + ListLocationsRequest request = + ListLocationsRequest.newBuilder() + .setName("name3373707") + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + + ListLocationsPagedResponse pagedListResponse = client.listLocations(request); + + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getLocationsList().get(0), resources.get(0)); + + List actualRequests = mockLocations.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + ListLocationsRequest actualRequest = ((ListLocationsRequest) actualRequests.get(0)); + + Assert.assertEquals(request.getName(), actualRequest.getName()); + Assert.assertEquals(request.getFilter(), actualRequest.getFilter()); + Assert.assertEquals(request.getPageSize(), actualRequest.getPageSize()); + Assert.assertEquals(request.getPageToken(), actualRequest.getPageToken()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void listLocationsExceptionTest() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockLocations.addException(exception); + + try { + ListLocationsRequest request = + ListLocationsRequest.newBuilder() + .setName("name3373707") + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + client.listLocations(request); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void getLocationTest() throws Exception { + Location expectedResponse = + Location.newBuilder() + .setName("name3373707") + .setLocationId("locationId1541836720") + .setDisplayName("displayName1714148973") + .putAllLabels(new HashMap()) + .setMetadata(Any.newBuilder().build()) + .build(); + mockLocations.addResponse(expectedResponse); + + GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build(); + + Location actualResponse = client.getLocation(request); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockLocations.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + GetLocationRequest actualRequest = ((GetLocationRequest) actualRequests.get(0)); + + Assert.assertEquals(request.getName(), actualRequest.getName()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void getLocationExceptionTest() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockLocations.addException(exception); + + try { + GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build(); + client.getLocation(request); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } } diff --git a/google-cloud-dialogflow/src/test/java/com/google/cloud/dialogflow/v2beta1/VersionsClientHttpJsonTest.java b/google-cloud-dialogflow/src/test/java/com/google/cloud/dialogflow/v2beta1/VersionsClientHttpJsonTest.java index d3fc94772..31dcbad09 100644 --- a/google-cloud-dialogflow/src/test/java/com/google/cloud/dialogflow/v2beta1/VersionsClientHttpJsonTest.java +++ b/google-cloud-dialogflow/src/test/java/com/google/cloud/dialogflow/v2beta1/VersionsClientHttpJsonTest.java @@ -16,6 +16,7 @@ package com.google.cloud.dialogflow.v2beta1; +import static com.google.cloud.dialogflow.v2beta1.VersionsClient.ListLocationsPagedResponse; import static com.google.cloud.dialogflow.v2beta1.VersionsClient.ListVersionsPagedResponse; import com.google.api.gax.core.NoCredentialsProvider; @@ -28,12 +29,18 @@ import com.google.api.gax.rpc.StatusCode; import com.google.api.gax.rpc.testing.FakeStatusCode; import com.google.cloud.dialogflow.v2beta1.stub.HttpJsonVersionsStub; +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.ListLocationsResponse; +import com.google.cloud.location.Location; import com.google.common.collect.Lists; +import com.google.protobuf.Any; import com.google.protobuf.Empty; import com.google.protobuf.FieldMask; import com.google.protobuf.Timestamp; import java.io.IOException; import java.util.Arrays; +import java.util.HashMap; import java.util.List; import javax.annotation.Generated; import org.junit.After; @@ -509,4 +516,120 @@ public void deleteVersionExceptionTest2() throws Exception { // Expected exception. } } + + @Test + public void listLocationsTest() throws Exception { + Location responsesElement = Location.newBuilder().build(); + ListLocationsResponse expectedResponse = + ListLocationsResponse.newBuilder() + .setNextPageToken("") + .addAllLocations(Arrays.asList(responsesElement)) + .build(); + mockService.addResponse(expectedResponse); + + ListLocationsRequest request = + ListLocationsRequest.newBuilder() + .setName("projects/project-3664") + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + + ListLocationsPagedResponse pagedListResponse = client.listLocations(request); + + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getLocationsList().get(0), resources.get(0)); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void listLocationsExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + ListLocationsRequest request = + ListLocationsRequest.newBuilder() + .setName("projects/project-3664") + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + client.listLocations(request); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void getLocationTest() throws Exception { + Location expectedResponse = + Location.newBuilder() + .setName("name3373707") + .setLocationId("locationId1541836720") + .setDisplayName("displayName1714148973") + .putAllLabels(new HashMap()) + .setMetadata(Any.newBuilder().build()) + .build(); + mockService.addResponse(expectedResponse); + + GetLocationRequest request = + GetLocationRequest.newBuilder() + .setName("projects/project-9062/locations/location-9062") + .build(); + + Location actualResponse = client.getLocation(request); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void getLocationExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + GetLocationRequest request = + GetLocationRequest.newBuilder() + .setName("projects/project-9062/locations/location-9062") + .build(); + client.getLocation(request); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } } diff --git a/google-cloud-dialogflow/src/test/java/com/google/cloud/dialogflow/v2beta1/VersionsClientTest.java b/google-cloud-dialogflow/src/test/java/com/google/cloud/dialogflow/v2beta1/VersionsClientTest.java index 6441dec56..2fbc07777 100644 --- a/google-cloud-dialogflow/src/test/java/com/google/cloud/dialogflow/v2beta1/VersionsClientTest.java +++ b/google-cloud-dialogflow/src/test/java/com/google/cloud/dialogflow/v2beta1/VersionsClientTest.java @@ -16,6 +16,7 @@ package com.google.cloud.dialogflow.v2beta1; +import static com.google.cloud.dialogflow.v2beta1.VersionsClient.ListLocationsPagedResponse; import static com.google.cloud.dialogflow.v2beta1.VersionsClient.ListVersionsPagedResponse; import com.google.api.gax.core.NoCredentialsProvider; @@ -25,14 +26,20 @@ import com.google.api.gax.grpc.testing.MockServiceHelper; import com.google.api.gax.rpc.ApiClientHeaderProvider; import com.google.api.gax.rpc.InvalidArgumentException; +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.ListLocationsResponse; +import com.google.cloud.location.Location; import com.google.common.collect.Lists; import com.google.protobuf.AbstractMessage; +import com.google.protobuf.Any; import com.google.protobuf.Empty; import com.google.protobuf.FieldMask; import com.google.protobuf.Timestamp; import io.grpc.StatusRuntimeException; import java.io.IOException; import java.util.Arrays; +import java.util.HashMap; import java.util.List; import java.util.UUID; import javax.annotation.Generated; @@ -45,6 +52,7 @@ @Generated("by gapic-generator-java") public class VersionsClientTest { + private static MockLocations mockLocations; private static MockServiceHelper mockServiceHelper; private static MockVersions mockVersions; private LocalChannelProvider channelProvider; @@ -53,9 +61,11 @@ public class VersionsClientTest { @BeforeClass public static void startStaticServer() { mockVersions = new MockVersions(); + mockLocations = new MockLocations(); mockServiceHelper = new MockServiceHelper( - UUID.randomUUID().toString(), Arrays.asList(mockVersions)); + UUID.randomUUID().toString(), + Arrays.asList(mockVersions, mockLocations)); mockServiceHelper.start(); } @@ -450,4 +460,105 @@ public void deleteVersionExceptionTest2() throws Exception { // Expected exception. } } + + @Test + public void listLocationsTest() throws Exception { + Location responsesElement = Location.newBuilder().build(); + ListLocationsResponse expectedResponse = + ListLocationsResponse.newBuilder() + .setNextPageToken("") + .addAllLocations(Arrays.asList(responsesElement)) + .build(); + mockLocations.addResponse(expectedResponse); + + ListLocationsRequest request = + ListLocationsRequest.newBuilder() + .setName("name3373707") + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + + ListLocationsPagedResponse pagedListResponse = client.listLocations(request); + + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getLocationsList().get(0), resources.get(0)); + + List actualRequests = mockLocations.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + ListLocationsRequest actualRequest = ((ListLocationsRequest) actualRequests.get(0)); + + Assert.assertEquals(request.getName(), actualRequest.getName()); + Assert.assertEquals(request.getFilter(), actualRequest.getFilter()); + Assert.assertEquals(request.getPageSize(), actualRequest.getPageSize()); + Assert.assertEquals(request.getPageToken(), actualRequest.getPageToken()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void listLocationsExceptionTest() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockLocations.addException(exception); + + try { + ListLocationsRequest request = + ListLocationsRequest.newBuilder() + .setName("name3373707") + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + client.listLocations(request); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void getLocationTest() throws Exception { + Location expectedResponse = + Location.newBuilder() + .setName("name3373707") + .setLocationId("locationId1541836720") + .setDisplayName("displayName1714148973") + .putAllLabels(new HashMap()) + .setMetadata(Any.newBuilder().build()) + .build(); + mockLocations.addResponse(expectedResponse); + + GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build(); + + Location actualResponse = client.getLocation(request); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockLocations.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + GetLocationRequest actualRequest = ((GetLocationRequest) actualRequests.get(0)); + + Assert.assertEquals(request.getName(), actualRequest.getName()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void getLocationExceptionTest() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockLocations.addException(exception); + + try { + GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build(); + client.getLocation(request); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } } diff --git a/proto-google-cloud-dialogflow-v2/src/main/java/com/google/cloud/dialogflow/v2/AnswerRecordsProto.java b/proto-google-cloud-dialogflow-v2/src/main/java/com/google/cloud/dialogflow/v2/AnswerRecordsProto.java index 93a2df21c..1fd691dd2 100644 --- a/proto-google-cloud-dialogflow-v2/src/main/java/com/google/cloud/dialogflow/v2/AnswerRecordsProto.java +++ b/proto-google-cloud-dialogflow-v2/src/main/java/com/google/cloud/dialogflow/v2/AnswerRecordsProto.java @@ -80,71 +80,71 @@ public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { + "ogleapis.com/AnswerRecord\0220projects/{pro" + "ject}/answerRecords/{answer_record}\022Epro" + "jects/{project}/locations/{location}/ans" - + "werRecords/{answer_record}B\010\n\006record\"\240\001\n" + + "werRecords/{answer_record}B\010\n\006record\"\242\001\n" + "\030ListAnswerRecordsRequest\022>\n\006parent\030\001 \001(" + "\tB.\340A\002\372A(\022&dialogflow.googleapis.com/Ans" - + "werRecord\022\023\n\006filter\030\002 \001(\tB\003\340A\002\022\026\n\tpage_s" - + "ize\030\003 \001(\005B\003\340A\001\022\027\n\npage_token\030\004 \001(\tB\003\340A\001\"" - + "v\n\031ListAnswerRecordsResponse\022@\n\016answer_r" - + "ecords\030\001 \003(\0132(.google.cloud.dialogflow.v" - + "2.AnswerRecord\022\027\n\017next_page_token\030\002 \001(\t\"" - + "\227\001\n\031UpdateAnswerRecordRequest\022D\n\ranswer_" - + "record\030\001 \001(\0132(.google.cloud.dialogflow.v" - + "2.AnswerRecordB\003\340A\002\0224\n\013update_mask\030\002 \001(\013" - + "2\032.google.protobuf.FieldMaskB\003\340A\002\"\322\003\n\016An" - + "swerFeedback\022V\n\021correctness_level\030\001 \001(\0162" - + ";.google.cloud.dialogflow.v2.AnswerFeedb" - + "ack.CorrectnessLevel\022]\n\037agent_assistant_" - + "detail_feedback\030\002 \001(\01322.google.cloud.dia" - + "logflow.v2.AgentAssistantFeedbackH\000\022\017\n\007c" - + "licked\030\003 \001(\010\022.\n\nclick_time\030\005 \001(\0132\032.googl" - + "e.protobuf.Timestamp\022\021\n\tdisplayed\030\004 \001(\010\022" - + "0\n\014display_time\030\006 \001(\0132\032.google.protobuf." - + "Timestamp\"p\n\020CorrectnessLevel\022!\n\035CORRECT" - + "NESS_LEVEL_UNSPECIFIED\020\000\022\017\n\013NOT_CORRECT\020" - + "\001\022\025\n\021PARTIALLY_CORRECT\020\002\022\021\n\rFULLY_CORREC" - + "T\020\003B\021\n\017detail_feedback\"\326\004\n\026AgentAssistan" - + "tFeedback\022a\n\020answer_relevance\030\001 \001(\0162B.go" - + "ogle.cloud.dialogflow.v2.AgentAssistantF" - + "eedback.AnswerRelevanceB\003\340A\001\022i\n\024document" - + "_correctness\030\002 \001(\0162F.google.cloud.dialog" - + "flow.v2.AgentAssistantFeedback.DocumentC" - + "orrectnessB\003\340A\001\022g\n\023document_efficiency\030\003" - + " \001(\0162E.google.cloud.dialogflow.v2.AgentA" - + "ssistantFeedback.DocumentEfficiencyB\003\340A\001" - + "\"Q\n\017AnswerRelevance\022 \n\034ANSWER_RELEVANCE_" - + "UNSPECIFIED\020\000\022\016\n\nIRRELEVANT\020\001\022\014\n\010RELEVAN" - + "T\020\002\"W\n\023DocumentCorrectness\022$\n DOCUMENT_C" - + "ORRECTNESS_UNSPECIFIED\020\000\022\r\n\tINCORRECT\020\001\022" - + "\013\n\007CORRECT\020\002\"Y\n\022DocumentEfficiency\022#\n\037DO" - + "CUMENT_EFFICIENCY_UNSPECIFIED\020\000\022\017\n\013INEFF" - + "ICIENT\020\001\022\r\n\tEFFICIENT\020\002\"\267\001\n\024AgentAssista" - + "ntRecord\022S\n\031article_suggestion_answer\030\005 " - + "\001(\0132).google.cloud.dialogflow.v2.Article" - + "AnswerB\003\340A\003H\000\022@\n\nfaq_answer\030\006 \001(\0132%.goog" - + "le.cloud.dialogflow.v2.FaqAnswerB\003\340A\003H\000B" - + "\010\n\006answer2\255\005\n\rAnswerRecords\022\355\001\n\021ListAnsw" - + "erRecords\0224.google.cloud.dialogflow.v2.L" - + "istAnswerRecordsRequest\0325.google.cloud.d" - + "ialogflow.v2.ListAnswerRecordsResponse\"k" - + "\202\323\344\223\002\\\022%/v2/{parent=projects/*}/answerRe" - + "cordsZ3\0221/v2/{parent=projects/*/location" - + "s/*}/answerRecords\332A\006parent\022\261\002\n\022UpdateAn" - + "swerRecord\0225.google.cloud.dialogflow.v2." - + "UpdateAnswerRecordRequest\032(.google.cloud" - + ".dialogflow.v2.AnswerRecord\"\271\001\202\323\344\223\002\226\00123/" - + "v2/{answer_record.name=projects/*/answer" - + "Records/*}:\ranswer_recordZP2?/v2/{answer" - + "_record.name=projects/*/locations/*/answ" - + "erRecords/*}:\ranswer_record\332A\031answer_rec" - + "ord,update_mask\032x\312A\031dialogflow.googleapi" - + "s.com\322AYhttps://www.googleapis.com/auth/" - + "cloud-platform,https://www.googleapis.co" - + "m/auth/dialogflowB\241\001\n\036com.google.cloud.d" - + "ialogflow.v2B\022AnswerRecordsProtoP\001ZDgoog" - + "le.golang.org/genproto/googleapis/cloud/" - + "dialogflow/v2;dialogflow\370\001\001\242\002\002DF\252\002\032Googl" - + "e.Cloud.Dialogflow.V2b\006proto3" + + "werRecord\022\025\n\006filter\030\002 \001(\tB\005\030\001\340A\001\022\026\n\tpage" + + "_size\030\003 \001(\005B\003\340A\001\022\027\n\npage_token\030\004 \001(\tB\003\340A" + + "\001\"v\n\031ListAnswerRecordsResponse\022@\n\016answer" + + "_records\030\001 \003(\0132(.google.cloud.dialogflow" + + ".v2.AnswerRecord\022\027\n\017next_page_token\030\002 \001(" + + "\t\"\227\001\n\031UpdateAnswerRecordRequest\022D\n\ranswe" + + "r_record\030\001 \001(\0132(.google.cloud.dialogflow" + + ".v2.AnswerRecordB\003\340A\002\0224\n\013update_mask\030\002 \001" + + "(\0132\032.google.protobuf.FieldMaskB\003\340A\002\"\322\003\n\016" + + "AnswerFeedback\022V\n\021correctness_level\030\001 \001(" + + "\0162;.google.cloud.dialogflow.v2.AnswerFee" + + "dback.CorrectnessLevel\022]\n\037agent_assistan" + + "t_detail_feedback\030\002 \001(\01322.google.cloud.d" + + "ialogflow.v2.AgentAssistantFeedbackH\000\022\017\n" + + "\007clicked\030\003 \001(\010\022.\n\nclick_time\030\005 \001(\0132\032.goo" + + "gle.protobuf.Timestamp\022\021\n\tdisplayed\030\004 \001(" + + "\010\0220\n\014display_time\030\006 \001(\0132\032.google.protobu" + + "f.Timestamp\"p\n\020CorrectnessLevel\022!\n\035CORRE" + + "CTNESS_LEVEL_UNSPECIFIED\020\000\022\017\n\013NOT_CORREC" + + "T\020\001\022\025\n\021PARTIALLY_CORRECT\020\002\022\021\n\rFULLY_CORR" + + "ECT\020\003B\021\n\017detail_feedback\"\326\004\n\026AgentAssist" + + "antFeedback\022a\n\020answer_relevance\030\001 \001(\0162B." + + "google.cloud.dialogflow.v2.AgentAssistan" + + "tFeedback.AnswerRelevanceB\003\340A\001\022i\n\024docume" + + "nt_correctness\030\002 \001(\0162F.google.cloud.dial" + + "ogflow.v2.AgentAssistantFeedback.Documen" + + "tCorrectnessB\003\340A\001\022g\n\023document_efficiency" + + "\030\003 \001(\0162E.google.cloud.dialogflow.v2.Agen" + + "tAssistantFeedback.DocumentEfficiencyB\003\340" + + "A\001\"Q\n\017AnswerRelevance\022 \n\034ANSWER_RELEVANC" + + "E_UNSPECIFIED\020\000\022\016\n\nIRRELEVANT\020\001\022\014\n\010RELEV" + + "ANT\020\002\"W\n\023DocumentCorrectness\022$\n DOCUMENT" + + "_CORRECTNESS_UNSPECIFIED\020\000\022\r\n\tINCORRECT\020" + + "\001\022\013\n\007CORRECT\020\002\"Y\n\022DocumentEfficiency\022#\n\037" + + "DOCUMENT_EFFICIENCY_UNSPECIFIED\020\000\022\017\n\013INE" + + "FFICIENT\020\001\022\r\n\tEFFICIENT\020\002\"\267\001\n\024AgentAssis" + + "tantRecord\022S\n\031article_suggestion_answer\030" + + "\005 \001(\0132).google.cloud.dialogflow.v2.Artic" + + "leAnswerB\003\340A\003H\000\022@\n\nfaq_answer\030\006 \001(\0132%.go" + + "ogle.cloud.dialogflow.v2.FaqAnswerB\003\340A\003H" + + "\000B\010\n\006answer2\255\005\n\rAnswerRecords\022\355\001\n\021ListAn" + + "swerRecords\0224.google.cloud.dialogflow.v2" + + ".ListAnswerRecordsRequest\0325.google.cloud" + + ".dialogflow.v2.ListAnswerRecordsResponse" + + "\"k\202\323\344\223\002\\\022%/v2/{parent=projects/*}/answer" + + "RecordsZ3\0221/v2/{parent=projects/*/locati" + + "ons/*}/answerRecords\332A\006parent\022\261\002\n\022Update" + + "AnswerRecord\0225.google.cloud.dialogflow.v" + + "2.UpdateAnswerRecordRequest\032(.google.clo" + + "ud.dialogflow.v2.AnswerRecord\"\271\001\202\323\344\223\002\226\0012" + + "3/v2/{answer_record.name=projects/*/answ" + + "erRecords/*}:\ranswer_recordZP2?/v2/{answ" + + "er_record.name=projects/*/locations/*/an" + + "swerRecords/*}:\ranswer_record\332A\031answer_r" + + "ecord,update_mask\032x\312A\031dialogflow.googlea" + + "pis.com\322AYhttps://www.googleapis.com/aut" + + "h/cloud-platform,https://www.googleapis." + + "com/auth/dialogflowB\241\001\n\036com.google.cloud" + + ".dialogflow.v2B\022AnswerRecordsProtoP\001ZDgo" + + "ogle.golang.org/genproto/googleapis/clou" + + "d/dialogflow/v2;dialogflow\370\001\001\242\002\002DF\252\002\032Goo" + + "gle.Cloud.Dialogflow.V2b\006proto3" }; descriptor = com.google.protobuf.Descriptors.FileDescriptor.internalBuildGeneratedFileFrom( diff --git a/proto-google-cloud-dialogflow-v2/src/main/java/com/google/cloud/dialogflow/v2/AudioConfigProto.java b/proto-google-cloud-dialogflow-v2/src/main/java/com/google/cloud/dialogflow/v2/AudioConfigProto.java index 2d40d31e6..af7b46a81 100644 --- a/proto-google-cloud-dialogflow-v2/src/main/java/com/google/cloud/dialogflow/v2/AudioConfigProto.java +++ b/proto-google-cloud-dialogflow-v2/src/main/java/com/google/cloud/dialogflow/v2/AudioConfigProto.java @@ -117,13 +117,16 @@ public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { + "OUTPUT_AUDIO_ENCODING_MP3\020\002\022%\n!OUTPUT_AU" + "DIO_ENCODING_MP3_64_KBPS\020\004\022\"\n\036OUTPUT_AUD" + "IO_ENCODING_OGG_OPUS\020\003\022\037\n\033OUTPUT_AUDIO_E" - + "NCODING_MULAW\020\005B\367\001\n\036com.google.cloud.dia" + + "NCODING_MULAW\020\005B\334\002\n\036com.google.cloud.dia" + "logflow.v2B\020AudioConfigProtoP\001ZDgoogle.g" + "olang.org/genproto/googleapis/cloud/dial" + "ogflow/v2;dialogflow\370\001\001\242\002\002DF\252\002\032Google.Cl" + "oud.Dialogflow.V2\352AU\n\033automl.googleapis." + "com/Model\0226projects/{project}/locations/" - + "{location}/models/{model}b\006proto3" + + "{location}/models/{model}\352Ab\n\037speech.goo" + + "gleapis.com/PhraseSet\022?projects/{project" + + "}/locations/{location}/phraseSets/{phras" + + "e_set}b\006proto3" }; descriptor = com.google.protobuf.Descriptors.FileDescriptor.internalBuildGeneratedFileFrom( diff --git a/proto-google-cloud-dialogflow-v2/src/main/java/com/google/cloud/dialogflow/v2/Document.java b/proto-google-cloud-dialogflow-v2/src/main/java/com/google/cloud/dialogflow/v2/Document.java index f039ff97a..e08071497 100644 --- a/proto-google-cloud-dialogflow-v2/src/main/java/com/google/cloud/dialogflow/v2/Document.java +++ b/proto-google-cloud-dialogflow-v2/src/main/java/com/google/cloud/dialogflow/v2/Document.java @@ -3534,8 +3534,8 @@ public int getKnowledgeTypesValue(int index) { * repeated .google.cloud.dialogflow.v2.Document.KnowledgeType knowledge_types = 4 [(.google.api.field_behavior) = REQUIRED]; * * - * @param index The index of the value to return. - * @return The enum numeric value on the wire of knowledgeTypes at the given index. + * @param index The index to set the value at. + * @param value The enum numeric value on the wire for knowledgeTypes to set. * @return This builder for chaining. */ public Builder setKnowledgeTypesValue(int index, int value) { diff --git a/proto-google-cloud-dialogflow-v2/src/main/java/com/google/cloud/dialogflow/v2/HumanAgentAssistantConfig.java b/proto-google-cloud-dialogflow-v2/src/main/java/com/google/cloud/dialogflow/v2/HumanAgentAssistantConfig.java index 0e4b9a4ea..b7993ee69 100644 --- a/proto-google-cloud-dialogflow-v2/src/main/java/com/google/cloud/dialogflow/v2/HumanAgentAssistantConfig.java +++ b/proto-google-cloud-dialogflow-v2/src/main/java/com/google/cloud/dialogflow/v2/HumanAgentAssistantConfig.java @@ -10754,7 +10754,8 @@ public interface ConversationModelConfigOrBuilder * *
    * Custom conversation models used in agent assist feature.
-   * Supported feature: ARTICLE_SUGGESTION, SMART_COMPOSE, SMART_REPLY.
+   * Supported feature: ARTICLE_SUGGESTION, SMART_COMPOSE, SMART_REPLY,
+   * CONVERSATION_SUMMARIZATION.
    * 
* * Protobuf type {@code @@ -11074,7 +11075,8 @@ protected Builder newBuilderForType( * *
      * Custom conversation models used in agent assist feature.
-     * Supported feature: ARTICLE_SUGGESTION, SMART_COMPOSE, SMART_REPLY.
+     * Supported feature: ARTICLE_SUGGESTION, SMART_COMPOSE, SMART_REPLY,
+     * CONVERSATION_SUMMARIZATION.
      * 
* * Protobuf type {@code diff --git a/proto-google-cloud-dialogflow-v2/src/main/java/com/google/cloud/dialogflow/v2/ImportDocumentTemplate.java b/proto-google-cloud-dialogflow-v2/src/main/java/com/google/cloud/dialogflow/v2/ImportDocumentTemplate.java index afbfa2bd3..a325d0c8f 100644 --- a/proto-google-cloud-dialogflow-v2/src/main/java/com/google/cloud/dialogflow/v2/ImportDocumentTemplate.java +++ b/proto-google-cloud-dialogflow-v2/src/main/java/com/google/cloud/dialogflow/v2/ImportDocumentTemplate.java @@ -1146,8 +1146,8 @@ public int getKnowledgeTypesValue(int index) { * repeated .google.cloud.dialogflow.v2.Document.KnowledgeType knowledge_types = 2 [(.google.api.field_behavior) = REQUIRED]; * * - * @param index The index of the value to return. - * @return The enum numeric value on the wire of knowledgeTypes at the given index. + * @param index The index to set the value at. + * @param value The enum numeric value on the wire for knowledgeTypes to set. * @return This builder for chaining. */ public Builder setKnowledgeTypesValue(int index, int value) { diff --git a/proto-google-cloud-dialogflow-v2/src/main/java/com/google/cloud/dialogflow/v2/InputAudioConfig.java b/proto-google-cloud-dialogflow-v2/src/main/java/com/google/cloud/dialogflow/v2/InputAudioConfig.java index b6b10c7e9..dfe475f24 100644 --- a/proto-google-cloud-dialogflow-v2/src/main/java/com/google/cloud/dialogflow/v2/InputAudioConfig.java +++ b/proto-google-cloud-dialogflow-v2/src/main/java/com/google/cloud/dialogflow/v2/InputAudioConfig.java @@ -343,7 +343,7 @@ public boolean getEnableWordInfo() { * repeated string phrase_hints = 4 [deprecated = true]; * * @deprecated google.cloud.dialogflow.v2.InputAudioConfig.phrase_hints is deprecated. See - * google/cloud/dialogflow/v2/audio_config.proto;l=216 + * google/cloud/dialogflow/v2/audio_config.proto;l=220 * @return A list containing the phraseHints. */ @java.lang.Deprecated @@ -367,7 +367,7 @@ public com.google.protobuf.ProtocolStringList getPhraseHintsList() { * repeated string phrase_hints = 4 [deprecated = true]; * * @deprecated google.cloud.dialogflow.v2.InputAudioConfig.phrase_hints is deprecated. See - * google/cloud/dialogflow/v2/audio_config.proto;l=216 + * google/cloud/dialogflow/v2/audio_config.proto;l=220 * @return The count of phraseHints. */ @java.lang.Deprecated @@ -391,7 +391,7 @@ public int getPhraseHintsCount() { * repeated string phrase_hints = 4 [deprecated = true]; * * @deprecated google.cloud.dialogflow.v2.InputAudioConfig.phrase_hints is deprecated. See - * google/cloud/dialogflow/v2/audio_config.proto;l=216 + * google/cloud/dialogflow/v2/audio_config.proto;l=220 * @param index The index of the element to return. * @return The phraseHints at the given index. */ @@ -416,7 +416,7 @@ public java.lang.String getPhraseHints(int index) { * repeated string phrase_hints = 4 [deprecated = true]; * * @deprecated google.cloud.dialogflow.v2.InputAudioConfig.phrase_hints is deprecated. See - * google/cloud/dialogflow/v2/audio_config.proto;l=216 + * google/cloud/dialogflow/v2/audio_config.proto;l=220 * @param index The index of the value to return. * @return The bytes of the phraseHints at the given index. */ @@ -1555,7 +1555,7 @@ private void ensurePhraseHintsIsMutable() { * repeated string phrase_hints = 4 [deprecated = true]; * * @deprecated google.cloud.dialogflow.v2.InputAudioConfig.phrase_hints is deprecated. See - * google/cloud/dialogflow/v2/audio_config.proto;l=216 + * google/cloud/dialogflow/v2/audio_config.proto;l=220 * @return A list containing the phraseHints. */ @java.lang.Deprecated @@ -1579,7 +1579,7 @@ public com.google.protobuf.ProtocolStringList getPhraseHintsList() { * repeated string phrase_hints = 4 [deprecated = true]; * * @deprecated google.cloud.dialogflow.v2.InputAudioConfig.phrase_hints is deprecated. See - * google/cloud/dialogflow/v2/audio_config.proto;l=216 + * google/cloud/dialogflow/v2/audio_config.proto;l=220 * @return The count of phraseHints. */ @java.lang.Deprecated @@ -1603,7 +1603,7 @@ public int getPhraseHintsCount() { * repeated string phrase_hints = 4 [deprecated = true]; * * @deprecated google.cloud.dialogflow.v2.InputAudioConfig.phrase_hints is deprecated. See - * google/cloud/dialogflow/v2/audio_config.proto;l=216 + * google/cloud/dialogflow/v2/audio_config.proto;l=220 * @param index The index of the element to return. * @return The phraseHints at the given index. */ @@ -1628,7 +1628,7 @@ public java.lang.String getPhraseHints(int index) { * repeated string phrase_hints = 4 [deprecated = true]; * * @deprecated google.cloud.dialogflow.v2.InputAudioConfig.phrase_hints is deprecated. See - * google/cloud/dialogflow/v2/audio_config.proto;l=216 + * google/cloud/dialogflow/v2/audio_config.proto;l=220 * @param index The index of the value to return. * @return The bytes of the phraseHints at the given index. */ @@ -1653,7 +1653,7 @@ public com.google.protobuf.ByteString getPhraseHintsBytes(int index) { * repeated string phrase_hints = 4 [deprecated = true]; * * @deprecated google.cloud.dialogflow.v2.InputAudioConfig.phrase_hints is deprecated. See - * google/cloud/dialogflow/v2/audio_config.proto;l=216 + * google/cloud/dialogflow/v2/audio_config.proto;l=220 * @param index The index to set the value at. * @param value The phraseHints to set. * @return This builder for chaining. @@ -1685,7 +1685,7 @@ public Builder setPhraseHints(int index, java.lang.String value) { * repeated string phrase_hints = 4 [deprecated = true]; * * @deprecated google.cloud.dialogflow.v2.InputAudioConfig.phrase_hints is deprecated. See - * google/cloud/dialogflow/v2/audio_config.proto;l=216 + * google/cloud/dialogflow/v2/audio_config.proto;l=220 * @param value The phraseHints to add. * @return This builder for chaining. */ @@ -1716,7 +1716,7 @@ public Builder addPhraseHints(java.lang.String value) { * repeated string phrase_hints = 4 [deprecated = true]; * * @deprecated google.cloud.dialogflow.v2.InputAudioConfig.phrase_hints is deprecated. See - * google/cloud/dialogflow/v2/audio_config.proto;l=216 + * google/cloud/dialogflow/v2/audio_config.proto;l=220 * @param values The phraseHints to add. * @return This builder for chaining. */ @@ -1744,7 +1744,7 @@ public Builder addAllPhraseHints(java.lang.Iterable values) { * repeated string phrase_hints = 4 [deprecated = true]; * * @deprecated google.cloud.dialogflow.v2.InputAudioConfig.phrase_hints is deprecated. See - * google/cloud/dialogflow/v2/audio_config.proto;l=216 + * google/cloud/dialogflow/v2/audio_config.proto;l=220 * @return This builder for chaining. */ @java.lang.Deprecated @@ -1771,7 +1771,7 @@ public Builder clearPhraseHints() { * repeated string phrase_hints = 4 [deprecated = true]; * * @deprecated google.cloud.dialogflow.v2.InputAudioConfig.phrase_hints is deprecated. See - * google/cloud/dialogflow/v2/audio_config.proto;l=216 + * google/cloud/dialogflow/v2/audio_config.proto;l=220 * @param value The bytes of the phraseHints to add. * @return This builder for chaining. */ diff --git a/proto-google-cloud-dialogflow-v2/src/main/java/com/google/cloud/dialogflow/v2/InputAudioConfigOrBuilder.java b/proto-google-cloud-dialogflow-v2/src/main/java/com/google/cloud/dialogflow/v2/InputAudioConfigOrBuilder.java index 57d10e9b3..1e9c90f5d 100644 --- a/proto-google-cloud-dialogflow-v2/src/main/java/com/google/cloud/dialogflow/v2/InputAudioConfigOrBuilder.java +++ b/proto-google-cloud-dialogflow-v2/src/main/java/com/google/cloud/dialogflow/v2/InputAudioConfigOrBuilder.java @@ -131,7 +131,7 @@ public interface InputAudioConfigOrBuilder * repeated string phrase_hints = 4 [deprecated = true]; * * @deprecated google.cloud.dialogflow.v2.InputAudioConfig.phrase_hints is deprecated. See - * google/cloud/dialogflow/v2/audio_config.proto;l=216 + * google/cloud/dialogflow/v2/audio_config.proto;l=220 * @return A list containing the phraseHints. */ @java.lang.Deprecated @@ -153,7 +153,7 @@ public interface InputAudioConfigOrBuilder * repeated string phrase_hints = 4 [deprecated = true]; * * @deprecated google.cloud.dialogflow.v2.InputAudioConfig.phrase_hints is deprecated. See - * google/cloud/dialogflow/v2/audio_config.proto;l=216 + * google/cloud/dialogflow/v2/audio_config.proto;l=220 * @return The count of phraseHints. */ @java.lang.Deprecated @@ -175,7 +175,7 @@ public interface InputAudioConfigOrBuilder * repeated string phrase_hints = 4 [deprecated = true]; * * @deprecated google.cloud.dialogflow.v2.InputAudioConfig.phrase_hints is deprecated. See - * google/cloud/dialogflow/v2/audio_config.proto;l=216 + * google/cloud/dialogflow/v2/audio_config.proto;l=220 * @param index The index of the element to return. * @return The phraseHints at the given index. */ @@ -198,7 +198,7 @@ public interface InputAudioConfigOrBuilder * repeated string phrase_hints = 4 [deprecated = true]; * * @deprecated google.cloud.dialogflow.v2.InputAudioConfig.phrase_hints is deprecated. See - * google/cloud/dialogflow/v2/audio_config.proto;l=216 + * google/cloud/dialogflow/v2/audio_config.proto;l=220 * @param index The index of the value to return. * @return The bytes of the phraseHints at the given index. */ diff --git a/proto-google-cloud-dialogflow-v2/src/main/java/com/google/cloud/dialogflow/v2/Intent.java b/proto-google-cloud-dialogflow-v2/src/main/java/com/google/cloud/dialogflow/v2/Intent.java index 92a2836a3..533900be0 100644 --- a/proto-google-cloud-dialogflow-v2/src/main/java/com/google/cloud/dialogflow/v2/Intent.java +++ b/proto-google-cloud-dialogflow-v2/src/main/java/com/google/cloud/dialogflow/v2/Intent.java @@ -52620,8 +52620,8 @@ public int getDefaultResponsePlatformsValue(int index) { * repeated .google.cloud.dialogflow.v2.Intent.Message.Platform default_response_platforms = 15 [(.google.api.field_behavior) = OPTIONAL]; * * - * @param index The index of the value to return. - * @return The enum numeric value on the wire of defaultResponsePlatforms at the given index. + * @param index The index to set the value at. + * @param value The enum numeric value on the wire for defaultResponsePlatforms to set. * @return This builder for chaining. */ public Builder setDefaultResponsePlatformsValue(int index, int value) { diff --git a/proto-google-cloud-dialogflow-v2/src/main/java/com/google/cloud/dialogflow/v2/ListAnswerRecordsRequest.java b/proto-google-cloud-dialogflow-v2/src/main/java/com/google/cloud/dialogflow/v2/ListAnswerRecordsRequest.java index e8139b652..57726a37e 100644 --- a/proto-google-cloud-dialogflow-v2/src/main/java/com/google/cloud/dialogflow/v2/ListAnswerRecordsRequest.java +++ b/proto-google-cloud-dialogflow-v2/src/main/java/com/google/cloud/dialogflow/v2/ListAnswerRecordsRequest.java @@ -197,18 +197,20 @@ public com.google.protobuf.ByteString getParentBytes() { * * *
-   * Required. Filters to restrict results to specific answer records.
-   * Filter on answer record type. Currently predicates on `type` is supported,
-   * valid values are `ARTICLE_ANSWER`, `FAQ_ANSWER`.
+   * Optional. Filters to restrict results to specific answer records.
+   * Marked deprecated as it hasn't been, and isn't currently, supported.
    * For more information about filtering, see
    * [API Filtering](https://aip.dev/160).
    * 
* - * string filter = 2 [(.google.api.field_behavior) = REQUIRED]; + * string filter = 2 [deprecated = true, (.google.api.field_behavior) = OPTIONAL]; * + * @deprecated google.cloud.dialogflow.v2.ListAnswerRecordsRequest.filter is deprecated. See + * google/cloud/dialogflow/v2/answer_record.proto;l=135 * @return The filter. */ @java.lang.Override + @java.lang.Deprecated public java.lang.String getFilter() { java.lang.Object ref = filter_; if (ref instanceof java.lang.String) { @@ -224,18 +226,20 @@ public java.lang.String getFilter() { * * *
-   * Required. Filters to restrict results to specific answer records.
-   * Filter on answer record type. Currently predicates on `type` is supported,
-   * valid values are `ARTICLE_ANSWER`, `FAQ_ANSWER`.
+   * Optional. Filters to restrict results to specific answer records.
+   * Marked deprecated as it hasn't been, and isn't currently, supported.
    * For more information about filtering, see
    * [API Filtering](https://aip.dev/160).
    * 
* - * string filter = 2 [(.google.api.field_behavior) = REQUIRED]; + * string filter = 2 [deprecated = true, (.google.api.field_behavior) = OPTIONAL]; * + * @deprecated google.cloud.dialogflow.v2.ListAnswerRecordsRequest.filter is deprecated. See + * google/cloud/dialogflow/v2/answer_record.proto;l=135 * @return The bytes for filter. */ @java.lang.Override + @java.lang.Deprecated public com.google.protobuf.ByteString getFilterBytes() { java.lang.Object ref = filter_; if (ref instanceof java.lang.String) { @@ -820,17 +824,19 @@ public Builder setParentBytes(com.google.protobuf.ByteString value) { * * *
-     * Required. Filters to restrict results to specific answer records.
-     * Filter on answer record type. Currently predicates on `type` is supported,
-     * valid values are `ARTICLE_ANSWER`, `FAQ_ANSWER`.
+     * Optional. Filters to restrict results to specific answer records.
+     * Marked deprecated as it hasn't been, and isn't currently, supported.
      * For more information about filtering, see
      * [API Filtering](https://aip.dev/160).
      * 
* - * string filter = 2 [(.google.api.field_behavior) = REQUIRED]; + * string filter = 2 [deprecated = true, (.google.api.field_behavior) = OPTIONAL]; * + * @deprecated google.cloud.dialogflow.v2.ListAnswerRecordsRequest.filter is deprecated. See + * google/cloud/dialogflow/v2/answer_record.proto;l=135 * @return The filter. */ + @java.lang.Deprecated public java.lang.String getFilter() { java.lang.Object ref = filter_; if (!(ref instanceof java.lang.String)) { @@ -846,17 +852,19 @@ public java.lang.String getFilter() { * * *
-     * Required. Filters to restrict results to specific answer records.
-     * Filter on answer record type. Currently predicates on `type` is supported,
-     * valid values are `ARTICLE_ANSWER`, `FAQ_ANSWER`.
+     * Optional. Filters to restrict results to specific answer records.
+     * Marked deprecated as it hasn't been, and isn't currently, supported.
      * For more information about filtering, see
      * [API Filtering](https://aip.dev/160).
      * 
* - * string filter = 2 [(.google.api.field_behavior) = REQUIRED]; + * string filter = 2 [deprecated = true, (.google.api.field_behavior) = OPTIONAL]; * + * @deprecated google.cloud.dialogflow.v2.ListAnswerRecordsRequest.filter is deprecated. See + * google/cloud/dialogflow/v2/answer_record.proto;l=135 * @return The bytes for filter. */ + @java.lang.Deprecated public com.google.protobuf.ByteString getFilterBytes() { java.lang.Object ref = filter_; if (ref instanceof String) { @@ -872,18 +880,20 @@ public com.google.protobuf.ByteString getFilterBytes() { * * *
-     * Required. Filters to restrict results to specific answer records.
-     * Filter on answer record type. Currently predicates on `type` is supported,
-     * valid values are `ARTICLE_ANSWER`, `FAQ_ANSWER`.
+     * Optional. Filters to restrict results to specific answer records.
+     * Marked deprecated as it hasn't been, and isn't currently, supported.
      * For more information about filtering, see
      * [API Filtering](https://aip.dev/160).
      * 
* - * string filter = 2 [(.google.api.field_behavior) = REQUIRED]; + * string filter = 2 [deprecated = true, (.google.api.field_behavior) = OPTIONAL]; * + * @deprecated google.cloud.dialogflow.v2.ListAnswerRecordsRequest.filter is deprecated. See + * google/cloud/dialogflow/v2/answer_record.proto;l=135 * @param value The filter to set. * @return This builder for chaining. */ + @java.lang.Deprecated public Builder setFilter(java.lang.String value) { if (value == null) { throw new NullPointerException(); @@ -897,17 +907,19 @@ public Builder setFilter(java.lang.String value) { * * *
-     * Required. Filters to restrict results to specific answer records.
-     * Filter on answer record type. Currently predicates on `type` is supported,
-     * valid values are `ARTICLE_ANSWER`, `FAQ_ANSWER`.
+     * Optional. Filters to restrict results to specific answer records.
+     * Marked deprecated as it hasn't been, and isn't currently, supported.
      * For more information about filtering, see
      * [API Filtering](https://aip.dev/160).
      * 
* - * string filter = 2 [(.google.api.field_behavior) = REQUIRED]; + * string filter = 2 [deprecated = true, (.google.api.field_behavior) = OPTIONAL]; * + * @deprecated google.cloud.dialogflow.v2.ListAnswerRecordsRequest.filter is deprecated. See + * google/cloud/dialogflow/v2/answer_record.proto;l=135 * @return This builder for chaining. */ + @java.lang.Deprecated public Builder clearFilter() { filter_ = getDefaultInstance().getFilter(); @@ -918,18 +930,20 @@ public Builder clearFilter() { * * *
-     * Required. Filters to restrict results to specific answer records.
-     * Filter on answer record type. Currently predicates on `type` is supported,
-     * valid values are `ARTICLE_ANSWER`, `FAQ_ANSWER`.
+     * Optional. Filters to restrict results to specific answer records.
+     * Marked deprecated as it hasn't been, and isn't currently, supported.
      * For more information about filtering, see
      * [API Filtering](https://aip.dev/160).
      * 
* - * string filter = 2 [(.google.api.field_behavior) = REQUIRED]; + * string filter = 2 [deprecated = true, (.google.api.field_behavior) = OPTIONAL]; * + * @deprecated google.cloud.dialogflow.v2.ListAnswerRecordsRequest.filter is deprecated. See + * google/cloud/dialogflow/v2/answer_record.proto;l=135 * @param value The bytes for filter to set. * @return This builder for chaining. */ + @java.lang.Deprecated public Builder setFilterBytes(com.google.protobuf.ByteString value) { if (value == null) { throw new NullPointerException(); diff --git a/proto-google-cloud-dialogflow-v2/src/main/java/com/google/cloud/dialogflow/v2/ListAnswerRecordsRequestOrBuilder.java b/proto-google-cloud-dialogflow-v2/src/main/java/com/google/cloud/dialogflow/v2/ListAnswerRecordsRequestOrBuilder.java index 0927a53cd..6216049ed 100644 --- a/proto-google-cloud-dialogflow-v2/src/main/java/com/google/cloud/dialogflow/v2/ListAnswerRecordsRequestOrBuilder.java +++ b/proto-google-cloud-dialogflow-v2/src/main/java/com/google/cloud/dialogflow/v2/ListAnswerRecordsRequestOrBuilder.java @@ -60,33 +60,37 @@ public interface ListAnswerRecordsRequestOrBuilder * * *
-   * Required. Filters to restrict results to specific answer records.
-   * Filter on answer record type. Currently predicates on `type` is supported,
-   * valid values are `ARTICLE_ANSWER`, `FAQ_ANSWER`.
+   * Optional. Filters to restrict results to specific answer records.
+   * Marked deprecated as it hasn't been, and isn't currently, supported.
    * For more information about filtering, see
    * [API Filtering](https://aip.dev/160).
    * 
* - * string filter = 2 [(.google.api.field_behavior) = REQUIRED]; + * string filter = 2 [deprecated = true, (.google.api.field_behavior) = OPTIONAL]; * + * @deprecated google.cloud.dialogflow.v2.ListAnswerRecordsRequest.filter is deprecated. See + * google/cloud/dialogflow/v2/answer_record.proto;l=135 * @return The filter. */ + @java.lang.Deprecated java.lang.String getFilter(); /** * * *
-   * Required. Filters to restrict results to specific answer records.
-   * Filter on answer record type. Currently predicates on `type` is supported,
-   * valid values are `ARTICLE_ANSWER`, `FAQ_ANSWER`.
+   * Optional. Filters to restrict results to specific answer records.
+   * Marked deprecated as it hasn't been, and isn't currently, supported.
    * For more information about filtering, see
    * [API Filtering](https://aip.dev/160).
    * 
* - * string filter = 2 [(.google.api.field_behavior) = REQUIRED]; + * string filter = 2 [deprecated = true, (.google.api.field_behavior) = OPTIONAL]; * + * @deprecated google.cloud.dialogflow.v2.ListAnswerRecordsRequest.filter is deprecated. See + * google/cloud/dialogflow/v2/answer_record.proto;l=135 * @return The bytes for filter. */ + @java.lang.Deprecated com.google.protobuf.ByteString getFilterBytes(); /** diff --git a/proto-google-cloud-dialogflow-v2/src/main/java/com/google/cloud/dialogflow/v2/QueryInput.java b/proto-google-cloud-dialogflow-v2/src/main/java/com/google/cloud/dialogflow/v2/QueryInput.java index 5f71650b9..9cbe29c54 100644 --- a/proto-google-cloud-dialogflow-v2/src/main/java/com/google/cloud/dialogflow/v2/QueryInput.java +++ b/proto-google-cloud-dialogflow-v2/src/main/java/com/google/cloud/dialogflow/v2/QueryInput.java @@ -262,7 +262,8 @@ public com.google.cloud.dialogflow.v2.InputAudioConfigOrBuilder getAudioConfigOr * * *
-   * The natural language text to be processed.
+   * The natural language text to be processed. Text length must not exceed
+   * 256 character for virtual agent interactions.
    * 
* * .google.cloud.dialogflow.v2.TextInput text = 2; @@ -277,7 +278,8 @@ public boolean hasText() { * * *
-   * The natural language text to be processed.
+   * The natural language text to be processed. Text length must not exceed
+   * 256 character for virtual agent interactions.
    * 
* * .google.cloud.dialogflow.v2.TextInput text = 2; @@ -295,7 +297,8 @@ public com.google.cloud.dialogflow.v2.TextInput getText() { * * *
-   * The natural language text to be processed.
+   * The natural language text to be processed. Text length must not exceed
+   * 256 character for virtual agent interactions.
    * 
* * .google.cloud.dialogflow.v2.TextInput text = 2; @@ -995,7 +998,8 @@ public com.google.cloud.dialogflow.v2.InputAudioConfigOrBuilder getAudioConfigOr * * *
-     * The natural language text to be processed.
+     * The natural language text to be processed. Text length must not exceed
+     * 256 character for virtual agent interactions.
      * 
* * .google.cloud.dialogflow.v2.TextInput text = 2; @@ -1010,7 +1014,8 @@ public boolean hasText() { * * *
-     * The natural language text to be processed.
+     * The natural language text to be processed. Text length must not exceed
+     * 256 character for virtual agent interactions.
      * 
* * .google.cloud.dialogflow.v2.TextInput text = 2; @@ -1035,7 +1040,8 @@ public com.google.cloud.dialogflow.v2.TextInput getText() { * * *
-     * The natural language text to be processed.
+     * The natural language text to be processed. Text length must not exceed
+     * 256 character for virtual agent interactions.
      * 
* * .google.cloud.dialogflow.v2.TextInput text = 2; @@ -1057,7 +1063,8 @@ public Builder setText(com.google.cloud.dialogflow.v2.TextInput value) { * * *
-     * The natural language text to be processed.
+     * The natural language text to be processed. Text length must not exceed
+     * 256 character for virtual agent interactions.
      * 
* * .google.cloud.dialogflow.v2.TextInput text = 2; @@ -1076,7 +1083,8 @@ public Builder setText(com.google.cloud.dialogflow.v2.TextInput.Builder builderF * * *
-     * The natural language text to be processed.
+     * The natural language text to be processed. Text length must not exceed
+     * 256 character for virtual agent interactions.
      * 
* * .google.cloud.dialogflow.v2.TextInput text = 2; @@ -1108,7 +1116,8 @@ public Builder mergeText(com.google.cloud.dialogflow.v2.TextInput value) { * * *
-     * The natural language text to be processed.
+     * The natural language text to be processed. Text length must not exceed
+     * 256 character for virtual agent interactions.
      * 
* * .google.cloud.dialogflow.v2.TextInput text = 2; @@ -1133,7 +1142,8 @@ public Builder clearText() { * * *
-     * The natural language text to be processed.
+     * The natural language text to be processed. Text length must not exceed
+     * 256 character for virtual agent interactions.
      * 
* * .google.cloud.dialogflow.v2.TextInput text = 2; @@ -1145,7 +1155,8 @@ public com.google.cloud.dialogflow.v2.TextInput.Builder getTextBuilder() { * * *
-     * The natural language text to be processed.
+     * The natural language text to be processed. Text length must not exceed
+     * 256 character for virtual agent interactions.
      * 
* * .google.cloud.dialogflow.v2.TextInput text = 2; @@ -1165,7 +1176,8 @@ public com.google.cloud.dialogflow.v2.TextInputOrBuilder getTextOrBuilder() { * * *
-     * The natural language text to be processed.
+     * The natural language text to be processed. Text length must not exceed
+     * 256 character for virtual agent interactions.
      * 
* * .google.cloud.dialogflow.v2.TextInput text = 2; diff --git a/proto-google-cloud-dialogflow-v2/src/main/java/com/google/cloud/dialogflow/v2/QueryInputOrBuilder.java b/proto-google-cloud-dialogflow-v2/src/main/java/com/google/cloud/dialogflow/v2/QueryInputOrBuilder.java index 92d7cad81..1374185a5 100644 --- a/proto-google-cloud-dialogflow-v2/src/main/java/com/google/cloud/dialogflow/v2/QueryInputOrBuilder.java +++ b/proto-google-cloud-dialogflow-v2/src/main/java/com/google/cloud/dialogflow/v2/QueryInputOrBuilder.java @@ -62,7 +62,8 @@ public interface QueryInputOrBuilder * * *
-   * The natural language text to be processed.
+   * The natural language text to be processed. Text length must not exceed
+   * 256 character for virtual agent interactions.
    * 
* * .google.cloud.dialogflow.v2.TextInput text = 2; @@ -74,7 +75,8 @@ public interface QueryInputOrBuilder * * *
-   * The natural language text to be processed.
+   * The natural language text to be processed. Text length must not exceed
+   * 256 character for virtual agent interactions.
    * 
* * .google.cloud.dialogflow.v2.TextInput text = 2; @@ -86,7 +88,8 @@ public interface QueryInputOrBuilder * * *
-   * The natural language text to be processed.
+   * The natural language text to be processed. Text length must not exceed
+   * 256 character for virtual agent interactions.
    * 
* * .google.cloud.dialogflow.v2.TextInput text = 2; diff --git a/proto-google-cloud-dialogflow-v2/src/main/java/com/google/cloud/dialogflow/v2/QueryResult.java b/proto-google-cloud-dialogflow-v2/src/main/java/com/google/cloud/dialogflow/v2/QueryResult.java index f3516c3e3..4d402be34 100644 --- a/proto-google-cloud-dialogflow-v2/src/main/java/com/google/cloud/dialogflow/v2/QueryResult.java +++ b/proto-google-cloud-dialogflow-v2/src/main/java/com/google/cloud/dialogflow/v2/QueryResult.java @@ -581,7 +581,8 @@ public boolean getAllRequiredParamsPresent() { * *
    * Indicates whether the conversational query triggers a cancellation for slot
-   * filling.
+   * filling. For more information, see the [cancel slot filling
+   * documentation](https://cloud.google.com/dialogflow/es/docs/intents-actions-parameters#cancel).
    * 
* * bool cancels_slot_filling = 21; @@ -2602,7 +2603,8 @@ public Builder clearAllRequiredParamsPresent() { * *
      * Indicates whether the conversational query triggers a cancellation for slot
-     * filling.
+     * filling. For more information, see the [cancel slot filling
+     * documentation](https://cloud.google.com/dialogflow/es/docs/intents-actions-parameters#cancel).
      * 
* * bool cancels_slot_filling = 21; @@ -2618,7 +2620,8 @@ public boolean getCancelsSlotFilling() { * *
      * Indicates whether the conversational query triggers a cancellation for slot
-     * filling.
+     * filling. For more information, see the [cancel slot filling
+     * documentation](https://cloud.google.com/dialogflow/es/docs/intents-actions-parameters#cancel).
      * 
* * bool cancels_slot_filling = 21; @@ -2637,7 +2640,8 @@ public Builder setCancelsSlotFilling(boolean value) { * *
      * Indicates whether the conversational query triggers a cancellation for slot
-     * filling.
+     * filling. For more information, see the [cancel slot filling
+     * documentation](https://cloud.google.com/dialogflow/es/docs/intents-actions-parameters#cancel).
      * 
* * bool cancels_slot_filling = 21; diff --git a/proto-google-cloud-dialogflow-v2/src/main/java/com/google/cloud/dialogflow/v2/QueryResultOrBuilder.java b/proto-google-cloud-dialogflow-v2/src/main/java/com/google/cloud/dialogflow/v2/QueryResultOrBuilder.java index 09e62d5a7..aacf368f5 100644 --- a/proto-google-cloud-dialogflow-v2/src/main/java/com/google/cloud/dialogflow/v2/QueryResultOrBuilder.java +++ b/proto-google-cloud-dialogflow-v2/src/main/java/com/google/cloud/dialogflow/v2/QueryResultOrBuilder.java @@ -234,7 +234,8 @@ public interface QueryResultOrBuilder * *
    * Indicates whether the conversational query triggers a cancellation for slot
-   * filling.
+   * filling. For more information, see the [cancel slot filling
+   * documentation](https://cloud.google.com/dialogflow/es/docs/intents-actions-parameters#cancel).
    * 
* * bool cancels_slot_filling = 21; diff --git a/proto-google-cloud-dialogflow-v2/src/main/java/com/google/cloud/dialogflow/v2/StreamingDetectIntentRequest.java b/proto-google-cloud-dialogflow-v2/src/main/java/com/google/cloud/dialogflow/v2/StreamingDetectIntentRequest.java index 86a385578..5633f0ec6 100644 --- a/proto-google-cloud-dialogflow-v2/src/main/java/com/google/cloud/dialogflow/v2/StreamingDetectIntentRequest.java +++ b/proto-google-cloud-dialogflow-v2/src/main/java/com/google/cloud/dialogflow/v2/StreamingDetectIntentRequest.java @@ -425,7 +425,7 @@ public com.google.cloud.dialogflow.v2.QueryInputOrBuilder getQueryInputOrBuilder * bool single_utterance = 4 [deprecated = true]; * * @deprecated google.cloud.dialogflow.v2.StreamingDetectIntentRequest.single_utterance is - * deprecated. See google/cloud/dialogflow/v2/session.proto;l=455 + * deprecated. See google/cloud/dialogflow/v2/session.proto;l=457 * @return The singleUtterance. */ @java.lang.Override @@ -1684,7 +1684,7 @@ public com.google.cloud.dialogflow.v2.QueryInputOrBuilder getQueryInputOrBuilder * bool single_utterance = 4 [deprecated = true]; * * @deprecated google.cloud.dialogflow.v2.StreamingDetectIntentRequest.single_utterance is - * deprecated. See google/cloud/dialogflow/v2/session.proto;l=455 + * deprecated. See google/cloud/dialogflow/v2/session.proto;l=457 * @return The singleUtterance. */ @java.lang.Override @@ -1709,7 +1709,7 @@ public boolean getSingleUtterance() { * bool single_utterance = 4 [deprecated = true]; * * @deprecated google.cloud.dialogflow.v2.StreamingDetectIntentRequest.single_utterance is - * deprecated. See google/cloud/dialogflow/v2/session.proto;l=455 + * deprecated. See google/cloud/dialogflow/v2/session.proto;l=457 * @param value The singleUtterance to set. * @return This builder for chaining. */ @@ -1737,7 +1737,7 @@ public Builder setSingleUtterance(boolean value) { * bool single_utterance = 4 [deprecated = true]; * * @deprecated google.cloud.dialogflow.v2.StreamingDetectIntentRequest.single_utterance is - * deprecated. See google/cloud/dialogflow/v2/session.proto;l=455 + * deprecated. See google/cloud/dialogflow/v2/session.proto;l=457 * @return This builder for chaining. */ @java.lang.Deprecated diff --git a/proto-google-cloud-dialogflow-v2/src/main/java/com/google/cloud/dialogflow/v2/StreamingDetectIntentRequestOrBuilder.java b/proto-google-cloud-dialogflow-v2/src/main/java/com/google/cloud/dialogflow/v2/StreamingDetectIntentRequestOrBuilder.java index f242c591b..ea23b9c81 100644 --- a/proto-google-cloud-dialogflow-v2/src/main/java/com/google/cloud/dialogflow/v2/StreamingDetectIntentRequestOrBuilder.java +++ b/proto-google-cloud-dialogflow-v2/src/main/java/com/google/cloud/dialogflow/v2/StreamingDetectIntentRequestOrBuilder.java @@ -185,7 +185,7 @@ public interface StreamingDetectIntentRequestOrBuilder * bool single_utterance = 4 [deprecated = true]; * * @deprecated google.cloud.dialogflow.v2.StreamingDetectIntentRequest.single_utterance is - * deprecated. See google/cloud/dialogflow/v2/session.proto;l=455 + * deprecated. See google/cloud/dialogflow/v2/session.proto;l=457 * @return The singleUtterance. */ @java.lang.Deprecated diff --git a/proto-google-cloud-dialogflow-v2/src/main/java/com/google/cloud/dialogflow/v2/TextInput.java b/proto-google-cloud-dialogflow-v2/src/main/java/com/google/cloud/dialogflow/v2/TextInput.java index 3d25580eb..803d56224 100644 --- a/proto-google-cloud-dialogflow-v2/src/main/java/com/google/cloud/dialogflow/v2/TextInput.java +++ b/proto-google-cloud-dialogflow-v2/src/main/java/com/google/cloud/dialogflow/v2/TextInput.java @@ -22,6 +22,8 @@ * * *
+ * ============================================================================
+ * Auxiliary proto messages.
  * Represents the natural language text to be processed.
  * 
* @@ -128,7 +130,7 @@ public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { * *
    * Required. The UTF-8 encoded natural language text to be processed.
-   * Text length must not exceed 256 characters.
+   * Text length must not exceed 256 characters for virtual agent interactions.
    * 
* * string text = 1 [(.google.api.field_behavior) = REQUIRED]; @@ -152,7 +154,7 @@ public java.lang.String getText() { * *
    * Required. The UTF-8 encoded natural language text to be processed.
-   * Text length must not exceed 256 characters.
+   * Text length must not exceed 256 characters for virtual agent interactions.
    * 
* * string text = 1 [(.google.api.field_behavior) = REQUIRED]; @@ -398,6 +400,8 @@ protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.Build * * *
+   * ============================================================================
+   * Auxiliary proto messages.
    * Represents the natural language text to be processed.
    * 
* @@ -564,7 +568,7 @@ public Builder mergeFrom( * *
      * Required. The UTF-8 encoded natural language text to be processed.
-     * Text length must not exceed 256 characters.
+     * Text length must not exceed 256 characters for virtual agent interactions.
      * 
* * string text = 1 [(.google.api.field_behavior) = REQUIRED]; @@ -587,7 +591,7 @@ public java.lang.String getText() { * *
      * Required. The UTF-8 encoded natural language text to be processed.
-     * Text length must not exceed 256 characters.
+     * Text length must not exceed 256 characters for virtual agent interactions.
      * 
* * string text = 1 [(.google.api.field_behavior) = REQUIRED]; @@ -610,7 +614,7 @@ public com.google.protobuf.ByteString getTextBytes() { * *
      * Required. The UTF-8 encoded natural language text to be processed.
-     * Text length must not exceed 256 characters.
+     * Text length must not exceed 256 characters for virtual agent interactions.
      * 
* * string text = 1 [(.google.api.field_behavior) = REQUIRED]; @@ -632,7 +636,7 @@ public Builder setText(java.lang.String value) { * *
      * Required. The UTF-8 encoded natural language text to be processed.
-     * Text length must not exceed 256 characters.
+     * Text length must not exceed 256 characters for virtual agent interactions.
      * 
* * string text = 1 [(.google.api.field_behavior) = REQUIRED]; @@ -650,7 +654,7 @@ public Builder clearText() { * *
      * Required. The UTF-8 encoded natural language text to be processed.
-     * Text length must not exceed 256 characters.
+     * Text length must not exceed 256 characters for virtual agent interactions.
      * 
* * string text = 1 [(.google.api.field_behavior) = REQUIRED]; diff --git a/proto-google-cloud-dialogflow-v2/src/main/java/com/google/cloud/dialogflow/v2/TextInputOrBuilder.java b/proto-google-cloud-dialogflow-v2/src/main/java/com/google/cloud/dialogflow/v2/TextInputOrBuilder.java index f7ebb3e30..5b0490447 100644 --- a/proto-google-cloud-dialogflow-v2/src/main/java/com/google/cloud/dialogflow/v2/TextInputOrBuilder.java +++ b/proto-google-cloud-dialogflow-v2/src/main/java/com/google/cloud/dialogflow/v2/TextInputOrBuilder.java @@ -28,7 +28,7 @@ public interface TextInputOrBuilder * *
    * Required. The UTF-8 encoded natural language text to be processed.
-   * Text length must not exceed 256 characters.
+   * Text length must not exceed 256 characters for virtual agent interactions.
    * 
* * string text = 1 [(.google.api.field_behavior) = REQUIRED]; @@ -41,7 +41,7 @@ public interface TextInputOrBuilder * *
    * Required. The UTF-8 encoded natural language text to be processed.
-   * Text length must not exceed 256 characters.
+   * Text length must not exceed 256 characters for virtual agent interactions.
    * 
* * string text = 1 [(.google.api.field_behavior) = REQUIRED]; diff --git a/proto-google-cloud-dialogflow-v2/src/main/proto/google/cloud/dialogflow/v2/answer_record.proto b/proto-google-cloud-dialogflow-v2/src/main/proto/google/cloud/dialogflow/v2/answer_record.proto index b6f3452d1..14ab41e15 100644 --- a/proto-google-cloud-dialogflow-v2/src/main/proto/google/cloud/dialogflow/v2/answer_record.proto +++ b/proto-google-cloud-dialogflow-v2/src/main/proto/google/cloud/dialogflow/v2/answer_record.proto @@ -127,13 +127,16 @@ message ListAnswerRecordsRequest { } ]; - // Required. Filters to restrict results to specific answer records. - // Filter on answer record type. Currently predicates on `type` is supported, - // valid values are `ARTICLE_ANSWER`, `FAQ_ANSWER`. + // Optional. Filters to restrict results to specific answer records. + // + // Marked deprecated as it hasn't been, and isn't currently, supported. // // For more information about filtering, see // [API Filtering](https://aip.dev/160). - string filter = 2 [(google.api.field_behavior) = REQUIRED]; + string filter = 2 [ + deprecated = true, + (google.api.field_behavior) = OPTIONAL + ]; // Optional. The maximum number of records to return in a single page. // The server may return fewer records than this. If unspecified, we use 10. diff --git a/proto-google-cloud-dialogflow-v2/src/main/proto/google/cloud/dialogflow/v2/audio_config.proto b/proto-google-cloud-dialogflow-v2/src/main/proto/google/cloud/dialogflow/v2/audio_config.proto index 8554a2349..98258ee23 100644 --- a/proto-google-cloud-dialogflow-v2/src/main/proto/google/cloud/dialogflow/v2/audio_config.proto +++ b/proto-google-cloud-dialogflow-v2/src/main/proto/google/cloud/dialogflow/v2/audio_config.proto @@ -31,6 +31,10 @@ option (google.api.resource_definition) = { type: "automl.googleapis.com/Model" pattern: "projects/{project}/locations/{location}/models/{model}" }; +option (google.api.resource_definition) = { + type: "speech.googleapis.com/PhraseSet" + pattern: "projects/{project}/locations/{location}/phraseSets/{phrase_set}" +}; // Audio encoding of the audio content sent in the conversational query request. // Refer to the diff --git a/proto-google-cloud-dialogflow-v2/src/main/proto/google/cloud/dialogflow/v2/conversation_profile.proto b/proto-google-cloud-dialogflow-v2/src/main/proto/google/cloud/dialogflow/v2/conversation_profile.proto index 4f87ec0d0..56cc8e47e 100644 --- a/proto-google-cloud-dialogflow-v2/src/main/proto/google/cloud/dialogflow/v2/conversation_profile.proto +++ b/proto-google-cloud-dialogflow-v2/src/main/proto/google/cloud/dialogflow/v2/conversation_profile.proto @@ -515,7 +515,8 @@ message HumanAgentAssistantConfig { // Custom conversation models used in agent assist feature. // - // Supported feature: ARTICLE_SUGGESTION, SMART_COMPOSE, SMART_REPLY. + // Supported feature: ARTICLE_SUGGESTION, SMART_COMPOSE, SMART_REPLY, + // CONVERSATION_SUMMARIZATION. message ConversationModelConfig { // Conversation model resource name. Format: `projects//conversationModels/`. diff --git a/proto-google-cloud-dialogflow-v2/src/main/proto/google/cloud/dialogflow/v2/session.proto b/proto-google-cloud-dialogflow-v2/src/main/proto/google/cloud/dialogflow/v2/session.proto index 479972a0e..107e02060 100644 --- a/proto-google-cloud-dialogflow-v2/src/main/proto/google/cloud/dialogflow/v2/session.proto +++ b/proto-google-cloud-dialogflow-v2/src/main/proto/google/cloud/dialogflow/v2/session.proto @@ -256,7 +256,8 @@ message QueryInput { // Instructs the speech recognizer how to process the speech audio. InputAudioConfig audio_config = 1; - // The natural language text to be processed. + // The natural language text to be processed. Text length must not exceed + // 256 character for virtual agent interactions. TextInput text = 2; // The event to be processed. @@ -324,7 +325,8 @@ message QueryResult { bool all_required_params_present = 5; // Indicates whether the conversational query triggers a cancellation for slot - // filling. + // filling. For more information, see the [cancel slot filling + // documentation](https://cloud.google.com/dialogflow/es/docs/intents-actions-parameters#cancel). bool cancels_slot_filling = 21; // The text to be pronounced to the user or shown on the screen. @@ -608,10 +610,13 @@ message StreamingRecognitionResult { string language_code = 10; } +// ============================================================================ +// Auxiliary proto messages. +// // Represents the natural language text to be processed. message TextInput { // Required. The UTF-8 encoded natural language text to be processed. - // Text length must not exceed 256 characters. + // Text length must not exceed 256 characters for virtual agent interactions. string text = 1 [(google.api.field_behavior) = REQUIRED]; // Required. The language of this conversational query. See [Language diff --git a/proto-google-cloud-dialogflow-v2beta1/src/main/java/com/google/cloud/dialogflow/v2beta1/AnalyzeContentRequest.java b/proto-google-cloud-dialogflow-v2beta1/src/main/java/com/google/cloud/dialogflow/v2beta1/AnalyzeContentRequest.java index fa86c21cb..9bad65912 100644 --- a/proto-google-cloud-dialogflow-v2beta1/src/main/java/com/google/cloud/dialogflow/v2beta1/AnalyzeContentRequest.java +++ b/proto-google-cloud-dialogflow-v2beta1/src/main/java/com/google/cloud/dialogflow/v2beta1/AnalyzeContentRequest.java @@ -39,6 +39,7 @@ private AnalyzeContentRequest(com.google.protobuf.GeneratedMessageV3.Builder private AnalyzeContentRequest() { participant_ = ""; + cxCurrentPage_ = ""; requestId_ = ""; } @@ -111,6 +112,22 @@ private AnalyzeContentRequest( inputCase_ = 6; break; } + case 58: + { + com.google.cloud.dialogflow.v2beta1.AudioInput.Builder subBuilder = null; + if (inputCase_ == 7) { + subBuilder = ((com.google.cloud.dialogflow.v2beta1.AudioInput) input_).toBuilder(); + } + input_ = + input.readMessage( + com.google.cloud.dialogflow.v2beta1.AudioInput.parser(), extensionRegistry); + if (subBuilder != null) { + subBuilder.mergeFrom((com.google.cloud.dialogflow.v2beta1.AudioInput) input_); + input_ = subBuilder.buildPartial(); + } + inputCase_ = 7; + break; + } case 66: { com.google.cloud.dialogflow.v2beta1.EventInput.Builder subBuilder = null; @@ -196,6 +213,13 @@ private AnalyzeContentRequest( cxParameters_ = subBuilder.buildPartial(); } + break; + } + case 162: + { + java.lang.String s = input.readStringRequireUtf8(); + + cxCurrentPage_ = s; break; } default: @@ -242,6 +266,7 @@ public enum InputCase com.google.protobuf.Internal.EnumLite, com.google.protobuf.AbstractMessage.InternalOneOfEnum { TEXT_INPUT(6), + AUDIO_INPUT(7), EVENT_INPUT(8), INPUT_NOT_SET(0); private final int value; @@ -263,6 +288,8 @@ public static InputCase forNumber(int value) { switch (value) { case 6: return TEXT_INPUT; + case 7: + return AUDIO_INPUT; case 8: return EVENT_INPUT; case 0: @@ -389,6 +416,57 @@ public com.google.cloud.dialogflow.v2beta1.TextInputOrBuilder getTextInputOrBuil return com.google.cloud.dialogflow.v2beta1.TextInput.getDefaultInstance(); } + public static final int AUDIO_INPUT_FIELD_NUMBER = 7; + /** + * + * + *
+   * The natural language speech audio to be processed.
+   * 
+ * + * .google.cloud.dialogflow.v2beta1.AudioInput audio_input = 7; + * + * @return Whether the audioInput field is set. + */ + @java.lang.Override + public boolean hasAudioInput() { + return inputCase_ == 7; + } + /** + * + * + *
+   * The natural language speech audio to be processed.
+   * 
+ * + * .google.cloud.dialogflow.v2beta1.AudioInput audio_input = 7; + * + * @return The audioInput. + */ + @java.lang.Override + public com.google.cloud.dialogflow.v2beta1.AudioInput getAudioInput() { + if (inputCase_ == 7) { + return (com.google.cloud.dialogflow.v2beta1.AudioInput) input_; + } + return com.google.cloud.dialogflow.v2beta1.AudioInput.getDefaultInstance(); + } + /** + * + * + *
+   * The natural language speech audio to be processed.
+   * 
+ * + * .google.cloud.dialogflow.v2beta1.AudioInput audio_input = 7; + */ + @java.lang.Override + public com.google.cloud.dialogflow.v2beta1.AudioInputOrBuilder getAudioInputOrBuilder() { + if (inputCase_ == 7) { + return (com.google.cloud.dialogflow.v2beta1.AudioInput) input_; + } + return com.google.cloud.dialogflow.v2beta1.AudioInput.getDefaultInstance(); + } + public static final int EVENT_INPUT_FIELD_NUMBER = 8; /** * @@ -656,6 +734,77 @@ public com.google.protobuf.StructOrBuilder getCxParametersOrBuilder() { return getCxParameters(); } + public static final int CX_CURRENT_PAGE_FIELD_NUMBER = 20; + private volatile java.lang.Object cxCurrentPage_; + /** + * + * + *
+   * The unique identifier of the CX page to override the `current_page` in the
+   * session.
+   * Format: `projects/<Project ID>/locations/<Location ID>/agents/<Agent
+   * ID>/flows/<Flow ID>/pages/<Page ID>`.
+   * If `cx_current_page` is specified, the previous state of the session will
+   * be ignored by Dialogflow CX, including the [previous
+   * page][QueryResult.current_page] and the [previous session
+   * parameters][QueryResult.parameters]. In most cases, `cx_current_page` and
+   * `cx_parameters` should be configured together to direct a session to a
+   * specific state.
+   * Note: this field should only be used if you are connecting to a Dialogflow
+   * CX agent.
+   * 
+ * + * string cx_current_page = 20; + * + * @return The cxCurrentPage. + */ + @java.lang.Override + public java.lang.String getCxCurrentPage() { + java.lang.Object ref = cxCurrentPage_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + cxCurrentPage_ = s; + return s; + } + } + /** + * + * + *
+   * The unique identifier of the CX page to override the `current_page` in the
+   * session.
+   * Format: `projects/<Project ID>/locations/<Location ID>/agents/<Agent
+   * ID>/flows/<Flow ID>/pages/<Page ID>`.
+   * If `cx_current_page` is specified, the previous state of the session will
+   * be ignored by Dialogflow CX, including the [previous
+   * page][QueryResult.current_page] and the [previous session
+   * parameters][QueryResult.parameters]. In most cases, `cx_current_page` and
+   * `cx_parameters` should be configured together to direct a session to a
+   * specific state.
+   * Note: this field should only be used if you are connecting to a Dialogflow
+   * CX agent.
+   * 
+ * + * string cx_current_page = 20; + * + * @return The bytes for cxCurrentPage. + */ + @java.lang.Override + public com.google.protobuf.ByteString getCxCurrentPageBytes() { + java.lang.Object ref = cxCurrentPage_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + cxCurrentPage_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + public static final int MESSAGE_SEND_TIME_FIELD_NUMBER = 10; private com.google.protobuf.Timestamp messageSendTime_; /** @@ -813,6 +962,9 @@ public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io if (inputCase_ == 6) { output.writeMessage(6, (com.google.cloud.dialogflow.v2beta1.TextInput) input_); } + if (inputCase_ == 7) { + output.writeMessage(7, (com.google.cloud.dialogflow.v2beta1.AudioInput) input_); + } if (inputCase_ == 8) { output.writeMessage(8, (com.google.cloud.dialogflow.v2beta1.EventInput) input_); } @@ -831,6 +983,9 @@ public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io if (cxParameters_ != null) { output.writeMessage(18, getCxParameters()); } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(cxCurrentPage_)) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 20, cxCurrentPage_); + } unknownFields.writeTo(output); } @@ -851,6 +1006,11 @@ public int getSerializedSize() { com.google.protobuf.CodedOutputStream.computeMessageSize( 6, (com.google.cloud.dialogflow.v2beta1.TextInput) input_); } + if (inputCase_ == 7) { + size += + com.google.protobuf.CodedOutputStream.computeMessageSize( + 7, (com.google.cloud.dialogflow.v2beta1.AudioInput) input_); + } if (inputCase_ == 8) { size += com.google.protobuf.CodedOutputStream.computeMessageSize( @@ -871,6 +1031,9 @@ public int getSerializedSize() { if (cxParameters_ != null) { size += com.google.protobuf.CodedOutputStream.computeMessageSize(18, getCxParameters()); } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(cxCurrentPage_)) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(20, cxCurrentPage_); + } size += unknownFields.getSerializedSize(); memoizedSize = size; return size; @@ -904,6 +1067,7 @@ public boolean equals(final java.lang.Object obj) { if (hasCxParameters()) { if (!getCxParameters().equals(other.getCxParameters())) return false; } + if (!getCxCurrentPage().equals(other.getCxCurrentPage())) return false; if (hasMessageSendTime() != other.hasMessageSendTime()) return false; if (hasMessageSendTime()) { if (!getMessageSendTime().equals(other.getMessageSendTime())) return false; @@ -914,6 +1078,9 @@ public boolean equals(final java.lang.Object obj) { case 6: if (!getTextInput().equals(other.getTextInput())) return false; break; + case 7: + if (!getAudioInput().equals(other.getAudioInput())) return false; + break; case 8: if (!getEventInput().equals(other.getEventInput())) return false; break; @@ -949,6 +1116,8 @@ public int hashCode() { hash = (37 * hash) + CX_PARAMETERS_FIELD_NUMBER; hash = (53 * hash) + getCxParameters().hashCode(); } + hash = (37 * hash) + CX_CURRENT_PAGE_FIELD_NUMBER; + hash = (53 * hash) + getCxCurrentPage().hashCode(); if (hasMessageSendTime()) { hash = (37 * hash) + MESSAGE_SEND_TIME_FIELD_NUMBER; hash = (53 * hash) + getMessageSendTime().hashCode(); @@ -960,6 +1129,10 @@ public int hashCode() { hash = (37 * hash) + TEXT_INPUT_FIELD_NUMBER; hash = (53 * hash) + getTextInput().hashCode(); break; + case 7: + hash = (37 * hash) + AUDIO_INPUT_FIELD_NUMBER; + hash = (53 * hash) + getAudioInput().hashCode(); + break; case 8: hash = (37 * hash) + EVENT_INPUT_FIELD_NUMBER; hash = (53 * hash) + getEventInput().hashCode(); @@ -1139,6 +1312,8 @@ public Builder clear() { cxParameters_ = null; cxParametersBuilder_ = null; } + cxCurrentPage_ = ""; + if (messageSendTimeBuilder_ == null) { messageSendTime_ = null; } else { @@ -1184,6 +1359,13 @@ public com.google.cloud.dialogflow.v2beta1.AnalyzeContentRequest buildPartial() result.input_ = textInputBuilder_.build(); } } + if (inputCase_ == 7) { + if (audioInputBuilder_ == null) { + result.input_ = input_; + } else { + result.input_ = audioInputBuilder_.build(); + } + } if (inputCase_ == 8) { if (eventInputBuilder_ == null) { result.input_ = input_; @@ -1211,6 +1393,7 @@ public com.google.cloud.dialogflow.v2beta1.AnalyzeContentRequest buildPartial() } else { result.cxParameters_ = cxParametersBuilder_.build(); } + result.cxCurrentPage_ = cxCurrentPage_; if (messageSendTimeBuilder_ == null) { result.messageSendTime_ = messageSendTime_; } else { @@ -1284,6 +1467,10 @@ public Builder mergeFrom(com.google.cloud.dialogflow.v2beta1.AnalyzeContentReque if (other.hasCxParameters()) { mergeCxParameters(other.getCxParameters()); } + if (!other.getCxCurrentPage().isEmpty()) { + cxCurrentPage_ = other.cxCurrentPage_; + onChanged(); + } if (other.hasMessageSendTime()) { mergeMessageSendTime(other.getMessageSendTime()); } @@ -1297,6 +1484,11 @@ public Builder mergeFrom(com.google.cloud.dialogflow.v2beta1.AnalyzeContentReque mergeTextInput(other.getTextInput()); break; } + case AUDIO_INPUT: + { + mergeAudioInput(other.getAudioInput()); + break; + } case EVENT_INPUT: { mergeEventInput(other.getEventInput()); @@ -1687,6 +1879,216 @@ public com.google.cloud.dialogflow.v2beta1.TextInputOrBuilder getTextInputOrBuil return textInputBuilder_; } + private com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.dialogflow.v2beta1.AudioInput, + com.google.cloud.dialogflow.v2beta1.AudioInput.Builder, + com.google.cloud.dialogflow.v2beta1.AudioInputOrBuilder> + audioInputBuilder_; + /** + * + * + *
+     * The natural language speech audio to be processed.
+     * 
+ * + * .google.cloud.dialogflow.v2beta1.AudioInput audio_input = 7; + * + * @return Whether the audioInput field is set. + */ + @java.lang.Override + public boolean hasAudioInput() { + return inputCase_ == 7; + } + /** + * + * + *
+     * The natural language speech audio to be processed.
+     * 
+ * + * .google.cloud.dialogflow.v2beta1.AudioInput audio_input = 7; + * + * @return The audioInput. + */ + @java.lang.Override + public com.google.cloud.dialogflow.v2beta1.AudioInput getAudioInput() { + if (audioInputBuilder_ == null) { + if (inputCase_ == 7) { + return (com.google.cloud.dialogflow.v2beta1.AudioInput) input_; + } + return com.google.cloud.dialogflow.v2beta1.AudioInput.getDefaultInstance(); + } else { + if (inputCase_ == 7) { + return audioInputBuilder_.getMessage(); + } + return com.google.cloud.dialogflow.v2beta1.AudioInput.getDefaultInstance(); + } + } + /** + * + * + *
+     * The natural language speech audio to be processed.
+     * 
+ * + * .google.cloud.dialogflow.v2beta1.AudioInput audio_input = 7; + */ + public Builder setAudioInput(com.google.cloud.dialogflow.v2beta1.AudioInput value) { + if (audioInputBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + input_ = value; + onChanged(); + } else { + audioInputBuilder_.setMessage(value); + } + inputCase_ = 7; + return this; + } + /** + * + * + *
+     * The natural language speech audio to be processed.
+     * 
+ * + * .google.cloud.dialogflow.v2beta1.AudioInput audio_input = 7; + */ + public Builder setAudioInput( + com.google.cloud.dialogflow.v2beta1.AudioInput.Builder builderForValue) { + if (audioInputBuilder_ == null) { + input_ = builderForValue.build(); + onChanged(); + } else { + audioInputBuilder_.setMessage(builderForValue.build()); + } + inputCase_ = 7; + return this; + } + /** + * + * + *
+     * The natural language speech audio to be processed.
+     * 
+ * + * .google.cloud.dialogflow.v2beta1.AudioInput audio_input = 7; + */ + public Builder mergeAudioInput(com.google.cloud.dialogflow.v2beta1.AudioInput value) { + if (audioInputBuilder_ == null) { + if (inputCase_ == 7 + && input_ != com.google.cloud.dialogflow.v2beta1.AudioInput.getDefaultInstance()) { + input_ = + com.google.cloud.dialogflow.v2beta1.AudioInput.newBuilder( + (com.google.cloud.dialogflow.v2beta1.AudioInput) input_) + .mergeFrom(value) + .buildPartial(); + } else { + input_ = value; + } + onChanged(); + } else { + if (inputCase_ == 7) { + audioInputBuilder_.mergeFrom(value); + } else { + audioInputBuilder_.setMessage(value); + } + } + inputCase_ = 7; + return this; + } + /** + * + * + *
+     * The natural language speech audio to be processed.
+     * 
+ * + * .google.cloud.dialogflow.v2beta1.AudioInput audio_input = 7; + */ + public Builder clearAudioInput() { + if (audioInputBuilder_ == null) { + if (inputCase_ == 7) { + inputCase_ = 0; + input_ = null; + onChanged(); + } + } else { + if (inputCase_ == 7) { + inputCase_ = 0; + input_ = null; + } + audioInputBuilder_.clear(); + } + return this; + } + /** + * + * + *
+     * The natural language speech audio to be processed.
+     * 
+ * + * .google.cloud.dialogflow.v2beta1.AudioInput audio_input = 7; + */ + public com.google.cloud.dialogflow.v2beta1.AudioInput.Builder getAudioInputBuilder() { + return getAudioInputFieldBuilder().getBuilder(); + } + /** + * + * + *
+     * The natural language speech audio to be processed.
+     * 
+ * + * .google.cloud.dialogflow.v2beta1.AudioInput audio_input = 7; + */ + @java.lang.Override + public com.google.cloud.dialogflow.v2beta1.AudioInputOrBuilder getAudioInputOrBuilder() { + if ((inputCase_ == 7) && (audioInputBuilder_ != null)) { + return audioInputBuilder_.getMessageOrBuilder(); + } else { + if (inputCase_ == 7) { + return (com.google.cloud.dialogflow.v2beta1.AudioInput) input_; + } + return com.google.cloud.dialogflow.v2beta1.AudioInput.getDefaultInstance(); + } + } + /** + * + * + *
+     * The natural language speech audio to be processed.
+     * 
+ * + * .google.cloud.dialogflow.v2beta1.AudioInput audio_input = 7; + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.dialogflow.v2beta1.AudioInput, + com.google.cloud.dialogflow.v2beta1.AudioInput.Builder, + com.google.cloud.dialogflow.v2beta1.AudioInputOrBuilder> + getAudioInputFieldBuilder() { + if (audioInputBuilder_ == null) { + if (!(inputCase_ == 7)) { + input_ = com.google.cloud.dialogflow.v2beta1.AudioInput.getDefaultInstance(); + } + audioInputBuilder_ = + new com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.dialogflow.v2beta1.AudioInput, + com.google.cloud.dialogflow.v2beta1.AudioInput.Builder, + com.google.cloud.dialogflow.v2beta1.AudioInputOrBuilder>( + (com.google.cloud.dialogflow.v2beta1.AudioInput) input_, + getParentForChildren(), + isClean()); + input_ = null; + } + inputCase_ = 7; + onChanged(); + ; + return audioInputBuilder_; + } + private com.google.protobuf.SingleFieldBuilderV3< com.google.cloud.dialogflow.v2beta1.EventInput, com.google.cloud.dialogflow.v2beta1.EventInput.Builder, @@ -2719,6 +3121,167 @@ public com.google.protobuf.StructOrBuilder getCxParametersOrBuilder() { return cxParametersBuilder_; } + private java.lang.Object cxCurrentPage_ = ""; + /** + * + * + *
+     * The unique identifier of the CX page to override the `current_page` in the
+     * session.
+     * Format: `projects/<Project ID>/locations/<Location ID>/agents/<Agent
+     * ID>/flows/<Flow ID>/pages/<Page ID>`.
+     * If `cx_current_page` is specified, the previous state of the session will
+     * be ignored by Dialogflow CX, including the [previous
+     * page][QueryResult.current_page] and the [previous session
+     * parameters][QueryResult.parameters]. In most cases, `cx_current_page` and
+     * `cx_parameters` should be configured together to direct a session to a
+     * specific state.
+     * Note: this field should only be used if you are connecting to a Dialogflow
+     * CX agent.
+     * 
+ * + * string cx_current_page = 20; + * + * @return The cxCurrentPage. + */ + public java.lang.String getCxCurrentPage() { + java.lang.Object ref = cxCurrentPage_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + cxCurrentPage_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * The unique identifier of the CX page to override the `current_page` in the
+     * session.
+     * Format: `projects/<Project ID>/locations/<Location ID>/agents/<Agent
+     * ID>/flows/<Flow ID>/pages/<Page ID>`.
+     * If `cx_current_page` is specified, the previous state of the session will
+     * be ignored by Dialogflow CX, including the [previous
+     * page][QueryResult.current_page] and the [previous session
+     * parameters][QueryResult.parameters]. In most cases, `cx_current_page` and
+     * `cx_parameters` should be configured together to direct a session to a
+     * specific state.
+     * Note: this field should only be used if you are connecting to a Dialogflow
+     * CX agent.
+     * 
+ * + * string cx_current_page = 20; + * + * @return The bytes for cxCurrentPage. + */ + public com.google.protobuf.ByteString getCxCurrentPageBytes() { + java.lang.Object ref = cxCurrentPage_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + cxCurrentPage_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * The unique identifier of the CX page to override the `current_page` in the
+     * session.
+     * Format: `projects/<Project ID>/locations/<Location ID>/agents/<Agent
+     * ID>/flows/<Flow ID>/pages/<Page ID>`.
+     * If `cx_current_page` is specified, the previous state of the session will
+     * be ignored by Dialogflow CX, including the [previous
+     * page][QueryResult.current_page] and the [previous session
+     * parameters][QueryResult.parameters]. In most cases, `cx_current_page` and
+     * `cx_parameters` should be configured together to direct a session to a
+     * specific state.
+     * Note: this field should only be used if you are connecting to a Dialogflow
+     * CX agent.
+     * 
+ * + * string cx_current_page = 20; + * + * @param value The cxCurrentPage to set. + * @return This builder for chaining. + */ + public Builder setCxCurrentPage(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + cxCurrentPage_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * The unique identifier of the CX page to override the `current_page` in the
+     * session.
+     * Format: `projects/<Project ID>/locations/<Location ID>/agents/<Agent
+     * ID>/flows/<Flow ID>/pages/<Page ID>`.
+     * If `cx_current_page` is specified, the previous state of the session will
+     * be ignored by Dialogflow CX, including the [previous
+     * page][QueryResult.current_page] and the [previous session
+     * parameters][QueryResult.parameters]. In most cases, `cx_current_page` and
+     * `cx_parameters` should be configured together to direct a session to a
+     * specific state.
+     * Note: this field should only be used if you are connecting to a Dialogflow
+     * CX agent.
+     * 
+ * + * string cx_current_page = 20; + * + * @return This builder for chaining. + */ + public Builder clearCxCurrentPage() { + + cxCurrentPage_ = getDefaultInstance().getCxCurrentPage(); + onChanged(); + return this; + } + /** + * + * + *
+     * The unique identifier of the CX page to override the `current_page` in the
+     * session.
+     * Format: `projects/<Project ID>/locations/<Location ID>/agents/<Agent
+     * ID>/flows/<Flow ID>/pages/<Page ID>`.
+     * If `cx_current_page` is specified, the previous state of the session will
+     * be ignored by Dialogflow CX, including the [previous
+     * page][QueryResult.current_page] and the [previous session
+     * parameters][QueryResult.parameters]. In most cases, `cx_current_page` and
+     * `cx_parameters` should be configured together to direct a session to a
+     * specific state.
+     * Note: this field should only be used if you are connecting to a Dialogflow
+     * CX agent.
+     * 
+ * + * string cx_current_page = 20; + * + * @param value The bytes for cxCurrentPage to set. + * @return This builder for chaining. + */ + public Builder setCxCurrentPageBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + cxCurrentPage_ = value; + onChanged(); + return this; + } + private com.google.protobuf.Timestamp messageSendTime_; private com.google.protobuf.SingleFieldBuilderV3< com.google.protobuf.Timestamp, diff --git a/proto-google-cloud-dialogflow-v2beta1/src/main/java/com/google/cloud/dialogflow/v2beta1/AnalyzeContentRequestOrBuilder.java b/proto-google-cloud-dialogflow-v2beta1/src/main/java/com/google/cloud/dialogflow/v2beta1/AnalyzeContentRequestOrBuilder.java index 85b221fe6..5bbadd567 100644 --- a/proto-google-cloud-dialogflow-v2beta1/src/main/java/com/google/cloud/dialogflow/v2beta1/AnalyzeContentRequestOrBuilder.java +++ b/proto-google-cloud-dialogflow-v2beta1/src/main/java/com/google/cloud/dialogflow/v2beta1/AnalyzeContentRequestOrBuilder.java @@ -91,6 +91,41 @@ public interface AnalyzeContentRequestOrBuilder */ com.google.cloud.dialogflow.v2beta1.TextInputOrBuilder getTextInputOrBuilder(); + /** + * + * + *
+   * The natural language speech audio to be processed.
+   * 
+ * + * .google.cloud.dialogflow.v2beta1.AudioInput audio_input = 7; + * + * @return Whether the audioInput field is set. + */ + boolean hasAudioInput(); + /** + * + * + *
+   * The natural language speech audio to be processed.
+   * 
+ * + * .google.cloud.dialogflow.v2beta1.AudioInput audio_input = 7; + * + * @return The audioInput. + */ + com.google.cloud.dialogflow.v2beta1.AudioInput getAudioInput(); + /** + * + * + *
+   * The natural language speech audio to be processed.
+   * 
+ * + * .google.cloud.dialogflow.v2beta1.AudioInput audio_input = 7; + */ + com.google.cloud.dialogflow.v2beta1.AudioInputOrBuilder getAudioInputOrBuilder(); + /** * * @@ -291,6 +326,53 @@ public interface AnalyzeContentRequestOrBuilder */ com.google.protobuf.StructOrBuilder getCxParametersOrBuilder(); + /** + * + * + *
+   * The unique identifier of the CX page to override the `current_page` in the
+   * session.
+   * Format: `projects/<Project ID>/locations/<Location ID>/agents/<Agent
+   * ID>/flows/<Flow ID>/pages/<Page ID>`.
+   * If `cx_current_page` is specified, the previous state of the session will
+   * be ignored by Dialogflow CX, including the [previous
+   * page][QueryResult.current_page] and the [previous session
+   * parameters][QueryResult.parameters]. In most cases, `cx_current_page` and
+   * `cx_parameters` should be configured together to direct a session to a
+   * specific state.
+   * Note: this field should only be used if you are connecting to a Dialogflow
+   * CX agent.
+   * 
+ * + * string cx_current_page = 20; + * + * @return The cxCurrentPage. + */ + java.lang.String getCxCurrentPage(); + /** + * + * + *
+   * The unique identifier of the CX page to override the `current_page` in the
+   * session.
+   * Format: `projects/<Project ID>/locations/<Location ID>/agents/<Agent
+   * ID>/flows/<Flow ID>/pages/<Page ID>`.
+   * If `cx_current_page` is specified, the previous state of the session will
+   * be ignored by Dialogflow CX, including the [previous
+   * page][QueryResult.current_page] and the [previous session
+   * parameters][QueryResult.parameters]. In most cases, `cx_current_page` and
+   * `cx_parameters` should be configured together to direct a session to a
+   * specific state.
+   * Note: this field should only be used if you are connecting to a Dialogflow
+   * CX agent.
+   * 
+ * + * string cx_current_page = 20; + * + * @return The bytes for cxCurrentPage. + */ + com.google.protobuf.ByteString getCxCurrentPageBytes(); + /** * * diff --git a/proto-google-cloud-dialogflow-v2beta1/src/main/java/com/google/cloud/dialogflow/v2beta1/AnswerRecordsProto.java b/proto-google-cloud-dialogflow-v2beta1/src/main/java/com/google/cloud/dialogflow/v2beta1/AnswerRecordsProto.java index 30317c39b..ee0051226 100644 --- a/proto-google-cloud-dialogflow-v2beta1/src/main/java/com/google/cloud/dialogflow/v2beta1/AnswerRecordsProto.java +++ b/proto-google-cloud-dialogflow-v2beta1/src/main/java/com/google/cloud/dialogflow/v2beta1/AnswerRecordsProto.java @@ -128,46 +128,47 @@ public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { + "CORRECT\020\001\022\013\n\007CORRECT\020\002\"Y\n\022DocumentEffici" + "ency\022#\n\037DOCUMENT_EFFICIENCY_UNSPECIFIED\020" + "\000\022\017\n\013INEFFICIENT\020\001\022\r\n\tEFFICIENT\020\002\"&\n\026Get" - + "AnswerRecordRequest\022\014\n\004name\030\001 \001(\t\"~\n\030Lis" - + "tAnswerRecordsRequest\022;\n\006parent\030\001 \001(\tB+\372" - + "A(\022&dialogflow.googleapis.com/AnswerReco" - + "rd\022\021\n\tpage_size\030\003 \001(\005\022\022\n\npage_token\030\004 \001(" - + "\t\"{\n\031ListAnswerRecordsResponse\022E\n\016answer" - + "_records\030\001 \003(\0132-.google.cloud.dialogflow" - + ".v2beta1.AnswerRecord\022\027\n\017next_page_token" - + "\030\002 \001(\t\"\227\001\n\031UpdateAnswerRecordRequest\022I\n\r" - + "answer_record\030\001 \001(\0132-.google.cloud.dialo" - + "gflow.v2beta1.AnswerRecordB\003\340A\002\022/\n\013updat" - + "e_mask\030\002 \001(\0132\032.google.protobuf.FieldMask" - + "2\302\007\n\rAnswerRecords\022\352\001\n\017GetAnswerRecord\0227" - + ".google.cloud.dialogflow.v2beta1.GetAnsw" - + "erRecordRequest\032-.google.cloud.dialogflo" - + "w.v2beta1.AnswerRecord\"o\210\002\001\202\323\344\223\002f\022*/v2be" - + "ta1/{name=projects/*/answerRecords/*}Z8\022" - + "6/v2beta1/{name=projects/*/locations/*/a" - + "nswerRecords/*}\022\201\002\n\021ListAnswerRecords\0229." - + "google.cloud.dialogflow.v2beta1.ListAnsw" - + "erRecordsRequest\032:.google.cloud.dialogfl" - + "ow.v2beta1.ListAnswerRecordsResponse\"u\202\323" - + "\344\223\002f\022*/v2beta1/{parent=projects/*}/answe" - + "rRecordsZ8\0226/v2beta1/{parent=projects/*/" - + "locations/*}/answerRecords\332A\006parent\022\305\002\n\022" - + "UpdateAnswerRecord\022:.google.cloud.dialog" - + "flow.v2beta1.UpdateAnswerRecordRequest\032-" + + "AnswerRecordRequest\022\014\n\004name\030\001 \001(\t\"\225\001\n\030Li" + + "stAnswerRecordsRequest\022;\n\006parent\030\001 \001(\tB+" + + "\372A(\022&dialogflow.googleapis.com/AnswerRec" + + "ord\022\025\n\006filter\030\002 \001(\tB\005\030\001\340A\001\022\021\n\tpage_size\030" + + "\003 \001(\005\022\022\n\npage_token\030\004 \001(\t\"{\n\031ListAnswerR" + + "ecordsResponse\022E\n\016answer_records\030\001 \003(\0132-" + ".google.cloud.dialogflow.v2beta1.AnswerR" - + "ecord\"\303\001\202\323\344\223\002\240\00128/v2beta1/{answer_record" - + ".name=projects/*/answerRecords/*}:\ranswe" - + "r_recordZU2D/v2beta1/{answer_record.name" - + "=projects/*/locations/*/answerRecords/*}" - + ":\ranswer_record\332A\031answer_record,update_m" - + "ask\032x\312A\031dialogflow.googleapis.com\322AYhttp" - + "s://www.googleapis.com/auth/cloud-platfo" - + "rm,https://www.googleapis.com/auth/dialo" - + "gflowB\260\001\n#com.google.cloud.dialogflow.v2" - + "beta1B\022AnswerRecordsProtoP\001ZIgoogle.gola" - + "ng.org/genproto/googleapis/cloud/dialogf" - + "low/v2beta1;dialogflow\370\001\001\242\002\002DF\252\002\037Google." - + "Cloud.Dialogflow.V2beta1b\006proto3" + + "ecord\022\027\n\017next_page_token\030\002 \001(\t\"\227\001\n\031Updat" + + "eAnswerRecordRequest\022I\n\ranswer_record\030\001 " + + "\001(\0132-.google.cloud.dialogflow.v2beta1.An" + + "swerRecordB\003\340A\002\022/\n\013update_mask\030\002 \001(\0132\032.g" + + "oogle.protobuf.FieldMask2\302\007\n\rAnswerRecor" + + "ds\022\352\001\n\017GetAnswerRecord\0227.google.cloud.di" + + "alogflow.v2beta1.GetAnswerRecordRequest\032" + + "-.google.cloud.dialogflow.v2beta1.Answer" + + "Record\"o\210\002\001\202\323\344\223\002f\022*/v2beta1/{name=projec" + + "ts/*/answerRecords/*}Z8\0226/v2beta1/{name=" + + "projects/*/locations/*/answerRecords/*}\022" + + "\201\002\n\021ListAnswerRecords\0229.google.cloud.dia" + + "logflow.v2beta1.ListAnswerRecordsRequest" + + "\032:.google.cloud.dialogflow.v2beta1.ListA" + + "nswerRecordsResponse\"u\202\323\344\223\002f\022*/v2beta1/{" + + "parent=projects/*}/answerRecordsZ8\0226/v2b" + + "eta1/{parent=projects/*/locations/*}/ans" + + "werRecords\332A\006parent\022\305\002\n\022UpdateAnswerReco" + + "rd\022:.google.cloud.dialogflow.v2beta1.Upd" + + "ateAnswerRecordRequest\032-.google.cloud.di" + + "alogflow.v2beta1.AnswerRecord\"\303\001\202\323\344\223\002\240\0012" + + "8/v2beta1/{answer_record.name=projects/*" + + "/answerRecords/*}:\ranswer_recordZU2D/v2b" + + "eta1/{answer_record.name=projects/*/loca" + + "tions/*/answerRecords/*}:\ranswer_record\332" + + "A\031answer_record,update_mask\032x\312A\031dialogfl" + + "ow.googleapis.com\322AYhttps://www.googleap" + + "is.com/auth/cloud-platform,https://www.g" + + "oogleapis.com/auth/dialogflowB\260\001\n#com.go" + + "ogle.cloud.dialogflow.v2beta1B\022AnswerRec" + + "ordsProtoP\001ZIgoogle.golang.org/genproto/" + + "googleapis/cloud/dialogflow/v2beta1;dial" + + "ogflow\370\001\001\242\002\002DF\252\002\037Google.Cloud.Dialogflow" + + ".V2beta1b\006proto3" }; descriptor = com.google.protobuf.Descriptors.FileDescriptor.internalBuildGeneratedFileFrom( @@ -246,7 +247,7 @@ public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( internal_static_google_cloud_dialogflow_v2beta1_ListAnswerRecordsRequest_descriptor, new java.lang.String[] { - "Parent", "PageSize", "PageToken", + "Parent", "Filter", "PageSize", "PageToken", }); internal_static_google_cloud_dialogflow_v2beta1_ListAnswerRecordsResponse_descriptor = getDescriptor().getMessageTypes().get(6); diff --git a/proto-google-cloud-dialogflow-v2beta1/src/main/java/com/google/cloud/dialogflow/v2beta1/AudioInput.java b/proto-google-cloud-dialogflow-v2beta1/src/main/java/com/google/cloud/dialogflow/v2beta1/AudioInput.java new file mode 100644 index 000000000..fcda4be92 --- /dev/null +++ b/proto-google-cloud-dialogflow-v2beta1/src/main/java/com/google/cloud/dialogflow/v2beta1/AudioInput.java @@ -0,0 +1,842 @@ +/* + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/dialogflow/v2beta1/participant.proto + +package com.google.cloud.dialogflow.v2beta1; + +/** + * + * + *
+ * Represents the natural language speech audio to be processed.
+ * 
+ * + * Protobuf type {@code google.cloud.dialogflow.v2beta1.AudioInput} + */ +public final class AudioInput extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.cloud.dialogflow.v2beta1.AudioInput) + AudioInputOrBuilder { + private static final long serialVersionUID = 0L; + // Use AudioInput.newBuilder() to construct. + private AudioInput(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private AudioInput() { + audio_ = com.google.protobuf.ByteString.EMPTY; + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance(UnusedPrivateParameter unused) { + return new AudioInput(); + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet getUnknownFields() { + return this.unknownFields; + } + + private AudioInput( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + this(); + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + com.google.cloud.dialogflow.v2beta1.InputAudioConfig.Builder subBuilder = null; + if (config_ != null) { + subBuilder = config_.toBuilder(); + } + config_ = + input.readMessage( + com.google.cloud.dialogflow.v2beta1.InputAudioConfig.parser(), + extensionRegistry); + if (subBuilder != null) { + subBuilder.mergeFrom(config_); + config_ = subBuilder.buildPartial(); + } + + break; + } + case 18: + { + audio_ = input.readBytes(); + break; + } + default: + { + if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { + done = true; + } + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e).setUnfinishedMessage(this); + } finally { + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.dialogflow.v2beta1.ParticipantProto + .internal_static_google_cloud_dialogflow_v2beta1_AudioInput_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.dialogflow.v2beta1.ParticipantProto + .internal_static_google_cloud_dialogflow_v2beta1_AudioInput_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.dialogflow.v2beta1.AudioInput.class, + com.google.cloud.dialogflow.v2beta1.AudioInput.Builder.class); + } + + public static final int CONFIG_FIELD_NUMBER = 1; + private com.google.cloud.dialogflow.v2beta1.InputAudioConfig config_; + /** + * + * + *
+   * Required. Instructs the speech recognizer how to process the speech audio.
+   * 
+ * + * .google.cloud.dialogflow.v2beta1.InputAudioConfig config = 1; + * + * @return Whether the config field is set. + */ + @java.lang.Override + public boolean hasConfig() { + return config_ != null; + } + /** + * + * + *
+   * Required. Instructs the speech recognizer how to process the speech audio.
+   * 
+ * + * .google.cloud.dialogflow.v2beta1.InputAudioConfig config = 1; + * + * @return The config. + */ + @java.lang.Override + public com.google.cloud.dialogflow.v2beta1.InputAudioConfig getConfig() { + return config_ == null + ? com.google.cloud.dialogflow.v2beta1.InputAudioConfig.getDefaultInstance() + : config_; + } + /** + * + * + *
+   * Required. Instructs the speech recognizer how to process the speech audio.
+   * 
+ * + * .google.cloud.dialogflow.v2beta1.InputAudioConfig config = 1; + */ + @java.lang.Override + public com.google.cloud.dialogflow.v2beta1.InputAudioConfigOrBuilder getConfigOrBuilder() { + return getConfig(); + } + + public static final int AUDIO_FIELD_NUMBER = 2; + private com.google.protobuf.ByteString audio_; + /** + * + * + *
+   * Required. The natural language speech audio to be processed.
+   * A single request can contain up to 1 minute of speech audio data.
+   * The transcribed text cannot contain more than 256 bytes for virtual agent
+   * interactions.
+   * 
+ * + * bytes audio = 2; + * + * @return The audio. + */ + @java.lang.Override + public com.google.protobuf.ByteString getAudio() { + return audio_; + } + + private byte memoizedIsInitialized = -1; + + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { + if (config_ != null) { + output.writeMessage(1, getConfig()); + } + if (!audio_.isEmpty()) { + output.writeBytes(2, audio_); + } + unknownFields.writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (config_ != null) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(1, getConfig()); + } + if (!audio_.isEmpty()) { + size += com.google.protobuf.CodedOutputStream.computeBytesSize(2, audio_); + } + size += unknownFields.getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.google.cloud.dialogflow.v2beta1.AudioInput)) { + return super.equals(obj); + } + com.google.cloud.dialogflow.v2beta1.AudioInput other = + (com.google.cloud.dialogflow.v2beta1.AudioInput) obj; + + if (hasConfig() != other.hasConfig()) return false; + if (hasConfig()) { + if (!getConfig().equals(other.getConfig())) return false; + } + if (!getAudio().equals(other.getAudio())) return false; + if (!unknownFields.equals(other.unknownFields)) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + if (hasConfig()) { + hash = (37 * hash) + CONFIG_FIELD_NUMBER; + hash = (53 * hash) + getConfig().hashCode(); + } + hash = (37 * hash) + AUDIO_FIELD_NUMBER; + hash = (53 * hash) + getAudio().hashCode(); + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.cloud.dialogflow.v2beta1.AudioInput parseFrom(java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.dialogflow.v2beta1.AudioInput parseFrom( + java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.dialogflow.v2beta1.AudioInput parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.dialogflow.v2beta1.AudioInput parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.dialogflow.v2beta1.AudioInput parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.dialogflow.v2beta1.AudioInput parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.dialogflow.v2beta1.AudioInput parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.dialogflow.v2beta1.AudioInput parseFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.dialogflow.v2beta1.AudioInput parseDelimitedFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.cloud.dialogflow.v2beta1.AudioInput parseDelimitedFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.dialogflow.v2beta1.AudioInput parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.dialogflow.v2beta1.AudioInput parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { + return newBuilder(); + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(com.google.cloud.dialogflow.v2beta1.AudioInput prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * + * + *
+   * Represents the natural language speech audio to be processed.
+   * 
+ * + * Protobuf type {@code google.cloud.dialogflow.v2beta1.AudioInput} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.cloud.dialogflow.v2beta1.AudioInput) + com.google.cloud.dialogflow.v2beta1.AudioInputOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.dialogflow.v2beta1.ParticipantProto + .internal_static_google_cloud_dialogflow_v2beta1_AudioInput_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.dialogflow.v2beta1.ParticipantProto + .internal_static_google_cloud_dialogflow_v2beta1_AudioInput_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.dialogflow.v2beta1.AudioInput.class, + com.google.cloud.dialogflow.v2beta1.AudioInput.Builder.class); + } + + // Construct using com.google.cloud.dialogflow.v2beta1.AudioInput.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) {} + } + + @java.lang.Override + public Builder clear() { + super.clear(); + if (configBuilder_ == null) { + config_ = null; + } else { + config_ = null; + configBuilder_ = null; + } + audio_ = com.google.protobuf.ByteString.EMPTY; + + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.cloud.dialogflow.v2beta1.ParticipantProto + .internal_static_google_cloud_dialogflow_v2beta1_AudioInput_descriptor; + } + + @java.lang.Override + public com.google.cloud.dialogflow.v2beta1.AudioInput getDefaultInstanceForType() { + return com.google.cloud.dialogflow.v2beta1.AudioInput.getDefaultInstance(); + } + + @java.lang.Override + public com.google.cloud.dialogflow.v2beta1.AudioInput build() { + com.google.cloud.dialogflow.v2beta1.AudioInput result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.cloud.dialogflow.v2beta1.AudioInput buildPartial() { + com.google.cloud.dialogflow.v2beta1.AudioInput result = + new com.google.cloud.dialogflow.v2beta1.AudioInput(this); + if (configBuilder_ == null) { + result.config_ = config_; + } else { + result.config_ = configBuilder_.build(); + } + result.audio_ = audio_; + onBuilt(); + return result; + } + + @java.lang.Override + public Builder clone() { + return super.clone(); + } + + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.setField(field, value); + } + + @java.lang.Override + public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { + return super.clearField(field); + } + + @java.lang.Override + public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return super.clearOneof(oneof); + } + + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { + return super.setRepeatedField(field, index, value); + } + + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.addRepeatedField(field, value); + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.google.cloud.dialogflow.v2beta1.AudioInput) { + return mergeFrom((com.google.cloud.dialogflow.v2beta1.AudioInput) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.cloud.dialogflow.v2beta1.AudioInput other) { + if (other == com.google.cloud.dialogflow.v2beta1.AudioInput.getDefaultInstance()) return this; + if (other.hasConfig()) { + mergeConfig(other.getConfig()); + } + if (other.getAudio() != com.google.protobuf.ByteString.EMPTY) { + setAudio(other.getAudio()); + } + this.mergeUnknownFields(other.unknownFields); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.google.cloud.dialogflow.v2beta1.AudioInput parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = (com.google.cloud.dialogflow.v2beta1.AudioInput) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + private com.google.cloud.dialogflow.v2beta1.InputAudioConfig config_; + private com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.dialogflow.v2beta1.InputAudioConfig, + com.google.cloud.dialogflow.v2beta1.InputAudioConfig.Builder, + com.google.cloud.dialogflow.v2beta1.InputAudioConfigOrBuilder> + configBuilder_; + /** + * + * + *
+     * Required. Instructs the speech recognizer how to process the speech audio.
+     * 
+ * + * .google.cloud.dialogflow.v2beta1.InputAudioConfig config = 1; + * + * @return Whether the config field is set. + */ + public boolean hasConfig() { + return configBuilder_ != null || config_ != null; + } + /** + * + * + *
+     * Required. Instructs the speech recognizer how to process the speech audio.
+     * 
+ * + * .google.cloud.dialogflow.v2beta1.InputAudioConfig config = 1; + * + * @return The config. + */ + public com.google.cloud.dialogflow.v2beta1.InputAudioConfig getConfig() { + if (configBuilder_ == null) { + return config_ == null + ? com.google.cloud.dialogflow.v2beta1.InputAudioConfig.getDefaultInstance() + : config_; + } else { + return configBuilder_.getMessage(); + } + } + /** + * + * + *
+     * Required. Instructs the speech recognizer how to process the speech audio.
+     * 
+ * + * .google.cloud.dialogflow.v2beta1.InputAudioConfig config = 1; + */ + public Builder setConfig(com.google.cloud.dialogflow.v2beta1.InputAudioConfig value) { + if (configBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + config_ = value; + onChanged(); + } else { + configBuilder_.setMessage(value); + } + + return this; + } + /** + * + * + *
+     * Required. Instructs the speech recognizer how to process the speech audio.
+     * 
+ * + * .google.cloud.dialogflow.v2beta1.InputAudioConfig config = 1; + */ + public Builder setConfig( + com.google.cloud.dialogflow.v2beta1.InputAudioConfig.Builder builderForValue) { + if (configBuilder_ == null) { + config_ = builderForValue.build(); + onChanged(); + } else { + configBuilder_.setMessage(builderForValue.build()); + } + + return this; + } + /** + * + * + *
+     * Required. Instructs the speech recognizer how to process the speech audio.
+     * 
+ * + * .google.cloud.dialogflow.v2beta1.InputAudioConfig config = 1; + */ + public Builder mergeConfig(com.google.cloud.dialogflow.v2beta1.InputAudioConfig value) { + if (configBuilder_ == null) { + if (config_ != null) { + config_ = + com.google.cloud.dialogflow.v2beta1.InputAudioConfig.newBuilder(config_) + .mergeFrom(value) + .buildPartial(); + } else { + config_ = value; + } + onChanged(); + } else { + configBuilder_.mergeFrom(value); + } + + return this; + } + /** + * + * + *
+     * Required. Instructs the speech recognizer how to process the speech audio.
+     * 
+ * + * .google.cloud.dialogflow.v2beta1.InputAudioConfig config = 1; + */ + public Builder clearConfig() { + if (configBuilder_ == null) { + config_ = null; + onChanged(); + } else { + config_ = null; + configBuilder_ = null; + } + + return this; + } + /** + * + * + *
+     * Required. Instructs the speech recognizer how to process the speech audio.
+     * 
+ * + * .google.cloud.dialogflow.v2beta1.InputAudioConfig config = 1; + */ + public com.google.cloud.dialogflow.v2beta1.InputAudioConfig.Builder getConfigBuilder() { + + onChanged(); + return getConfigFieldBuilder().getBuilder(); + } + /** + * + * + *
+     * Required. Instructs the speech recognizer how to process the speech audio.
+     * 
+ * + * .google.cloud.dialogflow.v2beta1.InputAudioConfig config = 1; + */ + public com.google.cloud.dialogflow.v2beta1.InputAudioConfigOrBuilder getConfigOrBuilder() { + if (configBuilder_ != null) { + return configBuilder_.getMessageOrBuilder(); + } else { + return config_ == null + ? com.google.cloud.dialogflow.v2beta1.InputAudioConfig.getDefaultInstance() + : config_; + } + } + /** + * + * + *
+     * Required. Instructs the speech recognizer how to process the speech audio.
+     * 
+ * + * .google.cloud.dialogflow.v2beta1.InputAudioConfig config = 1; + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.dialogflow.v2beta1.InputAudioConfig, + com.google.cloud.dialogflow.v2beta1.InputAudioConfig.Builder, + com.google.cloud.dialogflow.v2beta1.InputAudioConfigOrBuilder> + getConfigFieldBuilder() { + if (configBuilder_ == null) { + configBuilder_ = + new com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.dialogflow.v2beta1.InputAudioConfig, + com.google.cloud.dialogflow.v2beta1.InputAudioConfig.Builder, + com.google.cloud.dialogflow.v2beta1.InputAudioConfigOrBuilder>( + getConfig(), getParentForChildren(), isClean()); + config_ = null; + } + return configBuilder_; + } + + private com.google.protobuf.ByteString audio_ = com.google.protobuf.ByteString.EMPTY; + /** + * + * + *
+     * Required. The natural language speech audio to be processed.
+     * A single request can contain up to 1 minute of speech audio data.
+     * The transcribed text cannot contain more than 256 bytes for virtual agent
+     * interactions.
+     * 
+ * + * bytes audio = 2; + * + * @return The audio. + */ + @java.lang.Override + public com.google.protobuf.ByteString getAudio() { + return audio_; + } + /** + * + * + *
+     * Required. The natural language speech audio to be processed.
+     * A single request can contain up to 1 minute of speech audio data.
+     * The transcribed text cannot contain more than 256 bytes for virtual agent
+     * interactions.
+     * 
+ * + * bytes audio = 2; + * + * @param value The audio to set. + * @return This builder for chaining. + */ + public Builder setAudio(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + + audio_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * Required. The natural language speech audio to be processed.
+     * A single request can contain up to 1 minute of speech audio data.
+     * The transcribed text cannot contain more than 256 bytes for virtual agent
+     * interactions.
+     * 
+ * + * bytes audio = 2; + * + * @return This builder for chaining. + */ + public Builder clearAudio() { + + audio_ = getDefaultInstance().getAudio(); + onChanged(); + return this; + } + + @java.lang.Override + public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + // @@protoc_insertion_point(builder_scope:google.cloud.dialogflow.v2beta1.AudioInput) + } + + // @@protoc_insertion_point(class_scope:google.cloud.dialogflow.v2beta1.AudioInput) + private static final com.google.cloud.dialogflow.v2beta1.AudioInput DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.cloud.dialogflow.v2beta1.AudioInput(); + } + + public static com.google.cloud.dialogflow.v2beta1.AudioInput getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public AudioInput parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new AudioInput(input, extensionRegistry); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.google.cloud.dialogflow.v2beta1.AudioInput getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/proto-google-cloud-dialogflow-v2beta1/src/main/java/com/google/cloud/dialogflow/v2beta1/AudioInputOrBuilder.java b/proto-google-cloud-dialogflow-v2beta1/src/main/java/com/google/cloud/dialogflow/v2beta1/AudioInputOrBuilder.java new file mode 100644 index 000000000..7f1fd862c --- /dev/null +++ b/proto-google-cloud-dialogflow-v2beta1/src/main/java/com/google/cloud/dialogflow/v2beta1/AudioInputOrBuilder.java @@ -0,0 +1,76 @@ +/* + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/dialogflow/v2beta1/participant.proto + +package com.google.cloud.dialogflow.v2beta1; + +public interface AudioInputOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.cloud.dialogflow.v2beta1.AudioInput) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+   * Required. Instructs the speech recognizer how to process the speech audio.
+   * 
+ * + * .google.cloud.dialogflow.v2beta1.InputAudioConfig config = 1; + * + * @return Whether the config field is set. + */ + boolean hasConfig(); + /** + * + * + *
+   * Required. Instructs the speech recognizer how to process the speech audio.
+   * 
+ * + * .google.cloud.dialogflow.v2beta1.InputAudioConfig config = 1; + * + * @return The config. + */ + com.google.cloud.dialogflow.v2beta1.InputAudioConfig getConfig(); + /** + * + * + *
+   * Required. Instructs the speech recognizer how to process the speech audio.
+   * 
+ * + * .google.cloud.dialogflow.v2beta1.InputAudioConfig config = 1; + */ + com.google.cloud.dialogflow.v2beta1.InputAudioConfigOrBuilder getConfigOrBuilder(); + + /** + * + * + *
+   * Required. The natural language speech audio to be processed.
+   * A single request can contain up to 1 minute of speech audio data.
+   * The transcribed text cannot contain more than 256 bytes for virtual agent
+   * interactions.
+   * 
+ * + * bytes audio = 2; + * + * @return The audio. + */ + com.google.protobuf.ByteString getAudio(); +} diff --git a/proto-google-cloud-dialogflow-v2beta1/src/main/java/com/google/cloud/dialogflow/v2beta1/AutomatedAgentReply.java b/proto-google-cloud-dialogflow-v2beta1/src/main/java/com/google/cloud/dialogflow/v2beta1/AutomatedAgentReply.java index 41e308b66..1a2d5ff0c 100644 --- a/proto-google-cloud-dialogflow-v2beta1/src/main/java/com/google/cloud/dialogflow/v2beta1/AutomatedAgentReply.java +++ b/proto-google-cloud-dialogflow-v2beta1/src/main/java/com/google/cloud/dialogflow/v2beta1/AutomatedAgentReply.java @@ -821,7 +821,7 @@ public com.google.protobuf.StructOrBuilder getParametersOrBuilder() { * .google.protobuf.Struct cx_session_parameters = 6 [deprecated = true]; * * @deprecated google.cloud.dialogflow.v2beta1.AutomatedAgentReply.cx_session_parameters is - * deprecated. See google/cloud/dialogflow/v2beta1/participant.proto;l=474 + * deprecated. See google/cloud/dialogflow/v2beta1/participant.proto;l=487 * @return Whether the cxSessionParameters field is set. */ @java.lang.Override @@ -841,7 +841,7 @@ public boolean hasCxSessionParameters() { * .google.protobuf.Struct cx_session_parameters = 6 [deprecated = true]; * * @deprecated google.cloud.dialogflow.v2beta1.AutomatedAgentReply.cx_session_parameters is - * deprecated. See google/cloud/dialogflow/v2beta1/participant.proto;l=474 + * deprecated. See google/cloud/dialogflow/v2beta1/participant.proto;l=487 * @return The cxSessionParameters. */ @java.lang.Override @@ -2682,7 +2682,7 @@ public com.google.protobuf.StructOrBuilder getParametersOrBuilder() { * .google.protobuf.Struct cx_session_parameters = 6 [deprecated = true]; * * @deprecated google.cloud.dialogflow.v2beta1.AutomatedAgentReply.cx_session_parameters is - * deprecated. See google/cloud/dialogflow/v2beta1/participant.proto;l=474 + * deprecated. See google/cloud/dialogflow/v2beta1/participant.proto;l=487 * @return Whether the cxSessionParameters field is set. */ @java.lang.Deprecated @@ -2701,7 +2701,7 @@ public boolean hasCxSessionParameters() { * .google.protobuf.Struct cx_session_parameters = 6 [deprecated = true]; * * @deprecated google.cloud.dialogflow.v2beta1.AutomatedAgentReply.cx_session_parameters is - * deprecated. See google/cloud/dialogflow/v2beta1/participant.proto;l=474 + * deprecated. See google/cloud/dialogflow/v2beta1/participant.proto;l=487 * @return The cxSessionParameters. */ @java.lang.Deprecated diff --git a/proto-google-cloud-dialogflow-v2beta1/src/main/java/com/google/cloud/dialogflow/v2beta1/AutomatedAgentReplyOrBuilder.java b/proto-google-cloud-dialogflow-v2beta1/src/main/java/com/google/cloud/dialogflow/v2beta1/AutomatedAgentReplyOrBuilder.java index 23256f704..96929c018 100644 --- a/proto-google-cloud-dialogflow-v2beta1/src/main/java/com/google/cloud/dialogflow/v2beta1/AutomatedAgentReplyOrBuilder.java +++ b/proto-google-cloud-dialogflow-v2beta1/src/main/java/com/google/cloud/dialogflow/v2beta1/AutomatedAgentReplyOrBuilder.java @@ -263,7 +263,7 @@ com.google.cloud.dialogflow.v2beta1.ResponseMessageOrBuilder getResponseMessages * .google.protobuf.Struct cx_session_parameters = 6 [deprecated = true]; * * @deprecated google.cloud.dialogflow.v2beta1.AutomatedAgentReply.cx_session_parameters is - * deprecated. See google/cloud/dialogflow/v2beta1/participant.proto;l=474 + * deprecated. See google/cloud/dialogflow/v2beta1/participant.proto;l=487 * @return Whether the cxSessionParameters field is set. */ @java.lang.Deprecated @@ -280,7 +280,7 @@ com.google.cloud.dialogflow.v2beta1.ResponseMessageOrBuilder getResponseMessages * .google.protobuf.Struct cx_session_parameters = 6 [deprecated = true]; * * @deprecated google.cloud.dialogflow.v2beta1.AutomatedAgentReply.cx_session_parameters is - * deprecated. See google/cloud/dialogflow/v2beta1/participant.proto;l=474 + * deprecated. See google/cloud/dialogflow/v2beta1/participant.proto;l=487 * @return The cxSessionParameters. */ @java.lang.Deprecated diff --git a/proto-google-cloud-dialogflow-v2beta1/src/main/java/com/google/cloud/dialogflow/v2beta1/Document.java b/proto-google-cloud-dialogflow-v2beta1/src/main/java/com/google/cloud/dialogflow/v2beta1/Document.java index f9354e5aa..4131a48c8 100644 --- a/proto-google-cloud-dialogflow-v2beta1/src/main/java/com/google/cloud/dialogflow/v2beta1/Document.java +++ b/proto-google-cloud-dialogflow-v2beta1/src/main/java/com/google/cloud/dialogflow/v2beta1/Document.java @@ -3693,8 +3693,8 @@ public int getKnowledgeTypesValue(int index) { * repeated .google.cloud.dialogflow.v2beta1.Document.KnowledgeType knowledge_types = 4 [(.google.api.field_behavior) = REQUIRED]; * * - * @param index The index of the value to return. - * @return The enum numeric value on the wire of knowledgeTypes at the given index. + * @param index The index to set the value at. + * @param value The enum numeric value on the wire for knowledgeTypes to set. * @return This builder for chaining. */ public Builder setKnowledgeTypesValue(int index, int value) { diff --git a/proto-google-cloud-dialogflow-v2beta1/src/main/java/com/google/cloud/dialogflow/v2beta1/HumanAgentAssistantConfig.java b/proto-google-cloud-dialogflow-v2beta1/src/main/java/com/google/cloud/dialogflow/v2beta1/HumanAgentAssistantConfig.java index f516b3be0..e53a0b7d7 100644 --- a/proto-google-cloud-dialogflow-v2beta1/src/main/java/com/google/cloud/dialogflow/v2beta1/HumanAgentAssistantConfig.java +++ b/proto-google-cloud-dialogflow-v2beta1/src/main/java/com/google/cloud/dialogflow/v2beta1/HumanAgentAssistantConfig.java @@ -10869,7 +10869,8 @@ public interface ConversationModelConfigOrBuilder * *
    * Custom conversation models used in agent assist feature.
-   * Supported feature: ARTICLE_SUGGESTION, SMART_COMPOSE, SMART_REPLY.
+   * Supported feature: ARTICLE_SUGGESTION, SMART_COMPOSE, SMART_REPLY,
+   * CONVERSATION_SUMMARIZATION.
    * 
* * Protobuf type {@code @@ -11202,7 +11203,8 @@ protected Builder newBuilderForType( * *
      * Custom conversation models used in agent assist feature.
-     * Supported feature: ARTICLE_SUGGESTION, SMART_COMPOSE, SMART_REPLY.
+     * Supported feature: ARTICLE_SUGGESTION, SMART_COMPOSE, SMART_REPLY,
+     * CONVERSATION_SUMMARIZATION.
      * 
* * Protobuf type {@code diff --git a/proto-google-cloud-dialogflow-v2beta1/src/main/java/com/google/cloud/dialogflow/v2beta1/ImportDocumentTemplate.java b/proto-google-cloud-dialogflow-v2beta1/src/main/java/com/google/cloud/dialogflow/v2beta1/ImportDocumentTemplate.java index 9aa1a0947..95dff5d73 100644 --- a/proto-google-cloud-dialogflow-v2beta1/src/main/java/com/google/cloud/dialogflow/v2beta1/ImportDocumentTemplate.java +++ b/proto-google-cloud-dialogflow-v2beta1/src/main/java/com/google/cloud/dialogflow/v2beta1/ImportDocumentTemplate.java @@ -1147,8 +1147,8 @@ public int getKnowledgeTypesValue(int index) { * repeated .google.cloud.dialogflow.v2beta1.Document.KnowledgeType knowledge_types = 2 [(.google.api.field_behavior) = REQUIRED]; * * - * @param index The index of the value to return. - * @return The enum numeric value on the wire of knowledgeTypes at the given index. + * @param index The index to set the value at. + * @param value The enum numeric value on the wire for knowledgeTypes to set. * @return This builder for chaining. */ public Builder setKnowledgeTypesValue(int index, int value) { diff --git a/proto-google-cloud-dialogflow-v2beta1/src/main/java/com/google/cloud/dialogflow/v2beta1/Intent.java b/proto-google-cloud-dialogflow-v2beta1/src/main/java/com/google/cloud/dialogflow/v2beta1/Intent.java index 91a0b377d..6cf1cd159 100644 --- a/proto-google-cloud-dialogflow-v2beta1/src/main/java/com/google/cloud/dialogflow/v2beta1/Intent.java +++ b/proto-google-cloud-dialogflow-v2beta1/src/main/java/com/google/cloud/dialogflow/v2beta1/Intent.java @@ -72127,8 +72127,8 @@ public int getDefaultResponsePlatformsValue(int index) { * repeated .google.cloud.dialogflow.v2beta1.Intent.Message.Platform default_response_platforms = 15 [(.google.api.field_behavior) = OPTIONAL]; * * - * @param index The index of the value to return. - * @return The enum numeric value on the wire of defaultResponsePlatforms at the given index. + * @param index The index to set the value at. + * @param value The enum numeric value on the wire for defaultResponsePlatforms to set. * @return This builder for chaining. */ public Builder setDefaultResponsePlatformsValue(int index, int value) { diff --git a/proto-google-cloud-dialogflow-v2beta1/src/main/java/com/google/cloud/dialogflow/v2beta1/ListAnswerRecordsRequest.java b/proto-google-cloud-dialogflow-v2beta1/src/main/java/com/google/cloud/dialogflow/v2beta1/ListAnswerRecordsRequest.java index a57739491..3edd80170 100644 --- a/proto-google-cloud-dialogflow-v2beta1/src/main/java/com/google/cloud/dialogflow/v2beta1/ListAnswerRecordsRequest.java +++ b/proto-google-cloud-dialogflow-v2beta1/src/main/java/com/google/cloud/dialogflow/v2beta1/ListAnswerRecordsRequest.java @@ -39,6 +39,7 @@ private ListAnswerRecordsRequest(com.google.protobuf.GeneratedMessageV3.Builder< private ListAnswerRecordsRequest() { parent_ = ""; + filter_ = ""; pageToken_ = ""; } @@ -78,6 +79,13 @@ private ListAnswerRecordsRequest( parent_ = s; break; } + case 18: + { + java.lang.String s = input.readStringRequireUtf8(); + + filter_ = s; + break; + } case 24: { pageSize_ = input.readInt32(); @@ -179,6 +187,65 @@ public com.google.protobuf.ByteString getParentBytes() { } } + public static final int FILTER_FIELD_NUMBER = 2; + private volatile java.lang.Object filter_; + /** + * + * + *
+   * Optional. Filters to restrict results to specific answer records.
+   * For more information about filtering, see
+   * [API Filtering](https://aip.dev/160).
+   * 
+ * + * string filter = 2 [deprecated = true, (.google.api.field_behavior) = OPTIONAL]; + * + * @deprecated google.cloud.dialogflow.v2beta1.ListAnswerRecordsRequest.filter is deprecated. See + * google/cloud/dialogflow/v2beta1/answer_record.proto;l=286 + * @return The filter. + */ + @java.lang.Override + @java.lang.Deprecated + public java.lang.String getFilter() { + java.lang.Object ref = filter_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + filter_ = s; + return s; + } + } + /** + * + * + *
+   * Optional. Filters to restrict results to specific answer records.
+   * For more information about filtering, see
+   * [API Filtering](https://aip.dev/160).
+   * 
+ * + * string filter = 2 [deprecated = true, (.google.api.field_behavior) = OPTIONAL]; + * + * @deprecated google.cloud.dialogflow.v2beta1.ListAnswerRecordsRequest.filter is deprecated. See + * google/cloud/dialogflow/v2beta1/answer_record.proto;l=286 + * @return The bytes for filter. + */ + @java.lang.Override + @java.lang.Deprecated + public com.google.protobuf.ByteString getFilterBytes() { + java.lang.Object ref = filter_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + filter_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + public static final int PAGE_SIZE_FIELD_NUMBER = 3; private int pageSize_; /** @@ -271,6 +338,9 @@ public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(parent_)) { com.google.protobuf.GeneratedMessageV3.writeString(output, 1, parent_); } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(filter_)) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 2, filter_); + } if (pageSize_ != 0) { output.writeInt32(3, pageSize_); } @@ -289,6 +359,9 @@ public int getSerializedSize() { if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(parent_)) { size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, parent_); } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(filter_)) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(2, filter_); + } if (pageSize_ != 0) { size += com.google.protobuf.CodedOutputStream.computeInt32Size(3, pageSize_); } @@ -312,6 +385,7 @@ public boolean equals(final java.lang.Object obj) { (com.google.cloud.dialogflow.v2beta1.ListAnswerRecordsRequest) obj; if (!getParent().equals(other.getParent())) return false; + if (!getFilter().equals(other.getFilter())) return false; if (getPageSize() != other.getPageSize()) return false; if (!getPageToken().equals(other.getPageToken())) return false; if (!unknownFields.equals(other.unknownFields)) return false; @@ -327,6 +401,8 @@ public int hashCode() { hash = (19 * hash) + getDescriptor().hashCode(); hash = (37 * hash) + PARENT_FIELD_NUMBER; hash = (53 * hash) + getParent().hashCode(); + hash = (37 * hash) + FILTER_FIELD_NUMBER; + hash = (53 * hash) + getFilter().hashCode(); hash = (37 * hash) + PAGE_SIZE_FIELD_NUMBER; hash = (53 * hash) + getPageSize(); hash = (37 * hash) + PAGE_TOKEN_FIELD_NUMBER; @@ -479,6 +555,8 @@ public Builder clear() { super.clear(); parent_ = ""; + filter_ = ""; + pageSize_ = 0; pageToken_ = ""; @@ -512,6 +590,7 @@ public com.google.cloud.dialogflow.v2beta1.ListAnswerRecordsRequest buildPartial com.google.cloud.dialogflow.v2beta1.ListAnswerRecordsRequest result = new com.google.cloud.dialogflow.v2beta1.ListAnswerRecordsRequest(this); result.parent_ = parent_; + result.filter_ = filter_; result.pageSize_ = pageSize_; result.pageToken_ = pageToken_; onBuilt(); @@ -569,6 +648,10 @@ public Builder mergeFrom(com.google.cloud.dialogflow.v2beta1.ListAnswerRecordsRe parent_ = other.parent_; onChanged(); } + if (!other.getFilter().isEmpty()) { + filter_ = other.filter_; + onChanged(); + } if (other.getPageSize() != 0) { setPageSize(other.getPageSize()); } @@ -722,6 +805,137 @@ public Builder setParentBytes(com.google.protobuf.ByteString value) { return this; } + private java.lang.Object filter_ = ""; + /** + * + * + *
+     * Optional. Filters to restrict results to specific answer records.
+     * For more information about filtering, see
+     * [API Filtering](https://aip.dev/160).
+     * 
+ * + * string filter = 2 [deprecated = true, (.google.api.field_behavior) = OPTIONAL]; + * + * @deprecated google.cloud.dialogflow.v2beta1.ListAnswerRecordsRequest.filter is deprecated. + * See google/cloud/dialogflow/v2beta1/answer_record.proto;l=286 + * @return The filter. + */ + @java.lang.Deprecated + public java.lang.String getFilter() { + java.lang.Object ref = filter_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + filter_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * Optional. Filters to restrict results to specific answer records.
+     * For more information about filtering, see
+     * [API Filtering](https://aip.dev/160).
+     * 
+ * + * string filter = 2 [deprecated = true, (.google.api.field_behavior) = OPTIONAL]; + * + * @deprecated google.cloud.dialogflow.v2beta1.ListAnswerRecordsRequest.filter is deprecated. + * See google/cloud/dialogflow/v2beta1/answer_record.proto;l=286 + * @return The bytes for filter. + */ + @java.lang.Deprecated + public com.google.protobuf.ByteString getFilterBytes() { + java.lang.Object ref = filter_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + filter_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * Optional. Filters to restrict results to specific answer records.
+     * For more information about filtering, see
+     * [API Filtering](https://aip.dev/160).
+     * 
+ * + * string filter = 2 [deprecated = true, (.google.api.field_behavior) = OPTIONAL]; + * + * @deprecated google.cloud.dialogflow.v2beta1.ListAnswerRecordsRequest.filter is deprecated. + * See google/cloud/dialogflow/v2beta1/answer_record.proto;l=286 + * @param value The filter to set. + * @return This builder for chaining. + */ + @java.lang.Deprecated + public Builder setFilter(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + filter_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * Optional. Filters to restrict results to specific answer records.
+     * For more information about filtering, see
+     * [API Filtering](https://aip.dev/160).
+     * 
+ * + * string filter = 2 [deprecated = true, (.google.api.field_behavior) = OPTIONAL]; + * + * @deprecated google.cloud.dialogflow.v2beta1.ListAnswerRecordsRequest.filter is deprecated. + * See google/cloud/dialogflow/v2beta1/answer_record.proto;l=286 + * @return This builder for chaining. + */ + @java.lang.Deprecated + public Builder clearFilter() { + + filter_ = getDefaultInstance().getFilter(); + onChanged(); + return this; + } + /** + * + * + *
+     * Optional. Filters to restrict results to specific answer records.
+     * For more information about filtering, see
+     * [API Filtering](https://aip.dev/160).
+     * 
+ * + * string filter = 2 [deprecated = true, (.google.api.field_behavior) = OPTIONAL]; + * + * @deprecated google.cloud.dialogflow.v2beta1.ListAnswerRecordsRequest.filter is deprecated. + * See google/cloud/dialogflow/v2beta1/answer_record.proto;l=286 + * @param value The bytes for filter to set. + * @return This builder for chaining. + */ + @java.lang.Deprecated + public Builder setFilterBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + filter_ = value; + onChanged(); + return this; + } + private int pageSize_; /** * diff --git a/proto-google-cloud-dialogflow-v2beta1/src/main/java/com/google/cloud/dialogflow/v2beta1/ListAnswerRecordsRequestOrBuilder.java b/proto-google-cloud-dialogflow-v2beta1/src/main/java/com/google/cloud/dialogflow/v2beta1/ListAnswerRecordsRequestOrBuilder.java index bdc9fbc92..18ced9ce3 100644 --- a/proto-google-cloud-dialogflow-v2beta1/src/main/java/com/google/cloud/dialogflow/v2beta1/ListAnswerRecordsRequestOrBuilder.java +++ b/proto-google-cloud-dialogflow-v2beta1/src/main/java/com/google/cloud/dialogflow/v2beta1/ListAnswerRecordsRequestOrBuilder.java @@ -52,6 +52,41 @@ public interface ListAnswerRecordsRequestOrBuilder */ com.google.protobuf.ByteString getParentBytes(); + /** + * + * + *
+   * Optional. Filters to restrict results to specific answer records.
+   * For more information about filtering, see
+   * [API Filtering](https://aip.dev/160).
+   * 
+ * + * string filter = 2 [deprecated = true, (.google.api.field_behavior) = OPTIONAL]; + * + * @deprecated google.cloud.dialogflow.v2beta1.ListAnswerRecordsRequest.filter is deprecated. See + * google/cloud/dialogflow/v2beta1/answer_record.proto;l=286 + * @return The filter. + */ + @java.lang.Deprecated + java.lang.String getFilter(); + /** + * + * + *
+   * Optional. Filters to restrict results to specific answer records.
+   * For more information about filtering, see
+   * [API Filtering](https://aip.dev/160).
+   * 
+ * + * string filter = 2 [deprecated = true, (.google.api.field_behavior) = OPTIONAL]; + * + * @deprecated google.cloud.dialogflow.v2beta1.ListAnswerRecordsRequest.filter is deprecated. See + * google/cloud/dialogflow/v2beta1/answer_record.proto;l=286 + * @return The bytes for filter. + */ + @java.lang.Deprecated + com.google.protobuf.ByteString getFilterBytes(); + /** * * diff --git a/proto-google-cloud-dialogflow-v2beta1/src/main/java/com/google/cloud/dialogflow/v2beta1/ParticipantProto.java b/proto-google-cloud-dialogflow-v2beta1/src/main/java/com/google/cloud/dialogflow/v2beta1/ParticipantProto.java index 449db6c3c..496cb8a14 100644 --- a/proto-google-cloud-dialogflow-v2beta1/src/main/java/com/google/cloud/dialogflow/v2beta1/ParticipantProto.java +++ b/proto-google-cloud-dialogflow-v2beta1/src/main/java/com/google/cloud/dialogflow/v2beta1/ParticipantProto.java @@ -59,6 +59,10 @@ public static void registerAllExtensions(com.google.protobuf.ExtensionRegistry r internal_static_google_cloud_dialogflow_v2beta1_UpdateParticipantRequest_descriptor; static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internal_static_google_cloud_dialogflow_v2beta1_UpdateParticipantRequest_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_cloud_dialogflow_v2beta1_AudioInput_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_cloud_dialogflow_v2beta1_AudioInput_fieldAccessorTable; static final com.google.protobuf.Descriptors.Descriptor internal_static_google_cloud_dialogflow_v2beta1_OutputAudio_descriptor; static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable @@ -291,252 +295,258 @@ public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { + "teParticipantRequest\022F\n\013participant\030\001 \001(" + "\0132,.google.cloud.dialogflow.v2beta1.Part" + "icipantB\003\340A\002\0224\n\013update_mask\030\002 \001(\0132\032.goog" - + "le.protobuf.FieldMaskB\003\340A\002\"`\n\013OutputAudi" - + "o\022B\n\006config\030\001 \001(\01322.google.cloud.dialogf" - + "low.v2beta1.OutputAudioConfig\022\r\n\005audio\030\002" - + " \001(\014\"\212\005\n\023AutomatedAgentReply\022W\n\026detect_i" - + "ntent_response\030\001 \001(\01325.google.cloud.dial" - + "ogflow.v2beta1.DetectIntentResponseH\000\022K\n" - + "\021response_messages\030\003 \003(\01320.google.cloud." - + "dialogflow.v2beta1.ResponseMessage\0227\n\006in" - + "tent\030\004 \001(\tB%\372A\"\n dialogflow.googleapis.c" - + "om/IntentH\001\022\017\n\005event\030\005 \001(\tH\001\022\030\n\020match_co" - + "nfidence\030\t \001(\002\022+\n\nparameters\030\n \001(\0132\027.goo" - + "gle.protobuf.Struct\022:\n\025cx_session_parame" - + "ters\030\006 \001(\0132\027.google.protobuf.StructB\002\030\001\022" - + "p\n\032automated_agent_reply_type\030\007 \001(\0162L.go" - + "ogle.cloud.dialogflow.v2beta1.AutomatedA" - + "gentReply.AutomatedAgentReplyType\022\032\n\022all" - + "ow_cancellation\030\010 \001(\010\"]\n\027AutomatedAgentR" - + "eplyType\022*\n&AUTOMATED_AGENT_REPLY_TYPE_U" - + "NSPECIFIED\020\000\022\013\n\007PARTIAL\020\001\022\t\n\005FINAL\020\002B\n\n\010" - + "responseB\007\n\005match\"\252\001\n\021SuggestionFeature\022" - + "E\n\004type\030\001 \001(\01627.google.cloud.dialogflow." - + "v2beta1.SuggestionFeature.Type\"N\n\004Type\022\024" - + "\n\020TYPE_UNSPECIFIED\020\000\022\026\n\022ARTICLE_SUGGESTI" - + "ON\020\001\022\007\n\003FAQ\020\002\022\017\n\013SMART_REPLY\020\003\"\322\001\n\025Assis" - + "tQueryParameters\022x\n\032documents_metadata_f" - + "ilters\030\001 \003(\0132T.google.cloud.dialogflow.v" - + "2beta1.AssistQueryParameters.DocumentsMe" - + "tadataFiltersEntry\032?\n\035DocumentsMetadataF" - + "iltersEntry\022\013\n\003key\030\001 \001(\t\022\r\n\005value\030\002 \001(\t:" - + "\0028\001\"\322\004\n\025AnalyzeContentRequest\022B\n\013partici" - + "pant\030\001 \001(\tB-\340A\002\372A\'\n%dialogflow.googleapi" - + "s.com/Participant\022@\n\ntext_input\030\006 \001(\0132*." - + "google.cloud.dialogflow.v2beta1.TextInpu" - + "tH\000\022B\n\013event_input\030\010 \001(\0132+.google.cloud." - + "dialogflow.v2beta1.EventInputH\000\022N\n\022reply" - + "_audio_config\030\005 \001(\01322.google.cloud.dialo" - + "gflow.v2beta1.OutputAudioConfig\022F\n\014query" - + "_params\030\t \001(\01320.google.cloud.dialogflow." - + "v2beta1.QueryParameters\022S\n\023assist_query_" - + "params\030\016 \001(\01326.google.cloud.dialogflow.v" - + "2beta1.AssistQueryParameters\022.\n\rcx_param" - + "eters\030\022 \001(\0132\027.google.protobuf.Struct\0225\n\021" - + "message_send_time\030\n \001(\0132\032.google.protobu" - + "f.Timestamp\022\022\n\nrequest_id\030\013 \001(\tB\007\n\005input" - + "\",\n\016DtmfParameters\022\032\n\022accepts_dtmf_input" - + "\030\001 \001(\010\"\374\003\n\026AnalyzeContentResponse\022\022\n\nrep" - + "ly_text\030\001 \001(\t\022A\n\013reply_audio\030\002 \001(\0132,.goo" - + "gle.cloud.dialogflow.v2beta1.OutputAudio" - + "\022S\n\025automated_agent_reply\030\003 \001(\01324.google" - + ".cloud.dialogflow.v2beta1.AutomatedAgent" - + "Reply\0229\n\007message\030\005 \001(\0132(.google.cloud.di" - + "alogflow.v2beta1.Message\022Y\n\036human_agent_" - + "suggestion_results\030\006 \003(\01321.google.cloud." - + "dialogflow.v2beta1.SuggestionResult\022V\n\033e" - + "nd_user_suggestion_results\030\007 \003(\01321.googl" - + "e.cloud.dialogflow.v2beta1.SuggestionRes" - + "ult\022H\n\017dtmf_parameters\030\t \001(\0132/.google.cl" - + "oud.dialogflow.v2beta1.DtmfParameters\"(\n" - + "\017InputTextConfig\022\025\n\rlanguage_code\030\001 \001(\t\"" - + "\317\005\n\036StreamingAnalyzeContentRequest\022B\n\013pa" - + "rticipant\030\001 \001(\tB-\340A\002\372A\'\n%dialogflow.goog" - + "leapis.com/Participant\022I\n\014audio_config\030\002" - + " \001(\01321.google.cloud.dialogflow.v2beta1.I" - + "nputAudioConfigH\000\022G\n\013text_config\030\003 \001(\01320" - + ".google.cloud.dialogflow.v2beta1.InputTe" - + "xtConfigH\000\022N\n\022reply_audio_config\030\004 \001(\01322" - + ".google.cloud.dialogflow.v2beta1.OutputA" - + "udioConfig\022\025\n\013input_audio\030\005 \001(\014H\001\022\024\n\ninp" - + "ut_text\030\006 \001(\tH\001\022J\n\ninput_dtmf\030\t \001(\01324.go" - + "ogle.cloud.dialogflow.v2beta1.TelephonyD" - + "tmfEventsH\001\022F\n\014query_params\030\007 \001(\01320.goog" - + "le.cloud.dialogflow.v2beta1.QueryParamet" - + "ers\022S\n\023assist_query_params\030\010 \001(\01326.googl" - + "e.cloud.dialogflow.v2beta1.AssistQueryPa" - + "rameters\022.\n\rcx_parameters\030\r \001(\0132\027.google" - + ".protobuf.Struct\022,\n$enable_partial_autom" - + "ated_agent_reply\030\014 \001(\010B\010\n\006configB\007\n\005inpu" - + "t\"\336\004\n\037StreamingAnalyzeContentResponse\022W\n" - + "\022recognition_result\030\001 \001(\0132;.google.cloud" - + ".dialogflow.v2beta1.StreamingRecognition" - + "Result\022\022\n\nreply_text\030\002 \001(\t\022A\n\013reply_audi" - + "o\030\003 \001(\0132,.google.cloud.dialogflow.v2beta" - + "1.OutputAudio\022S\n\025automated_agent_reply\030\004" - + " \001(\01324.google.cloud.dialogflow.v2beta1.A" - + "utomatedAgentReply\0229\n\007message\030\006 \001(\0132(.go" - + "ogle.cloud.dialogflow.v2beta1.Message\022Y\n" - + "\036human_agent_suggestion_results\030\007 \003(\01321." - + "google.cloud.dialogflow.v2beta1.Suggesti" - + "onResult\022V\n\033end_user_suggestion_results\030" - + "\010 \003(\01321.google.cloud.dialogflow.v2beta1." - + "SuggestionResult\022H\n\017dtmf_parameters\030\n \001(" - + "\0132/.google.cloud.dialogflow.v2beta1.Dtmf" - + "Parameters\"j\n\024AnnotatedMessagePart\022\014\n\004te" - + "xt\030\001 \001(\t\022\023\n\013entity_type\030\002 \001(\t\022/\n\017formatt" - + "ed_value\030\003 \001(\0132\026.google.protobuf.Value\"s" - + "\n\021MessageAnnotation\022D\n\005parts\030\001 \003(\01325.goo" - + "gle.cloud.dialogflow.v2beta1.AnnotatedMe" - + "ssagePart\022\030\n\020contain_entities\030\002 \001(\010\"\325\001\n\r" - + "ArticleAnswer\022\r\n\005title\030\001 \001(\t\022\013\n\003uri\030\002 \001(" - + "\t\022\020\n\010snippets\030\003 \003(\t\022N\n\010metadata\030\005 \003(\0132<." - + "google.cloud.dialogflow.v2beta1.ArticleA" - + "nswer.MetadataEntry\022\025\n\ranswer_record\030\006 \001" - + "(\t\032/\n\rMetadataEntry\022\013\n\003key\030\001 \001(\t\022\r\n\005valu" - + "e\030\002 \001(\t:\0028\001\"\345\001\n\tFaqAnswer\022\016\n\006answer\030\001 \001(" - + "\t\022\022\n\nconfidence\030\002 \001(\002\022\020\n\010question\030\003 \001(\t\022" - + "\016\n\006source\030\004 \001(\t\022J\n\010metadata\030\005 \003(\01328.goog" - + "le.cloud.dialogflow.v2beta1.FaqAnswer.Me" - + "tadataEntry\022\025\n\ranswer_record\030\006 \001(\t\032/\n\rMe" - + "tadataEntry\022\013\n\003key\030\001 \001(\t\022\r\n\005value\030\002 \001(\t:" - + "\0028\001\"y\n\020SmartReplyAnswer\022\r\n\005reply\030\001 \001(\t\022\022" - + "\n\nconfidence\030\002 \001(\002\022B\n\ranswer_record\030\003 \001(" - + "\tB+\372A(\n&dialogflow.googleapis.com/Answer" - + "Record\"\371\002\n\020SuggestionResult\022#\n\005error\030\001 \001" - + "(\0132\022.google.rpc.StatusH\000\022]\n\031suggest_arti" - + "cles_response\030\002 \001(\01328.google.cloud.dialo" - + "gflow.v2beta1.SuggestArticlesResponseH\000\022" - + "b\n\034suggest_faq_answers_response\030\003 \001(\0132:." - + "google.cloud.dialogflow.v2beta1.SuggestF" - + "aqAnswersResponseH\000\022f\n\036suggest_smart_rep" - + "lies_response\030\004 \001(\0132<.google.cloud.dialo" - + "gflow.v2beta1.SuggestSmartRepliesRespons" - + "eH\000B\025\n\023suggestion_response\"\217\002\n\026SuggestAr" - + "ticlesRequest\022=\n\006parent\030\001 \001(\tB-\340A\002\372A\'\n%d" - + "ialogflow.googleapis.com/Participant\022A\n\016" - + "latest_message\030\002 \001(\tB)\340A\001\372A#\n!dialogflow" - + ".googleapis.com/Message\022\031\n\014context_size\030" - + "\003 \001(\005B\003\340A\001\022X\n\023assist_query_params\030\004 \001(\0132" - + "6.google.cloud.dialogflow.v2beta1.Assist" - + "QueryParametersB\003\340A\001\"\220\001\n\027SuggestArticles" - + "Response\022G\n\017article_answers\030\001 \003(\0132..goog" - + "le.cloud.dialogflow.v2beta1.ArticleAnswe" - + "r\022\026\n\016latest_message\030\002 \001(\t\022\024\n\014context_siz" - + "e\030\003 \001(\005\"\221\002\n\030SuggestFaqAnswersRequest\022=\n\006" - + "parent\030\001 \001(\tB-\340A\002\372A\'\n%dialogflow.googlea" - + "pis.com/Participant\022A\n\016latest_message\030\002 " - + "\001(\tB)\340A\001\372A#\n!dialogflow.googleapis.com/M" - + "essage\022\031\n\014context_size\030\003 \001(\005B\003\340A\001\022X\n\023ass" - + "ist_query_params\030\004 \001(\01326.google.cloud.di" - + "alogflow.v2beta1.AssistQueryParametersB\003" - + "\340A\001\"\212\001\n\031SuggestFaqAnswersResponse\022?\n\013faq" - + "_answers\030\001 \003(\0132*.google.cloud.dialogflow" - + ".v2beta1.FaqAnswer\022\026\n\016latest_message\030\002 \001" - + "(\t\022\024\n\014context_size\030\003 \001(\005\"\371\001\n\032SuggestSmar" - + "tRepliesRequest\022=\n\006parent\030\001 \001(\tB-\340A\002\372A\'\n" - + "%dialogflow.googleapis.com/Participant\022F" - + "\n\022current_text_input\030\004 \001(\0132*.google.clou" - + "d.dialogflow.v2beta1.TextInput\022>\n\016latest" - + "_message\030\002 \001(\tB&\372A#\n!dialogflow.googleap" - + "is.com/Message\022\024\n\014context_size\030\003 \001(\005\"\303\001\n" - + "\033SuggestSmartRepliesResponse\022N\n\023smart_re" - + "ply_answers\030\001 \003(\01321.google.cloud.dialogf" - + "low.v2beta1.SmartReplyAnswer\022>\n\016latest_m" - + "essage\030\002 \001(\tB&\372A#\n!dialogflow.googleapis" - + ".com/Message\022\024\n\014context_size\030\003 \001(\005\"\304\005\n\nS" - + "uggestion\022\014\n\004name\030\001 \001(\t\022E\n\010articles\030\002 \003(" - + "\01323.google.cloud.dialogflow.v2beta1.Sugg" - + "estion.Article\022J\n\013faq_answers\030\004 \003(\01325.go" - + "ogle.cloud.dialogflow.v2beta1.Suggestion" - + ".FaqAnswer\022/\n\013create_time\030\005 \001(\0132\032.google" - + ".protobuf.Timestamp\022\026\n\016latest_message\030\007 " - + "\001(\t\032\324\001\n\007Article\022\r\n\005title\030\001 \001(\t\022\013\n\003uri\030\002 " - + "\001(\t\022\020\n\010snippets\030\003 \003(\t\022S\n\010metadata\030\005 \003(\0132" - + "A.google.cloud.dialogflow.v2beta1.Sugges" - + "tion.Article.MetadataEntry\022\025\n\ranswer_rec" - + "ord\030\006 \001(\t\032/\n\rMetadataEntry\022\013\n\003key\030\001 \001(\t\022" - + "\r\n\005value\030\002 \001(\t:\0028\001\032\360\001\n\tFaqAnswer\022\016\n\006answ" - + "er\030\001 \001(\t\022\022\n\nconfidence\030\002 \001(\002\022\020\n\010question" - + "\030\003 \001(\t\022\016\n\006source\030\004 \001(\t\022U\n\010metadata\030\005 \003(\013" - + "2C.google.cloud.dialogflow.v2beta1.Sugge" - + "stion.FaqAnswer.MetadataEntry\022\025\n\ranswer_" - + "record\030\006 \001(\t\032/\n\rMetadataEntry\022\013\n\003key\030\001 \001" - + "(\t\022\r\n\005value\030\002 \001(\t:\0028\001:\002\030\001\"c\n\026ListSuggest" - + "ionsRequest\022\016\n\006parent\030\001 \001(\t\022\021\n\tpage_size" - + "\030\002 \001(\005\022\022\n\npage_token\030\003 \001(\t\022\016\n\006filter\030\004 \001" - + "(\t:\002\030\001\"x\n\027ListSuggestionsResponse\022@\n\013sug" - + "gestions\030\001 \003(\0132+.google.cloud.dialogflow" - + ".v2beta1.Suggestion\022\027\n\017next_page_token\030\002" - + " \001(\t:\002\030\001\"\\\n\030CompileSuggestionRequest\022\016\n\006" - + "parent\030\001 \001(\t\022\026\n\016latest_message\030\002 \001(\t\022\024\n\014" - + "context_size\030\003 \001(\005:\002\030\001\"\216\001\n\031CompileSugges" - + "tionResponse\022?\n\nsuggestion\030\001 \001(\0132+.googl" - + "e.cloud.dialogflow.v2beta1.Suggestion\022\026\n" - + "\016latest_message\030\002 \001(\t\022\024\n\014context_size\030\003 " - + "\001(\005:\002\030\001\"\203\007\n\017ResponseMessage\022E\n\004text\030\001 \001(" - + "\01325.google.cloud.dialogflow.v2beta1.Resp" - + "onseMessage.TextH\000\022*\n\007payload\030\002 \001(\0132\027.go" - + "ogle.protobuf.StructH\000\022_\n\022live_agent_han" - + "doff\030\003 \001(\0132A.google.cloud.dialogflow.v2b" - + "eta1.ResponseMessage.LiveAgentHandoffH\000\022" - + "Z\n\017end_interaction\030\004 \001(\0132?.google.cloud." - + "dialogflow.v2beta1.ResponseMessage.EndIn" - + "teractionH\000\022R\n\013mixed_audio\030\005 \001(\0132;.googl" + + "le.protobuf.FieldMaskB\003\340A\002\"^\n\nAudioInput" + + "\022A\n\006config\030\001 \001(\01321.google.cloud.dialogfl" + + "ow.v2beta1.InputAudioConfig\022\r\n\005audio\030\002 \001" + + "(\014\"`\n\013OutputAudio\022B\n\006config\030\001 \001(\01322.goog" + + "le.cloud.dialogflow.v2beta1.OutputAudioC" + + "onfig\022\r\n\005audio\030\002 \001(\014\"\212\005\n\023AutomatedAgentR" + + "eply\022W\n\026detect_intent_response\030\001 \001(\01325.g" + + "oogle.cloud.dialogflow.v2beta1.DetectInt" + + "entResponseH\000\022K\n\021response_messages\030\003 \003(\013" + + "20.google.cloud.dialogflow.v2beta1.Respo" + + "nseMessage\0227\n\006intent\030\004 \001(\tB%\372A\"\n dialogf" + + "low.googleapis.com/IntentH\001\022\017\n\005event\030\005 \001" + + "(\tH\001\022\030\n\020match_confidence\030\t \001(\002\022+\n\nparame" + + "ters\030\n \001(\0132\027.google.protobuf.Struct\022:\n\025c" + + "x_session_parameters\030\006 \001(\0132\027.google.prot" + + "obuf.StructB\002\030\001\022p\n\032automated_agent_reply" + + "_type\030\007 \001(\0162L.google.cloud.dialogflow.v2" + + "beta1.AutomatedAgentReply.AutomatedAgent" + + "ReplyType\022\032\n\022allow_cancellation\030\010 \001(\010\"]\n" + + "\027AutomatedAgentReplyType\022*\n&AUTOMATED_AG" + + "ENT_REPLY_TYPE_UNSPECIFIED\020\000\022\013\n\007PARTIAL\020" + + "\001\022\t\n\005FINAL\020\002B\n\n\010responseB\007\n\005match\"\252\001\n\021Su" + + "ggestionFeature\022E\n\004type\030\001 \001(\01627.google.c" + + "loud.dialogflow.v2beta1.SuggestionFeatur" + + "e.Type\"N\n\004Type\022\024\n\020TYPE_UNSPECIFIED\020\000\022\026\n\022" + + "ARTICLE_SUGGESTION\020\001\022\007\n\003FAQ\020\002\022\017\n\013SMART_R" + + "EPLY\020\003\"\322\001\n\025AssistQueryParameters\022x\n\032docu" + + "ments_metadata_filters\030\001 \003(\0132T.google.cl" + + "oud.dialogflow.v2beta1.AssistQueryParame" + + "ters.DocumentsMetadataFiltersEntry\032?\n\035Do" + + "cumentsMetadataFiltersEntry\022\013\n\003key\030\001 \001(\t" + + "\022\r\n\005value\030\002 \001(\t:\0028\001\"\257\005\n\025AnalyzeContentRe" + + "quest\022B\n\013participant\030\001 \001(\tB-\340A\002\372A\'\n%dial" + + "ogflow.googleapis.com/Participant\022@\n\ntex" + + "t_input\030\006 \001(\0132*.google.cloud.dialogflow." + + "v2beta1.TextInputH\000\022B\n\013audio_input\030\007 \001(\013" + + "2+.google.cloud.dialogflow.v2beta1.Audio" + + "InputH\000\022B\n\013event_input\030\010 \001(\0132+.google.cl" + + "oud.dialogflow.v2beta1.EventInputH\000\022N\n\022r" + + "eply_audio_config\030\005 \001(\01322.google.cloud.d" + + "ialogflow.v2beta1.OutputAudioConfig\022F\n\014q" + + "uery_params\030\t \001(\01320.google.cloud.dialogf" + + "low.v2beta1.QueryParameters\022S\n\023assist_qu" + + "ery_params\030\016 \001(\01326.google.cloud.dialogfl" + + "ow.v2beta1.AssistQueryParameters\022.\n\rcx_p" + + "arameters\030\022 \001(\0132\027.google.protobuf.Struct" + + "\022\027\n\017cx_current_page\030\024 \001(\t\0225\n\021message_sen" + + "d_time\030\n \001(\0132\032.google.protobuf.Timestamp" + + "\022\022\n\nrequest_id\030\013 \001(\tB\007\n\005input\",\n\016DtmfPar" + + "ameters\022\032\n\022accepts_dtmf_input\030\001 \001(\010\"\374\003\n\026" + + "AnalyzeContentResponse\022\022\n\nreply_text\030\001 \001" + + "(\t\022A\n\013reply_audio\030\002 \001(\0132,.google.cloud.d" + + "ialogflow.v2beta1.OutputAudio\022S\n\025automat" + + "ed_agent_reply\030\003 \001(\01324.google.cloud.dial" + + "ogflow.v2beta1.AutomatedAgentReply\0229\n\007me" + + "ssage\030\005 \001(\0132(.google.cloud.dialogflow.v2" + + "beta1.Message\022Y\n\036human_agent_suggestion_" + + "results\030\006 \003(\01321.google.cloud.dialogflow." + + "v2beta1.SuggestionResult\022V\n\033end_user_sug" + + "gestion_results\030\007 \003(\01321.google.cloud.dia" + + "logflow.v2beta1.SuggestionResult\022H\n\017dtmf" + + "_parameters\030\t \001(\0132/.google.cloud.dialogf" + + "low.v2beta1.DtmfParameters\"(\n\017InputTextC" + + "onfig\022\025\n\rlanguage_code\030\001 \001(\t\"\350\005\n\036Streami" + + "ngAnalyzeContentRequest\022B\n\013participant\030\001" + + " \001(\tB-\340A\002\372A\'\n%dialogflow.googleapis.com/" + + "Participant\022I\n\014audio_config\030\002 \001(\01321.goog" + + "le.cloud.dialogflow.v2beta1.InputAudioCo" + + "nfigH\000\022G\n\013text_config\030\003 \001(\01320.google.clo" + + "ud.dialogflow.v2beta1.InputTextConfigH\000\022" + + "N\n\022reply_audio_config\030\004 \001(\01322.google.clo" + + "ud.dialogflow.v2beta1.OutputAudioConfig\022" + + "\025\n\013input_audio\030\005 \001(\014H\001\022\024\n\ninput_text\030\006 \001" + + "(\tH\001\022J\n\ninput_dtmf\030\t \001(\01324.google.cloud." + + "dialogflow.v2beta1.TelephonyDtmfEventsH\001" + + "\022F\n\014query_params\030\007 \001(\01320.google.cloud.di" + + "alogflow.v2beta1.QueryParameters\022S\n\023assi" + + "st_query_params\030\010 \001(\01326.google.cloud.dia" + + "logflow.v2beta1.AssistQueryParameters\022.\n" + + "\rcx_parameters\030\r \001(\0132\027.google.protobuf.S" + + "truct\022\027\n\017cx_current_page\030\017 \001(\t\022,\n$enable" + + "_partial_automated_agent_reply\030\014 \001(\010B\010\n\006" + + "configB\007\n\005input\"\336\004\n\037StreamingAnalyzeCont" + + "entResponse\022W\n\022recognition_result\030\001 \001(\0132" + + ";.google.cloud.dialogflow.v2beta1.Stream" + + "ingRecognitionResult\022\022\n\nreply_text\030\002 \001(\t" + + "\022A\n\013reply_audio\030\003 \001(\0132,.google.cloud.dia" + + "logflow.v2beta1.OutputAudio\022S\n\025automated" + + "_agent_reply\030\004 \001(\01324.google.cloud.dialog" + + "flow.v2beta1.AutomatedAgentReply\0229\n\007mess" + + "age\030\006 \001(\0132(.google.cloud.dialogflow.v2be" + + "ta1.Message\022Y\n\036human_agent_suggestion_re" + + "sults\030\007 \003(\01321.google.cloud.dialogflow.v2" + + "beta1.SuggestionResult\022V\n\033end_user_sugge" + + "stion_results\030\010 \003(\01321.google.cloud.dialo" + + "gflow.v2beta1.SuggestionResult\022H\n\017dtmf_p" + + "arameters\030\n \001(\0132/.google.cloud.dialogflo" + + "w.v2beta1.DtmfParameters\"j\n\024AnnotatedMes" + + "sagePart\022\014\n\004text\030\001 \001(\t\022\023\n\013entity_type\030\002 " + + "\001(\t\022/\n\017formatted_value\030\003 \001(\0132\026.google.pr" + + "otobuf.Value\"s\n\021MessageAnnotation\022D\n\005par" + + "ts\030\001 \003(\01325.google.cloud.dialogflow.v2bet" + + "a1.AnnotatedMessagePart\022\030\n\020contain_entit" + + "ies\030\002 \001(\010\"\325\001\n\rArticleAnswer\022\r\n\005title\030\001 \001" + + "(\t\022\013\n\003uri\030\002 \001(\t\022\020\n\010snippets\030\003 \003(\t\022N\n\010met" + + "adata\030\005 \003(\0132<.google.cloud.dialogflow.v2" + + "beta1.ArticleAnswer.MetadataEntry\022\025\n\rans" + + "wer_record\030\006 \001(\t\032/\n\rMetadataEntry\022\013\n\003key" + + "\030\001 \001(\t\022\r\n\005value\030\002 \001(\t:\0028\001\"\345\001\n\tFaqAnswer\022" + + "\016\n\006answer\030\001 \001(\t\022\022\n\nconfidence\030\002 \001(\002\022\020\n\010q" + + "uestion\030\003 \001(\t\022\016\n\006source\030\004 \001(\t\022J\n\010metadat" + + "a\030\005 \003(\01328.google.cloud.dialogflow.v2beta" + + "1.FaqAnswer.MetadataEntry\022\025\n\ranswer_reco" + + "rd\030\006 \001(\t\032/\n\rMetadataEntry\022\013\n\003key\030\001 \001(\t\022\r" + + "\n\005value\030\002 \001(\t:\0028\001\"y\n\020SmartReplyAnswer\022\r\n" + + "\005reply\030\001 \001(\t\022\022\n\nconfidence\030\002 \001(\002\022B\n\ransw" + + "er_record\030\003 \001(\tB+\372A(\n&dialogflow.googlea" + + "pis.com/AnswerRecord\"\371\002\n\020SuggestionResul" + + "t\022#\n\005error\030\001 \001(\0132\022.google.rpc.StatusH\000\022]" + + "\n\031suggest_articles_response\030\002 \001(\01328.goog" + + "le.cloud.dialogflow.v2beta1.SuggestArtic" + + "lesResponseH\000\022b\n\034suggest_faq_answers_res" + + "ponse\030\003 \001(\0132:.google.cloud.dialogflow.v2" + + "beta1.SuggestFaqAnswersResponseH\000\022f\n\036sug" + + "gest_smart_replies_response\030\004 \001(\0132<.goog" + + "le.cloud.dialogflow.v2beta1.SuggestSmart" + + "RepliesResponseH\000B\025\n\023suggestion_response" + + "\"\217\002\n\026SuggestArticlesRequest\022=\n\006parent\030\001 " + + "\001(\tB-\340A\002\372A\'\n%dialogflow.googleapis.com/P" + + "articipant\022A\n\016latest_message\030\002 \001(\tB)\340A\001\372" + + "A#\n!dialogflow.googleapis.com/Message\022\031\n" + + "\014context_size\030\003 \001(\005B\003\340A\001\022X\n\023assist_query" + + "_params\030\004 \001(\01326.google.cloud.dialogflow." + + "v2beta1.AssistQueryParametersB\003\340A\001\"\220\001\n\027S" + + "uggestArticlesResponse\022G\n\017article_answer" + + "s\030\001 \003(\0132..google.cloud.dialogflow.v2beta" + + "1.ArticleAnswer\022\026\n\016latest_message\030\002 \001(\t\022" + + "\024\n\014context_size\030\003 \001(\005\"\221\002\n\030SuggestFaqAnsw" + + "ersRequest\022=\n\006parent\030\001 \001(\tB-\340A\002\372A\'\n%dial" + + "ogflow.googleapis.com/Participant\022A\n\016lat" + + "est_message\030\002 \001(\tB)\340A\001\372A#\n!dialogflow.go" + + "ogleapis.com/Message\022\031\n\014context_size\030\003 \001" + + "(\005B\003\340A\001\022X\n\023assist_query_params\030\004 \001(\01326.g" + + "oogle.cloud.dialogflow.v2beta1.AssistQue" + + "ryParametersB\003\340A\001\"\212\001\n\031SuggestFaqAnswersR" + + "esponse\022?\n\013faq_answers\030\001 \003(\0132*.google.cl" + + "oud.dialogflow.v2beta1.FaqAnswer\022\026\n\016late" + + "st_message\030\002 \001(\t\022\024\n\014context_size\030\003 \001(\005\"\371" + + "\001\n\032SuggestSmartRepliesRequest\022=\n\006parent\030" + + "\001 \001(\tB-\340A\002\372A\'\n%dialogflow.googleapis.com" + + "/Participant\022F\n\022current_text_input\030\004 \001(\013" + + "2*.google.cloud.dialogflow.v2beta1.TextI" + + "nput\022>\n\016latest_message\030\002 \001(\tB&\372A#\n!dialo" + + "gflow.googleapis.com/Message\022\024\n\014context_" + + "size\030\003 \001(\005\"\303\001\n\033SuggestSmartRepliesRespon" + + "se\022N\n\023smart_reply_answers\030\001 \003(\01321.google" + + ".cloud.dialogflow.v2beta1.SmartReplyAnsw" + + "er\022>\n\016latest_message\030\002 \001(\tB&\372A#\n!dialogf" + + "low.googleapis.com/Message\022\024\n\014context_si" + + "ze\030\003 \001(\005\"\304\005\n\nSuggestion\022\014\n\004name\030\001 \001(\t\022E\n" + + "\010articles\030\002 \003(\01323.google.cloud.dialogflo" + + "w.v2beta1.Suggestion.Article\022J\n\013faq_answ" + + "ers\030\004 \003(\01325.google.cloud.dialogflow.v2be" + + "ta1.Suggestion.FaqAnswer\022/\n\013create_time\030" + + "\005 \001(\0132\032.google.protobuf.Timestamp\022\026\n\016lat" + + "est_message\030\007 \001(\t\032\324\001\n\007Article\022\r\n\005title\030\001" + + " \001(\t\022\013\n\003uri\030\002 \001(\t\022\020\n\010snippets\030\003 \003(\t\022S\n\010m" + + "etadata\030\005 \003(\0132A.google.cloud.dialogflow." + + "v2beta1.Suggestion.Article.MetadataEntry" + + "\022\025\n\ranswer_record\030\006 \001(\t\032/\n\rMetadataEntry" + + "\022\013\n\003key\030\001 \001(\t\022\r\n\005value\030\002 \001(\t:\0028\001\032\360\001\n\tFaq" + + "Answer\022\016\n\006answer\030\001 \001(\t\022\022\n\nconfidence\030\002 \001" + + "(\002\022\020\n\010question\030\003 \001(\t\022\016\n\006source\030\004 \001(\t\022U\n\010" + + "metadata\030\005 \003(\0132C.google.cloud.dialogflow" + + ".v2beta1.Suggestion.FaqAnswer.MetadataEn" + + "try\022\025\n\ranswer_record\030\006 \001(\t\032/\n\rMetadataEn" + + "try\022\013\n\003key\030\001 \001(\t\022\r\n\005value\030\002 \001(\t:\0028\001:\002\030\001\"" + + "c\n\026ListSuggestionsRequest\022\016\n\006parent\030\001 \001(" + + "\t\022\021\n\tpage_size\030\002 \001(\005\022\022\n\npage_token\030\003 \001(\t" + + "\022\016\n\006filter\030\004 \001(\t:\002\030\001\"x\n\027ListSuggestionsR" + + "esponse\022@\n\013suggestions\030\001 \003(\0132+.google.cl" + + "oud.dialogflow.v2beta1.Suggestion\022\027\n\017nex" + + "t_page_token\030\002 \001(\t:\002\030\001\"\\\n\030CompileSuggest" + + "ionRequest\022\016\n\006parent\030\001 \001(\t\022\026\n\016latest_mes" + + "sage\030\002 \001(\t\022\024\n\014context_size\030\003 \001(\005:\002\030\001\"\216\001\n" + + "\031CompileSuggestionResponse\022?\n\nsuggestion" + + "\030\001 \001(\0132+.google.cloud.dialogflow.v2beta1" + + ".Suggestion\022\026\n\016latest_message\030\002 \001(\t\022\024\n\014c" + + "ontext_size\030\003 \001(\005:\002\030\001\"\203\007\n\017ResponseMessag" + + "e\022E\n\004text\030\001 \001(\01325.google.cloud.dialogflo" + + "w.v2beta1.ResponseMessage.TextH\000\022*\n\007payl" + + "oad\030\002 \001(\0132\027.google.protobuf.StructH\000\022_\n\022" + + "live_agent_handoff\030\003 \001(\0132A.google.cloud." + + "dialogflow.v2beta1.ResponseMessage.LiveA" + + "gentHandoffH\000\022Z\n\017end_interaction\030\004 \001(\0132?" + + ".google.cloud.dialogflow.v2beta1.Respons" + + "eMessage.EndInteractionH\000\022R\n\013mixed_audio" + + "\030\005 \001(\0132;.google.cloud.dialogflow.v2beta1" + + ".ResponseMessage.MixedAudioH\000\022i\n\027telepho" + + "ny_transfer_call\030\006 \001(\0132F.google.cloud.di" + + "alogflow.v2beta1.ResponseMessage.Telepho" + + "nyTransferCallH\000\032\024\n\004Text\022\014\n\004text\030\001 \003(\t\032=" + + "\n\020LiveAgentHandoff\022)\n\010metadata\030\001 \001(\0132\027.g" + + "oogle.protobuf.Struct\032\020\n\016EndInteraction\032" + + "\276\001\n\nMixedAudio\022U\n\010segments\030\001 \003(\0132C.googl" + "e.cloud.dialogflow.v2beta1.ResponseMessa" - + "ge.MixedAudioH\000\022i\n\027telephony_transfer_ca" - + "ll\030\006 \001(\0132F.google.cloud.dialogflow.v2bet" - + "a1.ResponseMessage.TelephonyTransferCall" - + "H\000\032\024\n\004Text\022\014\n\004text\030\001 \003(\t\032=\n\020LiveAgentHan" - + "doff\022)\n\010metadata\030\001 \001(\0132\027.google.protobuf" - + ".Struct\032\020\n\016EndInteraction\032\276\001\n\nMixedAudio" - + "\022U\n\010segments\030\001 \003(\0132C.google.cloud.dialog" - + "flow.v2beta1.ResponseMessage.MixedAudio." - + "Segment\032Y\n\007Segment\022\017\n\005audio\030\001 \001(\014H\000\022\r\n\003u" - + "ri\030\002 \001(\tH\000\022#\n\033allow_playback_interruptio" - + "n\030\003 \001(\010B\t\n\007content\032N\n\025TelephonyTransferC" - + "all\022\026\n\014phone_number\030\001 \001(\tH\000\022\021\n\007sip_uri\030\002" - + " \001(\tH\000B\n\n\010endpointB\t\n\007message2\355\032\n\014Partic" - + "ipants\022\271\002\n\021CreateParticipant\0229.google.cl" - + "oud.dialogflow.v2beta1.CreateParticipant" - + "Request\032,.google.cloud.dialogflow.v2beta" - + "1.Participant\"\272\001\202\323\344\223\002\236\001\"9/v2beta1/{paren" - + "t=projects/*/conversations/*}/participan" - + "ts:\013participantZT\"E/v2beta1/{parent=proj" - + "ects/*/locations/*/conversations/*}/part" - + "icipants:\013participant\332A\022parent,participa" - + "nt\022\213\002\n\016GetParticipant\0226.google.cloud.dia" - + "logflow.v2beta1.GetParticipantRequest\032,." - + "google.cloud.dialogflow.v2beta1.Particip" - + "ant\"\222\001\202\323\344\223\002\204\001\0229/v2beta1/{name=projects/*" - + "/conversations/*/participants/*}ZG\022E/v2b" - + "eta1/{name=projects/*/locations/*/conver" - + "sations/*/participants/*}\332A\004name\022\236\002\n\020Lis" - + "tParticipants\0228.google.cloud.dialogflow." - + "v2beta1.ListParticipantsRequest\0329.google" - + ".cloud.dialogflow.v2beta1.ListParticipan" - + "tsResponse\"\224\001\202\323\344\223\002\204\001\0229/v2beta1/{parent=p" - + "rojects/*/conversations/*}/participantsZ" - + "G\022E/v2beta1/{parent=projects/*/locations" - + "/*/conversations/*}/participants\332A\006paren" - + "t\022\326\002\n\021UpdateParticipant\0229.google.cloud.d" - + "ialogflow.v2beta1.UpdateParticipantReque" - + "st\032,.google.cloud.dialogflow.v2beta1.Par" - + "ticipant\"\327\001\202\323\344\223\002\266\0012E/v2beta1/{participan" - + "t.name=projects/*/conversations/*/partic" - + "ipants/*}:\013participantZ`2Q/v2beta1/{part" - + "icipant.name=projects/*/locations/*/conv" - + "ersations/*/participants/*}:\013participant" - + "\332A\027participant,update_mask\022\364\002\n\016AnalyzeCo" - + "ntent\0226.google.cloud.dialogflow.v2beta1." - + "AnalyzeContentRequest\0327.google.cloud.dia" - + "logflow.v2beta1.AnalyzeContentResponse\"\360" - + "\001\202\323\344\223\002\266\001\"O/v2beta1/{participant=projects" - + "/*/conversations/*/participants/*}:analy" - + "zeContent:\001*Z`\"[/v2beta1/{participant=pr" - + "ojects/*/locations/*/conversations/*/par" - + "ticipants/*}:analyzeContent:\001*\332A\026partici" - + "pant,text_input\332A\027participant,event_inpu" + + "ge.MixedAudio.Segment\032Y\n\007Segment\022\017\n\005audi" + + "o\030\001 \001(\014H\000\022\r\n\003uri\030\002 \001(\tH\000\022#\n\033allow_playba" + + "ck_interruption\030\003 \001(\010B\t\n\007content\032N\n\025Tele" + + "phonyTransferCall\022\026\n\014phone_number\030\001 \001(\tH" + + "\000\022\021\n\007sip_uri\030\002 \001(\tH\000B\n\n\010endpointB\t\n\007mess" + + "age2\207\033\n\014Participants\022\271\002\n\021CreateParticipa" + + "nt\0229.google.cloud.dialogflow.v2beta1.Cre" + + "ateParticipantRequest\032,.google.cloud.dia" + + "logflow.v2beta1.Participant\"\272\001\202\323\344\223\002\236\001\"9/" + + "v2beta1/{parent=projects/*/conversations" + + "/*}/participants:\013participantZT\"E/v2beta" + + "1/{parent=projects/*/locations/*/convers" + + "ations/*}/participants:\013participant\332A\022pa" + + "rent,participant\022\213\002\n\016GetParticipant\0226.go" + + "ogle.cloud.dialogflow.v2beta1.GetPartici" + + "pantRequest\032,.google.cloud.dialogflow.v2" + + "beta1.Participant\"\222\001\202\323\344\223\002\204\001\0229/v2beta1/{n" + + "ame=projects/*/conversations/*/participa" + + "nts/*}ZG\022E/v2beta1/{name=projects/*/loca" + + "tions/*/conversations/*/participants/*}\332" + + "A\004name\022\236\002\n\020ListParticipants\0228.google.clo" + + "ud.dialogflow.v2beta1.ListParticipantsRe" + + "quest\0329.google.cloud.dialogflow.v2beta1." + + "ListParticipantsResponse\"\224\001\202\323\344\223\002\204\001\0229/v2b" + + "eta1/{parent=projects/*/conversations/*}" + + "/participantsZG\022E/v2beta1/{parent=projec" + + "ts/*/locations/*/conversations/*}/partic" + + "ipants\332A\006parent\022\326\002\n\021UpdateParticipant\0229." + + "google.cloud.dialogflow.v2beta1.UpdatePa" + + "rticipantRequest\032,.google.cloud.dialogfl" + + "ow.v2beta1.Participant\"\327\001\202\323\344\223\002\266\0012E/v2bet" + + "a1/{participant.name=projects/*/conversa" + + "tions/*/participants/*}:\013participantZ`2Q" + + "/v2beta1/{participant.name=projects/*/lo" + + "cations/*/conversations/*/participants/*" + + "}:\013participant\332A\027participant,update_mask" + + "\022\216\003\n\016AnalyzeContent\0226.google.cloud.dialo" + + "gflow.v2beta1.AnalyzeContentRequest\0327.go" + + "ogle.cloud.dialogflow.v2beta1.AnalyzeCon" + + "tentResponse\"\212\002\202\323\344\223\002\266\001\"O/v2beta1/{partic" + + "ipant=projects/*/conversations/*/partici" + + "pants/*}:analyzeContent:\001*Z`\"[/v2beta1/{" + + "participant=projects/*/locations/*/conve" + + "rsations/*/participants/*}:analyzeConten" + + "t:\001*\332A\026participant,text_input\332A\027particip" + + "ant,audio_input\332A\027participant,event_inpu" + "t\022\242\001\n\027StreamingAnalyzeContent\022?.google.c" + "loud.dialogflow.v2beta1.StreamingAnalyze" + "ContentRequest\032@.google.cloud.dialogflow" @@ -678,8 +688,16 @@ public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { new java.lang.String[] { "Participant", "UpdateMask", }); - internal_static_google_cloud_dialogflow_v2beta1_OutputAudio_descriptor = + internal_static_google_cloud_dialogflow_v2beta1_AudioInput_descriptor = getDescriptor().getMessageTypes().get(7); + internal_static_google_cloud_dialogflow_v2beta1_AudioInput_fieldAccessorTable = + new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_google_cloud_dialogflow_v2beta1_AudioInput_descriptor, + new java.lang.String[] { + "Config", "Audio", + }); + internal_static_google_cloud_dialogflow_v2beta1_OutputAudio_descriptor = + getDescriptor().getMessageTypes().get(8); internal_static_google_cloud_dialogflow_v2beta1_OutputAudio_fieldAccessorTable = new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( internal_static_google_cloud_dialogflow_v2beta1_OutputAudio_descriptor, @@ -687,7 +705,7 @@ public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { "Config", "Audio", }); internal_static_google_cloud_dialogflow_v2beta1_AutomatedAgentReply_descriptor = - getDescriptor().getMessageTypes().get(8); + getDescriptor().getMessageTypes().get(9); internal_static_google_cloud_dialogflow_v2beta1_AutomatedAgentReply_fieldAccessorTable = new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( internal_static_google_cloud_dialogflow_v2beta1_AutomatedAgentReply_descriptor, @@ -705,7 +723,7 @@ public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { "Match", }); internal_static_google_cloud_dialogflow_v2beta1_SuggestionFeature_descriptor = - getDescriptor().getMessageTypes().get(9); + getDescriptor().getMessageTypes().get(10); internal_static_google_cloud_dialogflow_v2beta1_SuggestionFeature_fieldAccessorTable = new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( internal_static_google_cloud_dialogflow_v2beta1_SuggestionFeature_descriptor, @@ -713,7 +731,7 @@ public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { "Type", }); internal_static_google_cloud_dialogflow_v2beta1_AssistQueryParameters_descriptor = - getDescriptor().getMessageTypes().get(10); + getDescriptor().getMessageTypes().get(11); internal_static_google_cloud_dialogflow_v2beta1_AssistQueryParameters_fieldAccessorTable = new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( internal_static_google_cloud_dialogflow_v2beta1_AssistQueryParameters_descriptor, @@ -731,24 +749,26 @@ public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { "Key", "Value", }); internal_static_google_cloud_dialogflow_v2beta1_AnalyzeContentRequest_descriptor = - getDescriptor().getMessageTypes().get(11); + getDescriptor().getMessageTypes().get(12); internal_static_google_cloud_dialogflow_v2beta1_AnalyzeContentRequest_fieldAccessorTable = new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( internal_static_google_cloud_dialogflow_v2beta1_AnalyzeContentRequest_descriptor, new java.lang.String[] { "Participant", "TextInput", + "AudioInput", "EventInput", "ReplyAudioConfig", "QueryParams", "AssistQueryParams", "CxParameters", + "CxCurrentPage", "MessageSendTime", "RequestId", "Input", }); internal_static_google_cloud_dialogflow_v2beta1_DtmfParameters_descriptor = - getDescriptor().getMessageTypes().get(12); + getDescriptor().getMessageTypes().get(13); internal_static_google_cloud_dialogflow_v2beta1_DtmfParameters_fieldAccessorTable = new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( internal_static_google_cloud_dialogflow_v2beta1_DtmfParameters_descriptor, @@ -756,7 +776,7 @@ public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { "AcceptsDtmfInput", }); internal_static_google_cloud_dialogflow_v2beta1_AnalyzeContentResponse_descriptor = - getDescriptor().getMessageTypes().get(13); + getDescriptor().getMessageTypes().get(14); internal_static_google_cloud_dialogflow_v2beta1_AnalyzeContentResponse_fieldAccessorTable = new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( internal_static_google_cloud_dialogflow_v2beta1_AnalyzeContentResponse_descriptor, @@ -770,7 +790,7 @@ public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { "DtmfParameters", }); internal_static_google_cloud_dialogflow_v2beta1_InputTextConfig_descriptor = - getDescriptor().getMessageTypes().get(14); + getDescriptor().getMessageTypes().get(15); internal_static_google_cloud_dialogflow_v2beta1_InputTextConfig_fieldAccessorTable = new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( internal_static_google_cloud_dialogflow_v2beta1_InputTextConfig_descriptor, @@ -778,7 +798,7 @@ public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { "LanguageCode", }); internal_static_google_cloud_dialogflow_v2beta1_StreamingAnalyzeContentRequest_descriptor = - getDescriptor().getMessageTypes().get(15); + getDescriptor().getMessageTypes().get(16); internal_static_google_cloud_dialogflow_v2beta1_StreamingAnalyzeContentRequest_fieldAccessorTable = new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( internal_static_google_cloud_dialogflow_v2beta1_StreamingAnalyzeContentRequest_descriptor, @@ -793,12 +813,13 @@ public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { "QueryParams", "AssistQueryParams", "CxParameters", + "CxCurrentPage", "EnablePartialAutomatedAgentReply", "Config", "Input", }); internal_static_google_cloud_dialogflow_v2beta1_StreamingAnalyzeContentResponse_descriptor = - getDescriptor().getMessageTypes().get(16); + getDescriptor().getMessageTypes().get(17); internal_static_google_cloud_dialogflow_v2beta1_StreamingAnalyzeContentResponse_fieldAccessorTable = new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( internal_static_google_cloud_dialogflow_v2beta1_StreamingAnalyzeContentResponse_descriptor, @@ -813,7 +834,7 @@ public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { "DtmfParameters", }); internal_static_google_cloud_dialogflow_v2beta1_AnnotatedMessagePart_descriptor = - getDescriptor().getMessageTypes().get(17); + getDescriptor().getMessageTypes().get(18); internal_static_google_cloud_dialogflow_v2beta1_AnnotatedMessagePart_fieldAccessorTable = new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( internal_static_google_cloud_dialogflow_v2beta1_AnnotatedMessagePart_descriptor, @@ -821,7 +842,7 @@ public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { "Text", "EntityType", "FormattedValue", }); internal_static_google_cloud_dialogflow_v2beta1_MessageAnnotation_descriptor = - getDescriptor().getMessageTypes().get(18); + getDescriptor().getMessageTypes().get(19); internal_static_google_cloud_dialogflow_v2beta1_MessageAnnotation_fieldAccessorTable = new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( internal_static_google_cloud_dialogflow_v2beta1_MessageAnnotation_descriptor, @@ -829,7 +850,7 @@ public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { "Parts", "ContainEntities", }); internal_static_google_cloud_dialogflow_v2beta1_ArticleAnswer_descriptor = - getDescriptor().getMessageTypes().get(19); + getDescriptor().getMessageTypes().get(20); internal_static_google_cloud_dialogflow_v2beta1_ArticleAnswer_fieldAccessorTable = new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( internal_static_google_cloud_dialogflow_v2beta1_ArticleAnswer_descriptor, @@ -847,7 +868,7 @@ public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { "Key", "Value", }); internal_static_google_cloud_dialogflow_v2beta1_FaqAnswer_descriptor = - getDescriptor().getMessageTypes().get(20); + getDescriptor().getMessageTypes().get(21); internal_static_google_cloud_dialogflow_v2beta1_FaqAnswer_fieldAccessorTable = new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( internal_static_google_cloud_dialogflow_v2beta1_FaqAnswer_descriptor, @@ -865,7 +886,7 @@ public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { "Key", "Value", }); internal_static_google_cloud_dialogflow_v2beta1_SmartReplyAnswer_descriptor = - getDescriptor().getMessageTypes().get(21); + getDescriptor().getMessageTypes().get(22); internal_static_google_cloud_dialogflow_v2beta1_SmartReplyAnswer_fieldAccessorTable = new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( internal_static_google_cloud_dialogflow_v2beta1_SmartReplyAnswer_descriptor, @@ -873,7 +894,7 @@ public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { "Reply", "Confidence", "AnswerRecord", }); internal_static_google_cloud_dialogflow_v2beta1_SuggestionResult_descriptor = - getDescriptor().getMessageTypes().get(22); + getDescriptor().getMessageTypes().get(23); internal_static_google_cloud_dialogflow_v2beta1_SuggestionResult_fieldAccessorTable = new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( internal_static_google_cloud_dialogflow_v2beta1_SuggestionResult_descriptor, @@ -885,7 +906,7 @@ public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { "SuggestionResponse", }); internal_static_google_cloud_dialogflow_v2beta1_SuggestArticlesRequest_descriptor = - getDescriptor().getMessageTypes().get(23); + getDescriptor().getMessageTypes().get(24); internal_static_google_cloud_dialogflow_v2beta1_SuggestArticlesRequest_fieldAccessorTable = new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( internal_static_google_cloud_dialogflow_v2beta1_SuggestArticlesRequest_descriptor, @@ -893,7 +914,7 @@ public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { "Parent", "LatestMessage", "ContextSize", "AssistQueryParams", }); internal_static_google_cloud_dialogflow_v2beta1_SuggestArticlesResponse_descriptor = - getDescriptor().getMessageTypes().get(24); + getDescriptor().getMessageTypes().get(25); internal_static_google_cloud_dialogflow_v2beta1_SuggestArticlesResponse_fieldAccessorTable = new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( internal_static_google_cloud_dialogflow_v2beta1_SuggestArticlesResponse_descriptor, @@ -901,7 +922,7 @@ public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { "ArticleAnswers", "LatestMessage", "ContextSize", }); internal_static_google_cloud_dialogflow_v2beta1_SuggestFaqAnswersRequest_descriptor = - getDescriptor().getMessageTypes().get(25); + getDescriptor().getMessageTypes().get(26); internal_static_google_cloud_dialogflow_v2beta1_SuggestFaqAnswersRequest_fieldAccessorTable = new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( internal_static_google_cloud_dialogflow_v2beta1_SuggestFaqAnswersRequest_descriptor, @@ -909,7 +930,7 @@ public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { "Parent", "LatestMessage", "ContextSize", "AssistQueryParams", }); internal_static_google_cloud_dialogflow_v2beta1_SuggestFaqAnswersResponse_descriptor = - getDescriptor().getMessageTypes().get(26); + getDescriptor().getMessageTypes().get(27); internal_static_google_cloud_dialogflow_v2beta1_SuggestFaqAnswersResponse_fieldAccessorTable = new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( internal_static_google_cloud_dialogflow_v2beta1_SuggestFaqAnswersResponse_descriptor, @@ -917,7 +938,7 @@ public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { "FaqAnswers", "LatestMessage", "ContextSize", }); internal_static_google_cloud_dialogflow_v2beta1_SuggestSmartRepliesRequest_descriptor = - getDescriptor().getMessageTypes().get(27); + getDescriptor().getMessageTypes().get(28); internal_static_google_cloud_dialogflow_v2beta1_SuggestSmartRepliesRequest_fieldAccessorTable = new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( internal_static_google_cloud_dialogflow_v2beta1_SuggestSmartRepliesRequest_descriptor, @@ -925,7 +946,7 @@ public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { "Parent", "CurrentTextInput", "LatestMessage", "ContextSize", }); internal_static_google_cloud_dialogflow_v2beta1_SuggestSmartRepliesResponse_descriptor = - getDescriptor().getMessageTypes().get(28); + getDescriptor().getMessageTypes().get(29); internal_static_google_cloud_dialogflow_v2beta1_SuggestSmartRepliesResponse_fieldAccessorTable = new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( internal_static_google_cloud_dialogflow_v2beta1_SuggestSmartRepliesResponse_descriptor, @@ -933,7 +954,7 @@ public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { "SmartReplyAnswers", "LatestMessage", "ContextSize", }); internal_static_google_cloud_dialogflow_v2beta1_Suggestion_descriptor = - getDescriptor().getMessageTypes().get(29); + getDescriptor().getMessageTypes().get(30); internal_static_google_cloud_dialogflow_v2beta1_Suggestion_fieldAccessorTable = new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( internal_static_google_cloud_dialogflow_v2beta1_Suggestion_descriptor, @@ -981,7 +1002,7 @@ public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { "Key", "Value", }); internal_static_google_cloud_dialogflow_v2beta1_ListSuggestionsRequest_descriptor = - getDescriptor().getMessageTypes().get(30); + getDescriptor().getMessageTypes().get(31); internal_static_google_cloud_dialogflow_v2beta1_ListSuggestionsRequest_fieldAccessorTable = new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( internal_static_google_cloud_dialogflow_v2beta1_ListSuggestionsRequest_descriptor, @@ -989,7 +1010,7 @@ public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { "Parent", "PageSize", "PageToken", "Filter", }); internal_static_google_cloud_dialogflow_v2beta1_ListSuggestionsResponse_descriptor = - getDescriptor().getMessageTypes().get(31); + getDescriptor().getMessageTypes().get(32); internal_static_google_cloud_dialogflow_v2beta1_ListSuggestionsResponse_fieldAccessorTable = new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( internal_static_google_cloud_dialogflow_v2beta1_ListSuggestionsResponse_descriptor, @@ -997,7 +1018,7 @@ public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { "Suggestions", "NextPageToken", }); internal_static_google_cloud_dialogflow_v2beta1_CompileSuggestionRequest_descriptor = - getDescriptor().getMessageTypes().get(32); + getDescriptor().getMessageTypes().get(33); internal_static_google_cloud_dialogflow_v2beta1_CompileSuggestionRequest_fieldAccessorTable = new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( internal_static_google_cloud_dialogflow_v2beta1_CompileSuggestionRequest_descriptor, @@ -1005,7 +1026,7 @@ public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { "Parent", "LatestMessage", "ContextSize", }); internal_static_google_cloud_dialogflow_v2beta1_CompileSuggestionResponse_descriptor = - getDescriptor().getMessageTypes().get(33); + getDescriptor().getMessageTypes().get(34); internal_static_google_cloud_dialogflow_v2beta1_CompileSuggestionResponse_fieldAccessorTable = new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( internal_static_google_cloud_dialogflow_v2beta1_CompileSuggestionResponse_descriptor, @@ -1013,7 +1034,7 @@ public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { "Suggestion", "LatestMessage", "ContextSize", }); internal_static_google_cloud_dialogflow_v2beta1_ResponseMessage_descriptor = - getDescriptor().getMessageTypes().get(34); + getDescriptor().getMessageTypes().get(35); internal_static_google_cloud_dialogflow_v2beta1_ResponseMessage_fieldAccessorTable = new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( internal_static_google_cloud_dialogflow_v2beta1_ResponseMessage_descriptor, diff --git a/proto-google-cloud-dialogflow-v2beta1/src/main/java/com/google/cloud/dialogflow/v2beta1/QueryResult.java b/proto-google-cloud-dialogflow-v2beta1/src/main/java/com/google/cloud/dialogflow/v2beta1/QueryResult.java index 2481c5732..5ef1a7d82 100644 --- a/proto-google-cloud-dialogflow-v2beta1/src/main/java/com/google/cloud/dialogflow/v2beta1/QueryResult.java +++ b/proto-google-cloud-dialogflow-v2beta1/src/main/java/com/google/cloud/dialogflow/v2beta1/QueryResult.java @@ -600,7 +600,8 @@ public boolean getAllRequiredParamsPresent() { * *
    * Indicates whether the conversational query triggers a cancellation for slot
-   * filling.
+   * filling. For more information, see the [cancel slot filling
+   * documentation](https://cloud.google.com/dialogflow/es/docs/intents-actions-parameters#cancel).
    * 
* * bool cancels_slot_filling = 21; @@ -2705,7 +2706,8 @@ public Builder clearAllRequiredParamsPresent() { * *
      * Indicates whether the conversational query triggers a cancellation for slot
-     * filling.
+     * filling. For more information, see the [cancel slot filling
+     * documentation](https://cloud.google.com/dialogflow/es/docs/intents-actions-parameters#cancel).
      * 
* * bool cancels_slot_filling = 21; @@ -2721,7 +2723,8 @@ public boolean getCancelsSlotFilling() { * *
      * Indicates whether the conversational query triggers a cancellation for slot
-     * filling.
+     * filling. For more information, see the [cancel slot filling
+     * documentation](https://cloud.google.com/dialogflow/es/docs/intents-actions-parameters#cancel).
      * 
* * bool cancels_slot_filling = 21; @@ -2740,7 +2743,8 @@ public Builder setCancelsSlotFilling(boolean value) { * *
      * Indicates whether the conversational query triggers a cancellation for slot
-     * filling.
+     * filling. For more information, see the [cancel slot filling
+     * documentation](https://cloud.google.com/dialogflow/es/docs/intents-actions-parameters#cancel).
      * 
* * bool cancels_slot_filling = 21; diff --git a/proto-google-cloud-dialogflow-v2beta1/src/main/java/com/google/cloud/dialogflow/v2beta1/QueryResultOrBuilder.java b/proto-google-cloud-dialogflow-v2beta1/src/main/java/com/google/cloud/dialogflow/v2beta1/QueryResultOrBuilder.java index 95ef23dba..c26bcda74 100644 --- a/proto-google-cloud-dialogflow-v2beta1/src/main/java/com/google/cloud/dialogflow/v2beta1/QueryResultOrBuilder.java +++ b/proto-google-cloud-dialogflow-v2beta1/src/main/java/com/google/cloud/dialogflow/v2beta1/QueryResultOrBuilder.java @@ -234,7 +234,8 @@ public interface QueryResultOrBuilder * *
    * Indicates whether the conversational query triggers a cancellation for slot
-   * filling.
+   * filling. For more information, see the [cancel slot filling
+   * documentation](https://cloud.google.com/dialogflow/es/docs/intents-actions-parameters#cancel).
    * 
* * bool cancels_slot_filling = 21; diff --git a/proto-google-cloud-dialogflow-v2beta1/src/main/java/com/google/cloud/dialogflow/v2beta1/StreamingAnalyzeContentRequest.java b/proto-google-cloud-dialogflow-v2beta1/src/main/java/com/google/cloud/dialogflow/v2beta1/StreamingAnalyzeContentRequest.java index 049bc4871..1e7939bb1 100644 --- a/proto-google-cloud-dialogflow-v2beta1/src/main/java/com/google/cloud/dialogflow/v2beta1/StreamingAnalyzeContentRequest.java +++ b/proto-google-cloud-dialogflow-v2beta1/src/main/java/com/google/cloud/dialogflow/v2beta1/StreamingAnalyzeContentRequest.java @@ -67,6 +67,7 @@ private StreamingAnalyzeContentRequest( private StreamingAnalyzeContentRequest() { participant_ = ""; + cxCurrentPage_ = ""; } @java.lang.Override @@ -243,6 +244,13 @@ private StreamingAnalyzeContentRequest( cxParameters_ = subBuilder.buildPartial(); } + break; + } + case 122: + { + java.lang.String s = input.readStringRequireUtf8(); + + cxCurrentPage_ = s; break; } default: @@ -644,7 +652,8 @@ public com.google.protobuf.ByteString getInputAudio() { *
    * The UTF-8 encoded natural language text to be processed. Must be sent if
    * `text_config` is set in the first message. Text length must not exceed
-   * 256 bytes. The `input_text` field can be only sent once.
+   * 256 bytes for virtual agent interactions. The `input_text` field can be
+   * only sent once.
    * 
* * string input_text = 6; @@ -660,7 +669,8 @@ public boolean hasInputText() { *
    * The UTF-8 encoded natural language text to be processed. Must be sent if
    * `text_config` is set in the first message. Text length must not exceed
-   * 256 bytes. The `input_text` field can be only sent once.
+   * 256 bytes for virtual agent interactions. The `input_text` field can be
+   * only sent once.
    * 
* * string input_text = 6; @@ -689,7 +699,8 @@ public java.lang.String getInputText() { *
    * The UTF-8 encoded natural language text to be processed. Must be sent if
    * `text_config` is set in the first message. Text length must not exceed
-   * 256 bytes. The `input_text` field can be only sent once.
+   * 256 bytes for virtual agent interactions. The `input_text` field can be
+   * only sent once.
    * 
* * string input_text = 6; @@ -925,6 +936,77 @@ public com.google.protobuf.StructOrBuilder getCxParametersOrBuilder() { return getCxParameters(); } + public static final int CX_CURRENT_PAGE_FIELD_NUMBER = 15; + private volatile java.lang.Object cxCurrentPage_; + /** + * + * + *
+   * The unique identifier of the CX page to override the `current_page` in the
+   * session.
+   * Format: `projects/<Project ID>/locations/<Location ID>/agents/<Agent
+   * ID>/flows/<Flow ID>/pages/<Page ID>`.
+   * If `cx_current_page` is specified, the previous state of the session will
+   * be ignored by Dialogflow CX, including the [previous
+   * page][QueryResult.current_page] and the [previous session
+   * parameters][QueryResult.parameters]. In most cases, `cx_current_page` and
+   * `cx_parameters` should be configured together to direct a session to a
+   * specific state.
+   * Note: this field should only be used if you are connecting to a Dialogflow
+   * CX agent.
+   * 
+ * + * string cx_current_page = 15; + * + * @return The cxCurrentPage. + */ + @java.lang.Override + public java.lang.String getCxCurrentPage() { + java.lang.Object ref = cxCurrentPage_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + cxCurrentPage_ = s; + return s; + } + } + /** + * + * + *
+   * The unique identifier of the CX page to override the `current_page` in the
+   * session.
+   * Format: `projects/<Project ID>/locations/<Location ID>/agents/<Agent
+   * ID>/flows/<Flow ID>/pages/<Page ID>`.
+   * If `cx_current_page` is specified, the previous state of the session will
+   * be ignored by Dialogflow CX, including the [previous
+   * page][QueryResult.current_page] and the [previous session
+   * parameters][QueryResult.parameters]. In most cases, `cx_current_page` and
+   * `cx_parameters` should be configured together to direct a session to a
+   * specific state.
+   * Note: this field should only be used if you are connecting to a Dialogflow
+   * CX agent.
+   * 
+ * + * string cx_current_page = 15; + * + * @return The bytes for cxCurrentPage. + */ + @java.lang.Override + public com.google.protobuf.ByteString getCxCurrentPageBytes() { + java.lang.Object ref = cxCurrentPage_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + cxCurrentPage_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + public static final int ENABLE_PARTIAL_AUTOMATED_AGENT_REPLY_FIELD_NUMBER = 12; private boolean enablePartialAutomatedAgentReply_; /** @@ -993,6 +1075,9 @@ public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io if (cxParameters_ != null) { output.writeMessage(13, getCxParameters()); } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(cxCurrentPage_)) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 15, cxCurrentPage_); + } unknownFields.writeTo(output); } @@ -1045,6 +1130,9 @@ public int getSerializedSize() { if (cxParameters_ != null) { size += com.google.protobuf.CodedOutputStream.computeMessageSize(13, getCxParameters()); } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(cxCurrentPage_)) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(15, cxCurrentPage_); + } size += unknownFields.getSerializedSize(); memoizedSize = size; return size; @@ -1078,6 +1166,7 @@ public boolean equals(final java.lang.Object obj) { if (hasCxParameters()) { if (!getCxParameters().equals(other.getCxParameters())) return false; } + if (!getCxCurrentPage().equals(other.getCxCurrentPage())) return false; if (getEnablePartialAutomatedAgentReply() != other.getEnablePartialAutomatedAgentReply()) return false; if (!getConfigCase().equals(other.getConfigCase())) return false; @@ -1134,6 +1223,8 @@ public int hashCode() { hash = (37 * hash) + CX_PARAMETERS_FIELD_NUMBER; hash = (53 * hash) + getCxParameters().hashCode(); } + hash = (37 * hash) + CX_CURRENT_PAGE_FIELD_NUMBER; + hash = (53 * hash) + getCxCurrentPage().hashCode(); hash = (37 * hash) + ENABLE_PARTIAL_AUTOMATED_AGENT_REPLY_FIELD_NUMBER; hash = (53 * hash) @@ -1367,6 +1458,8 @@ public Builder clear() { cxParameters_ = null; cxParametersBuilder_ = null; } + cxCurrentPage_ = ""; + enablePartialAutomatedAgentReply_ = false; configCase_ = 0; @@ -1450,6 +1543,7 @@ public com.google.cloud.dialogflow.v2beta1.StreamingAnalyzeContentRequest buildP } else { result.cxParameters_ = cxParametersBuilder_.build(); } + result.cxCurrentPage_ = cxCurrentPage_; result.enablePartialAutomatedAgentReply_ = enablePartialAutomatedAgentReply_; result.configCase_ = configCase_; result.inputCase_ = inputCase_; @@ -1522,6 +1616,10 @@ public Builder mergeFrom( if (other.hasCxParameters()) { mergeCxParameters(other.getCxParameters()); } + if (!other.getCxCurrentPage().isEmpty()) { + cxCurrentPage_ = other.cxCurrentPage_; + onChanged(); + } if (other.getEnablePartialAutomatedAgentReply() != false) { setEnablePartialAutomatedAgentReply(other.getEnablePartialAutomatedAgentReply()); } @@ -2483,7 +2581,8 @@ public Builder clearInputAudio() { *
      * The UTF-8 encoded natural language text to be processed. Must be sent if
      * `text_config` is set in the first message. Text length must not exceed
-     * 256 bytes. The `input_text` field can be only sent once.
+     * 256 bytes for virtual agent interactions. The `input_text` field can be
+     * only sent once.
      * 
* * string input_text = 6; @@ -2500,7 +2599,8 @@ public boolean hasInputText() { *
      * The UTF-8 encoded natural language text to be processed. Must be sent if
      * `text_config` is set in the first message. Text length must not exceed
-     * 256 bytes. The `input_text` field can be only sent once.
+     * 256 bytes for virtual agent interactions. The `input_text` field can be
+     * only sent once.
      * 
* * string input_text = 6; @@ -2530,7 +2630,8 @@ public java.lang.String getInputText() { *
      * The UTF-8 encoded natural language text to be processed. Must be sent if
      * `text_config` is set in the first message. Text length must not exceed
-     * 256 bytes. The `input_text` field can be only sent once.
+     * 256 bytes for virtual agent interactions. The `input_text` field can be
+     * only sent once.
      * 
* * string input_text = 6; @@ -2560,7 +2661,8 @@ public com.google.protobuf.ByteString getInputTextBytes() { *
      * The UTF-8 encoded natural language text to be processed. Must be sent if
      * `text_config` is set in the first message. Text length must not exceed
-     * 256 bytes. The `input_text` field can be only sent once.
+     * 256 bytes for virtual agent interactions. The `input_text` field can be
+     * only sent once.
      * 
* * string input_text = 6; @@ -2583,7 +2685,8 @@ public Builder setInputText(java.lang.String value) { *
      * The UTF-8 encoded natural language text to be processed. Must be sent if
      * `text_config` is set in the first message. Text length must not exceed
-     * 256 bytes. The `input_text` field can be only sent once.
+     * 256 bytes for virtual agent interactions. The `input_text` field can be
+     * only sent once.
      * 
* * string input_text = 6; @@ -2604,7 +2707,8 @@ public Builder clearInputText() { *
      * The UTF-8 encoded natural language text to be processed. Must be sent if
      * `text_config` is set in the first message. Text length must not exceed
-     * 256 bytes. The `input_text` field can be only sent once.
+     * 256 bytes for virtual agent interactions. The `input_text` field can be
+     * only sent once.
      * 
* * string input_text = 6; @@ -3449,6 +3553,167 @@ public com.google.protobuf.StructOrBuilder getCxParametersOrBuilder() { return cxParametersBuilder_; } + private java.lang.Object cxCurrentPage_ = ""; + /** + * + * + *
+     * The unique identifier of the CX page to override the `current_page` in the
+     * session.
+     * Format: `projects/<Project ID>/locations/<Location ID>/agents/<Agent
+     * ID>/flows/<Flow ID>/pages/<Page ID>`.
+     * If `cx_current_page` is specified, the previous state of the session will
+     * be ignored by Dialogflow CX, including the [previous
+     * page][QueryResult.current_page] and the [previous session
+     * parameters][QueryResult.parameters]. In most cases, `cx_current_page` and
+     * `cx_parameters` should be configured together to direct a session to a
+     * specific state.
+     * Note: this field should only be used if you are connecting to a Dialogflow
+     * CX agent.
+     * 
+ * + * string cx_current_page = 15; + * + * @return The cxCurrentPage. + */ + public java.lang.String getCxCurrentPage() { + java.lang.Object ref = cxCurrentPage_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + cxCurrentPage_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * The unique identifier of the CX page to override the `current_page` in the
+     * session.
+     * Format: `projects/<Project ID>/locations/<Location ID>/agents/<Agent
+     * ID>/flows/<Flow ID>/pages/<Page ID>`.
+     * If `cx_current_page` is specified, the previous state of the session will
+     * be ignored by Dialogflow CX, including the [previous
+     * page][QueryResult.current_page] and the [previous session
+     * parameters][QueryResult.parameters]. In most cases, `cx_current_page` and
+     * `cx_parameters` should be configured together to direct a session to a
+     * specific state.
+     * Note: this field should only be used if you are connecting to a Dialogflow
+     * CX agent.
+     * 
+ * + * string cx_current_page = 15; + * + * @return The bytes for cxCurrentPage. + */ + public com.google.protobuf.ByteString getCxCurrentPageBytes() { + java.lang.Object ref = cxCurrentPage_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + cxCurrentPage_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * The unique identifier of the CX page to override the `current_page` in the
+     * session.
+     * Format: `projects/<Project ID>/locations/<Location ID>/agents/<Agent
+     * ID>/flows/<Flow ID>/pages/<Page ID>`.
+     * If `cx_current_page` is specified, the previous state of the session will
+     * be ignored by Dialogflow CX, including the [previous
+     * page][QueryResult.current_page] and the [previous session
+     * parameters][QueryResult.parameters]. In most cases, `cx_current_page` and
+     * `cx_parameters` should be configured together to direct a session to a
+     * specific state.
+     * Note: this field should only be used if you are connecting to a Dialogflow
+     * CX agent.
+     * 
+ * + * string cx_current_page = 15; + * + * @param value The cxCurrentPage to set. + * @return This builder for chaining. + */ + public Builder setCxCurrentPage(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + cxCurrentPage_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * The unique identifier of the CX page to override the `current_page` in the
+     * session.
+     * Format: `projects/<Project ID>/locations/<Location ID>/agents/<Agent
+     * ID>/flows/<Flow ID>/pages/<Page ID>`.
+     * If `cx_current_page` is specified, the previous state of the session will
+     * be ignored by Dialogflow CX, including the [previous
+     * page][QueryResult.current_page] and the [previous session
+     * parameters][QueryResult.parameters]. In most cases, `cx_current_page` and
+     * `cx_parameters` should be configured together to direct a session to a
+     * specific state.
+     * Note: this field should only be used if you are connecting to a Dialogflow
+     * CX agent.
+     * 
+ * + * string cx_current_page = 15; + * + * @return This builder for chaining. + */ + public Builder clearCxCurrentPage() { + + cxCurrentPage_ = getDefaultInstance().getCxCurrentPage(); + onChanged(); + return this; + } + /** + * + * + *
+     * The unique identifier of the CX page to override the `current_page` in the
+     * session.
+     * Format: `projects/<Project ID>/locations/<Location ID>/agents/<Agent
+     * ID>/flows/<Flow ID>/pages/<Page ID>`.
+     * If `cx_current_page` is specified, the previous state of the session will
+     * be ignored by Dialogflow CX, including the [previous
+     * page][QueryResult.current_page] and the [previous session
+     * parameters][QueryResult.parameters]. In most cases, `cx_current_page` and
+     * `cx_parameters` should be configured together to direct a session to a
+     * specific state.
+     * Note: this field should only be used if you are connecting to a Dialogflow
+     * CX agent.
+     * 
+ * + * string cx_current_page = 15; + * + * @param value The bytes for cxCurrentPage to set. + * @return This builder for chaining. + */ + public Builder setCxCurrentPageBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + cxCurrentPage_ = value; + onChanged(); + return this; + } + private boolean enablePartialAutomatedAgentReply_; /** * diff --git a/proto-google-cloud-dialogflow-v2beta1/src/main/java/com/google/cloud/dialogflow/v2beta1/StreamingAnalyzeContentRequestOrBuilder.java b/proto-google-cloud-dialogflow-v2beta1/src/main/java/com/google/cloud/dialogflow/v2beta1/StreamingAnalyzeContentRequestOrBuilder.java index f8e5cb220..92c7570ff 100644 --- a/proto-google-cloud-dialogflow-v2beta1/src/main/java/com/google/cloud/dialogflow/v2beta1/StreamingAnalyzeContentRequestOrBuilder.java +++ b/proto-google-cloud-dialogflow-v2beta1/src/main/java/com/google/cloud/dialogflow/v2beta1/StreamingAnalyzeContentRequestOrBuilder.java @@ -208,7 +208,8 @@ public interface StreamingAnalyzeContentRequestOrBuilder *
    * The UTF-8 encoded natural language text to be processed. Must be sent if
    * `text_config` is set in the first message. Text length must not exceed
-   * 256 bytes. The `input_text` field can be only sent once.
+   * 256 bytes for virtual agent interactions. The `input_text` field can be
+   * only sent once.
    * 
* * string input_text = 6; @@ -222,7 +223,8 @@ public interface StreamingAnalyzeContentRequestOrBuilder *
    * The UTF-8 encoded natural language text to be processed. Must be sent if
    * `text_config` is set in the first message. Text length must not exceed
-   * 256 bytes. The `input_text` field can be only sent once.
+   * 256 bytes for virtual agent interactions. The `input_text` field can be
+   * only sent once.
    * 
* * string input_text = 6; @@ -236,7 +238,8 @@ public interface StreamingAnalyzeContentRequestOrBuilder *
    * The UTF-8 encoded natural language text to be processed. Must be sent if
    * `text_config` is set in the first message. Text length must not exceed
-   * 256 bytes. The `input_text` field can be only sent once.
+   * 256 bytes for virtual agent interactions. The `input_text` field can be
+   * only sent once.
    * 
* * string input_text = 6; @@ -404,6 +407,53 @@ public interface StreamingAnalyzeContentRequestOrBuilder */ com.google.protobuf.StructOrBuilder getCxParametersOrBuilder(); + /** + * + * + *
+   * The unique identifier of the CX page to override the `current_page` in the
+   * session.
+   * Format: `projects/<Project ID>/locations/<Location ID>/agents/<Agent
+   * ID>/flows/<Flow ID>/pages/<Page ID>`.
+   * If `cx_current_page` is specified, the previous state of the session will
+   * be ignored by Dialogflow CX, including the [previous
+   * page][QueryResult.current_page] and the [previous session
+   * parameters][QueryResult.parameters]. In most cases, `cx_current_page` and
+   * `cx_parameters` should be configured together to direct a session to a
+   * specific state.
+   * Note: this field should only be used if you are connecting to a Dialogflow
+   * CX agent.
+   * 
+ * + * string cx_current_page = 15; + * + * @return The cxCurrentPage. + */ + java.lang.String getCxCurrentPage(); + /** + * + * + *
+   * The unique identifier of the CX page to override the `current_page` in the
+   * session.
+   * Format: `projects/<Project ID>/locations/<Location ID>/agents/<Agent
+   * ID>/flows/<Flow ID>/pages/<Page ID>`.
+   * If `cx_current_page` is specified, the previous state of the session will
+   * be ignored by Dialogflow CX, including the [previous
+   * page][QueryResult.current_page] and the [previous session
+   * parameters][QueryResult.parameters]. In most cases, `cx_current_page` and
+   * `cx_parameters` should be configured together to direct a session to a
+   * specific state.
+   * Note: this field should only be used if you are connecting to a Dialogflow
+   * CX agent.
+   * 
+ * + * string cx_current_page = 15; + * + * @return The bytes for cxCurrentPage. + */ + com.google.protobuf.ByteString getCxCurrentPageBytes(); + /** * * diff --git a/proto-google-cloud-dialogflow-v2beta1/src/main/java/com/google/cloud/dialogflow/v2beta1/StreamingDetectIntentRequest.java b/proto-google-cloud-dialogflow-v2beta1/src/main/java/com/google/cloud/dialogflow/v2beta1/StreamingDetectIntentRequest.java index 18a006abb..8da0af9ca 100644 --- a/proto-google-cloud-dialogflow-v2beta1/src/main/java/com/google/cloud/dialogflow/v2beta1/StreamingDetectIntentRequest.java +++ b/proto-google-cloud-dialogflow-v2beta1/src/main/java/com/google/cloud/dialogflow/v2beta1/StreamingDetectIntentRequest.java @@ -440,7 +440,7 @@ public com.google.cloud.dialogflow.v2beta1.QueryInputOrBuilder getQueryInputOrBu * bool single_utterance = 4 [deprecated = true]; * * @deprecated google.cloud.dialogflow.v2beta1.StreamingDetectIntentRequest.single_utterance is - * deprecated. See google/cloud/dialogflow/v2beta1/session.proto;l=557 + * deprecated. See google/cloud/dialogflow/v2beta1/session.proto;l=558 * @return The singleUtterance. */ @java.lang.Override @@ -1735,7 +1735,7 @@ public com.google.cloud.dialogflow.v2beta1.QueryInputOrBuilder getQueryInputOrBu * bool single_utterance = 4 [deprecated = true]; * * @deprecated google.cloud.dialogflow.v2beta1.StreamingDetectIntentRequest.single_utterance is - * deprecated. See google/cloud/dialogflow/v2beta1/session.proto;l=557 + * deprecated. See google/cloud/dialogflow/v2beta1/session.proto;l=558 * @return The singleUtterance. */ @java.lang.Override @@ -1761,7 +1761,7 @@ public boolean getSingleUtterance() { * bool single_utterance = 4 [deprecated = true]; * * @deprecated google.cloud.dialogflow.v2beta1.StreamingDetectIntentRequest.single_utterance is - * deprecated. See google/cloud/dialogflow/v2beta1/session.proto;l=557 + * deprecated. See google/cloud/dialogflow/v2beta1/session.proto;l=558 * @param value The singleUtterance to set. * @return This builder for chaining. */ @@ -1790,7 +1790,7 @@ public Builder setSingleUtterance(boolean value) { * bool single_utterance = 4 [deprecated = true]; * * @deprecated google.cloud.dialogflow.v2beta1.StreamingDetectIntentRequest.single_utterance is - * deprecated. See google/cloud/dialogflow/v2beta1/session.proto;l=557 + * deprecated. See google/cloud/dialogflow/v2beta1/session.proto;l=558 * @return This builder for chaining. */ @java.lang.Deprecated diff --git a/proto-google-cloud-dialogflow-v2beta1/src/main/java/com/google/cloud/dialogflow/v2beta1/StreamingDetectIntentRequestOrBuilder.java b/proto-google-cloud-dialogflow-v2beta1/src/main/java/com/google/cloud/dialogflow/v2beta1/StreamingDetectIntentRequestOrBuilder.java index f56bfd851..8a4cc134e 100644 --- a/proto-google-cloud-dialogflow-v2beta1/src/main/java/com/google/cloud/dialogflow/v2beta1/StreamingDetectIntentRequestOrBuilder.java +++ b/proto-google-cloud-dialogflow-v2beta1/src/main/java/com/google/cloud/dialogflow/v2beta1/StreamingDetectIntentRequestOrBuilder.java @@ -198,7 +198,7 @@ public interface StreamingDetectIntentRequestOrBuilder * bool single_utterance = 4 [deprecated = true]; * * @deprecated google.cloud.dialogflow.v2beta1.StreamingDetectIntentRequest.single_utterance is - * deprecated. See google/cloud/dialogflow/v2beta1/session.proto;l=557 + * deprecated. See google/cloud/dialogflow/v2beta1/session.proto;l=558 * @return The singleUtterance. */ @java.lang.Deprecated diff --git a/proto-google-cloud-dialogflow-v2beta1/src/main/java/com/google/cloud/dialogflow/v2beta1/TelephonyDtmfEvents.java b/proto-google-cloud-dialogflow-v2beta1/src/main/java/com/google/cloud/dialogflow/v2beta1/TelephonyDtmfEvents.java index 99f9e8929..888091ed4 100644 --- a/proto-google-cloud-dialogflow-v2beta1/src/main/java/com/google/cloud/dialogflow/v2beta1/TelephonyDtmfEvents.java +++ b/proto-google-cloud-dialogflow-v2beta1/src/main/java/com/google/cloud/dialogflow/v2beta1/TelephonyDtmfEvents.java @@ -755,8 +755,8 @@ public int getDtmfEventsValue(int index) { * * repeated .google.cloud.dialogflow.v2beta1.TelephonyDtmf dtmf_events = 1; * - * @param index The index of the value to return. - * @return The enum numeric value on the wire of dtmfEvents at the given index. + * @param index The index to set the value at. + * @param value The enum numeric value on the wire for dtmfEvents to set. * @return This builder for chaining. */ public Builder setDtmfEventsValue(int index, int value) { diff --git a/proto-google-cloud-dialogflow-v2beta1/src/main/java/com/google/cloud/dialogflow/v2beta1/TextInput.java b/proto-google-cloud-dialogflow-v2beta1/src/main/java/com/google/cloud/dialogflow/v2beta1/TextInput.java index eb91573b0..bcb2da90a 100644 --- a/proto-google-cloud-dialogflow-v2beta1/src/main/java/com/google/cloud/dialogflow/v2beta1/TextInput.java +++ b/proto-google-cloud-dialogflow-v2beta1/src/main/java/com/google/cloud/dialogflow/v2beta1/TextInput.java @@ -128,7 +128,7 @@ public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { * *
    * Required. The UTF-8 encoded natural language text to be processed.
-   * Text length must not exceed 256 characters.
+   * Text length must not exceed 256 characters for virtual agent interactions.
    * 
* * string text = 1; @@ -152,7 +152,7 @@ public java.lang.String getText() { * *
    * Required. The UTF-8 encoded natural language text to be processed.
-   * Text length must not exceed 256 characters.
+   * Text length must not exceed 256 characters for virtual agent interactions.
    * 
* * string text = 1; @@ -565,7 +565,7 @@ public Builder mergeFrom( * *
      * Required. The UTF-8 encoded natural language text to be processed.
-     * Text length must not exceed 256 characters.
+     * Text length must not exceed 256 characters for virtual agent interactions.
      * 
* * string text = 1; @@ -588,7 +588,7 @@ public java.lang.String getText() { * *
      * Required. The UTF-8 encoded natural language text to be processed.
-     * Text length must not exceed 256 characters.
+     * Text length must not exceed 256 characters for virtual agent interactions.
      * 
* * string text = 1; @@ -611,7 +611,7 @@ public com.google.protobuf.ByteString getTextBytes() { * *
      * Required. The UTF-8 encoded natural language text to be processed.
-     * Text length must not exceed 256 characters.
+     * Text length must not exceed 256 characters for virtual agent interactions.
      * 
* * string text = 1; @@ -633,7 +633,7 @@ public Builder setText(java.lang.String value) { * *
      * Required. The UTF-8 encoded natural language text to be processed.
-     * Text length must not exceed 256 characters.
+     * Text length must not exceed 256 characters for virtual agent interactions.
      * 
* * string text = 1; @@ -651,7 +651,7 @@ public Builder clearText() { * *
      * Required. The UTF-8 encoded natural language text to be processed.
-     * Text length must not exceed 256 characters.
+     * Text length must not exceed 256 characters for virtual agent interactions.
      * 
* * string text = 1; diff --git a/proto-google-cloud-dialogflow-v2beta1/src/main/java/com/google/cloud/dialogflow/v2beta1/TextInputOrBuilder.java b/proto-google-cloud-dialogflow-v2beta1/src/main/java/com/google/cloud/dialogflow/v2beta1/TextInputOrBuilder.java index ab756dd7f..4dc7c3224 100644 --- a/proto-google-cloud-dialogflow-v2beta1/src/main/java/com/google/cloud/dialogflow/v2beta1/TextInputOrBuilder.java +++ b/proto-google-cloud-dialogflow-v2beta1/src/main/java/com/google/cloud/dialogflow/v2beta1/TextInputOrBuilder.java @@ -28,7 +28,7 @@ public interface TextInputOrBuilder * *
    * Required. The UTF-8 encoded natural language text to be processed.
-   * Text length must not exceed 256 characters.
+   * Text length must not exceed 256 characters for virtual agent interactions.
    * 
* * string text = 1; @@ -41,7 +41,7 @@ public interface TextInputOrBuilder * *
    * Required. The UTF-8 encoded natural language text to be processed.
-   * Text length must not exceed 256 characters.
+   * Text length must not exceed 256 characters for virtual agent interactions.
    * 
* * string text = 1; diff --git a/proto-google-cloud-dialogflow-v2beta1/src/main/proto/google/cloud/dialogflow/v2beta1/answer_record.proto b/proto-google-cloud-dialogflow-v2beta1/src/main/proto/google/cloud/dialogflow/v2beta1/answer_record.proto index 9815384a8..1193f90c6 100644 --- a/proto-google-cloud-dialogflow-v2beta1/src/main/proto/google/cloud/dialogflow/v2beta1/answer_record.proto +++ b/proto-google-cloud-dialogflow-v2beta1/src/main/proto/google/cloud/dialogflow/v2beta1/answer_record.proto @@ -280,6 +280,15 @@ message ListAnswerRecordsRequest { child_type: "dialogflow.googleapis.com/AnswerRecord" }]; + // Optional. Filters to restrict results to specific answer records. + // + // For more information about filtering, see + // [API Filtering](https://aip.dev/160). + string filter = 2 [ + deprecated = true, + (google.api.field_behavior) = OPTIONAL + ]; + // Optional. The maximum number of records to return in a single page. // The server may return fewer records than this. If unspecified, we use 10. // The maximum is 100. diff --git a/proto-google-cloud-dialogflow-v2beta1/src/main/proto/google/cloud/dialogflow/v2beta1/conversation_profile.proto b/proto-google-cloud-dialogflow-v2beta1/src/main/proto/google/cloud/dialogflow/v2beta1/conversation_profile.proto index a4825bc2c..0c1f55296 100644 --- a/proto-google-cloud-dialogflow-v2beta1/src/main/proto/google/cloud/dialogflow/v2beta1/conversation_profile.proto +++ b/proto-google-cloud-dialogflow-v2beta1/src/main/proto/google/cloud/dialogflow/v2beta1/conversation_profile.proto @@ -437,7 +437,8 @@ message HumanAgentAssistantConfig { // Custom conversation models used in agent assist feature. // - // Supported feature: ARTICLE_SUGGESTION, SMART_COMPOSE, SMART_REPLY. + // Supported feature: ARTICLE_SUGGESTION, SMART_COMPOSE, SMART_REPLY, + // CONVERSATION_SUMMARIZATION. message ConversationModelConfig { // Conversation model resource name. Format: `projects//conversationModels/`. diff --git a/proto-google-cloud-dialogflow-v2beta1/src/main/proto/google/cloud/dialogflow/v2beta1/participant.proto b/proto-google-cloud-dialogflow-v2beta1/src/main/proto/google/cloud/dialogflow/v2beta1/participant.proto index 6dc9eec19..1d3489fe1 100644 --- a/proto-google-cloud-dialogflow-v2beta1/src/main/proto/google/cloud/dialogflow/v2beta1/participant.proto +++ b/proto-google-cloud-dialogflow-v2beta1/src/main/proto/google/cloud/dialogflow/v2beta1/participant.proto @@ -106,6 +106,7 @@ service Participants { } }; option (google.api.method_signature) = "participant,text_input"; + option (google.api.method_signature) = "participant,audio_input"; option (google.api.method_signature) = "participant,event_input"; } @@ -408,6 +409,18 @@ message UpdateParticipantRequest { google.protobuf.FieldMask update_mask = 2 [(google.api.field_behavior) = REQUIRED]; } +// Represents the natural language speech audio to be processed. +message AudioInput { + // Required. Instructs the speech recognizer how to process the speech audio. + InputAudioConfig config = 1; + + // Required. The natural language speech audio to be processed. + // A single request can contain up to 1 minute of speech audio data. + // The transcribed text cannot contain more than 256 bytes for virtual agent + // interactions. + bytes audio = 2; +} + // Represents the natural language speech audio to be played to the end user. message OutputAudio { // Required. Instructs the speech synthesizer how to generate the speech @@ -544,6 +557,9 @@ message AnalyzeContentRequest { // The natural language text to be processed. TextInput text_input = 6; + // The natural language speech audio to be processed. + AudioInput audio_input = 7; + // An input event to send to Dialogflow. EventInput event_input = 8; } @@ -569,6 +585,22 @@ message AnalyzeContentRequest { // CX agent. google.protobuf.Struct cx_parameters = 18; + // The unique identifier of the CX page to override the `current_page` in the + // session. + // Format: `projects//locations//agents//flows//pages/`. + // + // If `cx_current_page` is specified, the previous state of the session will + // be ignored by Dialogflow CX, including the [previous + // page][QueryResult.current_page] and the [previous session + // parameters][QueryResult.parameters]. In most cases, `cx_current_page` and + // `cx_parameters` should be configured together to direct a session to a + // specific state. + // + // Note: this field should only be used if you are connecting to a Dialogflow + // CX agent. + string cx_current_page = 20; + // Optional. The send time of the message from end user or human agent's // perspective. It is used for identifying the same message under one // participant. @@ -729,7 +761,8 @@ message StreamingAnalyzeContentRequest { // The UTF-8 encoded natural language text to be processed. Must be sent if // `text_config` is set in the first message. Text length must not exceed - // 256 bytes. The `input_text` field can be only sent once. + // 256 bytes for virtual agent interactions. The `input_text` field can be + // only sent once. string input_text = 6; // The DTMF digits used to invoke intent and fill in parameter value. @@ -753,6 +786,22 @@ message StreamingAnalyzeContentRequest { // CX agent. google.protobuf.Struct cx_parameters = 13; + // The unique identifier of the CX page to override the `current_page` in the + // session. + // Format: `projects//locations//agents//flows//pages/`. + // + // If `cx_current_page` is specified, the previous state of the session will + // be ignored by Dialogflow CX, including the [previous + // page][QueryResult.current_page] and the [previous session + // parameters][QueryResult.parameters]. In most cases, `cx_current_page` and + // `cx_parameters` should be configured together to direct a session to a + // specific state. + // + // Note: this field should only be used if you are connecting to a Dialogflow + // CX agent. + string cx_current_page = 15; + // Enable partial virtual agent responses. If this flag is not enabled, // response stream still contains only one final response even if some // `Fulfillment`s in Dialogflow virtual agent have been configured to return diff --git a/proto-google-cloud-dialogflow-v2beta1/src/main/proto/google/cloud/dialogflow/v2beta1/session.proto b/proto-google-cloud-dialogflow-v2beta1/src/main/proto/google/cloud/dialogflow/v2beta1/session.proto index d31fb7f1a..ac64e7127 100644 --- a/proto-google-cloud-dialogflow-v2beta1/src/main/proto/google/cloud/dialogflow/v2beta1/session.proto +++ b/proto-google-cloud-dialogflow-v2beta1/src/main/proto/google/cloud/dialogflow/v2beta1/session.proto @@ -356,7 +356,8 @@ message QueryResult { bool all_required_params_present = 5; // Indicates whether the conversational query triggers a cancellation for slot - // filling. + // filling. For more information, see the [cancel slot filling + // documentation](https://cloud.google.com/dialogflow/es/docs/intents-actions-parameters#cancel). bool cancels_slot_filling = 21; // The text to be pronounced to the user or shown on the screen. @@ -753,7 +754,7 @@ message StreamingRecognitionResult { // Represents the natural language text to be processed. message TextInput { // Required. The UTF-8 encoded natural language text to be processed. - // Text length must not exceed 256 characters. + // Text length must not exceed 256 characters for virtual agent interactions. string text = 1; // Required. The language of this conversational query. See [Language diff --git a/samples/snippets/generated/com/google/cloud/dialogflow/v2/agentsclient/getlocation/AsyncGetLocation.java b/samples/snippets/generated/com/google/cloud/dialogflow/v2/agentsclient/getlocation/AsyncGetLocation.java new file mode 100644 index 000000000..da71c4a85 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/dialogflow/v2/agentsclient/getlocation/AsyncGetLocation.java @@ -0,0 +1,42 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.dialogflow.v2.samples; + +// [START dialogflow_v2_generated_agentsclient_getlocation_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.dialogflow.v2.AgentsClient; +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.Location; + +public class AsyncGetLocation { + + public static void main(String[] args) throws Exception { + asyncGetLocation(); + } + + public static void asyncGetLocation() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (AgentsClient agentsClient = AgentsClient.create()) { + GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build(); + ApiFuture future = agentsClient.getLocationCallable().futureCall(request); + // Do something. + Location response = future.get(); + } + } +} +// [END dialogflow_v2_generated_agentsclient_getlocation_async] diff --git a/samples/snippets/generated/com/google/cloud/dialogflow/v2/agentsclient/getlocation/SyncGetLocation.java b/samples/snippets/generated/com/google/cloud/dialogflow/v2/agentsclient/getlocation/SyncGetLocation.java new file mode 100644 index 000000000..f666aab53 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/dialogflow/v2/agentsclient/getlocation/SyncGetLocation.java @@ -0,0 +1,39 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.dialogflow.v2.samples; + +// [START dialogflow_v2_generated_agentsclient_getlocation_sync] +import com.google.cloud.dialogflow.v2.AgentsClient; +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.Location; + +public class SyncGetLocation { + + public static void main(String[] args) throws Exception { + syncGetLocation(); + } + + public static void syncGetLocation() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (AgentsClient agentsClient = AgentsClient.create()) { + GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build(); + Location response = agentsClient.getLocation(request); + } + } +} +// [END dialogflow_v2_generated_agentsclient_getlocation_sync] diff --git a/samples/snippets/generated/com/google/cloud/dialogflow/v2/agentsclient/listlocations/AsyncListLocations.java b/samples/snippets/generated/com/google/cloud/dialogflow/v2/agentsclient/listlocations/AsyncListLocations.java new file mode 100644 index 000000000..19f37470a --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/dialogflow/v2/agentsclient/listlocations/AsyncListLocations.java @@ -0,0 +1,50 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.dialogflow.v2.samples; + +// [START dialogflow_v2_generated_agentsclient_listlocations_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.dialogflow.v2.AgentsClient; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.Location; + +public class AsyncListLocations { + + public static void main(String[] args) throws Exception { + asyncListLocations(); + } + + public static void asyncListLocations() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (AgentsClient agentsClient = AgentsClient.create()) { + ListLocationsRequest request = + ListLocationsRequest.newBuilder() + .setName("name3373707") + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + ApiFuture future = agentsClient.listLocationsPagedCallable().futureCall(request); + // Do something. + for (Location element : future.get().iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END dialogflow_v2_generated_agentsclient_listlocations_async] diff --git a/samples/snippets/generated/com/google/cloud/dialogflow/v2/agentsclient/listlocations/AsyncListLocationsPaged.java b/samples/snippets/generated/com/google/cloud/dialogflow/v2/agentsclient/listlocations/AsyncListLocationsPaged.java new file mode 100644 index 000000000..f5953a14f --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/dialogflow/v2/agentsclient/listlocations/AsyncListLocationsPaged.java @@ -0,0 +1,58 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.dialogflow.v2.samples; + +// [START dialogflow_v2_generated_agentsclient_listlocations_paged_async] +import com.google.cloud.dialogflow.v2.AgentsClient; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.ListLocationsResponse; +import com.google.cloud.location.Location; +import com.google.common.base.Strings; + +public class AsyncListLocationsPaged { + + public static void main(String[] args) throws Exception { + asyncListLocationsPaged(); + } + + public static void asyncListLocationsPaged() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (AgentsClient agentsClient = AgentsClient.create()) { + ListLocationsRequest request = + ListLocationsRequest.newBuilder() + .setName("name3373707") + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + while (true) { + ListLocationsResponse response = agentsClient.listLocationsCallable().call(request); + for (Location element : response.getLocationsList()) { + // doThingsWith(element); + } + String nextPageToken = response.getNextPageToken(); + if (!Strings.isNullOrEmpty(nextPageToken)) { + request = request.toBuilder().setPageToken(nextPageToken).build(); + } else { + break; + } + } + } + } +} +// [END dialogflow_v2_generated_agentsclient_listlocations_paged_async] diff --git a/samples/snippets/generated/com/google/cloud/dialogflow/v2/agentsclient/listlocations/SyncListLocations.java b/samples/snippets/generated/com/google/cloud/dialogflow/v2/agentsclient/listlocations/SyncListLocations.java new file mode 100644 index 000000000..fa8581167 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/dialogflow/v2/agentsclient/listlocations/SyncListLocations.java @@ -0,0 +1,47 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.dialogflow.v2.samples; + +// [START dialogflow_v2_generated_agentsclient_listlocations_sync] +import com.google.cloud.dialogflow.v2.AgentsClient; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.Location; + +public class SyncListLocations { + + public static void main(String[] args) throws Exception { + syncListLocations(); + } + + public static void syncListLocations() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (AgentsClient agentsClient = AgentsClient.create()) { + ListLocationsRequest request = + ListLocationsRequest.newBuilder() + .setName("name3373707") + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + for (Location element : agentsClient.listLocations(request).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END dialogflow_v2_generated_agentsclient_listlocations_sync] diff --git a/samples/snippets/generated/com/google/cloud/dialogflow/v2/answerrecordsclient/getlocation/AsyncGetLocation.java b/samples/snippets/generated/com/google/cloud/dialogflow/v2/answerrecordsclient/getlocation/AsyncGetLocation.java new file mode 100644 index 000000000..68cc4dd4f --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/dialogflow/v2/answerrecordsclient/getlocation/AsyncGetLocation.java @@ -0,0 +1,42 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.dialogflow.v2.samples; + +// [START dialogflow_v2_generated_answerrecordsclient_getlocation_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.dialogflow.v2.AnswerRecordsClient; +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.Location; + +public class AsyncGetLocation { + + public static void main(String[] args) throws Exception { + asyncGetLocation(); + } + + public static void asyncGetLocation() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (AnswerRecordsClient answerRecordsClient = AnswerRecordsClient.create()) { + GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build(); + ApiFuture future = answerRecordsClient.getLocationCallable().futureCall(request); + // Do something. + Location response = future.get(); + } + } +} +// [END dialogflow_v2_generated_answerrecordsclient_getlocation_async] diff --git a/samples/snippets/generated/com/google/cloud/dialogflow/v2/answerrecordsclient/getlocation/SyncGetLocation.java b/samples/snippets/generated/com/google/cloud/dialogflow/v2/answerrecordsclient/getlocation/SyncGetLocation.java new file mode 100644 index 000000000..d7cd91b24 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/dialogflow/v2/answerrecordsclient/getlocation/SyncGetLocation.java @@ -0,0 +1,39 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.dialogflow.v2.samples; + +// [START dialogflow_v2_generated_answerrecordsclient_getlocation_sync] +import com.google.cloud.dialogflow.v2.AnswerRecordsClient; +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.Location; + +public class SyncGetLocation { + + public static void main(String[] args) throws Exception { + syncGetLocation(); + } + + public static void syncGetLocation() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (AnswerRecordsClient answerRecordsClient = AnswerRecordsClient.create()) { + GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build(); + Location response = answerRecordsClient.getLocation(request); + } + } +} +// [END dialogflow_v2_generated_answerrecordsclient_getlocation_sync] diff --git a/samples/snippets/generated/com/google/cloud/dialogflow/v2/answerrecordsclient/listlocations/AsyncListLocations.java b/samples/snippets/generated/com/google/cloud/dialogflow/v2/answerrecordsclient/listlocations/AsyncListLocations.java new file mode 100644 index 000000000..6f1efde36 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/dialogflow/v2/answerrecordsclient/listlocations/AsyncListLocations.java @@ -0,0 +1,51 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.dialogflow.v2.samples; + +// [START dialogflow_v2_generated_answerrecordsclient_listlocations_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.dialogflow.v2.AnswerRecordsClient; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.Location; + +public class AsyncListLocations { + + public static void main(String[] args) throws Exception { + asyncListLocations(); + } + + public static void asyncListLocations() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (AnswerRecordsClient answerRecordsClient = AnswerRecordsClient.create()) { + ListLocationsRequest request = + ListLocationsRequest.newBuilder() + .setName("name3373707") + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + ApiFuture future = + answerRecordsClient.listLocationsPagedCallable().futureCall(request); + // Do something. + for (Location element : future.get().iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END dialogflow_v2_generated_answerrecordsclient_listlocations_async] diff --git a/samples/snippets/generated/com/google/cloud/dialogflow/v2/answerrecordsclient/listlocations/AsyncListLocationsPaged.java b/samples/snippets/generated/com/google/cloud/dialogflow/v2/answerrecordsclient/listlocations/AsyncListLocationsPaged.java new file mode 100644 index 000000000..a75518bf9 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/dialogflow/v2/answerrecordsclient/listlocations/AsyncListLocationsPaged.java @@ -0,0 +1,58 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.dialogflow.v2.samples; + +// [START dialogflow_v2_generated_answerrecordsclient_listlocations_paged_async] +import com.google.cloud.dialogflow.v2.AnswerRecordsClient; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.ListLocationsResponse; +import com.google.cloud.location.Location; +import com.google.common.base.Strings; + +public class AsyncListLocationsPaged { + + public static void main(String[] args) throws Exception { + asyncListLocationsPaged(); + } + + public static void asyncListLocationsPaged() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (AnswerRecordsClient answerRecordsClient = AnswerRecordsClient.create()) { + ListLocationsRequest request = + ListLocationsRequest.newBuilder() + .setName("name3373707") + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + while (true) { + ListLocationsResponse response = answerRecordsClient.listLocationsCallable().call(request); + for (Location element : response.getLocationsList()) { + // doThingsWith(element); + } + String nextPageToken = response.getNextPageToken(); + if (!Strings.isNullOrEmpty(nextPageToken)) { + request = request.toBuilder().setPageToken(nextPageToken).build(); + } else { + break; + } + } + } + } +} +// [END dialogflow_v2_generated_answerrecordsclient_listlocations_paged_async] diff --git a/samples/snippets/generated/com/google/cloud/dialogflow/v2/answerrecordsclient/listlocations/SyncListLocations.java b/samples/snippets/generated/com/google/cloud/dialogflow/v2/answerrecordsclient/listlocations/SyncListLocations.java new file mode 100644 index 000000000..bfc624a0b --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/dialogflow/v2/answerrecordsclient/listlocations/SyncListLocations.java @@ -0,0 +1,47 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.dialogflow.v2.samples; + +// [START dialogflow_v2_generated_answerrecordsclient_listlocations_sync] +import com.google.cloud.dialogflow.v2.AnswerRecordsClient; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.Location; + +public class SyncListLocations { + + public static void main(String[] args) throws Exception { + syncListLocations(); + } + + public static void syncListLocations() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (AnswerRecordsClient answerRecordsClient = AnswerRecordsClient.create()) { + ListLocationsRequest request = + ListLocationsRequest.newBuilder() + .setName("name3373707") + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + for (Location element : answerRecordsClient.listLocations(request).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END dialogflow_v2_generated_answerrecordsclient_listlocations_sync] diff --git a/samples/snippets/generated/com/google/cloud/dialogflow/v2/contextsclient/getlocation/AsyncGetLocation.java b/samples/snippets/generated/com/google/cloud/dialogflow/v2/contextsclient/getlocation/AsyncGetLocation.java new file mode 100644 index 000000000..dc5c9f90d --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/dialogflow/v2/contextsclient/getlocation/AsyncGetLocation.java @@ -0,0 +1,42 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.dialogflow.v2.samples; + +// [START dialogflow_v2_generated_contextsclient_getlocation_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.dialogflow.v2.ContextsClient; +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.Location; + +public class AsyncGetLocation { + + public static void main(String[] args) throws Exception { + asyncGetLocation(); + } + + public static void asyncGetLocation() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (ContextsClient contextsClient = ContextsClient.create()) { + GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build(); + ApiFuture future = contextsClient.getLocationCallable().futureCall(request); + // Do something. + Location response = future.get(); + } + } +} +// [END dialogflow_v2_generated_contextsclient_getlocation_async] diff --git a/samples/snippets/generated/com/google/cloud/dialogflow/v2/contextsclient/getlocation/SyncGetLocation.java b/samples/snippets/generated/com/google/cloud/dialogflow/v2/contextsclient/getlocation/SyncGetLocation.java new file mode 100644 index 000000000..f7c6f6576 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/dialogflow/v2/contextsclient/getlocation/SyncGetLocation.java @@ -0,0 +1,39 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.dialogflow.v2.samples; + +// [START dialogflow_v2_generated_contextsclient_getlocation_sync] +import com.google.cloud.dialogflow.v2.ContextsClient; +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.Location; + +public class SyncGetLocation { + + public static void main(String[] args) throws Exception { + syncGetLocation(); + } + + public static void syncGetLocation() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (ContextsClient contextsClient = ContextsClient.create()) { + GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build(); + Location response = contextsClient.getLocation(request); + } + } +} +// [END dialogflow_v2_generated_contextsclient_getlocation_sync] diff --git a/samples/snippets/generated/com/google/cloud/dialogflow/v2/contextsclient/listlocations/AsyncListLocations.java b/samples/snippets/generated/com/google/cloud/dialogflow/v2/contextsclient/listlocations/AsyncListLocations.java new file mode 100644 index 000000000..e87f5a3d2 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/dialogflow/v2/contextsclient/listlocations/AsyncListLocations.java @@ -0,0 +1,50 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.dialogflow.v2.samples; + +// [START dialogflow_v2_generated_contextsclient_listlocations_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.dialogflow.v2.ContextsClient; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.Location; + +public class AsyncListLocations { + + public static void main(String[] args) throws Exception { + asyncListLocations(); + } + + public static void asyncListLocations() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (ContextsClient contextsClient = ContextsClient.create()) { + ListLocationsRequest request = + ListLocationsRequest.newBuilder() + .setName("name3373707") + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + ApiFuture future = contextsClient.listLocationsPagedCallable().futureCall(request); + // Do something. + for (Location element : future.get().iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END dialogflow_v2_generated_contextsclient_listlocations_async] diff --git a/samples/snippets/generated/com/google/cloud/dialogflow/v2/contextsclient/listlocations/AsyncListLocationsPaged.java b/samples/snippets/generated/com/google/cloud/dialogflow/v2/contextsclient/listlocations/AsyncListLocationsPaged.java new file mode 100644 index 000000000..2564c0b5d --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/dialogflow/v2/contextsclient/listlocations/AsyncListLocationsPaged.java @@ -0,0 +1,58 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.dialogflow.v2.samples; + +// [START dialogflow_v2_generated_contextsclient_listlocations_paged_async] +import com.google.cloud.dialogflow.v2.ContextsClient; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.ListLocationsResponse; +import com.google.cloud.location.Location; +import com.google.common.base.Strings; + +public class AsyncListLocationsPaged { + + public static void main(String[] args) throws Exception { + asyncListLocationsPaged(); + } + + public static void asyncListLocationsPaged() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (ContextsClient contextsClient = ContextsClient.create()) { + ListLocationsRequest request = + ListLocationsRequest.newBuilder() + .setName("name3373707") + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + while (true) { + ListLocationsResponse response = contextsClient.listLocationsCallable().call(request); + for (Location element : response.getLocationsList()) { + // doThingsWith(element); + } + String nextPageToken = response.getNextPageToken(); + if (!Strings.isNullOrEmpty(nextPageToken)) { + request = request.toBuilder().setPageToken(nextPageToken).build(); + } else { + break; + } + } + } + } +} +// [END dialogflow_v2_generated_contextsclient_listlocations_paged_async] diff --git a/samples/snippets/generated/com/google/cloud/dialogflow/v2/contextsclient/listlocations/SyncListLocations.java b/samples/snippets/generated/com/google/cloud/dialogflow/v2/contextsclient/listlocations/SyncListLocations.java new file mode 100644 index 000000000..08b59cb40 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/dialogflow/v2/contextsclient/listlocations/SyncListLocations.java @@ -0,0 +1,47 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.dialogflow.v2.samples; + +// [START dialogflow_v2_generated_contextsclient_listlocations_sync] +import com.google.cloud.dialogflow.v2.ContextsClient; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.Location; + +public class SyncListLocations { + + public static void main(String[] args) throws Exception { + syncListLocations(); + } + + public static void syncListLocations() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (ContextsClient contextsClient = ContextsClient.create()) { + ListLocationsRequest request = + ListLocationsRequest.newBuilder() + .setName("name3373707") + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + for (Location element : contextsClient.listLocations(request).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END dialogflow_v2_generated_contextsclient_listlocations_sync] diff --git a/samples/snippets/generated/com/google/cloud/dialogflow/v2/conversationdatasetsclient/getlocation/AsyncGetLocation.java b/samples/snippets/generated/com/google/cloud/dialogflow/v2/conversationdatasetsclient/getlocation/AsyncGetLocation.java new file mode 100644 index 000000000..05c928c33 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/dialogflow/v2/conversationdatasetsclient/getlocation/AsyncGetLocation.java @@ -0,0 +1,44 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.dialogflow.v2.samples; + +// [START dialogflow_v2_generated_conversationdatasetsclient_getlocation_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.dialogflow.v2.ConversationDatasetsClient; +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.Location; + +public class AsyncGetLocation { + + public static void main(String[] args) throws Exception { + asyncGetLocation(); + } + + public static void asyncGetLocation() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (ConversationDatasetsClient conversationDatasetsClient = + ConversationDatasetsClient.create()) { + GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build(); + ApiFuture future = + conversationDatasetsClient.getLocationCallable().futureCall(request); + // Do something. + Location response = future.get(); + } + } +} +// [END dialogflow_v2_generated_conversationdatasetsclient_getlocation_async] diff --git a/samples/snippets/generated/com/google/cloud/dialogflow/v2/conversationdatasetsclient/getlocation/SyncGetLocation.java b/samples/snippets/generated/com/google/cloud/dialogflow/v2/conversationdatasetsclient/getlocation/SyncGetLocation.java new file mode 100644 index 000000000..05b76a8af --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/dialogflow/v2/conversationdatasetsclient/getlocation/SyncGetLocation.java @@ -0,0 +1,40 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.dialogflow.v2.samples; + +// [START dialogflow_v2_generated_conversationdatasetsclient_getlocation_sync] +import com.google.cloud.dialogflow.v2.ConversationDatasetsClient; +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.Location; + +public class SyncGetLocation { + + public static void main(String[] args) throws Exception { + syncGetLocation(); + } + + public static void syncGetLocation() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (ConversationDatasetsClient conversationDatasetsClient = + ConversationDatasetsClient.create()) { + GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build(); + Location response = conversationDatasetsClient.getLocation(request); + } + } +} +// [END dialogflow_v2_generated_conversationdatasetsclient_getlocation_sync] diff --git a/samples/snippets/generated/com/google/cloud/dialogflow/v2/conversationdatasetsclient/listlocations/AsyncListLocations.java b/samples/snippets/generated/com/google/cloud/dialogflow/v2/conversationdatasetsclient/listlocations/AsyncListLocations.java new file mode 100644 index 000000000..7a5dbbb59 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/dialogflow/v2/conversationdatasetsclient/listlocations/AsyncListLocations.java @@ -0,0 +1,52 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.dialogflow.v2.samples; + +// [START dialogflow_v2_generated_conversationdatasetsclient_listlocations_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.dialogflow.v2.ConversationDatasetsClient; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.Location; + +public class AsyncListLocations { + + public static void main(String[] args) throws Exception { + asyncListLocations(); + } + + public static void asyncListLocations() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (ConversationDatasetsClient conversationDatasetsClient = + ConversationDatasetsClient.create()) { + ListLocationsRequest request = + ListLocationsRequest.newBuilder() + .setName("name3373707") + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + ApiFuture future = + conversationDatasetsClient.listLocationsPagedCallable().futureCall(request); + // Do something. + for (Location element : future.get().iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END dialogflow_v2_generated_conversationdatasetsclient_listlocations_async] diff --git a/samples/snippets/generated/com/google/cloud/dialogflow/v2/conversationdatasetsclient/listlocations/AsyncListLocationsPaged.java b/samples/snippets/generated/com/google/cloud/dialogflow/v2/conversationdatasetsclient/listlocations/AsyncListLocationsPaged.java new file mode 100644 index 000000000..3aef6434e --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/dialogflow/v2/conversationdatasetsclient/listlocations/AsyncListLocationsPaged.java @@ -0,0 +1,60 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.dialogflow.v2.samples; + +// [START dialogflow_v2_generated_conversationdatasetsclient_listlocations_paged_async] +import com.google.cloud.dialogflow.v2.ConversationDatasetsClient; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.ListLocationsResponse; +import com.google.cloud.location.Location; +import com.google.common.base.Strings; + +public class AsyncListLocationsPaged { + + public static void main(String[] args) throws Exception { + asyncListLocationsPaged(); + } + + public static void asyncListLocationsPaged() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (ConversationDatasetsClient conversationDatasetsClient = + ConversationDatasetsClient.create()) { + ListLocationsRequest request = + ListLocationsRequest.newBuilder() + .setName("name3373707") + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + while (true) { + ListLocationsResponse response = + conversationDatasetsClient.listLocationsCallable().call(request); + for (Location element : response.getLocationsList()) { + // doThingsWith(element); + } + String nextPageToken = response.getNextPageToken(); + if (!Strings.isNullOrEmpty(nextPageToken)) { + request = request.toBuilder().setPageToken(nextPageToken).build(); + } else { + break; + } + } + } + } +} +// [END dialogflow_v2_generated_conversationdatasetsclient_listlocations_paged_async] diff --git a/samples/snippets/generated/com/google/cloud/dialogflow/v2/conversationdatasetsclient/listlocations/SyncListLocations.java b/samples/snippets/generated/com/google/cloud/dialogflow/v2/conversationdatasetsclient/listlocations/SyncListLocations.java new file mode 100644 index 000000000..f985e9289 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/dialogflow/v2/conversationdatasetsclient/listlocations/SyncListLocations.java @@ -0,0 +1,48 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.dialogflow.v2.samples; + +// [START dialogflow_v2_generated_conversationdatasetsclient_listlocations_sync] +import com.google.cloud.dialogflow.v2.ConversationDatasetsClient; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.Location; + +public class SyncListLocations { + + public static void main(String[] args) throws Exception { + syncListLocations(); + } + + public static void syncListLocations() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (ConversationDatasetsClient conversationDatasetsClient = + ConversationDatasetsClient.create()) { + ListLocationsRequest request = + ListLocationsRequest.newBuilder() + .setName("name3373707") + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + for (Location element : conversationDatasetsClient.listLocations(request).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END dialogflow_v2_generated_conversationdatasetsclient_listlocations_sync] diff --git a/samples/snippets/generated/com/google/cloud/dialogflow/v2/conversationmodelsclient/getlocation/AsyncGetLocation.java b/samples/snippets/generated/com/google/cloud/dialogflow/v2/conversationmodelsclient/getlocation/AsyncGetLocation.java new file mode 100644 index 000000000..0ff50dd5f --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/dialogflow/v2/conversationmodelsclient/getlocation/AsyncGetLocation.java @@ -0,0 +1,43 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.dialogflow.v2.samples; + +// [START dialogflow_v2_generated_conversationmodelsclient_getlocation_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.dialogflow.v2.ConversationModelsClient; +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.Location; + +public class AsyncGetLocation { + + public static void main(String[] args) throws Exception { + asyncGetLocation(); + } + + public static void asyncGetLocation() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (ConversationModelsClient conversationModelsClient = ConversationModelsClient.create()) { + GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build(); + ApiFuture future = + conversationModelsClient.getLocationCallable().futureCall(request); + // Do something. + Location response = future.get(); + } + } +} +// [END dialogflow_v2_generated_conversationmodelsclient_getlocation_async] diff --git a/samples/snippets/generated/com/google/cloud/dialogflow/v2/conversationmodelsclient/getlocation/SyncGetLocation.java b/samples/snippets/generated/com/google/cloud/dialogflow/v2/conversationmodelsclient/getlocation/SyncGetLocation.java new file mode 100644 index 000000000..cc6edb7ac --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/dialogflow/v2/conversationmodelsclient/getlocation/SyncGetLocation.java @@ -0,0 +1,39 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.dialogflow.v2.samples; + +// [START dialogflow_v2_generated_conversationmodelsclient_getlocation_sync] +import com.google.cloud.dialogflow.v2.ConversationModelsClient; +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.Location; + +public class SyncGetLocation { + + public static void main(String[] args) throws Exception { + syncGetLocation(); + } + + public static void syncGetLocation() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (ConversationModelsClient conversationModelsClient = ConversationModelsClient.create()) { + GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build(); + Location response = conversationModelsClient.getLocation(request); + } + } +} +// [END dialogflow_v2_generated_conversationmodelsclient_getlocation_sync] diff --git a/samples/snippets/generated/com/google/cloud/dialogflow/v2/conversationmodelsclient/listlocations/AsyncListLocations.java b/samples/snippets/generated/com/google/cloud/dialogflow/v2/conversationmodelsclient/listlocations/AsyncListLocations.java new file mode 100644 index 000000000..e1df1ba44 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/dialogflow/v2/conversationmodelsclient/listlocations/AsyncListLocations.java @@ -0,0 +1,51 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.dialogflow.v2.samples; + +// [START dialogflow_v2_generated_conversationmodelsclient_listlocations_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.dialogflow.v2.ConversationModelsClient; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.Location; + +public class AsyncListLocations { + + public static void main(String[] args) throws Exception { + asyncListLocations(); + } + + public static void asyncListLocations() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (ConversationModelsClient conversationModelsClient = ConversationModelsClient.create()) { + ListLocationsRequest request = + ListLocationsRequest.newBuilder() + .setName("name3373707") + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + ApiFuture future = + conversationModelsClient.listLocationsPagedCallable().futureCall(request); + // Do something. + for (Location element : future.get().iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END dialogflow_v2_generated_conversationmodelsclient_listlocations_async] diff --git a/samples/snippets/generated/com/google/cloud/dialogflow/v2/conversationmodelsclient/listlocations/AsyncListLocationsPaged.java b/samples/snippets/generated/com/google/cloud/dialogflow/v2/conversationmodelsclient/listlocations/AsyncListLocationsPaged.java new file mode 100644 index 000000000..29a57d917 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/dialogflow/v2/conversationmodelsclient/listlocations/AsyncListLocationsPaged.java @@ -0,0 +1,59 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.dialogflow.v2.samples; + +// [START dialogflow_v2_generated_conversationmodelsclient_listlocations_paged_async] +import com.google.cloud.dialogflow.v2.ConversationModelsClient; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.ListLocationsResponse; +import com.google.cloud.location.Location; +import com.google.common.base.Strings; + +public class AsyncListLocationsPaged { + + public static void main(String[] args) throws Exception { + asyncListLocationsPaged(); + } + + public static void asyncListLocationsPaged() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (ConversationModelsClient conversationModelsClient = ConversationModelsClient.create()) { + ListLocationsRequest request = + ListLocationsRequest.newBuilder() + .setName("name3373707") + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + while (true) { + ListLocationsResponse response = + conversationModelsClient.listLocationsCallable().call(request); + for (Location element : response.getLocationsList()) { + // doThingsWith(element); + } + String nextPageToken = response.getNextPageToken(); + if (!Strings.isNullOrEmpty(nextPageToken)) { + request = request.toBuilder().setPageToken(nextPageToken).build(); + } else { + break; + } + } + } + } +} +// [END dialogflow_v2_generated_conversationmodelsclient_listlocations_paged_async] diff --git a/samples/snippets/generated/com/google/cloud/dialogflow/v2/conversationmodelsclient/listlocations/SyncListLocations.java b/samples/snippets/generated/com/google/cloud/dialogflow/v2/conversationmodelsclient/listlocations/SyncListLocations.java new file mode 100644 index 000000000..3c41660d4 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/dialogflow/v2/conversationmodelsclient/listlocations/SyncListLocations.java @@ -0,0 +1,47 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.dialogflow.v2.samples; + +// [START dialogflow_v2_generated_conversationmodelsclient_listlocations_sync] +import com.google.cloud.dialogflow.v2.ConversationModelsClient; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.Location; + +public class SyncListLocations { + + public static void main(String[] args) throws Exception { + syncListLocations(); + } + + public static void syncListLocations() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (ConversationModelsClient conversationModelsClient = ConversationModelsClient.create()) { + ListLocationsRequest request = + ListLocationsRequest.newBuilder() + .setName("name3373707") + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + for (Location element : conversationModelsClient.listLocations(request).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END dialogflow_v2_generated_conversationmodelsclient_listlocations_sync] diff --git a/samples/snippets/generated/com/google/cloud/dialogflow/v2/conversationprofilesclient/getlocation/AsyncGetLocation.java b/samples/snippets/generated/com/google/cloud/dialogflow/v2/conversationprofilesclient/getlocation/AsyncGetLocation.java new file mode 100644 index 000000000..cccc89801 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/dialogflow/v2/conversationprofilesclient/getlocation/AsyncGetLocation.java @@ -0,0 +1,44 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.dialogflow.v2.samples; + +// [START dialogflow_v2_generated_conversationprofilesclient_getlocation_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.dialogflow.v2.ConversationProfilesClient; +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.Location; + +public class AsyncGetLocation { + + public static void main(String[] args) throws Exception { + asyncGetLocation(); + } + + public static void asyncGetLocation() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (ConversationProfilesClient conversationProfilesClient = + ConversationProfilesClient.create()) { + GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build(); + ApiFuture future = + conversationProfilesClient.getLocationCallable().futureCall(request); + // Do something. + Location response = future.get(); + } + } +} +// [END dialogflow_v2_generated_conversationprofilesclient_getlocation_async] diff --git a/samples/snippets/generated/com/google/cloud/dialogflow/v2/conversationprofilesclient/getlocation/SyncGetLocation.java b/samples/snippets/generated/com/google/cloud/dialogflow/v2/conversationprofilesclient/getlocation/SyncGetLocation.java new file mode 100644 index 000000000..dc657bee1 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/dialogflow/v2/conversationprofilesclient/getlocation/SyncGetLocation.java @@ -0,0 +1,40 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.dialogflow.v2.samples; + +// [START dialogflow_v2_generated_conversationprofilesclient_getlocation_sync] +import com.google.cloud.dialogflow.v2.ConversationProfilesClient; +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.Location; + +public class SyncGetLocation { + + public static void main(String[] args) throws Exception { + syncGetLocation(); + } + + public static void syncGetLocation() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (ConversationProfilesClient conversationProfilesClient = + ConversationProfilesClient.create()) { + GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build(); + Location response = conversationProfilesClient.getLocation(request); + } + } +} +// [END dialogflow_v2_generated_conversationprofilesclient_getlocation_sync] diff --git a/samples/snippets/generated/com/google/cloud/dialogflow/v2/conversationprofilesclient/listlocations/AsyncListLocations.java b/samples/snippets/generated/com/google/cloud/dialogflow/v2/conversationprofilesclient/listlocations/AsyncListLocations.java new file mode 100644 index 000000000..64170276c --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/dialogflow/v2/conversationprofilesclient/listlocations/AsyncListLocations.java @@ -0,0 +1,52 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.dialogflow.v2.samples; + +// [START dialogflow_v2_generated_conversationprofilesclient_listlocations_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.dialogflow.v2.ConversationProfilesClient; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.Location; + +public class AsyncListLocations { + + public static void main(String[] args) throws Exception { + asyncListLocations(); + } + + public static void asyncListLocations() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (ConversationProfilesClient conversationProfilesClient = + ConversationProfilesClient.create()) { + ListLocationsRequest request = + ListLocationsRequest.newBuilder() + .setName("name3373707") + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + ApiFuture future = + conversationProfilesClient.listLocationsPagedCallable().futureCall(request); + // Do something. + for (Location element : future.get().iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END dialogflow_v2_generated_conversationprofilesclient_listlocations_async] diff --git a/samples/snippets/generated/com/google/cloud/dialogflow/v2/conversationprofilesclient/listlocations/AsyncListLocationsPaged.java b/samples/snippets/generated/com/google/cloud/dialogflow/v2/conversationprofilesclient/listlocations/AsyncListLocationsPaged.java new file mode 100644 index 000000000..bcc161e68 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/dialogflow/v2/conversationprofilesclient/listlocations/AsyncListLocationsPaged.java @@ -0,0 +1,60 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.dialogflow.v2.samples; + +// [START dialogflow_v2_generated_conversationprofilesclient_listlocations_paged_async] +import com.google.cloud.dialogflow.v2.ConversationProfilesClient; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.ListLocationsResponse; +import com.google.cloud.location.Location; +import com.google.common.base.Strings; + +public class AsyncListLocationsPaged { + + public static void main(String[] args) throws Exception { + asyncListLocationsPaged(); + } + + public static void asyncListLocationsPaged() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (ConversationProfilesClient conversationProfilesClient = + ConversationProfilesClient.create()) { + ListLocationsRequest request = + ListLocationsRequest.newBuilder() + .setName("name3373707") + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + while (true) { + ListLocationsResponse response = + conversationProfilesClient.listLocationsCallable().call(request); + for (Location element : response.getLocationsList()) { + // doThingsWith(element); + } + String nextPageToken = response.getNextPageToken(); + if (!Strings.isNullOrEmpty(nextPageToken)) { + request = request.toBuilder().setPageToken(nextPageToken).build(); + } else { + break; + } + } + } + } +} +// [END dialogflow_v2_generated_conversationprofilesclient_listlocations_paged_async] diff --git a/samples/snippets/generated/com/google/cloud/dialogflow/v2/conversationprofilesclient/listlocations/SyncListLocations.java b/samples/snippets/generated/com/google/cloud/dialogflow/v2/conversationprofilesclient/listlocations/SyncListLocations.java new file mode 100644 index 000000000..cc9482ebd --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/dialogflow/v2/conversationprofilesclient/listlocations/SyncListLocations.java @@ -0,0 +1,48 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.dialogflow.v2.samples; + +// [START dialogflow_v2_generated_conversationprofilesclient_listlocations_sync] +import com.google.cloud.dialogflow.v2.ConversationProfilesClient; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.Location; + +public class SyncListLocations { + + public static void main(String[] args) throws Exception { + syncListLocations(); + } + + public static void syncListLocations() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (ConversationProfilesClient conversationProfilesClient = + ConversationProfilesClient.create()) { + ListLocationsRequest request = + ListLocationsRequest.newBuilder() + .setName("name3373707") + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + for (Location element : conversationProfilesClient.listLocations(request).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END dialogflow_v2_generated_conversationprofilesclient_listlocations_sync] diff --git a/samples/snippets/generated/com/google/cloud/dialogflow/v2/conversationsclient/getlocation/AsyncGetLocation.java b/samples/snippets/generated/com/google/cloud/dialogflow/v2/conversationsclient/getlocation/AsyncGetLocation.java new file mode 100644 index 000000000..2cc798913 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/dialogflow/v2/conversationsclient/getlocation/AsyncGetLocation.java @@ -0,0 +1,42 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.dialogflow.v2.samples; + +// [START dialogflow_v2_generated_conversationsclient_getlocation_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.dialogflow.v2.ConversationsClient; +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.Location; + +public class AsyncGetLocation { + + public static void main(String[] args) throws Exception { + asyncGetLocation(); + } + + public static void asyncGetLocation() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (ConversationsClient conversationsClient = ConversationsClient.create()) { + GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build(); + ApiFuture future = conversationsClient.getLocationCallable().futureCall(request); + // Do something. + Location response = future.get(); + } + } +} +// [END dialogflow_v2_generated_conversationsclient_getlocation_async] diff --git a/samples/snippets/generated/com/google/cloud/dialogflow/v2/conversationsclient/getlocation/SyncGetLocation.java b/samples/snippets/generated/com/google/cloud/dialogflow/v2/conversationsclient/getlocation/SyncGetLocation.java new file mode 100644 index 000000000..d50263ad0 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/dialogflow/v2/conversationsclient/getlocation/SyncGetLocation.java @@ -0,0 +1,39 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.dialogflow.v2.samples; + +// [START dialogflow_v2_generated_conversationsclient_getlocation_sync] +import com.google.cloud.dialogflow.v2.ConversationsClient; +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.Location; + +public class SyncGetLocation { + + public static void main(String[] args) throws Exception { + syncGetLocation(); + } + + public static void syncGetLocation() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (ConversationsClient conversationsClient = ConversationsClient.create()) { + GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build(); + Location response = conversationsClient.getLocation(request); + } + } +} +// [END dialogflow_v2_generated_conversationsclient_getlocation_sync] diff --git a/samples/snippets/generated/com/google/cloud/dialogflow/v2/conversationsclient/listlocations/AsyncListLocations.java b/samples/snippets/generated/com/google/cloud/dialogflow/v2/conversationsclient/listlocations/AsyncListLocations.java new file mode 100644 index 000000000..457b40f2f --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/dialogflow/v2/conversationsclient/listlocations/AsyncListLocations.java @@ -0,0 +1,51 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.dialogflow.v2.samples; + +// [START dialogflow_v2_generated_conversationsclient_listlocations_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.dialogflow.v2.ConversationsClient; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.Location; + +public class AsyncListLocations { + + public static void main(String[] args) throws Exception { + asyncListLocations(); + } + + public static void asyncListLocations() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (ConversationsClient conversationsClient = ConversationsClient.create()) { + ListLocationsRequest request = + ListLocationsRequest.newBuilder() + .setName("name3373707") + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + ApiFuture future = + conversationsClient.listLocationsPagedCallable().futureCall(request); + // Do something. + for (Location element : future.get().iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END dialogflow_v2_generated_conversationsclient_listlocations_async] diff --git a/samples/snippets/generated/com/google/cloud/dialogflow/v2/conversationsclient/listlocations/AsyncListLocationsPaged.java b/samples/snippets/generated/com/google/cloud/dialogflow/v2/conversationsclient/listlocations/AsyncListLocationsPaged.java new file mode 100644 index 000000000..12c35f6b6 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/dialogflow/v2/conversationsclient/listlocations/AsyncListLocationsPaged.java @@ -0,0 +1,58 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.dialogflow.v2.samples; + +// [START dialogflow_v2_generated_conversationsclient_listlocations_paged_async] +import com.google.cloud.dialogflow.v2.ConversationsClient; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.ListLocationsResponse; +import com.google.cloud.location.Location; +import com.google.common.base.Strings; + +public class AsyncListLocationsPaged { + + public static void main(String[] args) throws Exception { + asyncListLocationsPaged(); + } + + public static void asyncListLocationsPaged() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (ConversationsClient conversationsClient = ConversationsClient.create()) { + ListLocationsRequest request = + ListLocationsRequest.newBuilder() + .setName("name3373707") + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + while (true) { + ListLocationsResponse response = conversationsClient.listLocationsCallable().call(request); + for (Location element : response.getLocationsList()) { + // doThingsWith(element); + } + String nextPageToken = response.getNextPageToken(); + if (!Strings.isNullOrEmpty(nextPageToken)) { + request = request.toBuilder().setPageToken(nextPageToken).build(); + } else { + break; + } + } + } + } +} +// [END dialogflow_v2_generated_conversationsclient_listlocations_paged_async] diff --git a/samples/snippets/generated/com/google/cloud/dialogflow/v2/conversationsclient/listlocations/SyncListLocations.java b/samples/snippets/generated/com/google/cloud/dialogflow/v2/conversationsclient/listlocations/SyncListLocations.java new file mode 100644 index 000000000..c114767c3 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/dialogflow/v2/conversationsclient/listlocations/SyncListLocations.java @@ -0,0 +1,47 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.dialogflow.v2.samples; + +// [START dialogflow_v2_generated_conversationsclient_listlocations_sync] +import com.google.cloud.dialogflow.v2.ConversationsClient; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.Location; + +public class SyncListLocations { + + public static void main(String[] args) throws Exception { + syncListLocations(); + } + + public static void syncListLocations() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (ConversationsClient conversationsClient = ConversationsClient.create()) { + ListLocationsRequest request = + ListLocationsRequest.newBuilder() + .setName("name3373707") + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + for (Location element : conversationsClient.listLocations(request).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END dialogflow_v2_generated_conversationsclient_listlocations_sync] diff --git a/samples/snippets/generated/com/google/cloud/dialogflow/v2/documentsclient/getlocation/AsyncGetLocation.java b/samples/snippets/generated/com/google/cloud/dialogflow/v2/documentsclient/getlocation/AsyncGetLocation.java new file mode 100644 index 000000000..cbaf3e008 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/dialogflow/v2/documentsclient/getlocation/AsyncGetLocation.java @@ -0,0 +1,42 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.dialogflow.v2.samples; + +// [START dialogflow_v2_generated_documentsclient_getlocation_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.dialogflow.v2.DocumentsClient; +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.Location; + +public class AsyncGetLocation { + + public static void main(String[] args) throws Exception { + asyncGetLocation(); + } + + public static void asyncGetLocation() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DocumentsClient documentsClient = DocumentsClient.create()) { + GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build(); + ApiFuture future = documentsClient.getLocationCallable().futureCall(request); + // Do something. + Location response = future.get(); + } + } +} +// [END dialogflow_v2_generated_documentsclient_getlocation_async] diff --git a/samples/snippets/generated/com/google/cloud/dialogflow/v2/documentsclient/getlocation/SyncGetLocation.java b/samples/snippets/generated/com/google/cloud/dialogflow/v2/documentsclient/getlocation/SyncGetLocation.java new file mode 100644 index 000000000..34addabd4 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/dialogflow/v2/documentsclient/getlocation/SyncGetLocation.java @@ -0,0 +1,39 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.dialogflow.v2.samples; + +// [START dialogflow_v2_generated_documentsclient_getlocation_sync] +import com.google.cloud.dialogflow.v2.DocumentsClient; +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.Location; + +public class SyncGetLocation { + + public static void main(String[] args) throws Exception { + syncGetLocation(); + } + + public static void syncGetLocation() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DocumentsClient documentsClient = DocumentsClient.create()) { + GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build(); + Location response = documentsClient.getLocation(request); + } + } +} +// [END dialogflow_v2_generated_documentsclient_getlocation_sync] diff --git a/samples/snippets/generated/com/google/cloud/dialogflow/v2/documentsclient/listlocations/AsyncListLocations.java b/samples/snippets/generated/com/google/cloud/dialogflow/v2/documentsclient/listlocations/AsyncListLocations.java new file mode 100644 index 000000000..7dffa67a4 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/dialogflow/v2/documentsclient/listlocations/AsyncListLocations.java @@ -0,0 +1,50 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.dialogflow.v2.samples; + +// [START dialogflow_v2_generated_documentsclient_listlocations_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.dialogflow.v2.DocumentsClient; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.Location; + +public class AsyncListLocations { + + public static void main(String[] args) throws Exception { + asyncListLocations(); + } + + public static void asyncListLocations() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DocumentsClient documentsClient = DocumentsClient.create()) { + ListLocationsRequest request = + ListLocationsRequest.newBuilder() + .setName("name3373707") + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + ApiFuture future = documentsClient.listLocationsPagedCallable().futureCall(request); + // Do something. + for (Location element : future.get().iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END dialogflow_v2_generated_documentsclient_listlocations_async] diff --git a/samples/snippets/generated/com/google/cloud/dialogflow/v2/documentsclient/listlocations/AsyncListLocationsPaged.java b/samples/snippets/generated/com/google/cloud/dialogflow/v2/documentsclient/listlocations/AsyncListLocationsPaged.java new file mode 100644 index 000000000..cccaf35fc --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/dialogflow/v2/documentsclient/listlocations/AsyncListLocationsPaged.java @@ -0,0 +1,58 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.dialogflow.v2.samples; + +// [START dialogflow_v2_generated_documentsclient_listlocations_paged_async] +import com.google.cloud.dialogflow.v2.DocumentsClient; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.ListLocationsResponse; +import com.google.cloud.location.Location; +import com.google.common.base.Strings; + +public class AsyncListLocationsPaged { + + public static void main(String[] args) throws Exception { + asyncListLocationsPaged(); + } + + public static void asyncListLocationsPaged() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DocumentsClient documentsClient = DocumentsClient.create()) { + ListLocationsRequest request = + ListLocationsRequest.newBuilder() + .setName("name3373707") + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + while (true) { + ListLocationsResponse response = documentsClient.listLocationsCallable().call(request); + for (Location element : response.getLocationsList()) { + // doThingsWith(element); + } + String nextPageToken = response.getNextPageToken(); + if (!Strings.isNullOrEmpty(nextPageToken)) { + request = request.toBuilder().setPageToken(nextPageToken).build(); + } else { + break; + } + } + } + } +} +// [END dialogflow_v2_generated_documentsclient_listlocations_paged_async] diff --git a/samples/snippets/generated/com/google/cloud/dialogflow/v2/documentsclient/listlocations/SyncListLocations.java b/samples/snippets/generated/com/google/cloud/dialogflow/v2/documentsclient/listlocations/SyncListLocations.java new file mode 100644 index 000000000..26e93c26d --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/dialogflow/v2/documentsclient/listlocations/SyncListLocations.java @@ -0,0 +1,47 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.dialogflow.v2.samples; + +// [START dialogflow_v2_generated_documentsclient_listlocations_sync] +import com.google.cloud.dialogflow.v2.DocumentsClient; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.Location; + +public class SyncListLocations { + + public static void main(String[] args) throws Exception { + syncListLocations(); + } + + public static void syncListLocations() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DocumentsClient documentsClient = DocumentsClient.create()) { + ListLocationsRequest request = + ListLocationsRequest.newBuilder() + .setName("name3373707") + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + for (Location element : documentsClient.listLocations(request).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END dialogflow_v2_generated_documentsclient_listlocations_sync] diff --git a/samples/snippets/generated/com/google/cloud/dialogflow/v2/entitytypesclient/getlocation/AsyncGetLocation.java b/samples/snippets/generated/com/google/cloud/dialogflow/v2/entitytypesclient/getlocation/AsyncGetLocation.java new file mode 100644 index 000000000..d410b5030 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/dialogflow/v2/entitytypesclient/getlocation/AsyncGetLocation.java @@ -0,0 +1,42 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.dialogflow.v2.samples; + +// [START dialogflow_v2_generated_entitytypesclient_getlocation_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.dialogflow.v2.EntityTypesClient; +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.Location; + +public class AsyncGetLocation { + + public static void main(String[] args) throws Exception { + asyncGetLocation(); + } + + public static void asyncGetLocation() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (EntityTypesClient entityTypesClient = EntityTypesClient.create()) { + GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build(); + ApiFuture future = entityTypesClient.getLocationCallable().futureCall(request); + // Do something. + Location response = future.get(); + } + } +} +// [END dialogflow_v2_generated_entitytypesclient_getlocation_async] diff --git a/samples/snippets/generated/com/google/cloud/dialogflow/v2/entitytypesclient/getlocation/SyncGetLocation.java b/samples/snippets/generated/com/google/cloud/dialogflow/v2/entitytypesclient/getlocation/SyncGetLocation.java new file mode 100644 index 000000000..7bb4f399d --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/dialogflow/v2/entitytypesclient/getlocation/SyncGetLocation.java @@ -0,0 +1,39 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.dialogflow.v2.samples; + +// [START dialogflow_v2_generated_entitytypesclient_getlocation_sync] +import com.google.cloud.dialogflow.v2.EntityTypesClient; +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.Location; + +public class SyncGetLocation { + + public static void main(String[] args) throws Exception { + syncGetLocation(); + } + + public static void syncGetLocation() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (EntityTypesClient entityTypesClient = EntityTypesClient.create()) { + GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build(); + Location response = entityTypesClient.getLocation(request); + } + } +} +// [END dialogflow_v2_generated_entitytypesclient_getlocation_sync] diff --git a/samples/snippets/generated/com/google/cloud/dialogflow/v2/entitytypesclient/listlocations/AsyncListLocations.java b/samples/snippets/generated/com/google/cloud/dialogflow/v2/entitytypesclient/listlocations/AsyncListLocations.java new file mode 100644 index 000000000..3abc72880 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/dialogflow/v2/entitytypesclient/listlocations/AsyncListLocations.java @@ -0,0 +1,51 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.dialogflow.v2.samples; + +// [START dialogflow_v2_generated_entitytypesclient_listlocations_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.dialogflow.v2.EntityTypesClient; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.Location; + +public class AsyncListLocations { + + public static void main(String[] args) throws Exception { + asyncListLocations(); + } + + public static void asyncListLocations() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (EntityTypesClient entityTypesClient = EntityTypesClient.create()) { + ListLocationsRequest request = + ListLocationsRequest.newBuilder() + .setName("name3373707") + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + ApiFuture future = + entityTypesClient.listLocationsPagedCallable().futureCall(request); + // Do something. + for (Location element : future.get().iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END dialogflow_v2_generated_entitytypesclient_listlocations_async] diff --git a/samples/snippets/generated/com/google/cloud/dialogflow/v2/entitytypesclient/listlocations/AsyncListLocationsPaged.java b/samples/snippets/generated/com/google/cloud/dialogflow/v2/entitytypesclient/listlocations/AsyncListLocationsPaged.java new file mode 100644 index 000000000..926ccc360 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/dialogflow/v2/entitytypesclient/listlocations/AsyncListLocationsPaged.java @@ -0,0 +1,58 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.dialogflow.v2.samples; + +// [START dialogflow_v2_generated_entitytypesclient_listlocations_paged_async] +import com.google.cloud.dialogflow.v2.EntityTypesClient; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.ListLocationsResponse; +import com.google.cloud.location.Location; +import com.google.common.base.Strings; + +public class AsyncListLocationsPaged { + + public static void main(String[] args) throws Exception { + asyncListLocationsPaged(); + } + + public static void asyncListLocationsPaged() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (EntityTypesClient entityTypesClient = EntityTypesClient.create()) { + ListLocationsRequest request = + ListLocationsRequest.newBuilder() + .setName("name3373707") + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + while (true) { + ListLocationsResponse response = entityTypesClient.listLocationsCallable().call(request); + for (Location element : response.getLocationsList()) { + // doThingsWith(element); + } + String nextPageToken = response.getNextPageToken(); + if (!Strings.isNullOrEmpty(nextPageToken)) { + request = request.toBuilder().setPageToken(nextPageToken).build(); + } else { + break; + } + } + } + } +} +// [END dialogflow_v2_generated_entitytypesclient_listlocations_paged_async] diff --git a/samples/snippets/generated/com/google/cloud/dialogflow/v2/entitytypesclient/listlocations/SyncListLocations.java b/samples/snippets/generated/com/google/cloud/dialogflow/v2/entitytypesclient/listlocations/SyncListLocations.java new file mode 100644 index 000000000..a77bcf965 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/dialogflow/v2/entitytypesclient/listlocations/SyncListLocations.java @@ -0,0 +1,47 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.dialogflow.v2.samples; + +// [START dialogflow_v2_generated_entitytypesclient_listlocations_sync] +import com.google.cloud.dialogflow.v2.EntityTypesClient; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.Location; + +public class SyncListLocations { + + public static void main(String[] args) throws Exception { + syncListLocations(); + } + + public static void syncListLocations() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (EntityTypesClient entityTypesClient = EntityTypesClient.create()) { + ListLocationsRequest request = + ListLocationsRequest.newBuilder() + .setName("name3373707") + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + for (Location element : entityTypesClient.listLocations(request).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END dialogflow_v2_generated_entitytypesclient_listlocations_sync] diff --git a/samples/snippets/generated/com/google/cloud/dialogflow/v2/environmentsclient/getlocation/AsyncGetLocation.java b/samples/snippets/generated/com/google/cloud/dialogflow/v2/environmentsclient/getlocation/AsyncGetLocation.java new file mode 100644 index 000000000..b613518ae --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/dialogflow/v2/environmentsclient/getlocation/AsyncGetLocation.java @@ -0,0 +1,42 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.dialogflow.v2.samples; + +// [START dialogflow_v2_generated_environmentsclient_getlocation_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.dialogflow.v2.EnvironmentsClient; +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.Location; + +public class AsyncGetLocation { + + public static void main(String[] args) throws Exception { + asyncGetLocation(); + } + + public static void asyncGetLocation() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (EnvironmentsClient environmentsClient = EnvironmentsClient.create()) { + GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build(); + ApiFuture future = environmentsClient.getLocationCallable().futureCall(request); + // Do something. + Location response = future.get(); + } + } +} +// [END dialogflow_v2_generated_environmentsclient_getlocation_async] diff --git a/samples/snippets/generated/com/google/cloud/dialogflow/v2/environmentsclient/getlocation/SyncGetLocation.java b/samples/snippets/generated/com/google/cloud/dialogflow/v2/environmentsclient/getlocation/SyncGetLocation.java new file mode 100644 index 000000000..a19e6de71 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/dialogflow/v2/environmentsclient/getlocation/SyncGetLocation.java @@ -0,0 +1,39 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.dialogflow.v2.samples; + +// [START dialogflow_v2_generated_environmentsclient_getlocation_sync] +import com.google.cloud.dialogflow.v2.EnvironmentsClient; +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.Location; + +public class SyncGetLocation { + + public static void main(String[] args) throws Exception { + syncGetLocation(); + } + + public static void syncGetLocation() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (EnvironmentsClient environmentsClient = EnvironmentsClient.create()) { + GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build(); + Location response = environmentsClient.getLocation(request); + } + } +} +// [END dialogflow_v2_generated_environmentsclient_getlocation_sync] diff --git a/samples/snippets/generated/com/google/cloud/dialogflow/v2/environmentsclient/listlocations/AsyncListLocations.java b/samples/snippets/generated/com/google/cloud/dialogflow/v2/environmentsclient/listlocations/AsyncListLocations.java new file mode 100644 index 000000000..77cf6e19a --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/dialogflow/v2/environmentsclient/listlocations/AsyncListLocations.java @@ -0,0 +1,51 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.dialogflow.v2.samples; + +// [START dialogflow_v2_generated_environmentsclient_listlocations_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.dialogflow.v2.EnvironmentsClient; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.Location; + +public class AsyncListLocations { + + public static void main(String[] args) throws Exception { + asyncListLocations(); + } + + public static void asyncListLocations() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (EnvironmentsClient environmentsClient = EnvironmentsClient.create()) { + ListLocationsRequest request = + ListLocationsRequest.newBuilder() + .setName("name3373707") + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + ApiFuture future = + environmentsClient.listLocationsPagedCallable().futureCall(request); + // Do something. + for (Location element : future.get().iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END dialogflow_v2_generated_environmentsclient_listlocations_async] diff --git a/samples/snippets/generated/com/google/cloud/dialogflow/v2/environmentsclient/listlocations/AsyncListLocationsPaged.java b/samples/snippets/generated/com/google/cloud/dialogflow/v2/environmentsclient/listlocations/AsyncListLocationsPaged.java new file mode 100644 index 000000000..6788a52d5 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/dialogflow/v2/environmentsclient/listlocations/AsyncListLocationsPaged.java @@ -0,0 +1,58 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.dialogflow.v2.samples; + +// [START dialogflow_v2_generated_environmentsclient_listlocations_paged_async] +import com.google.cloud.dialogflow.v2.EnvironmentsClient; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.ListLocationsResponse; +import com.google.cloud.location.Location; +import com.google.common.base.Strings; + +public class AsyncListLocationsPaged { + + public static void main(String[] args) throws Exception { + asyncListLocationsPaged(); + } + + public static void asyncListLocationsPaged() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (EnvironmentsClient environmentsClient = EnvironmentsClient.create()) { + ListLocationsRequest request = + ListLocationsRequest.newBuilder() + .setName("name3373707") + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + while (true) { + ListLocationsResponse response = environmentsClient.listLocationsCallable().call(request); + for (Location element : response.getLocationsList()) { + // doThingsWith(element); + } + String nextPageToken = response.getNextPageToken(); + if (!Strings.isNullOrEmpty(nextPageToken)) { + request = request.toBuilder().setPageToken(nextPageToken).build(); + } else { + break; + } + } + } + } +} +// [END dialogflow_v2_generated_environmentsclient_listlocations_paged_async] diff --git a/samples/snippets/generated/com/google/cloud/dialogflow/v2/environmentsclient/listlocations/SyncListLocations.java b/samples/snippets/generated/com/google/cloud/dialogflow/v2/environmentsclient/listlocations/SyncListLocations.java new file mode 100644 index 000000000..4449c7d96 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/dialogflow/v2/environmentsclient/listlocations/SyncListLocations.java @@ -0,0 +1,47 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.dialogflow.v2.samples; + +// [START dialogflow_v2_generated_environmentsclient_listlocations_sync] +import com.google.cloud.dialogflow.v2.EnvironmentsClient; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.Location; + +public class SyncListLocations { + + public static void main(String[] args) throws Exception { + syncListLocations(); + } + + public static void syncListLocations() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (EnvironmentsClient environmentsClient = EnvironmentsClient.create()) { + ListLocationsRequest request = + ListLocationsRequest.newBuilder() + .setName("name3373707") + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + for (Location element : environmentsClient.listLocations(request).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END dialogflow_v2_generated_environmentsclient_listlocations_sync] diff --git a/samples/snippets/generated/com/google/cloud/dialogflow/v2/fulfillmentsclient/getlocation/AsyncGetLocation.java b/samples/snippets/generated/com/google/cloud/dialogflow/v2/fulfillmentsclient/getlocation/AsyncGetLocation.java new file mode 100644 index 000000000..b51ae307e --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/dialogflow/v2/fulfillmentsclient/getlocation/AsyncGetLocation.java @@ -0,0 +1,42 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.dialogflow.v2.samples; + +// [START dialogflow_v2_generated_fulfillmentsclient_getlocation_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.dialogflow.v2.FulfillmentsClient; +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.Location; + +public class AsyncGetLocation { + + public static void main(String[] args) throws Exception { + asyncGetLocation(); + } + + public static void asyncGetLocation() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (FulfillmentsClient fulfillmentsClient = FulfillmentsClient.create()) { + GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build(); + ApiFuture future = fulfillmentsClient.getLocationCallable().futureCall(request); + // Do something. + Location response = future.get(); + } + } +} +// [END dialogflow_v2_generated_fulfillmentsclient_getlocation_async] diff --git a/samples/snippets/generated/com/google/cloud/dialogflow/v2/fulfillmentsclient/getlocation/SyncGetLocation.java b/samples/snippets/generated/com/google/cloud/dialogflow/v2/fulfillmentsclient/getlocation/SyncGetLocation.java new file mode 100644 index 000000000..7acf46cf5 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/dialogflow/v2/fulfillmentsclient/getlocation/SyncGetLocation.java @@ -0,0 +1,39 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.dialogflow.v2.samples; + +// [START dialogflow_v2_generated_fulfillmentsclient_getlocation_sync] +import com.google.cloud.dialogflow.v2.FulfillmentsClient; +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.Location; + +public class SyncGetLocation { + + public static void main(String[] args) throws Exception { + syncGetLocation(); + } + + public static void syncGetLocation() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (FulfillmentsClient fulfillmentsClient = FulfillmentsClient.create()) { + GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build(); + Location response = fulfillmentsClient.getLocation(request); + } + } +} +// [END dialogflow_v2_generated_fulfillmentsclient_getlocation_sync] diff --git a/samples/snippets/generated/com/google/cloud/dialogflow/v2/fulfillmentsclient/listlocations/AsyncListLocations.java b/samples/snippets/generated/com/google/cloud/dialogflow/v2/fulfillmentsclient/listlocations/AsyncListLocations.java new file mode 100644 index 000000000..24d799d40 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/dialogflow/v2/fulfillmentsclient/listlocations/AsyncListLocations.java @@ -0,0 +1,51 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.dialogflow.v2.samples; + +// [START dialogflow_v2_generated_fulfillmentsclient_listlocations_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.dialogflow.v2.FulfillmentsClient; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.Location; + +public class AsyncListLocations { + + public static void main(String[] args) throws Exception { + asyncListLocations(); + } + + public static void asyncListLocations() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (FulfillmentsClient fulfillmentsClient = FulfillmentsClient.create()) { + ListLocationsRequest request = + ListLocationsRequest.newBuilder() + .setName("name3373707") + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + ApiFuture future = + fulfillmentsClient.listLocationsPagedCallable().futureCall(request); + // Do something. + for (Location element : future.get().iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END dialogflow_v2_generated_fulfillmentsclient_listlocations_async] diff --git a/samples/snippets/generated/com/google/cloud/dialogflow/v2/fulfillmentsclient/listlocations/AsyncListLocationsPaged.java b/samples/snippets/generated/com/google/cloud/dialogflow/v2/fulfillmentsclient/listlocations/AsyncListLocationsPaged.java new file mode 100644 index 000000000..2439f4fdc --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/dialogflow/v2/fulfillmentsclient/listlocations/AsyncListLocationsPaged.java @@ -0,0 +1,58 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.dialogflow.v2.samples; + +// [START dialogflow_v2_generated_fulfillmentsclient_listlocations_paged_async] +import com.google.cloud.dialogflow.v2.FulfillmentsClient; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.ListLocationsResponse; +import com.google.cloud.location.Location; +import com.google.common.base.Strings; + +public class AsyncListLocationsPaged { + + public static void main(String[] args) throws Exception { + asyncListLocationsPaged(); + } + + public static void asyncListLocationsPaged() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (FulfillmentsClient fulfillmentsClient = FulfillmentsClient.create()) { + ListLocationsRequest request = + ListLocationsRequest.newBuilder() + .setName("name3373707") + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + while (true) { + ListLocationsResponse response = fulfillmentsClient.listLocationsCallable().call(request); + for (Location element : response.getLocationsList()) { + // doThingsWith(element); + } + String nextPageToken = response.getNextPageToken(); + if (!Strings.isNullOrEmpty(nextPageToken)) { + request = request.toBuilder().setPageToken(nextPageToken).build(); + } else { + break; + } + } + } + } +} +// [END dialogflow_v2_generated_fulfillmentsclient_listlocations_paged_async] diff --git a/samples/snippets/generated/com/google/cloud/dialogflow/v2/fulfillmentsclient/listlocations/SyncListLocations.java b/samples/snippets/generated/com/google/cloud/dialogflow/v2/fulfillmentsclient/listlocations/SyncListLocations.java new file mode 100644 index 000000000..8673dcc3b --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/dialogflow/v2/fulfillmentsclient/listlocations/SyncListLocations.java @@ -0,0 +1,47 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.dialogflow.v2.samples; + +// [START dialogflow_v2_generated_fulfillmentsclient_listlocations_sync] +import com.google.cloud.dialogflow.v2.FulfillmentsClient; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.Location; + +public class SyncListLocations { + + public static void main(String[] args) throws Exception { + syncListLocations(); + } + + public static void syncListLocations() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (FulfillmentsClient fulfillmentsClient = FulfillmentsClient.create()) { + ListLocationsRequest request = + ListLocationsRequest.newBuilder() + .setName("name3373707") + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + for (Location element : fulfillmentsClient.listLocations(request).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END dialogflow_v2_generated_fulfillmentsclient_listlocations_sync] diff --git a/samples/snippets/generated/com/google/cloud/dialogflow/v2/intentsclient/getlocation/AsyncGetLocation.java b/samples/snippets/generated/com/google/cloud/dialogflow/v2/intentsclient/getlocation/AsyncGetLocation.java new file mode 100644 index 000000000..66147f333 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/dialogflow/v2/intentsclient/getlocation/AsyncGetLocation.java @@ -0,0 +1,42 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.dialogflow.v2.samples; + +// [START dialogflow_v2_generated_intentsclient_getlocation_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.dialogflow.v2.IntentsClient; +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.Location; + +public class AsyncGetLocation { + + public static void main(String[] args) throws Exception { + asyncGetLocation(); + } + + public static void asyncGetLocation() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (IntentsClient intentsClient = IntentsClient.create()) { + GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build(); + ApiFuture future = intentsClient.getLocationCallable().futureCall(request); + // Do something. + Location response = future.get(); + } + } +} +// [END dialogflow_v2_generated_intentsclient_getlocation_async] diff --git a/samples/snippets/generated/com/google/cloud/dialogflow/v2/intentsclient/getlocation/SyncGetLocation.java b/samples/snippets/generated/com/google/cloud/dialogflow/v2/intentsclient/getlocation/SyncGetLocation.java new file mode 100644 index 000000000..03117a9cb --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/dialogflow/v2/intentsclient/getlocation/SyncGetLocation.java @@ -0,0 +1,39 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.dialogflow.v2.samples; + +// [START dialogflow_v2_generated_intentsclient_getlocation_sync] +import com.google.cloud.dialogflow.v2.IntentsClient; +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.Location; + +public class SyncGetLocation { + + public static void main(String[] args) throws Exception { + syncGetLocation(); + } + + public static void syncGetLocation() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (IntentsClient intentsClient = IntentsClient.create()) { + GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build(); + Location response = intentsClient.getLocation(request); + } + } +} +// [END dialogflow_v2_generated_intentsclient_getlocation_sync] diff --git a/samples/snippets/generated/com/google/cloud/dialogflow/v2/intentsclient/listlocations/AsyncListLocations.java b/samples/snippets/generated/com/google/cloud/dialogflow/v2/intentsclient/listlocations/AsyncListLocations.java new file mode 100644 index 000000000..fcc7757d7 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/dialogflow/v2/intentsclient/listlocations/AsyncListLocations.java @@ -0,0 +1,50 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.dialogflow.v2.samples; + +// [START dialogflow_v2_generated_intentsclient_listlocations_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.dialogflow.v2.IntentsClient; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.Location; + +public class AsyncListLocations { + + public static void main(String[] args) throws Exception { + asyncListLocations(); + } + + public static void asyncListLocations() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (IntentsClient intentsClient = IntentsClient.create()) { + ListLocationsRequest request = + ListLocationsRequest.newBuilder() + .setName("name3373707") + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + ApiFuture future = intentsClient.listLocationsPagedCallable().futureCall(request); + // Do something. + for (Location element : future.get().iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END dialogflow_v2_generated_intentsclient_listlocations_async] diff --git a/samples/snippets/generated/com/google/cloud/dialogflow/v2/intentsclient/listlocations/AsyncListLocationsPaged.java b/samples/snippets/generated/com/google/cloud/dialogflow/v2/intentsclient/listlocations/AsyncListLocationsPaged.java new file mode 100644 index 000000000..40c08f2ea --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/dialogflow/v2/intentsclient/listlocations/AsyncListLocationsPaged.java @@ -0,0 +1,58 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.dialogflow.v2.samples; + +// [START dialogflow_v2_generated_intentsclient_listlocations_paged_async] +import com.google.cloud.dialogflow.v2.IntentsClient; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.ListLocationsResponse; +import com.google.cloud.location.Location; +import com.google.common.base.Strings; + +public class AsyncListLocationsPaged { + + public static void main(String[] args) throws Exception { + asyncListLocationsPaged(); + } + + public static void asyncListLocationsPaged() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (IntentsClient intentsClient = IntentsClient.create()) { + ListLocationsRequest request = + ListLocationsRequest.newBuilder() + .setName("name3373707") + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + while (true) { + ListLocationsResponse response = intentsClient.listLocationsCallable().call(request); + for (Location element : response.getLocationsList()) { + // doThingsWith(element); + } + String nextPageToken = response.getNextPageToken(); + if (!Strings.isNullOrEmpty(nextPageToken)) { + request = request.toBuilder().setPageToken(nextPageToken).build(); + } else { + break; + } + } + } + } +} +// [END dialogflow_v2_generated_intentsclient_listlocations_paged_async] diff --git a/samples/snippets/generated/com/google/cloud/dialogflow/v2/intentsclient/listlocations/SyncListLocations.java b/samples/snippets/generated/com/google/cloud/dialogflow/v2/intentsclient/listlocations/SyncListLocations.java new file mode 100644 index 000000000..ea4d23409 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/dialogflow/v2/intentsclient/listlocations/SyncListLocations.java @@ -0,0 +1,47 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.dialogflow.v2.samples; + +// [START dialogflow_v2_generated_intentsclient_listlocations_sync] +import com.google.cloud.dialogflow.v2.IntentsClient; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.Location; + +public class SyncListLocations { + + public static void main(String[] args) throws Exception { + syncListLocations(); + } + + public static void syncListLocations() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (IntentsClient intentsClient = IntentsClient.create()) { + ListLocationsRequest request = + ListLocationsRequest.newBuilder() + .setName("name3373707") + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + for (Location element : intentsClient.listLocations(request).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END dialogflow_v2_generated_intentsclient_listlocations_sync] diff --git a/samples/snippets/generated/com/google/cloud/dialogflow/v2/knowledgebasesclient/getlocation/AsyncGetLocation.java b/samples/snippets/generated/com/google/cloud/dialogflow/v2/knowledgebasesclient/getlocation/AsyncGetLocation.java new file mode 100644 index 000000000..d65e4a866 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/dialogflow/v2/knowledgebasesclient/getlocation/AsyncGetLocation.java @@ -0,0 +1,42 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.dialogflow.v2.samples; + +// [START dialogflow_v2_generated_knowledgebasesclient_getlocation_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.dialogflow.v2.KnowledgeBasesClient; +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.Location; + +public class AsyncGetLocation { + + public static void main(String[] args) throws Exception { + asyncGetLocation(); + } + + public static void asyncGetLocation() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (KnowledgeBasesClient knowledgeBasesClient = KnowledgeBasesClient.create()) { + GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build(); + ApiFuture future = knowledgeBasesClient.getLocationCallable().futureCall(request); + // Do something. + Location response = future.get(); + } + } +} +// [END dialogflow_v2_generated_knowledgebasesclient_getlocation_async] diff --git a/samples/snippets/generated/com/google/cloud/dialogflow/v2/knowledgebasesclient/getlocation/SyncGetLocation.java b/samples/snippets/generated/com/google/cloud/dialogflow/v2/knowledgebasesclient/getlocation/SyncGetLocation.java new file mode 100644 index 000000000..585f05525 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/dialogflow/v2/knowledgebasesclient/getlocation/SyncGetLocation.java @@ -0,0 +1,39 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.dialogflow.v2.samples; + +// [START dialogflow_v2_generated_knowledgebasesclient_getlocation_sync] +import com.google.cloud.dialogflow.v2.KnowledgeBasesClient; +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.Location; + +public class SyncGetLocation { + + public static void main(String[] args) throws Exception { + syncGetLocation(); + } + + public static void syncGetLocation() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (KnowledgeBasesClient knowledgeBasesClient = KnowledgeBasesClient.create()) { + GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build(); + Location response = knowledgeBasesClient.getLocation(request); + } + } +} +// [END dialogflow_v2_generated_knowledgebasesclient_getlocation_sync] diff --git a/samples/snippets/generated/com/google/cloud/dialogflow/v2/knowledgebasesclient/listlocations/AsyncListLocations.java b/samples/snippets/generated/com/google/cloud/dialogflow/v2/knowledgebasesclient/listlocations/AsyncListLocations.java new file mode 100644 index 000000000..758dc195d --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/dialogflow/v2/knowledgebasesclient/listlocations/AsyncListLocations.java @@ -0,0 +1,51 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.dialogflow.v2.samples; + +// [START dialogflow_v2_generated_knowledgebasesclient_listlocations_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.dialogflow.v2.KnowledgeBasesClient; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.Location; + +public class AsyncListLocations { + + public static void main(String[] args) throws Exception { + asyncListLocations(); + } + + public static void asyncListLocations() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (KnowledgeBasesClient knowledgeBasesClient = KnowledgeBasesClient.create()) { + ListLocationsRequest request = + ListLocationsRequest.newBuilder() + .setName("name3373707") + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + ApiFuture future = + knowledgeBasesClient.listLocationsPagedCallable().futureCall(request); + // Do something. + for (Location element : future.get().iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END dialogflow_v2_generated_knowledgebasesclient_listlocations_async] diff --git a/samples/snippets/generated/com/google/cloud/dialogflow/v2/knowledgebasesclient/listlocations/AsyncListLocationsPaged.java b/samples/snippets/generated/com/google/cloud/dialogflow/v2/knowledgebasesclient/listlocations/AsyncListLocationsPaged.java new file mode 100644 index 000000000..549c83b18 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/dialogflow/v2/knowledgebasesclient/listlocations/AsyncListLocationsPaged.java @@ -0,0 +1,58 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.dialogflow.v2.samples; + +// [START dialogflow_v2_generated_knowledgebasesclient_listlocations_paged_async] +import com.google.cloud.dialogflow.v2.KnowledgeBasesClient; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.ListLocationsResponse; +import com.google.cloud.location.Location; +import com.google.common.base.Strings; + +public class AsyncListLocationsPaged { + + public static void main(String[] args) throws Exception { + asyncListLocationsPaged(); + } + + public static void asyncListLocationsPaged() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (KnowledgeBasesClient knowledgeBasesClient = KnowledgeBasesClient.create()) { + ListLocationsRequest request = + ListLocationsRequest.newBuilder() + .setName("name3373707") + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + while (true) { + ListLocationsResponse response = knowledgeBasesClient.listLocationsCallable().call(request); + for (Location element : response.getLocationsList()) { + // doThingsWith(element); + } + String nextPageToken = response.getNextPageToken(); + if (!Strings.isNullOrEmpty(nextPageToken)) { + request = request.toBuilder().setPageToken(nextPageToken).build(); + } else { + break; + } + } + } + } +} +// [END dialogflow_v2_generated_knowledgebasesclient_listlocations_paged_async] diff --git a/samples/snippets/generated/com/google/cloud/dialogflow/v2/knowledgebasesclient/listlocations/SyncListLocations.java b/samples/snippets/generated/com/google/cloud/dialogflow/v2/knowledgebasesclient/listlocations/SyncListLocations.java new file mode 100644 index 000000000..6989a1a83 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/dialogflow/v2/knowledgebasesclient/listlocations/SyncListLocations.java @@ -0,0 +1,47 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.dialogflow.v2.samples; + +// [START dialogflow_v2_generated_knowledgebasesclient_listlocations_sync] +import com.google.cloud.dialogflow.v2.KnowledgeBasesClient; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.Location; + +public class SyncListLocations { + + public static void main(String[] args) throws Exception { + syncListLocations(); + } + + public static void syncListLocations() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (KnowledgeBasesClient knowledgeBasesClient = KnowledgeBasesClient.create()) { + ListLocationsRequest request = + ListLocationsRequest.newBuilder() + .setName("name3373707") + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + for (Location element : knowledgeBasesClient.listLocations(request).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END dialogflow_v2_generated_knowledgebasesclient_listlocations_sync] diff --git a/samples/snippets/generated/com/google/cloud/dialogflow/v2/participantsclient/getlocation/AsyncGetLocation.java b/samples/snippets/generated/com/google/cloud/dialogflow/v2/participantsclient/getlocation/AsyncGetLocation.java new file mode 100644 index 000000000..3ee613ba7 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/dialogflow/v2/participantsclient/getlocation/AsyncGetLocation.java @@ -0,0 +1,42 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.dialogflow.v2.samples; + +// [START dialogflow_v2_generated_participantsclient_getlocation_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.dialogflow.v2.ParticipantsClient; +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.Location; + +public class AsyncGetLocation { + + public static void main(String[] args) throws Exception { + asyncGetLocation(); + } + + public static void asyncGetLocation() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (ParticipantsClient participantsClient = ParticipantsClient.create()) { + GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build(); + ApiFuture future = participantsClient.getLocationCallable().futureCall(request); + // Do something. + Location response = future.get(); + } + } +} +// [END dialogflow_v2_generated_participantsclient_getlocation_async] diff --git a/samples/snippets/generated/com/google/cloud/dialogflow/v2/participantsclient/getlocation/SyncGetLocation.java b/samples/snippets/generated/com/google/cloud/dialogflow/v2/participantsclient/getlocation/SyncGetLocation.java new file mode 100644 index 000000000..7a30a280c --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/dialogflow/v2/participantsclient/getlocation/SyncGetLocation.java @@ -0,0 +1,39 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.dialogflow.v2.samples; + +// [START dialogflow_v2_generated_participantsclient_getlocation_sync] +import com.google.cloud.dialogflow.v2.ParticipantsClient; +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.Location; + +public class SyncGetLocation { + + public static void main(String[] args) throws Exception { + syncGetLocation(); + } + + public static void syncGetLocation() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (ParticipantsClient participantsClient = ParticipantsClient.create()) { + GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build(); + Location response = participantsClient.getLocation(request); + } + } +} +// [END dialogflow_v2_generated_participantsclient_getlocation_sync] diff --git a/samples/snippets/generated/com/google/cloud/dialogflow/v2/participantsclient/listlocations/AsyncListLocations.java b/samples/snippets/generated/com/google/cloud/dialogflow/v2/participantsclient/listlocations/AsyncListLocations.java new file mode 100644 index 000000000..63f402035 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/dialogflow/v2/participantsclient/listlocations/AsyncListLocations.java @@ -0,0 +1,51 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.dialogflow.v2.samples; + +// [START dialogflow_v2_generated_participantsclient_listlocations_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.dialogflow.v2.ParticipantsClient; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.Location; + +public class AsyncListLocations { + + public static void main(String[] args) throws Exception { + asyncListLocations(); + } + + public static void asyncListLocations() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (ParticipantsClient participantsClient = ParticipantsClient.create()) { + ListLocationsRequest request = + ListLocationsRequest.newBuilder() + .setName("name3373707") + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + ApiFuture future = + participantsClient.listLocationsPagedCallable().futureCall(request); + // Do something. + for (Location element : future.get().iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END dialogflow_v2_generated_participantsclient_listlocations_async] diff --git a/samples/snippets/generated/com/google/cloud/dialogflow/v2/participantsclient/listlocations/AsyncListLocationsPaged.java b/samples/snippets/generated/com/google/cloud/dialogflow/v2/participantsclient/listlocations/AsyncListLocationsPaged.java new file mode 100644 index 000000000..6b5f13a72 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/dialogflow/v2/participantsclient/listlocations/AsyncListLocationsPaged.java @@ -0,0 +1,58 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.dialogflow.v2.samples; + +// [START dialogflow_v2_generated_participantsclient_listlocations_paged_async] +import com.google.cloud.dialogflow.v2.ParticipantsClient; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.ListLocationsResponse; +import com.google.cloud.location.Location; +import com.google.common.base.Strings; + +public class AsyncListLocationsPaged { + + public static void main(String[] args) throws Exception { + asyncListLocationsPaged(); + } + + public static void asyncListLocationsPaged() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (ParticipantsClient participantsClient = ParticipantsClient.create()) { + ListLocationsRequest request = + ListLocationsRequest.newBuilder() + .setName("name3373707") + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + while (true) { + ListLocationsResponse response = participantsClient.listLocationsCallable().call(request); + for (Location element : response.getLocationsList()) { + // doThingsWith(element); + } + String nextPageToken = response.getNextPageToken(); + if (!Strings.isNullOrEmpty(nextPageToken)) { + request = request.toBuilder().setPageToken(nextPageToken).build(); + } else { + break; + } + } + } + } +} +// [END dialogflow_v2_generated_participantsclient_listlocations_paged_async] diff --git a/samples/snippets/generated/com/google/cloud/dialogflow/v2/participantsclient/listlocations/SyncListLocations.java b/samples/snippets/generated/com/google/cloud/dialogflow/v2/participantsclient/listlocations/SyncListLocations.java new file mode 100644 index 000000000..f4c39ec42 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/dialogflow/v2/participantsclient/listlocations/SyncListLocations.java @@ -0,0 +1,47 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.dialogflow.v2.samples; + +// [START dialogflow_v2_generated_participantsclient_listlocations_sync] +import com.google.cloud.dialogflow.v2.ParticipantsClient; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.Location; + +public class SyncListLocations { + + public static void main(String[] args) throws Exception { + syncListLocations(); + } + + public static void syncListLocations() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (ParticipantsClient participantsClient = ParticipantsClient.create()) { + ListLocationsRequest request = + ListLocationsRequest.newBuilder() + .setName("name3373707") + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + for (Location element : participantsClient.listLocations(request).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END dialogflow_v2_generated_participantsclient_listlocations_sync] diff --git a/samples/snippets/generated/com/google/cloud/dialogflow/v2/sessionentitytypesclient/getlocation/AsyncGetLocation.java b/samples/snippets/generated/com/google/cloud/dialogflow/v2/sessionentitytypesclient/getlocation/AsyncGetLocation.java new file mode 100644 index 000000000..17d7aa6d8 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/dialogflow/v2/sessionentitytypesclient/getlocation/AsyncGetLocation.java @@ -0,0 +1,43 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.dialogflow.v2.samples; + +// [START dialogflow_v2_generated_sessionentitytypesclient_getlocation_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.dialogflow.v2.SessionEntityTypesClient; +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.Location; + +public class AsyncGetLocation { + + public static void main(String[] args) throws Exception { + asyncGetLocation(); + } + + public static void asyncGetLocation() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (SessionEntityTypesClient sessionEntityTypesClient = SessionEntityTypesClient.create()) { + GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build(); + ApiFuture future = + sessionEntityTypesClient.getLocationCallable().futureCall(request); + // Do something. + Location response = future.get(); + } + } +} +// [END dialogflow_v2_generated_sessionentitytypesclient_getlocation_async] diff --git a/samples/snippets/generated/com/google/cloud/dialogflow/v2/sessionentitytypesclient/getlocation/SyncGetLocation.java b/samples/snippets/generated/com/google/cloud/dialogflow/v2/sessionentitytypesclient/getlocation/SyncGetLocation.java new file mode 100644 index 000000000..14d167ba6 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/dialogflow/v2/sessionentitytypesclient/getlocation/SyncGetLocation.java @@ -0,0 +1,39 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.dialogflow.v2.samples; + +// [START dialogflow_v2_generated_sessionentitytypesclient_getlocation_sync] +import com.google.cloud.dialogflow.v2.SessionEntityTypesClient; +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.Location; + +public class SyncGetLocation { + + public static void main(String[] args) throws Exception { + syncGetLocation(); + } + + public static void syncGetLocation() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (SessionEntityTypesClient sessionEntityTypesClient = SessionEntityTypesClient.create()) { + GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build(); + Location response = sessionEntityTypesClient.getLocation(request); + } + } +} +// [END dialogflow_v2_generated_sessionentitytypesclient_getlocation_sync] diff --git a/samples/snippets/generated/com/google/cloud/dialogflow/v2/sessionentitytypesclient/listlocations/AsyncListLocations.java b/samples/snippets/generated/com/google/cloud/dialogflow/v2/sessionentitytypesclient/listlocations/AsyncListLocations.java new file mode 100644 index 000000000..eaf457525 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/dialogflow/v2/sessionentitytypesclient/listlocations/AsyncListLocations.java @@ -0,0 +1,51 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.dialogflow.v2.samples; + +// [START dialogflow_v2_generated_sessionentitytypesclient_listlocations_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.dialogflow.v2.SessionEntityTypesClient; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.Location; + +public class AsyncListLocations { + + public static void main(String[] args) throws Exception { + asyncListLocations(); + } + + public static void asyncListLocations() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (SessionEntityTypesClient sessionEntityTypesClient = SessionEntityTypesClient.create()) { + ListLocationsRequest request = + ListLocationsRequest.newBuilder() + .setName("name3373707") + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + ApiFuture future = + sessionEntityTypesClient.listLocationsPagedCallable().futureCall(request); + // Do something. + for (Location element : future.get().iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END dialogflow_v2_generated_sessionentitytypesclient_listlocations_async] diff --git a/samples/snippets/generated/com/google/cloud/dialogflow/v2/sessionentitytypesclient/listlocations/AsyncListLocationsPaged.java b/samples/snippets/generated/com/google/cloud/dialogflow/v2/sessionentitytypesclient/listlocations/AsyncListLocationsPaged.java new file mode 100644 index 000000000..1fe08ec70 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/dialogflow/v2/sessionentitytypesclient/listlocations/AsyncListLocationsPaged.java @@ -0,0 +1,59 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.dialogflow.v2.samples; + +// [START dialogflow_v2_generated_sessionentitytypesclient_listlocations_paged_async] +import com.google.cloud.dialogflow.v2.SessionEntityTypesClient; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.ListLocationsResponse; +import com.google.cloud.location.Location; +import com.google.common.base.Strings; + +public class AsyncListLocationsPaged { + + public static void main(String[] args) throws Exception { + asyncListLocationsPaged(); + } + + public static void asyncListLocationsPaged() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (SessionEntityTypesClient sessionEntityTypesClient = SessionEntityTypesClient.create()) { + ListLocationsRequest request = + ListLocationsRequest.newBuilder() + .setName("name3373707") + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + while (true) { + ListLocationsResponse response = + sessionEntityTypesClient.listLocationsCallable().call(request); + for (Location element : response.getLocationsList()) { + // doThingsWith(element); + } + String nextPageToken = response.getNextPageToken(); + if (!Strings.isNullOrEmpty(nextPageToken)) { + request = request.toBuilder().setPageToken(nextPageToken).build(); + } else { + break; + } + } + } + } +} +// [END dialogflow_v2_generated_sessionentitytypesclient_listlocations_paged_async] diff --git a/samples/snippets/generated/com/google/cloud/dialogflow/v2/sessionentitytypesclient/listlocations/SyncListLocations.java b/samples/snippets/generated/com/google/cloud/dialogflow/v2/sessionentitytypesclient/listlocations/SyncListLocations.java new file mode 100644 index 000000000..766f238f9 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/dialogflow/v2/sessionentitytypesclient/listlocations/SyncListLocations.java @@ -0,0 +1,47 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.dialogflow.v2.samples; + +// [START dialogflow_v2_generated_sessionentitytypesclient_listlocations_sync] +import com.google.cloud.dialogflow.v2.SessionEntityTypesClient; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.Location; + +public class SyncListLocations { + + public static void main(String[] args) throws Exception { + syncListLocations(); + } + + public static void syncListLocations() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (SessionEntityTypesClient sessionEntityTypesClient = SessionEntityTypesClient.create()) { + ListLocationsRequest request = + ListLocationsRequest.newBuilder() + .setName("name3373707") + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + for (Location element : sessionEntityTypesClient.listLocations(request).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END dialogflow_v2_generated_sessionentitytypesclient_listlocations_sync] diff --git a/samples/snippets/generated/com/google/cloud/dialogflow/v2/sessionsclient/getlocation/AsyncGetLocation.java b/samples/snippets/generated/com/google/cloud/dialogflow/v2/sessionsclient/getlocation/AsyncGetLocation.java new file mode 100644 index 000000000..10548a56f --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/dialogflow/v2/sessionsclient/getlocation/AsyncGetLocation.java @@ -0,0 +1,42 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.dialogflow.v2.samples; + +// [START dialogflow_v2_generated_sessionsclient_getlocation_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.dialogflow.v2.SessionsClient; +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.Location; + +public class AsyncGetLocation { + + public static void main(String[] args) throws Exception { + asyncGetLocation(); + } + + public static void asyncGetLocation() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (SessionsClient sessionsClient = SessionsClient.create()) { + GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build(); + ApiFuture future = sessionsClient.getLocationCallable().futureCall(request); + // Do something. + Location response = future.get(); + } + } +} +// [END dialogflow_v2_generated_sessionsclient_getlocation_async] diff --git a/samples/snippets/generated/com/google/cloud/dialogflow/v2/sessionsclient/getlocation/SyncGetLocation.java b/samples/snippets/generated/com/google/cloud/dialogflow/v2/sessionsclient/getlocation/SyncGetLocation.java new file mode 100644 index 000000000..8d5332cbb --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/dialogflow/v2/sessionsclient/getlocation/SyncGetLocation.java @@ -0,0 +1,39 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.dialogflow.v2.samples; + +// [START dialogflow_v2_generated_sessionsclient_getlocation_sync] +import com.google.cloud.dialogflow.v2.SessionsClient; +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.Location; + +public class SyncGetLocation { + + public static void main(String[] args) throws Exception { + syncGetLocation(); + } + + public static void syncGetLocation() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (SessionsClient sessionsClient = SessionsClient.create()) { + GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build(); + Location response = sessionsClient.getLocation(request); + } + } +} +// [END dialogflow_v2_generated_sessionsclient_getlocation_sync] diff --git a/samples/snippets/generated/com/google/cloud/dialogflow/v2/sessionsclient/listlocations/AsyncListLocations.java b/samples/snippets/generated/com/google/cloud/dialogflow/v2/sessionsclient/listlocations/AsyncListLocations.java new file mode 100644 index 000000000..ecac25f8b --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/dialogflow/v2/sessionsclient/listlocations/AsyncListLocations.java @@ -0,0 +1,50 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.dialogflow.v2.samples; + +// [START dialogflow_v2_generated_sessionsclient_listlocations_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.dialogflow.v2.SessionsClient; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.Location; + +public class AsyncListLocations { + + public static void main(String[] args) throws Exception { + asyncListLocations(); + } + + public static void asyncListLocations() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (SessionsClient sessionsClient = SessionsClient.create()) { + ListLocationsRequest request = + ListLocationsRequest.newBuilder() + .setName("name3373707") + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + ApiFuture future = sessionsClient.listLocationsPagedCallable().futureCall(request); + // Do something. + for (Location element : future.get().iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END dialogflow_v2_generated_sessionsclient_listlocations_async] diff --git a/samples/snippets/generated/com/google/cloud/dialogflow/v2/sessionsclient/listlocations/AsyncListLocationsPaged.java b/samples/snippets/generated/com/google/cloud/dialogflow/v2/sessionsclient/listlocations/AsyncListLocationsPaged.java new file mode 100644 index 000000000..6310e5320 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/dialogflow/v2/sessionsclient/listlocations/AsyncListLocationsPaged.java @@ -0,0 +1,58 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.dialogflow.v2.samples; + +// [START dialogflow_v2_generated_sessionsclient_listlocations_paged_async] +import com.google.cloud.dialogflow.v2.SessionsClient; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.ListLocationsResponse; +import com.google.cloud.location.Location; +import com.google.common.base.Strings; + +public class AsyncListLocationsPaged { + + public static void main(String[] args) throws Exception { + asyncListLocationsPaged(); + } + + public static void asyncListLocationsPaged() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (SessionsClient sessionsClient = SessionsClient.create()) { + ListLocationsRequest request = + ListLocationsRequest.newBuilder() + .setName("name3373707") + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + while (true) { + ListLocationsResponse response = sessionsClient.listLocationsCallable().call(request); + for (Location element : response.getLocationsList()) { + // doThingsWith(element); + } + String nextPageToken = response.getNextPageToken(); + if (!Strings.isNullOrEmpty(nextPageToken)) { + request = request.toBuilder().setPageToken(nextPageToken).build(); + } else { + break; + } + } + } + } +} +// [END dialogflow_v2_generated_sessionsclient_listlocations_paged_async] diff --git a/samples/snippets/generated/com/google/cloud/dialogflow/v2/sessionsclient/listlocations/SyncListLocations.java b/samples/snippets/generated/com/google/cloud/dialogflow/v2/sessionsclient/listlocations/SyncListLocations.java new file mode 100644 index 000000000..1486328e5 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/dialogflow/v2/sessionsclient/listlocations/SyncListLocations.java @@ -0,0 +1,47 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.dialogflow.v2.samples; + +// [START dialogflow_v2_generated_sessionsclient_listlocations_sync] +import com.google.cloud.dialogflow.v2.SessionsClient; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.Location; + +public class SyncListLocations { + + public static void main(String[] args) throws Exception { + syncListLocations(); + } + + public static void syncListLocations() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (SessionsClient sessionsClient = SessionsClient.create()) { + ListLocationsRequest request = + ListLocationsRequest.newBuilder() + .setName("name3373707") + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + for (Location element : sessionsClient.listLocations(request).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END dialogflow_v2_generated_sessionsclient_listlocations_sync] diff --git a/samples/snippets/generated/com/google/cloud/dialogflow/v2/versionsclient/getlocation/AsyncGetLocation.java b/samples/snippets/generated/com/google/cloud/dialogflow/v2/versionsclient/getlocation/AsyncGetLocation.java new file mode 100644 index 000000000..a68671b46 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/dialogflow/v2/versionsclient/getlocation/AsyncGetLocation.java @@ -0,0 +1,42 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.dialogflow.v2.samples; + +// [START dialogflow_v2_generated_versionsclient_getlocation_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.dialogflow.v2.VersionsClient; +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.Location; + +public class AsyncGetLocation { + + public static void main(String[] args) throws Exception { + asyncGetLocation(); + } + + public static void asyncGetLocation() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (VersionsClient versionsClient = VersionsClient.create()) { + GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build(); + ApiFuture future = versionsClient.getLocationCallable().futureCall(request); + // Do something. + Location response = future.get(); + } + } +} +// [END dialogflow_v2_generated_versionsclient_getlocation_async] diff --git a/samples/snippets/generated/com/google/cloud/dialogflow/v2/versionsclient/getlocation/SyncGetLocation.java b/samples/snippets/generated/com/google/cloud/dialogflow/v2/versionsclient/getlocation/SyncGetLocation.java new file mode 100644 index 000000000..abd521dc3 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/dialogflow/v2/versionsclient/getlocation/SyncGetLocation.java @@ -0,0 +1,39 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.dialogflow.v2.samples; + +// [START dialogflow_v2_generated_versionsclient_getlocation_sync] +import com.google.cloud.dialogflow.v2.VersionsClient; +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.Location; + +public class SyncGetLocation { + + public static void main(String[] args) throws Exception { + syncGetLocation(); + } + + public static void syncGetLocation() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (VersionsClient versionsClient = VersionsClient.create()) { + GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build(); + Location response = versionsClient.getLocation(request); + } + } +} +// [END dialogflow_v2_generated_versionsclient_getlocation_sync] diff --git a/samples/snippets/generated/com/google/cloud/dialogflow/v2/versionsclient/listlocations/AsyncListLocations.java b/samples/snippets/generated/com/google/cloud/dialogflow/v2/versionsclient/listlocations/AsyncListLocations.java new file mode 100644 index 000000000..eacea7807 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/dialogflow/v2/versionsclient/listlocations/AsyncListLocations.java @@ -0,0 +1,50 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.dialogflow.v2.samples; + +// [START dialogflow_v2_generated_versionsclient_listlocations_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.dialogflow.v2.VersionsClient; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.Location; + +public class AsyncListLocations { + + public static void main(String[] args) throws Exception { + asyncListLocations(); + } + + public static void asyncListLocations() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (VersionsClient versionsClient = VersionsClient.create()) { + ListLocationsRequest request = + ListLocationsRequest.newBuilder() + .setName("name3373707") + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + ApiFuture future = versionsClient.listLocationsPagedCallable().futureCall(request); + // Do something. + for (Location element : future.get().iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END dialogflow_v2_generated_versionsclient_listlocations_async] diff --git a/samples/snippets/generated/com/google/cloud/dialogflow/v2/versionsclient/listlocations/AsyncListLocationsPaged.java b/samples/snippets/generated/com/google/cloud/dialogflow/v2/versionsclient/listlocations/AsyncListLocationsPaged.java new file mode 100644 index 000000000..7ea5c57ad --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/dialogflow/v2/versionsclient/listlocations/AsyncListLocationsPaged.java @@ -0,0 +1,58 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.dialogflow.v2.samples; + +// [START dialogflow_v2_generated_versionsclient_listlocations_paged_async] +import com.google.cloud.dialogflow.v2.VersionsClient; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.ListLocationsResponse; +import com.google.cloud.location.Location; +import com.google.common.base.Strings; + +public class AsyncListLocationsPaged { + + public static void main(String[] args) throws Exception { + asyncListLocationsPaged(); + } + + public static void asyncListLocationsPaged() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (VersionsClient versionsClient = VersionsClient.create()) { + ListLocationsRequest request = + ListLocationsRequest.newBuilder() + .setName("name3373707") + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + while (true) { + ListLocationsResponse response = versionsClient.listLocationsCallable().call(request); + for (Location element : response.getLocationsList()) { + // doThingsWith(element); + } + String nextPageToken = response.getNextPageToken(); + if (!Strings.isNullOrEmpty(nextPageToken)) { + request = request.toBuilder().setPageToken(nextPageToken).build(); + } else { + break; + } + } + } + } +} +// [END dialogflow_v2_generated_versionsclient_listlocations_paged_async] diff --git a/samples/snippets/generated/com/google/cloud/dialogflow/v2/versionsclient/listlocations/SyncListLocations.java b/samples/snippets/generated/com/google/cloud/dialogflow/v2/versionsclient/listlocations/SyncListLocations.java new file mode 100644 index 000000000..5d617cb36 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/dialogflow/v2/versionsclient/listlocations/SyncListLocations.java @@ -0,0 +1,47 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.dialogflow.v2.samples; + +// [START dialogflow_v2_generated_versionsclient_listlocations_sync] +import com.google.cloud.dialogflow.v2.VersionsClient; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.Location; + +public class SyncListLocations { + + public static void main(String[] args) throws Exception { + syncListLocations(); + } + + public static void syncListLocations() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (VersionsClient versionsClient = VersionsClient.create()) { + ListLocationsRequest request = + ListLocationsRequest.newBuilder() + .setName("name3373707") + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + for (Location element : versionsClient.listLocations(request).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END dialogflow_v2_generated_versionsclient_listlocations_sync] diff --git a/samples/snippets/generated/com/google/cloud/dialogflow/v2beta1/agentsclient/getlocation/AsyncGetLocation.java b/samples/snippets/generated/com/google/cloud/dialogflow/v2beta1/agentsclient/getlocation/AsyncGetLocation.java new file mode 100644 index 000000000..debc32417 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/dialogflow/v2beta1/agentsclient/getlocation/AsyncGetLocation.java @@ -0,0 +1,42 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.dialogflow.v2beta1.samples; + +// [START dialogflow_v2beta1_generated_agentsclient_getlocation_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.dialogflow.v2beta1.AgentsClient; +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.Location; + +public class AsyncGetLocation { + + public static void main(String[] args) throws Exception { + asyncGetLocation(); + } + + public static void asyncGetLocation() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (AgentsClient agentsClient = AgentsClient.create()) { + GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build(); + ApiFuture future = agentsClient.getLocationCallable().futureCall(request); + // Do something. + Location response = future.get(); + } + } +} +// [END dialogflow_v2beta1_generated_agentsclient_getlocation_async] diff --git a/samples/snippets/generated/com/google/cloud/dialogflow/v2beta1/agentsclient/getlocation/SyncGetLocation.java b/samples/snippets/generated/com/google/cloud/dialogflow/v2beta1/agentsclient/getlocation/SyncGetLocation.java new file mode 100644 index 000000000..61de93145 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/dialogflow/v2beta1/agentsclient/getlocation/SyncGetLocation.java @@ -0,0 +1,39 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.dialogflow.v2beta1.samples; + +// [START dialogflow_v2beta1_generated_agentsclient_getlocation_sync] +import com.google.cloud.dialogflow.v2beta1.AgentsClient; +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.Location; + +public class SyncGetLocation { + + public static void main(String[] args) throws Exception { + syncGetLocation(); + } + + public static void syncGetLocation() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (AgentsClient agentsClient = AgentsClient.create()) { + GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build(); + Location response = agentsClient.getLocation(request); + } + } +} +// [END dialogflow_v2beta1_generated_agentsclient_getlocation_sync] diff --git a/samples/snippets/generated/com/google/cloud/dialogflow/v2beta1/agentsclient/listlocations/AsyncListLocations.java b/samples/snippets/generated/com/google/cloud/dialogflow/v2beta1/agentsclient/listlocations/AsyncListLocations.java new file mode 100644 index 000000000..07ddef116 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/dialogflow/v2beta1/agentsclient/listlocations/AsyncListLocations.java @@ -0,0 +1,50 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.dialogflow.v2beta1.samples; + +// [START dialogflow_v2beta1_generated_agentsclient_listlocations_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.dialogflow.v2beta1.AgentsClient; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.Location; + +public class AsyncListLocations { + + public static void main(String[] args) throws Exception { + asyncListLocations(); + } + + public static void asyncListLocations() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (AgentsClient agentsClient = AgentsClient.create()) { + ListLocationsRequest request = + ListLocationsRequest.newBuilder() + .setName("name3373707") + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + ApiFuture future = agentsClient.listLocationsPagedCallable().futureCall(request); + // Do something. + for (Location element : future.get().iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END dialogflow_v2beta1_generated_agentsclient_listlocations_async] diff --git a/samples/snippets/generated/com/google/cloud/dialogflow/v2beta1/agentsclient/listlocations/AsyncListLocationsPaged.java b/samples/snippets/generated/com/google/cloud/dialogflow/v2beta1/agentsclient/listlocations/AsyncListLocationsPaged.java new file mode 100644 index 000000000..293bbe2de --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/dialogflow/v2beta1/agentsclient/listlocations/AsyncListLocationsPaged.java @@ -0,0 +1,58 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.dialogflow.v2beta1.samples; + +// [START dialogflow_v2beta1_generated_agentsclient_listlocations_paged_async] +import com.google.cloud.dialogflow.v2beta1.AgentsClient; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.ListLocationsResponse; +import com.google.cloud.location.Location; +import com.google.common.base.Strings; + +public class AsyncListLocationsPaged { + + public static void main(String[] args) throws Exception { + asyncListLocationsPaged(); + } + + public static void asyncListLocationsPaged() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (AgentsClient agentsClient = AgentsClient.create()) { + ListLocationsRequest request = + ListLocationsRequest.newBuilder() + .setName("name3373707") + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + while (true) { + ListLocationsResponse response = agentsClient.listLocationsCallable().call(request); + for (Location element : response.getLocationsList()) { + // doThingsWith(element); + } + String nextPageToken = response.getNextPageToken(); + if (!Strings.isNullOrEmpty(nextPageToken)) { + request = request.toBuilder().setPageToken(nextPageToken).build(); + } else { + break; + } + } + } + } +} +// [END dialogflow_v2beta1_generated_agentsclient_listlocations_paged_async] diff --git a/samples/snippets/generated/com/google/cloud/dialogflow/v2beta1/agentsclient/listlocations/SyncListLocations.java b/samples/snippets/generated/com/google/cloud/dialogflow/v2beta1/agentsclient/listlocations/SyncListLocations.java new file mode 100644 index 000000000..27e391ac6 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/dialogflow/v2beta1/agentsclient/listlocations/SyncListLocations.java @@ -0,0 +1,47 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.dialogflow.v2beta1.samples; + +// [START dialogflow_v2beta1_generated_agentsclient_listlocations_sync] +import com.google.cloud.dialogflow.v2beta1.AgentsClient; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.Location; + +public class SyncListLocations { + + public static void main(String[] args) throws Exception { + syncListLocations(); + } + + public static void syncListLocations() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (AgentsClient agentsClient = AgentsClient.create()) { + ListLocationsRequest request = + ListLocationsRequest.newBuilder() + .setName("name3373707") + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + for (Location element : agentsClient.listLocations(request).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END dialogflow_v2beta1_generated_agentsclient_listlocations_sync] diff --git a/samples/snippets/generated/com/google/cloud/dialogflow/v2beta1/answerrecordsclient/getlocation/AsyncGetLocation.java b/samples/snippets/generated/com/google/cloud/dialogflow/v2beta1/answerrecordsclient/getlocation/AsyncGetLocation.java new file mode 100644 index 000000000..4ef721341 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/dialogflow/v2beta1/answerrecordsclient/getlocation/AsyncGetLocation.java @@ -0,0 +1,42 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.dialogflow.v2beta1.samples; + +// [START dialogflow_v2beta1_generated_answerrecordsclient_getlocation_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.dialogflow.v2beta1.AnswerRecordsClient; +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.Location; + +public class AsyncGetLocation { + + public static void main(String[] args) throws Exception { + asyncGetLocation(); + } + + public static void asyncGetLocation() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (AnswerRecordsClient answerRecordsClient = AnswerRecordsClient.create()) { + GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build(); + ApiFuture future = answerRecordsClient.getLocationCallable().futureCall(request); + // Do something. + Location response = future.get(); + } + } +} +// [END dialogflow_v2beta1_generated_answerrecordsclient_getlocation_async] diff --git a/samples/snippets/generated/com/google/cloud/dialogflow/v2beta1/answerrecordsclient/getlocation/SyncGetLocation.java b/samples/snippets/generated/com/google/cloud/dialogflow/v2beta1/answerrecordsclient/getlocation/SyncGetLocation.java new file mode 100644 index 000000000..a18275b82 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/dialogflow/v2beta1/answerrecordsclient/getlocation/SyncGetLocation.java @@ -0,0 +1,39 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.dialogflow.v2beta1.samples; + +// [START dialogflow_v2beta1_generated_answerrecordsclient_getlocation_sync] +import com.google.cloud.dialogflow.v2beta1.AnswerRecordsClient; +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.Location; + +public class SyncGetLocation { + + public static void main(String[] args) throws Exception { + syncGetLocation(); + } + + public static void syncGetLocation() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (AnswerRecordsClient answerRecordsClient = AnswerRecordsClient.create()) { + GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build(); + Location response = answerRecordsClient.getLocation(request); + } + } +} +// [END dialogflow_v2beta1_generated_answerrecordsclient_getlocation_sync] diff --git a/samples/snippets/generated/com/google/cloud/dialogflow/v2beta1/answerrecordsclient/listanswerrecords/AsyncListAnswerRecords.java b/samples/snippets/generated/com/google/cloud/dialogflow/v2beta1/answerrecordsclient/listanswerrecords/AsyncListAnswerRecords.java index 2a25f0c7d..53338a497 100644 --- a/samples/snippets/generated/com/google/cloud/dialogflow/v2beta1/answerrecordsclient/listanswerrecords/AsyncListAnswerRecords.java +++ b/samples/snippets/generated/com/google/cloud/dialogflow/v2beta1/answerrecordsclient/listanswerrecords/AsyncListAnswerRecords.java @@ -36,6 +36,7 @@ public static void asyncListAnswerRecords() throws Exception { ListAnswerRecordsRequest request = ListAnswerRecordsRequest.newBuilder() .setParent(ProjectName.of("[PROJECT]").toString()) + .setFilter("filter-1274492040") .setPageSize(883849137) .setPageToken("pageToken873572522") .build(); diff --git a/samples/snippets/generated/com/google/cloud/dialogflow/v2beta1/answerrecordsclient/listanswerrecords/AsyncListAnswerRecordsPaged.java b/samples/snippets/generated/com/google/cloud/dialogflow/v2beta1/answerrecordsclient/listanswerrecords/AsyncListAnswerRecordsPaged.java index 625289f3b..112bebedd 100644 --- a/samples/snippets/generated/com/google/cloud/dialogflow/v2beta1/answerrecordsclient/listanswerrecords/AsyncListAnswerRecordsPaged.java +++ b/samples/snippets/generated/com/google/cloud/dialogflow/v2beta1/answerrecordsclient/listanswerrecords/AsyncListAnswerRecordsPaged.java @@ -37,6 +37,7 @@ public static void asyncListAnswerRecordsPaged() throws Exception { ListAnswerRecordsRequest request = ListAnswerRecordsRequest.newBuilder() .setParent(ProjectName.of("[PROJECT]").toString()) + .setFilter("filter-1274492040") .setPageSize(883849137) .setPageToken("pageToken873572522") .build(); diff --git a/samples/snippets/generated/com/google/cloud/dialogflow/v2beta1/answerrecordsclient/listanswerrecords/SyncListAnswerRecords.java b/samples/snippets/generated/com/google/cloud/dialogflow/v2beta1/answerrecordsclient/listanswerrecords/SyncListAnswerRecords.java index 3de10cf91..68dcf1933 100644 --- a/samples/snippets/generated/com/google/cloud/dialogflow/v2beta1/answerrecordsclient/listanswerrecords/SyncListAnswerRecords.java +++ b/samples/snippets/generated/com/google/cloud/dialogflow/v2beta1/answerrecordsclient/listanswerrecords/SyncListAnswerRecords.java @@ -35,6 +35,7 @@ public static void syncListAnswerRecords() throws Exception { ListAnswerRecordsRequest request = ListAnswerRecordsRequest.newBuilder() .setParent(ProjectName.of("[PROJECT]").toString()) + .setFilter("filter-1274492040") .setPageSize(883849137) .setPageToken("pageToken873572522") .build(); diff --git a/samples/snippets/generated/com/google/cloud/dialogflow/v2beta1/answerrecordsclient/listlocations/AsyncListLocations.java b/samples/snippets/generated/com/google/cloud/dialogflow/v2beta1/answerrecordsclient/listlocations/AsyncListLocations.java new file mode 100644 index 000000000..b04ae1e1e --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/dialogflow/v2beta1/answerrecordsclient/listlocations/AsyncListLocations.java @@ -0,0 +1,51 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.dialogflow.v2beta1.samples; + +// [START dialogflow_v2beta1_generated_answerrecordsclient_listlocations_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.dialogflow.v2beta1.AnswerRecordsClient; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.Location; + +public class AsyncListLocations { + + public static void main(String[] args) throws Exception { + asyncListLocations(); + } + + public static void asyncListLocations() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (AnswerRecordsClient answerRecordsClient = AnswerRecordsClient.create()) { + ListLocationsRequest request = + ListLocationsRequest.newBuilder() + .setName("name3373707") + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + ApiFuture future = + answerRecordsClient.listLocationsPagedCallable().futureCall(request); + // Do something. + for (Location element : future.get().iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END dialogflow_v2beta1_generated_answerrecordsclient_listlocations_async] diff --git a/samples/snippets/generated/com/google/cloud/dialogflow/v2beta1/answerrecordsclient/listlocations/AsyncListLocationsPaged.java b/samples/snippets/generated/com/google/cloud/dialogflow/v2beta1/answerrecordsclient/listlocations/AsyncListLocationsPaged.java new file mode 100644 index 000000000..f1e03713c --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/dialogflow/v2beta1/answerrecordsclient/listlocations/AsyncListLocationsPaged.java @@ -0,0 +1,58 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.dialogflow.v2beta1.samples; + +// [START dialogflow_v2beta1_generated_answerrecordsclient_listlocations_paged_async] +import com.google.cloud.dialogflow.v2beta1.AnswerRecordsClient; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.ListLocationsResponse; +import com.google.cloud.location.Location; +import com.google.common.base.Strings; + +public class AsyncListLocationsPaged { + + public static void main(String[] args) throws Exception { + asyncListLocationsPaged(); + } + + public static void asyncListLocationsPaged() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (AnswerRecordsClient answerRecordsClient = AnswerRecordsClient.create()) { + ListLocationsRequest request = + ListLocationsRequest.newBuilder() + .setName("name3373707") + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + while (true) { + ListLocationsResponse response = answerRecordsClient.listLocationsCallable().call(request); + for (Location element : response.getLocationsList()) { + // doThingsWith(element); + } + String nextPageToken = response.getNextPageToken(); + if (!Strings.isNullOrEmpty(nextPageToken)) { + request = request.toBuilder().setPageToken(nextPageToken).build(); + } else { + break; + } + } + } + } +} +// [END dialogflow_v2beta1_generated_answerrecordsclient_listlocations_paged_async] diff --git a/samples/snippets/generated/com/google/cloud/dialogflow/v2beta1/answerrecordsclient/listlocations/SyncListLocations.java b/samples/snippets/generated/com/google/cloud/dialogflow/v2beta1/answerrecordsclient/listlocations/SyncListLocations.java new file mode 100644 index 000000000..6e4a8e911 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/dialogflow/v2beta1/answerrecordsclient/listlocations/SyncListLocations.java @@ -0,0 +1,47 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.dialogflow.v2beta1.samples; + +// [START dialogflow_v2beta1_generated_answerrecordsclient_listlocations_sync] +import com.google.cloud.dialogflow.v2beta1.AnswerRecordsClient; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.Location; + +public class SyncListLocations { + + public static void main(String[] args) throws Exception { + syncListLocations(); + } + + public static void syncListLocations() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (AnswerRecordsClient answerRecordsClient = AnswerRecordsClient.create()) { + ListLocationsRequest request = + ListLocationsRequest.newBuilder() + .setName("name3373707") + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + for (Location element : answerRecordsClient.listLocations(request).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END dialogflow_v2beta1_generated_answerrecordsclient_listlocations_sync] diff --git a/samples/snippets/generated/com/google/cloud/dialogflow/v2beta1/contextsclient/getlocation/AsyncGetLocation.java b/samples/snippets/generated/com/google/cloud/dialogflow/v2beta1/contextsclient/getlocation/AsyncGetLocation.java new file mode 100644 index 000000000..eb0df51c3 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/dialogflow/v2beta1/contextsclient/getlocation/AsyncGetLocation.java @@ -0,0 +1,42 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.dialogflow.v2beta1.samples; + +// [START dialogflow_v2beta1_generated_contextsclient_getlocation_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.dialogflow.v2beta1.ContextsClient; +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.Location; + +public class AsyncGetLocation { + + public static void main(String[] args) throws Exception { + asyncGetLocation(); + } + + public static void asyncGetLocation() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (ContextsClient contextsClient = ContextsClient.create()) { + GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build(); + ApiFuture future = contextsClient.getLocationCallable().futureCall(request); + // Do something. + Location response = future.get(); + } + } +} +// [END dialogflow_v2beta1_generated_contextsclient_getlocation_async] diff --git a/samples/snippets/generated/com/google/cloud/dialogflow/v2beta1/contextsclient/getlocation/SyncGetLocation.java b/samples/snippets/generated/com/google/cloud/dialogflow/v2beta1/contextsclient/getlocation/SyncGetLocation.java new file mode 100644 index 000000000..220a137c7 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/dialogflow/v2beta1/contextsclient/getlocation/SyncGetLocation.java @@ -0,0 +1,39 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.dialogflow.v2beta1.samples; + +// [START dialogflow_v2beta1_generated_contextsclient_getlocation_sync] +import com.google.cloud.dialogflow.v2beta1.ContextsClient; +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.Location; + +public class SyncGetLocation { + + public static void main(String[] args) throws Exception { + syncGetLocation(); + } + + public static void syncGetLocation() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (ContextsClient contextsClient = ContextsClient.create()) { + GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build(); + Location response = contextsClient.getLocation(request); + } + } +} +// [END dialogflow_v2beta1_generated_contextsclient_getlocation_sync] diff --git a/samples/snippets/generated/com/google/cloud/dialogflow/v2beta1/contextsclient/listlocations/AsyncListLocations.java b/samples/snippets/generated/com/google/cloud/dialogflow/v2beta1/contextsclient/listlocations/AsyncListLocations.java new file mode 100644 index 000000000..8203eaefb --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/dialogflow/v2beta1/contextsclient/listlocations/AsyncListLocations.java @@ -0,0 +1,50 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.dialogflow.v2beta1.samples; + +// [START dialogflow_v2beta1_generated_contextsclient_listlocations_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.dialogflow.v2beta1.ContextsClient; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.Location; + +public class AsyncListLocations { + + public static void main(String[] args) throws Exception { + asyncListLocations(); + } + + public static void asyncListLocations() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (ContextsClient contextsClient = ContextsClient.create()) { + ListLocationsRequest request = + ListLocationsRequest.newBuilder() + .setName("name3373707") + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + ApiFuture future = contextsClient.listLocationsPagedCallable().futureCall(request); + // Do something. + for (Location element : future.get().iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END dialogflow_v2beta1_generated_contextsclient_listlocations_async] diff --git a/samples/snippets/generated/com/google/cloud/dialogflow/v2beta1/contextsclient/listlocations/AsyncListLocationsPaged.java b/samples/snippets/generated/com/google/cloud/dialogflow/v2beta1/contextsclient/listlocations/AsyncListLocationsPaged.java new file mode 100644 index 000000000..c8093ba36 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/dialogflow/v2beta1/contextsclient/listlocations/AsyncListLocationsPaged.java @@ -0,0 +1,58 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.dialogflow.v2beta1.samples; + +// [START dialogflow_v2beta1_generated_contextsclient_listlocations_paged_async] +import com.google.cloud.dialogflow.v2beta1.ContextsClient; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.ListLocationsResponse; +import com.google.cloud.location.Location; +import com.google.common.base.Strings; + +public class AsyncListLocationsPaged { + + public static void main(String[] args) throws Exception { + asyncListLocationsPaged(); + } + + public static void asyncListLocationsPaged() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (ContextsClient contextsClient = ContextsClient.create()) { + ListLocationsRequest request = + ListLocationsRequest.newBuilder() + .setName("name3373707") + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + while (true) { + ListLocationsResponse response = contextsClient.listLocationsCallable().call(request); + for (Location element : response.getLocationsList()) { + // doThingsWith(element); + } + String nextPageToken = response.getNextPageToken(); + if (!Strings.isNullOrEmpty(nextPageToken)) { + request = request.toBuilder().setPageToken(nextPageToken).build(); + } else { + break; + } + } + } + } +} +// [END dialogflow_v2beta1_generated_contextsclient_listlocations_paged_async] diff --git a/samples/snippets/generated/com/google/cloud/dialogflow/v2beta1/contextsclient/listlocations/SyncListLocations.java b/samples/snippets/generated/com/google/cloud/dialogflow/v2beta1/contextsclient/listlocations/SyncListLocations.java new file mode 100644 index 000000000..4685d28c2 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/dialogflow/v2beta1/contextsclient/listlocations/SyncListLocations.java @@ -0,0 +1,47 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.dialogflow.v2beta1.samples; + +// [START dialogflow_v2beta1_generated_contextsclient_listlocations_sync] +import com.google.cloud.dialogflow.v2beta1.ContextsClient; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.Location; + +public class SyncListLocations { + + public static void main(String[] args) throws Exception { + syncListLocations(); + } + + public static void syncListLocations() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (ContextsClient contextsClient = ContextsClient.create()) { + ListLocationsRequest request = + ListLocationsRequest.newBuilder() + .setName("name3373707") + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + for (Location element : contextsClient.listLocations(request).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END dialogflow_v2beta1_generated_contextsclient_listlocations_sync] diff --git a/samples/snippets/generated/com/google/cloud/dialogflow/v2beta1/conversationprofilesclient/getlocation/AsyncGetLocation.java b/samples/snippets/generated/com/google/cloud/dialogflow/v2beta1/conversationprofilesclient/getlocation/AsyncGetLocation.java new file mode 100644 index 000000000..a42cd8897 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/dialogflow/v2beta1/conversationprofilesclient/getlocation/AsyncGetLocation.java @@ -0,0 +1,44 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.dialogflow.v2beta1.samples; + +// [START dialogflow_v2beta1_generated_conversationprofilesclient_getlocation_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.dialogflow.v2beta1.ConversationProfilesClient; +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.Location; + +public class AsyncGetLocation { + + public static void main(String[] args) throws Exception { + asyncGetLocation(); + } + + public static void asyncGetLocation() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (ConversationProfilesClient conversationProfilesClient = + ConversationProfilesClient.create()) { + GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build(); + ApiFuture future = + conversationProfilesClient.getLocationCallable().futureCall(request); + // Do something. + Location response = future.get(); + } + } +} +// [END dialogflow_v2beta1_generated_conversationprofilesclient_getlocation_async] diff --git a/samples/snippets/generated/com/google/cloud/dialogflow/v2beta1/conversationprofilesclient/getlocation/SyncGetLocation.java b/samples/snippets/generated/com/google/cloud/dialogflow/v2beta1/conversationprofilesclient/getlocation/SyncGetLocation.java new file mode 100644 index 000000000..a9f35af16 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/dialogflow/v2beta1/conversationprofilesclient/getlocation/SyncGetLocation.java @@ -0,0 +1,40 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.dialogflow.v2beta1.samples; + +// [START dialogflow_v2beta1_generated_conversationprofilesclient_getlocation_sync] +import com.google.cloud.dialogflow.v2beta1.ConversationProfilesClient; +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.Location; + +public class SyncGetLocation { + + public static void main(String[] args) throws Exception { + syncGetLocation(); + } + + public static void syncGetLocation() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (ConversationProfilesClient conversationProfilesClient = + ConversationProfilesClient.create()) { + GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build(); + Location response = conversationProfilesClient.getLocation(request); + } + } +} +// [END dialogflow_v2beta1_generated_conversationprofilesclient_getlocation_sync] diff --git a/samples/snippets/generated/com/google/cloud/dialogflow/v2beta1/conversationprofilesclient/listlocations/AsyncListLocations.java b/samples/snippets/generated/com/google/cloud/dialogflow/v2beta1/conversationprofilesclient/listlocations/AsyncListLocations.java new file mode 100644 index 000000000..a9be2a036 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/dialogflow/v2beta1/conversationprofilesclient/listlocations/AsyncListLocations.java @@ -0,0 +1,52 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.dialogflow.v2beta1.samples; + +// [START dialogflow_v2beta1_generated_conversationprofilesclient_listlocations_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.dialogflow.v2beta1.ConversationProfilesClient; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.Location; + +public class AsyncListLocations { + + public static void main(String[] args) throws Exception { + asyncListLocations(); + } + + public static void asyncListLocations() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (ConversationProfilesClient conversationProfilesClient = + ConversationProfilesClient.create()) { + ListLocationsRequest request = + ListLocationsRequest.newBuilder() + .setName("name3373707") + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + ApiFuture future = + conversationProfilesClient.listLocationsPagedCallable().futureCall(request); + // Do something. + for (Location element : future.get().iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END dialogflow_v2beta1_generated_conversationprofilesclient_listlocations_async] diff --git a/samples/snippets/generated/com/google/cloud/dialogflow/v2beta1/conversationprofilesclient/listlocations/AsyncListLocationsPaged.java b/samples/snippets/generated/com/google/cloud/dialogflow/v2beta1/conversationprofilesclient/listlocations/AsyncListLocationsPaged.java new file mode 100644 index 000000000..edb93cc69 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/dialogflow/v2beta1/conversationprofilesclient/listlocations/AsyncListLocationsPaged.java @@ -0,0 +1,60 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.dialogflow.v2beta1.samples; + +// [START dialogflow_v2beta1_generated_conversationprofilesclient_listlocations_paged_async] +import com.google.cloud.dialogflow.v2beta1.ConversationProfilesClient; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.ListLocationsResponse; +import com.google.cloud.location.Location; +import com.google.common.base.Strings; + +public class AsyncListLocationsPaged { + + public static void main(String[] args) throws Exception { + asyncListLocationsPaged(); + } + + public static void asyncListLocationsPaged() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (ConversationProfilesClient conversationProfilesClient = + ConversationProfilesClient.create()) { + ListLocationsRequest request = + ListLocationsRequest.newBuilder() + .setName("name3373707") + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + while (true) { + ListLocationsResponse response = + conversationProfilesClient.listLocationsCallable().call(request); + for (Location element : response.getLocationsList()) { + // doThingsWith(element); + } + String nextPageToken = response.getNextPageToken(); + if (!Strings.isNullOrEmpty(nextPageToken)) { + request = request.toBuilder().setPageToken(nextPageToken).build(); + } else { + break; + } + } + } + } +} +// [END dialogflow_v2beta1_generated_conversationprofilesclient_listlocations_paged_async] diff --git a/samples/snippets/generated/com/google/cloud/dialogflow/v2beta1/conversationprofilesclient/listlocations/SyncListLocations.java b/samples/snippets/generated/com/google/cloud/dialogflow/v2beta1/conversationprofilesclient/listlocations/SyncListLocations.java new file mode 100644 index 000000000..46ba47b27 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/dialogflow/v2beta1/conversationprofilesclient/listlocations/SyncListLocations.java @@ -0,0 +1,48 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.dialogflow.v2beta1.samples; + +// [START dialogflow_v2beta1_generated_conversationprofilesclient_listlocations_sync] +import com.google.cloud.dialogflow.v2beta1.ConversationProfilesClient; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.Location; + +public class SyncListLocations { + + public static void main(String[] args) throws Exception { + syncListLocations(); + } + + public static void syncListLocations() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (ConversationProfilesClient conversationProfilesClient = + ConversationProfilesClient.create()) { + ListLocationsRequest request = + ListLocationsRequest.newBuilder() + .setName("name3373707") + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + for (Location element : conversationProfilesClient.listLocations(request).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END dialogflow_v2beta1_generated_conversationprofilesclient_listlocations_sync] diff --git a/samples/snippets/generated/com/google/cloud/dialogflow/v2beta1/conversationsclient/getlocation/AsyncGetLocation.java b/samples/snippets/generated/com/google/cloud/dialogflow/v2beta1/conversationsclient/getlocation/AsyncGetLocation.java new file mode 100644 index 000000000..b897f5555 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/dialogflow/v2beta1/conversationsclient/getlocation/AsyncGetLocation.java @@ -0,0 +1,42 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.dialogflow.v2beta1.samples; + +// [START dialogflow_v2beta1_generated_conversationsclient_getlocation_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.dialogflow.v2beta1.ConversationsClient; +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.Location; + +public class AsyncGetLocation { + + public static void main(String[] args) throws Exception { + asyncGetLocation(); + } + + public static void asyncGetLocation() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (ConversationsClient conversationsClient = ConversationsClient.create()) { + GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build(); + ApiFuture future = conversationsClient.getLocationCallable().futureCall(request); + // Do something. + Location response = future.get(); + } + } +} +// [END dialogflow_v2beta1_generated_conversationsclient_getlocation_async] diff --git a/samples/snippets/generated/com/google/cloud/dialogflow/v2beta1/conversationsclient/getlocation/SyncGetLocation.java b/samples/snippets/generated/com/google/cloud/dialogflow/v2beta1/conversationsclient/getlocation/SyncGetLocation.java new file mode 100644 index 000000000..7c94b12ce --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/dialogflow/v2beta1/conversationsclient/getlocation/SyncGetLocation.java @@ -0,0 +1,39 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.dialogflow.v2beta1.samples; + +// [START dialogflow_v2beta1_generated_conversationsclient_getlocation_sync] +import com.google.cloud.dialogflow.v2beta1.ConversationsClient; +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.Location; + +public class SyncGetLocation { + + public static void main(String[] args) throws Exception { + syncGetLocation(); + } + + public static void syncGetLocation() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (ConversationsClient conversationsClient = ConversationsClient.create()) { + GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build(); + Location response = conversationsClient.getLocation(request); + } + } +} +// [END dialogflow_v2beta1_generated_conversationsclient_getlocation_sync] diff --git a/samples/snippets/generated/com/google/cloud/dialogflow/v2beta1/conversationsclient/listlocations/AsyncListLocations.java b/samples/snippets/generated/com/google/cloud/dialogflow/v2beta1/conversationsclient/listlocations/AsyncListLocations.java new file mode 100644 index 000000000..2b6e237a5 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/dialogflow/v2beta1/conversationsclient/listlocations/AsyncListLocations.java @@ -0,0 +1,51 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.dialogflow.v2beta1.samples; + +// [START dialogflow_v2beta1_generated_conversationsclient_listlocations_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.dialogflow.v2beta1.ConversationsClient; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.Location; + +public class AsyncListLocations { + + public static void main(String[] args) throws Exception { + asyncListLocations(); + } + + public static void asyncListLocations() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (ConversationsClient conversationsClient = ConversationsClient.create()) { + ListLocationsRequest request = + ListLocationsRequest.newBuilder() + .setName("name3373707") + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + ApiFuture future = + conversationsClient.listLocationsPagedCallable().futureCall(request); + // Do something. + for (Location element : future.get().iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END dialogflow_v2beta1_generated_conversationsclient_listlocations_async] diff --git a/samples/snippets/generated/com/google/cloud/dialogflow/v2beta1/conversationsclient/listlocations/AsyncListLocationsPaged.java b/samples/snippets/generated/com/google/cloud/dialogflow/v2beta1/conversationsclient/listlocations/AsyncListLocationsPaged.java new file mode 100644 index 000000000..2f4ac999d --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/dialogflow/v2beta1/conversationsclient/listlocations/AsyncListLocationsPaged.java @@ -0,0 +1,58 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.dialogflow.v2beta1.samples; + +// [START dialogflow_v2beta1_generated_conversationsclient_listlocations_paged_async] +import com.google.cloud.dialogflow.v2beta1.ConversationsClient; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.ListLocationsResponse; +import com.google.cloud.location.Location; +import com.google.common.base.Strings; + +public class AsyncListLocationsPaged { + + public static void main(String[] args) throws Exception { + asyncListLocationsPaged(); + } + + public static void asyncListLocationsPaged() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (ConversationsClient conversationsClient = ConversationsClient.create()) { + ListLocationsRequest request = + ListLocationsRequest.newBuilder() + .setName("name3373707") + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + while (true) { + ListLocationsResponse response = conversationsClient.listLocationsCallable().call(request); + for (Location element : response.getLocationsList()) { + // doThingsWith(element); + } + String nextPageToken = response.getNextPageToken(); + if (!Strings.isNullOrEmpty(nextPageToken)) { + request = request.toBuilder().setPageToken(nextPageToken).build(); + } else { + break; + } + } + } + } +} +// [END dialogflow_v2beta1_generated_conversationsclient_listlocations_paged_async] diff --git a/samples/snippets/generated/com/google/cloud/dialogflow/v2beta1/conversationsclient/listlocations/SyncListLocations.java b/samples/snippets/generated/com/google/cloud/dialogflow/v2beta1/conversationsclient/listlocations/SyncListLocations.java new file mode 100644 index 000000000..d4958ecbf --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/dialogflow/v2beta1/conversationsclient/listlocations/SyncListLocations.java @@ -0,0 +1,47 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.dialogflow.v2beta1.samples; + +// [START dialogflow_v2beta1_generated_conversationsclient_listlocations_sync] +import com.google.cloud.dialogflow.v2beta1.ConversationsClient; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.Location; + +public class SyncListLocations { + + public static void main(String[] args) throws Exception { + syncListLocations(); + } + + public static void syncListLocations() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (ConversationsClient conversationsClient = ConversationsClient.create()) { + ListLocationsRequest request = + ListLocationsRequest.newBuilder() + .setName("name3373707") + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + for (Location element : conversationsClient.listLocations(request).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END dialogflow_v2beta1_generated_conversationsclient_listlocations_sync] diff --git a/samples/snippets/generated/com/google/cloud/dialogflow/v2beta1/documentsclient/getlocation/AsyncGetLocation.java b/samples/snippets/generated/com/google/cloud/dialogflow/v2beta1/documentsclient/getlocation/AsyncGetLocation.java new file mode 100644 index 000000000..7ed45665a --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/dialogflow/v2beta1/documentsclient/getlocation/AsyncGetLocation.java @@ -0,0 +1,42 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.dialogflow.v2beta1.samples; + +// [START dialogflow_v2beta1_generated_documentsclient_getlocation_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.dialogflow.v2beta1.DocumentsClient; +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.Location; + +public class AsyncGetLocation { + + public static void main(String[] args) throws Exception { + asyncGetLocation(); + } + + public static void asyncGetLocation() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DocumentsClient documentsClient = DocumentsClient.create()) { + GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build(); + ApiFuture future = documentsClient.getLocationCallable().futureCall(request); + // Do something. + Location response = future.get(); + } + } +} +// [END dialogflow_v2beta1_generated_documentsclient_getlocation_async] diff --git a/samples/snippets/generated/com/google/cloud/dialogflow/v2beta1/documentsclient/getlocation/SyncGetLocation.java b/samples/snippets/generated/com/google/cloud/dialogflow/v2beta1/documentsclient/getlocation/SyncGetLocation.java new file mode 100644 index 000000000..dfcb19aef --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/dialogflow/v2beta1/documentsclient/getlocation/SyncGetLocation.java @@ -0,0 +1,39 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.dialogflow.v2beta1.samples; + +// [START dialogflow_v2beta1_generated_documentsclient_getlocation_sync] +import com.google.cloud.dialogflow.v2beta1.DocumentsClient; +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.Location; + +public class SyncGetLocation { + + public static void main(String[] args) throws Exception { + syncGetLocation(); + } + + public static void syncGetLocation() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DocumentsClient documentsClient = DocumentsClient.create()) { + GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build(); + Location response = documentsClient.getLocation(request); + } + } +} +// [END dialogflow_v2beta1_generated_documentsclient_getlocation_sync] diff --git a/samples/snippets/generated/com/google/cloud/dialogflow/v2beta1/documentsclient/listlocations/AsyncListLocations.java b/samples/snippets/generated/com/google/cloud/dialogflow/v2beta1/documentsclient/listlocations/AsyncListLocations.java new file mode 100644 index 000000000..f039259cc --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/dialogflow/v2beta1/documentsclient/listlocations/AsyncListLocations.java @@ -0,0 +1,50 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.dialogflow.v2beta1.samples; + +// [START dialogflow_v2beta1_generated_documentsclient_listlocations_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.dialogflow.v2beta1.DocumentsClient; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.Location; + +public class AsyncListLocations { + + public static void main(String[] args) throws Exception { + asyncListLocations(); + } + + public static void asyncListLocations() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DocumentsClient documentsClient = DocumentsClient.create()) { + ListLocationsRequest request = + ListLocationsRequest.newBuilder() + .setName("name3373707") + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + ApiFuture future = documentsClient.listLocationsPagedCallable().futureCall(request); + // Do something. + for (Location element : future.get().iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END dialogflow_v2beta1_generated_documentsclient_listlocations_async] diff --git a/samples/snippets/generated/com/google/cloud/dialogflow/v2beta1/documentsclient/listlocations/AsyncListLocationsPaged.java b/samples/snippets/generated/com/google/cloud/dialogflow/v2beta1/documentsclient/listlocations/AsyncListLocationsPaged.java new file mode 100644 index 000000000..9057c19e6 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/dialogflow/v2beta1/documentsclient/listlocations/AsyncListLocationsPaged.java @@ -0,0 +1,58 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.dialogflow.v2beta1.samples; + +// [START dialogflow_v2beta1_generated_documentsclient_listlocations_paged_async] +import com.google.cloud.dialogflow.v2beta1.DocumentsClient; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.ListLocationsResponse; +import com.google.cloud.location.Location; +import com.google.common.base.Strings; + +public class AsyncListLocationsPaged { + + public static void main(String[] args) throws Exception { + asyncListLocationsPaged(); + } + + public static void asyncListLocationsPaged() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DocumentsClient documentsClient = DocumentsClient.create()) { + ListLocationsRequest request = + ListLocationsRequest.newBuilder() + .setName("name3373707") + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + while (true) { + ListLocationsResponse response = documentsClient.listLocationsCallable().call(request); + for (Location element : response.getLocationsList()) { + // doThingsWith(element); + } + String nextPageToken = response.getNextPageToken(); + if (!Strings.isNullOrEmpty(nextPageToken)) { + request = request.toBuilder().setPageToken(nextPageToken).build(); + } else { + break; + } + } + } + } +} +// [END dialogflow_v2beta1_generated_documentsclient_listlocations_paged_async] diff --git a/samples/snippets/generated/com/google/cloud/dialogflow/v2beta1/documentsclient/listlocations/SyncListLocations.java b/samples/snippets/generated/com/google/cloud/dialogflow/v2beta1/documentsclient/listlocations/SyncListLocations.java new file mode 100644 index 000000000..f1aea9e79 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/dialogflow/v2beta1/documentsclient/listlocations/SyncListLocations.java @@ -0,0 +1,47 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.dialogflow.v2beta1.samples; + +// [START dialogflow_v2beta1_generated_documentsclient_listlocations_sync] +import com.google.cloud.dialogflow.v2beta1.DocumentsClient; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.Location; + +public class SyncListLocations { + + public static void main(String[] args) throws Exception { + syncListLocations(); + } + + public static void syncListLocations() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DocumentsClient documentsClient = DocumentsClient.create()) { + ListLocationsRequest request = + ListLocationsRequest.newBuilder() + .setName("name3373707") + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + for (Location element : documentsClient.listLocations(request).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END dialogflow_v2beta1_generated_documentsclient_listlocations_sync] diff --git a/samples/snippets/generated/com/google/cloud/dialogflow/v2beta1/entitytypesclient/getlocation/AsyncGetLocation.java b/samples/snippets/generated/com/google/cloud/dialogflow/v2beta1/entitytypesclient/getlocation/AsyncGetLocation.java new file mode 100644 index 000000000..dcda2c972 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/dialogflow/v2beta1/entitytypesclient/getlocation/AsyncGetLocation.java @@ -0,0 +1,42 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.dialogflow.v2beta1.samples; + +// [START dialogflow_v2beta1_generated_entitytypesclient_getlocation_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.dialogflow.v2beta1.EntityTypesClient; +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.Location; + +public class AsyncGetLocation { + + public static void main(String[] args) throws Exception { + asyncGetLocation(); + } + + public static void asyncGetLocation() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (EntityTypesClient entityTypesClient = EntityTypesClient.create()) { + GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build(); + ApiFuture future = entityTypesClient.getLocationCallable().futureCall(request); + // Do something. + Location response = future.get(); + } + } +} +// [END dialogflow_v2beta1_generated_entitytypesclient_getlocation_async] diff --git a/samples/snippets/generated/com/google/cloud/dialogflow/v2beta1/entitytypesclient/getlocation/SyncGetLocation.java b/samples/snippets/generated/com/google/cloud/dialogflow/v2beta1/entitytypesclient/getlocation/SyncGetLocation.java new file mode 100644 index 000000000..dd6b34dc3 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/dialogflow/v2beta1/entitytypesclient/getlocation/SyncGetLocation.java @@ -0,0 +1,39 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.dialogflow.v2beta1.samples; + +// [START dialogflow_v2beta1_generated_entitytypesclient_getlocation_sync] +import com.google.cloud.dialogflow.v2beta1.EntityTypesClient; +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.Location; + +public class SyncGetLocation { + + public static void main(String[] args) throws Exception { + syncGetLocation(); + } + + public static void syncGetLocation() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (EntityTypesClient entityTypesClient = EntityTypesClient.create()) { + GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build(); + Location response = entityTypesClient.getLocation(request); + } + } +} +// [END dialogflow_v2beta1_generated_entitytypesclient_getlocation_sync] diff --git a/samples/snippets/generated/com/google/cloud/dialogflow/v2beta1/entitytypesclient/listlocations/AsyncListLocations.java b/samples/snippets/generated/com/google/cloud/dialogflow/v2beta1/entitytypesclient/listlocations/AsyncListLocations.java new file mode 100644 index 000000000..084a13ed5 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/dialogflow/v2beta1/entitytypesclient/listlocations/AsyncListLocations.java @@ -0,0 +1,51 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.dialogflow.v2beta1.samples; + +// [START dialogflow_v2beta1_generated_entitytypesclient_listlocations_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.dialogflow.v2beta1.EntityTypesClient; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.Location; + +public class AsyncListLocations { + + public static void main(String[] args) throws Exception { + asyncListLocations(); + } + + public static void asyncListLocations() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (EntityTypesClient entityTypesClient = EntityTypesClient.create()) { + ListLocationsRequest request = + ListLocationsRequest.newBuilder() + .setName("name3373707") + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + ApiFuture future = + entityTypesClient.listLocationsPagedCallable().futureCall(request); + // Do something. + for (Location element : future.get().iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END dialogflow_v2beta1_generated_entitytypesclient_listlocations_async] diff --git a/samples/snippets/generated/com/google/cloud/dialogflow/v2beta1/entitytypesclient/listlocations/AsyncListLocationsPaged.java b/samples/snippets/generated/com/google/cloud/dialogflow/v2beta1/entitytypesclient/listlocations/AsyncListLocationsPaged.java new file mode 100644 index 000000000..5d9d6c1f4 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/dialogflow/v2beta1/entitytypesclient/listlocations/AsyncListLocationsPaged.java @@ -0,0 +1,58 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.dialogflow.v2beta1.samples; + +// [START dialogflow_v2beta1_generated_entitytypesclient_listlocations_paged_async] +import com.google.cloud.dialogflow.v2beta1.EntityTypesClient; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.ListLocationsResponse; +import com.google.cloud.location.Location; +import com.google.common.base.Strings; + +public class AsyncListLocationsPaged { + + public static void main(String[] args) throws Exception { + asyncListLocationsPaged(); + } + + public static void asyncListLocationsPaged() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (EntityTypesClient entityTypesClient = EntityTypesClient.create()) { + ListLocationsRequest request = + ListLocationsRequest.newBuilder() + .setName("name3373707") + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + while (true) { + ListLocationsResponse response = entityTypesClient.listLocationsCallable().call(request); + for (Location element : response.getLocationsList()) { + // doThingsWith(element); + } + String nextPageToken = response.getNextPageToken(); + if (!Strings.isNullOrEmpty(nextPageToken)) { + request = request.toBuilder().setPageToken(nextPageToken).build(); + } else { + break; + } + } + } + } +} +// [END dialogflow_v2beta1_generated_entitytypesclient_listlocations_paged_async] diff --git a/samples/snippets/generated/com/google/cloud/dialogflow/v2beta1/entitytypesclient/listlocations/SyncListLocations.java b/samples/snippets/generated/com/google/cloud/dialogflow/v2beta1/entitytypesclient/listlocations/SyncListLocations.java new file mode 100644 index 000000000..376ef505a --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/dialogflow/v2beta1/entitytypesclient/listlocations/SyncListLocations.java @@ -0,0 +1,47 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.dialogflow.v2beta1.samples; + +// [START dialogflow_v2beta1_generated_entitytypesclient_listlocations_sync] +import com.google.cloud.dialogflow.v2beta1.EntityTypesClient; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.Location; + +public class SyncListLocations { + + public static void main(String[] args) throws Exception { + syncListLocations(); + } + + public static void syncListLocations() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (EntityTypesClient entityTypesClient = EntityTypesClient.create()) { + ListLocationsRequest request = + ListLocationsRequest.newBuilder() + .setName("name3373707") + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + for (Location element : entityTypesClient.listLocations(request).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END dialogflow_v2beta1_generated_entitytypesclient_listlocations_sync] diff --git a/samples/snippets/generated/com/google/cloud/dialogflow/v2beta1/environmentsclient/getlocation/AsyncGetLocation.java b/samples/snippets/generated/com/google/cloud/dialogflow/v2beta1/environmentsclient/getlocation/AsyncGetLocation.java new file mode 100644 index 000000000..0a78315e5 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/dialogflow/v2beta1/environmentsclient/getlocation/AsyncGetLocation.java @@ -0,0 +1,42 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.dialogflow.v2beta1.samples; + +// [START dialogflow_v2beta1_generated_environmentsclient_getlocation_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.dialogflow.v2beta1.EnvironmentsClient; +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.Location; + +public class AsyncGetLocation { + + public static void main(String[] args) throws Exception { + asyncGetLocation(); + } + + public static void asyncGetLocation() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (EnvironmentsClient environmentsClient = EnvironmentsClient.create()) { + GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build(); + ApiFuture future = environmentsClient.getLocationCallable().futureCall(request); + // Do something. + Location response = future.get(); + } + } +} +// [END dialogflow_v2beta1_generated_environmentsclient_getlocation_async] diff --git a/samples/snippets/generated/com/google/cloud/dialogflow/v2beta1/environmentsclient/getlocation/SyncGetLocation.java b/samples/snippets/generated/com/google/cloud/dialogflow/v2beta1/environmentsclient/getlocation/SyncGetLocation.java new file mode 100644 index 000000000..b0b7eff99 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/dialogflow/v2beta1/environmentsclient/getlocation/SyncGetLocation.java @@ -0,0 +1,39 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.dialogflow.v2beta1.samples; + +// [START dialogflow_v2beta1_generated_environmentsclient_getlocation_sync] +import com.google.cloud.dialogflow.v2beta1.EnvironmentsClient; +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.Location; + +public class SyncGetLocation { + + public static void main(String[] args) throws Exception { + syncGetLocation(); + } + + public static void syncGetLocation() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (EnvironmentsClient environmentsClient = EnvironmentsClient.create()) { + GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build(); + Location response = environmentsClient.getLocation(request); + } + } +} +// [END dialogflow_v2beta1_generated_environmentsclient_getlocation_sync] diff --git a/samples/snippets/generated/com/google/cloud/dialogflow/v2beta1/environmentsclient/listlocations/AsyncListLocations.java b/samples/snippets/generated/com/google/cloud/dialogflow/v2beta1/environmentsclient/listlocations/AsyncListLocations.java new file mode 100644 index 000000000..1bceb7a9d --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/dialogflow/v2beta1/environmentsclient/listlocations/AsyncListLocations.java @@ -0,0 +1,51 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.dialogflow.v2beta1.samples; + +// [START dialogflow_v2beta1_generated_environmentsclient_listlocations_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.dialogflow.v2beta1.EnvironmentsClient; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.Location; + +public class AsyncListLocations { + + public static void main(String[] args) throws Exception { + asyncListLocations(); + } + + public static void asyncListLocations() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (EnvironmentsClient environmentsClient = EnvironmentsClient.create()) { + ListLocationsRequest request = + ListLocationsRequest.newBuilder() + .setName("name3373707") + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + ApiFuture future = + environmentsClient.listLocationsPagedCallable().futureCall(request); + // Do something. + for (Location element : future.get().iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END dialogflow_v2beta1_generated_environmentsclient_listlocations_async] diff --git a/samples/snippets/generated/com/google/cloud/dialogflow/v2beta1/environmentsclient/listlocations/AsyncListLocationsPaged.java b/samples/snippets/generated/com/google/cloud/dialogflow/v2beta1/environmentsclient/listlocations/AsyncListLocationsPaged.java new file mode 100644 index 000000000..3e74dd10c --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/dialogflow/v2beta1/environmentsclient/listlocations/AsyncListLocationsPaged.java @@ -0,0 +1,58 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.dialogflow.v2beta1.samples; + +// [START dialogflow_v2beta1_generated_environmentsclient_listlocations_paged_async] +import com.google.cloud.dialogflow.v2beta1.EnvironmentsClient; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.ListLocationsResponse; +import com.google.cloud.location.Location; +import com.google.common.base.Strings; + +public class AsyncListLocationsPaged { + + public static void main(String[] args) throws Exception { + asyncListLocationsPaged(); + } + + public static void asyncListLocationsPaged() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (EnvironmentsClient environmentsClient = EnvironmentsClient.create()) { + ListLocationsRequest request = + ListLocationsRequest.newBuilder() + .setName("name3373707") + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + while (true) { + ListLocationsResponse response = environmentsClient.listLocationsCallable().call(request); + for (Location element : response.getLocationsList()) { + // doThingsWith(element); + } + String nextPageToken = response.getNextPageToken(); + if (!Strings.isNullOrEmpty(nextPageToken)) { + request = request.toBuilder().setPageToken(nextPageToken).build(); + } else { + break; + } + } + } + } +} +// [END dialogflow_v2beta1_generated_environmentsclient_listlocations_paged_async] diff --git a/samples/snippets/generated/com/google/cloud/dialogflow/v2beta1/environmentsclient/listlocations/SyncListLocations.java b/samples/snippets/generated/com/google/cloud/dialogflow/v2beta1/environmentsclient/listlocations/SyncListLocations.java new file mode 100644 index 000000000..5dfd0a7ba --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/dialogflow/v2beta1/environmentsclient/listlocations/SyncListLocations.java @@ -0,0 +1,47 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.dialogflow.v2beta1.samples; + +// [START dialogflow_v2beta1_generated_environmentsclient_listlocations_sync] +import com.google.cloud.dialogflow.v2beta1.EnvironmentsClient; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.Location; + +public class SyncListLocations { + + public static void main(String[] args) throws Exception { + syncListLocations(); + } + + public static void syncListLocations() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (EnvironmentsClient environmentsClient = EnvironmentsClient.create()) { + ListLocationsRequest request = + ListLocationsRequest.newBuilder() + .setName("name3373707") + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + for (Location element : environmentsClient.listLocations(request).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END dialogflow_v2beta1_generated_environmentsclient_listlocations_sync] diff --git a/samples/snippets/generated/com/google/cloud/dialogflow/v2beta1/fulfillmentsclient/getlocation/AsyncGetLocation.java b/samples/snippets/generated/com/google/cloud/dialogflow/v2beta1/fulfillmentsclient/getlocation/AsyncGetLocation.java new file mode 100644 index 000000000..be32239d7 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/dialogflow/v2beta1/fulfillmentsclient/getlocation/AsyncGetLocation.java @@ -0,0 +1,42 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.dialogflow.v2beta1.samples; + +// [START dialogflow_v2beta1_generated_fulfillmentsclient_getlocation_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.dialogflow.v2beta1.FulfillmentsClient; +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.Location; + +public class AsyncGetLocation { + + public static void main(String[] args) throws Exception { + asyncGetLocation(); + } + + public static void asyncGetLocation() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (FulfillmentsClient fulfillmentsClient = FulfillmentsClient.create()) { + GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build(); + ApiFuture future = fulfillmentsClient.getLocationCallable().futureCall(request); + // Do something. + Location response = future.get(); + } + } +} +// [END dialogflow_v2beta1_generated_fulfillmentsclient_getlocation_async] diff --git a/samples/snippets/generated/com/google/cloud/dialogflow/v2beta1/fulfillmentsclient/getlocation/SyncGetLocation.java b/samples/snippets/generated/com/google/cloud/dialogflow/v2beta1/fulfillmentsclient/getlocation/SyncGetLocation.java new file mode 100644 index 000000000..684a52358 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/dialogflow/v2beta1/fulfillmentsclient/getlocation/SyncGetLocation.java @@ -0,0 +1,39 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.dialogflow.v2beta1.samples; + +// [START dialogflow_v2beta1_generated_fulfillmentsclient_getlocation_sync] +import com.google.cloud.dialogflow.v2beta1.FulfillmentsClient; +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.Location; + +public class SyncGetLocation { + + public static void main(String[] args) throws Exception { + syncGetLocation(); + } + + public static void syncGetLocation() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (FulfillmentsClient fulfillmentsClient = FulfillmentsClient.create()) { + GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build(); + Location response = fulfillmentsClient.getLocation(request); + } + } +} +// [END dialogflow_v2beta1_generated_fulfillmentsclient_getlocation_sync] diff --git a/samples/snippets/generated/com/google/cloud/dialogflow/v2beta1/fulfillmentsclient/listlocations/AsyncListLocations.java b/samples/snippets/generated/com/google/cloud/dialogflow/v2beta1/fulfillmentsclient/listlocations/AsyncListLocations.java new file mode 100644 index 000000000..1bb26c71f --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/dialogflow/v2beta1/fulfillmentsclient/listlocations/AsyncListLocations.java @@ -0,0 +1,51 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.dialogflow.v2beta1.samples; + +// [START dialogflow_v2beta1_generated_fulfillmentsclient_listlocations_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.dialogflow.v2beta1.FulfillmentsClient; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.Location; + +public class AsyncListLocations { + + public static void main(String[] args) throws Exception { + asyncListLocations(); + } + + public static void asyncListLocations() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (FulfillmentsClient fulfillmentsClient = FulfillmentsClient.create()) { + ListLocationsRequest request = + ListLocationsRequest.newBuilder() + .setName("name3373707") + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + ApiFuture future = + fulfillmentsClient.listLocationsPagedCallable().futureCall(request); + // Do something. + for (Location element : future.get().iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END dialogflow_v2beta1_generated_fulfillmentsclient_listlocations_async] diff --git a/samples/snippets/generated/com/google/cloud/dialogflow/v2beta1/fulfillmentsclient/listlocations/AsyncListLocationsPaged.java b/samples/snippets/generated/com/google/cloud/dialogflow/v2beta1/fulfillmentsclient/listlocations/AsyncListLocationsPaged.java new file mode 100644 index 000000000..a2f2ac819 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/dialogflow/v2beta1/fulfillmentsclient/listlocations/AsyncListLocationsPaged.java @@ -0,0 +1,58 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.dialogflow.v2beta1.samples; + +// [START dialogflow_v2beta1_generated_fulfillmentsclient_listlocations_paged_async] +import com.google.cloud.dialogflow.v2beta1.FulfillmentsClient; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.ListLocationsResponse; +import com.google.cloud.location.Location; +import com.google.common.base.Strings; + +public class AsyncListLocationsPaged { + + public static void main(String[] args) throws Exception { + asyncListLocationsPaged(); + } + + public static void asyncListLocationsPaged() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (FulfillmentsClient fulfillmentsClient = FulfillmentsClient.create()) { + ListLocationsRequest request = + ListLocationsRequest.newBuilder() + .setName("name3373707") + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + while (true) { + ListLocationsResponse response = fulfillmentsClient.listLocationsCallable().call(request); + for (Location element : response.getLocationsList()) { + // doThingsWith(element); + } + String nextPageToken = response.getNextPageToken(); + if (!Strings.isNullOrEmpty(nextPageToken)) { + request = request.toBuilder().setPageToken(nextPageToken).build(); + } else { + break; + } + } + } + } +} +// [END dialogflow_v2beta1_generated_fulfillmentsclient_listlocations_paged_async] diff --git a/samples/snippets/generated/com/google/cloud/dialogflow/v2beta1/fulfillmentsclient/listlocations/SyncListLocations.java b/samples/snippets/generated/com/google/cloud/dialogflow/v2beta1/fulfillmentsclient/listlocations/SyncListLocations.java new file mode 100644 index 000000000..5a3e28671 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/dialogflow/v2beta1/fulfillmentsclient/listlocations/SyncListLocations.java @@ -0,0 +1,47 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.dialogflow.v2beta1.samples; + +// [START dialogflow_v2beta1_generated_fulfillmentsclient_listlocations_sync] +import com.google.cloud.dialogflow.v2beta1.FulfillmentsClient; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.Location; + +public class SyncListLocations { + + public static void main(String[] args) throws Exception { + syncListLocations(); + } + + public static void syncListLocations() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (FulfillmentsClient fulfillmentsClient = FulfillmentsClient.create()) { + ListLocationsRequest request = + ListLocationsRequest.newBuilder() + .setName("name3373707") + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + for (Location element : fulfillmentsClient.listLocations(request).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END dialogflow_v2beta1_generated_fulfillmentsclient_listlocations_sync] diff --git a/samples/snippets/generated/com/google/cloud/dialogflow/v2beta1/intentsclient/getlocation/AsyncGetLocation.java b/samples/snippets/generated/com/google/cloud/dialogflow/v2beta1/intentsclient/getlocation/AsyncGetLocation.java new file mode 100644 index 000000000..cc9262c50 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/dialogflow/v2beta1/intentsclient/getlocation/AsyncGetLocation.java @@ -0,0 +1,42 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.dialogflow.v2beta1.samples; + +// [START dialogflow_v2beta1_generated_intentsclient_getlocation_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.dialogflow.v2beta1.IntentsClient; +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.Location; + +public class AsyncGetLocation { + + public static void main(String[] args) throws Exception { + asyncGetLocation(); + } + + public static void asyncGetLocation() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (IntentsClient intentsClient = IntentsClient.create()) { + GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build(); + ApiFuture future = intentsClient.getLocationCallable().futureCall(request); + // Do something. + Location response = future.get(); + } + } +} +// [END dialogflow_v2beta1_generated_intentsclient_getlocation_async] diff --git a/samples/snippets/generated/com/google/cloud/dialogflow/v2beta1/intentsclient/getlocation/SyncGetLocation.java b/samples/snippets/generated/com/google/cloud/dialogflow/v2beta1/intentsclient/getlocation/SyncGetLocation.java new file mode 100644 index 000000000..c093d284f --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/dialogflow/v2beta1/intentsclient/getlocation/SyncGetLocation.java @@ -0,0 +1,39 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.dialogflow.v2beta1.samples; + +// [START dialogflow_v2beta1_generated_intentsclient_getlocation_sync] +import com.google.cloud.dialogflow.v2beta1.IntentsClient; +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.Location; + +public class SyncGetLocation { + + public static void main(String[] args) throws Exception { + syncGetLocation(); + } + + public static void syncGetLocation() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (IntentsClient intentsClient = IntentsClient.create()) { + GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build(); + Location response = intentsClient.getLocation(request); + } + } +} +// [END dialogflow_v2beta1_generated_intentsclient_getlocation_sync] diff --git a/samples/snippets/generated/com/google/cloud/dialogflow/v2beta1/intentsclient/listlocations/AsyncListLocations.java b/samples/snippets/generated/com/google/cloud/dialogflow/v2beta1/intentsclient/listlocations/AsyncListLocations.java new file mode 100644 index 000000000..10fd7edd8 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/dialogflow/v2beta1/intentsclient/listlocations/AsyncListLocations.java @@ -0,0 +1,50 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.dialogflow.v2beta1.samples; + +// [START dialogflow_v2beta1_generated_intentsclient_listlocations_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.dialogflow.v2beta1.IntentsClient; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.Location; + +public class AsyncListLocations { + + public static void main(String[] args) throws Exception { + asyncListLocations(); + } + + public static void asyncListLocations() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (IntentsClient intentsClient = IntentsClient.create()) { + ListLocationsRequest request = + ListLocationsRequest.newBuilder() + .setName("name3373707") + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + ApiFuture future = intentsClient.listLocationsPagedCallable().futureCall(request); + // Do something. + for (Location element : future.get().iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END dialogflow_v2beta1_generated_intentsclient_listlocations_async] diff --git a/samples/snippets/generated/com/google/cloud/dialogflow/v2beta1/intentsclient/listlocations/AsyncListLocationsPaged.java b/samples/snippets/generated/com/google/cloud/dialogflow/v2beta1/intentsclient/listlocations/AsyncListLocationsPaged.java new file mode 100644 index 000000000..8497cd54c --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/dialogflow/v2beta1/intentsclient/listlocations/AsyncListLocationsPaged.java @@ -0,0 +1,58 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.dialogflow.v2beta1.samples; + +// [START dialogflow_v2beta1_generated_intentsclient_listlocations_paged_async] +import com.google.cloud.dialogflow.v2beta1.IntentsClient; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.ListLocationsResponse; +import com.google.cloud.location.Location; +import com.google.common.base.Strings; + +public class AsyncListLocationsPaged { + + public static void main(String[] args) throws Exception { + asyncListLocationsPaged(); + } + + public static void asyncListLocationsPaged() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (IntentsClient intentsClient = IntentsClient.create()) { + ListLocationsRequest request = + ListLocationsRequest.newBuilder() + .setName("name3373707") + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + while (true) { + ListLocationsResponse response = intentsClient.listLocationsCallable().call(request); + for (Location element : response.getLocationsList()) { + // doThingsWith(element); + } + String nextPageToken = response.getNextPageToken(); + if (!Strings.isNullOrEmpty(nextPageToken)) { + request = request.toBuilder().setPageToken(nextPageToken).build(); + } else { + break; + } + } + } + } +} +// [END dialogflow_v2beta1_generated_intentsclient_listlocations_paged_async] diff --git a/samples/snippets/generated/com/google/cloud/dialogflow/v2beta1/intentsclient/listlocations/SyncListLocations.java b/samples/snippets/generated/com/google/cloud/dialogflow/v2beta1/intentsclient/listlocations/SyncListLocations.java new file mode 100644 index 000000000..965f50308 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/dialogflow/v2beta1/intentsclient/listlocations/SyncListLocations.java @@ -0,0 +1,47 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.dialogflow.v2beta1.samples; + +// [START dialogflow_v2beta1_generated_intentsclient_listlocations_sync] +import com.google.cloud.dialogflow.v2beta1.IntentsClient; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.Location; + +public class SyncListLocations { + + public static void main(String[] args) throws Exception { + syncListLocations(); + } + + public static void syncListLocations() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (IntentsClient intentsClient = IntentsClient.create()) { + ListLocationsRequest request = + ListLocationsRequest.newBuilder() + .setName("name3373707") + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + for (Location element : intentsClient.listLocations(request).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END dialogflow_v2beta1_generated_intentsclient_listlocations_sync] diff --git a/samples/snippets/generated/com/google/cloud/dialogflow/v2beta1/knowledgebasesclient/getlocation/AsyncGetLocation.java b/samples/snippets/generated/com/google/cloud/dialogflow/v2beta1/knowledgebasesclient/getlocation/AsyncGetLocation.java new file mode 100644 index 000000000..8677e25a9 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/dialogflow/v2beta1/knowledgebasesclient/getlocation/AsyncGetLocation.java @@ -0,0 +1,42 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.dialogflow.v2beta1.samples; + +// [START dialogflow_v2beta1_generated_knowledgebasesclient_getlocation_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.dialogflow.v2beta1.KnowledgeBasesClient; +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.Location; + +public class AsyncGetLocation { + + public static void main(String[] args) throws Exception { + asyncGetLocation(); + } + + public static void asyncGetLocation() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (KnowledgeBasesClient knowledgeBasesClient = KnowledgeBasesClient.create()) { + GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build(); + ApiFuture future = knowledgeBasesClient.getLocationCallable().futureCall(request); + // Do something. + Location response = future.get(); + } + } +} +// [END dialogflow_v2beta1_generated_knowledgebasesclient_getlocation_async] diff --git a/samples/snippets/generated/com/google/cloud/dialogflow/v2beta1/knowledgebasesclient/getlocation/SyncGetLocation.java b/samples/snippets/generated/com/google/cloud/dialogflow/v2beta1/knowledgebasesclient/getlocation/SyncGetLocation.java new file mode 100644 index 000000000..2d669228e --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/dialogflow/v2beta1/knowledgebasesclient/getlocation/SyncGetLocation.java @@ -0,0 +1,39 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.dialogflow.v2beta1.samples; + +// [START dialogflow_v2beta1_generated_knowledgebasesclient_getlocation_sync] +import com.google.cloud.dialogflow.v2beta1.KnowledgeBasesClient; +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.Location; + +public class SyncGetLocation { + + public static void main(String[] args) throws Exception { + syncGetLocation(); + } + + public static void syncGetLocation() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (KnowledgeBasesClient knowledgeBasesClient = KnowledgeBasesClient.create()) { + GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build(); + Location response = knowledgeBasesClient.getLocation(request); + } + } +} +// [END dialogflow_v2beta1_generated_knowledgebasesclient_getlocation_sync] diff --git a/samples/snippets/generated/com/google/cloud/dialogflow/v2beta1/knowledgebasesclient/listlocations/AsyncListLocations.java b/samples/snippets/generated/com/google/cloud/dialogflow/v2beta1/knowledgebasesclient/listlocations/AsyncListLocations.java new file mode 100644 index 000000000..1602ada01 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/dialogflow/v2beta1/knowledgebasesclient/listlocations/AsyncListLocations.java @@ -0,0 +1,51 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.dialogflow.v2beta1.samples; + +// [START dialogflow_v2beta1_generated_knowledgebasesclient_listlocations_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.dialogflow.v2beta1.KnowledgeBasesClient; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.Location; + +public class AsyncListLocations { + + public static void main(String[] args) throws Exception { + asyncListLocations(); + } + + public static void asyncListLocations() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (KnowledgeBasesClient knowledgeBasesClient = KnowledgeBasesClient.create()) { + ListLocationsRequest request = + ListLocationsRequest.newBuilder() + .setName("name3373707") + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + ApiFuture future = + knowledgeBasesClient.listLocationsPagedCallable().futureCall(request); + // Do something. + for (Location element : future.get().iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END dialogflow_v2beta1_generated_knowledgebasesclient_listlocations_async] diff --git a/samples/snippets/generated/com/google/cloud/dialogflow/v2beta1/knowledgebasesclient/listlocations/AsyncListLocationsPaged.java b/samples/snippets/generated/com/google/cloud/dialogflow/v2beta1/knowledgebasesclient/listlocations/AsyncListLocationsPaged.java new file mode 100644 index 000000000..abab11fd0 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/dialogflow/v2beta1/knowledgebasesclient/listlocations/AsyncListLocationsPaged.java @@ -0,0 +1,58 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.dialogflow.v2beta1.samples; + +// [START dialogflow_v2beta1_generated_knowledgebasesclient_listlocations_paged_async] +import com.google.cloud.dialogflow.v2beta1.KnowledgeBasesClient; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.ListLocationsResponse; +import com.google.cloud.location.Location; +import com.google.common.base.Strings; + +public class AsyncListLocationsPaged { + + public static void main(String[] args) throws Exception { + asyncListLocationsPaged(); + } + + public static void asyncListLocationsPaged() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (KnowledgeBasesClient knowledgeBasesClient = KnowledgeBasesClient.create()) { + ListLocationsRequest request = + ListLocationsRequest.newBuilder() + .setName("name3373707") + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + while (true) { + ListLocationsResponse response = knowledgeBasesClient.listLocationsCallable().call(request); + for (Location element : response.getLocationsList()) { + // doThingsWith(element); + } + String nextPageToken = response.getNextPageToken(); + if (!Strings.isNullOrEmpty(nextPageToken)) { + request = request.toBuilder().setPageToken(nextPageToken).build(); + } else { + break; + } + } + } + } +} +// [END dialogflow_v2beta1_generated_knowledgebasesclient_listlocations_paged_async] diff --git a/samples/snippets/generated/com/google/cloud/dialogflow/v2beta1/knowledgebasesclient/listlocations/SyncListLocations.java b/samples/snippets/generated/com/google/cloud/dialogflow/v2beta1/knowledgebasesclient/listlocations/SyncListLocations.java new file mode 100644 index 000000000..a6179fb0e --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/dialogflow/v2beta1/knowledgebasesclient/listlocations/SyncListLocations.java @@ -0,0 +1,47 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.dialogflow.v2beta1.samples; + +// [START dialogflow_v2beta1_generated_knowledgebasesclient_listlocations_sync] +import com.google.cloud.dialogflow.v2beta1.KnowledgeBasesClient; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.Location; + +public class SyncListLocations { + + public static void main(String[] args) throws Exception { + syncListLocations(); + } + + public static void syncListLocations() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (KnowledgeBasesClient knowledgeBasesClient = KnowledgeBasesClient.create()) { + ListLocationsRequest request = + ListLocationsRequest.newBuilder() + .setName("name3373707") + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + for (Location element : knowledgeBasesClient.listLocations(request).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END dialogflow_v2beta1_generated_knowledgebasesclient_listlocations_sync] diff --git a/samples/snippets/generated/com/google/cloud/dialogflow/v2beta1/participantsclient/analyzecontent/AsyncAnalyzeContent.java b/samples/snippets/generated/com/google/cloud/dialogflow/v2beta1/participantsclient/analyzecontent/AsyncAnalyzeContent.java index 75942815a..f15c55d24 100644 --- a/samples/snippets/generated/com/google/cloud/dialogflow/v2beta1/participantsclient/analyzecontent/AsyncAnalyzeContent.java +++ b/samples/snippets/generated/com/google/cloud/dialogflow/v2beta1/participantsclient/analyzecontent/AsyncAnalyzeContent.java @@ -48,6 +48,7 @@ public static void asyncAnalyzeContent() throws Exception { .setQueryParams(QueryParameters.newBuilder().build()) .setAssistQueryParams(AssistQueryParameters.newBuilder().build()) .setCxParameters(Struct.newBuilder().build()) + .setCxCurrentPage("cxCurrentPage1596907507") .setMessageSendTime(Timestamp.newBuilder().build()) .setRequestId("requestId693933066") .build(); diff --git a/samples/snippets/generated/com/google/cloud/dialogflow/v2beta1/participantsclient/analyzecontent/SyncAnalyzeContent.java b/samples/snippets/generated/com/google/cloud/dialogflow/v2beta1/participantsclient/analyzecontent/SyncAnalyzeContent.java index 9dd6f2c0f..80ae0a17e 100644 --- a/samples/snippets/generated/com/google/cloud/dialogflow/v2beta1/participantsclient/analyzecontent/SyncAnalyzeContent.java +++ b/samples/snippets/generated/com/google/cloud/dialogflow/v2beta1/participantsclient/analyzecontent/SyncAnalyzeContent.java @@ -47,6 +47,7 @@ public static void syncAnalyzeContent() throws Exception { .setQueryParams(QueryParameters.newBuilder().build()) .setAssistQueryParams(AssistQueryParameters.newBuilder().build()) .setCxParameters(Struct.newBuilder().build()) + .setCxCurrentPage("cxCurrentPage1596907507") .setMessageSendTime(Timestamp.newBuilder().build()) .setRequestId("requestId693933066") .build(); diff --git a/samples/snippets/generated/com/google/cloud/dialogflow/v2beta1/participantsclient/analyzecontent/SyncAnalyzeContentParticipantnameAudioinput.java b/samples/snippets/generated/com/google/cloud/dialogflow/v2beta1/participantsclient/analyzecontent/SyncAnalyzeContentParticipantnameAudioinput.java new file mode 100644 index 000000000..7f201289d --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/dialogflow/v2beta1/participantsclient/analyzecontent/SyncAnalyzeContentParticipantnameAudioinput.java @@ -0,0 +1,43 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.dialogflow.v2beta1.samples; + +// [START dialogflow_v2beta1_generated_participantsclient_analyzecontent_participantnameaudioinput_sync] +import com.google.cloud.dialogflow.v2beta1.AnalyzeContentResponse; +import com.google.cloud.dialogflow.v2beta1.AudioInput; +import com.google.cloud.dialogflow.v2beta1.ParticipantName; +import com.google.cloud.dialogflow.v2beta1.ParticipantsClient; + +public class SyncAnalyzeContentParticipantnameAudioinput { + + public static void main(String[] args) throws Exception { + syncAnalyzeContentParticipantnameAudioinput(); + } + + public static void syncAnalyzeContentParticipantnameAudioinput() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (ParticipantsClient participantsClient = ParticipantsClient.create()) { + ParticipantName participant = + ParticipantName.ofProjectConversationParticipantName( + "[PROJECT]", "[CONVERSATION]", "[PARTICIPANT]"); + AudioInput audioInput = AudioInput.newBuilder().build(); + AnalyzeContentResponse response = participantsClient.analyzeContent(participant, audioInput); + } + } +} +// [END dialogflow_v2beta1_generated_participantsclient_analyzecontent_participantnameaudioinput_sync] diff --git a/samples/snippets/generated/com/google/cloud/dialogflow/v2beta1/participantsclient/analyzecontent/SyncAnalyzeContentStringAudioinput.java b/samples/snippets/generated/com/google/cloud/dialogflow/v2beta1/participantsclient/analyzecontent/SyncAnalyzeContentStringAudioinput.java new file mode 100644 index 000000000..7da098824 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/dialogflow/v2beta1/participantsclient/analyzecontent/SyncAnalyzeContentStringAudioinput.java @@ -0,0 +1,44 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.dialogflow.v2beta1.samples; + +// [START dialogflow_v2beta1_generated_participantsclient_analyzecontent_stringaudioinput_sync] +import com.google.cloud.dialogflow.v2beta1.AnalyzeContentResponse; +import com.google.cloud.dialogflow.v2beta1.AudioInput; +import com.google.cloud.dialogflow.v2beta1.ParticipantName; +import com.google.cloud.dialogflow.v2beta1.ParticipantsClient; + +public class SyncAnalyzeContentStringAudioinput { + + public static void main(String[] args) throws Exception { + syncAnalyzeContentStringAudioinput(); + } + + public static void syncAnalyzeContentStringAudioinput() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (ParticipantsClient participantsClient = ParticipantsClient.create()) { + String participant = + ParticipantName.ofProjectConversationParticipantName( + "[PROJECT]", "[CONVERSATION]", "[PARTICIPANT]") + .toString(); + AudioInput audioInput = AudioInput.newBuilder().build(); + AnalyzeContentResponse response = participantsClient.analyzeContent(participant, audioInput); + } + } +} +// [END dialogflow_v2beta1_generated_participantsclient_analyzecontent_stringaudioinput_sync] diff --git a/samples/snippets/generated/com/google/cloud/dialogflow/v2beta1/participantsclient/getlocation/AsyncGetLocation.java b/samples/snippets/generated/com/google/cloud/dialogflow/v2beta1/participantsclient/getlocation/AsyncGetLocation.java new file mode 100644 index 000000000..a40febae7 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/dialogflow/v2beta1/participantsclient/getlocation/AsyncGetLocation.java @@ -0,0 +1,42 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.dialogflow.v2beta1.samples; + +// [START dialogflow_v2beta1_generated_participantsclient_getlocation_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.dialogflow.v2beta1.ParticipantsClient; +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.Location; + +public class AsyncGetLocation { + + public static void main(String[] args) throws Exception { + asyncGetLocation(); + } + + public static void asyncGetLocation() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (ParticipantsClient participantsClient = ParticipantsClient.create()) { + GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build(); + ApiFuture future = participantsClient.getLocationCallable().futureCall(request); + // Do something. + Location response = future.get(); + } + } +} +// [END dialogflow_v2beta1_generated_participantsclient_getlocation_async] diff --git a/samples/snippets/generated/com/google/cloud/dialogflow/v2beta1/participantsclient/getlocation/SyncGetLocation.java b/samples/snippets/generated/com/google/cloud/dialogflow/v2beta1/participantsclient/getlocation/SyncGetLocation.java new file mode 100644 index 000000000..211de7876 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/dialogflow/v2beta1/participantsclient/getlocation/SyncGetLocation.java @@ -0,0 +1,39 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.dialogflow.v2beta1.samples; + +// [START dialogflow_v2beta1_generated_participantsclient_getlocation_sync] +import com.google.cloud.dialogflow.v2beta1.ParticipantsClient; +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.Location; + +public class SyncGetLocation { + + public static void main(String[] args) throws Exception { + syncGetLocation(); + } + + public static void syncGetLocation() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (ParticipantsClient participantsClient = ParticipantsClient.create()) { + GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build(); + Location response = participantsClient.getLocation(request); + } + } +} +// [END dialogflow_v2beta1_generated_participantsclient_getlocation_sync] diff --git a/samples/snippets/generated/com/google/cloud/dialogflow/v2beta1/participantsclient/listlocations/AsyncListLocations.java b/samples/snippets/generated/com/google/cloud/dialogflow/v2beta1/participantsclient/listlocations/AsyncListLocations.java new file mode 100644 index 000000000..3f8dee91f --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/dialogflow/v2beta1/participantsclient/listlocations/AsyncListLocations.java @@ -0,0 +1,51 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.dialogflow.v2beta1.samples; + +// [START dialogflow_v2beta1_generated_participantsclient_listlocations_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.dialogflow.v2beta1.ParticipantsClient; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.Location; + +public class AsyncListLocations { + + public static void main(String[] args) throws Exception { + asyncListLocations(); + } + + public static void asyncListLocations() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (ParticipantsClient participantsClient = ParticipantsClient.create()) { + ListLocationsRequest request = + ListLocationsRequest.newBuilder() + .setName("name3373707") + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + ApiFuture future = + participantsClient.listLocationsPagedCallable().futureCall(request); + // Do something. + for (Location element : future.get().iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END dialogflow_v2beta1_generated_participantsclient_listlocations_async] diff --git a/samples/snippets/generated/com/google/cloud/dialogflow/v2beta1/participantsclient/listlocations/AsyncListLocationsPaged.java b/samples/snippets/generated/com/google/cloud/dialogflow/v2beta1/participantsclient/listlocations/AsyncListLocationsPaged.java new file mode 100644 index 000000000..ada7595c6 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/dialogflow/v2beta1/participantsclient/listlocations/AsyncListLocationsPaged.java @@ -0,0 +1,58 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.dialogflow.v2beta1.samples; + +// [START dialogflow_v2beta1_generated_participantsclient_listlocations_paged_async] +import com.google.cloud.dialogflow.v2beta1.ParticipantsClient; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.ListLocationsResponse; +import com.google.cloud.location.Location; +import com.google.common.base.Strings; + +public class AsyncListLocationsPaged { + + public static void main(String[] args) throws Exception { + asyncListLocationsPaged(); + } + + public static void asyncListLocationsPaged() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (ParticipantsClient participantsClient = ParticipantsClient.create()) { + ListLocationsRequest request = + ListLocationsRequest.newBuilder() + .setName("name3373707") + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + while (true) { + ListLocationsResponse response = participantsClient.listLocationsCallable().call(request); + for (Location element : response.getLocationsList()) { + // doThingsWith(element); + } + String nextPageToken = response.getNextPageToken(); + if (!Strings.isNullOrEmpty(nextPageToken)) { + request = request.toBuilder().setPageToken(nextPageToken).build(); + } else { + break; + } + } + } + } +} +// [END dialogflow_v2beta1_generated_participantsclient_listlocations_paged_async] diff --git a/samples/snippets/generated/com/google/cloud/dialogflow/v2beta1/participantsclient/listlocations/SyncListLocations.java b/samples/snippets/generated/com/google/cloud/dialogflow/v2beta1/participantsclient/listlocations/SyncListLocations.java new file mode 100644 index 000000000..9e962d5a3 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/dialogflow/v2beta1/participantsclient/listlocations/SyncListLocations.java @@ -0,0 +1,47 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.dialogflow.v2beta1.samples; + +// [START dialogflow_v2beta1_generated_participantsclient_listlocations_sync] +import com.google.cloud.dialogflow.v2beta1.ParticipantsClient; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.Location; + +public class SyncListLocations { + + public static void main(String[] args) throws Exception { + syncListLocations(); + } + + public static void syncListLocations() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (ParticipantsClient participantsClient = ParticipantsClient.create()) { + ListLocationsRequest request = + ListLocationsRequest.newBuilder() + .setName("name3373707") + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + for (Location element : participantsClient.listLocations(request).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END dialogflow_v2beta1_generated_participantsclient_listlocations_sync] diff --git a/samples/snippets/generated/com/google/cloud/dialogflow/v2beta1/participantsclient/streaminganalyzecontent/AsyncStreamingAnalyzeContent.java b/samples/snippets/generated/com/google/cloud/dialogflow/v2beta1/participantsclient/streaminganalyzecontent/AsyncStreamingAnalyzeContent.java index ac4deea3e..e7fffe09e 100644 --- a/samples/snippets/generated/com/google/cloud/dialogflow/v2beta1/participantsclient/streaminganalyzecontent/AsyncStreamingAnalyzeContent.java +++ b/samples/snippets/generated/com/google/cloud/dialogflow/v2beta1/participantsclient/streaminganalyzecontent/AsyncStreamingAnalyzeContent.java @@ -49,6 +49,7 @@ public static void asyncStreamingAnalyzeContent() throws Exception { .setQueryParams(QueryParameters.newBuilder().build()) .setAssistQueryParams(AssistQueryParameters.newBuilder().build()) .setCxParameters(Struct.newBuilder().build()) + .setCxCurrentPage("cxCurrentPage1596907507") .setEnablePartialAutomatedAgentReply(true) .build(); bidiStream.send(request); diff --git a/samples/snippets/generated/com/google/cloud/dialogflow/v2beta1/sessionentitytypesclient/getlocation/AsyncGetLocation.java b/samples/snippets/generated/com/google/cloud/dialogflow/v2beta1/sessionentitytypesclient/getlocation/AsyncGetLocation.java new file mode 100644 index 000000000..21d9e3605 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/dialogflow/v2beta1/sessionentitytypesclient/getlocation/AsyncGetLocation.java @@ -0,0 +1,43 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.dialogflow.v2beta1.samples; + +// [START dialogflow_v2beta1_generated_sessionentitytypesclient_getlocation_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.dialogflow.v2beta1.SessionEntityTypesClient; +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.Location; + +public class AsyncGetLocation { + + public static void main(String[] args) throws Exception { + asyncGetLocation(); + } + + public static void asyncGetLocation() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (SessionEntityTypesClient sessionEntityTypesClient = SessionEntityTypesClient.create()) { + GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build(); + ApiFuture future = + sessionEntityTypesClient.getLocationCallable().futureCall(request); + // Do something. + Location response = future.get(); + } + } +} +// [END dialogflow_v2beta1_generated_sessionentitytypesclient_getlocation_async] diff --git a/samples/snippets/generated/com/google/cloud/dialogflow/v2beta1/sessionentitytypesclient/getlocation/SyncGetLocation.java b/samples/snippets/generated/com/google/cloud/dialogflow/v2beta1/sessionentitytypesclient/getlocation/SyncGetLocation.java new file mode 100644 index 000000000..cd7914a43 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/dialogflow/v2beta1/sessionentitytypesclient/getlocation/SyncGetLocation.java @@ -0,0 +1,39 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.dialogflow.v2beta1.samples; + +// [START dialogflow_v2beta1_generated_sessionentitytypesclient_getlocation_sync] +import com.google.cloud.dialogflow.v2beta1.SessionEntityTypesClient; +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.Location; + +public class SyncGetLocation { + + public static void main(String[] args) throws Exception { + syncGetLocation(); + } + + public static void syncGetLocation() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (SessionEntityTypesClient sessionEntityTypesClient = SessionEntityTypesClient.create()) { + GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build(); + Location response = sessionEntityTypesClient.getLocation(request); + } + } +} +// [END dialogflow_v2beta1_generated_sessionentitytypesclient_getlocation_sync] diff --git a/samples/snippets/generated/com/google/cloud/dialogflow/v2beta1/sessionentitytypesclient/listlocations/AsyncListLocations.java b/samples/snippets/generated/com/google/cloud/dialogflow/v2beta1/sessionentitytypesclient/listlocations/AsyncListLocations.java new file mode 100644 index 000000000..40526e15b --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/dialogflow/v2beta1/sessionentitytypesclient/listlocations/AsyncListLocations.java @@ -0,0 +1,51 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.dialogflow.v2beta1.samples; + +// [START dialogflow_v2beta1_generated_sessionentitytypesclient_listlocations_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.dialogflow.v2beta1.SessionEntityTypesClient; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.Location; + +public class AsyncListLocations { + + public static void main(String[] args) throws Exception { + asyncListLocations(); + } + + public static void asyncListLocations() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (SessionEntityTypesClient sessionEntityTypesClient = SessionEntityTypesClient.create()) { + ListLocationsRequest request = + ListLocationsRequest.newBuilder() + .setName("name3373707") + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + ApiFuture future = + sessionEntityTypesClient.listLocationsPagedCallable().futureCall(request); + // Do something. + for (Location element : future.get().iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END dialogflow_v2beta1_generated_sessionentitytypesclient_listlocations_async] diff --git a/samples/snippets/generated/com/google/cloud/dialogflow/v2beta1/sessionentitytypesclient/listlocations/AsyncListLocationsPaged.java b/samples/snippets/generated/com/google/cloud/dialogflow/v2beta1/sessionentitytypesclient/listlocations/AsyncListLocationsPaged.java new file mode 100644 index 000000000..9cd9ee680 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/dialogflow/v2beta1/sessionentitytypesclient/listlocations/AsyncListLocationsPaged.java @@ -0,0 +1,59 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.dialogflow.v2beta1.samples; + +// [START dialogflow_v2beta1_generated_sessionentitytypesclient_listlocations_paged_async] +import com.google.cloud.dialogflow.v2beta1.SessionEntityTypesClient; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.ListLocationsResponse; +import com.google.cloud.location.Location; +import com.google.common.base.Strings; + +public class AsyncListLocationsPaged { + + public static void main(String[] args) throws Exception { + asyncListLocationsPaged(); + } + + public static void asyncListLocationsPaged() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (SessionEntityTypesClient sessionEntityTypesClient = SessionEntityTypesClient.create()) { + ListLocationsRequest request = + ListLocationsRequest.newBuilder() + .setName("name3373707") + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + while (true) { + ListLocationsResponse response = + sessionEntityTypesClient.listLocationsCallable().call(request); + for (Location element : response.getLocationsList()) { + // doThingsWith(element); + } + String nextPageToken = response.getNextPageToken(); + if (!Strings.isNullOrEmpty(nextPageToken)) { + request = request.toBuilder().setPageToken(nextPageToken).build(); + } else { + break; + } + } + } + } +} +// [END dialogflow_v2beta1_generated_sessionentitytypesclient_listlocations_paged_async] diff --git a/samples/snippets/generated/com/google/cloud/dialogflow/v2beta1/sessionentitytypesclient/listlocations/SyncListLocations.java b/samples/snippets/generated/com/google/cloud/dialogflow/v2beta1/sessionentitytypesclient/listlocations/SyncListLocations.java new file mode 100644 index 000000000..73f80566d --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/dialogflow/v2beta1/sessionentitytypesclient/listlocations/SyncListLocations.java @@ -0,0 +1,47 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.dialogflow.v2beta1.samples; + +// [START dialogflow_v2beta1_generated_sessionentitytypesclient_listlocations_sync] +import com.google.cloud.dialogflow.v2beta1.SessionEntityTypesClient; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.Location; + +public class SyncListLocations { + + public static void main(String[] args) throws Exception { + syncListLocations(); + } + + public static void syncListLocations() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (SessionEntityTypesClient sessionEntityTypesClient = SessionEntityTypesClient.create()) { + ListLocationsRequest request = + ListLocationsRequest.newBuilder() + .setName("name3373707") + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + for (Location element : sessionEntityTypesClient.listLocations(request).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END dialogflow_v2beta1_generated_sessionentitytypesclient_listlocations_sync] diff --git a/samples/snippets/generated/com/google/cloud/dialogflow/v2beta1/sessionsclient/getlocation/AsyncGetLocation.java b/samples/snippets/generated/com/google/cloud/dialogflow/v2beta1/sessionsclient/getlocation/AsyncGetLocation.java new file mode 100644 index 000000000..d2db2a646 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/dialogflow/v2beta1/sessionsclient/getlocation/AsyncGetLocation.java @@ -0,0 +1,42 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.dialogflow.v2beta1.samples; + +// [START dialogflow_v2beta1_generated_sessionsclient_getlocation_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.dialogflow.v2beta1.SessionsClient; +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.Location; + +public class AsyncGetLocation { + + public static void main(String[] args) throws Exception { + asyncGetLocation(); + } + + public static void asyncGetLocation() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (SessionsClient sessionsClient = SessionsClient.create()) { + GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build(); + ApiFuture future = sessionsClient.getLocationCallable().futureCall(request); + // Do something. + Location response = future.get(); + } + } +} +// [END dialogflow_v2beta1_generated_sessionsclient_getlocation_async] diff --git a/samples/snippets/generated/com/google/cloud/dialogflow/v2beta1/sessionsclient/getlocation/SyncGetLocation.java b/samples/snippets/generated/com/google/cloud/dialogflow/v2beta1/sessionsclient/getlocation/SyncGetLocation.java new file mode 100644 index 000000000..debc60a48 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/dialogflow/v2beta1/sessionsclient/getlocation/SyncGetLocation.java @@ -0,0 +1,39 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.dialogflow.v2beta1.samples; + +// [START dialogflow_v2beta1_generated_sessionsclient_getlocation_sync] +import com.google.cloud.dialogflow.v2beta1.SessionsClient; +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.Location; + +public class SyncGetLocation { + + public static void main(String[] args) throws Exception { + syncGetLocation(); + } + + public static void syncGetLocation() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (SessionsClient sessionsClient = SessionsClient.create()) { + GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build(); + Location response = sessionsClient.getLocation(request); + } + } +} +// [END dialogflow_v2beta1_generated_sessionsclient_getlocation_sync] diff --git a/samples/snippets/generated/com/google/cloud/dialogflow/v2beta1/sessionsclient/listlocations/AsyncListLocations.java b/samples/snippets/generated/com/google/cloud/dialogflow/v2beta1/sessionsclient/listlocations/AsyncListLocations.java new file mode 100644 index 000000000..6d7fc1c14 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/dialogflow/v2beta1/sessionsclient/listlocations/AsyncListLocations.java @@ -0,0 +1,50 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.dialogflow.v2beta1.samples; + +// [START dialogflow_v2beta1_generated_sessionsclient_listlocations_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.dialogflow.v2beta1.SessionsClient; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.Location; + +public class AsyncListLocations { + + public static void main(String[] args) throws Exception { + asyncListLocations(); + } + + public static void asyncListLocations() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (SessionsClient sessionsClient = SessionsClient.create()) { + ListLocationsRequest request = + ListLocationsRequest.newBuilder() + .setName("name3373707") + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + ApiFuture future = sessionsClient.listLocationsPagedCallable().futureCall(request); + // Do something. + for (Location element : future.get().iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END dialogflow_v2beta1_generated_sessionsclient_listlocations_async] diff --git a/samples/snippets/generated/com/google/cloud/dialogflow/v2beta1/sessionsclient/listlocations/AsyncListLocationsPaged.java b/samples/snippets/generated/com/google/cloud/dialogflow/v2beta1/sessionsclient/listlocations/AsyncListLocationsPaged.java new file mode 100644 index 000000000..aa50121d7 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/dialogflow/v2beta1/sessionsclient/listlocations/AsyncListLocationsPaged.java @@ -0,0 +1,58 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.dialogflow.v2beta1.samples; + +// [START dialogflow_v2beta1_generated_sessionsclient_listlocations_paged_async] +import com.google.cloud.dialogflow.v2beta1.SessionsClient; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.ListLocationsResponse; +import com.google.cloud.location.Location; +import com.google.common.base.Strings; + +public class AsyncListLocationsPaged { + + public static void main(String[] args) throws Exception { + asyncListLocationsPaged(); + } + + public static void asyncListLocationsPaged() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (SessionsClient sessionsClient = SessionsClient.create()) { + ListLocationsRequest request = + ListLocationsRequest.newBuilder() + .setName("name3373707") + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + while (true) { + ListLocationsResponse response = sessionsClient.listLocationsCallable().call(request); + for (Location element : response.getLocationsList()) { + // doThingsWith(element); + } + String nextPageToken = response.getNextPageToken(); + if (!Strings.isNullOrEmpty(nextPageToken)) { + request = request.toBuilder().setPageToken(nextPageToken).build(); + } else { + break; + } + } + } + } +} +// [END dialogflow_v2beta1_generated_sessionsclient_listlocations_paged_async] diff --git a/samples/snippets/generated/com/google/cloud/dialogflow/v2beta1/sessionsclient/listlocations/SyncListLocations.java b/samples/snippets/generated/com/google/cloud/dialogflow/v2beta1/sessionsclient/listlocations/SyncListLocations.java new file mode 100644 index 000000000..1ca8cb81e --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/dialogflow/v2beta1/sessionsclient/listlocations/SyncListLocations.java @@ -0,0 +1,47 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.dialogflow.v2beta1.samples; + +// [START dialogflow_v2beta1_generated_sessionsclient_listlocations_sync] +import com.google.cloud.dialogflow.v2beta1.SessionsClient; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.Location; + +public class SyncListLocations { + + public static void main(String[] args) throws Exception { + syncListLocations(); + } + + public static void syncListLocations() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (SessionsClient sessionsClient = SessionsClient.create()) { + ListLocationsRequest request = + ListLocationsRequest.newBuilder() + .setName("name3373707") + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + for (Location element : sessionsClient.listLocations(request).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END dialogflow_v2beta1_generated_sessionsclient_listlocations_sync] diff --git a/samples/snippets/generated/com/google/cloud/dialogflow/v2beta1/versionsclient/getlocation/AsyncGetLocation.java b/samples/snippets/generated/com/google/cloud/dialogflow/v2beta1/versionsclient/getlocation/AsyncGetLocation.java new file mode 100644 index 000000000..349f2368f --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/dialogflow/v2beta1/versionsclient/getlocation/AsyncGetLocation.java @@ -0,0 +1,42 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.dialogflow.v2beta1.samples; + +// [START dialogflow_v2beta1_generated_versionsclient_getlocation_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.dialogflow.v2beta1.VersionsClient; +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.Location; + +public class AsyncGetLocation { + + public static void main(String[] args) throws Exception { + asyncGetLocation(); + } + + public static void asyncGetLocation() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (VersionsClient versionsClient = VersionsClient.create()) { + GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build(); + ApiFuture future = versionsClient.getLocationCallable().futureCall(request); + // Do something. + Location response = future.get(); + } + } +} +// [END dialogflow_v2beta1_generated_versionsclient_getlocation_async] diff --git a/samples/snippets/generated/com/google/cloud/dialogflow/v2beta1/versionsclient/getlocation/SyncGetLocation.java b/samples/snippets/generated/com/google/cloud/dialogflow/v2beta1/versionsclient/getlocation/SyncGetLocation.java new file mode 100644 index 000000000..e7abcf303 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/dialogflow/v2beta1/versionsclient/getlocation/SyncGetLocation.java @@ -0,0 +1,39 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.dialogflow.v2beta1.samples; + +// [START dialogflow_v2beta1_generated_versionsclient_getlocation_sync] +import com.google.cloud.dialogflow.v2beta1.VersionsClient; +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.Location; + +public class SyncGetLocation { + + public static void main(String[] args) throws Exception { + syncGetLocation(); + } + + public static void syncGetLocation() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (VersionsClient versionsClient = VersionsClient.create()) { + GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build(); + Location response = versionsClient.getLocation(request); + } + } +} +// [END dialogflow_v2beta1_generated_versionsclient_getlocation_sync] diff --git a/samples/snippets/generated/com/google/cloud/dialogflow/v2beta1/versionsclient/listlocations/AsyncListLocations.java b/samples/snippets/generated/com/google/cloud/dialogflow/v2beta1/versionsclient/listlocations/AsyncListLocations.java new file mode 100644 index 000000000..9390bb27a --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/dialogflow/v2beta1/versionsclient/listlocations/AsyncListLocations.java @@ -0,0 +1,50 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.dialogflow.v2beta1.samples; + +// [START dialogflow_v2beta1_generated_versionsclient_listlocations_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.dialogflow.v2beta1.VersionsClient; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.Location; + +public class AsyncListLocations { + + public static void main(String[] args) throws Exception { + asyncListLocations(); + } + + public static void asyncListLocations() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (VersionsClient versionsClient = VersionsClient.create()) { + ListLocationsRequest request = + ListLocationsRequest.newBuilder() + .setName("name3373707") + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + ApiFuture future = versionsClient.listLocationsPagedCallable().futureCall(request); + // Do something. + for (Location element : future.get().iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END dialogflow_v2beta1_generated_versionsclient_listlocations_async] diff --git a/samples/snippets/generated/com/google/cloud/dialogflow/v2beta1/versionsclient/listlocations/AsyncListLocationsPaged.java b/samples/snippets/generated/com/google/cloud/dialogflow/v2beta1/versionsclient/listlocations/AsyncListLocationsPaged.java new file mode 100644 index 000000000..318dda2c8 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/dialogflow/v2beta1/versionsclient/listlocations/AsyncListLocationsPaged.java @@ -0,0 +1,58 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.dialogflow.v2beta1.samples; + +// [START dialogflow_v2beta1_generated_versionsclient_listlocations_paged_async] +import com.google.cloud.dialogflow.v2beta1.VersionsClient; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.ListLocationsResponse; +import com.google.cloud.location.Location; +import com.google.common.base.Strings; + +public class AsyncListLocationsPaged { + + public static void main(String[] args) throws Exception { + asyncListLocationsPaged(); + } + + public static void asyncListLocationsPaged() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (VersionsClient versionsClient = VersionsClient.create()) { + ListLocationsRequest request = + ListLocationsRequest.newBuilder() + .setName("name3373707") + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + while (true) { + ListLocationsResponse response = versionsClient.listLocationsCallable().call(request); + for (Location element : response.getLocationsList()) { + // doThingsWith(element); + } + String nextPageToken = response.getNextPageToken(); + if (!Strings.isNullOrEmpty(nextPageToken)) { + request = request.toBuilder().setPageToken(nextPageToken).build(); + } else { + break; + } + } + } + } +} +// [END dialogflow_v2beta1_generated_versionsclient_listlocations_paged_async] diff --git a/samples/snippets/generated/com/google/cloud/dialogflow/v2beta1/versionsclient/listlocations/SyncListLocations.java b/samples/snippets/generated/com/google/cloud/dialogflow/v2beta1/versionsclient/listlocations/SyncListLocations.java new file mode 100644 index 000000000..057f3c3f0 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/dialogflow/v2beta1/versionsclient/listlocations/SyncListLocations.java @@ -0,0 +1,47 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.dialogflow.v2beta1.samples; + +// [START dialogflow_v2beta1_generated_versionsclient_listlocations_sync] +import com.google.cloud.dialogflow.v2beta1.VersionsClient; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.Location; + +public class SyncListLocations { + + public static void main(String[] args) throws Exception { + syncListLocations(); + } + + public static void syncListLocations() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (VersionsClient versionsClient = VersionsClient.create()) { + ListLocationsRequest request = + ListLocationsRequest.newBuilder() + .setName("name3373707") + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + for (Location element : versionsClient.listLocations(request).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END dialogflow_v2beta1_generated_versionsclient_listlocations_sync]