From 329b306505d291dc9f7b3e9832adf20d0abc30a8 Mon Sep 17 00:00:00 2001 From: Yoshi Automation Bot Date: Mon, 14 Dec 2020 11:08:11 -0800 Subject: [PATCH] feat: allowed custom to specify webhook headers through query parameters (#109) This PR was generated using Autosynth. :rainbow: Synth log will be available here: https://source.cloud.google.com/results/invocations/a0fa0bb5-ad7e-435c-ac39-17051adf64ae/targets - [ ] To automatically regenerate this PR, check this box. PiperOrigin-RevId: 346434847 Source-Link: https://github.com/googleapis/googleapis/commit/e4d01555afeb93d2f3b467056ea884b092567d1b PiperOrigin-RevId: 346372957 Source-Link: https://github.com/googleapis/googleapis/commit/857f70daef9f4c38f042fb3dfb7b8423ae18fd19 PiperOrigin-RevId: 346126713 Source-Link: https://github.com/googleapis/googleapis/commit/b8b2f8c288cec1f673bf10aa5008819c1576bf2e PiperOrigin-RevId: 345476969 Source-Link: https://github.com/googleapis/googleapis/commit/7be2c821dd88109038c55c89f7dd48f092eeab9d PiperOrigin-RevId: 345067549 Source-Link: https://github.com/googleapis/googleapis/commit/8cfc6c874574b649b4524a4ef6a0651533325a84 PiperOrigin-RevId: 345049577 Source-Link: https://github.com/googleapis/googleapis/commit/ca7389d35c91ba8aae893fbafd68127d1ff535d2 PiperOrigin-RevId: 344134135 Source-Link: https://github.com/googleapis/googleapis/commit/b11a87f3b54be3a5e42c15020ee1e0781f86da90 PiperOrigin-RevId: 342188199 Source-Link: https://github.com/googleapis/googleapis/commit/836f0eaf5f21f300f63ac635e5ef263d183e0cdd --- .../cloud/dialogflow/cx/v3/AgentsClient.java | 413 +- .../dialogflow/cx/v3/AgentsSettings.java | 43 +- .../dialogflow/cx/v3/EntityTypesClient.java | 318 +- .../dialogflow/cx/v3/EntityTypesSettings.java | 35 +- .../dialogflow/cx/v3/EnvironmentsClient.java | 449 +- .../cx/v3/EnvironmentsSettings.java | 43 +- .../cloud/dialogflow/cx/v3/FlowsClient.java | 399 +- .../cloud/dialogflow/cx/v3/FlowsSettings.java | 39 +- .../cloud/dialogflow/cx/v3/IntentsClient.java | 321 +- .../dialogflow/cx/v3/IntentsSettings.java | 35 +- .../cloud/dialogflow/cx/v3/PagesClient.java | 321 +- .../cloud/dialogflow/cx/v3/PagesSettings.java | 35 +- .../cx/v3/SecuritySettingsServiceClient.java | 317 +- .../v3/SecuritySettingsServiceSettings.java | 35 +- .../cx/v3/SessionEntityTypesClient.java | 312 +- .../cx/v3/SessionEntityTypesSettings.java | 35 +- .../dialogflow/cx/v3/SessionsClient.java | 150 +- .../dialogflow/cx/v3/SessionsSettings.java | 35 +- .../cx/v3/TransitionRouteGroupsClient.java | 312 +- .../cx/v3/TransitionRouteGroupsSettings.java | 35 +- .../dialogflow/cx/v3/VersionsClient.java | 418 +- .../dialogflow/cx/v3/VersionsSettings.java | 43 +- .../dialogflow/cx/v3/WebhooksClient.java | 318 +- .../dialogflow/cx/v3/WebhooksSettings.java | 35 +- .../cloud/dialogflow/cx/v3/package-info.java | 175 +- .../dialogflow/cx/v3/stub/AgentsStub.java | 12 +- .../cx/v3/stub/AgentsStubSettings.java | 293 +- .../cx/v3/stub/EntityTypesStub.java | 9 +- .../cx/v3/stub/EntityTypesStubSettings.java | 240 +- .../cx/v3/stub/EnvironmentsStub.java | 12 +- .../cx/v3/stub/EnvironmentsStubSettings.java | 437 +- .../dialogflow/cx/v3/stub/FlowsStub.java | 11 +- .../cx/v3/stub/FlowsStubSettings.java | 265 +- .../cx/v3/stub/GrpcAgentsCallableFactory.java | 40 +- .../dialogflow/cx/v3/stub/GrpcAgentsStub.java | 53 +- .../stub/GrpcEntityTypesCallableFactory.java | 40 +- .../cx/v3/stub/GrpcEntityTypesStub.java | 35 +- .../stub/GrpcEnvironmentsCallableFactory.java | 40 +- .../cx/v3/stub/GrpcEnvironmentsStub.java | 64 +- .../cx/v3/stub/GrpcFlowsCallableFactory.java | 40 +- .../dialogflow/cx/v3/stub/GrpcFlowsStub.java | 45 +- .../v3/stub/GrpcIntentsCallableFactory.java | 40 +- .../cx/v3/stub/GrpcIntentsStub.java | 33 +- .../cx/v3/stub/GrpcPagesCallableFactory.java | 40 +- .../dialogflow/cx/v3/stub/GrpcPagesStub.java | 33 +- ...ecuritySettingsServiceCallableFactory.java | 40 +- .../stub/GrpcSecuritySettingsServiceStub.java | 39 +- ...GrpcSessionEntityTypesCallableFactory.java | 40 +- .../v3/stub/GrpcSessionEntityTypesStub.java | 35 +- .../v3/stub/GrpcSessionsCallableFactory.java | 40 +- .../cx/v3/stub/GrpcSessionsStub.java | 28 +- ...cTransitionRouteGroupsCallableFactory.java | 40 +- .../stub/GrpcTransitionRouteGroupsStub.java | 35 +- .../v3/stub/GrpcVersionsCallableFactory.java | 40 +- .../cx/v3/stub/GrpcVersionsStub.java | 56 +- .../v3/stub/GrpcWebhooksCallableFactory.java | 40 +- .../cx/v3/stub/GrpcWebhooksStub.java | 33 +- .../dialogflow/cx/v3/stub/IntentsStub.java | 9 +- .../cx/v3/stub/IntentsStubSettings.java | 237 +- .../dialogflow/cx/v3/stub/PagesStub.java | 9 +- .../cx/v3/stub/PagesStubSettings.java | 237 +- .../v3/stub/SecuritySettingsServiceStub.java | 9 +- .../SecuritySettingsServiceStubSettings.java | 261 +- .../cx/v3/stub/SessionEntityTypesStub.java | 9 +- .../stub/SessionEntityTypesStubSettings.java | 271 +- .../dialogflow/cx/v3/stub/SessionsStub.java | 9 +- .../cx/v3/stub/SessionsStubSettings.java | 112 +- .../cx/v3/stub/TransitionRouteGroupsStub.java | 9 +- .../TransitionRouteGroupsStubSettings.java | 281 +- .../dialogflow/cx/v3/stub/VersionsStub.java | 12 +- .../cx/v3/stub/VersionsStubSettings.java | 284 +- .../dialogflow/cx/v3/stub/WebhooksStub.java | 9 +- .../cx/v3/stub/WebhooksStubSettings.java | 237 +- .../dialogflow/cx/v3beta1/AgentsClient.java | 414 +- .../dialogflow/cx/v3beta1/AgentsSettings.java | 44 +- .../cx/v3beta1/EntityTypesClient.java | 319 +- .../cx/v3beta1/EntityTypesSettings.java | 36 +- .../cx/v3beta1/EnvironmentsClient.java | 450 +- .../cx/v3beta1/EnvironmentsSettings.java | 44 +- .../dialogflow/cx/v3beta1/FlowsClient.java | 400 +- .../dialogflow/cx/v3beta1/FlowsSettings.java | 40 +- .../dialogflow/cx/v3beta1/IntentsClient.java | 322 +- .../cx/v3beta1/IntentsSettings.java | 36 +- .../dialogflow/cx/v3beta1/PagesClient.java | 322 +- .../dialogflow/cx/v3beta1/PagesSettings.java | 36 +- .../cx/v3beta1/SessionEntityTypesClient.java | 313 +- .../v3beta1/SessionEntityTypesSettings.java | 36 +- .../dialogflow/cx/v3beta1/SessionsClient.java | 158 +- .../cx/v3beta1/SessionsSettings.java | 36 +- .../v3beta1/TransitionRouteGroupsClient.java | 313 +- .../TransitionRouteGroupsSettings.java | 36 +- .../dialogflow/cx/v3beta1/VersionsClient.java | 419 +- .../cx/v3beta1/VersionsSettings.java | 44 +- .../dialogflow/cx/v3beta1/WebhooksClient.java | 319 +- .../cx/v3beta1/WebhooksSettings.java | 36 +- .../dialogflow/cx/v3beta1/package-info.java | 159 +- .../cx/v3beta1/stub/AgentsStub.java | 12 +- .../cx/v3beta1/stub/AgentsStubSettings.java | 292 +- .../cx/v3beta1/stub/EntityTypesStub.java | 9 +- .../v3beta1/stub/EntityTypesStubSettings.java | 239 +- .../cx/v3beta1/stub/EnvironmentsStub.java | 12 +- .../stub/EnvironmentsStubSettings.java | 436 +- .../dialogflow/cx/v3beta1/stub/FlowsStub.java | 11 +- .../cx/v3beta1/stub/FlowsStubSettings.java | 264 +- .../stub/GrpcAgentsCallableFactory.java | 40 +- .../cx/v3beta1/stub/GrpcAgentsStub.java | 53 +- .../stub/GrpcEntityTypesCallableFactory.java | 40 +- .../cx/v3beta1/stub/GrpcEntityTypesStub.java | 35 +- .../stub/GrpcEnvironmentsCallableFactory.java | 40 +- .../cx/v3beta1/stub/GrpcEnvironmentsStub.java | 64 +- .../stub/GrpcFlowsCallableFactory.java | 40 +- .../cx/v3beta1/stub/GrpcFlowsStub.java | 45 +- .../stub/GrpcIntentsCallableFactory.java | 40 +- .../cx/v3beta1/stub/GrpcIntentsStub.java | 33 +- .../stub/GrpcPagesCallableFactory.java | 40 +- .../cx/v3beta1/stub/GrpcPagesStub.java | 33 +- ...GrpcSessionEntityTypesCallableFactory.java | 40 +- .../stub/GrpcSessionEntityTypesStub.java | 35 +- .../stub/GrpcSessionsCallableFactory.java | 40 +- .../cx/v3beta1/stub/GrpcSessionsStub.java | 28 +- ...cTransitionRouteGroupsCallableFactory.java | 40 +- .../stub/GrpcTransitionRouteGroupsStub.java | 35 +- .../stub/GrpcVersionsCallableFactory.java | 40 +- .../cx/v3beta1/stub/GrpcVersionsStub.java | 56 +- .../stub/GrpcWebhooksCallableFactory.java | 40 +- .../cx/v3beta1/stub/GrpcWebhooksStub.java | 33 +- .../cx/v3beta1/stub/IntentsStub.java | 9 +- .../cx/v3beta1/stub/IntentsStubSettings.java | 236 +- .../dialogflow/cx/v3beta1/stub/PagesStub.java | 9 +- .../cx/v3beta1/stub/PagesStubSettings.java | 236 +- .../v3beta1/stub/SessionEntityTypesStub.java | 9 +- .../stub/SessionEntityTypesStubSettings.java | 270 +- .../cx/v3beta1/stub/SessionsStub.java | 9 +- .../cx/v3beta1/stub/SessionsStubSettings.java | 111 +- .../stub/TransitionRouteGroupsStub.java | 9 +- .../TransitionRouteGroupsStubSettings.java | 280 +- .../cx/v3beta1/stub/VersionsStub.java | 12 +- .../cx/v3beta1/stub/VersionsStubSettings.java | 283 +- .../cx/v3beta1/stub/WebhooksStub.java | 9 +- .../cx/v3beta1/stub/WebhooksStubSettings.java | 236 +- .../dialogflow/cx/v3/AgentsClientTest.java | 438 +- .../cx/v3/EntityTypesClientTest.java | 324 +- .../cx/v3/EnvironmentsClientTest.java | 404 +- .../dialogflow/cx/v3/FlowsClientTest.java | 379 +- .../dialogflow/cx/v3/IntentsClientTest.java | 347 +- .../cloud/dialogflow/cx/v3/MockAgents.java | 6 +- .../dialogflow/cx/v3/MockAgentsImpl.java | 34 +- .../dialogflow/cx/v3/MockEntityTypes.java | 6 +- .../dialogflow/cx/v3/MockEntityTypesImpl.java | 26 +- .../dialogflow/cx/v3/MockEnvironments.java | 6 +- .../cx/v3/MockEnvironmentsImpl.java | 30 +- .../cloud/dialogflow/cx/v3/MockFlows.java | 6 +- .../cloud/dialogflow/cx/v3/MockFlowsImpl.java | 30 +- .../cloud/dialogflow/cx/v3/MockIntents.java | 6 +- .../dialogflow/cx/v3/MockIntentsImpl.java | 26 +- .../cloud/dialogflow/cx/v3/MockPages.java | 6 +- .../cloud/dialogflow/cx/v3/MockPagesImpl.java | 26 +- .../cx/v3/MockSecuritySettingsService.java | 6 +- .../v3/MockSecuritySettingsServiceImpl.java | 26 +- .../cx/v3/MockSessionEntityTypes.java | 6 +- .../cx/v3/MockSessionEntityTypesImpl.java | 26 +- .../cloud/dialogflow/cx/v3/MockSessions.java | 6 +- .../dialogflow/cx/v3/MockSessionsImpl.java | 22 +- .../cx/v3/MockTransitionRouteGroups.java | 6 +- .../cx/v3/MockTransitionRouteGroupsImpl.java | 26 +- .../cloud/dialogflow/cx/v3/MockVersions.java | 6 +- .../dialogflow/cx/v3/MockVersionsImpl.java | 30 +- .../cloud/dialogflow/cx/v3/MockWebhooks.java | 6 +- .../dialogflow/cx/v3/MockWebhooksImpl.java | 26 +- .../dialogflow/cx/v3/PagesClientTest.java | 332 +- .../v3/SecuritySettingsServiceClientTest.java | 338 +- .../cx/v3/SessionEntityTypesClientTest.java | 324 +- .../dialogflow/cx/v3/SessionsClientTest.java | 221 +- .../v3/TransitionRouteGroupsClientTest.java | 329 +- .../dialogflow/cx/v3/VersionsClientTest.java | 389 +- .../dialogflow/cx/v3/WebhooksClientTest.java | 314 +- .../cx/v3beta1/AgentsClientTest.java | 435 +- .../cx/v3beta1/EntityTypesClientTest.java | 321 +- .../cx/v3beta1/EnvironmentsClientTest.java | 401 +- .../cx/v3beta1/FlowsClientTest.java | 376 +- .../cx/v3beta1/IntentsClientTest.java | 344 +- .../dialogflow/cx/v3beta1/MockAgents.java | 6 +- .../dialogflow/cx/v3beta1/MockAgentsImpl.java | 34 +- .../cx/v3beta1/MockEntityTypes.java | 6 +- .../cx/v3beta1/MockEntityTypesImpl.java | 26 +- .../cx/v3beta1/MockEnvironments.java | 6 +- .../cx/v3beta1/MockEnvironmentsImpl.java | 30 +- .../dialogflow/cx/v3beta1/MockFlows.java | 6 +- .../dialogflow/cx/v3beta1/MockFlowsImpl.java | 30 +- .../dialogflow/cx/v3beta1/MockIntents.java | 6 +- .../cx/v3beta1/MockIntentsImpl.java | 26 +- .../dialogflow/cx/v3beta1/MockPages.java | 6 +- .../dialogflow/cx/v3beta1/MockPagesImpl.java | 26 +- .../cx/v3beta1/MockSessionEntityTypes.java | 6 +- .../v3beta1/MockSessionEntityTypesImpl.java | 26 +- .../dialogflow/cx/v3beta1/MockSessions.java | 6 +- .../cx/v3beta1/MockSessionsImpl.java | 22 +- .../cx/v3beta1/MockTransitionRouteGroups.java | 6 +- .../MockTransitionRouteGroupsImpl.java | 26 +- .../dialogflow/cx/v3beta1/MockVersions.java | 6 +- .../cx/v3beta1/MockVersionsImpl.java | 30 +- .../dialogflow/cx/v3beta1/MockWebhooks.java | 6 +- .../cx/v3beta1/MockWebhooksImpl.java | 26 +- .../cx/v3beta1/PagesClientTest.java | 329 +- .../v3beta1/SessionEntityTypesClientTest.java | 321 +- .../cx/v3beta1/SessionsClientTest.java | 218 +- .../TransitionRouteGroupsClientTest.java | 326 +- .../cx/v3beta1/VersionsClientTest.java | 386 +- .../cx/v3beta1/WebhooksClientTest.java | 311 +- .../dialogflow/cx/v3beta1/SessionsGrpc.java | 18 + .../cloud/dialogflow/cx/v3/AgentName.java | 113 +- .../dialogflow/cx/v3/EntityTypeName.java | 127 +- .../dialogflow/cx/v3/EnvironmentName.java | 127 +- .../cloud/dialogflow/cx/v3/FlowName.java | 125 +- .../cloud/dialogflow/cx/v3/IntentName.java | 125 +- .../cloud/dialogflow/cx/v3/LocationName.java | 98 +- .../cloud/dialogflow/cx/v3/PageName.java | 140 +- .../cx/v3/SecuritySettingsName.java | 112 +- .../cx/v3/SessionEntityTypeName.java | 188 +- .../cloud/dialogflow/cx/v3/SessionName.java | 165 +- .../cx/v3/TransitionRouteGroupName.java | 141 +- .../cloud/dialogflow/cx/v3/VersionName.java | 141 +- .../cloud/dialogflow/cx/v3/WebhookName.java | 125 +- .../dialogflow/cx/v3beta1/AgentName.java | 113 +- .../cx/v3beta1/DetectIntentRequest.java | 21 + .../v3beta1/DetectIntentRequestOrBuilder.java | 6 + .../dialogflow/cx/v3beta1/EntityTypeName.java | 127 +- .../cx/v3beta1/EnvironmentName.java | 127 +- .../cloud/dialogflow/cx/v3beta1/FlowName.java | 125 +- .../dialogflow/cx/v3beta1/IntentName.java | 125 +- .../dialogflow/cx/v3beta1/LocationName.java | 98 +- .../cloud/dialogflow/cx/v3beta1/PageName.java | 140 +- .../cx/v3beta1/QueryParameters.java | 407 ++ .../cx/v3beta1/QueryParametersOrBuilder.java | 89 + .../cx/v3beta1/ResponseMessage.java | 4880 ++++++++--------- .../cx/v3beta1/ResponseMessageProto.java | 68 +- .../cx/v3beta1/SessionEntityTypeName.java | 188 +- .../dialogflow/cx/v3beta1/SessionName.java | 165 +- .../dialogflow/cx/v3beta1/SessionProto.java | 247 +- .../v3beta1/StreamingDetectIntentRequest.java | 21 + ...StreamingDetectIntentRequestOrBuilder.java | 6 + .../cx/v3beta1/TransitionRouteGroupName.java | 141 +- .../dialogflow/cx/v3beta1/VersionName.java | 141 +- .../dialogflow/cx/v3beta1/WebhookName.java | 125 +- .../cx/v3beta1/response_message.proto | 38 +- .../cloud/dialogflow/cx/v3beta1/session.proto | 26 + synth.metadata | 14 +- 247 files changed, 15941 insertions(+), 19046 deletions(-) diff --git a/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3/AgentsClient.java b/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3/AgentsClient.java index d9a48bfed..883f81f71 100644 --- a/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3/AgentsClient.java +++ b/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3/AgentsClient.java @@ -5,7 +5,7 @@ * 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 + * 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, @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.google.cloud.dialogflow.cx.v3; import com.google.api.core.ApiFunction; @@ -40,23 +41,14 @@ import java.util.concurrent.TimeUnit; import javax.annotation.Generated; -// AUTO-GENERATED DOCUMENTATION AND SERVICE +// AUTO-GENERATED DOCUMENTATION AND CLASS. /** * Service Description: Service for managing [Agents][google.cloud.dialogflow.cx.v3.Agent]. * *

This class provides the ability to make remote calls to the backing service through method * calls that map to API methods. Sample code to get started: * - *

- * 
- * try (AgentsClient agentsClient = AgentsClient.create()) {
- *   AgentName name = AgentName.of("[PROJECT]", "[LOCATION]", "[AGENT]");
- *   Agent response = agentsClient.getAgent(name);
- * }
- * 
- * 
- * - *

Note: close() needs to be called on the agentsClient object to clean up resources such as + *

Note: close() needs to be called on the AgentsClient object to clean up resources such as * threads. In the example above, try-with-resources is used, which automatically calls close(). * *

The surface of this class includes several types of Java methods for each of the API's @@ -84,28 +76,24 @@ * *

To customize credentials: * - *

- * 
+ * 
{@code
  * AgentsSettings agentsSettings =
  *     AgentsSettings.newBuilder()
  *         .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
  *         .build();
- * AgentsClient agentsClient =
- *     AgentsClient.create(agentsSettings);
- * 
- * 
+ * AgentsClient agentsClient = AgentsClient.create(agentsSettings); + * }
* - * To customize the endpoint: + *

To customize the endpoint: * - *

- * 
- * AgentsSettings agentsSettings =
- *     AgentsSettings.newBuilder().setEndpoint(myEndpoint).build();
- * AgentsClient agentsClient =
- *     AgentsClient.create(agentsSettings);
- * 
- * 
+ *
{@code
+ * AgentsSettings agentsSettings = AgentsSettings.newBuilder().setEndpoint(myEndpoint).build();
+ * AgentsClient agentsClient = AgentsClient.create(agentsSettings);
+ * }
+ * + *

Please refer to the GitHub repository's samples for more quickstart code snippets. */ +@BetaApi @Generated("by gapic-generator") public class AgentsClient implements BackgroundResource { private final AgentsSettings settings; @@ -127,7 +115,7 @@ public static final AgentsClient create(AgentsSettings settings) throws IOExcept /** * Constructs an instance of AgentsClient, using the given stub for making calls. This is for - * advanced usage - prefer to use AgentsSettings}. + * advanced usage - prefer using create(AgentsSettings). */ @BetaApi("A restructuring of stub classes is planned, so this may break in the future") public static final AgentsClient create(AgentsStub stub) { @@ -164,27 +152,14 @@ public AgentsStub getStub() { * Returns the OperationsClient that can be used to query the status of a long-running operation * returned by another API method call. */ - @BetaApi( - "The surface for long-running operations is not stable yet and may change in the future.") public final OperationsClient getOperationsClient() { return operationsClient; } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Returns the list of all agents in the specified location. * - *

Sample code: - * - *


-   * try (AgentsClient agentsClient = AgentsClient.create()) {
-   *   LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
-   *   for (Agent element : agentsClient.listAgents(parent).iterateAll()) {
-   *     // doThingsWith(element);
-   *   }
-   * }
-   * 
- * * @param parent Required. The location to list all agents for. Format: `projects/<Project * ID>/locations/<Location ID>`. * @throws com.google.api.gax.rpc.ApiException if the remote call fails @@ -195,21 +170,10 @@ public final ListAgentsPagedResponse listAgents(LocationName parent) { return listAgents(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Returns the list of all agents in the specified location. * - *

Sample code: - * - *


-   * try (AgentsClient agentsClient = AgentsClient.create()) {
-   *   LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
-   *   for (Agent element : agentsClient.listAgents(parent.toString()).iterateAll()) {
-   *     // doThingsWith(element);
-   *   }
-   * }
-   * 
- * * @param parent Required. The location to list all agents for. Format: `projects/<Project * ID>/locations/<Location ID>`. * @throws com.google.api.gax.rpc.ApiException if the remote call fails @@ -219,24 +183,10 @@ public final ListAgentsPagedResponse listAgents(String parent) { return listAgents(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Returns the list of all agents in the specified location. * - *

Sample code: - * - *


-   * try (AgentsClient agentsClient = AgentsClient.create()) {
-   *   LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
-   *   ListAgentsRequest request = ListAgentsRequest.newBuilder()
-   *     .setParent(parent.toString())
-   *     .build();
-   *   for (Agent element : agentsClient.listAgents(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 */ @@ -244,74 +194,30 @@ public final ListAgentsPagedResponse listAgents(ListAgentsRequest request) { return listAgentsPagedCallable().call(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Returns the list of all agents in the specified location. * *

Sample code: - * - *


-   * try (AgentsClient agentsClient = AgentsClient.create()) {
-   *   LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
-   *   ListAgentsRequest request = ListAgentsRequest.newBuilder()
-   *     .setParent(parent.toString())
-   *     .build();
-   *   ApiFuture<ListAgentsPagedResponse> future = agentsClient.listAgentsPagedCallable().futureCall(request);
-   *   // Do something
-   *   for (Agent element : future.get().iterateAll()) {
-   *     // doThingsWith(element);
-   *   }
-   * }
-   * 
*/ public final UnaryCallable listAgentsPagedCallable() { return stub.listAgentsPagedCallable(); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Returns the list of all agents in the specified location. * *

Sample code: - * - *


-   * try (AgentsClient agentsClient = AgentsClient.create()) {
-   *   LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
-   *   ListAgentsRequest request = ListAgentsRequest.newBuilder()
-   *     .setParent(parent.toString())
-   *     .build();
-   *   while (true) {
-   *     ListAgentsResponse response = agentsClient.listAgentsCallable().call(request);
-   *     for (Agent element : response.getAgentsList()) {
-   *       // doThingsWith(element);
-   *     }
-   *     String nextPageToken = response.getNextPageToken();
-   *     if (!Strings.isNullOrEmpty(nextPageToken)) {
-   *       request = request.toBuilder().setPageToken(nextPageToken).build();
-   *     } else {
-   *       break;
-   *     }
-   *   }
-   * }
-   * 
*/ public final UnaryCallable listAgentsCallable() { return stub.listAgentsCallable(); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Retrieves the specified agent. * - *

Sample code: - * - *


-   * try (AgentsClient agentsClient = AgentsClient.create()) {
-   *   AgentName name = AgentName.of("[PROJECT]", "[LOCATION]", "[AGENT]");
-   *   Agent response = agentsClient.getAgent(name);
-   * }
-   * 
- * * @param name Required. The name of the agent. Format: `projects/<Project * ID>/locations/<Location ID>/agents/<Agent ID>`. * @throws com.google.api.gax.rpc.ApiException if the remote call fails @@ -322,19 +228,10 @@ public final Agent getAgent(AgentName name) { return getAgent(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Retrieves the specified agent. * - *

Sample code: - * - *


-   * try (AgentsClient agentsClient = AgentsClient.create()) {
-   *   AgentName name = AgentName.of("[PROJECT]", "[LOCATION]", "[AGENT]");
-   *   Agent response = agentsClient.getAgent(name.toString());
-   * }
-   * 
- * * @param name Required. The name of the agent. Format: `projects/<Project * ID>/locations/<Location ID>/agents/<Agent ID>`. * @throws com.google.api.gax.rpc.ApiException if the remote call fails @@ -344,22 +241,10 @@ public final Agent getAgent(String name) { return getAgent(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Retrieves the specified agent. * - *

Sample code: - * - *


-   * try (AgentsClient agentsClient = AgentsClient.create()) {
-   *   AgentName name = AgentName.of("[PROJECT]", "[LOCATION]", "[AGENT]");
-   *   GetAgentRequest request = GetAgentRequest.newBuilder()
-   *     .setName(name.toString())
-   *     .build();
-   *   Agent response = agentsClient.getAgent(request);
-   * }
-   * 
- * * @param request The request object containing all of the parameters for the API call. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ @@ -367,42 +252,20 @@ public final Agent getAgent(GetAgentRequest request) { return getAgentCallable().call(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Retrieves the specified agent. * *

Sample code: - * - *


-   * try (AgentsClient agentsClient = AgentsClient.create()) {
-   *   AgentName name = AgentName.of("[PROJECT]", "[LOCATION]", "[AGENT]");
-   *   GetAgentRequest request = GetAgentRequest.newBuilder()
-   *     .setName(name.toString())
-   *     .build();
-   *   ApiFuture<Agent> future = agentsClient.getAgentCallable().futureCall(request);
-   *   // Do something
-   *   Agent response = future.get();
-   * }
-   * 
*/ public final UnaryCallable getAgentCallable() { return stub.getAgentCallable(); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Creates an agent in the specified location. * - *

Sample code: - * - *


-   * try (AgentsClient agentsClient = AgentsClient.create()) {
-   *   LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
-   *   Agent agent = Agent.newBuilder().build();
-   *   Agent response = agentsClient.createAgent(parent, agent);
-   * }
-   * 
- * * @param parent Required. The location to create a agent for. Format: `projects/<Project * ID>/locations/<Location ID>`. * @param agent Required. The agent to create. @@ -417,20 +280,10 @@ public final Agent createAgent(LocationName parent, Agent agent) { return createAgent(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Creates an agent in the specified location. * - *

Sample code: - * - *


-   * try (AgentsClient agentsClient = AgentsClient.create()) {
-   *   LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
-   *   Agent agent = Agent.newBuilder().build();
-   *   Agent response = agentsClient.createAgent(parent.toString(), agent);
-   * }
-   * 
- * * @param parent Required. The location to create a agent for. Format: `projects/<Project * ID>/locations/<Location ID>`. * @param agent Required. The agent to create. @@ -442,24 +295,10 @@ public final Agent createAgent(String parent, Agent agent) { return createAgent(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Creates an agent in the specified location. * - *

Sample code: - * - *


-   * try (AgentsClient agentsClient = AgentsClient.create()) {
-   *   LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
-   *   Agent agent = Agent.newBuilder().build();
-   *   CreateAgentRequest request = CreateAgentRequest.newBuilder()
-   *     .setParent(parent.toString())
-   *     .setAgent(agent)
-   *     .build();
-   *   Agent response = agentsClient.createAgent(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 */ @@ -467,44 +306,20 @@ public final Agent createAgent(CreateAgentRequest request) { return createAgentCallable().call(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Creates an agent in the specified location. * *

Sample code: - * - *


-   * try (AgentsClient agentsClient = AgentsClient.create()) {
-   *   LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
-   *   Agent agent = Agent.newBuilder().build();
-   *   CreateAgentRequest request = CreateAgentRequest.newBuilder()
-   *     .setParent(parent.toString())
-   *     .setAgent(agent)
-   *     .build();
-   *   ApiFuture<Agent> future = agentsClient.createAgentCallable().futureCall(request);
-   *   // Do something
-   *   Agent response = future.get();
-   * }
-   * 
*/ public final UnaryCallable createAgentCallable() { return stub.createAgentCallable(); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Updates the specified agent. * - *

Sample code: - * - *


-   * try (AgentsClient agentsClient = AgentsClient.create()) {
-   *   Agent agent = Agent.newBuilder().build();
-   *   FieldMask updateMask = FieldMask.newBuilder().build();
-   *   Agent response = agentsClient.updateAgent(agent, updateMask);
-   * }
-   * 
- * * @param agent Required. The agent to update. * @param updateMask The mask to control which fields get updated. If the mask is not present, all * fields will be updated. @@ -516,22 +331,10 @@ public final Agent updateAgent(Agent agent, FieldMask updateMask) { return updateAgent(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Updates the specified agent. * - *

Sample code: - * - *


-   * try (AgentsClient agentsClient = AgentsClient.create()) {
-   *   Agent agent = Agent.newBuilder().build();
-   *   UpdateAgentRequest request = UpdateAgentRequest.newBuilder()
-   *     .setAgent(agent)
-   *     .build();
-   *   Agent response = agentsClient.updateAgent(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 */ @@ -539,41 +342,20 @@ public final Agent updateAgent(UpdateAgentRequest request) { return updateAgentCallable().call(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Updates the specified agent. * *

Sample code: - * - *


-   * try (AgentsClient agentsClient = AgentsClient.create()) {
-   *   Agent agent = Agent.newBuilder().build();
-   *   UpdateAgentRequest request = UpdateAgentRequest.newBuilder()
-   *     .setAgent(agent)
-   *     .build();
-   *   ApiFuture<Agent> future = agentsClient.updateAgentCallable().futureCall(request);
-   *   // Do something
-   *   Agent response = future.get();
-   * }
-   * 
*/ public final UnaryCallable updateAgentCallable() { return stub.updateAgentCallable(); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Deletes the specified agent. * - *

Sample code: - * - *


-   * try (AgentsClient agentsClient = AgentsClient.create()) {
-   *   AgentName name = AgentName.of("[PROJECT]", "[LOCATION]", "[AGENT]");
-   *   agentsClient.deleteAgent(name);
-   * }
-   * 
- * * @param name Required. The name of the agent to delete. Format: `projects/<Project * ID>/locations/<Location ID>/agents/<Agent ID>`. * @throws com.google.api.gax.rpc.ApiException if the remote call fails @@ -584,19 +366,10 @@ public final void deleteAgent(AgentName name) { deleteAgent(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Deletes the specified agent. * - *

Sample code: - * - *


-   * try (AgentsClient agentsClient = AgentsClient.create()) {
-   *   AgentName name = AgentName.of("[PROJECT]", "[LOCATION]", "[AGENT]");
-   *   agentsClient.deleteAgent(name.toString());
-   * }
-   * 
- * * @param name Required. The name of the agent to delete. Format: `projects/<Project * ID>/locations/<Location ID>/agents/<Agent ID>`. * @throws com.google.api.gax.rpc.ApiException if the remote call fails @@ -606,22 +379,10 @@ public final void deleteAgent(String name) { deleteAgent(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Deletes the specified agent. * - *

Sample code: - * - *


-   * try (AgentsClient agentsClient = AgentsClient.create()) {
-   *   AgentName name = AgentName.of("[PROJECT]", "[LOCATION]", "[AGENT]");
-   *   DeleteAgentRequest request = DeleteAgentRequest.newBuilder()
-   *     .setName(name.toString())
-   *     .build();
-   *   agentsClient.deleteAgent(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 */ @@ -629,129 +390,64 @@ public final void deleteAgent(DeleteAgentRequest request) { deleteAgentCallable().call(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Deletes the specified agent. * *

Sample code: - * - *


-   * try (AgentsClient agentsClient = AgentsClient.create()) {
-   *   AgentName name = AgentName.of("[PROJECT]", "[LOCATION]", "[AGENT]");
-   *   DeleteAgentRequest request = DeleteAgentRequest.newBuilder()
-   *     .setName(name.toString())
-   *     .build();
-   *   ApiFuture<Void> future = agentsClient.deleteAgentCallable().futureCall(request);
-   *   // Do something
-   *   future.get();
-   * }
-   * 
*/ public final UnaryCallable deleteAgentCallable() { return stub.deleteAgentCallable(); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Exports the specified agent to a binary file. * - *

Sample code: - * - *


-   * try (AgentsClient agentsClient = AgentsClient.create()) {
-   *   AgentName name = AgentName.of("[PROJECT]", "[LOCATION]", "[AGENT]");
-   *   ExportAgentRequest request = ExportAgentRequest.newBuilder()
-   *     .setName(name.toString())
-   *     .build();
-   *   ExportAgentResponse response = agentsClient.exportAgentAsync(request).get();
-   * }
-   * 
- * * @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 */ - @BetaApi( - "The surface for long-running operations is not stable yet and may change in the future.") public final OperationFuture exportAgentAsync( ExportAgentRequest request) { return exportAgentOperationCallable().futureCall(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Exports the specified agent to a binary file. * *

Sample code: - * - *


-   * try (AgentsClient agentsClient = AgentsClient.create()) {
-   *   AgentName name = AgentName.of("[PROJECT]", "[LOCATION]", "[AGENT]");
-   *   ExportAgentRequest request = ExportAgentRequest.newBuilder()
-   *     .setName(name.toString())
-   *     .build();
-   *   OperationFuture<ExportAgentResponse, Struct> future = agentsClient.exportAgentOperationCallable().futureCall(request);
-   *   // Do something
-   *   ExportAgentResponse response = future.get();
-   * }
-   * 
*/ - @BetaApi("The surface for use by generated code is not stable yet and may change in the future.") public final OperationCallable exportAgentOperationCallable() { return stub.exportAgentOperationCallable(); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Exports the specified agent to a binary file. * *

Sample code: - * - *


-   * try (AgentsClient agentsClient = AgentsClient.create()) {
-   *   AgentName name = AgentName.of("[PROJECT]", "[LOCATION]", "[AGENT]");
-   *   ExportAgentRequest request = ExportAgentRequest.newBuilder()
-   *     .setName(name.toString())
-   *     .build();
-   *   ApiFuture<Operation> future = agentsClient.exportAgentCallable().futureCall(request);
-   *   // Do something
-   *   Operation response = future.get();
-   * }
-   * 
*/ public final UnaryCallable exportAgentCallable() { return stub.exportAgentCallable(); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Restores the specified agent from a binary file. * *

Replaces the current agent with a new one. Note that all existing resources in agent (e.g. * intents, entity types, flows) will be removed. * - *

Sample code: - * - *


-   * try (AgentsClient agentsClient = AgentsClient.create()) {
-   *   AgentName name = AgentName.of("[PROJECT]", "[LOCATION]", "[AGENT]");
-   *   RestoreAgentRequest request = RestoreAgentRequest.newBuilder()
-   *     .setName(name.toString())
-   *     .build();
-   *   agentsClient.restoreAgentAsync(request).get();
-   * }
-   * 
- * * @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 */ - @BetaApi( - "The surface for long-running operations is not stable yet and may change in the future.") public final OperationFuture restoreAgentAsync(RestoreAgentRequest request) { return restoreAgentOperationCallable().futureCall(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Restores the specified agent from a binary file. * @@ -759,26 +455,13 @@ public final OperationFuture restoreAgentAsync(RestoreAgentReques * intents, entity types, flows) will be removed. * *

Sample code: - * - *


-   * try (AgentsClient agentsClient = AgentsClient.create()) {
-   *   AgentName name = AgentName.of("[PROJECT]", "[LOCATION]", "[AGENT]");
-   *   RestoreAgentRequest request = RestoreAgentRequest.newBuilder()
-   *     .setName(name.toString())
-   *     .build();
-   *   OperationFuture<Empty, Struct> future = agentsClient.restoreAgentOperationCallable().futureCall(request);
-   *   // Do something
-   *   future.get();
-   * }
-   * 
*/ - @BetaApi("The surface for use by generated code is not stable yet and may change in the future.") public final OperationCallable restoreAgentOperationCallable() { return stub.restoreAgentOperationCallable(); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Restores the specified agent from a binary file. * @@ -786,18 +469,6 @@ public final OperationFuture restoreAgentAsync(RestoreAgentReques * intents, entity types, flows) will be removed. * *

Sample code: - * - *


-   * try (AgentsClient agentsClient = AgentsClient.create()) {
-   *   AgentName name = AgentName.of("[PROJECT]", "[LOCATION]", "[AGENT]");
-   *   RestoreAgentRequest request = RestoreAgentRequest.newBuilder()
-   *     .setName(name.toString())
-   *     .build();
-   *   ApiFuture<Operation> future = agentsClient.restoreAgentCallable().futureCall(request);
-   *   // Do something
-   *   future.get();
-   * }
-   * 
*/ public final UnaryCallable restoreAgentCallable() { return stub.restoreAgentCallable(); diff --git a/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3/AgentsSettings.java b/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3/AgentsSettings.java index 498c92438..c620b8163 100644 --- a/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3/AgentsSettings.java +++ b/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3/AgentsSettings.java @@ -5,7 +5,7 @@ * 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 + * 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, @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.google.cloud.dialogflow.cx.v3; import static com.google.cloud.dialogflow.cx.v3.AgentsClient.ListAgentsPagedResponse; @@ -37,7 +38,7 @@ import java.util.List; import javax.annotation.Generated; -// AUTO-GENERATED DOCUMENTATION AND CLASS +// AUTO-GENERATED DOCUMENTATION AND CLASS. /** * Settings class to configure an instance of {@link AgentsClient}. * @@ -54,22 +55,23 @@ * *

For example, to set the total timeout of getAgent to 30 seconds: * - *

- * 
- * AgentsSettings.Builder agentsSettingsBuilder =
- *     AgentsSettings.newBuilder();
+ * 
{@code
+ * AgentsSettings.Builder agentsSettingsBuilder = AgentsSettings.newBuilder();
  * agentsSettingsBuilder
  *     .getAgentSettings()
  *     .setRetrySettings(
- *         agentsSettingsBuilder.getAgentSettings().getRetrySettings().toBuilder()
+ *         agentsSettingsBuilder
+ *             .getAgentSettings()
+ *             .getRetrySettings()
+ *             .toBuilder()
  *             .setTotalTimeout(Duration.ofSeconds(30))
  *             .build());
  * AgentsSettings agentsSettings = agentsSettingsBuilder.build();
- * 
- * 
+ * }
*/ -@Generated("by gapic-generator") +@Generated("by gapic-generator-java") public class AgentsSettings extends ClientSettings { + /** Returns the object with the settings used for calls to listAgents. */ public PagedCallSettings listAgentsSettings() { @@ -102,8 +104,6 @@ public UnaryCallSettings exportAgentSettings() { } /** Returns the object with the settings used for calls to exportAgent. */ - @BetaApi( - "The surface for long-running operations is not stable yet and may change in the future.") public OperationCallSettings exportAgentOperationSettings() { return ((AgentsStubSettings) getStubSettings()).exportAgentOperationSettings(); @@ -115,8 +115,6 @@ public UnaryCallSettings restoreAgentSettings() } /** Returns the object with the settings used for calls to restoreAgent. */ - @BetaApi( - "The surface for long-running operations is not stable yet and may change in the future.") public OperationCallSettings restoreAgentOperationSettings() { return ((AgentsStubSettings) getStubSettings()).restoreAgentOperationSettings(); } @@ -180,18 +178,15 @@ protected AgentsSettings(Builder settingsBuilder) throws IOException { /** Builder for AgentsSettings. */ public static class Builder extends ClientSettings.Builder { + protected Builder() throws IOException { - this((ClientContext) null); + this(((ClientContext) null)); } protected Builder(ClientContext clientContext) { super(AgentsStubSettings.newBuilder(clientContext)); } - private static Builder createDefault() { - return new Builder(AgentsStubSettings.newBuilder()); - } - protected Builder(AgentsSettings settings) { super(settings.getStubSettings().toBuilder()); } @@ -200,11 +195,15 @@ protected Builder(AgentsStubSettings.Builder stubSettings) { super(stubSettings); } + private static Builder createDefault() { + return new Builder(AgentsStubSettings.newBuilder()); + } + public AgentsStubSettings.Builder getStubSettingsBuilder() { return ((AgentsStubSettings.Builder) getStubSettings()); } - // NEXT_MAJOR_VER: remove 'throws Exception' + // NEXT_MAJOR_VER: remove 'throws Exception'. /** * Applies the given settings updater function to all of the unary API methods in this service. * @@ -249,8 +248,6 @@ public UnaryCallSettings.Builder exportAgentSetti } /** Returns the builder for the settings used for calls to exportAgent. */ - @BetaApi( - "The surface for long-running operations is not stable yet and may change in the future.") public OperationCallSettings.Builder exportAgentOperationSettings() { return getStubSettingsBuilder().exportAgentOperationSettings(); @@ -262,8 +259,6 @@ public UnaryCallSettings.Builder restoreAgentSet } /** Returns the builder for the settings used for calls to restoreAgent. */ - @BetaApi( - "The surface for long-running operations is not stable yet and may change in the future.") public OperationCallSettings.Builder restoreAgentOperationSettings() { return getStubSettingsBuilder().restoreAgentOperationSettings(); diff --git a/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3/EntityTypesClient.java b/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3/EntityTypesClient.java index 9e196ab74..e68c0f94f 100644 --- a/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3/EntityTypesClient.java +++ b/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3/EntityTypesClient.java @@ -5,7 +5,7 @@ * 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 + * 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, @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.google.cloud.dialogflow.cx.v3; import com.google.api.core.ApiFunction; @@ -35,7 +36,7 @@ import java.util.concurrent.TimeUnit; import javax.annotation.Generated; -// AUTO-GENERATED DOCUMENTATION AND SERVICE +// AUTO-GENERATED DOCUMENTATION AND CLASS. /** * Service Description: Service for managing * [EntityTypes][google.cloud.dialogflow.cx.v3.EntityType]. @@ -43,16 +44,7 @@ *

This class provides the ability to make remote calls to the backing service through method * calls that map to API methods. Sample code to get started: * - *

- * 
- * try (EntityTypesClient entityTypesClient = EntityTypesClient.create()) {
- *   EntityTypeName name = EntityTypeName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[ENTITY_TYPE]");
- *   EntityType response = entityTypesClient.getEntityType(name);
- * }
- * 
- * 
- * - *

Note: close() needs to be called on the entityTypesClient object to clean up resources such as + *

Note: close() needs to be called on the EntityTypesClient object to clean up resources such as * threads. In the example above, try-with-resources is used, which automatically calls close(). * *

The surface of this class includes several types of Java methods for each of the API's @@ -80,28 +72,25 @@ * *

To customize credentials: * - *

- * 
+ * 
{@code
  * EntityTypesSettings entityTypesSettings =
  *     EntityTypesSettings.newBuilder()
  *         .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
  *         .build();
- * EntityTypesClient entityTypesClient =
- *     EntityTypesClient.create(entityTypesSettings);
- * 
- * 
+ * EntityTypesClient entityTypesClient = EntityTypesClient.create(entityTypesSettings); + * }
* - * To customize the endpoint: + *

To customize the endpoint: * - *

- * 
+ * 
{@code
  * EntityTypesSettings entityTypesSettings =
  *     EntityTypesSettings.newBuilder().setEndpoint(myEndpoint).build();
- * EntityTypesClient entityTypesClient =
- *     EntityTypesClient.create(entityTypesSettings);
- * 
- * 
+ * EntityTypesClient entityTypesClient = EntityTypesClient.create(entityTypesSettings); + * }
+ * + *

Please refer to the GitHub repository's samples for more quickstart code snippets. */ +@BetaApi @Generated("by gapic-generator") public class EntityTypesClient implements BackgroundResource { private final EntityTypesSettings settings; @@ -122,7 +111,7 @@ public static final EntityTypesClient create(EntityTypesSettings settings) throw /** * Constructs an instance of EntityTypesClient, using the given stub for making calls. This is for - * advanced usage - prefer to use EntityTypesSettings}. + * advanced usage - prefer using create(EntityTypesSettings). */ @BetaApi("A restructuring of stub classes is planned, so this may break in the future") public static final EntityTypesClient create(EntityTypesStub stub) { @@ -154,21 +143,10 @@ public EntityTypesStub getStub() { return stub; } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Returns the list of all entity types in the specified agent. * - *

Sample code: - * - *


-   * try (EntityTypesClient entityTypesClient = EntityTypesClient.create()) {
-   *   AgentName parent = AgentName.of("[PROJECT]", "[LOCATION]", "[AGENT]");
-   *   for (EntityType element : entityTypesClient.listEntityTypes(parent).iterateAll()) {
-   *     // doThingsWith(element);
-   *   }
-   * }
-   * 
- * * @param parent Required. The agent to list all entity types for. Format: `projects/<Project * ID>/locations/<Location ID>/agents/<Agent ID>`. * @throws com.google.api.gax.rpc.ApiException if the remote call fails @@ -181,21 +159,10 @@ public final ListEntityTypesPagedResponse listEntityTypes(AgentName parent) { return listEntityTypes(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Returns the list of all entity types in the specified agent. * - *

Sample code: - * - *


-   * try (EntityTypesClient entityTypesClient = EntityTypesClient.create()) {
-   *   AgentName parent = AgentName.of("[PROJECT]", "[LOCATION]", "[AGENT]");
-   *   for (EntityType element : entityTypesClient.listEntityTypes(parent.toString()).iterateAll()) {
-   *     // doThingsWith(element);
-   *   }
-   * }
-   * 
- * * @param parent Required. The agent to list all entity types for. Format: `projects/<Project * ID>/locations/<Location ID>/agents/<Agent ID>`. * @throws com.google.api.gax.rpc.ApiException if the remote call fails @@ -205,24 +172,10 @@ public final ListEntityTypesPagedResponse listEntityTypes(String parent) { return listEntityTypes(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Returns the list of all entity types in the specified agent. * - *

Sample code: - * - *


-   * try (EntityTypesClient entityTypesClient = EntityTypesClient.create()) {
-   *   AgentName parent = AgentName.of("[PROJECT]", "[LOCATION]", "[AGENT]");
-   *   ListEntityTypesRequest request = ListEntityTypesRequest.newBuilder()
-   *     .setParent(parent.toString())
-   *     .build();
-   *   for (EntityType element : entityTypesClient.listEntityTypes(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 */ @@ -230,76 +183,32 @@ public final ListEntityTypesPagedResponse listEntityTypes(ListEntityTypesRequest return listEntityTypesPagedCallable().call(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Returns the list of all entity types in the specified agent. * *

Sample code: - * - *


-   * try (EntityTypesClient entityTypesClient = EntityTypesClient.create()) {
-   *   AgentName parent = AgentName.of("[PROJECT]", "[LOCATION]", "[AGENT]");
-   *   ListEntityTypesRequest request = ListEntityTypesRequest.newBuilder()
-   *     .setParent(parent.toString())
-   *     .build();
-   *   ApiFuture<ListEntityTypesPagedResponse> future = entityTypesClient.listEntityTypesPagedCallable().futureCall(request);
-   *   // Do something
-   *   for (EntityType element : future.get().iterateAll()) {
-   *     // doThingsWith(element);
-   *   }
-   * }
-   * 
*/ public final UnaryCallable listEntityTypesPagedCallable() { return stub.listEntityTypesPagedCallable(); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Returns the list of all entity types in the specified agent. * *

Sample code: - * - *


-   * try (EntityTypesClient entityTypesClient = EntityTypesClient.create()) {
-   *   AgentName parent = AgentName.of("[PROJECT]", "[LOCATION]", "[AGENT]");
-   *   ListEntityTypesRequest request = ListEntityTypesRequest.newBuilder()
-   *     .setParent(parent.toString())
-   *     .build();
-   *   while (true) {
-   *     ListEntityTypesResponse response = entityTypesClient.listEntityTypesCallable().call(request);
-   *     for (EntityType element : response.getEntityTypesList()) {
-   *       // doThingsWith(element);
-   *     }
-   *     String nextPageToken = response.getNextPageToken();
-   *     if (!Strings.isNullOrEmpty(nextPageToken)) {
-   *       request = request.toBuilder().setPageToken(nextPageToken).build();
-   *     } else {
-   *       break;
-   *     }
-   *   }
-   * }
-   * 
*/ public final UnaryCallable listEntityTypesCallable() { return stub.listEntityTypesCallable(); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Retrieves the specified entity type. * - *

Sample code: - * - *


-   * try (EntityTypesClient entityTypesClient = EntityTypesClient.create()) {
-   *   EntityTypeName name = EntityTypeName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[ENTITY_TYPE]");
-   *   EntityType response = entityTypesClient.getEntityType(name);
-   * }
-   * 
- * * @param name Required. The name of the entity type. Format: `projects/<Project * ID>/locations/<Location ID>/agents/<Agent ID>/entityTypes/<Entity Type * ID>`. @@ -311,19 +220,10 @@ public final EntityType getEntityType(EntityTypeName name) { return getEntityType(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Retrieves the specified entity type. * - *

Sample code: - * - *


-   * try (EntityTypesClient entityTypesClient = EntityTypesClient.create()) {
-   *   EntityTypeName name = EntityTypeName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[ENTITY_TYPE]");
-   *   EntityType response = entityTypesClient.getEntityType(name.toString());
-   * }
-   * 
- * * @param name Required. The name of the entity type. Format: `projects/<Project * ID>/locations/<Location ID>/agents/<Agent ID>/entityTypes/<Entity Type * ID>`. @@ -334,22 +234,10 @@ public final EntityType getEntityType(String name) { return getEntityType(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Retrieves the specified entity type. * - *

Sample code: - * - *


-   * try (EntityTypesClient entityTypesClient = EntityTypesClient.create()) {
-   *   EntityTypeName name = EntityTypeName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[ENTITY_TYPE]");
-   *   GetEntityTypeRequest request = GetEntityTypeRequest.newBuilder()
-   *     .setName(name.toString())
-   *     .build();
-   *   EntityType response = entityTypesClient.getEntityType(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 */ @@ -357,42 +245,20 @@ public final EntityType getEntityType(GetEntityTypeRequest request) { return getEntityTypeCallable().call(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Retrieves the specified entity type. * *

Sample code: - * - *


-   * try (EntityTypesClient entityTypesClient = EntityTypesClient.create()) {
-   *   EntityTypeName name = EntityTypeName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[ENTITY_TYPE]");
-   *   GetEntityTypeRequest request = GetEntityTypeRequest.newBuilder()
-   *     .setName(name.toString())
-   *     .build();
-   *   ApiFuture<EntityType> future = entityTypesClient.getEntityTypeCallable().futureCall(request);
-   *   // Do something
-   *   EntityType response = future.get();
-   * }
-   * 
*/ public final UnaryCallable getEntityTypeCallable() { return stub.getEntityTypeCallable(); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Creates an entity type in the specified agent. * - *

Sample code: - * - *


-   * try (EntityTypesClient entityTypesClient = EntityTypesClient.create()) {
-   *   AgentName parent = AgentName.of("[PROJECT]", "[LOCATION]", "[AGENT]");
-   *   EntityType entityType = EntityType.newBuilder().build();
-   *   EntityType response = entityTypesClient.createEntityType(parent, entityType);
-   * }
-   * 
- * * @param parent Required. The agent to create a entity type for. Format: `projects/<Project * ID>/locations/<Location ID>/agents/<Agent ID>`. * @param entityType Required. The entity type to create. @@ -407,20 +273,10 @@ public final EntityType createEntityType(AgentName parent, EntityType entityType return createEntityType(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Creates an entity type in the specified agent. * - *

Sample code: - * - *


-   * try (EntityTypesClient entityTypesClient = EntityTypesClient.create()) {
-   *   AgentName parent = AgentName.of("[PROJECT]", "[LOCATION]", "[AGENT]");
-   *   EntityType entityType = EntityType.newBuilder().build();
-   *   EntityType response = entityTypesClient.createEntityType(parent.toString(), entityType);
-   * }
-   * 
- * * @param parent Required. The agent to create a entity type for. Format: `projects/<Project * ID>/locations/<Location ID>/agents/<Agent ID>`. * @param entityType Required. The entity type to create. @@ -432,24 +288,10 @@ public final EntityType createEntityType(String parent, EntityType entityType) { return createEntityType(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Creates an entity type in the specified agent. * - *

Sample code: - * - *


-   * try (EntityTypesClient entityTypesClient = EntityTypesClient.create()) {
-   *   AgentName parent = AgentName.of("[PROJECT]", "[LOCATION]", "[AGENT]");
-   *   EntityType entityType = EntityType.newBuilder().build();
-   *   CreateEntityTypeRequest request = CreateEntityTypeRequest.newBuilder()
-   *     .setParent(parent.toString())
-   *     .setEntityType(entityType)
-   *     .build();
-   *   EntityType response = entityTypesClient.createEntityType(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 */ @@ -457,44 +299,20 @@ public final EntityType createEntityType(CreateEntityTypeRequest request) { return createEntityTypeCallable().call(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Creates an entity type in the specified agent. * *

Sample code: - * - *


-   * try (EntityTypesClient entityTypesClient = EntityTypesClient.create()) {
-   *   AgentName parent = AgentName.of("[PROJECT]", "[LOCATION]", "[AGENT]");
-   *   EntityType entityType = EntityType.newBuilder().build();
-   *   CreateEntityTypeRequest request = CreateEntityTypeRequest.newBuilder()
-   *     .setParent(parent.toString())
-   *     .setEntityType(entityType)
-   *     .build();
-   *   ApiFuture<EntityType> future = entityTypesClient.createEntityTypeCallable().futureCall(request);
-   *   // Do something
-   *   EntityType response = future.get();
-   * }
-   * 
*/ public final UnaryCallable createEntityTypeCallable() { return stub.createEntityTypeCallable(); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Updates the specified entity type. * - *

Sample code: - * - *


-   * try (EntityTypesClient entityTypesClient = EntityTypesClient.create()) {
-   *   EntityType entityType = EntityType.newBuilder().build();
-   *   FieldMask updateMask = FieldMask.newBuilder().build();
-   *   EntityType response = entityTypesClient.updateEntityType(entityType, updateMask);
-   * }
-   * 
- * * @param entityType Required. The entity type to update. * @param updateMask The mask to control which fields get updated. * @throws com.google.api.gax.rpc.ApiException if the remote call fails @@ -508,22 +326,10 @@ public final EntityType updateEntityType(EntityType entityType, FieldMask update return updateEntityType(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Updates the specified entity type. * - *

Sample code: - * - *


-   * try (EntityTypesClient entityTypesClient = EntityTypesClient.create()) {
-   *   EntityType entityType = EntityType.newBuilder().build();
-   *   UpdateEntityTypeRequest request = UpdateEntityTypeRequest.newBuilder()
-   *     .setEntityType(entityType)
-   *     .build();
-   *   EntityType response = entityTypesClient.updateEntityType(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 */ @@ -531,41 +337,20 @@ public final EntityType updateEntityType(UpdateEntityTypeRequest request) { return updateEntityTypeCallable().call(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Updates the specified entity type. * *

Sample code: - * - *


-   * try (EntityTypesClient entityTypesClient = EntityTypesClient.create()) {
-   *   EntityType entityType = EntityType.newBuilder().build();
-   *   UpdateEntityTypeRequest request = UpdateEntityTypeRequest.newBuilder()
-   *     .setEntityType(entityType)
-   *     .build();
-   *   ApiFuture<EntityType> future = entityTypesClient.updateEntityTypeCallable().futureCall(request);
-   *   // Do something
-   *   EntityType response = future.get();
-   * }
-   * 
*/ public final UnaryCallable updateEntityTypeCallable() { return stub.updateEntityTypeCallable(); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Deletes the specified entity type. * - *

Sample code: - * - *


-   * try (EntityTypesClient entityTypesClient = EntityTypesClient.create()) {
-   *   EntityTypeName name = EntityTypeName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[ENTITY_TYPE]");
-   *   entityTypesClient.deleteEntityType(name);
-   * }
-   * 
- * * @param name Required. The name of the entity type to delete. Format: `projects/<Project * ID>/locations/<Location ID>/agents/<Agent ID>/entityTypes/<Entity Type * ID>`. @@ -577,19 +362,10 @@ public final void deleteEntityType(EntityTypeName name) { deleteEntityType(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Deletes the specified entity type. * - *

Sample code: - * - *


-   * try (EntityTypesClient entityTypesClient = EntityTypesClient.create()) {
-   *   EntityTypeName name = EntityTypeName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[ENTITY_TYPE]");
-   *   entityTypesClient.deleteEntityType(name.toString());
-   * }
-   * 
- * * @param name Required. The name of the entity type to delete. Format: `projects/<Project * ID>/locations/<Location ID>/agents/<Agent ID>/entityTypes/<Entity Type * ID>`. @@ -600,22 +376,10 @@ public final void deleteEntityType(String name) { deleteEntityType(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Deletes the specified entity type. * - *

Sample code: - * - *


-   * try (EntityTypesClient entityTypesClient = EntityTypesClient.create()) {
-   *   EntityTypeName name = EntityTypeName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[ENTITY_TYPE]");
-   *   DeleteEntityTypeRequest request = DeleteEntityTypeRequest.newBuilder()
-   *     .setName(name.toString())
-   *     .build();
-   *   entityTypesClient.deleteEntityType(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 */ @@ -623,23 +387,11 @@ public final void deleteEntityType(DeleteEntityTypeRequest request) { deleteEntityTypeCallable().call(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Deletes the specified entity type. * *

Sample code: - * - *


-   * try (EntityTypesClient entityTypesClient = EntityTypesClient.create()) {
-   *   EntityTypeName name = EntityTypeName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[ENTITY_TYPE]");
-   *   DeleteEntityTypeRequest request = DeleteEntityTypeRequest.newBuilder()
-   *     .setName(name.toString())
-   *     .build();
-   *   ApiFuture<Void> future = entityTypesClient.deleteEntityTypeCallable().futureCall(request);
-   *   // Do something
-   *   future.get();
-   * }
-   * 
*/ public final UnaryCallable deleteEntityTypeCallable() { return stub.deleteEntityTypeCallable(); diff --git a/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3/EntityTypesSettings.java b/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3/EntityTypesSettings.java index 4659b4275..f3810cf23 100644 --- a/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3/EntityTypesSettings.java +++ b/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3/EntityTypesSettings.java @@ -5,7 +5,7 @@ * 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 + * 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, @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.google.cloud.dialogflow.cx.v3; import static com.google.cloud.dialogflow.cx.v3.EntityTypesClient.ListEntityTypesPagedResponse; @@ -34,7 +35,7 @@ import java.util.List; import javax.annotation.Generated; -// AUTO-GENERATED DOCUMENTATION AND CLASS +// AUTO-GENERATED DOCUMENTATION AND CLASS. /** * Settings class to configure an instance of {@link EntityTypesClient}. * @@ -51,22 +52,23 @@ * *

For example, to set the total timeout of getEntityType to 30 seconds: * - *

- * 
- * EntityTypesSettings.Builder entityTypesSettingsBuilder =
- *     EntityTypesSettings.newBuilder();
+ * 
{@code
+ * EntityTypesSettings.Builder entityTypesSettingsBuilder = EntityTypesSettings.newBuilder();
  * entityTypesSettingsBuilder
  *     .getEntityTypeSettings()
  *     .setRetrySettings(
- *         entityTypesSettingsBuilder.getEntityTypeSettings().getRetrySettings().toBuilder()
+ *         entityTypesSettingsBuilder
+ *             .getEntityTypeSettings()
+ *             .getRetrySettings()
+ *             .toBuilder()
  *             .setTotalTimeout(Duration.ofSeconds(30))
  *             .build());
  * EntityTypesSettings entityTypesSettings = entityTypesSettingsBuilder.build();
- * 
- * 
+ * }
*/ -@Generated("by gapic-generator") +@Generated("by gapic-generator-java") public class EntityTypesSettings extends ClientSettings { + /** Returns the object with the settings used for calls to listEntityTypes. */ public PagedCallSettings< ListEntityTypesRequest, ListEntityTypesResponse, ListEntityTypesPagedResponse> @@ -153,18 +155,15 @@ protected EntityTypesSettings(Builder settingsBuilder) throws IOException { /** Builder for EntityTypesSettings. */ public static class Builder extends ClientSettings.Builder { + protected Builder() throws IOException { - this((ClientContext) null); + this(((ClientContext) null)); } protected Builder(ClientContext clientContext) { super(EntityTypesStubSettings.newBuilder(clientContext)); } - private static Builder createDefault() { - return new Builder(EntityTypesStubSettings.newBuilder()); - } - protected Builder(EntityTypesSettings settings) { super(settings.getStubSettings().toBuilder()); } @@ -173,11 +172,15 @@ protected Builder(EntityTypesStubSettings.Builder stubSettings) { super(stubSettings); } + private static Builder createDefault() { + return new Builder(EntityTypesStubSettings.newBuilder()); + } + public EntityTypesStubSettings.Builder getStubSettingsBuilder() { return ((EntityTypesStubSettings.Builder) getStubSettings()); } - // NEXT_MAJOR_VER: remove 'throws Exception' + // NEXT_MAJOR_VER: remove 'throws Exception'. /** * Applies the given settings updater function to all of the unary API methods in this service. * diff --git a/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3/EnvironmentsClient.java b/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3/EnvironmentsClient.java index d596f6d1b..dcfa30aa0 100644 --- a/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3/EnvironmentsClient.java +++ b/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3/EnvironmentsClient.java @@ -5,7 +5,7 @@ * 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 + * 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, @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.google.cloud.dialogflow.cx.v3; import com.google.api.core.ApiFunction; @@ -40,7 +41,7 @@ import java.util.concurrent.TimeUnit; import javax.annotation.Generated; -// AUTO-GENERATED DOCUMENTATION AND SERVICE +// AUTO-GENERATED DOCUMENTATION AND CLASS. /** * Service Description: Service for managing * [Environments][google.cloud.dialogflow.cx.v3.Environment]. @@ -48,16 +49,7 @@ *

This class provides the ability to make remote calls to the backing service through method * calls that map to API methods. Sample code to get started: * - *

- * 
- * try (EnvironmentsClient environmentsClient = EnvironmentsClient.create()) {
- *   EnvironmentName name = EnvironmentName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[ENVIRONMENT]");
- *   Environment response = environmentsClient.getEnvironment(name);
- * }
- * 
- * 
- * - *

Note: close() needs to be called on the environmentsClient object to clean up resources such + *

Note: close() needs to be called on the EnvironmentsClient object to clean up resources such * as threads. In the example above, try-with-resources is used, which automatically calls close(). * *

The surface of this class includes several types of Java methods for each of the API's @@ -85,28 +77,25 @@ * *

To customize credentials: * - *

- * 
+ * 
{@code
  * EnvironmentsSettings environmentsSettings =
  *     EnvironmentsSettings.newBuilder()
  *         .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
  *         .build();
- * EnvironmentsClient environmentsClient =
- *     EnvironmentsClient.create(environmentsSettings);
- * 
- * 
+ * EnvironmentsClient environmentsClient = EnvironmentsClient.create(environmentsSettings); + * }
* - * To customize the endpoint: + *

To customize the endpoint: * - *

- * 
+ * 
{@code
  * EnvironmentsSettings environmentsSettings =
  *     EnvironmentsSettings.newBuilder().setEndpoint(myEndpoint).build();
- * EnvironmentsClient environmentsClient =
- *     EnvironmentsClient.create(environmentsSettings);
- * 
- * 
+ * EnvironmentsClient environmentsClient = EnvironmentsClient.create(environmentsSettings); + * }
+ * + *

Please refer to the GitHub repository's samples for more quickstart code snippets. */ +@BetaApi @Generated("by gapic-generator") public class EnvironmentsClient implements BackgroundResource { private final EnvironmentsSettings settings; @@ -128,7 +117,7 @@ public static final EnvironmentsClient create(EnvironmentsSettings settings) thr /** * Constructs an instance of EnvironmentsClient, using the given stub for making calls. This is - * for advanced usage - prefer to use EnvironmentsSettings}. + * for advanced usage - prefer using create(EnvironmentsSettings). */ @BetaApi("A restructuring of stub classes is planned, so this may break in the future") public static final EnvironmentsClient create(EnvironmentsStub stub) { @@ -166,28 +155,15 @@ public EnvironmentsStub getStub() { * Returns the OperationsClient that can be used to query the status of a long-running operation * returned by another API method call. */ - @BetaApi( - "The surface for long-running operations is not stable yet and may change in the future.") public final OperationsClient getOperationsClient() { return operationsClient; } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Returns the list of all environments in the specified * [Agent][google.cloud.dialogflow.cx.v3.Agent]. * - *

Sample code: - * - *


-   * try (EnvironmentsClient environmentsClient = EnvironmentsClient.create()) {
-   *   AgentName parent = AgentName.of("[PROJECT]", "[LOCATION]", "[AGENT]");
-   *   for (Environment element : environmentsClient.listEnvironments(parent).iterateAll()) {
-   *     // doThingsWith(element);
-   *   }
-   * }
-   * 
- * * @param parent Required. The [Agent][google.cloud.dialogflow.cx.v3.Agent] to list all * environments for. Format: `projects/<Project ID>/locations/<Location * ID>/agents/<Agent ID>`. @@ -201,22 +177,11 @@ public final ListEnvironmentsPagedResponse listEnvironments(AgentName parent) { return listEnvironments(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Returns the list of all environments in the specified * [Agent][google.cloud.dialogflow.cx.v3.Agent]. * - *

Sample code: - * - *


-   * try (EnvironmentsClient environmentsClient = EnvironmentsClient.create()) {
-   *   AgentName parent = AgentName.of("[PROJECT]", "[LOCATION]", "[AGENT]");
-   *   for (Environment element : environmentsClient.listEnvironments(parent.toString()).iterateAll()) {
-   *     // doThingsWith(element);
-   *   }
-   * }
-   * 
- * * @param parent Required. The [Agent][google.cloud.dialogflow.cx.v3.Agent] to list all * environments for. Format: `projects/<Project ID>/locations/<Location * ID>/agents/<Agent ID>`. @@ -228,25 +193,11 @@ public final ListEnvironmentsPagedResponse listEnvironments(String parent) { return listEnvironments(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Returns the list of all environments in the specified * [Agent][google.cloud.dialogflow.cx.v3.Agent]. * - *

Sample code: - * - *


-   * try (EnvironmentsClient environmentsClient = EnvironmentsClient.create()) {
-   *   AgentName parent = AgentName.of("[PROJECT]", "[LOCATION]", "[AGENT]");
-   *   ListEnvironmentsRequest request = ListEnvironmentsRequest.newBuilder()
-   *     .setParent(parent.toString())
-   *     .build();
-   *   for (Environment element : environmentsClient.listEnvironments(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 */ @@ -254,78 +205,34 @@ public final ListEnvironmentsPagedResponse listEnvironments(ListEnvironmentsRequ return listEnvironmentsPagedCallable().call(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Returns the list of all environments in the specified * [Agent][google.cloud.dialogflow.cx.v3.Agent]. * *

Sample code: - * - *


-   * try (EnvironmentsClient environmentsClient = EnvironmentsClient.create()) {
-   *   AgentName parent = AgentName.of("[PROJECT]", "[LOCATION]", "[AGENT]");
-   *   ListEnvironmentsRequest request = ListEnvironmentsRequest.newBuilder()
-   *     .setParent(parent.toString())
-   *     .build();
-   *   ApiFuture<ListEnvironmentsPagedResponse> future = environmentsClient.listEnvironmentsPagedCallable().futureCall(request);
-   *   // Do something
-   *   for (Environment element : future.get().iterateAll()) {
-   *     // doThingsWith(element);
-   *   }
-   * }
-   * 
*/ public final UnaryCallable listEnvironmentsPagedCallable() { return stub.listEnvironmentsPagedCallable(); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Returns the list of all environments in the specified * [Agent][google.cloud.dialogflow.cx.v3.Agent]. * *

Sample code: - * - *


-   * try (EnvironmentsClient environmentsClient = EnvironmentsClient.create()) {
-   *   AgentName parent = AgentName.of("[PROJECT]", "[LOCATION]", "[AGENT]");
-   *   ListEnvironmentsRequest request = ListEnvironmentsRequest.newBuilder()
-   *     .setParent(parent.toString())
-   *     .build();
-   *   while (true) {
-   *     ListEnvironmentsResponse response = environmentsClient.listEnvironmentsCallable().call(request);
-   *     for (Environment element : response.getEnvironmentsList()) {
-   *       // doThingsWith(element);
-   *     }
-   *     String nextPageToken = response.getNextPageToken();
-   *     if (!Strings.isNullOrEmpty(nextPageToken)) {
-   *       request = request.toBuilder().setPageToken(nextPageToken).build();
-   *     } else {
-   *       break;
-   *     }
-   *   }
-   * }
-   * 
*/ public final UnaryCallable listEnvironmentsCallable() { return stub.listEnvironmentsCallable(); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Retrieves the specified [Environment][google.cloud.dialogflow.cx.v3.Environment]. * - *

Sample code: - * - *


-   * try (EnvironmentsClient environmentsClient = EnvironmentsClient.create()) {
-   *   EnvironmentName name = EnvironmentName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[ENVIRONMENT]");
-   *   Environment response = environmentsClient.getEnvironment(name);
-   * }
-   * 
- * * @param name Required. The name of the [Environment][google.cloud.dialogflow.cx.v3.Environment]. * Format: `projects/<Project ID>/locations/<Location ID>/agents/<Agent * ID>/environments/<Environment ID>`. @@ -337,19 +244,10 @@ public final Environment getEnvironment(EnvironmentName name) { return getEnvironment(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Retrieves the specified [Environment][google.cloud.dialogflow.cx.v3.Environment]. * - *

Sample code: - * - *


-   * try (EnvironmentsClient environmentsClient = EnvironmentsClient.create()) {
-   *   EnvironmentName name = EnvironmentName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[ENVIRONMENT]");
-   *   Environment response = environmentsClient.getEnvironment(name.toString());
-   * }
-   * 
- * * @param name Required. The name of the [Environment][google.cloud.dialogflow.cx.v3.Environment]. * Format: `projects/<Project ID>/locations/<Location ID>/agents/<Agent * ID>/environments/<Environment ID>`. @@ -360,22 +258,10 @@ public final Environment getEnvironment(String name) { return getEnvironment(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Retrieves the specified [Environment][google.cloud.dialogflow.cx.v3.Environment]. * - *

Sample code: - * - *


-   * try (EnvironmentsClient environmentsClient = EnvironmentsClient.create()) {
-   *   EnvironmentName name = EnvironmentName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[ENVIRONMENT]");
-   *   GetEnvironmentRequest request = GetEnvironmentRequest.newBuilder()
-   *     .setName(name.toString())
-   *     .build();
-   *   Environment response = environmentsClient.getEnvironment(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 */ @@ -383,51 +269,27 @@ public final Environment getEnvironment(GetEnvironmentRequest request) { return getEnvironmentCallable().call(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Retrieves the specified [Environment][google.cloud.dialogflow.cx.v3.Environment]. * *

Sample code: - * - *


-   * try (EnvironmentsClient environmentsClient = EnvironmentsClient.create()) {
-   *   EnvironmentName name = EnvironmentName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[ENVIRONMENT]");
-   *   GetEnvironmentRequest request = GetEnvironmentRequest.newBuilder()
-   *     .setName(name.toString())
-   *     .build();
-   *   ApiFuture<Environment> future = environmentsClient.getEnvironmentCallable().futureCall(request);
-   *   // Do something
-   *   Environment response = future.get();
-   * }
-   * 
*/ public final UnaryCallable getEnvironmentCallable() { return stub.getEnvironmentCallable(); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Creates an [Environment][google.cloud.dialogflow.cx.v3.Environment] in the specified * [Agent][google.cloud.dialogflow.cx.v3.Agent]. * - *

Sample code: - * - *


-   * try (EnvironmentsClient environmentsClient = EnvironmentsClient.create()) {
-   *   AgentName parent = AgentName.of("[PROJECT]", "[LOCATION]", "[AGENT]");
-   *   Environment environment = Environment.newBuilder().build();
-   *   Environment response = environmentsClient.createEnvironmentAsync(parent, environment).get();
-   * }
-   * 
- * * @param parent Required. The [Agent][google.cloud.dialogflow.cx.v3.Agent] to create an * [Environment][google.cloud.dialogflow.cx.v3.Environment] for. Format: `projects/<Project * ID>/locations/<Location ID>/agents/<Agent ID>`. * @param environment Required. The environment to create. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ - @BetaApi( - "The surface for long-running operations is not stable yet and may change in the future.") public final OperationFuture createEnvironmentAsync( AgentName parent, Environment environment) { CreateEnvironmentRequest request = @@ -438,29 +300,17 @@ public final OperationFuture createEnvironmentAsync( return createEnvironmentAsync(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Creates an [Environment][google.cloud.dialogflow.cx.v3.Environment] in the specified * [Agent][google.cloud.dialogflow.cx.v3.Agent]. * - *

Sample code: - * - *


-   * try (EnvironmentsClient environmentsClient = EnvironmentsClient.create()) {
-   *   AgentName parent = AgentName.of("[PROJECT]", "[LOCATION]", "[AGENT]");
-   *   Environment environment = Environment.newBuilder().build();
-   *   Environment response = environmentsClient.createEnvironmentAsync(parent.toString(), environment).get();
-   * }
-   * 
- * * @param parent Required. The [Agent][google.cloud.dialogflow.cx.v3.Agent] to create an * [Environment][google.cloud.dialogflow.cx.v3.Environment] for. Format: `projects/<Project * ID>/locations/<Location ID>/agents/<Agent ID>`. * @param environment Required. The environment to create. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ - @BetaApi( - "The surface for long-running operations is not stable yet and may change in the future.") public final OperationFuture createEnvironmentAsync( String parent, Environment environment) { CreateEnvironmentRequest request = @@ -468,107 +318,50 @@ public final OperationFuture createEnvironmentAsync( return createEnvironmentAsync(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Creates an [Environment][google.cloud.dialogflow.cx.v3.Environment] in the specified * [Agent][google.cloud.dialogflow.cx.v3.Agent]. * - *

Sample code: - * - *


-   * try (EnvironmentsClient environmentsClient = EnvironmentsClient.create()) {
-   *   AgentName parent = AgentName.of("[PROJECT]", "[LOCATION]", "[AGENT]");
-   *   Environment environment = Environment.newBuilder().build();
-   *   CreateEnvironmentRequest request = CreateEnvironmentRequest.newBuilder()
-   *     .setParent(parent.toString())
-   *     .setEnvironment(environment)
-   *     .build();
-   *   Environment response = environmentsClient.createEnvironmentAsync(request).get();
-   * }
-   * 
- * * @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 */ - @BetaApi( - "The surface for long-running operations is not stable yet and may change in the future.") public final OperationFuture createEnvironmentAsync( CreateEnvironmentRequest request) { return createEnvironmentOperationCallable().futureCall(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Creates an [Environment][google.cloud.dialogflow.cx.v3.Environment] in the specified * [Agent][google.cloud.dialogflow.cx.v3.Agent]. * *

Sample code: - * - *


-   * try (EnvironmentsClient environmentsClient = EnvironmentsClient.create()) {
-   *   AgentName parent = AgentName.of("[PROJECT]", "[LOCATION]", "[AGENT]");
-   *   Environment environment = Environment.newBuilder().build();
-   *   CreateEnvironmentRequest request = CreateEnvironmentRequest.newBuilder()
-   *     .setParent(parent.toString())
-   *     .setEnvironment(environment)
-   *     .build();
-   *   OperationFuture<Environment, Struct> future = environmentsClient.createEnvironmentOperationCallable().futureCall(request);
-   *   // Do something
-   *   Environment response = future.get();
-   * }
-   * 
*/ - @BetaApi("The surface for use by generated code is not stable yet and may change in the future.") public final OperationCallable createEnvironmentOperationCallable() { return stub.createEnvironmentOperationCallable(); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Creates an [Environment][google.cloud.dialogflow.cx.v3.Environment] in the specified * [Agent][google.cloud.dialogflow.cx.v3.Agent]. * *

Sample code: - * - *


-   * try (EnvironmentsClient environmentsClient = EnvironmentsClient.create()) {
-   *   AgentName parent = AgentName.of("[PROJECT]", "[LOCATION]", "[AGENT]");
-   *   Environment environment = Environment.newBuilder().build();
-   *   CreateEnvironmentRequest request = CreateEnvironmentRequest.newBuilder()
-   *     .setParent(parent.toString())
-   *     .setEnvironment(environment)
-   *     .build();
-   *   ApiFuture<Operation> future = environmentsClient.createEnvironmentCallable().futureCall(request);
-   *   // Do something
-   *   Operation response = future.get();
-   * }
-   * 
*/ public final UnaryCallable createEnvironmentCallable() { return stub.createEnvironmentCallable(); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Updates the specified [Environment][google.cloud.dialogflow.cx.v3.Environment]. * - *

Sample code: - * - *


-   * try (EnvironmentsClient environmentsClient = EnvironmentsClient.create()) {
-   *   Environment environment = Environment.newBuilder().build();
-   *   FieldMask updateMask = FieldMask.newBuilder().build();
-   *   Environment response = environmentsClient.updateEnvironmentAsync(environment, updateMask).get();
-   * }
-   * 
- * * @param environment Required. The environment to update. * @param updateMask Required. The mask to control which fields get updated. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ - @BetaApi( - "The surface for long-running operations is not stable yet and may change in the future.") public final OperationFuture updateEnvironmentAsync( Environment environment, FieldMask updateMask) { UpdateEnvironmentRequest request = @@ -579,97 +372,43 @@ public final OperationFuture updateEnvironmentAsync( return updateEnvironmentAsync(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Updates the specified [Environment][google.cloud.dialogflow.cx.v3.Environment]. * - *

Sample code: - * - *


-   * try (EnvironmentsClient environmentsClient = EnvironmentsClient.create()) {
-   *   Environment environment = Environment.newBuilder().build();
-   *   FieldMask updateMask = FieldMask.newBuilder().build();
-   *   UpdateEnvironmentRequest request = UpdateEnvironmentRequest.newBuilder()
-   *     .setEnvironment(environment)
-   *     .setUpdateMask(updateMask)
-   *     .build();
-   *   Environment response = environmentsClient.updateEnvironmentAsync(request).get();
-   * }
-   * 
- * * @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 */ - @BetaApi( - "The surface for long-running operations is not stable yet and may change in the future.") public final OperationFuture updateEnvironmentAsync( UpdateEnvironmentRequest request) { return updateEnvironmentOperationCallable().futureCall(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Updates the specified [Environment][google.cloud.dialogflow.cx.v3.Environment]. * *

Sample code: - * - *


-   * try (EnvironmentsClient environmentsClient = EnvironmentsClient.create()) {
-   *   Environment environment = Environment.newBuilder().build();
-   *   FieldMask updateMask = FieldMask.newBuilder().build();
-   *   UpdateEnvironmentRequest request = UpdateEnvironmentRequest.newBuilder()
-   *     .setEnvironment(environment)
-   *     .setUpdateMask(updateMask)
-   *     .build();
-   *   OperationFuture<Environment, Struct> future = environmentsClient.updateEnvironmentOperationCallable().futureCall(request);
-   *   // Do something
-   *   Environment response = future.get();
-   * }
-   * 
*/ - @BetaApi("The surface for use by generated code is not stable yet and may change in the future.") public final OperationCallable updateEnvironmentOperationCallable() { return stub.updateEnvironmentOperationCallable(); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Updates the specified [Environment][google.cloud.dialogflow.cx.v3.Environment]. * *

Sample code: - * - *


-   * try (EnvironmentsClient environmentsClient = EnvironmentsClient.create()) {
-   *   Environment environment = Environment.newBuilder().build();
-   *   FieldMask updateMask = FieldMask.newBuilder().build();
-   *   UpdateEnvironmentRequest request = UpdateEnvironmentRequest.newBuilder()
-   *     .setEnvironment(environment)
-   *     .setUpdateMask(updateMask)
-   *     .build();
-   *   ApiFuture<Operation> future = environmentsClient.updateEnvironmentCallable().futureCall(request);
-   *   // Do something
-   *   Operation response = future.get();
-   * }
-   * 
*/ public final UnaryCallable updateEnvironmentCallable() { return stub.updateEnvironmentCallable(); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Deletes the specified [Environment][google.cloud.dialogflow.cx.v3.Environment]. * - *

Sample code: - * - *


-   * try (EnvironmentsClient environmentsClient = EnvironmentsClient.create()) {
-   *   EnvironmentName name = EnvironmentName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[ENVIRONMENT]");
-   *   environmentsClient.deleteEnvironment(name);
-   * }
-   * 
- * * @param name Required. The name of the [Environment][google.cloud.dialogflow.cx.v3.Environment] * to delete. Format: `projects/<Project ID>/locations/<Location * ID>/agents/<Agent ID>/environments/<Environment ID>`. @@ -683,19 +422,10 @@ public final void deleteEnvironment(EnvironmentName name) { deleteEnvironment(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Deletes the specified [Environment][google.cloud.dialogflow.cx.v3.Environment]. * - *

Sample code: - * - *


-   * try (EnvironmentsClient environmentsClient = EnvironmentsClient.create()) {
-   *   EnvironmentName name = EnvironmentName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[ENVIRONMENT]");
-   *   environmentsClient.deleteEnvironment(name.toString());
-   * }
-   * 
- * * @param name Required. The name of the [Environment][google.cloud.dialogflow.cx.v3.Environment] * to delete. Format: `projects/<Project ID>/locations/<Location * ID>/agents/<Agent ID>/environments/<Environment ID>`. @@ -706,22 +436,10 @@ public final void deleteEnvironment(String name) { deleteEnvironment(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Deletes the specified [Environment][google.cloud.dialogflow.cx.v3.Environment]. * - *

Sample code: - * - *


-   * try (EnvironmentsClient environmentsClient = EnvironmentsClient.create()) {
-   *   EnvironmentName name = EnvironmentName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[ENVIRONMENT]");
-   *   DeleteEnvironmentRequest request = DeleteEnvironmentRequest.newBuilder()
-   *     .setName(name.toString())
-   *     .build();
-   *   environmentsClient.deleteEnvironment(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 */ @@ -729,43 +447,20 @@ public final void deleteEnvironment(DeleteEnvironmentRequest request) { deleteEnvironmentCallable().call(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Deletes the specified [Environment][google.cloud.dialogflow.cx.v3.Environment]. * *

Sample code: - * - *


-   * try (EnvironmentsClient environmentsClient = EnvironmentsClient.create()) {
-   *   EnvironmentName name = EnvironmentName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[ENVIRONMENT]");
-   *   DeleteEnvironmentRequest request = DeleteEnvironmentRequest.newBuilder()
-   *     .setName(name.toString())
-   *     .build();
-   *   ApiFuture<Void> future = environmentsClient.deleteEnvironmentCallable().futureCall(request);
-   *   // Do something
-   *   future.get();
-   * }
-   * 
*/ public final UnaryCallable deleteEnvironmentCallable() { return stub.deleteEnvironmentCallable(); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Looks up the history of the specified [Environment][google.cloud.dialogflow.cx.v3.Environment]. * - *

Sample code: - * - *


-   * try (EnvironmentsClient environmentsClient = EnvironmentsClient.create()) {
-   *   EnvironmentName name = EnvironmentName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[ENVIRONMENT]");
-   *   for (Environment element : environmentsClient.lookupEnvironmentHistory(name).iterateAll()) {
-   *     // doThingsWith(element);
-   *   }
-   * }
-   * 
- * * @param name Required. Resource name of the environment to look up the history for. Format: * `projects/<Project ID>/locations/<Location ID>/agents/<Agent * ID>/environments/<Environment ID>`. @@ -780,21 +475,10 @@ public final LookupEnvironmentHistoryPagedResponse lookupEnvironmentHistory( return lookupEnvironmentHistory(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Looks up the history of the specified [Environment][google.cloud.dialogflow.cx.v3.Environment]. * - *

Sample code: - * - *


-   * try (EnvironmentsClient environmentsClient = EnvironmentsClient.create()) {
-   *   EnvironmentName name = EnvironmentName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[ENVIRONMENT]");
-   *   for (Environment element : environmentsClient.lookupEnvironmentHistory(name.toString()).iterateAll()) {
-   *     // doThingsWith(element);
-   *   }
-   * }
-   * 
- * * @param name Required. Resource name of the environment to look up the history for. Format: * `projects/<Project ID>/locations/<Location ID>/agents/<Agent * ID>/environments/<Environment ID>`. @@ -806,24 +490,10 @@ public final LookupEnvironmentHistoryPagedResponse lookupEnvironmentHistory(Stri return lookupEnvironmentHistory(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Looks up the history of the specified [Environment][google.cloud.dialogflow.cx.v3.Environment]. * - *

Sample code: - * - *


-   * try (EnvironmentsClient environmentsClient = EnvironmentsClient.create()) {
-   *   EnvironmentName name = EnvironmentName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[ENVIRONMENT]");
-   *   LookupEnvironmentHistoryRequest request = LookupEnvironmentHistoryRequest.newBuilder()
-   *     .setName(name.toString())
-   *     .build();
-   *   for (Environment element : environmentsClient.lookupEnvironmentHistory(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 */ @@ -832,57 +502,22 @@ public final LookupEnvironmentHistoryPagedResponse lookupEnvironmentHistory( return lookupEnvironmentHistoryPagedCallable().call(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Looks up the history of the specified [Environment][google.cloud.dialogflow.cx.v3.Environment]. * *

Sample code: - * - *


-   * try (EnvironmentsClient environmentsClient = EnvironmentsClient.create()) {
-   *   EnvironmentName name = EnvironmentName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[ENVIRONMENT]");
-   *   LookupEnvironmentHistoryRequest request = LookupEnvironmentHistoryRequest.newBuilder()
-   *     .setName(name.toString())
-   *     .build();
-   *   ApiFuture<LookupEnvironmentHistoryPagedResponse> future = environmentsClient.lookupEnvironmentHistoryPagedCallable().futureCall(request);
-   *   // Do something
-   *   for (Environment element : future.get().iterateAll()) {
-   *     // doThingsWith(element);
-   *   }
-   * }
-   * 
*/ public final UnaryCallable lookupEnvironmentHistoryPagedCallable() { return stub.lookupEnvironmentHistoryPagedCallable(); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Looks up the history of the specified [Environment][google.cloud.dialogflow.cx.v3.Environment]. * *

Sample code: - * - *


-   * try (EnvironmentsClient environmentsClient = EnvironmentsClient.create()) {
-   *   EnvironmentName name = EnvironmentName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[ENVIRONMENT]");
-   *   LookupEnvironmentHistoryRequest request = LookupEnvironmentHistoryRequest.newBuilder()
-   *     .setName(name.toString())
-   *     .build();
-   *   while (true) {
-   *     LookupEnvironmentHistoryResponse response = environmentsClient.lookupEnvironmentHistoryCallable().call(request);
-   *     for (Environment element : response.getEnvironmentsList()) {
-   *       // doThingsWith(element);
-   *     }
-   *     String nextPageToken = response.getNextPageToken();
-   *     if (!Strings.isNullOrEmpty(nextPageToken)) {
-   *       request = request.toBuilder().setPageToken(nextPageToken).build();
-   *     } else {
-   *       break;
-   *     }
-   *   }
-   * }
-   * 
*/ public final UnaryCallable lookupEnvironmentHistoryCallable() { diff --git a/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3/EnvironmentsSettings.java b/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3/EnvironmentsSettings.java index fed683871..c366e8e36 100644 --- a/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3/EnvironmentsSettings.java +++ b/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3/EnvironmentsSettings.java @@ -5,7 +5,7 @@ * 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 + * 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, @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.google.cloud.dialogflow.cx.v3; import static com.google.cloud.dialogflow.cx.v3.EnvironmentsClient.ListEnvironmentsPagedResponse; @@ -38,7 +39,7 @@ import java.util.List; import javax.annotation.Generated; -// AUTO-GENERATED DOCUMENTATION AND CLASS +// AUTO-GENERATED DOCUMENTATION AND CLASS. /** * Settings class to configure an instance of {@link EnvironmentsClient}. * @@ -55,22 +56,23 @@ * *

For example, to set the total timeout of getEnvironment to 30 seconds: * - *

- * 
- * EnvironmentsSettings.Builder environmentsSettingsBuilder =
- *     EnvironmentsSettings.newBuilder();
+ * 
{@code
+ * EnvironmentsSettings.Builder environmentsSettingsBuilder = EnvironmentsSettings.newBuilder();
  * environmentsSettingsBuilder
  *     .getEnvironmentSettings()
  *     .setRetrySettings(
- *         environmentsSettingsBuilder.getEnvironmentSettings().getRetrySettings().toBuilder()
+ *         environmentsSettingsBuilder
+ *             .getEnvironmentSettings()
+ *             .getRetrySettings()
+ *             .toBuilder()
  *             .setTotalTimeout(Duration.ofSeconds(30))
  *             .build());
  * EnvironmentsSettings environmentsSettings = environmentsSettingsBuilder.build();
- * 
- * 
+ * }
*/ -@Generated("by gapic-generator") +@Generated("by gapic-generator-java") public class EnvironmentsSettings extends ClientSettings { + /** Returns the object with the settings used for calls to listEnvironments. */ public PagedCallSettings< ListEnvironmentsRequest, ListEnvironmentsResponse, ListEnvironmentsPagedResponse> @@ -89,8 +91,6 @@ public UnaryCallSettings createEnvironmentS } /** Returns the object with the settings used for calls to createEnvironment. */ - @BetaApi( - "The surface for long-running operations is not stable yet and may change in the future.") public OperationCallSettings createEnvironmentOperationSettings() { return ((EnvironmentsStubSettings) getStubSettings()).createEnvironmentOperationSettings(); @@ -102,8 +102,6 @@ public UnaryCallSettings updateEnvironmentS } /** Returns the object with the settings used for calls to updateEnvironment. */ - @BetaApi( - "The surface for long-running operations is not stable yet and may change in the future.") public OperationCallSettings updateEnvironmentOperationSettings() { return ((EnvironmentsStubSettings) getStubSettings()).updateEnvironmentOperationSettings(); @@ -183,18 +181,15 @@ protected EnvironmentsSettings(Builder settingsBuilder) throws IOException { /** Builder for EnvironmentsSettings. */ public static class Builder extends ClientSettings.Builder { + protected Builder() throws IOException { - this((ClientContext) null); + this(((ClientContext) null)); } protected Builder(ClientContext clientContext) { super(EnvironmentsStubSettings.newBuilder(clientContext)); } - private static Builder createDefault() { - return new Builder(EnvironmentsStubSettings.newBuilder()); - } - protected Builder(EnvironmentsSettings settings) { super(settings.getStubSettings().toBuilder()); } @@ -203,11 +198,15 @@ protected Builder(EnvironmentsStubSettings.Builder stubSettings) { super(stubSettings); } + private static Builder createDefault() { + return new Builder(EnvironmentsStubSettings.newBuilder()); + } + public EnvironmentsStubSettings.Builder getStubSettingsBuilder() { return ((EnvironmentsStubSettings.Builder) getStubSettings()); } - // NEXT_MAJOR_VER: remove 'throws Exception' + // NEXT_MAJOR_VER: remove 'throws Exception'. /** * Applies the given settings updater function to all of the unary API methods in this service. * @@ -239,8 +238,6 @@ public UnaryCallSettings.Builder getEnvironm } /** Returns the builder for the settings used for calls to createEnvironment. */ - @BetaApi( - "The surface for long-running operations is not stable yet and may change in the future.") public OperationCallSettings.Builder createEnvironmentOperationSettings() { return getStubSettingsBuilder().createEnvironmentOperationSettings(); @@ -253,8 +250,6 @@ public UnaryCallSettings.Builder getEnvironm } /** Returns the builder for the settings used for calls to updateEnvironment. */ - @BetaApi( - "The surface for long-running operations is not stable yet and may change in the future.") public OperationCallSettings.Builder updateEnvironmentOperationSettings() { return getStubSettingsBuilder().updateEnvironmentOperationSettings(); diff --git a/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3/FlowsClient.java b/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3/FlowsClient.java index 234d5a6f0..71497dbd2 100644 --- a/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3/FlowsClient.java +++ b/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3/FlowsClient.java @@ -5,7 +5,7 @@ * 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 + * 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, @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.google.cloud.dialogflow.cx.v3; import com.google.api.core.ApiFunction; @@ -40,24 +41,14 @@ import java.util.concurrent.TimeUnit; import javax.annotation.Generated; -// AUTO-GENERATED DOCUMENTATION AND SERVICE +// AUTO-GENERATED DOCUMENTATION AND CLASS. /** * Service Description: Service for managing [Flows][google.cloud.dialogflow.cx.v3.Flow]. * *

This class provides the ability to make remote calls to the backing service through method * calls that map to API methods. Sample code to get started: * - *

- * 
- * try (FlowsClient flowsClient = FlowsClient.create()) {
- *   AgentName parent = AgentName.of("[PROJECT]", "[LOCATION]", "[AGENT]");
- *   Flow flow = Flow.newBuilder().build();
- *   Flow response = flowsClient.createFlow(parent, flow);
- * }
- * 
- * 
- * - *

Note: close() needs to be called on the flowsClient object to clean up resources such as + *

Note: close() needs to be called on the FlowsClient object to clean up resources such as * threads. In the example above, try-with-resources is used, which automatically calls close(). * *

The surface of this class includes several types of Java methods for each of the API's @@ -85,28 +76,24 @@ * *

To customize credentials: * - *

- * 
+ * 
{@code
  * FlowsSettings flowsSettings =
  *     FlowsSettings.newBuilder()
  *         .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
  *         .build();
- * FlowsClient flowsClient =
- *     FlowsClient.create(flowsSettings);
- * 
- * 
+ * FlowsClient flowsClient = FlowsClient.create(flowsSettings); + * }
* - * To customize the endpoint: + *

To customize the endpoint: * - *

- * 
- * FlowsSettings flowsSettings =
- *     FlowsSettings.newBuilder().setEndpoint(myEndpoint).build();
- * FlowsClient flowsClient =
- *     FlowsClient.create(flowsSettings);
- * 
- * 
+ *
{@code
+ * FlowsSettings flowsSettings = FlowsSettings.newBuilder().setEndpoint(myEndpoint).build();
+ * FlowsClient flowsClient = FlowsClient.create(flowsSettings);
+ * }
+ * + *

Please refer to the GitHub repository's samples for more quickstart code snippets. */ +@BetaApi @Generated("by gapic-generator") public class FlowsClient implements BackgroundResource { private final FlowsSettings settings; @@ -128,7 +115,7 @@ public static final FlowsClient create(FlowsSettings settings) throws IOExceptio /** * Constructs an instance of FlowsClient, using the given stub for making calls. This is for - * advanced usage - prefer to use FlowsSettings}. + * advanced usage - prefer using create(FlowsSettings). */ @BetaApi("A restructuring of stub classes is planned, so this may break in the future") public static final FlowsClient create(FlowsStub stub) { @@ -165,26 +152,14 @@ public FlowsStub getStub() { * Returns the OperationsClient that can be used to query the status of a long-running operation * returned by another API method call. */ - @BetaApi( - "The surface for long-running operations is not stable yet and may change in the future.") public final OperationsClient getOperationsClient() { return operationsClient; } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Creates a flow in the specified agent. * - *

Sample code: - * - *


-   * try (FlowsClient flowsClient = FlowsClient.create()) {
-   *   AgentName parent = AgentName.of("[PROJECT]", "[LOCATION]", "[AGENT]");
-   *   Flow flow = Flow.newBuilder().build();
-   *   Flow response = flowsClient.createFlow(parent, flow);
-   * }
-   * 
- * * @param parent Required. The agent to create a flow for. Format: `projects/<Project * ID>/locations/<Location ID>/agents/<Agent ID>`. * @param flow Required. The flow to create. @@ -199,20 +174,10 @@ public final Flow createFlow(AgentName parent, Flow flow) { return createFlow(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Creates a flow in the specified agent. * - *

Sample code: - * - *


-   * try (FlowsClient flowsClient = FlowsClient.create()) {
-   *   AgentName parent = AgentName.of("[PROJECT]", "[LOCATION]", "[AGENT]");
-   *   Flow flow = Flow.newBuilder().build();
-   *   Flow response = flowsClient.createFlow(parent.toString(), flow);
-   * }
-   * 
- * * @param parent Required. The agent to create a flow for. Format: `projects/<Project * ID>/locations/<Location ID>/agents/<Agent ID>`. * @param flow Required. The flow to create. @@ -224,24 +189,10 @@ public final Flow createFlow(String parent, Flow flow) { return createFlow(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Creates a flow in the specified agent. * - *

Sample code: - * - *


-   * try (FlowsClient flowsClient = FlowsClient.create()) {
-   *   AgentName parent = AgentName.of("[PROJECT]", "[LOCATION]", "[AGENT]");
-   *   Flow flow = Flow.newBuilder().build();
-   *   CreateFlowRequest request = CreateFlowRequest.newBuilder()
-   *     .setParent(parent.toString())
-   *     .setFlow(flow)
-   *     .build();
-   *   Flow response = flowsClient.createFlow(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 */ @@ -249,43 +200,20 @@ public final Flow createFlow(CreateFlowRequest request) { return createFlowCallable().call(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Creates a flow in the specified agent. * *

Sample code: - * - *


-   * try (FlowsClient flowsClient = FlowsClient.create()) {
-   *   AgentName parent = AgentName.of("[PROJECT]", "[LOCATION]", "[AGENT]");
-   *   Flow flow = Flow.newBuilder().build();
-   *   CreateFlowRequest request = CreateFlowRequest.newBuilder()
-   *     .setParent(parent.toString())
-   *     .setFlow(flow)
-   *     .build();
-   *   ApiFuture<Flow> future = flowsClient.createFlowCallable().futureCall(request);
-   *   // Do something
-   *   Flow response = future.get();
-   * }
-   * 
*/ public final UnaryCallable createFlowCallable() { return stub.createFlowCallable(); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Deletes a specified flow. * - *

Sample code: - * - *


-   * try (FlowsClient flowsClient = FlowsClient.create()) {
-   *   FlowName name = FlowName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]");
-   *   flowsClient.deleteFlow(name);
-   * }
-   * 
- * * @param name Required. The name of the flow to delete. Format: `projects/<Project * ID>/locations/<Location ID>/agents/<Agent ID>/flows/<Flow ID>`. * @throws com.google.api.gax.rpc.ApiException if the remote call fails @@ -296,19 +224,10 @@ public final void deleteFlow(FlowName name) { deleteFlow(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Deletes a specified flow. * - *

Sample code: - * - *


-   * try (FlowsClient flowsClient = FlowsClient.create()) {
-   *   FlowName name = FlowName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]");
-   *   flowsClient.deleteFlow(name.toString());
-   * }
-   * 
- * * @param name Required. The name of the flow to delete. Format: `projects/<Project * ID>/locations/<Location ID>/agents/<Agent ID>/flows/<Flow ID>`. * @throws com.google.api.gax.rpc.ApiException if the remote call fails @@ -318,22 +237,10 @@ public final void deleteFlow(String name) { deleteFlow(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Deletes a specified flow. * - *

Sample code: - * - *


-   * try (FlowsClient flowsClient = FlowsClient.create()) {
-   *   FlowName name = FlowName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]");
-   *   DeleteFlowRequest request = DeleteFlowRequest.newBuilder()
-   *     .setName(name.toString())
-   *     .build();
-   *   flowsClient.deleteFlow(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 */ @@ -341,43 +248,20 @@ public final void deleteFlow(DeleteFlowRequest request) { deleteFlowCallable().call(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Deletes a specified flow. * *

Sample code: - * - *


-   * try (FlowsClient flowsClient = FlowsClient.create()) {
-   *   FlowName name = FlowName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]");
-   *   DeleteFlowRequest request = DeleteFlowRequest.newBuilder()
-   *     .setName(name.toString())
-   *     .build();
-   *   ApiFuture<Void> future = flowsClient.deleteFlowCallable().futureCall(request);
-   *   // Do something
-   *   future.get();
-   * }
-   * 
*/ public final UnaryCallable deleteFlowCallable() { return stub.deleteFlowCallable(); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Returns the list of all flows in the specified agent. * - *

Sample code: - * - *


-   * try (FlowsClient flowsClient = FlowsClient.create()) {
-   *   AgentName parent = AgentName.of("[PROJECT]", "[LOCATION]", "[AGENT]");
-   *   for (Flow element : flowsClient.listFlows(parent).iterateAll()) {
-   *     // doThingsWith(element);
-   *   }
-   * }
-   * 
- * * @param parent Required. The agent containing the flows. Format: `projects/<Project * ID>/locations/<Location ID>/agents/<Agent ID>`. * @throws com.google.api.gax.rpc.ApiException if the remote call fails @@ -388,21 +272,10 @@ public final ListFlowsPagedResponse listFlows(AgentName parent) { return listFlows(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Returns the list of all flows in the specified agent. * - *

Sample code: - * - *


-   * try (FlowsClient flowsClient = FlowsClient.create()) {
-   *   AgentName parent = AgentName.of("[PROJECT]", "[LOCATION]", "[AGENT]");
-   *   for (Flow element : flowsClient.listFlows(parent.toString()).iterateAll()) {
-   *     // doThingsWith(element);
-   *   }
-   * }
-   * 
- * * @param parent Required. The agent containing the flows. Format: `projects/<Project * ID>/locations/<Location ID>/agents/<Agent ID>`. * @throws com.google.api.gax.rpc.ApiException if the remote call fails @@ -412,24 +285,10 @@ public final ListFlowsPagedResponse listFlows(String parent) { return listFlows(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Returns the list of all flows in the specified agent. * - *

Sample code: - * - *


-   * try (FlowsClient flowsClient = FlowsClient.create()) {
-   *   AgentName parent = AgentName.of("[PROJECT]", "[LOCATION]", "[AGENT]");
-   *   ListFlowsRequest request = ListFlowsRequest.newBuilder()
-   *     .setParent(parent.toString())
-   *     .build();
-   *   for (Flow element : flowsClient.listFlows(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 */ @@ -437,74 +296,30 @@ public final ListFlowsPagedResponse listFlows(ListFlowsRequest request) { return listFlowsPagedCallable().call(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Returns the list of all flows in the specified agent. * *

Sample code: - * - *


-   * try (FlowsClient flowsClient = FlowsClient.create()) {
-   *   AgentName parent = AgentName.of("[PROJECT]", "[LOCATION]", "[AGENT]");
-   *   ListFlowsRequest request = ListFlowsRequest.newBuilder()
-   *     .setParent(parent.toString())
-   *     .build();
-   *   ApiFuture<ListFlowsPagedResponse> future = flowsClient.listFlowsPagedCallable().futureCall(request);
-   *   // Do something
-   *   for (Flow element : future.get().iterateAll()) {
-   *     // doThingsWith(element);
-   *   }
-   * }
-   * 
*/ public final UnaryCallable listFlowsPagedCallable() { return stub.listFlowsPagedCallable(); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Returns the list of all flows in the specified agent. * *

Sample code: - * - *


-   * try (FlowsClient flowsClient = FlowsClient.create()) {
-   *   AgentName parent = AgentName.of("[PROJECT]", "[LOCATION]", "[AGENT]");
-   *   ListFlowsRequest request = ListFlowsRequest.newBuilder()
-   *     .setParent(parent.toString())
-   *     .build();
-   *   while (true) {
-   *     ListFlowsResponse response = flowsClient.listFlowsCallable().call(request);
-   *     for (Flow element : response.getFlowsList()) {
-   *       // doThingsWith(element);
-   *     }
-   *     String nextPageToken = response.getNextPageToken();
-   *     if (!Strings.isNullOrEmpty(nextPageToken)) {
-   *       request = request.toBuilder().setPageToken(nextPageToken).build();
-   *     } else {
-   *       break;
-   *     }
-   *   }
-   * }
-   * 
*/ public final UnaryCallable listFlowsCallable() { return stub.listFlowsCallable(); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Retrieves the specified flow. * - *

Sample code: - * - *


-   * try (FlowsClient flowsClient = FlowsClient.create()) {
-   *   FlowName name = FlowName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]");
-   *   Flow response = flowsClient.getFlow(name);
-   * }
-   * 
- * * @param name Required. The name of the flow to get. Format: `projects/<Project * ID>/locations/<Location ID>/agents/<Agent ID>/flows/<Flow ID>`. * @throws com.google.api.gax.rpc.ApiException if the remote call fails @@ -515,19 +330,10 @@ public final Flow getFlow(FlowName name) { return getFlow(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Retrieves the specified flow. * - *

Sample code: - * - *


-   * try (FlowsClient flowsClient = FlowsClient.create()) {
-   *   FlowName name = FlowName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]");
-   *   Flow response = flowsClient.getFlow(name.toString());
-   * }
-   * 
- * * @param name Required. The name of the flow to get. Format: `projects/<Project * ID>/locations/<Location ID>/agents/<Agent ID>/flows/<Flow ID>`. * @throws com.google.api.gax.rpc.ApiException if the remote call fails @@ -537,22 +343,10 @@ public final Flow getFlow(String name) { return getFlow(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Retrieves the specified flow. * - *

Sample code: - * - *


-   * try (FlowsClient flowsClient = FlowsClient.create()) {
-   *   FlowName name = FlowName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]");
-   *   GetFlowRequest request = GetFlowRequest.newBuilder()
-   *     .setName(name.toString())
-   *     .build();
-   *   Flow response = flowsClient.getFlow(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 */ @@ -560,42 +354,20 @@ public final Flow getFlow(GetFlowRequest request) { return getFlowCallable().call(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Retrieves the specified flow. * *

Sample code: - * - *


-   * try (FlowsClient flowsClient = FlowsClient.create()) {
-   *   FlowName name = FlowName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]");
-   *   GetFlowRequest request = GetFlowRequest.newBuilder()
-   *     .setName(name.toString())
-   *     .build();
-   *   ApiFuture<Flow> future = flowsClient.getFlowCallable().futureCall(request);
-   *   // Do something
-   *   Flow response = future.get();
-   * }
-   * 
*/ public final UnaryCallable getFlowCallable() { return stub.getFlowCallable(); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Updates the specified flow. * - *

Sample code: - * - *


-   * try (FlowsClient flowsClient = FlowsClient.create()) {
-   *   Flow flow = Flow.newBuilder().build();
-   *   FieldMask updateMask = FieldMask.newBuilder().build();
-   *   Flow response = flowsClient.updateFlow(flow, updateMask);
-   * }
-   * 
- * * @param flow Required. The flow to update. * @param updateMask Required. The mask to control which fields get updated. If `update_mask` is * not specified, an error will be returned. @@ -607,24 +379,10 @@ public final Flow updateFlow(Flow flow, FieldMask updateMask) { return updateFlow(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Updates the specified flow. * - *

Sample code: - * - *


-   * try (FlowsClient flowsClient = FlowsClient.create()) {
-   *   Flow flow = Flow.newBuilder().build();
-   *   FieldMask updateMask = FieldMask.newBuilder().build();
-   *   UpdateFlowRequest request = UpdateFlowRequest.newBuilder()
-   *     .setFlow(flow)
-   *     .setUpdateMask(updateMask)
-   *     .build();
-   *   Flow response = flowsClient.updateFlow(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 */ @@ -632,144 +390,69 @@ public final Flow updateFlow(UpdateFlowRequest request) { return updateFlowCallable().call(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Updates the specified flow. * *

Sample code: - * - *


-   * try (FlowsClient flowsClient = FlowsClient.create()) {
-   *   Flow flow = Flow.newBuilder().build();
-   *   FieldMask updateMask = FieldMask.newBuilder().build();
-   *   UpdateFlowRequest request = UpdateFlowRequest.newBuilder()
-   *     .setFlow(flow)
-   *     .setUpdateMask(updateMask)
-   *     .build();
-   *   ApiFuture<Flow> future = flowsClient.updateFlowCallable().futureCall(request);
-   *   // Do something
-   *   Flow response = future.get();
-   * }
-   * 
*/ public final UnaryCallable updateFlowCallable() { return stub.updateFlowCallable(); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Trains the specified flow. Note that only the flow in 'draft' environment is trained. * - *

Sample code: - * - *


-   * try (FlowsClient flowsClient = FlowsClient.create()) {
-   *   FlowName name = FlowName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]");
-   *   flowsClient.trainFlowAsync(name).get();
-   * }
-   * 
- * * @param name Required. The flow to train. Format: `projects/<Project * ID>/locations/<Location ID>/agents/<Agent ID>/flows/<Flow ID>`. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ - @BetaApi( - "The surface for long-running operations is not stable yet and may change in the future.") public final OperationFuture trainFlowAsync(FlowName name) { TrainFlowRequest request = TrainFlowRequest.newBuilder().setName(name == null ? null : name.toString()).build(); return trainFlowAsync(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Trains the specified flow. Note that only the flow in 'draft' environment is trained. * - *

Sample code: - * - *


-   * try (FlowsClient flowsClient = FlowsClient.create()) {
-   *   FlowName name = FlowName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]");
-   *   flowsClient.trainFlowAsync(name.toString()).get();
-   * }
-   * 
- * * @param name Required. The flow to train. Format: `projects/<Project * ID>/locations/<Location ID>/agents/<Agent ID>/flows/<Flow ID>`. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ - @BetaApi( - "The surface for long-running operations is not stable yet and may change in the future.") public final OperationFuture trainFlowAsync(String name) { TrainFlowRequest request = TrainFlowRequest.newBuilder().setName(name).build(); return trainFlowAsync(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Trains the specified flow. Note that only the flow in 'draft' environment is trained. * - *

Sample code: - * - *


-   * try (FlowsClient flowsClient = FlowsClient.create()) {
-   *   FlowName name = FlowName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]");
-   *   TrainFlowRequest request = TrainFlowRequest.newBuilder()
-   *     .setName(name.toString())
-   *     .build();
-   *   flowsClient.trainFlowAsync(request).get();
-   * }
-   * 
- * * @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 */ - @BetaApi( - "The surface for long-running operations is not stable yet and may change in the future.") public final OperationFuture trainFlowAsync(TrainFlowRequest request) { return trainFlowOperationCallable().futureCall(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Trains the specified flow. Note that only the flow in 'draft' environment is trained. * *

Sample code: - * - *


-   * try (FlowsClient flowsClient = FlowsClient.create()) {
-   *   FlowName name = FlowName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]");
-   *   TrainFlowRequest request = TrainFlowRequest.newBuilder()
-   *     .setName(name.toString())
-   *     .build();
-   *   OperationFuture<Empty, Struct> future = flowsClient.trainFlowOperationCallable().futureCall(request);
-   *   // Do something
-   *   future.get();
-   * }
-   * 
*/ - @BetaApi("The surface for use by generated code is not stable yet and may change in the future.") public final OperationCallable trainFlowOperationCallable() { return stub.trainFlowOperationCallable(); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Trains the specified flow. Note that only the flow in 'draft' environment is trained. * *

Sample code: - * - *


-   * try (FlowsClient flowsClient = FlowsClient.create()) {
-   *   FlowName name = FlowName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]");
-   *   TrainFlowRequest request = TrainFlowRequest.newBuilder()
-   *     .setName(name.toString())
-   *     .build();
-   *   ApiFuture<Operation> future = flowsClient.trainFlowCallable().futureCall(request);
-   *   // Do something
-   *   future.get();
-   * }
-   * 
*/ public final UnaryCallable trainFlowCallable() { return stub.trainFlowCallable(); diff --git a/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3/FlowsSettings.java b/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3/FlowsSettings.java index b9d19894c..1d282cd1e 100644 --- a/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3/FlowsSettings.java +++ b/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3/FlowsSettings.java @@ -5,7 +5,7 @@ * 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 + * 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, @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.google.cloud.dialogflow.cx.v3; import static com.google.cloud.dialogflow.cx.v3.FlowsClient.ListFlowsPagedResponse; @@ -37,7 +38,7 @@ import java.util.List; import javax.annotation.Generated; -// AUTO-GENERATED DOCUMENTATION AND CLASS +// AUTO-GENERATED DOCUMENTATION AND CLASS. /** * Settings class to configure an instance of {@link FlowsClient}. * @@ -54,22 +55,23 @@ * *

For example, to set the total timeout of createFlow to 30 seconds: * - *

- * 
- * FlowsSettings.Builder flowsSettingsBuilder =
- *     FlowsSettings.newBuilder();
+ * 
{@code
+ * FlowsSettings.Builder flowsSettingsBuilder = FlowsSettings.newBuilder();
  * flowsSettingsBuilder
  *     .createFlowSettings()
  *     .setRetrySettings(
- *         flowsSettingsBuilder.createFlowSettings().getRetrySettings().toBuilder()
+ *         flowsSettingsBuilder
+ *             .createFlowSettings()
+ *             .getRetrySettings()
+ *             .toBuilder()
  *             .setTotalTimeout(Duration.ofSeconds(30))
  *             .build());
  * FlowsSettings flowsSettings = flowsSettingsBuilder.build();
- * 
- * 
+ * }
*/ -@Generated("by gapic-generator") +@Generated("by gapic-generator-java") public class FlowsSettings extends ClientSettings { + /** Returns the object with the settings used for calls to createFlow. */ public UnaryCallSettings createFlowSettings() { return ((FlowsStubSettings) getStubSettings()).createFlowSettings(); @@ -102,8 +104,6 @@ public UnaryCallSettings trainFlowSettings() { } /** Returns the object with the settings used for calls to trainFlow. */ - @BetaApi( - "The surface for long-running operations is not stable yet and may change in the future.") public OperationCallSettings trainFlowOperationSettings() { return ((FlowsStubSettings) getStubSettings()).trainFlowOperationSettings(); } @@ -167,18 +167,15 @@ protected FlowsSettings(Builder settingsBuilder) throws IOException { /** Builder for FlowsSettings. */ public static class Builder extends ClientSettings.Builder { + protected Builder() throws IOException { - this((ClientContext) null); + this(((ClientContext) null)); } protected Builder(ClientContext clientContext) { super(FlowsStubSettings.newBuilder(clientContext)); } - private static Builder createDefault() { - return new Builder(FlowsStubSettings.newBuilder()); - } - protected Builder(FlowsSettings settings) { super(settings.getStubSettings().toBuilder()); } @@ -187,11 +184,15 @@ protected Builder(FlowsStubSettings.Builder stubSettings) { super(stubSettings); } + private static Builder createDefault() { + return new Builder(FlowsStubSettings.newBuilder()); + } + public FlowsStubSettings.Builder getStubSettingsBuilder() { return ((FlowsStubSettings.Builder) getStubSettings()); } - // NEXT_MAJOR_VER: remove 'throws Exception' + // NEXT_MAJOR_VER: remove 'throws Exception'. /** * Applies the given settings updater function to all of the unary API methods in this service. * @@ -236,8 +237,6 @@ public UnaryCallSettings.Builder trainFlowSettings( } /** Returns the builder for the settings used for calls to trainFlow. */ - @BetaApi( - "The surface for long-running operations is not stable yet and may change in the future.") public OperationCallSettings.Builder trainFlowOperationSettings() { return getStubSettingsBuilder().trainFlowOperationSettings(); diff --git a/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3/IntentsClient.java b/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3/IntentsClient.java index b2c613cd6..9589c02e6 100644 --- a/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3/IntentsClient.java +++ b/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3/IntentsClient.java @@ -5,7 +5,7 @@ * 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 + * 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, @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.google.cloud.dialogflow.cx.v3; import com.google.api.core.ApiFunction; @@ -35,23 +36,14 @@ import java.util.concurrent.TimeUnit; import javax.annotation.Generated; -// AUTO-GENERATED DOCUMENTATION AND SERVICE +// AUTO-GENERATED DOCUMENTATION AND CLASS. /** * Service Description: Service for managing [Intents][google.cloud.dialogflow.cx.v3.Intent]. * *

This class provides the ability to make remote calls to the backing service through method * calls that map to API methods. Sample code to get started: * - *

- * 
- * try (IntentsClient intentsClient = IntentsClient.create()) {
- *   IntentName name = IntentName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[INTENT]");
- *   Intent response = intentsClient.getIntent(name);
- * }
- * 
- * 
- * - *

Note: close() needs to be called on the intentsClient object to clean up resources such as + *

Note: close() needs to be called on the IntentsClient object to clean up resources such as * threads. In the example above, try-with-resources is used, which automatically calls close(). * *

The surface of this class includes several types of Java methods for each of the API's @@ -79,28 +71,24 @@ * *

To customize credentials: * - *

- * 
+ * 
{@code
  * IntentsSettings intentsSettings =
  *     IntentsSettings.newBuilder()
  *         .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
  *         .build();
- * IntentsClient intentsClient =
- *     IntentsClient.create(intentsSettings);
- * 
- * 
+ * IntentsClient intentsClient = IntentsClient.create(intentsSettings); + * }
* - * To customize the endpoint: + *

To customize the endpoint: * - *

- * 
- * IntentsSettings intentsSettings =
- *     IntentsSettings.newBuilder().setEndpoint(myEndpoint).build();
- * IntentsClient intentsClient =
- *     IntentsClient.create(intentsSettings);
- * 
- * 
+ *
{@code
+ * IntentsSettings intentsSettings = IntentsSettings.newBuilder().setEndpoint(myEndpoint).build();
+ * IntentsClient intentsClient = IntentsClient.create(intentsSettings);
+ * }
+ * + *

Please refer to the GitHub repository's samples for more quickstart code snippets. */ +@BetaApi @Generated("by gapic-generator") public class IntentsClient implements BackgroundResource { private final IntentsSettings settings; @@ -121,7 +109,7 @@ public static final IntentsClient create(IntentsSettings settings) throws IOExce /** * Constructs an instance of IntentsClient, using the given stub for making calls. This is for - * advanced usage - prefer to use IntentsSettings}. + * advanced usage - prefer using create(IntentsSettings). */ @BetaApi("A restructuring of stub classes is planned, so this may break in the future") public static final IntentsClient create(IntentsStub stub) { @@ -152,21 +140,10 @@ public IntentsStub getStub() { return stub; } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Returns the list of all intents in the specified agent. * - *

Sample code: - * - *


-   * try (IntentsClient intentsClient = IntentsClient.create()) {
-   *   AgentName parent = AgentName.of("[PROJECT]", "[LOCATION]", "[AGENT]");
-   *   for (Intent element : intentsClient.listIntents(parent).iterateAll()) {
-   *     // doThingsWith(element);
-   *   }
-   * }
-   * 
- * * @param parent Required. The agent to list all intents for. Format: `projects/<Project * ID>/locations/<Location ID>/agents/<Agent ID>`. * @throws com.google.api.gax.rpc.ApiException if the remote call fails @@ -179,21 +156,10 @@ public final ListIntentsPagedResponse listIntents(AgentName parent) { return listIntents(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Returns the list of all intents in the specified agent. * - *

Sample code: - * - *


-   * try (IntentsClient intentsClient = IntentsClient.create()) {
-   *   AgentName parent = AgentName.of("[PROJECT]", "[LOCATION]", "[AGENT]");
-   *   for (Intent element : intentsClient.listIntents(parent.toString()).iterateAll()) {
-   *     // doThingsWith(element);
-   *   }
-   * }
-   * 
- * * @param parent Required. The agent to list all intents for. Format: `projects/<Project * ID>/locations/<Location ID>/agents/<Agent ID>`. * @throws com.google.api.gax.rpc.ApiException if the remote call fails @@ -203,24 +169,10 @@ public final ListIntentsPagedResponse listIntents(String parent) { return listIntents(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Returns the list of all intents in the specified agent. * - *

Sample code: - * - *


-   * try (IntentsClient intentsClient = IntentsClient.create()) {
-   *   AgentName parent = AgentName.of("[PROJECT]", "[LOCATION]", "[AGENT]");
-   *   ListIntentsRequest request = ListIntentsRequest.newBuilder()
-   *     .setParent(parent.toString())
-   *     .build();
-   *   for (Intent element : intentsClient.listIntents(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 */ @@ -228,75 +180,31 @@ public final ListIntentsPagedResponse listIntents(ListIntentsRequest request) { return listIntentsPagedCallable().call(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Returns the list of all intents in the specified agent. * *

Sample code: - * - *


-   * try (IntentsClient intentsClient = IntentsClient.create()) {
-   *   AgentName parent = AgentName.of("[PROJECT]", "[LOCATION]", "[AGENT]");
-   *   ListIntentsRequest request = ListIntentsRequest.newBuilder()
-   *     .setParent(parent.toString())
-   *     .build();
-   *   ApiFuture<ListIntentsPagedResponse> future = intentsClient.listIntentsPagedCallable().futureCall(request);
-   *   // Do something
-   *   for (Intent element : future.get().iterateAll()) {
-   *     // doThingsWith(element);
-   *   }
-   * }
-   * 
*/ public final UnaryCallable listIntentsPagedCallable() { return stub.listIntentsPagedCallable(); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Returns the list of all intents in the specified agent. * *

Sample code: - * - *


-   * try (IntentsClient intentsClient = IntentsClient.create()) {
-   *   AgentName parent = AgentName.of("[PROJECT]", "[LOCATION]", "[AGENT]");
-   *   ListIntentsRequest request = ListIntentsRequest.newBuilder()
-   *     .setParent(parent.toString())
-   *     .build();
-   *   while (true) {
-   *     ListIntentsResponse response = intentsClient.listIntentsCallable().call(request);
-   *     for (Intent element : response.getIntentsList()) {
-   *       // doThingsWith(element);
-   *     }
-   *     String nextPageToken = response.getNextPageToken();
-   *     if (!Strings.isNullOrEmpty(nextPageToken)) {
-   *       request = request.toBuilder().setPageToken(nextPageToken).build();
-   *     } else {
-   *       break;
-   *     }
-   *   }
-   * }
-   * 
*/ public final UnaryCallable listIntentsCallable() { return stub.listIntentsCallable(); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Retrieves the specified intent. * - *

Sample code: - * - *


-   * try (IntentsClient intentsClient = IntentsClient.create()) {
-   *   IntentName name = IntentName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[INTENT]");
-   *   Intent response = intentsClient.getIntent(name);
-   * }
-   * 
- * * @param name Required. The name of the intent. Format: `projects/<Project * ID>/locations/<Location ID>/agents/<Agent ID>/intents/<Intent ID>`. * @throws com.google.api.gax.rpc.ApiException if the remote call fails @@ -307,19 +215,10 @@ public final Intent getIntent(IntentName name) { return getIntent(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Retrieves the specified intent. * - *

Sample code: - * - *


-   * try (IntentsClient intentsClient = IntentsClient.create()) {
-   *   IntentName name = IntentName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[INTENT]");
-   *   Intent response = intentsClient.getIntent(name.toString());
-   * }
-   * 
- * * @param name Required. The name of the intent. Format: `projects/<Project * ID>/locations/<Location ID>/agents/<Agent ID>/intents/<Intent ID>`. * @throws com.google.api.gax.rpc.ApiException if the remote call fails @@ -329,22 +228,10 @@ public final Intent getIntent(String name) { return getIntent(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Retrieves the specified intent. * - *

Sample code: - * - *


-   * try (IntentsClient intentsClient = IntentsClient.create()) {
-   *   IntentName name = IntentName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[INTENT]");
-   *   GetIntentRequest request = GetIntentRequest.newBuilder()
-   *     .setName(name.toString())
-   *     .build();
-   *   Intent response = intentsClient.getIntent(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 */ @@ -352,42 +239,20 @@ public final Intent getIntent(GetIntentRequest request) { return getIntentCallable().call(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Retrieves the specified intent. * *

Sample code: - * - *


-   * try (IntentsClient intentsClient = IntentsClient.create()) {
-   *   IntentName name = IntentName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[INTENT]");
-   *   GetIntentRequest request = GetIntentRequest.newBuilder()
-   *     .setName(name.toString())
-   *     .build();
-   *   ApiFuture<Intent> future = intentsClient.getIntentCallable().futureCall(request);
-   *   // Do something
-   *   Intent response = future.get();
-   * }
-   * 
*/ public final UnaryCallable getIntentCallable() { return stub.getIntentCallable(); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Creates an intent in the specified agent. * - *

Sample code: - * - *


-   * try (IntentsClient intentsClient = IntentsClient.create()) {
-   *   AgentName parent = AgentName.of("[PROJECT]", "[LOCATION]", "[AGENT]");
-   *   Intent intent = Intent.newBuilder().build();
-   *   Intent response = intentsClient.createIntent(parent, intent);
-   * }
-   * 
- * * @param parent Required. The agent to create an intent for. Format: `projects/<Project * ID>/locations/<Location ID>/agents/<Agent ID>`. * @param intent Required. The intent to create. @@ -402,20 +267,10 @@ public final Intent createIntent(AgentName parent, Intent intent) { return createIntent(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Creates an intent in the specified agent. * - *

Sample code: - * - *


-   * try (IntentsClient intentsClient = IntentsClient.create()) {
-   *   AgentName parent = AgentName.of("[PROJECT]", "[LOCATION]", "[AGENT]");
-   *   Intent intent = Intent.newBuilder().build();
-   *   Intent response = intentsClient.createIntent(parent.toString(), intent);
-   * }
-   * 
- * * @param parent Required. The agent to create an intent for. Format: `projects/<Project * ID>/locations/<Location ID>/agents/<Agent ID>`. * @param intent Required. The intent to create. @@ -427,24 +282,10 @@ public final Intent createIntent(String parent, Intent intent) { return createIntent(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Creates an intent in the specified agent. * - *

Sample code: - * - *


-   * try (IntentsClient intentsClient = IntentsClient.create()) {
-   *   AgentName parent = AgentName.of("[PROJECT]", "[LOCATION]", "[AGENT]");
-   *   Intent intent = Intent.newBuilder().build();
-   *   CreateIntentRequest request = CreateIntentRequest.newBuilder()
-   *     .setParent(parent.toString())
-   *     .setIntent(intent)
-   *     .build();
-   *   Intent response = intentsClient.createIntent(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 */ @@ -452,44 +293,20 @@ public final Intent createIntent(CreateIntentRequest request) { return createIntentCallable().call(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Creates an intent in the specified agent. * *

Sample code: - * - *


-   * try (IntentsClient intentsClient = IntentsClient.create()) {
-   *   AgentName parent = AgentName.of("[PROJECT]", "[LOCATION]", "[AGENT]");
-   *   Intent intent = Intent.newBuilder().build();
-   *   CreateIntentRequest request = CreateIntentRequest.newBuilder()
-   *     .setParent(parent.toString())
-   *     .setIntent(intent)
-   *     .build();
-   *   ApiFuture<Intent> future = intentsClient.createIntentCallable().futureCall(request);
-   *   // Do something
-   *   Intent response = future.get();
-   * }
-   * 
*/ public final UnaryCallable createIntentCallable() { return stub.createIntentCallable(); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Updates the specified intent. * - *

Sample code: - * - *


-   * try (IntentsClient intentsClient = IntentsClient.create()) {
-   *   Intent intent = Intent.newBuilder().build();
-   *   FieldMask updateMask = FieldMask.newBuilder().build();
-   *   Intent response = intentsClient.updateIntent(intent, updateMask);
-   * }
-   * 
- * * @param intent Required. The intent to update. * @param updateMask The mask to control which fields get updated. If the mask is not present, all * fields will be updated. @@ -501,22 +318,10 @@ public final Intent updateIntent(Intent intent, FieldMask updateMask) { return updateIntent(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Updates the specified intent. * - *

Sample code: - * - *


-   * try (IntentsClient intentsClient = IntentsClient.create()) {
-   *   Intent intent = Intent.newBuilder().build();
-   *   UpdateIntentRequest request = UpdateIntentRequest.newBuilder()
-   *     .setIntent(intent)
-   *     .build();
-   *   Intent response = intentsClient.updateIntent(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 */ @@ -524,41 +329,20 @@ public final Intent updateIntent(UpdateIntentRequest request) { return updateIntentCallable().call(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Updates the specified intent. * *

Sample code: - * - *


-   * try (IntentsClient intentsClient = IntentsClient.create()) {
-   *   Intent intent = Intent.newBuilder().build();
-   *   UpdateIntentRequest request = UpdateIntentRequest.newBuilder()
-   *     .setIntent(intent)
-   *     .build();
-   *   ApiFuture<Intent> future = intentsClient.updateIntentCallable().futureCall(request);
-   *   // Do something
-   *   Intent response = future.get();
-   * }
-   * 
*/ public final UnaryCallable updateIntentCallable() { return stub.updateIntentCallable(); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Deletes the specified intent. * - *

Sample code: - * - *


-   * try (IntentsClient intentsClient = IntentsClient.create()) {
-   *   IntentName name = IntentName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[INTENT]");
-   *   intentsClient.deleteIntent(name);
-   * }
-   * 
- * * @param name Required. The name of the intent to delete. Format: `projects/<Project * ID>/locations/<Location ID>/agents/<Agent ID>/intents/<Intent ID>`. * @throws com.google.api.gax.rpc.ApiException if the remote call fails @@ -569,19 +353,10 @@ public final void deleteIntent(IntentName name) { deleteIntent(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Deletes the specified intent. * - *

Sample code: - * - *


-   * try (IntentsClient intentsClient = IntentsClient.create()) {
-   *   IntentName name = IntentName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[INTENT]");
-   *   intentsClient.deleteIntent(name.toString());
-   * }
-   * 
- * * @param name Required. The name of the intent to delete. Format: `projects/<Project * ID>/locations/<Location ID>/agents/<Agent ID>/intents/<Intent ID>`. * @throws com.google.api.gax.rpc.ApiException if the remote call fails @@ -591,22 +366,10 @@ public final void deleteIntent(String name) { deleteIntent(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Deletes the specified intent. * - *

Sample code: - * - *


-   * try (IntentsClient intentsClient = IntentsClient.create()) {
-   *   IntentName name = IntentName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[INTENT]");
-   *   DeleteIntentRequest request = DeleteIntentRequest.newBuilder()
-   *     .setName(name.toString())
-   *     .build();
-   *   intentsClient.deleteIntent(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 */ @@ -614,23 +377,11 @@ public final void deleteIntent(DeleteIntentRequest request) { deleteIntentCallable().call(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Deletes the specified intent. * *

Sample code: - * - *


-   * try (IntentsClient intentsClient = IntentsClient.create()) {
-   *   IntentName name = IntentName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[INTENT]");
-   *   DeleteIntentRequest request = DeleteIntentRequest.newBuilder()
-   *     .setName(name.toString())
-   *     .build();
-   *   ApiFuture<Void> future = intentsClient.deleteIntentCallable().futureCall(request);
-   *   // Do something
-   *   future.get();
-   * }
-   * 
*/ public final UnaryCallable deleteIntentCallable() { return stub.deleteIntentCallable(); diff --git a/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3/IntentsSettings.java b/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3/IntentsSettings.java index 630b35bc6..48a85742d 100644 --- a/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3/IntentsSettings.java +++ b/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3/IntentsSettings.java @@ -5,7 +5,7 @@ * 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 + * 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, @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.google.cloud.dialogflow.cx.v3; import static com.google.cloud.dialogflow.cx.v3.IntentsClient.ListIntentsPagedResponse; @@ -34,7 +35,7 @@ import java.util.List; import javax.annotation.Generated; -// AUTO-GENERATED DOCUMENTATION AND CLASS +// AUTO-GENERATED DOCUMENTATION AND CLASS. /** * Settings class to configure an instance of {@link IntentsClient}. * @@ -51,22 +52,23 @@ * *

For example, to set the total timeout of getIntent to 30 seconds: * - *

- * 
- * IntentsSettings.Builder intentsSettingsBuilder =
- *     IntentsSettings.newBuilder();
+ * 
{@code
+ * IntentsSettings.Builder intentsSettingsBuilder = IntentsSettings.newBuilder();
  * intentsSettingsBuilder
  *     .getIntentSettings()
  *     .setRetrySettings(
- *         intentsSettingsBuilder.getIntentSettings().getRetrySettings().toBuilder()
+ *         intentsSettingsBuilder
+ *             .getIntentSettings()
+ *             .getRetrySettings()
+ *             .toBuilder()
  *             .setTotalTimeout(Duration.ofSeconds(30))
  *             .build());
  * IntentsSettings intentsSettings = intentsSettingsBuilder.build();
- * 
- * 
+ * }
*/ -@Generated("by gapic-generator") +@Generated("by gapic-generator-java") public class IntentsSettings extends ClientSettings { + /** Returns the object with the settings used for calls to listIntents. */ public PagedCallSettings listIntentsSettings() { @@ -152,18 +154,15 @@ protected IntentsSettings(Builder settingsBuilder) throws IOException { /** Builder for IntentsSettings. */ public static class Builder extends ClientSettings.Builder { + protected Builder() throws IOException { - this((ClientContext) null); + this(((ClientContext) null)); } protected Builder(ClientContext clientContext) { super(IntentsStubSettings.newBuilder(clientContext)); } - private static Builder createDefault() { - return new Builder(IntentsStubSettings.newBuilder()); - } - protected Builder(IntentsSettings settings) { super(settings.getStubSettings().toBuilder()); } @@ -172,11 +171,15 @@ protected Builder(IntentsStubSettings.Builder stubSettings) { super(stubSettings); } + private static Builder createDefault() { + return new Builder(IntentsStubSettings.newBuilder()); + } + public IntentsStubSettings.Builder getStubSettingsBuilder() { return ((IntentsStubSettings.Builder) getStubSettings()); } - // NEXT_MAJOR_VER: remove 'throws Exception' + // NEXT_MAJOR_VER: remove 'throws Exception'. /** * Applies the given settings updater function to all of the unary API methods in this service. * diff --git a/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3/PagesClient.java b/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3/PagesClient.java index 0849d9edf..7be5669f5 100644 --- a/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3/PagesClient.java +++ b/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3/PagesClient.java @@ -5,7 +5,7 @@ * 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 + * 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, @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.google.cloud.dialogflow.cx.v3; import com.google.api.core.ApiFunction; @@ -35,23 +36,14 @@ import java.util.concurrent.TimeUnit; import javax.annotation.Generated; -// AUTO-GENERATED DOCUMENTATION AND SERVICE +// AUTO-GENERATED DOCUMENTATION AND CLASS. /** * Service Description: Service for managing [Pages][google.cloud.dialogflow.cx.v3.Page]. * *

This class provides the ability to make remote calls to the backing service through method * calls that map to API methods. Sample code to get started: * - *

- * 
- * try (PagesClient pagesClient = PagesClient.create()) {
- *   PageName name = PageName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]", "[PAGE]");
- *   Page response = pagesClient.getPage(name);
- * }
- * 
- * 
- * - *

Note: close() needs to be called on the pagesClient object to clean up resources such as + *

Note: close() needs to be called on the PagesClient object to clean up resources such as * threads. In the example above, try-with-resources is used, which automatically calls close(). * *

The surface of this class includes several types of Java methods for each of the API's @@ -79,28 +71,24 @@ * *

To customize credentials: * - *

- * 
+ * 
{@code
  * PagesSettings pagesSettings =
  *     PagesSettings.newBuilder()
  *         .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
  *         .build();
- * PagesClient pagesClient =
- *     PagesClient.create(pagesSettings);
- * 
- * 
+ * PagesClient pagesClient = PagesClient.create(pagesSettings); + * }
* - * To customize the endpoint: + *

To customize the endpoint: * - *

- * 
- * PagesSettings pagesSettings =
- *     PagesSettings.newBuilder().setEndpoint(myEndpoint).build();
- * PagesClient pagesClient =
- *     PagesClient.create(pagesSettings);
- * 
- * 
+ *
{@code
+ * PagesSettings pagesSettings = PagesSettings.newBuilder().setEndpoint(myEndpoint).build();
+ * PagesClient pagesClient = PagesClient.create(pagesSettings);
+ * }
+ * + *

Please refer to the GitHub repository's samples for more quickstart code snippets. */ +@BetaApi @Generated("by gapic-generator") public class PagesClient implements BackgroundResource { private final PagesSettings settings; @@ -121,7 +109,7 @@ public static final PagesClient create(PagesSettings settings) throws IOExceptio /** * Constructs an instance of PagesClient, using the given stub for making calls. This is for - * advanced usage - prefer to use PagesSettings}. + * advanced usage - prefer using create(PagesSettings). */ @BetaApi("A restructuring of stub classes is planned, so this may break in the future") public static final PagesClient create(PagesStub stub) { @@ -152,21 +140,10 @@ public PagesStub getStub() { return stub; } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Returns the list of all pages in the specified flow. * - *

Sample code: - * - *


-   * try (PagesClient pagesClient = PagesClient.create()) {
-   *   FlowName parent = FlowName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]");
-   *   for (Page element : pagesClient.listPages(parent).iterateAll()) {
-   *     // doThingsWith(element);
-   *   }
-   * }
-   * 
- * * @param parent Required. The flow to list all pages for. Format: `projects/<Project * ID>/locations/<Location ID>/agents/<Agent ID>/flows/<Flow ID>`. * @throws com.google.api.gax.rpc.ApiException if the remote call fails @@ -177,21 +154,10 @@ public final ListPagesPagedResponse listPages(FlowName parent) { return listPages(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Returns the list of all pages in the specified flow. * - *

Sample code: - * - *


-   * try (PagesClient pagesClient = PagesClient.create()) {
-   *   FlowName parent = FlowName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]");
-   *   for (Page element : pagesClient.listPages(parent.toString()).iterateAll()) {
-   *     // doThingsWith(element);
-   *   }
-   * }
-   * 
- * * @param parent Required. The flow to list all pages for. Format: `projects/<Project * ID>/locations/<Location ID>/agents/<Agent ID>/flows/<Flow ID>`. * @throws com.google.api.gax.rpc.ApiException if the remote call fails @@ -201,24 +167,10 @@ public final ListPagesPagedResponse listPages(String parent) { return listPages(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Returns the list of all pages in the specified flow. * - *

Sample code: - * - *


-   * try (PagesClient pagesClient = PagesClient.create()) {
-   *   FlowName parent = FlowName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]");
-   *   ListPagesRequest request = ListPagesRequest.newBuilder()
-   *     .setParent(parent.toString())
-   *     .build();
-   *   for (Page element : pagesClient.listPages(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 */ @@ -226,74 +178,30 @@ public final ListPagesPagedResponse listPages(ListPagesRequest request) { return listPagesPagedCallable().call(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Returns the list of all pages in the specified flow. * *

Sample code: - * - *


-   * try (PagesClient pagesClient = PagesClient.create()) {
-   *   FlowName parent = FlowName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]");
-   *   ListPagesRequest request = ListPagesRequest.newBuilder()
-   *     .setParent(parent.toString())
-   *     .build();
-   *   ApiFuture<ListPagesPagedResponse> future = pagesClient.listPagesPagedCallable().futureCall(request);
-   *   // Do something
-   *   for (Page element : future.get().iterateAll()) {
-   *     // doThingsWith(element);
-   *   }
-   * }
-   * 
*/ public final UnaryCallable listPagesPagedCallable() { return stub.listPagesPagedCallable(); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Returns the list of all pages in the specified flow. * *

Sample code: - * - *


-   * try (PagesClient pagesClient = PagesClient.create()) {
-   *   FlowName parent = FlowName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]");
-   *   ListPagesRequest request = ListPagesRequest.newBuilder()
-   *     .setParent(parent.toString())
-   *     .build();
-   *   while (true) {
-   *     ListPagesResponse response = pagesClient.listPagesCallable().call(request);
-   *     for (Page element : response.getPagesList()) {
-   *       // doThingsWith(element);
-   *     }
-   *     String nextPageToken = response.getNextPageToken();
-   *     if (!Strings.isNullOrEmpty(nextPageToken)) {
-   *       request = request.toBuilder().setPageToken(nextPageToken).build();
-   *     } else {
-   *       break;
-   *     }
-   *   }
-   * }
-   * 
*/ public final UnaryCallable listPagesCallable() { return stub.listPagesCallable(); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Retrieves the specified page. * - *

Sample code: - * - *


-   * try (PagesClient pagesClient = PagesClient.create()) {
-   *   PageName name = PageName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]", "[PAGE]");
-   *   Page response = pagesClient.getPage(name);
-   * }
-   * 
- * * @param name Required. The name of the page. Format: `projects/<Project * ID>/locations/<Location ID>/agents/<Agent ID>/flows/<Flow * ID>/pages/<Page ID>`. @@ -305,19 +213,10 @@ public final Page getPage(PageName name) { return getPage(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Retrieves the specified page. * - *

Sample code: - * - *


-   * try (PagesClient pagesClient = PagesClient.create()) {
-   *   PageName name = PageName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]", "[PAGE]");
-   *   Page response = pagesClient.getPage(name.toString());
-   * }
-   * 
- * * @param name Required. The name of the page. Format: `projects/<Project * ID>/locations/<Location ID>/agents/<Agent ID>/flows/<Flow * ID>/pages/<Page ID>`. @@ -328,22 +227,10 @@ public final Page getPage(String name) { return getPage(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Retrieves the specified page. * - *

Sample code: - * - *


-   * try (PagesClient pagesClient = PagesClient.create()) {
-   *   PageName name = PageName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]", "[PAGE]");
-   *   GetPageRequest request = GetPageRequest.newBuilder()
-   *     .setName(name.toString())
-   *     .build();
-   *   Page response = pagesClient.getPage(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 */ @@ -351,42 +238,20 @@ public final Page getPage(GetPageRequest request) { return getPageCallable().call(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Retrieves the specified page. * *

Sample code: - * - *


-   * try (PagesClient pagesClient = PagesClient.create()) {
-   *   PageName name = PageName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]", "[PAGE]");
-   *   GetPageRequest request = GetPageRequest.newBuilder()
-   *     .setName(name.toString())
-   *     .build();
-   *   ApiFuture<Page> future = pagesClient.getPageCallable().futureCall(request);
-   *   // Do something
-   *   Page response = future.get();
-   * }
-   * 
*/ public final UnaryCallable getPageCallable() { return stub.getPageCallable(); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Creates a page in the specified flow. * - *

Sample code: - * - *


-   * try (PagesClient pagesClient = PagesClient.create()) {
-   *   FlowName parent = FlowName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]");
-   *   Page page = Page.newBuilder().build();
-   *   Page response = pagesClient.createPage(parent, page);
-   * }
-   * 
- * * @param parent Required. The flow to create a page for. Format: `projects/<Project * ID>/locations/<Location ID>/agents/<Agent ID>/flows/<Flow ID>`. * @param page Required. The page to create. @@ -401,20 +266,10 @@ public final Page createPage(FlowName parent, Page page) { return createPage(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Creates a page in the specified flow. * - *

Sample code: - * - *


-   * try (PagesClient pagesClient = PagesClient.create()) {
-   *   FlowName parent = FlowName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]");
-   *   Page page = Page.newBuilder().build();
-   *   Page response = pagesClient.createPage(parent.toString(), page);
-   * }
-   * 
- * * @param parent Required. The flow to create a page for. Format: `projects/<Project * ID>/locations/<Location ID>/agents/<Agent ID>/flows/<Flow ID>`. * @param page Required. The page to create. @@ -426,24 +281,10 @@ public final Page createPage(String parent, Page page) { return createPage(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Creates a page in the specified flow. * - *

Sample code: - * - *


-   * try (PagesClient pagesClient = PagesClient.create()) {
-   *   FlowName parent = FlowName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]");
-   *   Page page = Page.newBuilder().build();
-   *   CreatePageRequest request = CreatePageRequest.newBuilder()
-   *     .setParent(parent.toString())
-   *     .setPage(page)
-   *     .build();
-   *   Page response = pagesClient.createPage(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 */ @@ -451,44 +292,20 @@ public final Page createPage(CreatePageRequest request) { return createPageCallable().call(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Creates a page in the specified flow. * *

Sample code: - * - *


-   * try (PagesClient pagesClient = PagesClient.create()) {
-   *   FlowName parent = FlowName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]");
-   *   Page page = Page.newBuilder().build();
-   *   CreatePageRequest request = CreatePageRequest.newBuilder()
-   *     .setParent(parent.toString())
-   *     .setPage(page)
-   *     .build();
-   *   ApiFuture<Page> future = pagesClient.createPageCallable().futureCall(request);
-   *   // Do something
-   *   Page response = future.get();
-   * }
-   * 
*/ public final UnaryCallable createPageCallable() { return stub.createPageCallable(); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Updates the specified page. * - *

Sample code: - * - *


-   * try (PagesClient pagesClient = PagesClient.create()) {
-   *   Page page = Page.newBuilder().build();
-   *   FieldMask updateMask = FieldMask.newBuilder().build();
-   *   Page response = pagesClient.updatePage(page, updateMask);
-   * }
-   * 
- * * @param page Required. The page to update. * @param updateMask The mask to control which fields get updated. If the mask is not present, all * fields will be updated. @@ -500,22 +317,10 @@ public final Page updatePage(Page page, FieldMask updateMask) { return updatePage(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Updates the specified page. * - *

Sample code: - * - *


-   * try (PagesClient pagesClient = PagesClient.create()) {
-   *   Page page = Page.newBuilder().build();
-   *   UpdatePageRequest request = UpdatePageRequest.newBuilder()
-   *     .setPage(page)
-   *     .build();
-   *   Page response = pagesClient.updatePage(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 */ @@ -523,41 +328,20 @@ public final Page updatePage(UpdatePageRequest request) { return updatePageCallable().call(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Updates the specified page. * *

Sample code: - * - *


-   * try (PagesClient pagesClient = PagesClient.create()) {
-   *   Page page = Page.newBuilder().build();
-   *   UpdatePageRequest request = UpdatePageRequest.newBuilder()
-   *     .setPage(page)
-   *     .build();
-   *   ApiFuture<Page> future = pagesClient.updatePageCallable().futureCall(request);
-   *   // Do something
-   *   Page response = future.get();
-   * }
-   * 
*/ public final UnaryCallable updatePageCallable() { return stub.updatePageCallable(); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Deletes the specified page. * - *

Sample code: - * - *


-   * try (PagesClient pagesClient = PagesClient.create()) {
-   *   PageName name = PageName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]", "[PAGE]");
-   *   pagesClient.deletePage(name);
-   * }
-   * 
- * * @param name Required. The name of the page to delete. Format: `projects/<Project * ID>/locations/<Location ID>/agents/<Agent ID>/Flows/<flow * ID>/pages/<Page ID>`. @@ -569,19 +353,10 @@ public final void deletePage(PageName name) { deletePage(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Deletes the specified page. * - *

Sample code: - * - *


-   * try (PagesClient pagesClient = PagesClient.create()) {
-   *   PageName name = PageName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]", "[PAGE]");
-   *   pagesClient.deletePage(name.toString());
-   * }
-   * 
- * * @param name Required. The name of the page to delete. Format: `projects/<Project * ID>/locations/<Location ID>/agents/<Agent ID>/Flows/<flow * ID>/pages/<Page ID>`. @@ -592,22 +367,10 @@ public final void deletePage(String name) { deletePage(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Deletes the specified page. * - *

Sample code: - * - *


-   * try (PagesClient pagesClient = PagesClient.create()) {
-   *   PageName name = PageName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]", "[PAGE]");
-   *   DeletePageRequest request = DeletePageRequest.newBuilder()
-   *     .setName(name.toString())
-   *     .build();
-   *   pagesClient.deletePage(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 */ @@ -615,23 +378,11 @@ public final void deletePage(DeletePageRequest request) { deletePageCallable().call(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Deletes the specified page. * *

Sample code: - * - *


-   * try (PagesClient pagesClient = PagesClient.create()) {
-   *   PageName name = PageName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]", "[PAGE]");
-   *   DeletePageRequest request = DeletePageRequest.newBuilder()
-   *     .setName(name.toString())
-   *     .build();
-   *   ApiFuture<Void> future = pagesClient.deletePageCallable().futureCall(request);
-   *   // Do something
-   *   future.get();
-   * }
-   * 
*/ public final UnaryCallable deletePageCallable() { return stub.deletePageCallable(); diff --git a/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3/PagesSettings.java b/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3/PagesSettings.java index 78a34fb13..077dc1610 100644 --- a/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3/PagesSettings.java +++ b/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3/PagesSettings.java @@ -5,7 +5,7 @@ * 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 + * 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, @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.google.cloud.dialogflow.cx.v3; import static com.google.cloud.dialogflow.cx.v3.PagesClient.ListPagesPagedResponse; @@ -34,7 +35,7 @@ import java.util.List; import javax.annotation.Generated; -// AUTO-GENERATED DOCUMENTATION AND CLASS +// AUTO-GENERATED DOCUMENTATION AND CLASS. /** * Settings class to configure an instance of {@link PagesClient}. * @@ -51,22 +52,23 @@ * *

For example, to set the total timeout of getPage to 30 seconds: * - *

- * 
- * PagesSettings.Builder pagesSettingsBuilder =
- *     PagesSettings.newBuilder();
+ * 
{@code
+ * PagesSettings.Builder pagesSettingsBuilder = PagesSettings.newBuilder();
  * pagesSettingsBuilder
  *     .getPageSettings()
  *     .setRetrySettings(
- *         pagesSettingsBuilder.getPageSettings().getRetrySettings().toBuilder()
+ *         pagesSettingsBuilder
+ *             .getPageSettings()
+ *             .getRetrySettings()
+ *             .toBuilder()
  *             .setTotalTimeout(Duration.ofSeconds(30))
  *             .build());
  * PagesSettings pagesSettings = pagesSettingsBuilder.build();
- * 
- * 
+ * }
*/ -@Generated("by gapic-generator") +@Generated("by gapic-generator-java") public class PagesSettings extends ClientSettings { + /** Returns the object with the settings used for calls to listPages. */ public PagedCallSettings listPagesSettings() { @@ -152,18 +154,15 @@ protected PagesSettings(Builder settingsBuilder) throws IOException { /** Builder for PagesSettings. */ public static class Builder extends ClientSettings.Builder { + protected Builder() throws IOException { - this((ClientContext) null); + this(((ClientContext) null)); } protected Builder(ClientContext clientContext) { super(PagesStubSettings.newBuilder(clientContext)); } - private static Builder createDefault() { - return new Builder(PagesStubSettings.newBuilder()); - } - protected Builder(PagesSettings settings) { super(settings.getStubSettings().toBuilder()); } @@ -172,11 +171,15 @@ protected Builder(PagesStubSettings.Builder stubSettings) { super(stubSettings); } + private static Builder createDefault() { + return new Builder(PagesStubSettings.newBuilder()); + } + public PagesStubSettings.Builder getStubSettingsBuilder() { return ((PagesStubSettings.Builder) getStubSettings()); } - // NEXT_MAJOR_VER: remove 'throws Exception' + // NEXT_MAJOR_VER: remove 'throws Exception'. /** * Applies the given settings updater function to all of the unary API methods in this service. * diff --git a/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3/SecuritySettingsServiceClient.java b/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3/SecuritySettingsServiceClient.java index a45824df0..7b603ce44 100644 --- a/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3/SecuritySettingsServiceClient.java +++ b/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3/SecuritySettingsServiceClient.java @@ -5,7 +5,7 @@ * 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 + * 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, @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.google.cloud.dialogflow.cx.v3; import com.google.api.core.ApiFunction; @@ -35,24 +36,14 @@ import java.util.concurrent.TimeUnit; import javax.annotation.Generated; -// AUTO-GENERATED DOCUMENTATION AND SERVICE +// AUTO-GENERATED DOCUMENTATION AND CLASS. /** * Service Description: Service for managing security settings for Dialogflow. * *

This class provides the ability to make remote calls to the backing service through method * calls that map to API methods. Sample code to get started: * - *

- * 
- * try (SecuritySettingsServiceClient securitySettingsServiceClient = SecuritySettingsServiceClient.create()) {
- *   LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
- *   SecuritySettings securitySettings = SecuritySettings.newBuilder().build();
- *   SecuritySettings response = securitySettingsServiceClient.createSecuritySettings(parent, securitySettings);
- * }
- * 
- * 
- * - *

Note: close() needs to be called on the securitySettingsServiceClient object to clean up + *

Note: close() needs to be called on the SecuritySettingsServiceClient object to clean up * resources such as threads. In the example above, try-with-resources is used, which automatically * calls close(). * @@ -81,28 +72,27 @@ * *

To customize credentials: * - *

- * 
+ * 
{@code
  * SecuritySettingsServiceSettings securitySettingsServiceSettings =
  *     SecuritySettingsServiceSettings.newBuilder()
  *         .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
  *         .build();
  * SecuritySettingsServiceClient securitySettingsServiceClient =
  *     SecuritySettingsServiceClient.create(securitySettingsServiceSettings);
- * 
- * 
+ * }
* - * To customize the endpoint: + *

To customize the endpoint: * - *

- * 
+ * 
{@code
  * SecuritySettingsServiceSettings securitySettingsServiceSettings =
  *     SecuritySettingsServiceSettings.newBuilder().setEndpoint(myEndpoint).build();
  * SecuritySettingsServiceClient securitySettingsServiceClient =
  *     SecuritySettingsServiceClient.create(securitySettingsServiceSettings);
- * 
- * 
+ * }
+ * + *

Please refer to the GitHub repository's samples for more quickstart code snippets. */ +@BetaApi @Generated("by gapic-generator") public class SecuritySettingsServiceClient implements BackgroundResource { private final SecuritySettingsServiceSettings settings; @@ -124,7 +114,7 @@ public static final SecuritySettingsServiceClient create(SecuritySettingsService /** * Constructs an instance of SecuritySettingsServiceClient, using the given stub for making calls. - * This is for advanced usage - prefer to use SecuritySettingsServiceSettings}. + * This is for advanced usage - prefer using create(SecuritySettingsServiceSettings). */ @BetaApi("A restructuring of stub classes is planned, so this may break in the future") public static final SecuritySettingsServiceClient create(SecuritySettingsServiceStub stub) { @@ -157,20 +147,10 @@ public SecuritySettingsServiceStub getStub() { return stub; } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Create security settings in the specified location. * - *

Sample code: - * - *


-   * try (SecuritySettingsServiceClient securitySettingsServiceClient = SecuritySettingsServiceClient.create()) {
-   *   LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
-   *   SecuritySettings securitySettings = SecuritySettings.newBuilder().build();
-   *   SecuritySettings response = securitySettingsServiceClient.createSecuritySettings(parent, securitySettings);
-   * }
-   * 
- * * @param parent Required. The location to create an * [SecuritySettings][google.cloud.dialogflow.cx.v3.SecuritySettings] for. Format: * `projects/<Project ID>/locations/<Location ID>`. @@ -187,20 +167,10 @@ public final SecuritySettings createSecuritySettings( return createSecuritySettings(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Create security settings in the specified location. * - *

Sample code: - * - *


-   * try (SecuritySettingsServiceClient securitySettingsServiceClient = SecuritySettingsServiceClient.create()) {
-   *   LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
-   *   SecuritySettings securitySettings = SecuritySettings.newBuilder().build();
-   *   SecuritySettings response = securitySettingsServiceClient.createSecuritySettings(parent.toString(), securitySettings);
-   * }
-   * 
- * * @param parent Required. The location to create an * [SecuritySettings][google.cloud.dialogflow.cx.v3.SecuritySettings] for. Format: * `projects/<Project ID>/locations/<Location ID>`. @@ -217,24 +187,10 @@ public final SecuritySettings createSecuritySettings( return createSecuritySettings(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Create security settings in the specified location. * - *

Sample code: - * - *


-   * try (SecuritySettingsServiceClient securitySettingsServiceClient = SecuritySettingsServiceClient.create()) {
-   *   LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
-   *   SecuritySettings securitySettings = SecuritySettings.newBuilder().build();
-   *   CreateSecuritySettingsRequest request = CreateSecuritySettingsRequest.newBuilder()
-   *     .setParent(parent.toString())
-   *     .setSecuritySettings(securitySettings)
-   *     .build();
-   *   SecuritySettings response = securitySettingsServiceClient.createSecuritySettings(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 */ @@ -242,45 +198,22 @@ public final SecuritySettings createSecuritySettings(CreateSecuritySettingsReque return createSecuritySettingsCallable().call(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Create security settings in the specified location. * *

Sample code: - * - *


-   * try (SecuritySettingsServiceClient securitySettingsServiceClient = SecuritySettingsServiceClient.create()) {
-   *   LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
-   *   SecuritySettings securitySettings = SecuritySettings.newBuilder().build();
-   *   CreateSecuritySettingsRequest request = CreateSecuritySettingsRequest.newBuilder()
-   *     .setParent(parent.toString())
-   *     .setSecuritySettings(securitySettings)
-   *     .build();
-   *   ApiFuture<SecuritySettings> future = securitySettingsServiceClient.createSecuritySettingsCallable().futureCall(request);
-   *   // Do something
-   *   SecuritySettings response = future.get();
-   * }
-   * 
*/ public final UnaryCallable createSecuritySettingsCallable() { return stub.createSecuritySettingsCallable(); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Retrieves the specified [SecuritySettings][google.cloud.dialogflow.cx.v3.SecuritySettings]. The * returned settings may be stale by up to 1 minute. * - *

Sample code: - * - *


-   * try (SecuritySettingsServiceClient securitySettingsServiceClient = SecuritySettingsServiceClient.create()) {
-   *   SecuritySettingsName name = SecuritySettingsName.of("[PROJECT]", "[LOCATION]", "[SECURITY_SETTINGS]");
-   *   SecuritySettings response = securitySettingsServiceClient.getSecuritySettings(name);
-   * }
-   * 
- * * @param name Required. Resource name of the settings. Format: `projects/<Project * ID>/locations/<Location ID>/securitySettings/<security settings ID>`. * @throws com.google.api.gax.rpc.ApiException if the remote call fails @@ -293,20 +226,11 @@ public final SecuritySettings getSecuritySettings(SecuritySettingsName name) { return getSecuritySettings(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Retrieves the specified [SecuritySettings][google.cloud.dialogflow.cx.v3.SecuritySettings]. The * returned settings may be stale by up to 1 minute. * - *

Sample code: - * - *


-   * try (SecuritySettingsServiceClient securitySettingsServiceClient = SecuritySettingsServiceClient.create()) {
-   *   SecuritySettingsName name = SecuritySettingsName.of("[PROJECT]", "[LOCATION]", "[SECURITY_SETTINGS]");
-   *   SecuritySettings response = securitySettingsServiceClient.getSecuritySettings(name.toString());
-   * }
-   * 
- * * @param name Required. Resource name of the settings. Format: `projects/<Project * ID>/locations/<Location ID>/securitySettings/<security settings ID>`. * @throws com.google.api.gax.rpc.ApiException if the remote call fails @@ -317,23 +241,11 @@ public final SecuritySettings getSecuritySettings(String name) { return getSecuritySettings(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Retrieves the specified [SecuritySettings][google.cloud.dialogflow.cx.v3.SecuritySettings]. The * returned settings may be stale by up to 1 minute. * - *

Sample code: - * - *


-   * try (SecuritySettingsServiceClient securitySettingsServiceClient = SecuritySettingsServiceClient.create()) {
-   *   SecuritySettingsName name = SecuritySettingsName.of("[PROJECT]", "[LOCATION]", "[SECURITY_SETTINGS]");
-   *   GetSecuritySettingsRequest request = GetSecuritySettingsRequest.newBuilder()
-   *     .setName(name.toString())
-   *     .build();
-   *   SecuritySettings response = securitySettingsServiceClient.getSecuritySettings(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 */ @@ -341,44 +253,22 @@ public final SecuritySettings getSecuritySettings(GetSecuritySettingsRequest req return getSecuritySettingsCallable().call(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Retrieves the specified [SecuritySettings][google.cloud.dialogflow.cx.v3.SecuritySettings]. The * returned settings may be stale by up to 1 minute. * *

Sample code: - * - *


-   * try (SecuritySettingsServiceClient securitySettingsServiceClient = SecuritySettingsServiceClient.create()) {
-   *   SecuritySettingsName name = SecuritySettingsName.of("[PROJECT]", "[LOCATION]", "[SECURITY_SETTINGS]");
-   *   GetSecuritySettingsRequest request = GetSecuritySettingsRequest.newBuilder()
-   *     .setName(name.toString())
-   *     .build();
-   *   ApiFuture<SecuritySettings> future = securitySettingsServiceClient.getSecuritySettingsCallable().futureCall(request);
-   *   // Do something
-   *   SecuritySettings response = future.get();
-   * }
-   * 
*/ public final UnaryCallable getSecuritySettingsCallable() { return stub.getSecuritySettingsCallable(); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Updates the specified [SecuritySettings][google.cloud.dialogflow.cx.v3.SecuritySettings]. * - *

Sample code: - * - *


-   * try (SecuritySettingsServiceClient securitySettingsServiceClient = SecuritySettingsServiceClient.create()) {
-   *   SecuritySettings securitySettings = SecuritySettings.newBuilder().build();
-   *   FieldMask updateMask = FieldMask.newBuilder().build();
-   *   SecuritySettings response = securitySettingsServiceClient.updateSecuritySettings(securitySettings, updateMask);
-   * }
-   * 
- * * @param securitySettings Required. [SecuritySettings] object that contains values for each of * the fields to update. * @param updateMask Required. The mask to control which fields get updated. If the mask is not @@ -395,24 +285,10 @@ public final SecuritySettings updateSecuritySettings( return updateSecuritySettings(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Updates the specified [SecuritySettings][google.cloud.dialogflow.cx.v3.SecuritySettings]. * - *

Sample code: - * - *


-   * try (SecuritySettingsServiceClient securitySettingsServiceClient = SecuritySettingsServiceClient.create()) {
-   *   SecuritySettings securitySettings = SecuritySettings.newBuilder().build();
-   *   FieldMask updateMask = FieldMask.newBuilder().build();
-   *   UpdateSecuritySettingsRequest request = UpdateSecuritySettingsRequest.newBuilder()
-   *     .setSecuritySettings(securitySettings)
-   *     .setUpdateMask(updateMask)
-   *     .build();
-   *   SecuritySettings response = securitySettingsServiceClient.updateSecuritySettings(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 */ @@ -420,46 +296,21 @@ public final SecuritySettings updateSecuritySettings(UpdateSecuritySettingsReque return updateSecuritySettingsCallable().call(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Updates the specified [SecuritySettings][google.cloud.dialogflow.cx.v3.SecuritySettings]. * *

Sample code: - * - *


-   * try (SecuritySettingsServiceClient securitySettingsServiceClient = SecuritySettingsServiceClient.create()) {
-   *   SecuritySettings securitySettings = SecuritySettings.newBuilder().build();
-   *   FieldMask updateMask = FieldMask.newBuilder().build();
-   *   UpdateSecuritySettingsRequest request = UpdateSecuritySettingsRequest.newBuilder()
-   *     .setSecuritySettings(securitySettings)
-   *     .setUpdateMask(updateMask)
-   *     .build();
-   *   ApiFuture<SecuritySettings> future = securitySettingsServiceClient.updateSecuritySettingsCallable().futureCall(request);
-   *   // Do something
-   *   SecuritySettings response = future.get();
-   * }
-   * 
*/ public final UnaryCallable updateSecuritySettingsCallable() { return stub.updateSecuritySettingsCallable(); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Returns the list of all security settings in the specified location. * - *

Sample code: - * - *


-   * try (SecuritySettingsServiceClient securitySettingsServiceClient = SecuritySettingsServiceClient.create()) {
-   *   LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
-   *   for (SecuritySettings element : securitySettingsServiceClient.listSecuritySettings(parent).iterateAll()) {
-   *     // doThingsWith(element);
-   *   }
-   * }
-   * 
- * * @param parent Required. The location to list all security settings for. Format: * `projects/<Project ID>/locations/<Location ID>`. * @throws com.google.api.gax.rpc.ApiException if the remote call fails @@ -472,21 +323,10 @@ public final ListSecuritySettingsPagedResponse listSecuritySettings(LocationName return listSecuritySettings(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Returns the list of all security settings in the specified location. * - *

Sample code: - * - *


-   * try (SecuritySettingsServiceClient securitySettingsServiceClient = SecuritySettingsServiceClient.create()) {
-   *   LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
-   *   for (SecuritySettings element : securitySettingsServiceClient.listSecuritySettings(parent.toString()).iterateAll()) {
-   *     // doThingsWith(element);
-   *   }
-   * }
-   * 
- * * @param parent Required. The location to list all security settings for. Format: * `projects/<Project ID>/locations/<Location ID>`. * @throws com.google.api.gax.rpc.ApiException if the remote call fails @@ -497,24 +337,10 @@ public final ListSecuritySettingsPagedResponse listSecuritySettings(String paren return listSecuritySettings(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Returns the list of all security settings in the specified location. * - *

Sample code: - * - *


-   * try (SecuritySettingsServiceClient securitySettingsServiceClient = SecuritySettingsServiceClient.create()) {
-   *   LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
-   *   ListSecuritySettingsRequest request = ListSecuritySettingsRequest.newBuilder()
-   *     .setParent(parent.toString())
-   *     .build();
-   *   for (SecuritySettings element : securitySettingsServiceClient.listSecuritySettings(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 */ @@ -523,76 +349,32 @@ public final ListSecuritySettingsPagedResponse listSecuritySettings( return listSecuritySettingsPagedCallable().call(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Returns the list of all security settings in the specified location. * *

Sample code: - * - *


-   * try (SecuritySettingsServiceClient securitySettingsServiceClient = SecuritySettingsServiceClient.create()) {
-   *   LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
-   *   ListSecuritySettingsRequest request = ListSecuritySettingsRequest.newBuilder()
-   *     .setParent(parent.toString())
-   *     .build();
-   *   ApiFuture<ListSecuritySettingsPagedResponse> future = securitySettingsServiceClient.listSecuritySettingsPagedCallable().futureCall(request);
-   *   // Do something
-   *   for (SecuritySettings element : future.get().iterateAll()) {
-   *     // doThingsWith(element);
-   *   }
-   * }
-   * 
*/ public final UnaryCallable listSecuritySettingsPagedCallable() { return stub.listSecuritySettingsPagedCallable(); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Returns the list of all security settings in the specified location. * *

Sample code: - * - *


-   * try (SecuritySettingsServiceClient securitySettingsServiceClient = SecuritySettingsServiceClient.create()) {
-   *   LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
-   *   ListSecuritySettingsRequest request = ListSecuritySettingsRequest.newBuilder()
-   *     .setParent(parent.toString())
-   *     .build();
-   *   while (true) {
-   *     ListSecuritySettingsResponse response = securitySettingsServiceClient.listSecuritySettingsCallable().call(request);
-   *     for (SecuritySettings element : response.getSecuritySettingsList()) {
-   *       // doThingsWith(element);
-   *     }
-   *     String nextPageToken = response.getNextPageToken();
-   *     if (!Strings.isNullOrEmpty(nextPageToken)) {
-   *       request = request.toBuilder().setPageToken(nextPageToken).build();
-   *     } else {
-   *       break;
-   *     }
-   *   }
-   * }
-   * 
*/ public final UnaryCallable listSecuritySettingsCallable() { return stub.listSecuritySettingsCallable(); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Deletes the specified [SecuritySettings][google.cloud.dialogflow.cx.v3.SecuritySettings]. * - *

Sample code: - * - *


-   * try (SecuritySettingsServiceClient securitySettingsServiceClient = SecuritySettingsServiceClient.create()) {
-   *   SecuritySettingsName name = SecuritySettingsName.of("[PROJECT]", "[LOCATION]", "[SECURITY_SETTINGS]");
-   *   securitySettingsServiceClient.deleteSecuritySettings(name);
-   * }
-   * 
- * * @param name Required. The name of the * [SecuritySettings][google.cloud.dialogflow.cx.v3.SecuritySettings] to delete. Format: * `projects/<Project ID>/locations/<Location ID>/securitySettings/<Security @@ -607,19 +389,10 @@ public final void deleteSecuritySettings(SecuritySettingsName name) { deleteSecuritySettings(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Deletes the specified [SecuritySettings][google.cloud.dialogflow.cx.v3.SecuritySettings]. * - *

Sample code: - * - *


-   * try (SecuritySettingsServiceClient securitySettingsServiceClient = SecuritySettingsServiceClient.create()) {
-   *   SecuritySettingsName name = SecuritySettingsName.of("[PROJECT]", "[LOCATION]", "[SECURITY_SETTINGS]");
-   *   securitySettingsServiceClient.deleteSecuritySettings(name.toString());
-   * }
-   * 
- * * @param name Required. The name of the * [SecuritySettings][google.cloud.dialogflow.cx.v3.SecuritySettings] to delete. Format: * `projects/<Project ID>/locations/<Location ID>/securitySettings/<Security @@ -632,22 +405,10 @@ public final void deleteSecuritySettings(String name) { deleteSecuritySettings(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Deletes the specified [SecuritySettings][google.cloud.dialogflow.cx.v3.SecuritySettings]. * - *

Sample code: - * - *


-   * try (SecuritySettingsServiceClient securitySettingsServiceClient = SecuritySettingsServiceClient.create()) {
-   *   SecuritySettingsName name = SecuritySettingsName.of("[PROJECT]", "[LOCATION]", "[SECURITY_SETTINGS]");
-   *   DeleteSecuritySettingsRequest request = DeleteSecuritySettingsRequest.newBuilder()
-   *     .setName(name.toString())
-   *     .build();
-   *   securitySettingsServiceClient.deleteSecuritySettings(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 */ @@ -655,23 +416,11 @@ public final void deleteSecuritySettings(DeleteSecuritySettingsRequest request) deleteSecuritySettingsCallable().call(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Deletes the specified [SecuritySettings][google.cloud.dialogflow.cx.v3.SecuritySettings]. * *

Sample code: - * - *


-   * try (SecuritySettingsServiceClient securitySettingsServiceClient = SecuritySettingsServiceClient.create()) {
-   *   SecuritySettingsName name = SecuritySettingsName.of("[PROJECT]", "[LOCATION]", "[SECURITY_SETTINGS]");
-   *   DeleteSecuritySettingsRequest request = DeleteSecuritySettingsRequest.newBuilder()
-   *     .setName(name.toString())
-   *     .build();
-   *   ApiFuture<Void> future = securitySettingsServiceClient.deleteSecuritySettingsCallable().futureCall(request);
-   *   // Do something
-   *   future.get();
-   * }
-   * 
*/ public final UnaryCallable deleteSecuritySettingsCallable() { diff --git a/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3/SecuritySettingsServiceSettings.java b/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3/SecuritySettingsServiceSettings.java index 5750825f8..41140c007 100644 --- a/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3/SecuritySettingsServiceSettings.java +++ b/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3/SecuritySettingsServiceSettings.java @@ -5,7 +5,7 @@ * 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 + * 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, @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.google.cloud.dialogflow.cx.v3; import static com.google.cloud.dialogflow.cx.v3.SecuritySettingsServiceClient.ListSecuritySettingsPagedResponse; @@ -34,7 +35,7 @@ import java.util.List; import javax.annotation.Generated; -// AUTO-GENERATED DOCUMENTATION AND CLASS +// AUTO-GENERATED DOCUMENTATION AND CLASS. /** * Settings class to configure an instance of {@link SecuritySettingsServiceClient}. * @@ -51,23 +52,26 @@ * *

For example, to set the total timeout of createSecuritySettings to 30 seconds: * - *

- * 
+ * 
{@code
  * SecuritySettingsServiceSettings.Builder securitySettingsServiceSettingsBuilder =
  *     SecuritySettingsServiceSettings.newBuilder();
  * securitySettingsServiceSettingsBuilder
  *     .createSecuritySettingsSettings()
  *     .setRetrySettings(
- *         securitySettingsServiceSettingsBuilder.createSecuritySettingsSettings().getRetrySettings().toBuilder()
+ *         securitySettingsServiceSettingsBuilder
+ *             .createSecuritySettingsSettings()
+ *             .getRetrySettings()
+ *             .toBuilder()
  *             .setTotalTimeout(Duration.ofSeconds(30))
  *             .build());
- * SecuritySettingsServiceSettings securitySettingsServiceSettings = securitySettingsServiceSettingsBuilder.build();
- * 
- * 
+ * SecuritySettingsServiceSettings securitySettingsServiceSettings = + * securitySettingsServiceSettingsBuilder.build(); + * }
*/ -@Generated("by gapic-generator") +@Generated("by gapic-generator-java") public class SecuritySettingsServiceSettings extends ClientSettings { + /** Returns the object with the settings used for calls to createSecuritySettings. */ public UnaryCallSettings createSecuritySettingsSettings() { @@ -164,18 +168,15 @@ protected SecuritySettingsServiceSettings(Builder settingsBuilder) throws IOExce /** Builder for SecuritySettingsServiceSettings. */ public static class Builder extends ClientSettings.Builder { + protected Builder() throws IOException { - this((ClientContext) null); + this(((ClientContext) null)); } protected Builder(ClientContext clientContext) { super(SecuritySettingsServiceStubSettings.newBuilder(clientContext)); } - private static Builder createDefault() { - return new Builder(SecuritySettingsServiceStubSettings.newBuilder()); - } - protected Builder(SecuritySettingsServiceSettings settings) { super(settings.getStubSettings().toBuilder()); } @@ -184,11 +185,15 @@ protected Builder(SecuritySettingsServiceStubSettings.Builder stubSettings) { super(stubSettings); } + private static Builder createDefault() { + return new Builder(SecuritySettingsServiceStubSettings.newBuilder()); + } + public SecuritySettingsServiceStubSettings.Builder getStubSettingsBuilder() { return ((SecuritySettingsServiceStubSettings.Builder) getStubSettings()); } - // NEXT_MAJOR_VER: remove 'throws Exception' + // NEXT_MAJOR_VER: remove 'throws Exception'. /** * Applies the given settings updater function to all of the unary API methods in this service. * diff --git a/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3/SessionEntityTypesClient.java b/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3/SessionEntityTypesClient.java index a3a362ef4..a692241b5 100644 --- a/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3/SessionEntityTypesClient.java +++ b/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3/SessionEntityTypesClient.java @@ -5,7 +5,7 @@ * 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 + * 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, @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.google.cloud.dialogflow.cx.v3; import com.google.api.core.ApiFunction; @@ -35,7 +36,7 @@ import java.util.concurrent.TimeUnit; import javax.annotation.Generated; -// AUTO-GENERATED DOCUMENTATION AND SERVICE +// AUTO-GENERATED DOCUMENTATION AND CLASS. /** * Service Description: Service for managing * [SessionEntityTypes][google.cloud.dialogflow.cx.v3.SessionEntityType]. @@ -43,16 +44,7 @@ *

This class provides the ability to make remote calls to the backing service through method * calls that map to API methods. Sample code to get started: * - *

- * 
- * try (SessionEntityTypesClient sessionEntityTypesClient = SessionEntityTypesClient.create()) {
- *   SessionEntityTypeName name = SessionEntityTypeName.ofProjectLocationAgentSessionEntityTypeName("[PROJECT]", "[LOCATION]", "[AGENT]", "[SESSION]", "[ENTITY_TYPE]");
- *   SessionEntityType response = sessionEntityTypesClient.getSessionEntityType(name);
- * }
- * 
- * 
- * - *

Note: close() needs to be called on the sessionEntityTypesClient object to clean up resources + *

Note: close() needs to be called on the SessionEntityTypesClient object to clean up resources * such as threads. In the example above, try-with-resources is used, which automatically calls * close(). * @@ -81,28 +73,27 @@ * *

To customize credentials: * - *

- * 
+ * 
{@code
  * SessionEntityTypesSettings sessionEntityTypesSettings =
  *     SessionEntityTypesSettings.newBuilder()
  *         .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
  *         .build();
  * SessionEntityTypesClient sessionEntityTypesClient =
  *     SessionEntityTypesClient.create(sessionEntityTypesSettings);
- * 
- * 
+ * }
* - * To customize the endpoint: + *

To customize the endpoint: * - *

- * 
+ * 
{@code
  * SessionEntityTypesSettings sessionEntityTypesSettings =
  *     SessionEntityTypesSettings.newBuilder().setEndpoint(myEndpoint).build();
  * SessionEntityTypesClient sessionEntityTypesClient =
  *     SessionEntityTypesClient.create(sessionEntityTypesSettings);
- * 
- * 
+ * }
+ * + *

Please refer to the GitHub repository's samples for more quickstart code snippets. */ +@BetaApi @Generated("by gapic-generator") public class SessionEntityTypesClient implements BackgroundResource { private final SessionEntityTypesSettings settings; @@ -124,7 +115,7 @@ public static final SessionEntityTypesClient create(SessionEntityTypesSettings s /** * Constructs an instance of SessionEntityTypesClient, using the given stub for making calls. This - * is for advanced usage - prefer to use SessionEntityTypesSettings}. + * is for advanced usage - prefer using create(SessionEntityTypesSettings). */ @BetaApi("A restructuring of stub classes is planned, so this may break in the future") public static final SessionEntityTypesClient create(SessionEntityTypesStub stub) { @@ -156,21 +147,10 @@ public SessionEntityTypesStub getStub() { return stub; } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Returns the list of all session entity types in the specified session. * - *

Sample code: - * - *


-   * try (SessionEntityTypesClient sessionEntityTypesClient = SessionEntityTypesClient.create()) {
-   *   SessionName parent = SessionName.ofProjectLocationAgentSessionName("[PROJECT]", "[LOCATION]", "[AGENT]", "[SESSION]");
-   *   for (SessionEntityType element : sessionEntityTypesClient.listSessionEntityTypes(parent).iterateAll()) {
-   *     // doThingsWith(element);
-   *   }
-   * }
-   * 
- * * @param parent Required. The session to list all session entity types from. Format: * `projects/<Project ID>/locations/<Location ID>/agents/<Agent * ID>/sessions/<Session ID>` or `projects/<Project ID>/locations/<Location @@ -186,21 +166,10 @@ public final ListSessionEntityTypesPagedResponse listSessionEntityTypes(SessionN return listSessionEntityTypes(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Returns the list of all session entity types in the specified session. * - *

Sample code: - * - *


-   * try (SessionEntityTypesClient sessionEntityTypesClient = SessionEntityTypesClient.create()) {
-   *   SessionName parent = SessionName.ofProjectLocationAgentSessionName("[PROJECT]", "[LOCATION]", "[AGENT]", "[SESSION]");
-   *   for (SessionEntityType element : sessionEntityTypesClient.listSessionEntityTypes(parent.toString()).iterateAll()) {
-   *     // doThingsWith(element);
-   *   }
-   * }
-   * 
- * * @param parent Required. The session to list all session entity types from. Format: * `projects/<Project ID>/locations/<Location ID>/agents/<Agent * ID>/sessions/<Session ID>` or `projects/<Project ID>/locations/<Location @@ -214,24 +183,10 @@ public final ListSessionEntityTypesPagedResponse listSessionEntityTypes(String p return listSessionEntityTypes(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Returns the list of all session entity types in the specified session. * - *

Sample code: - * - *


-   * try (SessionEntityTypesClient sessionEntityTypesClient = SessionEntityTypesClient.create()) {
-   *   SessionName parent = SessionName.ofProjectLocationAgentSessionName("[PROJECT]", "[LOCATION]", "[AGENT]", "[SESSION]");
-   *   ListSessionEntityTypesRequest request = ListSessionEntityTypesRequest.newBuilder()
-   *     .setParent(parent.toString())
-   *     .build();
-   *   for (SessionEntityType element : sessionEntityTypesClient.listSessionEntityTypes(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 */ @@ -240,76 +195,32 @@ public final ListSessionEntityTypesPagedResponse listSessionEntityTypes( return listSessionEntityTypesPagedCallable().call(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Returns the list of all session entity types in the specified session. * *

Sample code: - * - *


-   * try (SessionEntityTypesClient sessionEntityTypesClient = SessionEntityTypesClient.create()) {
-   *   SessionName parent = SessionName.ofProjectLocationAgentSessionName("[PROJECT]", "[LOCATION]", "[AGENT]", "[SESSION]");
-   *   ListSessionEntityTypesRequest request = ListSessionEntityTypesRequest.newBuilder()
-   *     .setParent(parent.toString())
-   *     .build();
-   *   ApiFuture<ListSessionEntityTypesPagedResponse> future = sessionEntityTypesClient.listSessionEntityTypesPagedCallable().futureCall(request);
-   *   // Do something
-   *   for (SessionEntityType element : future.get().iterateAll()) {
-   *     // doThingsWith(element);
-   *   }
-   * }
-   * 
*/ public final UnaryCallable listSessionEntityTypesPagedCallable() { return stub.listSessionEntityTypesPagedCallable(); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Returns the list of all session entity types in the specified session. * *

Sample code: - * - *


-   * try (SessionEntityTypesClient sessionEntityTypesClient = SessionEntityTypesClient.create()) {
-   *   SessionName parent = SessionName.ofProjectLocationAgentSessionName("[PROJECT]", "[LOCATION]", "[AGENT]", "[SESSION]");
-   *   ListSessionEntityTypesRequest request = ListSessionEntityTypesRequest.newBuilder()
-   *     .setParent(parent.toString())
-   *     .build();
-   *   while (true) {
-   *     ListSessionEntityTypesResponse response = sessionEntityTypesClient.listSessionEntityTypesCallable().call(request);
-   *     for (SessionEntityType element : response.getSessionEntityTypesList()) {
-   *       // doThingsWith(element);
-   *     }
-   *     String nextPageToken = response.getNextPageToken();
-   *     if (!Strings.isNullOrEmpty(nextPageToken)) {
-   *       request = request.toBuilder().setPageToken(nextPageToken).build();
-   *     } else {
-   *       break;
-   *     }
-   *   }
-   * }
-   * 
*/ public final UnaryCallable listSessionEntityTypesCallable() { return stub.listSessionEntityTypesCallable(); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Retrieves the specified session entity type. * - *

Sample code: - * - *


-   * try (SessionEntityTypesClient sessionEntityTypesClient = SessionEntityTypesClient.create()) {
-   *   SessionEntityTypeName name = SessionEntityTypeName.ofProjectLocationAgentSessionEntityTypeName("[PROJECT]", "[LOCATION]", "[AGENT]", "[SESSION]", "[ENTITY_TYPE]");
-   *   SessionEntityType response = sessionEntityTypesClient.getSessionEntityType(name);
-   * }
-   * 
- * * @param name Required. The name of the session entity type. Format: `projects/<Project * ID>/locations/<Location ID>/agents/<Agent ID>/sessions/<Session * ID>/entityTypes/<Entity Type ID>` or `projects/<Project @@ -326,19 +237,10 @@ public final SessionEntityType getSessionEntityType(SessionEntityTypeName name) return getSessionEntityType(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Retrieves the specified session entity type. * - *

Sample code: - * - *


-   * try (SessionEntityTypesClient sessionEntityTypesClient = SessionEntityTypesClient.create()) {
-   *   SessionEntityTypeName name = SessionEntityTypeName.ofProjectLocationAgentSessionEntityTypeName("[PROJECT]", "[LOCATION]", "[AGENT]", "[SESSION]", "[ENTITY_TYPE]");
-   *   SessionEntityType response = sessionEntityTypesClient.getSessionEntityType(name.toString());
-   * }
-   * 
- * * @param name Required. The name of the session entity type. Format: `projects/<Project * ID>/locations/<Location ID>/agents/<Agent ID>/sessions/<Session * ID>/entityTypes/<Entity Type ID>` or `projects/<Project @@ -353,22 +255,10 @@ public final SessionEntityType getSessionEntityType(String name) { return getSessionEntityType(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Retrieves the specified session entity type. * - *

Sample code: - * - *


-   * try (SessionEntityTypesClient sessionEntityTypesClient = SessionEntityTypesClient.create()) {
-   *   SessionEntityTypeName name = SessionEntityTypeName.ofProjectLocationAgentSessionEntityTypeName("[PROJECT]", "[LOCATION]", "[AGENT]", "[SESSION]", "[ENTITY_TYPE]");
-   *   GetSessionEntityTypeRequest request = GetSessionEntityTypeRequest.newBuilder()
-   *     .setName(name.toString())
-   *     .build();
-   *   SessionEntityType response = sessionEntityTypesClient.getSessionEntityType(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 */ @@ -376,45 +266,23 @@ public final SessionEntityType getSessionEntityType(GetSessionEntityTypeRequest return getSessionEntityTypeCallable().call(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Retrieves the specified session entity type. * *

Sample code: - * - *


-   * try (SessionEntityTypesClient sessionEntityTypesClient = SessionEntityTypesClient.create()) {
-   *   SessionEntityTypeName name = SessionEntityTypeName.ofProjectLocationAgentSessionEntityTypeName("[PROJECT]", "[LOCATION]", "[AGENT]", "[SESSION]", "[ENTITY_TYPE]");
-   *   GetSessionEntityTypeRequest request = GetSessionEntityTypeRequest.newBuilder()
-   *     .setName(name.toString())
-   *     .build();
-   *   ApiFuture<SessionEntityType> future = sessionEntityTypesClient.getSessionEntityTypeCallable().futureCall(request);
-   *   // Do something
-   *   SessionEntityType response = future.get();
-   * }
-   * 
*/ public final UnaryCallable getSessionEntityTypeCallable() { return stub.getSessionEntityTypeCallable(); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Creates a session entity type. * *

If the specified session entity type already exists, overrides the session entity type. * - *

Sample code: - * - *


-   * try (SessionEntityTypesClient sessionEntityTypesClient = SessionEntityTypesClient.create()) {
-   *   SessionName parent = SessionName.ofProjectLocationAgentSessionName("[PROJECT]", "[LOCATION]", "[AGENT]", "[SESSION]");
-   *   SessionEntityType sessionEntityType = SessionEntityType.newBuilder().build();
-   *   SessionEntityType response = sessionEntityTypesClient.createSessionEntityType(parent, sessionEntityType);
-   * }
-   * 
- * * @param parent Required. The session to create a session entity type for. Format: * `projects/<Project ID>/locations/<Location ID>/agents/<Agent * ID>/sessions/<Session ID>` or `projects/<Project ID>/locations/<Location @@ -433,22 +301,12 @@ public final SessionEntityType createSessionEntityType( return createSessionEntityType(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Creates a session entity type. * *

If the specified session entity type already exists, overrides the session entity type. * - *

Sample code: - * - *


-   * try (SessionEntityTypesClient sessionEntityTypesClient = SessionEntityTypesClient.create()) {
-   *   SessionName parent = SessionName.ofProjectLocationAgentSessionName("[PROJECT]", "[LOCATION]", "[AGENT]", "[SESSION]");
-   *   SessionEntityType sessionEntityType = SessionEntityType.newBuilder().build();
-   *   SessionEntityType response = sessionEntityTypesClient.createSessionEntityType(parent.toString(), sessionEntityType);
-   * }
-   * 
- * * @param parent Required. The session to create a session entity type for. Format: * `projects/<Project ID>/locations/<Location ID>/agents/<Agent * ID>/sessions/<Session ID>` or `projects/<Project ID>/locations/<Location @@ -467,26 +325,12 @@ public final SessionEntityType createSessionEntityType( return createSessionEntityType(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Creates a session entity type. * *

If the specified session entity type already exists, overrides the session entity type. * - *

Sample code: - * - *


-   * try (SessionEntityTypesClient sessionEntityTypesClient = SessionEntityTypesClient.create()) {
-   *   SessionName parent = SessionName.ofProjectLocationAgentSessionName("[PROJECT]", "[LOCATION]", "[AGENT]", "[SESSION]");
-   *   SessionEntityType sessionEntityType = SessionEntityType.newBuilder().build();
-   *   CreateSessionEntityTypeRequest request = CreateSessionEntityTypeRequest.newBuilder()
-   *     .setParent(parent.toString())
-   *     .setSessionEntityType(sessionEntityType)
-   *     .build();
-   *   SessionEntityType response = sessionEntityTypesClient.createSessionEntityType(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 */ @@ -494,47 +338,23 @@ public final SessionEntityType createSessionEntityType(CreateSessionEntityTypeRe return createSessionEntityTypeCallable().call(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Creates a session entity type. * *

If the specified session entity type already exists, overrides the session entity type. * *

Sample code: - * - *


-   * try (SessionEntityTypesClient sessionEntityTypesClient = SessionEntityTypesClient.create()) {
-   *   SessionName parent = SessionName.ofProjectLocationAgentSessionName("[PROJECT]", "[LOCATION]", "[AGENT]", "[SESSION]");
-   *   SessionEntityType sessionEntityType = SessionEntityType.newBuilder().build();
-   *   CreateSessionEntityTypeRequest request = CreateSessionEntityTypeRequest.newBuilder()
-   *     .setParent(parent.toString())
-   *     .setSessionEntityType(sessionEntityType)
-   *     .build();
-   *   ApiFuture<SessionEntityType> future = sessionEntityTypesClient.createSessionEntityTypeCallable().futureCall(request);
-   *   // Do something
-   *   SessionEntityType response = future.get();
-   * }
-   * 
*/ public final UnaryCallable createSessionEntityTypeCallable() { return stub.createSessionEntityTypeCallable(); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Updates the specified session entity type. * - *

Sample code: - * - *


-   * try (SessionEntityTypesClient sessionEntityTypesClient = SessionEntityTypesClient.create()) {
-   *   SessionEntityType sessionEntityType = SessionEntityType.newBuilder().build();
-   *   FieldMask updateMask = FieldMask.newBuilder().build();
-   *   SessionEntityType response = sessionEntityTypesClient.updateSessionEntityType(sessionEntityType, updateMask);
-   * }
-   * 
- * * @param sessionEntityType Required. The session entity type to update. Format: * `projects/<Project ID>/locations/<Location ID>/agents/<Agent * ID>/sessions/<Session ID>/entityTypes/<Entity Type ID>` or @@ -555,22 +375,10 @@ public final SessionEntityType updateSessionEntityType( return updateSessionEntityType(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Updates the specified session entity type. * - *

Sample code: - * - *


-   * try (SessionEntityTypesClient sessionEntityTypesClient = SessionEntityTypesClient.create()) {
-   *   SessionEntityType sessionEntityType = SessionEntityType.newBuilder().build();
-   *   UpdateSessionEntityTypeRequest request = UpdateSessionEntityTypeRequest.newBuilder()
-   *     .setSessionEntityType(sessionEntityType)
-   *     .build();
-   *   SessionEntityType response = sessionEntityTypesClient.updateSessionEntityType(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 */ @@ -578,42 +386,21 @@ public final SessionEntityType updateSessionEntityType(UpdateSessionEntityTypeRe return updateSessionEntityTypeCallable().call(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Updates the specified session entity type. * *

Sample code: - * - *


-   * try (SessionEntityTypesClient sessionEntityTypesClient = SessionEntityTypesClient.create()) {
-   *   SessionEntityType sessionEntityType = SessionEntityType.newBuilder().build();
-   *   UpdateSessionEntityTypeRequest request = UpdateSessionEntityTypeRequest.newBuilder()
-   *     .setSessionEntityType(sessionEntityType)
-   *     .build();
-   *   ApiFuture<SessionEntityType> future = sessionEntityTypesClient.updateSessionEntityTypeCallable().futureCall(request);
-   *   // Do something
-   *   SessionEntityType response = future.get();
-   * }
-   * 
*/ public final UnaryCallable updateSessionEntityTypeCallable() { return stub.updateSessionEntityTypeCallable(); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Deletes the specified session entity type. * - *

Sample code: - * - *


-   * try (SessionEntityTypesClient sessionEntityTypesClient = SessionEntityTypesClient.create()) {
-   *   SessionEntityTypeName name = SessionEntityTypeName.ofProjectLocationAgentSessionEntityTypeName("[PROJECT]", "[LOCATION]", "[AGENT]", "[SESSION]", "[ENTITY_TYPE]");
-   *   sessionEntityTypesClient.deleteSessionEntityType(name);
-   * }
-   * 
- * * @param name Required. The name of the session entity type to delete. Format: * `projects/<Project ID>/locations/<Location ID>/agents/<Agent * ID>/sessions/<Session ID>/entityTypes/<Entity Type ID>` or @@ -631,19 +418,10 @@ public final void deleteSessionEntityType(SessionEntityTypeName name) { deleteSessionEntityType(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Deletes the specified session entity type. * - *

Sample code: - * - *


-   * try (SessionEntityTypesClient sessionEntityTypesClient = SessionEntityTypesClient.create()) {
-   *   SessionEntityTypeName name = SessionEntityTypeName.ofProjectLocationAgentSessionEntityTypeName("[PROJECT]", "[LOCATION]", "[AGENT]", "[SESSION]", "[ENTITY_TYPE]");
-   *   sessionEntityTypesClient.deleteSessionEntityType(name.toString());
-   * }
-   * 
- * * @param name Required. The name of the session entity type to delete. Format: * `projects/<Project ID>/locations/<Location ID>/agents/<Agent * ID>/sessions/<Session ID>/entityTypes/<Entity Type ID>` or @@ -659,22 +437,10 @@ public final void deleteSessionEntityType(String name) { deleteSessionEntityType(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Deletes the specified session entity type. * - *

Sample code: - * - *


-   * try (SessionEntityTypesClient sessionEntityTypesClient = SessionEntityTypesClient.create()) {
-   *   SessionEntityTypeName name = SessionEntityTypeName.ofProjectLocationAgentSessionEntityTypeName("[PROJECT]", "[LOCATION]", "[AGENT]", "[SESSION]", "[ENTITY_TYPE]");
-   *   DeleteSessionEntityTypeRequest request = DeleteSessionEntityTypeRequest.newBuilder()
-   *     .setName(name.toString())
-   *     .build();
-   *   sessionEntityTypesClient.deleteSessionEntityType(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 */ @@ -682,23 +448,11 @@ public final void deleteSessionEntityType(DeleteSessionEntityTypeRequest request deleteSessionEntityTypeCallable().call(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Deletes the specified session entity type. * *

Sample code: - * - *


-   * try (SessionEntityTypesClient sessionEntityTypesClient = SessionEntityTypesClient.create()) {
-   *   SessionEntityTypeName name = SessionEntityTypeName.ofProjectLocationAgentSessionEntityTypeName("[PROJECT]", "[LOCATION]", "[AGENT]", "[SESSION]", "[ENTITY_TYPE]");
-   *   DeleteSessionEntityTypeRequest request = DeleteSessionEntityTypeRequest.newBuilder()
-   *     .setName(name.toString())
-   *     .build();
-   *   ApiFuture<Void> future = sessionEntityTypesClient.deleteSessionEntityTypeCallable().futureCall(request);
-   *   // Do something
-   *   future.get();
-   * }
-   * 
*/ public final UnaryCallable deleteSessionEntityTypeCallable() { diff --git a/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3/SessionEntityTypesSettings.java b/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3/SessionEntityTypesSettings.java index c786a941a..a068a3d5f 100644 --- a/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3/SessionEntityTypesSettings.java +++ b/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3/SessionEntityTypesSettings.java @@ -5,7 +5,7 @@ * 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 + * 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, @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.google.cloud.dialogflow.cx.v3; import static com.google.cloud.dialogflow.cx.v3.SessionEntityTypesClient.ListSessionEntityTypesPagedResponse; @@ -34,7 +35,7 @@ import java.util.List; import javax.annotation.Generated; -// AUTO-GENERATED DOCUMENTATION AND CLASS +// AUTO-GENERATED DOCUMENTATION AND CLASS. /** * Settings class to configure an instance of {@link SessionEntityTypesClient}. * @@ -51,22 +52,25 @@ * *

For example, to set the total timeout of getSessionEntityType to 30 seconds: * - *

- * 
+ * 
{@code
  * SessionEntityTypesSettings.Builder sessionEntityTypesSettingsBuilder =
  *     SessionEntityTypesSettings.newBuilder();
  * sessionEntityTypesSettingsBuilder
  *     .getSessionEntityTypeSettings()
  *     .setRetrySettings(
- *         sessionEntityTypesSettingsBuilder.getSessionEntityTypeSettings().getRetrySettings().toBuilder()
+ *         sessionEntityTypesSettingsBuilder
+ *             .getSessionEntityTypeSettings()
+ *             .getRetrySettings()
+ *             .toBuilder()
  *             .setTotalTimeout(Duration.ofSeconds(30))
  *             .build());
- * SessionEntityTypesSettings sessionEntityTypesSettings = sessionEntityTypesSettingsBuilder.build();
- * 
- * 
+ * SessionEntityTypesSettings sessionEntityTypesSettings = + * sessionEntityTypesSettingsBuilder.build(); + * }
*/ -@Generated("by gapic-generator") +@Generated("by gapic-generator-java") public class SessionEntityTypesSettings extends ClientSettings { + /** Returns the object with the settings used for calls to listSessionEntityTypes. */ public PagedCallSettings< ListSessionEntityTypesRequest, @@ -160,18 +164,15 @@ protected SessionEntityTypesSettings(Builder settingsBuilder) throws IOException /** Builder for SessionEntityTypesSettings. */ public static class Builder extends ClientSettings.Builder { + protected Builder() throws IOException { - this((ClientContext) null); + this(((ClientContext) null)); } protected Builder(ClientContext clientContext) { super(SessionEntityTypesStubSettings.newBuilder(clientContext)); } - private static Builder createDefault() { - return new Builder(SessionEntityTypesStubSettings.newBuilder()); - } - protected Builder(SessionEntityTypesSettings settings) { super(settings.getStubSettings().toBuilder()); } @@ -180,11 +181,15 @@ protected Builder(SessionEntityTypesStubSettings.Builder stubSettings) { super(stubSettings); } + private static Builder createDefault() { + return new Builder(SessionEntityTypesStubSettings.newBuilder()); + } + public SessionEntityTypesStubSettings.Builder getStubSettingsBuilder() { return ((SessionEntityTypesStubSettings.Builder) getStubSettings()); } - // NEXT_MAJOR_VER: remove 'throws Exception' + // NEXT_MAJOR_VER: remove 'throws Exception'. /** * Applies the given settings updater function to all of the unary API methods in this service. * diff --git a/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3/SessionsClient.java b/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3/SessionsClient.java index eca06e291..89a6f26cd 100644 --- a/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3/SessionsClient.java +++ b/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3/SessionsClient.java @@ -5,7 +5,7 @@ * 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 + * 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, @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.google.cloud.dialogflow.cx.v3; import com.google.api.core.BetaApi; @@ -25,7 +26,7 @@ import java.util.concurrent.TimeUnit; import javax.annotation.Generated; -// AUTO-GENERATED DOCUMENTATION AND SERVICE +// AUTO-GENERATED DOCUMENTATION AND CLASS. /** * Service Description: A session represents an interaction with a user. You retrieve user input and * pass it to the [DetectIntent][google.cloud.dialogflow.cx.v3.Sessions.DetectIntent] method to @@ -34,21 +35,7 @@ *

This class provides the ability to make remote calls to the backing service through method * calls that map to API methods. Sample code to get started: * - *

- * 
- * try (SessionsClient sessionsClient = SessionsClient.create()) {
- *   SessionName session = SessionName.ofProjectLocationAgentSessionName("[PROJECT]", "[LOCATION]", "[AGENT]", "[SESSION]");
- *   QueryInput queryInput = QueryInput.newBuilder().build();
- *   DetectIntentRequest request = DetectIntentRequest.newBuilder()
- *     .setSession(session.toString())
- *     .setQueryInput(queryInput)
- *     .build();
- *   DetectIntentResponse response = sessionsClient.detectIntent(request);
- * }
- * 
- * 
- * - *

Note: close() needs to be called on the sessionsClient object to clean up resources such as + *

Note: close() needs to be called on the SessionsClient object to clean up resources such as * threads. In the example above, try-with-resources is used, which automatically calls close(). * *

The surface of this class includes several types of Java methods for each of the API's @@ -76,28 +63,25 @@ * *

To customize credentials: * - *

- * 
+ * 
{@code
  * SessionsSettings sessionsSettings =
  *     SessionsSettings.newBuilder()
  *         .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
  *         .build();
- * SessionsClient sessionsClient =
- *     SessionsClient.create(sessionsSettings);
- * 
- * 
+ * SessionsClient sessionsClient = SessionsClient.create(sessionsSettings); + * }
* - * To customize the endpoint: + *

To customize the endpoint: * - *

- * 
+ * 
{@code
  * SessionsSettings sessionsSettings =
  *     SessionsSettings.newBuilder().setEndpoint(myEndpoint).build();
- * SessionsClient sessionsClient =
- *     SessionsClient.create(sessionsSettings);
- * 
- * 
+ * SessionsClient sessionsClient = SessionsClient.create(sessionsSettings); + * }
+ * + *

Please refer to the GitHub repository's samples for more quickstart code snippets. */ +@BetaApi @Generated("by gapic-generator") public class SessionsClient implements BackgroundResource { private final SessionsSettings settings; @@ -118,7 +102,7 @@ public static final SessionsClient create(SessionsSettings settings) throws IOEx /** * Constructs an instance of SessionsClient, using the given stub for making calls. This is for - * advanced usage - prefer to use SessionsSettings}. + * advanced usage - prefer using create(SessionsSettings). */ @BetaApi("A restructuring of stub classes is planned, so this may break in the future") public static final SessionsClient create(SessionsStub stub) { @@ -149,26 +133,12 @@ public SessionsStub getStub() { return stub; } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Processes a natural language query and returns structured, actionable data as a result. This * method is not idempotent, because it may cause session entity types to be updated, which in * turn might affect results of future queries. * - *

Sample code: - * - *


-   * try (SessionsClient sessionsClient = SessionsClient.create()) {
-   *   SessionName session = SessionName.ofProjectLocationAgentSessionName("[PROJECT]", "[LOCATION]", "[AGENT]", "[SESSION]");
-   *   QueryInput queryInput = QueryInput.newBuilder().build();
-   *   DetectIntentRequest request = DetectIntentRequest.newBuilder()
-   *     .setSession(session.toString())
-   *     .setQueryInput(queryInput)
-   *     .build();
-   *   DetectIntentResponse response = sessionsClient.detectIntent(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 */ @@ -176,79 +146,35 @@ public final DetectIntentResponse detectIntent(DetectIntentRequest request) { return detectIntentCallable().call(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Processes a natural language query and returns structured, actionable data as a result. This * method is not idempotent, because it may cause session entity types to be updated, which in * turn might affect results of future queries. * *

Sample code: - * - *


-   * try (SessionsClient sessionsClient = SessionsClient.create()) {
-   *   SessionName session = SessionName.ofProjectLocationAgentSessionName("[PROJECT]", "[LOCATION]", "[AGENT]", "[SESSION]");
-   *   QueryInput queryInput = QueryInput.newBuilder().build();
-   *   DetectIntentRequest request = DetectIntentRequest.newBuilder()
-   *     .setSession(session.toString())
-   *     .setQueryInput(queryInput)
-   *     .build();
-   *   ApiFuture<DetectIntentResponse> future = sessionsClient.detectIntentCallable().futureCall(request);
-   *   // Do something
-   *   DetectIntentResponse response = future.get();
-   * }
-   * 
*/ public final UnaryCallable detectIntentCallable() { return stub.detectIntentCallable(); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Processes a natural language query in audio format in a streaming fashion and returns * structured, actionable data as a result. This method is only available via the gRPC API (not * REST). * *

Sample code: - * - *


-   * try (SessionsClient sessionsClient = SessionsClient.create()) {
-   *   BidiStream<StreamingDetectIntentRequest, StreamingDetectIntentResponse> bidiStream =
-   *       sessionsClient.streamingDetectIntentCallable().call();
-   *
-   *   QueryInput queryInput = QueryInput.newBuilder().build();
-   *   StreamingDetectIntentRequest request = StreamingDetectIntentRequest.newBuilder()
-   *     .setQueryInput(queryInput)
-   *     .build();
-   *   bidiStream.send(request);
-   *   for (StreamingDetectIntentResponse response : bidiStream) {
-   *     // Do something when receive a response
-   *   }
-   * }
-   * 
*/ public final BidiStreamingCallable streamingDetectIntentCallable() { return stub.streamingDetectIntentCallable(); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Returns preliminary intent match results, doesn't change the session status. * - *

Sample code: - * - *


-   * try (SessionsClient sessionsClient = SessionsClient.create()) {
-   *   SessionName session = SessionName.ofProjectLocationAgentSessionName("[PROJECT]", "[LOCATION]", "[AGENT]", "[SESSION]");
-   *   QueryInput queryInput = QueryInput.newBuilder().build();
-   *   MatchIntentRequest request = MatchIntentRequest.newBuilder()
-   *     .setSession(session.toString())
-   *     .setQueryInput(queryInput)
-   *     .build();
-   *   MatchIntentResponse response = sessionsClient.matchIntent(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 */ @@ -256,31 +182,17 @@ public final MatchIntentResponse matchIntent(MatchIntentRequest request) { return matchIntentCallable().call(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Returns preliminary intent match results, doesn't change the session status. * *

Sample code: - * - *


-   * try (SessionsClient sessionsClient = SessionsClient.create()) {
-   *   SessionName session = SessionName.ofProjectLocationAgentSessionName("[PROJECT]", "[LOCATION]", "[AGENT]", "[SESSION]");
-   *   QueryInput queryInput = QueryInput.newBuilder().build();
-   *   MatchIntentRequest request = MatchIntentRequest.newBuilder()
-   *     .setSession(session.toString())
-   *     .setQueryInput(queryInput)
-   *     .build();
-   *   ApiFuture<MatchIntentResponse> future = sessionsClient.matchIntentCallable().futureCall(request);
-   *   // Do something
-   *   MatchIntentResponse response = future.get();
-   * }
-   * 
*/ public final UnaryCallable matchIntentCallable() { return stub.matchIntentCallable(); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Fulfills a matched intent returned by * [MatchIntent][google.cloud.dialogflow.cx.v3.Sessions.MatchIntent]. Must be called after @@ -288,15 +200,6 @@ public final UnaryCallable matchIntentC * [MatchIntentResponse][google.cloud.dialogflow.cx.v3.MatchIntentResponse]. Otherwise, the * behavior is undefined. * - *

Sample code: - * - *


-   * try (SessionsClient sessionsClient = SessionsClient.create()) {
-   *   FulfillIntentRequest request = FulfillIntentRequest.newBuilder().build();
-   *   FulfillIntentResponse response = sessionsClient.fulfillIntent(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 */ @@ -304,7 +207,7 @@ public final FulfillIntentResponse fulfillIntent(FulfillIntentRequest request) { return fulfillIntentCallable().call(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Fulfills a matched intent returned by * [MatchIntent][google.cloud.dialogflow.cx.v3.Sessions.MatchIntent]. Must be called after @@ -313,15 +216,6 @@ public final FulfillIntentResponse fulfillIntent(FulfillIntentRequest request) { * behavior is undefined. * *

Sample code: - * - *


-   * try (SessionsClient sessionsClient = SessionsClient.create()) {
-   *   FulfillIntentRequest request = FulfillIntentRequest.newBuilder().build();
-   *   ApiFuture<FulfillIntentResponse> future = sessionsClient.fulfillIntentCallable().futureCall(request);
-   *   // Do something
-   *   FulfillIntentResponse response = future.get();
-   * }
-   * 
*/ public final UnaryCallable fulfillIntentCallable() { return stub.fulfillIntentCallable(); diff --git a/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3/SessionsSettings.java b/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3/SessionsSettings.java index 1f5dea115..a5d835c6c 100644 --- a/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3/SessionsSettings.java +++ b/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3/SessionsSettings.java @@ -5,7 +5,7 @@ * 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 + * 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, @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.google.cloud.dialogflow.cx.v3; import com.google.api.core.ApiFunction; @@ -31,7 +32,7 @@ import java.util.List; import javax.annotation.Generated; -// AUTO-GENERATED DOCUMENTATION AND CLASS +// AUTO-GENERATED DOCUMENTATION AND CLASS. /** * Settings class to configure an instance of {@link SessionsClient}. * @@ -48,22 +49,23 @@ * *

For example, to set the total timeout of detectIntent to 30 seconds: * - *

- * 
- * SessionsSettings.Builder sessionsSettingsBuilder =
- *     SessionsSettings.newBuilder();
+ * 
{@code
+ * SessionsSettings.Builder sessionsSettingsBuilder = SessionsSettings.newBuilder();
  * sessionsSettingsBuilder
  *     .detectIntentSettings()
  *     .setRetrySettings(
- *         sessionsSettingsBuilder.detectIntentSettings().getRetrySettings().toBuilder()
+ *         sessionsSettingsBuilder
+ *             .detectIntentSettings()
+ *             .getRetrySettings()
+ *             .toBuilder()
  *             .setTotalTimeout(Duration.ofSeconds(30))
  *             .build());
  * SessionsSettings sessionsSettings = sessionsSettingsBuilder.build();
- * 
- * 
+ * }
*/ -@Generated("by gapic-generator") +@Generated("by gapic-generator-java") public class SessionsSettings extends ClientSettings { + /** Returns the object with the settings used for calls to detectIntent. */ public UnaryCallSettings detectIntentSettings() { return ((SessionsStubSettings) getStubSettings()).detectIntentSettings(); @@ -144,18 +146,15 @@ protected SessionsSettings(Builder settingsBuilder) throws IOException { /** Builder for SessionsSettings. */ public static class Builder extends ClientSettings.Builder { + protected Builder() throws IOException { - this((ClientContext) null); + this(((ClientContext) null)); } protected Builder(ClientContext clientContext) { super(SessionsStubSettings.newBuilder(clientContext)); } - private static Builder createDefault() { - return new Builder(SessionsStubSettings.newBuilder()); - } - protected Builder(SessionsSettings settings) { super(settings.getStubSettings().toBuilder()); } @@ -164,11 +163,15 @@ protected Builder(SessionsStubSettings.Builder stubSettings) { super(stubSettings); } + private static Builder createDefault() { + return new Builder(SessionsStubSettings.newBuilder()); + } + public SessionsStubSettings.Builder getStubSettingsBuilder() { return ((SessionsStubSettings.Builder) getStubSettings()); } - // NEXT_MAJOR_VER: remove 'throws Exception' + // NEXT_MAJOR_VER: remove 'throws Exception'. /** * Applies the given settings updater function to all of the unary API methods in this service. * diff --git a/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3/TransitionRouteGroupsClient.java b/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3/TransitionRouteGroupsClient.java index bedb1d20d..13807556e 100644 --- a/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3/TransitionRouteGroupsClient.java +++ b/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3/TransitionRouteGroupsClient.java @@ -5,7 +5,7 @@ * 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 + * 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, @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.google.cloud.dialogflow.cx.v3; import com.google.api.core.ApiFunction; @@ -35,7 +36,7 @@ import java.util.concurrent.TimeUnit; import javax.annotation.Generated; -// AUTO-GENERATED DOCUMENTATION AND SERVICE +// AUTO-GENERATED DOCUMENTATION AND CLASS. /** * Service Description: Service for managing * [TransitionRouteGroups][google.cloud.dialogflow.cx.v3.TransitionRouteGroup]. @@ -43,16 +44,7 @@ *

This class provides the ability to make remote calls to the backing service through method * calls that map to API methods. Sample code to get started: * - *

- * 
- * try (TransitionRouteGroupsClient transitionRouteGroupsClient = TransitionRouteGroupsClient.create()) {
- *   TransitionRouteGroupName name = TransitionRouteGroupName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]", "[TRANSITION_ROUTE_GROUP]");
- *   TransitionRouteGroup response = transitionRouteGroupsClient.getTransitionRouteGroup(name);
- * }
- * 
- * 
- * - *

Note: close() needs to be called on the transitionRouteGroupsClient object to clean up + *

Note: close() needs to be called on the TransitionRouteGroupsClient object to clean up * resources such as threads. In the example above, try-with-resources is used, which automatically * calls close(). * @@ -81,28 +73,27 @@ * *

To customize credentials: * - *

- * 
+ * 
{@code
  * TransitionRouteGroupsSettings transitionRouteGroupsSettings =
  *     TransitionRouteGroupsSettings.newBuilder()
  *         .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
  *         .build();
  * TransitionRouteGroupsClient transitionRouteGroupsClient =
  *     TransitionRouteGroupsClient.create(transitionRouteGroupsSettings);
- * 
- * 
+ * }
* - * To customize the endpoint: + *

To customize the endpoint: * - *

- * 
+ * 
{@code
  * TransitionRouteGroupsSettings transitionRouteGroupsSettings =
  *     TransitionRouteGroupsSettings.newBuilder().setEndpoint(myEndpoint).build();
  * TransitionRouteGroupsClient transitionRouteGroupsClient =
  *     TransitionRouteGroupsClient.create(transitionRouteGroupsSettings);
- * 
- * 
+ * }
+ * + *

Please refer to the GitHub repository's samples for more quickstart code snippets. */ +@BetaApi @Generated("by gapic-generator") public class TransitionRouteGroupsClient implements BackgroundResource { private final TransitionRouteGroupsSettings settings; @@ -124,7 +115,7 @@ public static final TransitionRouteGroupsClient create(TransitionRouteGroupsSett /** * Constructs an instance of TransitionRouteGroupsClient, using the given stub for making calls. - * This is for advanced usage - prefer to use TransitionRouteGroupsSettings}. + * This is for advanced usage - prefer using create(TransitionRouteGroupsSettings). */ @BetaApi("A restructuring of stub classes is planned, so this may break in the future") public static final TransitionRouteGroupsClient create(TransitionRouteGroupsStub stub) { @@ -156,21 +147,10 @@ public TransitionRouteGroupsStub getStub() { return stub; } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Returns the list of all transition route groups in the specified flow. * - *

Sample code: - * - *


-   * try (TransitionRouteGroupsClient transitionRouteGroupsClient = TransitionRouteGroupsClient.create()) {
-   *   FlowName parent = FlowName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]");
-   *   for (TransitionRouteGroup element : transitionRouteGroupsClient.listTransitionRouteGroups(parent).iterateAll()) {
-   *     // doThingsWith(element);
-   *   }
-   * }
-   * 
- * * @param parent Required. The flow to list all transition route groups for. Format: * `projects/<Project ID>/locations/<Location ID>/agents/<Agent * ID>/flows/<Flow ID>`. @@ -184,21 +164,10 @@ public final ListTransitionRouteGroupsPagedResponse listTransitionRouteGroups(Fl return listTransitionRouteGroups(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Returns the list of all transition route groups in the specified flow. * - *

Sample code: - * - *


-   * try (TransitionRouteGroupsClient transitionRouteGroupsClient = TransitionRouteGroupsClient.create()) {
-   *   FlowName parent = FlowName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]");
-   *   for (TransitionRouteGroup element : transitionRouteGroupsClient.listTransitionRouteGroups(parent.toString()).iterateAll()) {
-   *     // doThingsWith(element);
-   *   }
-   * }
-   * 
- * * @param parent Required. The flow to list all transition route groups for. Format: * `projects/<Project ID>/locations/<Location ID>/agents/<Agent * ID>/flows/<Flow ID>`. @@ -210,24 +179,10 @@ public final ListTransitionRouteGroupsPagedResponse listTransitionRouteGroups(St return listTransitionRouteGroups(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Returns the list of all transition route groups in the specified flow. * - *

Sample code: - * - *


-   * try (TransitionRouteGroupsClient transitionRouteGroupsClient = TransitionRouteGroupsClient.create()) {
-   *   FlowName parent = FlowName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]");
-   *   ListTransitionRouteGroupsRequest request = ListTransitionRouteGroupsRequest.newBuilder()
-   *     .setParent(parent.toString())
-   *     .build();
-   *   for (TransitionRouteGroup element : transitionRouteGroupsClient.listTransitionRouteGroups(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 */ @@ -236,25 +191,11 @@ public final ListTransitionRouteGroupsPagedResponse listTransitionRouteGroups( return listTransitionRouteGroupsPagedCallable().call(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Returns the list of all transition route groups in the specified flow. * *

Sample code: - * - *


-   * try (TransitionRouteGroupsClient transitionRouteGroupsClient = TransitionRouteGroupsClient.create()) {
-   *   FlowName parent = FlowName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]");
-   *   ListTransitionRouteGroupsRequest request = ListTransitionRouteGroupsRequest.newBuilder()
-   *     .setParent(parent.toString())
-   *     .build();
-   *   ApiFuture<ListTransitionRouteGroupsPagedResponse> future = transitionRouteGroupsClient.listTransitionRouteGroupsPagedCallable().futureCall(request);
-   *   // Do something
-   *   for (TransitionRouteGroup element : future.get().iterateAll()) {
-   *     // doThingsWith(element);
-   *   }
-   * }
-   * 
*/ public final UnaryCallable< ListTransitionRouteGroupsRequest, ListTransitionRouteGroupsPagedResponse> @@ -262,52 +203,22 @@ public final ListTransitionRouteGroupsPagedResponse listTransitionRouteGroups( return stub.listTransitionRouteGroupsPagedCallable(); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Returns the list of all transition route groups in the specified flow. * *

Sample code: - * - *


-   * try (TransitionRouteGroupsClient transitionRouteGroupsClient = TransitionRouteGroupsClient.create()) {
-   *   FlowName parent = FlowName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]");
-   *   ListTransitionRouteGroupsRequest request = ListTransitionRouteGroupsRequest.newBuilder()
-   *     .setParent(parent.toString())
-   *     .build();
-   *   while (true) {
-   *     ListTransitionRouteGroupsResponse response = transitionRouteGroupsClient.listTransitionRouteGroupsCallable().call(request);
-   *     for (TransitionRouteGroup element : response.getTransitionRouteGroupsList()) {
-   *       // doThingsWith(element);
-   *     }
-   *     String nextPageToken = response.getNextPageToken();
-   *     if (!Strings.isNullOrEmpty(nextPageToken)) {
-   *       request = request.toBuilder().setPageToken(nextPageToken).build();
-   *     } else {
-   *       break;
-   *     }
-   *   }
-   * }
-   * 
*/ public final UnaryCallable listTransitionRouteGroupsCallable() { return stub.listTransitionRouteGroupsCallable(); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Retrieves the specified * [TransitionRouteGroup][google.cloud.dialogflow.cx.v3.TransitionRouteGroup]. * - *

Sample code: - * - *


-   * try (TransitionRouteGroupsClient transitionRouteGroupsClient = TransitionRouteGroupsClient.create()) {
-   *   TransitionRouteGroupName name = TransitionRouteGroupName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]", "[TRANSITION_ROUTE_GROUP]");
-   *   TransitionRouteGroup response = transitionRouteGroupsClient.getTransitionRouteGroup(name);
-   * }
-   * 
- * * @param name Required. The name of the * [TransitionRouteGroup][google.cloud.dialogflow.cx.v3.TransitionRouteGroup]. Format: * `projects/<Project ID>/locations/<Location ID>/agents/<Agent @@ -322,20 +233,11 @@ public final TransitionRouteGroup getTransitionRouteGroup(TransitionRouteGroupNa return getTransitionRouteGroup(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Retrieves the specified * [TransitionRouteGroup][google.cloud.dialogflow.cx.v3.TransitionRouteGroup]. * - *

Sample code: - * - *


-   * try (TransitionRouteGroupsClient transitionRouteGroupsClient = TransitionRouteGroupsClient.create()) {
-   *   TransitionRouteGroupName name = TransitionRouteGroupName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]", "[TRANSITION_ROUTE_GROUP]");
-   *   TransitionRouteGroup response = transitionRouteGroupsClient.getTransitionRouteGroup(name.toString());
-   * }
-   * 
- * * @param name Required. The name of the * [TransitionRouteGroup][google.cloud.dialogflow.cx.v3.TransitionRouteGroup]. Format: * `projects/<Project ID>/locations/<Location ID>/agents/<Agent @@ -348,23 +250,11 @@ public final TransitionRouteGroup getTransitionRouteGroup(String name) { return getTransitionRouteGroup(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Retrieves the specified * [TransitionRouteGroup][google.cloud.dialogflow.cx.v3.TransitionRouteGroup]. * - *

Sample code: - * - *


-   * try (TransitionRouteGroupsClient transitionRouteGroupsClient = TransitionRouteGroupsClient.create()) {
-   *   TransitionRouteGroupName name = TransitionRouteGroupName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]", "[TRANSITION_ROUTE_GROUP]");
-   *   GetTransitionRouteGroupRequest request = GetTransitionRouteGroupRequest.newBuilder()
-   *     .setName(name.toString())
-   *     .build();
-   *   TransitionRouteGroup response = transitionRouteGroupsClient.getTransitionRouteGroup(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 */ @@ -373,45 +263,23 @@ public final TransitionRouteGroup getTransitionRouteGroup( return getTransitionRouteGroupCallable().call(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Retrieves the specified * [TransitionRouteGroup][google.cloud.dialogflow.cx.v3.TransitionRouteGroup]. * *

Sample code: - * - *


-   * try (TransitionRouteGroupsClient transitionRouteGroupsClient = TransitionRouteGroupsClient.create()) {
-   *   TransitionRouteGroupName name = TransitionRouteGroupName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]", "[TRANSITION_ROUTE_GROUP]");
-   *   GetTransitionRouteGroupRequest request = GetTransitionRouteGroupRequest.newBuilder()
-   *     .setName(name.toString())
-   *     .build();
-   *   ApiFuture<TransitionRouteGroup> future = transitionRouteGroupsClient.getTransitionRouteGroupCallable().futureCall(request);
-   *   // Do something
-   *   TransitionRouteGroup response = future.get();
-   * }
-   * 
*/ public final UnaryCallable getTransitionRouteGroupCallable() { return stub.getTransitionRouteGroupCallable(); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Creates an [TransitionRouteGroup][google.cloud.dialogflow.cx.v3.TransitionRouteGroup] in the * specified flow. * - *

Sample code: - * - *


-   * try (TransitionRouteGroupsClient transitionRouteGroupsClient = TransitionRouteGroupsClient.create()) {
-   *   FlowName parent = FlowName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]");
-   *   TransitionRouteGroup transitionRouteGroup = TransitionRouteGroup.newBuilder().build();
-   *   TransitionRouteGroup response = transitionRouteGroupsClient.createTransitionRouteGroup(parent, transitionRouteGroup);
-   * }
-   * 
- * * @param parent Required. The flow to create an * [TransitionRouteGroup][google.cloud.dialogflow.cx.v3.TransitionRouteGroup] for. Format: * `projects/<Project ID>/locations/<Location ID>/agents/<Agent @@ -429,21 +297,11 @@ public final TransitionRouteGroup createTransitionRouteGroup( return createTransitionRouteGroup(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Creates an [TransitionRouteGroup][google.cloud.dialogflow.cx.v3.TransitionRouteGroup] in the * specified flow. * - *

Sample code: - * - *


-   * try (TransitionRouteGroupsClient transitionRouteGroupsClient = TransitionRouteGroupsClient.create()) {
-   *   FlowName parent = FlowName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]");
-   *   TransitionRouteGroup transitionRouteGroup = TransitionRouteGroup.newBuilder().build();
-   *   TransitionRouteGroup response = transitionRouteGroupsClient.createTransitionRouteGroup(parent.toString(), transitionRouteGroup);
-   * }
-   * 
- * * @param parent Required. The flow to create an * [TransitionRouteGroup][google.cloud.dialogflow.cx.v3.TransitionRouteGroup] for. Format: * `projects/<Project ID>/locations/<Location ID>/agents/<Agent @@ -461,25 +319,11 @@ public final TransitionRouteGroup createTransitionRouteGroup( return createTransitionRouteGroup(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Creates an [TransitionRouteGroup][google.cloud.dialogflow.cx.v3.TransitionRouteGroup] in the * specified flow. * - *

Sample code: - * - *


-   * try (TransitionRouteGroupsClient transitionRouteGroupsClient = TransitionRouteGroupsClient.create()) {
-   *   FlowName parent = FlowName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]");
-   *   TransitionRouteGroup transitionRouteGroup = TransitionRouteGroup.newBuilder().build();
-   *   CreateTransitionRouteGroupRequest request = CreateTransitionRouteGroupRequest.newBuilder()
-   *     .setParent(parent.toString())
-   *     .setTransitionRouteGroup(transitionRouteGroup)
-   *     .build();
-   *   TransitionRouteGroup response = transitionRouteGroupsClient.createTransitionRouteGroup(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 */ @@ -488,47 +332,23 @@ public final TransitionRouteGroup createTransitionRouteGroup( return createTransitionRouteGroupCallable().call(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Creates an [TransitionRouteGroup][google.cloud.dialogflow.cx.v3.TransitionRouteGroup] in the * specified flow. * *

Sample code: - * - *


-   * try (TransitionRouteGroupsClient transitionRouteGroupsClient = TransitionRouteGroupsClient.create()) {
-   *   FlowName parent = FlowName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]");
-   *   TransitionRouteGroup transitionRouteGroup = TransitionRouteGroup.newBuilder().build();
-   *   CreateTransitionRouteGroupRequest request = CreateTransitionRouteGroupRequest.newBuilder()
-   *     .setParent(parent.toString())
-   *     .setTransitionRouteGroup(transitionRouteGroup)
-   *     .build();
-   *   ApiFuture<TransitionRouteGroup> future = transitionRouteGroupsClient.createTransitionRouteGroupCallable().futureCall(request);
-   *   // Do something
-   *   TransitionRouteGroup response = future.get();
-   * }
-   * 
*/ public final UnaryCallable createTransitionRouteGroupCallable() { return stub.createTransitionRouteGroupCallable(); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Updates the specified * [TransitionRouteGroup][google.cloud.dialogflow.cx.v3.TransitionRouteGroup]. * - *

Sample code: - * - *


-   * try (TransitionRouteGroupsClient transitionRouteGroupsClient = TransitionRouteGroupsClient.create()) {
-   *   TransitionRouteGroup transitionRouteGroup = TransitionRouteGroup.newBuilder().build();
-   *   FieldMask updateMask = FieldMask.newBuilder().build();
-   *   TransitionRouteGroup response = transitionRouteGroupsClient.updateTransitionRouteGroup(transitionRouteGroup, updateMask);
-   * }
-   * 
- * * @param transitionRouteGroup Required. The transition route group to update. * @param updateMask The mask to control which fields get updated. * @throws com.google.api.gax.rpc.ApiException if the remote call fails @@ -543,23 +363,11 @@ public final TransitionRouteGroup updateTransitionRouteGroup( return updateTransitionRouteGroup(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Updates the specified * [TransitionRouteGroup][google.cloud.dialogflow.cx.v3.TransitionRouteGroup]. * - *

Sample code: - * - *


-   * try (TransitionRouteGroupsClient transitionRouteGroupsClient = TransitionRouteGroupsClient.create()) {
-   *   TransitionRouteGroup transitionRouteGroup = TransitionRouteGroup.newBuilder().build();
-   *   UpdateTransitionRouteGroupRequest request = UpdateTransitionRouteGroupRequest.newBuilder()
-   *     .setTransitionRouteGroup(transitionRouteGroup)
-   *     .build();
-   *   TransitionRouteGroup response = transitionRouteGroupsClient.updateTransitionRouteGroup(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 */ @@ -568,44 +376,23 @@ public final TransitionRouteGroup updateTransitionRouteGroup( return updateTransitionRouteGroupCallable().call(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Updates the specified * [TransitionRouteGroup][google.cloud.dialogflow.cx.v3.TransitionRouteGroup]. * *

Sample code: - * - *


-   * try (TransitionRouteGroupsClient transitionRouteGroupsClient = TransitionRouteGroupsClient.create()) {
-   *   TransitionRouteGroup transitionRouteGroup = TransitionRouteGroup.newBuilder().build();
-   *   UpdateTransitionRouteGroupRequest request = UpdateTransitionRouteGroupRequest.newBuilder()
-   *     .setTransitionRouteGroup(transitionRouteGroup)
-   *     .build();
-   *   ApiFuture<TransitionRouteGroup> future = transitionRouteGroupsClient.updateTransitionRouteGroupCallable().futureCall(request);
-   *   // Do something
-   *   TransitionRouteGroup response = future.get();
-   * }
-   * 
*/ public final UnaryCallable updateTransitionRouteGroupCallable() { return stub.updateTransitionRouteGroupCallable(); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Deletes the specified * [TransitionRouteGroup][google.cloud.dialogflow.cx.v3.TransitionRouteGroup]. * - *

Sample code: - * - *


-   * try (TransitionRouteGroupsClient transitionRouteGroupsClient = TransitionRouteGroupsClient.create()) {
-   *   TransitionRouteGroupName name = TransitionRouteGroupName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]", "[TRANSITION_ROUTE_GROUP]");
-   *   transitionRouteGroupsClient.deleteTransitionRouteGroup(name);
-   * }
-   * 
- * * @param name Required. The name of the * [TransitionRouteGroup][google.cloud.dialogflow.cx.v3.TransitionRouteGroup] to delete. * Format: `projects/<Project ID>/locations/<Location ID>/agents/<Agent @@ -620,20 +407,11 @@ public final void deleteTransitionRouteGroup(TransitionRouteGroupName name) { deleteTransitionRouteGroup(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Deletes the specified * [TransitionRouteGroup][google.cloud.dialogflow.cx.v3.TransitionRouteGroup]. * - *

Sample code: - * - *


-   * try (TransitionRouteGroupsClient transitionRouteGroupsClient = TransitionRouteGroupsClient.create()) {
-   *   TransitionRouteGroupName name = TransitionRouteGroupName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]", "[TRANSITION_ROUTE_GROUP]");
-   *   transitionRouteGroupsClient.deleteTransitionRouteGroup(name.toString());
-   * }
-   * 
- * * @param name Required. The name of the * [TransitionRouteGroup][google.cloud.dialogflow.cx.v3.TransitionRouteGroup] to delete. * Format: `projects/<Project ID>/locations/<Location ID>/agents/<Agent @@ -646,23 +424,11 @@ public final void deleteTransitionRouteGroup(String name) { deleteTransitionRouteGroup(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Deletes the specified * [TransitionRouteGroup][google.cloud.dialogflow.cx.v3.TransitionRouteGroup]. * - *

Sample code: - * - *


-   * try (TransitionRouteGroupsClient transitionRouteGroupsClient = TransitionRouteGroupsClient.create()) {
-   *   TransitionRouteGroupName name = TransitionRouteGroupName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]", "[TRANSITION_ROUTE_GROUP]");
-   *   DeleteTransitionRouteGroupRequest request = DeleteTransitionRouteGroupRequest.newBuilder()
-   *     .setName(name.toString())
-   *     .build();
-   *   transitionRouteGroupsClient.deleteTransitionRouteGroup(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 */ @@ -670,24 +436,12 @@ public final void deleteTransitionRouteGroup(DeleteTransitionRouteGroupRequest r deleteTransitionRouteGroupCallable().call(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Deletes the specified * [TransitionRouteGroup][google.cloud.dialogflow.cx.v3.TransitionRouteGroup]. * *

Sample code: - * - *


-   * try (TransitionRouteGroupsClient transitionRouteGroupsClient = TransitionRouteGroupsClient.create()) {
-   *   TransitionRouteGroupName name = TransitionRouteGroupName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]", "[TRANSITION_ROUTE_GROUP]");
-   *   DeleteTransitionRouteGroupRequest request = DeleteTransitionRouteGroupRequest.newBuilder()
-   *     .setName(name.toString())
-   *     .build();
-   *   ApiFuture<Void> future = transitionRouteGroupsClient.deleteTransitionRouteGroupCallable().futureCall(request);
-   *   // Do something
-   *   future.get();
-   * }
-   * 
*/ public final UnaryCallable deleteTransitionRouteGroupCallable() { diff --git a/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3/TransitionRouteGroupsSettings.java b/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3/TransitionRouteGroupsSettings.java index 98e2947d3..e69f5702f 100644 --- a/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3/TransitionRouteGroupsSettings.java +++ b/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3/TransitionRouteGroupsSettings.java @@ -5,7 +5,7 @@ * 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 + * 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, @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.google.cloud.dialogflow.cx.v3; import static com.google.cloud.dialogflow.cx.v3.TransitionRouteGroupsClient.ListTransitionRouteGroupsPagedResponse; @@ -34,7 +35,7 @@ import java.util.List; import javax.annotation.Generated; -// AUTO-GENERATED DOCUMENTATION AND CLASS +// AUTO-GENERATED DOCUMENTATION AND CLASS. /** * Settings class to configure an instance of {@link TransitionRouteGroupsClient}. * @@ -51,22 +52,25 @@ * *

For example, to set the total timeout of getTransitionRouteGroup to 30 seconds: * - *

- * 
+ * 
{@code
  * TransitionRouteGroupsSettings.Builder transitionRouteGroupsSettingsBuilder =
  *     TransitionRouteGroupsSettings.newBuilder();
  * transitionRouteGroupsSettingsBuilder
  *     .getTransitionRouteGroupSettings()
  *     .setRetrySettings(
- *         transitionRouteGroupsSettingsBuilder.getTransitionRouteGroupSettings().getRetrySettings().toBuilder()
+ *         transitionRouteGroupsSettingsBuilder
+ *             .getTransitionRouteGroupSettings()
+ *             .getRetrySettings()
+ *             .toBuilder()
  *             .setTotalTimeout(Duration.ofSeconds(30))
  *             .build());
- * TransitionRouteGroupsSettings transitionRouteGroupsSettings = transitionRouteGroupsSettingsBuilder.build();
- * 
- * 
+ * TransitionRouteGroupsSettings transitionRouteGroupsSettings = + * transitionRouteGroupsSettingsBuilder.build(); + * }
*/ -@Generated("by gapic-generator") +@Generated("by gapic-generator-java") public class TransitionRouteGroupsSettings extends ClientSettings { + /** Returns the object with the settings used for calls to listTransitionRouteGroups. */ public PagedCallSettings< ListTransitionRouteGroupsRequest, @@ -166,18 +170,15 @@ protected TransitionRouteGroupsSettings(Builder settingsBuilder) throws IOExcept /** Builder for TransitionRouteGroupsSettings. */ public static class Builder extends ClientSettings.Builder { + protected Builder() throws IOException { - this((ClientContext) null); + this(((ClientContext) null)); } protected Builder(ClientContext clientContext) { super(TransitionRouteGroupsStubSettings.newBuilder(clientContext)); } - private static Builder createDefault() { - return new Builder(TransitionRouteGroupsStubSettings.newBuilder()); - } - protected Builder(TransitionRouteGroupsSettings settings) { super(settings.getStubSettings().toBuilder()); } @@ -186,11 +187,15 @@ protected Builder(TransitionRouteGroupsStubSettings.Builder stubSettings) { super(stubSettings); } + private static Builder createDefault() { + return new Builder(TransitionRouteGroupsStubSettings.newBuilder()); + } + public TransitionRouteGroupsStubSettings.Builder getStubSettingsBuilder() { return ((TransitionRouteGroupsStubSettings.Builder) getStubSettings()); } - // NEXT_MAJOR_VER: remove 'throws Exception' + // NEXT_MAJOR_VER: remove 'throws Exception'. /** * Applies the given settings updater function to all of the unary API methods in this service. * diff --git a/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3/VersionsClient.java b/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3/VersionsClient.java index 4db4c6ee9..6e043c97c 100644 --- a/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3/VersionsClient.java +++ b/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3/VersionsClient.java @@ -5,7 +5,7 @@ * 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 + * 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, @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.google.cloud.dialogflow.cx.v3; import com.google.api.core.ApiFunction; @@ -40,23 +41,14 @@ import java.util.concurrent.TimeUnit; import javax.annotation.Generated; -// AUTO-GENERATED DOCUMENTATION AND SERVICE +// AUTO-GENERATED DOCUMENTATION AND CLASS. /** * Service Description: Service for managing [Versions][google.cloud.dialogflow.cx.v3.Version]. * *

This class provides the ability to make remote calls to the backing service through method * calls that map to API methods. Sample code to get started: * - *

- * 
- * try (VersionsClient versionsClient = VersionsClient.create()) {
- *   VersionName name = VersionName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]", "[VERSION]");
- *   Version response = versionsClient.getVersion(name);
- * }
- * 
- * 
- * - *

Note: close() needs to be called on the versionsClient object to clean up resources such as + *

Note: close() needs to be called on the VersionsClient object to clean up resources such as * threads. In the example above, try-with-resources is used, which automatically calls close(). * *

The surface of this class includes several types of Java methods for each of the API's @@ -84,28 +76,25 @@ * *

To customize credentials: * - *

- * 
+ * 
{@code
  * VersionsSettings versionsSettings =
  *     VersionsSettings.newBuilder()
  *         .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
  *         .build();
- * VersionsClient versionsClient =
- *     VersionsClient.create(versionsSettings);
- * 
- * 
+ * VersionsClient versionsClient = VersionsClient.create(versionsSettings); + * }
* - * To customize the endpoint: + *

To customize the endpoint: * - *

- * 
+ * 
{@code
  * VersionsSettings versionsSettings =
  *     VersionsSettings.newBuilder().setEndpoint(myEndpoint).build();
- * VersionsClient versionsClient =
- *     VersionsClient.create(versionsSettings);
- * 
- * 
+ * VersionsClient versionsClient = VersionsClient.create(versionsSettings); + * }
+ * + *

Please refer to the GitHub repository's samples for more quickstart code snippets. */ +@BetaApi @Generated("by gapic-generator") public class VersionsClient implements BackgroundResource { private final VersionsSettings settings; @@ -127,7 +116,7 @@ public static final VersionsClient create(VersionsSettings settings) throws IOEx /** * Constructs an instance of VersionsClient, using the given stub for making calls. This is for - * advanced usage - prefer to use VersionsSettings}. + * advanced usage - prefer using create(VersionsSettings). */ @BetaApi("A restructuring of stub classes is planned, so this may break in the future") public static final VersionsClient create(VersionsStub stub) { @@ -164,27 +153,14 @@ public VersionsStub getStub() { * Returns the OperationsClient that can be used to query the status of a long-running operation * returned by another API method call. */ - @BetaApi( - "The surface for long-running operations is not stable yet and may change in the future.") public final OperationsClient getOperationsClient() { return operationsClient; } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Returns the list of all versions in the specified [Flow][google.cloud.dialogflow.cx.v3.Flow]. * - *

Sample code: - * - *


-   * try (VersionsClient versionsClient = VersionsClient.create()) {
-   *   FlowName parent = FlowName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]");
-   *   for (Version element : versionsClient.listVersions(parent).iterateAll()) {
-   *     // doThingsWith(element);
-   *   }
-   * }
-   * 
- * * @param parent Required. The [Flow][google.cloud.dialogflow.cx.v3.Flow] to list all versions * for. Format: `projects/<Project ID>/locations/<Location ID>/agents/<Agent * ID>/flows/<Flow ID>`. @@ -198,21 +174,10 @@ public final ListVersionsPagedResponse listVersions(FlowName parent) { return listVersions(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Returns the list of all versions in the specified [Flow][google.cloud.dialogflow.cx.v3.Flow]. * - *

Sample code: - * - *


-   * try (VersionsClient versionsClient = VersionsClient.create()) {
-   *   FlowName parent = FlowName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]");
-   *   for (Version element : versionsClient.listVersions(parent.toString()).iterateAll()) {
-   *     // doThingsWith(element);
-   *   }
-   * }
-   * 
- * * @param parent Required. The [Flow][google.cloud.dialogflow.cx.v3.Flow] to list all versions * for. Format: `projects/<Project ID>/locations/<Location ID>/agents/<Agent * ID>/flows/<Flow ID>`. @@ -223,24 +188,10 @@ public final ListVersionsPagedResponse listVersions(String parent) { return listVersions(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Returns the list of all versions in the specified [Flow][google.cloud.dialogflow.cx.v3.Flow]. * - *

Sample code: - * - *


-   * try (VersionsClient versionsClient = VersionsClient.create()) {
-   *   FlowName parent = FlowName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]");
-   *   ListVersionsRequest request = ListVersionsRequest.newBuilder()
-   *     .setParent(parent.toString())
-   *     .build();
-   *   for (Version element : versionsClient.listVersions(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 */ @@ -248,75 +199,31 @@ public final ListVersionsPagedResponse listVersions(ListVersionsRequest request) return listVersionsPagedCallable().call(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Returns the list of all versions in the specified [Flow][google.cloud.dialogflow.cx.v3.Flow]. * *

Sample code: - * - *


-   * try (VersionsClient versionsClient = VersionsClient.create()) {
-   *   FlowName parent = FlowName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]");
-   *   ListVersionsRequest request = ListVersionsRequest.newBuilder()
-   *     .setParent(parent.toString())
-   *     .build();
-   *   ApiFuture<ListVersionsPagedResponse> future = versionsClient.listVersionsPagedCallable().futureCall(request);
-   *   // Do something
-   *   for (Version element : future.get().iterateAll()) {
-   *     // doThingsWith(element);
-   *   }
-   * }
-   * 
*/ public final UnaryCallable listVersionsPagedCallable() { return stub.listVersionsPagedCallable(); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Returns the list of all versions in the specified [Flow][google.cloud.dialogflow.cx.v3.Flow]. * *

Sample code: - * - *


-   * try (VersionsClient versionsClient = VersionsClient.create()) {
-   *   FlowName parent = FlowName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]");
-   *   ListVersionsRequest request = ListVersionsRequest.newBuilder()
-   *     .setParent(parent.toString())
-   *     .build();
-   *   while (true) {
-   *     ListVersionsResponse response = versionsClient.listVersionsCallable().call(request);
-   *     for (Version element : response.getVersionsList()) {
-   *       // doThingsWith(element);
-   *     }
-   *     String nextPageToken = response.getNextPageToken();
-   *     if (!Strings.isNullOrEmpty(nextPageToken)) {
-   *       request = request.toBuilder().setPageToken(nextPageToken).build();
-   *     } else {
-   *       break;
-   *     }
-   *   }
-   * }
-   * 
*/ public final UnaryCallable listVersionsCallable() { return stub.listVersionsCallable(); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Retrieves the specified [Version][google.cloud.dialogflow.cx.v3.Version]. * - *

Sample code: - * - *


-   * try (VersionsClient versionsClient = VersionsClient.create()) {
-   *   VersionName name = VersionName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]", "[VERSION]");
-   *   Version response = versionsClient.getVersion(name);
-   * }
-   * 
- * * @param name Required. The name of the [Version][google.cloud.dialogflow.cx.v3.Version]. Format: * `projects/<Project ID>/locations/<Location ID>/agents/<Agent * ID>/flows/<Flow ID>/versions/<Version ID>`. @@ -328,19 +235,10 @@ public final Version getVersion(VersionName name) { return getVersion(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Retrieves the specified [Version][google.cloud.dialogflow.cx.v3.Version]. * - *

Sample code: - * - *


-   * try (VersionsClient versionsClient = VersionsClient.create()) {
-   *   VersionName name = VersionName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]", "[VERSION]");
-   *   Version response = versionsClient.getVersion(name.toString());
-   * }
-   * 
- * * @param name Required. The name of the [Version][google.cloud.dialogflow.cx.v3.Version]. Format: * `projects/<Project ID>/locations/<Location ID>/agents/<Agent * ID>/flows/<Flow ID>/versions/<Version ID>`. @@ -351,22 +249,10 @@ public final Version getVersion(String name) { return getVersion(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Retrieves the specified [Version][google.cloud.dialogflow.cx.v3.Version]. * - *

Sample code: - * - *


-   * try (VersionsClient versionsClient = VersionsClient.create()) {
-   *   VersionName name = VersionName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]", "[VERSION]");
-   *   GetVersionRequest request = GetVersionRequest.newBuilder()
-   *     .setName(name.toString())
-   *     .build();
-   *   Version response = versionsClient.getVersion(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 */ @@ -374,51 +260,27 @@ public final Version getVersion(GetVersionRequest request) { return getVersionCallable().call(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Retrieves the specified [Version][google.cloud.dialogflow.cx.v3.Version]. * *

Sample code: - * - *


-   * try (VersionsClient versionsClient = VersionsClient.create()) {
-   *   VersionName name = VersionName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]", "[VERSION]");
-   *   GetVersionRequest request = GetVersionRequest.newBuilder()
-   *     .setName(name.toString())
-   *     .build();
-   *   ApiFuture<Version> future = versionsClient.getVersionCallable().futureCall(request);
-   *   // Do something
-   *   Version response = future.get();
-   * }
-   * 
*/ public final UnaryCallable getVersionCallable() { return stub.getVersionCallable(); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Creates a [Version][google.cloud.dialogflow.cx.v3.Version] in the specified * [Flow][google.cloud.dialogflow.cx.v3.Flow]. * - *

Sample code: - * - *


-   * try (VersionsClient versionsClient = VersionsClient.create()) {
-   *   FlowName parent = FlowName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]");
-   *   Version version = Version.newBuilder().build();
-   *   Version response = versionsClient.createVersionAsync(parent, version).get();
-   * }
-   * 
- * * @param parent Required. The [Flow][google.cloud.dialogflow.cx.v3.Flow] to create an * [Version][google.cloud.dialogflow.cx.v3.Version] for. Format: `projects/<Project * ID>/locations/<Location ID>/agents/<Agent ID>/flows/<Flow ID>`. * @param version Required. The version to create. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ - @BetaApi( - "The surface for long-running operations is not stable yet and may change in the future.") public final OperationFuture createVersionAsync( FlowName parent, Version version) { CreateVersionRequest request = @@ -429,29 +291,17 @@ public final OperationFuture createVers return createVersionAsync(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Creates a [Version][google.cloud.dialogflow.cx.v3.Version] in the specified * [Flow][google.cloud.dialogflow.cx.v3.Flow]. * - *

Sample code: - * - *


-   * try (VersionsClient versionsClient = VersionsClient.create()) {
-   *   FlowName parent = FlowName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]");
-   *   Version version = Version.newBuilder().build();
-   *   Version response = versionsClient.createVersionAsync(parent.toString(), version).get();
-   * }
-   * 
- * * @param parent Required. The [Flow][google.cloud.dialogflow.cx.v3.Flow] to create an * [Version][google.cloud.dialogflow.cx.v3.Version] for. Format: `projects/<Project * ID>/locations/<Location ID>/agents/<Agent ID>/flows/<Flow ID>`. * @param version Required. The version to create. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ - @BetaApi( - "The surface for long-running operations is not stable yet and may change in the future.") public final OperationFuture createVersionAsync( String parent, Version version) { CreateVersionRequest request = @@ -459,101 +309,46 @@ public final OperationFuture createVers return createVersionAsync(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Creates a [Version][google.cloud.dialogflow.cx.v3.Version] in the specified * [Flow][google.cloud.dialogflow.cx.v3.Flow]. * - *

Sample code: - * - *


-   * try (VersionsClient versionsClient = VersionsClient.create()) {
-   *   FlowName parent = FlowName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]");
-   *   Version version = Version.newBuilder().build();
-   *   CreateVersionRequest request = CreateVersionRequest.newBuilder()
-   *     .setParent(parent.toString())
-   *     .setVersion(version)
-   *     .build();
-   *   Version response = versionsClient.createVersionAsync(request).get();
-   * }
-   * 
- * * @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 */ - @BetaApi( - "The surface for long-running operations is not stable yet and may change in the future.") public final OperationFuture createVersionAsync( CreateVersionRequest request) { return createVersionOperationCallable().futureCall(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Creates a [Version][google.cloud.dialogflow.cx.v3.Version] in the specified * [Flow][google.cloud.dialogflow.cx.v3.Flow]. * *

Sample code: - * - *


-   * try (VersionsClient versionsClient = VersionsClient.create()) {
-   *   FlowName parent = FlowName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]");
-   *   Version version = Version.newBuilder().build();
-   *   CreateVersionRequest request = CreateVersionRequest.newBuilder()
-   *     .setParent(parent.toString())
-   *     .setVersion(version)
-   *     .build();
-   *   OperationFuture<Version, CreateVersionOperationMetadata> future = versionsClient.createVersionOperationCallable().futureCall(request);
-   *   // Do something
-   *   Version response = future.get();
-   * }
-   * 
*/ - @BetaApi("The surface for use by generated code is not stable yet and may change in the future.") public final OperationCallable createVersionOperationCallable() { return stub.createVersionOperationCallable(); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Creates a [Version][google.cloud.dialogflow.cx.v3.Version] in the specified * [Flow][google.cloud.dialogflow.cx.v3.Flow]. * *

Sample code: - * - *


-   * try (VersionsClient versionsClient = VersionsClient.create()) {
-   *   FlowName parent = FlowName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]");
-   *   Version version = Version.newBuilder().build();
-   *   CreateVersionRequest request = CreateVersionRequest.newBuilder()
-   *     .setParent(parent.toString())
-   *     .setVersion(version)
-   *     .build();
-   *   ApiFuture<Operation> future = versionsClient.createVersionCallable().futureCall(request);
-   *   // Do something
-   *   Operation response = future.get();
-   * }
-   * 
*/ public final UnaryCallable createVersionCallable() { return stub.createVersionCallable(); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Updates the specified [Version][google.cloud.dialogflow.cx.v3.Version]. * - *

Sample code: - * - *


-   * try (VersionsClient versionsClient = VersionsClient.create()) {
-   *   Version version = Version.newBuilder().build();
-   *   FieldMask updateMask = FieldMask.newBuilder().build();
-   *   Version response = versionsClient.updateVersion(version, updateMask);
-   * }
-   * 
- * * @param version Required. The version to update. * @param updateMask Required. The mask to control which fields get updated. Currently only * `description` and `display_name` can be updated. @@ -565,24 +360,10 @@ public final Version updateVersion(Version version, FieldMask updateMask) { return updateVersion(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Updates the specified [Version][google.cloud.dialogflow.cx.v3.Version]. * - *

Sample code: - * - *


-   * try (VersionsClient versionsClient = VersionsClient.create()) {
-   *   Version version = Version.newBuilder().build();
-   *   FieldMask updateMask = FieldMask.newBuilder().build();
-   *   UpdateVersionRequest request = UpdateVersionRequest.newBuilder()
-   *     .setVersion(version)
-   *     .setUpdateMask(updateMask)
-   *     .build();
-   *   Version response = versionsClient.updateVersion(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 */ @@ -590,43 +371,20 @@ public final Version updateVersion(UpdateVersionRequest request) { return updateVersionCallable().call(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Updates the specified [Version][google.cloud.dialogflow.cx.v3.Version]. * *

Sample code: - * - *


-   * try (VersionsClient versionsClient = VersionsClient.create()) {
-   *   Version version = Version.newBuilder().build();
-   *   FieldMask updateMask = FieldMask.newBuilder().build();
-   *   UpdateVersionRequest request = UpdateVersionRequest.newBuilder()
-   *     .setVersion(version)
-   *     .setUpdateMask(updateMask)
-   *     .build();
-   *   ApiFuture<Version> future = versionsClient.updateVersionCallable().futureCall(request);
-   *   // Do something
-   *   Version response = future.get();
-   * }
-   * 
*/ public final UnaryCallable updateVersionCallable() { return stub.updateVersionCallable(); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Deletes the specified [Version][google.cloud.dialogflow.cx.v3.Version]. * - *

Sample code: - * - *


-   * try (VersionsClient versionsClient = VersionsClient.create()) {
-   *   VersionName name = VersionName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]", "[VERSION]");
-   *   versionsClient.deleteVersion(name);
-   * }
-   * 
- * * @param name Required. The name of the [Version][google.cloud.dialogflow.cx.v3.Version] to * delete. Format: `projects/<Project ID>/locations/<Location ID>/agents/<Agent * ID>/flows/<Flow ID>/versions/<Version ID>`. @@ -638,19 +396,10 @@ public final void deleteVersion(VersionName name) { deleteVersion(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Deletes the specified [Version][google.cloud.dialogflow.cx.v3.Version]. * - *

Sample code: - * - *


-   * try (VersionsClient versionsClient = VersionsClient.create()) {
-   *   VersionName name = VersionName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]", "[VERSION]");
-   *   versionsClient.deleteVersion(name.toString());
-   * }
-   * 
- * * @param name Required. The name of the [Version][google.cloud.dialogflow.cx.v3.Version] to * delete. Format: `projects/<Project ID>/locations/<Location ID>/agents/<Agent * ID>/flows/<Flow ID>/versions/<Version ID>`. @@ -661,22 +410,10 @@ public final void deleteVersion(String name) { deleteVersion(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Deletes the specified [Version][google.cloud.dialogflow.cx.v3.Version]. * - *

Sample code: - * - *


-   * try (VersionsClient versionsClient = VersionsClient.create()) {
-   *   VersionName name = VersionName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]", "[VERSION]");
-   *   DeleteVersionRequest request = DeleteVersionRequest.newBuilder()
-   *     .setName(name.toString())
-   *     .build();
-   *   versionsClient.deleteVersion(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 */ @@ -684,144 +421,71 @@ public final void deleteVersion(DeleteVersionRequest request) { deleteVersionCallable().call(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Deletes the specified [Version][google.cloud.dialogflow.cx.v3.Version]. * *

Sample code: - * - *


-   * try (VersionsClient versionsClient = VersionsClient.create()) {
-   *   VersionName name = VersionName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]", "[VERSION]");
-   *   DeleteVersionRequest request = DeleteVersionRequest.newBuilder()
-   *     .setName(name.toString())
-   *     .build();
-   *   ApiFuture<Void> future = versionsClient.deleteVersionCallable().futureCall(request);
-   *   // Do something
-   *   future.get();
-   * }
-   * 
*/ public final UnaryCallable deleteVersionCallable() { return stub.deleteVersionCallable(); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Loads a specified version to draft version. * - *

Sample code: - * - *


-   * try (VersionsClient versionsClient = VersionsClient.create()) {
-   *   VersionName name = VersionName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]", "[VERSION]");
-   *   versionsClient.loadVersionAsync(name).get();
-   * }
-   * 
- * * @param name Required. The [Version][google.cloud.dialogflow.cx.v3.Version] to be loaded to * draft version. Format: `projects/<Project ID>/locations/<Location * ID>/agents/<Agent ID>/flows/<Flow ID>/versions/<Version ID>`. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ - @BetaApi( - "The surface for long-running operations is not stable yet and may change in the future.") public final OperationFuture loadVersionAsync(VersionName name) { LoadVersionRequest request = LoadVersionRequest.newBuilder().setName(name == null ? null : name.toString()).build(); return loadVersionAsync(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Loads a specified version to draft version. * - *

Sample code: - * - *


-   * try (VersionsClient versionsClient = VersionsClient.create()) {
-   *   VersionName name = VersionName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]", "[VERSION]");
-   *   versionsClient.loadVersionAsync(name.toString()).get();
-   * }
-   * 
- * * @param name Required. The [Version][google.cloud.dialogflow.cx.v3.Version] to be loaded to * draft version. Format: `projects/<Project ID>/locations/<Location * ID>/agents/<Agent ID>/flows/<Flow ID>/versions/<Version ID>`. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ - @BetaApi( - "The surface for long-running operations is not stable yet and may change in the future.") public final OperationFuture loadVersionAsync(String name) { LoadVersionRequest request = LoadVersionRequest.newBuilder().setName(name).build(); return loadVersionAsync(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Loads a specified version to draft version. * - *

Sample code: - * - *


-   * try (VersionsClient versionsClient = VersionsClient.create()) {
-   *   VersionName name = VersionName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]", "[VERSION]");
-   *   LoadVersionRequest request = LoadVersionRequest.newBuilder()
-   *     .setName(name.toString())
-   *     .build();
-   *   versionsClient.loadVersionAsync(request).get();
-   * }
-   * 
- * * @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 */ - @BetaApi( - "The surface for long-running operations is not stable yet and may change in the future.") public final OperationFuture loadVersionAsync(LoadVersionRequest request) { return loadVersionOperationCallable().futureCall(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Loads a specified version to draft version. * *

Sample code: - * - *


-   * try (VersionsClient versionsClient = VersionsClient.create()) {
-   *   VersionName name = VersionName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]", "[VERSION]");
-   *   LoadVersionRequest request = LoadVersionRequest.newBuilder()
-   *     .setName(name.toString())
-   *     .build();
-   *   OperationFuture<Empty, Struct> future = versionsClient.loadVersionOperationCallable().futureCall(request);
-   *   // Do something
-   *   future.get();
-   * }
-   * 
*/ - @BetaApi("The surface for use by generated code is not stable yet and may change in the future.") public final OperationCallable loadVersionOperationCallable() { return stub.loadVersionOperationCallable(); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Loads a specified version to draft version. * *

Sample code: - * - *


-   * try (VersionsClient versionsClient = VersionsClient.create()) {
-   *   VersionName name = VersionName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]", "[VERSION]");
-   *   LoadVersionRequest request = LoadVersionRequest.newBuilder()
-   *     .setName(name.toString())
-   *     .build();
-   *   ApiFuture<Operation> future = versionsClient.loadVersionCallable().futureCall(request);
-   *   // Do something
-   *   future.get();
-   * }
-   * 
*/ public final UnaryCallable loadVersionCallable() { return stub.loadVersionCallable(); diff --git a/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3/VersionsSettings.java b/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3/VersionsSettings.java index 38cf3ae3a..97f949903 100644 --- a/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3/VersionsSettings.java +++ b/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3/VersionsSettings.java @@ -5,7 +5,7 @@ * 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 + * 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, @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.google.cloud.dialogflow.cx.v3; import static com.google.cloud.dialogflow.cx.v3.VersionsClient.ListVersionsPagedResponse; @@ -37,7 +38,7 @@ import java.util.List; import javax.annotation.Generated; -// AUTO-GENERATED DOCUMENTATION AND CLASS +// AUTO-GENERATED DOCUMENTATION AND CLASS. /** * Settings class to configure an instance of {@link VersionsClient}. * @@ -54,22 +55,23 @@ * *

For example, to set the total timeout of getVersion to 30 seconds: * - *

- * 
- * VersionsSettings.Builder versionsSettingsBuilder =
- *     VersionsSettings.newBuilder();
+ * 
{@code
+ * VersionsSettings.Builder versionsSettingsBuilder = VersionsSettings.newBuilder();
  * versionsSettingsBuilder
  *     .getVersionSettings()
  *     .setRetrySettings(
- *         versionsSettingsBuilder.getVersionSettings().getRetrySettings().toBuilder()
+ *         versionsSettingsBuilder
+ *             .getVersionSettings()
+ *             .getRetrySettings()
+ *             .toBuilder()
  *             .setTotalTimeout(Duration.ofSeconds(30))
  *             .build());
  * VersionsSettings versionsSettings = versionsSettingsBuilder.build();
- * 
- * 
+ * }
*/ -@Generated("by gapic-generator") +@Generated("by gapic-generator-java") public class VersionsSettings extends ClientSettings { + /** Returns the object with the settings used for calls to listVersions. */ public PagedCallSettings listVersionsSettings() { @@ -87,8 +89,6 @@ public UnaryCallSettings createVersionSettings( } /** Returns the object with the settings used for calls to createVersion. */ - @BetaApi( - "The surface for long-running operations is not stable yet and may change in the future.") public OperationCallSettings createVersionOperationSettings() { return ((VersionsStubSettings) getStubSettings()).createVersionOperationSettings(); @@ -110,8 +110,6 @@ public UnaryCallSettings loadVersionSettings() { } /** Returns the object with the settings used for calls to loadVersion. */ - @BetaApi( - "The surface for long-running operations is not stable yet and may change in the future.") public OperationCallSettings loadVersionOperationSettings() { return ((VersionsStubSettings) getStubSettings()).loadVersionOperationSettings(); } @@ -175,18 +173,15 @@ protected VersionsSettings(Builder settingsBuilder) throws IOException { /** Builder for VersionsSettings. */ public static class Builder extends ClientSettings.Builder { + protected Builder() throws IOException { - this((ClientContext) null); + this(((ClientContext) null)); } protected Builder(ClientContext clientContext) { super(VersionsStubSettings.newBuilder(clientContext)); } - private static Builder createDefault() { - return new Builder(VersionsStubSettings.newBuilder()); - } - protected Builder(VersionsSettings settings) { super(settings.getStubSettings().toBuilder()); } @@ -195,11 +190,15 @@ protected Builder(VersionsStubSettings.Builder stubSettings) { super(stubSettings); } + private static Builder createDefault() { + return new Builder(VersionsStubSettings.newBuilder()); + } + public VersionsStubSettings.Builder getStubSettingsBuilder() { return ((VersionsStubSettings.Builder) getStubSettings()); } - // NEXT_MAJOR_VER: remove 'throws Exception' + // NEXT_MAJOR_VER: remove 'throws Exception'. /** * Applies the given settings updater function to all of the unary API methods in this service. * @@ -230,8 +229,6 @@ public UnaryCallSettings.Builder createVersionS } /** Returns the builder for the settings used for calls to createVersion. */ - @BetaApi( - "The surface for long-running operations is not stable yet and may change in the future.") public OperationCallSettings.Builder< CreateVersionRequest, Version, CreateVersionOperationMetadata> createVersionOperationSettings() { @@ -254,8 +251,6 @@ public UnaryCallSettings.Builder loadVersionSetti } /** Returns the builder for the settings used for calls to loadVersion. */ - @BetaApi( - "The surface for long-running operations is not stable yet and may change in the future.") public OperationCallSettings.Builder loadVersionOperationSettings() { return getStubSettingsBuilder().loadVersionOperationSettings(); diff --git a/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3/WebhooksClient.java b/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3/WebhooksClient.java index 866ef77f1..ae19f0602 100644 --- a/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3/WebhooksClient.java +++ b/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3/WebhooksClient.java @@ -5,7 +5,7 @@ * 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 + * 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, @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.google.cloud.dialogflow.cx.v3; import com.google.api.core.ApiFunction; @@ -35,23 +36,14 @@ import java.util.concurrent.TimeUnit; import javax.annotation.Generated; -// AUTO-GENERATED DOCUMENTATION AND SERVICE +// AUTO-GENERATED DOCUMENTATION AND CLASS. /** * Service Description: Service for managing [Webhooks][google.cloud.dialogflow.cx.v3.Webhook]. * *

This class provides the ability to make remote calls to the backing service through method * calls that map to API methods. Sample code to get started: * - *

- * 
- * try (WebhooksClient webhooksClient = WebhooksClient.create()) {
- *   WebhookName name = WebhookName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[WEBHOOK]");
- *   Webhook response = webhooksClient.getWebhook(name);
- * }
- * 
- * 
- * - *

Note: close() needs to be called on the webhooksClient object to clean up resources such as + *

Note: close() needs to be called on the WebhooksClient object to clean up resources such as * threads. In the example above, try-with-resources is used, which automatically calls close(). * *

The surface of this class includes several types of Java methods for each of the API's @@ -79,28 +71,25 @@ * *

To customize credentials: * - *

- * 
+ * 
{@code
  * WebhooksSettings webhooksSettings =
  *     WebhooksSettings.newBuilder()
  *         .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
  *         .build();
- * WebhooksClient webhooksClient =
- *     WebhooksClient.create(webhooksSettings);
- * 
- * 
+ * WebhooksClient webhooksClient = WebhooksClient.create(webhooksSettings); + * }
* - * To customize the endpoint: + *

To customize the endpoint: * - *

- * 
+ * 
{@code
  * WebhooksSettings webhooksSettings =
  *     WebhooksSettings.newBuilder().setEndpoint(myEndpoint).build();
- * WebhooksClient webhooksClient =
- *     WebhooksClient.create(webhooksSettings);
- * 
- * 
+ * WebhooksClient webhooksClient = WebhooksClient.create(webhooksSettings); + * }
+ * + *

Please refer to the GitHub repository's samples for more quickstart code snippets. */ +@BetaApi @Generated("by gapic-generator") public class WebhooksClient implements BackgroundResource { private final WebhooksSettings settings; @@ -121,7 +110,7 @@ public static final WebhooksClient create(WebhooksSettings settings) throws IOEx /** * Constructs an instance of WebhooksClient, using the given stub for making calls. This is for - * advanced usage - prefer to use WebhooksSettings}. + * advanced usage - prefer using create(WebhooksSettings). */ @BetaApi("A restructuring of stub classes is planned, so this may break in the future") public static final WebhooksClient create(WebhooksStub stub) { @@ -152,21 +141,10 @@ public WebhooksStub getStub() { return stub; } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Returns the list of all webhooks in the specified agent. * - *

Sample code: - * - *


-   * try (WebhooksClient webhooksClient = WebhooksClient.create()) {
-   *   AgentName parent = AgentName.of("[PROJECT]", "[LOCATION]", "[AGENT]");
-   *   for (Webhook element : webhooksClient.listWebhooks(parent).iterateAll()) {
-   *     // doThingsWith(element);
-   *   }
-   * }
-   * 
- * * @param parent Required. The agent to list all webhooks for. Format: `projects/<Project * ID>/locations/<Location ID>/agents/<Agent ID>`. * @throws com.google.api.gax.rpc.ApiException if the remote call fails @@ -179,21 +157,10 @@ public final ListWebhooksPagedResponse listWebhooks(AgentName parent) { return listWebhooks(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Returns the list of all webhooks in the specified agent. * - *

Sample code: - * - *


-   * try (WebhooksClient webhooksClient = WebhooksClient.create()) {
-   *   AgentName parent = AgentName.of("[PROJECT]", "[LOCATION]", "[AGENT]");
-   *   for (Webhook element : webhooksClient.listWebhooks(parent.toString()).iterateAll()) {
-   *     // doThingsWith(element);
-   *   }
-   * }
-   * 
- * * @param parent Required. The agent to list all webhooks for. Format: `projects/<Project * ID>/locations/<Location ID>/agents/<Agent ID>`. * @throws com.google.api.gax.rpc.ApiException if the remote call fails @@ -203,24 +170,10 @@ public final ListWebhooksPagedResponse listWebhooks(String parent) { return listWebhooks(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Returns the list of all webhooks in the specified agent. * - *

Sample code: - * - *


-   * try (WebhooksClient webhooksClient = WebhooksClient.create()) {
-   *   AgentName parent = AgentName.of("[PROJECT]", "[LOCATION]", "[AGENT]");
-   *   ListWebhooksRequest request = ListWebhooksRequest.newBuilder()
-   *     .setParent(parent.toString())
-   *     .build();
-   *   for (Webhook element : webhooksClient.listWebhooks(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 */ @@ -228,75 +181,31 @@ public final ListWebhooksPagedResponse listWebhooks(ListWebhooksRequest request) return listWebhooksPagedCallable().call(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Returns the list of all webhooks in the specified agent. * *

Sample code: - * - *


-   * try (WebhooksClient webhooksClient = WebhooksClient.create()) {
-   *   AgentName parent = AgentName.of("[PROJECT]", "[LOCATION]", "[AGENT]");
-   *   ListWebhooksRequest request = ListWebhooksRequest.newBuilder()
-   *     .setParent(parent.toString())
-   *     .build();
-   *   ApiFuture<ListWebhooksPagedResponse> future = webhooksClient.listWebhooksPagedCallable().futureCall(request);
-   *   // Do something
-   *   for (Webhook element : future.get().iterateAll()) {
-   *     // doThingsWith(element);
-   *   }
-   * }
-   * 
*/ public final UnaryCallable listWebhooksPagedCallable() { return stub.listWebhooksPagedCallable(); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Returns the list of all webhooks in the specified agent. * *

Sample code: - * - *


-   * try (WebhooksClient webhooksClient = WebhooksClient.create()) {
-   *   AgentName parent = AgentName.of("[PROJECT]", "[LOCATION]", "[AGENT]");
-   *   ListWebhooksRequest request = ListWebhooksRequest.newBuilder()
-   *     .setParent(parent.toString())
-   *     .build();
-   *   while (true) {
-   *     ListWebhooksResponse response = webhooksClient.listWebhooksCallable().call(request);
-   *     for (Webhook element : response.getWebhooksList()) {
-   *       // doThingsWith(element);
-   *     }
-   *     String nextPageToken = response.getNextPageToken();
-   *     if (!Strings.isNullOrEmpty(nextPageToken)) {
-   *       request = request.toBuilder().setPageToken(nextPageToken).build();
-   *     } else {
-   *       break;
-   *     }
-   *   }
-   * }
-   * 
*/ public final UnaryCallable listWebhooksCallable() { return stub.listWebhooksCallable(); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Retrieves the specified webhook. * - *

Sample code: - * - *


-   * try (WebhooksClient webhooksClient = WebhooksClient.create()) {
-   *   WebhookName name = WebhookName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[WEBHOOK]");
-   *   Webhook response = webhooksClient.getWebhook(name);
-   * }
-   * 
- * * @param name Required. The name of the webhook. Format: `projects/<Project * ID>/locations/<Location ID>/agents/<Agent ID>/webhooks/<Webhook ID>`. * @throws com.google.api.gax.rpc.ApiException if the remote call fails @@ -307,19 +216,10 @@ public final Webhook getWebhook(WebhookName name) { return getWebhook(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Retrieves the specified webhook. * - *

Sample code: - * - *


-   * try (WebhooksClient webhooksClient = WebhooksClient.create()) {
-   *   WebhookName name = WebhookName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[WEBHOOK]");
-   *   Webhook response = webhooksClient.getWebhook(name.toString());
-   * }
-   * 
- * * @param name Required. The name of the webhook. Format: `projects/<Project * ID>/locations/<Location ID>/agents/<Agent ID>/webhooks/<Webhook ID>`. * @throws com.google.api.gax.rpc.ApiException if the remote call fails @@ -329,22 +229,10 @@ public final Webhook getWebhook(String name) { return getWebhook(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Retrieves the specified webhook. * - *

Sample code: - * - *


-   * try (WebhooksClient webhooksClient = WebhooksClient.create()) {
-   *   WebhookName name = WebhookName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[WEBHOOK]");
-   *   GetWebhookRequest request = GetWebhookRequest.newBuilder()
-   *     .setName(name.toString())
-   *     .build();
-   *   Webhook response = webhooksClient.getWebhook(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 */ @@ -352,42 +240,20 @@ public final Webhook getWebhook(GetWebhookRequest request) { return getWebhookCallable().call(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Retrieves the specified webhook. * *

Sample code: - * - *


-   * try (WebhooksClient webhooksClient = WebhooksClient.create()) {
-   *   WebhookName name = WebhookName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[WEBHOOK]");
-   *   GetWebhookRequest request = GetWebhookRequest.newBuilder()
-   *     .setName(name.toString())
-   *     .build();
-   *   ApiFuture<Webhook> future = webhooksClient.getWebhookCallable().futureCall(request);
-   *   // Do something
-   *   Webhook response = future.get();
-   * }
-   * 
*/ public final UnaryCallable getWebhookCallable() { return stub.getWebhookCallable(); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Creates a webhook in the specified agent. * - *

Sample code: - * - *


-   * try (WebhooksClient webhooksClient = WebhooksClient.create()) {
-   *   AgentName parent = AgentName.of("[PROJECT]", "[LOCATION]", "[AGENT]");
-   *   Webhook webhook = Webhook.newBuilder().build();
-   *   Webhook response = webhooksClient.createWebhook(parent, webhook);
-   * }
-   * 
- * * @param parent Required. The agent to create a webhook for. Format: `projects/<Project * ID>/locations/<Location ID>/agents/<Agent ID>`. * @param webhook Required. The webhook to create. @@ -402,20 +268,10 @@ public final Webhook createWebhook(AgentName parent, Webhook webhook) { return createWebhook(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Creates a webhook in the specified agent. * - *

Sample code: - * - *


-   * try (WebhooksClient webhooksClient = WebhooksClient.create()) {
-   *   AgentName parent = AgentName.of("[PROJECT]", "[LOCATION]", "[AGENT]");
-   *   Webhook webhook = Webhook.newBuilder().build();
-   *   Webhook response = webhooksClient.createWebhook(parent.toString(), webhook);
-   * }
-   * 
- * * @param parent Required. The agent to create a webhook for. Format: `projects/<Project * ID>/locations/<Location ID>/agents/<Agent ID>`. * @param webhook Required. The webhook to create. @@ -427,24 +283,10 @@ public final Webhook createWebhook(String parent, Webhook webhook) { return createWebhook(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Creates a webhook in the specified agent. * - *

Sample code: - * - *


-   * try (WebhooksClient webhooksClient = WebhooksClient.create()) {
-   *   AgentName parent = AgentName.of("[PROJECT]", "[LOCATION]", "[AGENT]");
-   *   Webhook webhook = Webhook.newBuilder().build();
-   *   CreateWebhookRequest request = CreateWebhookRequest.newBuilder()
-   *     .setParent(parent.toString())
-   *     .setWebhook(webhook)
-   *     .build();
-   *   Webhook response = webhooksClient.createWebhook(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 */ @@ -452,44 +294,20 @@ public final Webhook createWebhook(CreateWebhookRequest request) { return createWebhookCallable().call(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Creates a webhook in the specified agent. * *

Sample code: - * - *


-   * try (WebhooksClient webhooksClient = WebhooksClient.create()) {
-   *   AgentName parent = AgentName.of("[PROJECT]", "[LOCATION]", "[AGENT]");
-   *   Webhook webhook = Webhook.newBuilder().build();
-   *   CreateWebhookRequest request = CreateWebhookRequest.newBuilder()
-   *     .setParent(parent.toString())
-   *     .setWebhook(webhook)
-   *     .build();
-   *   ApiFuture<Webhook> future = webhooksClient.createWebhookCallable().futureCall(request);
-   *   // Do something
-   *   Webhook response = future.get();
-   * }
-   * 
*/ public final UnaryCallable createWebhookCallable() { return stub.createWebhookCallable(); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Updates the specified webhook. * - *

Sample code: - * - *


-   * try (WebhooksClient webhooksClient = WebhooksClient.create()) {
-   *   Webhook webhook = Webhook.newBuilder().build();
-   *   FieldMask updateMask = FieldMask.newBuilder().build();
-   *   Webhook response = webhooksClient.updateWebhook(webhook, updateMask);
-   * }
-   * 
- * * @param webhook Required. The webhook to update. * @param updateMask The mask to control which fields get updated. If the mask is not present, all * fields will be updated. @@ -501,22 +319,10 @@ public final Webhook updateWebhook(Webhook webhook, FieldMask updateMask) { return updateWebhook(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Updates the specified webhook. * - *

Sample code: - * - *


-   * try (WebhooksClient webhooksClient = WebhooksClient.create()) {
-   *   Webhook webhook = Webhook.newBuilder().build();
-   *   UpdateWebhookRequest request = UpdateWebhookRequest.newBuilder()
-   *     .setWebhook(webhook)
-   *     .build();
-   *   Webhook response = webhooksClient.updateWebhook(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 */ @@ -524,41 +330,20 @@ public final Webhook updateWebhook(UpdateWebhookRequest request) { return updateWebhookCallable().call(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Updates the specified webhook. * *

Sample code: - * - *


-   * try (WebhooksClient webhooksClient = WebhooksClient.create()) {
-   *   Webhook webhook = Webhook.newBuilder().build();
-   *   UpdateWebhookRequest request = UpdateWebhookRequest.newBuilder()
-   *     .setWebhook(webhook)
-   *     .build();
-   *   ApiFuture<Webhook> future = webhooksClient.updateWebhookCallable().futureCall(request);
-   *   // Do something
-   *   Webhook response = future.get();
-   * }
-   * 
*/ public final UnaryCallable updateWebhookCallable() { return stub.updateWebhookCallable(); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Deletes the specified webhook. * - *

Sample code: - * - *


-   * try (WebhooksClient webhooksClient = WebhooksClient.create()) {
-   *   WebhookName name = WebhookName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[WEBHOOK]");
-   *   webhooksClient.deleteWebhook(name);
-   * }
-   * 
- * * @param name Required. The name of the webhook to delete. Format: `projects/<Project * ID>/locations/<Location ID>/agents/<Agent ID>/webhooks/<Webhook ID>`. * @throws com.google.api.gax.rpc.ApiException if the remote call fails @@ -569,19 +354,10 @@ public final void deleteWebhook(WebhookName name) { deleteWebhook(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Deletes the specified webhook. * - *

Sample code: - * - *


-   * try (WebhooksClient webhooksClient = WebhooksClient.create()) {
-   *   WebhookName name = WebhookName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[WEBHOOK]");
-   *   webhooksClient.deleteWebhook(name.toString());
-   * }
-   * 
- * * @param name Required. The name of the webhook to delete. Format: `projects/<Project * ID>/locations/<Location ID>/agents/<Agent ID>/webhooks/<Webhook ID>`. * @throws com.google.api.gax.rpc.ApiException if the remote call fails @@ -591,22 +367,10 @@ public final void deleteWebhook(String name) { deleteWebhook(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Deletes the specified webhook. * - *

Sample code: - * - *


-   * try (WebhooksClient webhooksClient = WebhooksClient.create()) {
-   *   WebhookName name = WebhookName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[WEBHOOK]");
-   *   DeleteWebhookRequest request = DeleteWebhookRequest.newBuilder()
-   *     .setName(name.toString())
-   *     .build();
-   *   webhooksClient.deleteWebhook(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 */ @@ -614,23 +378,11 @@ public final void deleteWebhook(DeleteWebhookRequest request) { deleteWebhookCallable().call(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Deletes the specified webhook. * *

Sample code: - * - *


-   * try (WebhooksClient webhooksClient = WebhooksClient.create()) {
-   *   WebhookName name = WebhookName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[WEBHOOK]");
-   *   DeleteWebhookRequest request = DeleteWebhookRequest.newBuilder()
-   *     .setName(name.toString())
-   *     .build();
-   *   ApiFuture<Void> future = webhooksClient.deleteWebhookCallable().futureCall(request);
-   *   // Do something
-   *   future.get();
-   * }
-   * 
*/ public final UnaryCallable deleteWebhookCallable() { return stub.deleteWebhookCallable(); diff --git a/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3/WebhooksSettings.java b/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3/WebhooksSettings.java index 826a60f99..d16c59651 100644 --- a/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3/WebhooksSettings.java +++ b/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3/WebhooksSettings.java @@ -5,7 +5,7 @@ * 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 + * 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, @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.google.cloud.dialogflow.cx.v3; import static com.google.cloud.dialogflow.cx.v3.WebhooksClient.ListWebhooksPagedResponse; @@ -34,7 +35,7 @@ import java.util.List; import javax.annotation.Generated; -// AUTO-GENERATED DOCUMENTATION AND CLASS +// AUTO-GENERATED DOCUMENTATION AND CLASS. /** * Settings class to configure an instance of {@link WebhooksClient}. * @@ -51,22 +52,23 @@ * *

For example, to set the total timeout of getWebhook to 30 seconds: * - *

- * 
- * WebhooksSettings.Builder webhooksSettingsBuilder =
- *     WebhooksSettings.newBuilder();
+ * 
{@code
+ * WebhooksSettings.Builder webhooksSettingsBuilder = WebhooksSettings.newBuilder();
  * webhooksSettingsBuilder
  *     .getWebhookSettings()
  *     .setRetrySettings(
- *         webhooksSettingsBuilder.getWebhookSettings().getRetrySettings().toBuilder()
+ *         webhooksSettingsBuilder
+ *             .getWebhookSettings()
+ *             .getRetrySettings()
+ *             .toBuilder()
  *             .setTotalTimeout(Duration.ofSeconds(30))
  *             .build());
  * WebhooksSettings webhooksSettings = webhooksSettingsBuilder.build();
- * 
- * 
+ * }
*/ -@Generated("by gapic-generator") +@Generated("by gapic-generator-java") public class WebhooksSettings extends ClientSettings { + /** Returns the object with the settings used for calls to listWebhooks. */ public PagedCallSettings listWebhooksSettings() { @@ -152,18 +154,15 @@ protected WebhooksSettings(Builder settingsBuilder) throws IOException { /** Builder for WebhooksSettings. */ public static class Builder extends ClientSettings.Builder { + protected Builder() throws IOException { - this((ClientContext) null); + this(((ClientContext) null)); } protected Builder(ClientContext clientContext) { super(WebhooksStubSettings.newBuilder(clientContext)); } - private static Builder createDefault() { - return new Builder(WebhooksStubSettings.newBuilder()); - } - protected Builder(WebhooksSettings settings) { super(settings.getStubSettings().toBuilder()); } @@ -172,11 +171,15 @@ protected Builder(WebhooksStubSettings.Builder stubSettings) { super(stubSettings); } + private static Builder createDefault() { + return new Builder(WebhooksStubSettings.newBuilder()); + } + public WebhooksStubSettings.Builder getStubSettingsBuilder() { return ((WebhooksStubSettings.Builder) getStubSettings()); } - // NEXT_MAJOR_VER: remove 'throws Exception' + // NEXT_MAJOR_VER: remove 'throws Exception'. /** * Applies the given settings updater function to all of the unary API methods in this service. * diff --git a/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3/package-info.java b/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3/package-info.java index 5c34c1340..761ab736c 100644 --- a/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3/package-info.java +++ b/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3/package-info.java @@ -5,7 +5,7 @@ * 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 + * 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, @@ -15,136 +15,53 @@ */ /** - * A client to Dialogflow API. + * The interfaces provided are listed below, along with usage samples. * - *

The interfaces provided are listed below, along with usage samples. - * - *

=========== PagesClient =========== - * - *

Service Description: Service for managing [Pages][google.cloud.dialogflow.cx.v3.Page]. - * - *

Sample for PagesClient: - * - *

- * 
- * try (PagesClient pagesClient = PagesClient.create()) {
- *   PageName name = PageName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]", "[PAGE]");
- *   Page response = pagesClient.getPage(name);
- * }
- * 
- * 
- * - * =========== FlowsClient =========== - * - *

Service Description: Service for managing [Flows][google.cloud.dialogflow.cx.v3.Flow]. - * - *

Sample for FlowsClient: - * - *

- * 
- * try (FlowsClient flowsClient = FlowsClient.create()) {
- *   AgentName parent = AgentName.of("[PROJECT]", "[LOCATION]", "[AGENT]");
- *   Flow flow = Flow.newBuilder().build();
- *   Flow response = flowsClient.createFlow(parent, flow);
- * }
- * 
- * 
- * - * ============ AgentsClient ============ + *

======================= AgentsClient ======================= * *

Service Description: Service for managing [Agents][google.cloud.dialogflow.cx.v3.Agent]. * *

Sample for AgentsClient: * - *

- * 
- * try (AgentsClient agentsClient = AgentsClient.create()) {
- *   AgentName name = AgentName.of("[PROJECT]", "[LOCATION]", "[AGENT]");
- *   Agent response = agentsClient.getAgent(name);
- * }
- * 
- * 
- * - * ================= EntityTypesClient ================= + *

======================= EntityTypesClient ======================= * *

Service Description: Service for managing * [EntityTypes][google.cloud.dialogflow.cx.v3.EntityType]. * *

Sample for EntityTypesClient: * - *

- * 
- * try (EntityTypesClient entityTypesClient = EntityTypesClient.create()) {
- *   EntityTypeName name = EntityTypeName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[ENTITY_TYPE]");
- *   EntityType response = entityTypesClient.getEntityType(name);
- * }
- * 
- * 
- * - * ================== EnvironmentsClient ================== + *

======================= EnvironmentsClient ======================= * *

Service Description: Service for managing * [Environments][google.cloud.dialogflow.cx.v3.Environment]. * *

Sample for EnvironmentsClient: * - *

- * 
- * try (EnvironmentsClient environmentsClient = EnvironmentsClient.create()) {
- *   EnvironmentName name = EnvironmentName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[ENVIRONMENT]");
- *   Environment response = environmentsClient.getEnvironment(name);
- * }
- * 
- * 
+ *

======================= FlowsClient ======================= * - * ============= IntentsClient ============= - * - *

Service Description: Service for managing [Intents][google.cloud.dialogflow.cx.v3.Intent]. + *

Service Description: Service for managing [Flows][google.cloud.dialogflow.cx.v3.Flow]. * - *

Sample for IntentsClient: + *

Sample for FlowsClient: * - *

- * 
- * try (IntentsClient intentsClient = IntentsClient.create()) {
- *   IntentName name = IntentName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[INTENT]");
- *   Intent response = intentsClient.getIntent(name);
- * }
- * 
- * 
+ *

======================= IntentsClient ======================= * - * ============================= SecuritySettingsServiceClient ============================= + *

Service Description: Service for managing [Intents][google.cloud.dialogflow.cx.v3.Intent]. * - *

Service Description: Service for managing security settings for Dialogflow. + *

Sample for IntentsClient: * - *

Sample for SecuritySettingsServiceClient: + *

======================= PagesClient ======================= * - *

- * 
- * try (SecuritySettingsServiceClient securitySettingsServiceClient = SecuritySettingsServiceClient.create()) {
- *   LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
- *   SecuritySettings securitySettings = SecuritySettings.newBuilder().build();
- *   SecuritySettings response = securitySettingsServiceClient.createSecuritySettings(parent, securitySettings);
- * }
- * 
- * 
+ *

Service Description: Service for managing [Pages][google.cloud.dialogflow.cx.v3.Page]. * - * ======================== SessionEntityTypesClient ======================== + *

Sample for PagesClient: * - *

Service Description: Service for managing - * [SessionEntityTypes][google.cloud.dialogflow.cx.v3.SessionEntityType]. + *

======================= SecuritySettingsServiceClient ======================= * - *

Sample for SessionEntityTypesClient: + *

Service Description: Service for managing security settings for Dialogflow. * - *

- * 
- * try (SessionEntityTypesClient sessionEntityTypesClient = SessionEntityTypesClient.create()) {
- *   SessionEntityTypeName name = SessionEntityTypeName.ofProjectLocationAgentSessionEntityTypeName("[PROJECT]", "[LOCATION]", "[AGENT]", "[SESSION]", "[ENTITY_TYPE]");
- *   SessionEntityType response = sessionEntityTypesClient.getSessionEntityType(name);
- * }
- * 
- * 
+ *

Sample for SecuritySettingsServiceClient: * - * ============== SessionsClient ============== + *

======================= SessionsClient ======================= * *

Service Description: A session represents an interaction with a user. You retrieve user input * and pass it to the [DetectIntent][google.cloud.dialogflow.cx.v3.Sessions.DetectIntent] method to @@ -152,67 +69,33 @@ * *

Sample for SessionsClient: * - *

- * 
- * try (SessionsClient sessionsClient = SessionsClient.create()) {
- *   SessionName session = SessionName.ofProjectLocationAgentSessionName("[PROJECT]", "[LOCATION]", "[AGENT]", "[SESSION]");
- *   QueryInput queryInput = QueryInput.newBuilder().build();
- *   DetectIntentRequest request = DetectIntentRequest.newBuilder()
- *     .setSession(session.toString())
- *     .setQueryInput(queryInput)
- *     .build();
- *   DetectIntentResponse response = sessionsClient.detectIntent(request);
- * }
- * 
- * 
- * - * =========================== TransitionRouteGroupsClient =========================== + *

======================= SessionEntityTypesClient ======================= + * + *

Service Description: Service for managing + * [SessionEntityTypes][google.cloud.dialogflow.cx.v3.SessionEntityType]. + * + *

Sample for SessionEntityTypesClient: + * + *

======================= TransitionRouteGroupsClient ======================= * *

Service Description: Service for managing * [TransitionRouteGroups][google.cloud.dialogflow.cx.v3.TransitionRouteGroup]. * *

Sample for TransitionRouteGroupsClient: * - *

- * 
- * try (TransitionRouteGroupsClient transitionRouteGroupsClient = TransitionRouteGroupsClient.create()) {
- *   TransitionRouteGroupName name = TransitionRouteGroupName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]", "[TRANSITION_ROUTE_GROUP]");
- *   TransitionRouteGroup response = transitionRouteGroupsClient.getTransitionRouteGroup(name);
- * }
- * 
- * 
- * - * ============== VersionsClient ============== + *

======================= VersionsClient ======================= * *

Service Description: Service for managing [Versions][google.cloud.dialogflow.cx.v3.Version]. * *

Sample for VersionsClient: * - *

- * 
- * try (VersionsClient versionsClient = VersionsClient.create()) {
- *   VersionName name = VersionName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]", "[VERSION]");
- *   Version response = versionsClient.getVersion(name);
- * }
- * 
- * 
- * - * ============== WebhooksClient ============== + *

======================= WebhooksClient ======================= * *

Service Description: Service for managing [Webhooks][google.cloud.dialogflow.cx.v3.Webhook]. * *

Sample for WebhooksClient: - * - *

- * 
- * try (WebhooksClient webhooksClient = WebhooksClient.create()) {
- *   WebhookName name = WebhookName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[WEBHOOK]");
- *   Webhook response = webhooksClient.getWebhook(name);
- * }
- * 
- * 
*/ -@Generated("by gapic-generator") +@Generated("by gapic-generator-java") package com.google.cloud.dialogflow.cx.v3; import javax.annotation.Generated; diff --git a/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3/stub/AgentsStub.java b/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3/stub/AgentsStub.java index 17fc87869..df817663c 100644 --- a/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3/stub/AgentsStub.java +++ b/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3/stub/AgentsStub.java @@ -5,7 +5,7 @@ * 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 + * 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, @@ -13,11 +13,11 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.google.cloud.dialogflow.cx.v3.stub; import static com.google.cloud.dialogflow.cx.v3.AgentsClient.ListAgentsPagedResponse; -import com.google.api.core.BetaApi; import com.google.api.gax.core.BackgroundResource; import com.google.api.gax.rpc.OperationCallable; import com.google.api.gax.rpc.UnaryCallable; @@ -37,17 +37,15 @@ import com.google.protobuf.Struct; import javax.annotation.Generated; -// AUTO-GENERATED DOCUMENTATION AND CLASS +// AUTO-GENERATED DOCUMENTATION AND CLASS. /** - * Base stub class for Dialogflow API. + * Base stub class for the Agents service API. * *

This class is for advanced usage and reflects the underlying API directly. */ @Generated("by gapic-generator") -@BetaApi("A restructuring of stub classes is planned, so this may break in the future") public abstract class AgentsStub implements BackgroundResource { - @BetaApi("The surface for use by generated code is not stable yet and may change in the future.") public OperationsStub getOperationsStub() { throw new UnsupportedOperationException("Not implemented: getOperationsStub()"); } @@ -76,7 +74,6 @@ public UnaryCallable deleteAgentCallable() { throw new UnsupportedOperationException("Not implemented: deleteAgentCallable()"); } - @BetaApi("The surface for use by generated code is not stable yet and may change in the future.") public OperationCallable exportAgentOperationCallable() { throw new UnsupportedOperationException("Not implemented: exportAgentOperationCallable()"); @@ -86,7 +83,6 @@ public UnaryCallable exportAgentCallable() { throw new UnsupportedOperationException("Not implemented: exportAgentCallable()"); } - @BetaApi("The surface for use by generated code is not stable yet and may change in the future.") public OperationCallable restoreAgentOperationCallable() { throw new UnsupportedOperationException("Not implemented: restoreAgentOperationCallable()"); } diff --git a/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3/stub/AgentsStubSettings.java b/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3/stub/AgentsStubSettings.java index 972d76358..173f21d7b 100644 --- a/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3/stub/AgentsStubSettings.java +++ b/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3/stub/AgentsStubSettings.java @@ -5,7 +5,7 @@ * 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 + * 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, @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.google.cloud.dialogflow.cx.v3.stub; import static com.google.cloud.dialogflow.cx.v3.AgentsClient.ListAgentsPagedResponse; @@ -65,7 +66,7 @@ import javax.annotation.Generated; import org.threeten.bp.Duration; -// AUTO-GENERATED DOCUMENTATION AND CLASS +// AUTO-GENERATED DOCUMENTATION AND CLASS. /** * Settings class to configure an instance of {@link AgentsStub}. * @@ -82,21 +83,22 @@ * *

For example, to set the total timeout of getAgent to 30 seconds: * - *

- * 
- * AgentsStubSettings.Builder agentsSettingsBuilder =
- *     AgentsStubSettings.newBuilder();
+ * 
{@code
+ * AgentsStubSettings.Builder agentsSettingsBuilder = AgentsStubSettings.newBuilder();
  * agentsSettingsBuilder
  *     .getAgentSettings()
  *     .setRetrySettings(
- *         agentsSettingsBuilder.getAgentSettings().getRetrySettings().toBuilder()
+ *         agentsSettingsBuilder
+ *             .getAgentSettings()
+ *             .getRetrySettings()
+ *             .toBuilder()
  *             .setTotalTimeout(Duration.ofSeconds(30))
  *             .build());
  * AgentsStubSettings agentsSettings = agentsSettingsBuilder.build();
- * 
- * 
+ * }
*/ -@Generated("by gapic-generator") +@BetaApi +@Generated("by gapic-generator-java") public class AgentsStubSettings extends StubSettings { /** The default scopes of the service. */ private static final ImmutableList DEFAULT_SERVICE_SCOPES = @@ -118,6 +120,59 @@ public class AgentsStubSettings extends StubSettings { private final OperationCallSettings restoreAgentOperationSettings; + private static final PagedListDescriptor + LIST_AGENTS_PAGE_STR_DESC = + new PagedListDescriptor() { + @Override + public String emptyToken() { + return ""; + } + + @Override + public ListAgentsRequest injectToken(ListAgentsRequest payload, String token) { + return ListAgentsRequest.newBuilder(payload).setPageToken(token).build(); + } + + @Override + public ListAgentsRequest injectPageSize(ListAgentsRequest payload, int pageSize) { + return ListAgentsRequest.newBuilder(payload).setPageSize(pageSize).build(); + } + + @Override + public Integer extractPageSize(ListAgentsRequest payload) { + return payload.getPageSize(); + } + + @Override + public String extractNextToken(ListAgentsResponse payload) { + return payload.getNextPageToken(); + } + + @Override + public Iterable extractResources(ListAgentsResponse payload) { + return payload.getAgentsList() == null + ? ImmutableList.of() + : payload.getAgentsList(); + } + }; + + private static final PagedListResponseFactory< + ListAgentsRequest, ListAgentsResponse, ListAgentsPagedResponse> + LIST_AGENTS_PAGE_STR_FACT = + new PagedListResponseFactory< + ListAgentsRequest, ListAgentsResponse, ListAgentsPagedResponse>() { + @Override + public ApiFuture getFuturePagedResponse( + UnaryCallable callable, + ListAgentsRequest request, + ApiCallContext context, + ApiFuture futureResponse) { + PageContext pageContext = + PageContext.create(callable, LIST_AGENTS_PAGE_STR_DESC, request, context); + return ListAgentsPagedResponse.createAsync(pageContext, futureResponse); + } + }; + /** Returns the object with the settings used for calls to listAgents. */ public PagedCallSettings listAgentsSettings() { @@ -150,7 +205,6 @@ public UnaryCallSettings exportAgentSettings() { } /** Returns the object with the settings used for calls to exportAgent. */ - @BetaApi("The surface for use by generated code is not stable yet and may change in the future.") public OperationCallSettings exportAgentOperationSettings() { return exportAgentOperationSettings; @@ -162,7 +216,6 @@ public UnaryCallSettings restoreAgentSettings() } /** Returns the object with the settings used for calls to restoreAgent. */ - @BetaApi("The surface for use by generated code is not stable yet and may change in the future.") public OperationCallSettings restoreAgentOperationSettings() { return restoreAgentOperationSettings; } @@ -173,10 +226,10 @@ public AgentsStub createStub() throws IOException { .getTransportName() .equals(GrpcTransportChannel.getGrpcTransportName())) { return GrpcAgentsStub.create(this); - } else { - throw new UnsupportedOperationException( - "Transport not supported: " + getTransportChannelProvider().getTransportName()); } + throw new UnsupportedOperationException( + String.format( + "Transport not supported: %s", getTransportChannelProvider().getTransportName())); } /** Returns a builder for the default ExecutorProvider for this service. */ @@ -246,63 +299,9 @@ protected AgentsStubSettings(Builder settingsBuilder) throws IOException { restoreAgentOperationSettings = settingsBuilder.restoreAgentOperationSettings().build(); } - private static final PagedListDescriptor - LIST_AGENTS_PAGE_STR_DESC = - new PagedListDescriptor() { - @Override - public String emptyToken() { - return ""; - } - - @Override - public ListAgentsRequest injectToken(ListAgentsRequest payload, String token) { - return ListAgentsRequest.newBuilder(payload).setPageToken(token).build(); - } - - @Override - public ListAgentsRequest injectPageSize(ListAgentsRequest payload, int pageSize) { - return ListAgentsRequest.newBuilder(payload).setPageSize(pageSize).build(); - } - - @Override - public Integer extractPageSize(ListAgentsRequest payload) { - return payload.getPageSize(); - } - - @Override - public String extractNextToken(ListAgentsResponse payload) { - return payload.getNextPageToken(); - } - - @Override - public Iterable extractResources(ListAgentsResponse payload) { - return payload.getAgentsList() != null - ? payload.getAgentsList() - : ImmutableList.of(); - } - }; - - private static final PagedListResponseFactory< - ListAgentsRequest, ListAgentsResponse, ListAgentsPagedResponse> - LIST_AGENTS_PAGE_STR_FACT = - new PagedListResponseFactory< - ListAgentsRequest, ListAgentsResponse, ListAgentsPagedResponse>() { - @Override - public ApiFuture getFuturePagedResponse( - UnaryCallable callable, - ListAgentsRequest request, - ApiCallContext context, - ApiFuture futureResponse) { - PageContext pageContext = - PageContext.create(callable, LIST_AGENTS_PAGE_STR_DESC, request, context); - return ListAgentsPagedResponse.createAsync(pageContext, futureResponse); - } - }; - /** Builder for AgentsStubSettings. */ public static class Builder extends StubSettings.Builder { private final ImmutableList> unaryMethodSettingsBuilders; - private final PagedCallSettings.Builder< ListAgentsRequest, ListAgentsResponse, ListAgentsPagedResponse> listAgentsSettings; @@ -316,7 +315,6 @@ public static class Builder extends StubSettings.Builder restoreAgentSettings; private final OperationCallSettings.Builder restoreAgentOperationSettings; - private static final ImmutableMap> RETRYABLE_CODE_DEFINITIONS; @@ -324,14 +322,8 @@ public static class Builder extends StubSettings.Builder> definitions = ImmutableMap.builder(); definitions.put( - "retry_policy_1_codes", - ImmutableSet.copyOf(Lists.newArrayList(StatusCode.Code.UNAVAILABLE))); - definitions.put("no_retry_codes", ImmutableSet.copyOf(Lists.newArrayList())); - definitions.put( - "retry_policy_2_codes", + "retry_policy_0_codes", ImmutableSet.copyOf(Lists.newArrayList(StatusCode.Code.UNAVAILABLE))); - definitions.put( - "no_retry_1_codes", ImmutableSet.copyOf(Lists.newArrayList())); RETRYABLE_CODE_DEFINITIONS = definitions.build(); } @@ -350,54 +342,25 @@ public static class Builder extends StubSettings.Builder>of( + listAgentsSettings, + getAgentSettings, + createAgentSettings, + updateAgentSettings, + deleteAgentSettings, + exportAgentSettings, + restoreAgentSettings); + } + private static Builder createDefault() { - Builder builder = new Builder((ClientContext) null); + Builder builder = new Builder(((ClientContext) null)); + builder.setTransportChannelProvider(defaultTransportChannelProvider()); builder.setCredentialsProvider(defaultCredentialsProviderBuilder().build()); builder.setInternalHeaderProvider(defaultApiClientHeaderProviderBuilder().build()); builder.setEndpoint(getDefaultEndpoint()); + return initDefaults(builder); } private static Builder initDefaults(Builder builder) { - builder .listAgentsSettings() - .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_1_codes")) - .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_1_params")); + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params")); builder .getAgentSettings() - .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_1_codes")) - .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_1_params")); + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params")); builder .createAgentSettings() - .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_1_codes")) - .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_1_params")); + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params")); builder .updateAgentSettings() - .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_1_codes")) - .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_1_params")); + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params")); builder .deleteAgentSettings() - .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_1_codes")) - .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_1_params")); + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params")); builder .exportAgentSettings() - .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_1_codes")) - .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_1_params")); + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params")); builder .restoreAgentSettings() - .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_1_codes")) - .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_1_params")); + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params")); + builder .exportAgentOperationSettings() .setInitialCallSettings( UnaryCallSettings.newUnaryCallSettingsBuilder() - .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_1_codes")) - .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_1_params")) + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params")) .build()) .setResponseTransformer( ProtoOperationTransformers.ResponseTransformer.create(ExportAgentResponse.class)) @@ -472,21 +460,22 @@ private static Builder initDefaults(Builder builder) { .setPollingAlgorithm( OperationTimedPollAlgorithm.create( RetrySettings.newBuilder() - .setInitialRetryDelay(Duration.ofMillis(500L)) + .setInitialRetryDelay(Duration.ofMillis(5000L)) .setRetryDelayMultiplier(1.5) - .setMaxRetryDelay(Duration.ofMillis(5000L)) - .setInitialRpcTimeout(Duration.ZERO) // ignored - .setRpcTimeoutMultiplier(1.0) // ignored - .setMaxRpcTimeout(Duration.ZERO) // ignored + .setMaxRetryDelay(Duration.ofMillis(45000L)) + .setInitialRpcTimeout(Duration.ZERO) + .setRpcTimeoutMultiplier(1.0) + .setMaxRpcTimeout(Duration.ZERO) .setTotalTimeout(Duration.ofMillis(300000L)) .build())); + builder .restoreAgentOperationSettings() .setInitialCallSettings( UnaryCallSettings .newUnaryCallSettingsBuilder() - .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_1_codes")) - .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_1_params")) + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params")) .build()) .setResponseTransformer( ProtoOperationTransformers.ResponseTransformer.create(Empty.class)) @@ -495,43 +484,19 @@ private static Builder initDefaults(Builder builder) { .setPollingAlgorithm( OperationTimedPollAlgorithm.create( RetrySettings.newBuilder() - .setInitialRetryDelay(Duration.ofMillis(500L)) + .setInitialRetryDelay(Duration.ofMillis(5000L)) .setRetryDelayMultiplier(1.5) - .setMaxRetryDelay(Duration.ofMillis(5000L)) - .setInitialRpcTimeout(Duration.ZERO) // ignored - .setRpcTimeoutMultiplier(1.0) // ignored - .setMaxRpcTimeout(Duration.ZERO) // ignored + .setMaxRetryDelay(Duration.ofMillis(45000L)) + .setInitialRpcTimeout(Duration.ZERO) + .setRpcTimeoutMultiplier(1.0) + .setMaxRpcTimeout(Duration.ZERO) .setTotalTimeout(Duration.ofMillis(300000L)) .build())); return builder; } - protected Builder(AgentsStubSettings settings) { - super(settings); - - listAgentsSettings = settings.listAgentsSettings.toBuilder(); - getAgentSettings = settings.getAgentSettings.toBuilder(); - createAgentSettings = settings.createAgentSettings.toBuilder(); - updateAgentSettings = settings.updateAgentSettings.toBuilder(); - deleteAgentSettings = settings.deleteAgentSettings.toBuilder(); - exportAgentSettings = settings.exportAgentSettings.toBuilder(); - exportAgentOperationSettings = settings.exportAgentOperationSettings.toBuilder(); - restoreAgentSettings = settings.restoreAgentSettings.toBuilder(); - restoreAgentOperationSettings = settings.restoreAgentOperationSettings.toBuilder(); - - unaryMethodSettingsBuilders = - ImmutableList.>of( - listAgentsSettings, - getAgentSettings, - createAgentSettings, - updateAgentSettings, - deleteAgentSettings, - exportAgentSettings, - restoreAgentSettings); - } - - // NEXT_MAJOR_VER: remove 'throws Exception' + // NEXT_MAJOR_VER: remove 'throws Exception'. /** * Applies the given settings updater function to all of the unary API methods in this service. * diff --git a/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3/stub/EntityTypesStub.java b/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3/stub/EntityTypesStub.java index 8ac55ce43..7d5e24b79 100644 --- a/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3/stub/EntityTypesStub.java +++ b/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3/stub/EntityTypesStub.java @@ -5,7 +5,7 @@ * 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 + * 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, @@ -13,11 +13,11 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.google.cloud.dialogflow.cx.v3.stub; import static com.google.cloud.dialogflow.cx.v3.EntityTypesClient.ListEntityTypesPagedResponse; -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.cx.v3.CreateEntityTypeRequest; @@ -30,14 +30,13 @@ import com.google.protobuf.Empty; import javax.annotation.Generated; -// AUTO-GENERATED DOCUMENTATION AND CLASS +// AUTO-GENERATED DOCUMENTATION AND CLASS. /** - * Base stub class for Dialogflow API. + * Base stub class for the EntityTypes service API. * *

This class is for advanced usage and reflects the underlying API directly. */ @Generated("by gapic-generator") -@BetaApi("A restructuring of stub classes is planned, so this may break in the future") public abstract class EntityTypesStub implements BackgroundResource { public UnaryCallable diff --git a/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3/stub/EntityTypesStubSettings.java b/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3/stub/EntityTypesStubSettings.java index ac312fea5..1e2472785 100644 --- a/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3/stub/EntityTypesStubSettings.java +++ b/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3/stub/EntityTypesStubSettings.java @@ -5,7 +5,7 @@ * 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 + * 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, @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.google.cloud.dialogflow.cx.v3.stub; import static com.google.cloud.dialogflow.cx.v3.EntityTypesClient.ListEntityTypesPagedResponse; @@ -56,7 +57,7 @@ import javax.annotation.Generated; import org.threeten.bp.Duration; -// AUTO-GENERATED DOCUMENTATION AND CLASS +// AUTO-GENERATED DOCUMENTATION AND CLASS. /** * Settings class to configure an instance of {@link EntityTypesStub}. * @@ -73,21 +74,23 @@ * *

For example, to set the total timeout of getEntityType to 30 seconds: * - *

- * 
+ * 
{@code
  * EntityTypesStubSettings.Builder entityTypesSettingsBuilder =
  *     EntityTypesStubSettings.newBuilder();
  * entityTypesSettingsBuilder
  *     .getEntityTypeSettings()
  *     .setRetrySettings(
- *         entityTypesSettingsBuilder.getEntityTypeSettings().getRetrySettings().toBuilder()
+ *         entityTypesSettingsBuilder
+ *             .getEntityTypeSettings()
+ *             .getRetrySettings()
+ *             .toBuilder()
  *             .setTotalTimeout(Duration.ofSeconds(30))
  *             .build());
  * EntityTypesStubSettings entityTypesSettings = entityTypesSettingsBuilder.build();
- * 
- * 
+ * }
*/ -@Generated("by gapic-generator") +@BetaApi +@Generated("by gapic-generator-java") public class EntityTypesStubSettings extends StubSettings { /** The default scopes of the service. */ private static final ImmutableList DEFAULT_SERVICE_SCOPES = @@ -104,6 +107,62 @@ public class EntityTypesStubSettings extends StubSettings updateEntityTypeSettings; private final UnaryCallSettings deleteEntityTypeSettings; + private static final PagedListDescriptor< + ListEntityTypesRequest, ListEntityTypesResponse, EntityType> + LIST_ENTITY_TYPES_PAGE_STR_DESC = + new PagedListDescriptor() { + @Override + public String emptyToken() { + return ""; + } + + @Override + public ListEntityTypesRequest injectToken( + ListEntityTypesRequest payload, String token) { + return ListEntityTypesRequest.newBuilder(payload).setPageToken(token).build(); + } + + @Override + public ListEntityTypesRequest injectPageSize( + ListEntityTypesRequest payload, int pageSize) { + return ListEntityTypesRequest.newBuilder(payload).setPageSize(pageSize).build(); + } + + @Override + public Integer extractPageSize(ListEntityTypesRequest payload) { + return payload.getPageSize(); + } + + @Override + public String extractNextToken(ListEntityTypesResponse payload) { + return payload.getNextPageToken(); + } + + @Override + public Iterable extractResources(ListEntityTypesResponse payload) { + return payload.getEntityTypesList() == null + ? ImmutableList.of() + : payload.getEntityTypesList(); + } + }; + + private static final PagedListResponseFactory< + ListEntityTypesRequest, ListEntityTypesResponse, ListEntityTypesPagedResponse> + LIST_ENTITY_TYPES_PAGE_STR_FACT = + new PagedListResponseFactory< + ListEntityTypesRequest, ListEntityTypesResponse, ListEntityTypesPagedResponse>() { + @Override + public ApiFuture getFuturePagedResponse( + UnaryCallable callable, + ListEntityTypesRequest request, + ApiCallContext context, + ApiFuture futureResponse) { + PageContext pageContext = + PageContext.create(callable, LIST_ENTITY_TYPES_PAGE_STR_DESC, request, context); + return ListEntityTypesPagedResponse.createAsync(pageContext, futureResponse); + } + }; + /** Returns the object with the settings used for calls to listEntityTypes. */ public PagedCallSettings< ListEntityTypesRequest, ListEntityTypesResponse, ListEntityTypesPagedResponse> @@ -137,10 +196,10 @@ public EntityTypesStub createStub() throws IOException { .getTransportName() .equals(GrpcTransportChannel.getGrpcTransportName())) { return GrpcEntityTypesStub.create(this); - } else { - throw new UnsupportedOperationException( - "Transport not supported: " + getTransportChannelProvider().getTransportName()); } + throw new UnsupportedOperationException( + String.format( + "Transport not supported: %s", getTransportChannelProvider().getTransportName())); } /** Returns a builder for the default ExecutorProvider for this service. */ @@ -207,66 +266,9 @@ protected EntityTypesStubSettings(Builder settingsBuilder) throws IOException { deleteEntityTypeSettings = settingsBuilder.deleteEntityTypeSettings().build(); } - private static final PagedListDescriptor< - ListEntityTypesRequest, ListEntityTypesResponse, EntityType> - LIST_ENTITY_TYPES_PAGE_STR_DESC = - new PagedListDescriptor() { - @Override - public String emptyToken() { - return ""; - } - - @Override - public ListEntityTypesRequest injectToken( - ListEntityTypesRequest payload, String token) { - return ListEntityTypesRequest.newBuilder(payload).setPageToken(token).build(); - } - - @Override - public ListEntityTypesRequest injectPageSize( - ListEntityTypesRequest payload, int pageSize) { - return ListEntityTypesRequest.newBuilder(payload).setPageSize(pageSize).build(); - } - - @Override - public Integer extractPageSize(ListEntityTypesRequest payload) { - return payload.getPageSize(); - } - - @Override - public String extractNextToken(ListEntityTypesResponse payload) { - return payload.getNextPageToken(); - } - - @Override - public Iterable extractResources(ListEntityTypesResponse payload) { - return payload.getEntityTypesList() != null - ? payload.getEntityTypesList() - : ImmutableList.of(); - } - }; - - private static final PagedListResponseFactory< - ListEntityTypesRequest, ListEntityTypesResponse, ListEntityTypesPagedResponse> - LIST_ENTITY_TYPES_PAGE_STR_FACT = - new PagedListResponseFactory< - ListEntityTypesRequest, ListEntityTypesResponse, ListEntityTypesPagedResponse>() { - @Override - public ApiFuture getFuturePagedResponse( - UnaryCallable callable, - ListEntityTypesRequest request, - ApiCallContext context, - ApiFuture futureResponse) { - PageContext pageContext = - PageContext.create(callable, LIST_ENTITY_TYPES_PAGE_STR_DESC, request, context); - return ListEntityTypesPagedResponse.createAsync(pageContext, futureResponse); - } - }; - /** Builder for EntityTypesStubSettings. */ public static class Builder extends StubSettings.Builder { private final ImmutableList> unaryMethodSettingsBuilders; - private final PagedCallSettings.Builder< ListEntityTypesRequest, ListEntityTypesResponse, ListEntityTypesPagedResponse> listEntityTypesSettings; @@ -277,7 +279,6 @@ public static class Builder extends StubSettings.Builder deleteEntityTypeSettings; - private static final ImmutableMap> RETRYABLE_CODE_DEFINITIONS; @@ -285,14 +286,8 @@ public static class Builder extends StubSettings.Builder> definitions = ImmutableMap.builder(); definitions.put( - "retry_policy_1_codes", - ImmutableSet.copyOf(Lists.newArrayList(StatusCode.Code.UNAVAILABLE))); - definitions.put("no_retry_codes", ImmutableSet.copyOf(Lists.newArrayList())); - definitions.put( - "retry_policy_2_codes", + "retry_policy_0_codes", ImmutableSet.copyOf(Lists.newArrayList(StatusCode.Code.UNAVAILABLE))); - definitions.put( - "no_retry_1_codes", ImmutableSet.copyOf(Lists.newArrayList())); RETRYABLE_CODE_DEFINITIONS = definitions.build(); } @@ -311,46 +306,21 @@ public static class Builder extends StubSettings.Builder>of( + listEntityTypesSettings, + getEntityTypeSettings, + createEntityTypeSettings, + updateEntityTypeSettings, + deleteEntityTypeSettings); + } + private static Builder createDefault() { - Builder builder = new Builder((ClientContext) null); + Builder builder = new Builder(((ClientContext) null)); + builder.setTransportChannelProvider(defaultTransportChannelProvider()); builder.setCredentialsProvider(defaultCredentialsProviderBuilder().build()); builder.setInternalHeaderProvider(defaultApiClientHeaderProviderBuilder().build()); builder.setEndpoint(getDefaultEndpoint()); + return initDefaults(builder); } private static Builder initDefaults(Builder builder) { - builder .listEntityTypesSettings() - .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_1_codes")) - .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_1_params")); + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params")); builder .getEntityTypeSettings() - .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_1_codes")) - .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_1_params")); + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params")); builder .createEntityTypeSettings() - .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_1_codes")) - .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_1_params")); + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params")); builder .updateEntityTypeSettings() - .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_1_codes")) - .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_1_params")); + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params")); builder .deleteEntityTypeSettings() - .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_1_codes")) - .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_1_params")); + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params")); return builder; } - protected Builder(EntityTypesStubSettings settings) { - super(settings); - - listEntityTypesSettings = settings.listEntityTypesSettings.toBuilder(); - getEntityTypeSettings = settings.getEntityTypeSettings.toBuilder(); - createEntityTypeSettings = settings.createEntityTypeSettings.toBuilder(); - updateEntityTypeSettings = settings.updateEntityTypeSettings.toBuilder(); - deleteEntityTypeSettings = settings.deleteEntityTypeSettings.toBuilder(); - - unaryMethodSettingsBuilders = - ImmutableList.>of( - listEntityTypesSettings, - getEntityTypeSettings, - createEntityTypeSettings, - updateEntityTypeSettings, - deleteEntityTypeSettings); - } - - // NEXT_MAJOR_VER: remove 'throws Exception' + // NEXT_MAJOR_VER: remove 'throws Exception'. /** * Applies the given settings updater function to all of the unary API methods in this service. * diff --git a/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3/stub/EnvironmentsStub.java b/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3/stub/EnvironmentsStub.java index 312c2d9f2..f2e0d0078 100644 --- a/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3/stub/EnvironmentsStub.java +++ b/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3/stub/EnvironmentsStub.java @@ -5,7 +5,7 @@ * 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 + * 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, @@ -13,12 +13,12 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.google.cloud.dialogflow.cx.v3.stub; import static com.google.cloud.dialogflow.cx.v3.EnvironmentsClient.ListEnvironmentsPagedResponse; import static com.google.cloud.dialogflow.cx.v3.EnvironmentsClient.LookupEnvironmentHistoryPagedResponse; -import com.google.api.core.BetaApi; import com.google.api.gax.core.BackgroundResource; import com.google.api.gax.rpc.OperationCallable; import com.google.api.gax.rpc.UnaryCallable; @@ -37,17 +37,15 @@ import com.google.protobuf.Struct; import javax.annotation.Generated; -// AUTO-GENERATED DOCUMENTATION AND CLASS +// AUTO-GENERATED DOCUMENTATION AND CLASS. /** - * Base stub class for Dialogflow API. + * Base stub class for the Environments service API. * *

This class is for advanced usage and reflects the underlying API directly. */ @Generated("by gapic-generator") -@BetaApi("A restructuring of stub classes is planned, so this may break in the future") public abstract class EnvironmentsStub implements BackgroundResource { - @BetaApi("The surface for use by generated code is not stable yet and may change in the future.") public OperationsStub getOperationsStub() { throw new UnsupportedOperationException("Not implemented: getOperationsStub()"); } @@ -66,7 +64,6 @@ public UnaryCallable getEnvironmentCallable( throw new UnsupportedOperationException("Not implemented: getEnvironmentCallable()"); } - @BetaApi("The surface for use by generated code is not stable yet and may change in the future.") public OperationCallable createEnvironmentOperationCallable() { throw new UnsupportedOperationException( @@ -77,7 +74,6 @@ public UnaryCallable createEnvironmentCalla throw new UnsupportedOperationException("Not implemented: createEnvironmentCallable()"); } - @BetaApi("The surface for use by generated code is not stable yet and may change in the future.") public OperationCallable updateEnvironmentOperationCallable() { throw new UnsupportedOperationException( diff --git a/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3/stub/EnvironmentsStubSettings.java b/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3/stub/EnvironmentsStubSettings.java index 143225496..255e92ce6 100644 --- a/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3/stub/EnvironmentsStubSettings.java +++ b/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3/stub/EnvironmentsStubSettings.java @@ -5,7 +5,7 @@ * 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 + * 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, @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.google.cloud.dialogflow.cx.v3.stub; import static com.google.cloud.dialogflow.cx.v3.EnvironmentsClient.ListEnvironmentsPagedResponse; @@ -65,7 +66,7 @@ import javax.annotation.Generated; import org.threeten.bp.Duration; -// AUTO-GENERATED DOCUMENTATION AND CLASS +// AUTO-GENERATED DOCUMENTATION AND CLASS. /** * Settings class to configure an instance of {@link EnvironmentsStub}. * @@ -82,21 +83,23 @@ * *

For example, to set the total timeout of getEnvironment to 30 seconds: * - *

- * 
+ * 
{@code
  * EnvironmentsStubSettings.Builder environmentsSettingsBuilder =
  *     EnvironmentsStubSettings.newBuilder();
  * environmentsSettingsBuilder
  *     .getEnvironmentSettings()
  *     .setRetrySettings(
- *         environmentsSettingsBuilder.getEnvironmentSettings().getRetrySettings().toBuilder()
+ *         environmentsSettingsBuilder
+ *             .getEnvironmentSettings()
+ *             .getRetrySettings()
+ *             .toBuilder()
  *             .setTotalTimeout(Duration.ofSeconds(30))
  *             .build());
  * EnvironmentsStubSettings environmentsSettings = environmentsSettingsBuilder.build();
- * 
- * 
+ * }
*/ -@Generated("by gapic-generator") +@BetaApi +@Generated("by gapic-generator-java") public class EnvironmentsStubSettings extends StubSettings { /** The default scopes of the service. */ private static final ImmutableList DEFAULT_SERVICE_SCOPES = @@ -122,6 +125,137 @@ public class EnvironmentsStubSettings extends StubSettings lookupEnvironmentHistorySettings; + private static final PagedListDescriptor< + ListEnvironmentsRequest, ListEnvironmentsResponse, Environment> + LIST_ENVIRONMENTS_PAGE_STR_DESC = + new PagedListDescriptor< + ListEnvironmentsRequest, ListEnvironmentsResponse, Environment>() { + @Override + public String emptyToken() { + return ""; + } + + @Override + public ListEnvironmentsRequest injectToken( + ListEnvironmentsRequest payload, String token) { + return ListEnvironmentsRequest.newBuilder(payload).setPageToken(token).build(); + } + + @Override + public ListEnvironmentsRequest injectPageSize( + ListEnvironmentsRequest payload, int pageSize) { + return ListEnvironmentsRequest.newBuilder(payload).setPageSize(pageSize).build(); + } + + @Override + public Integer extractPageSize(ListEnvironmentsRequest payload) { + return payload.getPageSize(); + } + + @Override + public String extractNextToken(ListEnvironmentsResponse payload) { + return payload.getNextPageToken(); + } + + @Override + public Iterable extractResources(ListEnvironmentsResponse payload) { + return payload.getEnvironmentsList() == null + ? ImmutableList.of() + : payload.getEnvironmentsList(); + } + }; + + private static final PagedListDescriptor< + LookupEnvironmentHistoryRequest, LookupEnvironmentHistoryResponse, Environment> + LOOKUP_ENVIRONMENT_HISTORY_PAGE_STR_DESC = + new PagedListDescriptor< + LookupEnvironmentHistoryRequest, LookupEnvironmentHistoryResponse, Environment>() { + @Override + public String emptyToken() { + return ""; + } + + @Override + public LookupEnvironmentHistoryRequest injectToken( + LookupEnvironmentHistoryRequest payload, String token) { + return LookupEnvironmentHistoryRequest.newBuilder(payload) + .setPageToken(token) + .build(); + } + + @Override + public LookupEnvironmentHistoryRequest injectPageSize( + LookupEnvironmentHistoryRequest payload, int pageSize) { + return LookupEnvironmentHistoryRequest.newBuilder(payload) + .setPageSize(pageSize) + .build(); + } + + @Override + public Integer extractPageSize(LookupEnvironmentHistoryRequest payload) { + return payload.getPageSize(); + } + + @Override + public String extractNextToken(LookupEnvironmentHistoryResponse payload) { + return payload.getNextPageToken(); + } + + @Override + public Iterable extractResources( + LookupEnvironmentHistoryResponse payload) { + return payload.getEnvironmentsList() == null + ? ImmutableList.of() + : payload.getEnvironmentsList(); + } + }; + + private static final PagedListResponseFactory< + ListEnvironmentsRequest, ListEnvironmentsResponse, ListEnvironmentsPagedResponse> + LIST_ENVIRONMENTS_PAGE_STR_FACT = + new PagedListResponseFactory< + ListEnvironmentsRequest, ListEnvironmentsResponse, ListEnvironmentsPagedResponse>() { + @Override + public ApiFuture getFuturePagedResponse( + UnaryCallable callable, + ListEnvironmentsRequest request, + ApiCallContext context, + ApiFuture futureResponse) { + PageContext + pageContext = + PageContext.create( + callable, LIST_ENVIRONMENTS_PAGE_STR_DESC, request, context); + return ListEnvironmentsPagedResponse.createAsync(pageContext, futureResponse); + } + }; + + private static final PagedListResponseFactory< + LookupEnvironmentHistoryRequest, + LookupEnvironmentHistoryResponse, + LookupEnvironmentHistoryPagedResponse> + LOOKUP_ENVIRONMENT_HISTORY_PAGE_STR_FACT = + new PagedListResponseFactory< + LookupEnvironmentHistoryRequest, + LookupEnvironmentHistoryResponse, + LookupEnvironmentHistoryPagedResponse>() { + @Override + public ApiFuture getFuturePagedResponse( + UnaryCallable + callable, + LookupEnvironmentHistoryRequest request, + ApiCallContext context, + ApiFuture futureResponse) { + PageContext< + LookupEnvironmentHistoryRequest, + LookupEnvironmentHistoryResponse, + Environment> + pageContext = + PageContext.create( + callable, LOOKUP_ENVIRONMENT_HISTORY_PAGE_STR_DESC, request, context); + return LookupEnvironmentHistoryPagedResponse.createAsync(pageContext, futureResponse); + } + }; + /** Returns the object with the settings used for calls to listEnvironments. */ public PagedCallSettings< ListEnvironmentsRequest, ListEnvironmentsResponse, ListEnvironmentsPagedResponse> @@ -140,7 +274,6 @@ public UnaryCallSettings createEnvironmentS } /** Returns the object with the settings used for calls to createEnvironment. */ - @BetaApi("The surface for use by generated code is not stable yet and may change in the future.") public OperationCallSettings createEnvironmentOperationSettings() { return createEnvironmentOperationSettings; @@ -152,7 +285,6 @@ public UnaryCallSettings updateEnvironmentS } /** Returns the object with the settings used for calls to updateEnvironment. */ - @BetaApi("The surface for use by generated code is not stable yet and may change in the future.") public OperationCallSettings updateEnvironmentOperationSettings() { return updateEnvironmentOperationSettings; @@ -178,10 +310,10 @@ public EnvironmentsStub createStub() throws IOException { .getTransportName() .equals(GrpcTransportChannel.getGrpcTransportName())) { return GrpcEnvironmentsStub.create(this); - } else { - throw new UnsupportedOperationException( - "Transport not supported: " + getTransportChannelProvider().getTransportName()); } + throw new UnsupportedOperationException( + String.format( + "Transport not supported: %s", getTransportChannelProvider().getTransportName())); } /** Returns a builder for the default ExecutorProvider for this service. */ @@ -253,141 +385,9 @@ protected EnvironmentsStubSettings(Builder settingsBuilder) throws IOException { lookupEnvironmentHistorySettings = settingsBuilder.lookupEnvironmentHistorySettings().build(); } - private static final PagedListDescriptor< - ListEnvironmentsRequest, ListEnvironmentsResponse, Environment> - LIST_ENVIRONMENTS_PAGE_STR_DESC = - new PagedListDescriptor< - ListEnvironmentsRequest, ListEnvironmentsResponse, Environment>() { - @Override - public String emptyToken() { - return ""; - } - - @Override - public ListEnvironmentsRequest injectToken( - ListEnvironmentsRequest payload, String token) { - return ListEnvironmentsRequest.newBuilder(payload).setPageToken(token).build(); - } - - @Override - public ListEnvironmentsRequest injectPageSize( - ListEnvironmentsRequest payload, int pageSize) { - return ListEnvironmentsRequest.newBuilder(payload).setPageSize(pageSize).build(); - } - - @Override - public Integer extractPageSize(ListEnvironmentsRequest payload) { - return payload.getPageSize(); - } - - @Override - public String extractNextToken(ListEnvironmentsResponse payload) { - return payload.getNextPageToken(); - } - - @Override - public Iterable extractResources(ListEnvironmentsResponse payload) { - return payload.getEnvironmentsList() != null - ? payload.getEnvironmentsList() - : ImmutableList.of(); - } - }; - - private static final PagedListDescriptor< - LookupEnvironmentHistoryRequest, LookupEnvironmentHistoryResponse, Environment> - LOOKUP_ENVIRONMENT_HISTORY_PAGE_STR_DESC = - new PagedListDescriptor< - LookupEnvironmentHistoryRequest, LookupEnvironmentHistoryResponse, Environment>() { - @Override - public String emptyToken() { - return ""; - } - - @Override - public LookupEnvironmentHistoryRequest injectToken( - LookupEnvironmentHistoryRequest payload, String token) { - return LookupEnvironmentHistoryRequest.newBuilder(payload) - .setPageToken(token) - .build(); - } - - @Override - public LookupEnvironmentHistoryRequest injectPageSize( - LookupEnvironmentHistoryRequest payload, int pageSize) { - return LookupEnvironmentHistoryRequest.newBuilder(payload) - .setPageSize(pageSize) - .build(); - } - - @Override - public Integer extractPageSize(LookupEnvironmentHistoryRequest payload) { - return payload.getPageSize(); - } - - @Override - public String extractNextToken(LookupEnvironmentHistoryResponse payload) { - return payload.getNextPageToken(); - } - - @Override - public Iterable extractResources( - LookupEnvironmentHistoryResponse payload) { - return payload.getEnvironmentsList() != null - ? payload.getEnvironmentsList() - : ImmutableList.of(); - } - }; - - private static final PagedListResponseFactory< - ListEnvironmentsRequest, ListEnvironmentsResponse, ListEnvironmentsPagedResponse> - LIST_ENVIRONMENTS_PAGE_STR_FACT = - new PagedListResponseFactory< - ListEnvironmentsRequest, ListEnvironmentsResponse, ListEnvironmentsPagedResponse>() { - @Override - public ApiFuture getFuturePagedResponse( - UnaryCallable callable, - ListEnvironmentsRequest request, - ApiCallContext context, - ApiFuture futureResponse) { - PageContext - pageContext = - PageContext.create( - callable, LIST_ENVIRONMENTS_PAGE_STR_DESC, request, context); - return ListEnvironmentsPagedResponse.createAsync(pageContext, futureResponse); - } - }; - - private static final PagedListResponseFactory< - LookupEnvironmentHistoryRequest, - LookupEnvironmentHistoryResponse, - LookupEnvironmentHistoryPagedResponse> - LOOKUP_ENVIRONMENT_HISTORY_PAGE_STR_FACT = - new PagedListResponseFactory< - LookupEnvironmentHistoryRequest, - LookupEnvironmentHistoryResponse, - LookupEnvironmentHistoryPagedResponse>() { - @Override - public ApiFuture getFuturePagedResponse( - UnaryCallable - callable, - LookupEnvironmentHistoryRequest request, - ApiCallContext context, - ApiFuture futureResponse) { - PageContext< - LookupEnvironmentHistoryRequest, - LookupEnvironmentHistoryResponse, - Environment> - pageContext = - PageContext.create( - callable, LOOKUP_ENVIRONMENT_HISTORY_PAGE_STR_DESC, request, context); - return LookupEnvironmentHistoryPagedResponse.createAsync(pageContext, futureResponse); - } - }; - /** Builder for EnvironmentsStubSettings. */ public static class Builder extends StubSettings.Builder { private final ImmutableList> unaryMethodSettingsBuilders; - private final PagedCallSettings.Builder< ListEnvironmentsRequest, ListEnvironmentsResponse, ListEnvironmentsPagedResponse> listEnvironmentsSettings; @@ -408,7 +408,6 @@ public static class Builder extends StubSettings.Builder lookupEnvironmentHistorySettings; - private static final ImmutableMap> RETRYABLE_CODE_DEFINITIONS; @@ -416,14 +415,8 @@ public static class Builder extends StubSettings.Builder> definitions = ImmutableMap.builder(); definitions.put( - "retry_policy_1_codes", + "retry_policy_0_codes", ImmutableSet.copyOf(Lists.newArrayList(StatusCode.Code.UNAVAILABLE))); - definitions.put("no_retry_codes", ImmutableSet.copyOf(Lists.newArrayList())); - definitions.put( - "retry_policy_2_codes", - ImmutableSet.copyOf(Lists.newArrayList(StatusCode.Code.UNAVAILABLE))); - definitions.put( - "no_retry_1_codes", ImmutableSet.copyOf(Lists.newArrayList())); RETRYABLE_CODE_DEFINITIONS = definitions.build(); } @@ -442,52 +435,24 @@ public static class Builder extends StubSettings.Builder>of( + listEnvironmentsSettings, + getEnvironmentSettings, + createEnvironmentSettings, + updateEnvironmentSettings, + deleteEnvironmentSettings, + lookupEnvironmentHistorySettings); + } + private static Builder createDefault() { - Builder builder = new Builder((ClientContext) null); + Builder builder = new Builder(((ClientContext) null)); + builder.setTransportChannelProvider(defaultTransportChannelProvider()); builder.setCredentialsProvider(defaultCredentialsProviderBuilder().build()); builder.setInternalHeaderProvider(defaultApiClientHeaderProviderBuilder().build()); builder.setEndpoint(getDefaultEndpoint()); + return initDefaults(builder); } private static Builder initDefaults(Builder builder) { - builder .listEnvironmentsSettings() - .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_1_codes")) - .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_1_params")); + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params")); builder .getEnvironmentSettings() - .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_1_codes")) - .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_1_params")); + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params")); builder .createEnvironmentSettings() - .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_1_codes")) - .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_1_params")); + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params")); builder .updateEnvironmentSettings() - .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_1_codes")) - .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_1_params")); + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params")); builder .deleteEnvironmentSettings() - .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_1_codes")) - .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_1_params")); + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params")); builder .lookupEnvironmentHistorySettings() - .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_1_codes")) - .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_1_params")); + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params")); + builder .createEnvironmentOperationSettings() .setInitialCallSettings( UnaryCallSettings .newUnaryCallSettingsBuilder() - .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_1_codes")) - .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_1_params")) + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params")) .build()) .setResponseTransformer( ProtoOperationTransformers.ResponseTransformer.create(Environment.class)) @@ -558,21 +546,22 @@ private static Builder initDefaults(Builder builder) { .setPollingAlgorithm( OperationTimedPollAlgorithm.create( RetrySettings.newBuilder() - .setInitialRetryDelay(Duration.ofMillis(500L)) + .setInitialRetryDelay(Duration.ofMillis(5000L)) .setRetryDelayMultiplier(1.5) - .setMaxRetryDelay(Duration.ofMillis(5000L)) - .setInitialRpcTimeout(Duration.ZERO) // ignored - .setRpcTimeoutMultiplier(1.0) // ignored - .setMaxRpcTimeout(Duration.ZERO) // ignored + .setMaxRetryDelay(Duration.ofMillis(45000L)) + .setInitialRpcTimeout(Duration.ZERO) + .setRpcTimeoutMultiplier(1.0) + .setMaxRpcTimeout(Duration.ZERO) .setTotalTimeout(Duration.ofMillis(300000L)) .build())); + builder .updateEnvironmentOperationSettings() .setInitialCallSettings( UnaryCallSettings .newUnaryCallSettingsBuilder() - .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_1_codes")) - .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_1_params")) + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params")) .build()) .setResponseTransformer( ProtoOperationTransformers.ResponseTransformer.create(Environment.class)) @@ -581,41 +570,19 @@ private static Builder initDefaults(Builder builder) { .setPollingAlgorithm( OperationTimedPollAlgorithm.create( RetrySettings.newBuilder() - .setInitialRetryDelay(Duration.ofMillis(500L)) + .setInitialRetryDelay(Duration.ofMillis(5000L)) .setRetryDelayMultiplier(1.5) - .setMaxRetryDelay(Duration.ofMillis(5000L)) - .setInitialRpcTimeout(Duration.ZERO) // ignored - .setRpcTimeoutMultiplier(1.0) // ignored - .setMaxRpcTimeout(Duration.ZERO) // ignored + .setMaxRetryDelay(Duration.ofMillis(45000L)) + .setInitialRpcTimeout(Duration.ZERO) + .setRpcTimeoutMultiplier(1.0) + .setMaxRpcTimeout(Duration.ZERO) .setTotalTimeout(Duration.ofMillis(300000L)) .build())); return builder; } - protected Builder(EnvironmentsStubSettings settings) { - super(settings); - - listEnvironmentsSettings = settings.listEnvironmentsSettings.toBuilder(); - getEnvironmentSettings = settings.getEnvironmentSettings.toBuilder(); - createEnvironmentSettings = settings.createEnvironmentSettings.toBuilder(); - createEnvironmentOperationSettings = settings.createEnvironmentOperationSettings.toBuilder(); - updateEnvironmentSettings = settings.updateEnvironmentSettings.toBuilder(); - updateEnvironmentOperationSettings = settings.updateEnvironmentOperationSettings.toBuilder(); - deleteEnvironmentSettings = settings.deleteEnvironmentSettings.toBuilder(); - lookupEnvironmentHistorySettings = settings.lookupEnvironmentHistorySettings.toBuilder(); - - unaryMethodSettingsBuilders = - ImmutableList.>of( - listEnvironmentsSettings, - getEnvironmentSettings, - createEnvironmentSettings, - updateEnvironmentSettings, - deleteEnvironmentSettings, - lookupEnvironmentHistorySettings); - } - - // NEXT_MAJOR_VER: remove 'throws Exception' + // NEXT_MAJOR_VER: remove 'throws Exception'. /** * Applies the given settings updater function to all of the unary API methods in this service. * diff --git a/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3/stub/FlowsStub.java b/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3/stub/FlowsStub.java index 3129d91a7..e4674f2e1 100644 --- a/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3/stub/FlowsStub.java +++ b/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3/stub/FlowsStub.java @@ -5,7 +5,7 @@ * 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 + * 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, @@ -13,11 +13,11 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.google.cloud.dialogflow.cx.v3.stub; import static com.google.cloud.dialogflow.cx.v3.FlowsClient.ListFlowsPagedResponse; -import com.google.api.core.BetaApi; import com.google.api.gax.core.BackgroundResource; import com.google.api.gax.rpc.OperationCallable; import com.google.api.gax.rpc.UnaryCallable; @@ -35,17 +35,15 @@ import com.google.protobuf.Struct; import javax.annotation.Generated; -// AUTO-GENERATED DOCUMENTATION AND CLASS +// AUTO-GENERATED DOCUMENTATION AND CLASS. /** - * Base stub class for Dialogflow API. + * Base stub class for the Flows service API. * *

This class is for advanced usage and reflects the underlying API directly. */ @Generated("by gapic-generator") -@BetaApi("A restructuring of stub classes is planned, so this may break in the future") public abstract class FlowsStub implements BackgroundResource { - @BetaApi("The surface for use by generated code is not stable yet and may change in the future.") public OperationsStub getOperationsStub() { throw new UnsupportedOperationException("Not implemented: getOperationsStub()"); } @@ -74,7 +72,6 @@ public UnaryCallable updateFlowCallable() { throw new UnsupportedOperationException("Not implemented: updateFlowCallable()"); } - @BetaApi("The surface for use by generated code is not stable yet and may change in the future.") public OperationCallable trainFlowOperationCallable() { throw new UnsupportedOperationException("Not implemented: trainFlowOperationCallable()"); } diff --git a/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3/stub/FlowsStubSettings.java b/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3/stub/FlowsStubSettings.java index 8855f6e4c..7df591e9c 100644 --- a/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3/stub/FlowsStubSettings.java +++ b/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3/stub/FlowsStubSettings.java @@ -5,7 +5,7 @@ * 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 + * 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, @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.google.cloud.dialogflow.cx.v3.stub; import static com.google.cloud.dialogflow.cx.v3.FlowsClient.ListFlowsPagedResponse; @@ -63,7 +64,7 @@ import javax.annotation.Generated; import org.threeten.bp.Duration; -// AUTO-GENERATED DOCUMENTATION AND CLASS +// AUTO-GENERATED DOCUMENTATION AND CLASS. /** * Settings class to configure an instance of {@link FlowsStub}. * @@ -80,21 +81,22 @@ * *

For example, to set the total timeout of createFlow to 30 seconds: * - *

- * 
- * FlowsStubSettings.Builder flowsSettingsBuilder =
- *     FlowsStubSettings.newBuilder();
+ * 
{@code
+ * FlowsStubSettings.Builder flowsSettingsBuilder = FlowsStubSettings.newBuilder();
  * flowsSettingsBuilder
  *     .createFlowSettings()
  *     .setRetrySettings(
- *         flowsSettingsBuilder.createFlowSettings().getRetrySettings().toBuilder()
+ *         flowsSettingsBuilder
+ *             .createFlowSettings()
+ *             .getRetrySettings()
+ *             .toBuilder()
  *             .setTotalTimeout(Duration.ofSeconds(30))
  *             .build());
  * FlowsStubSettings flowsSettings = flowsSettingsBuilder.build();
- * 
- * 
+ * }
*/ -@Generated("by gapic-generator") +@BetaApi +@Generated("by gapic-generator-java") public class FlowsStubSettings extends StubSettings { /** The default scopes of the service. */ private static final ImmutableList DEFAULT_SERVICE_SCOPES = @@ -112,6 +114,59 @@ public class FlowsStubSettings extends StubSettings { private final UnaryCallSettings trainFlowSettings; private final OperationCallSettings trainFlowOperationSettings; + private static final PagedListDescriptor + LIST_FLOWS_PAGE_STR_DESC = + new PagedListDescriptor() { + @Override + public String emptyToken() { + return ""; + } + + @Override + public ListFlowsRequest injectToken(ListFlowsRequest payload, String token) { + return ListFlowsRequest.newBuilder(payload).setPageToken(token).build(); + } + + @Override + public ListFlowsRequest injectPageSize(ListFlowsRequest payload, int pageSize) { + return ListFlowsRequest.newBuilder(payload).setPageSize(pageSize).build(); + } + + @Override + public Integer extractPageSize(ListFlowsRequest payload) { + return payload.getPageSize(); + } + + @Override + public String extractNextToken(ListFlowsResponse payload) { + return payload.getNextPageToken(); + } + + @Override + public Iterable extractResources(ListFlowsResponse payload) { + return payload.getFlowsList() == null + ? ImmutableList.of() + : payload.getFlowsList(); + } + }; + + private static final PagedListResponseFactory< + ListFlowsRequest, ListFlowsResponse, ListFlowsPagedResponse> + LIST_FLOWS_PAGE_STR_FACT = + new PagedListResponseFactory< + ListFlowsRequest, ListFlowsResponse, ListFlowsPagedResponse>() { + @Override + public ApiFuture getFuturePagedResponse( + UnaryCallable callable, + ListFlowsRequest request, + ApiCallContext context, + ApiFuture futureResponse) { + PageContext pageContext = + PageContext.create(callable, LIST_FLOWS_PAGE_STR_DESC, request, context); + return ListFlowsPagedResponse.createAsync(pageContext, futureResponse); + } + }; + /** Returns the object with the settings used for calls to createFlow. */ public UnaryCallSettings createFlowSettings() { return createFlowSettings; @@ -144,7 +199,6 @@ public UnaryCallSettings trainFlowSettings() { } /** Returns the object with the settings used for calls to trainFlow. */ - @BetaApi("The surface for use by generated code is not stable yet and may change in the future.") public OperationCallSettings trainFlowOperationSettings() { return trainFlowOperationSettings; } @@ -155,10 +209,10 @@ public FlowsStub createStub() throws IOException { .getTransportName() .equals(GrpcTransportChannel.getGrpcTransportName())) { return GrpcFlowsStub.create(this); - } else { - throw new UnsupportedOperationException( - "Transport not supported: " + getTransportChannelProvider().getTransportName()); } + throw new UnsupportedOperationException( + String.format( + "Transport not supported: %s", getTransportChannelProvider().getTransportName())); } /** Returns a builder for the default ExecutorProvider for this service. */ @@ -226,63 +280,9 @@ protected FlowsStubSettings(Builder settingsBuilder) throws IOException { trainFlowOperationSettings = settingsBuilder.trainFlowOperationSettings().build(); } - private static final PagedListDescriptor - LIST_FLOWS_PAGE_STR_DESC = - new PagedListDescriptor() { - @Override - public String emptyToken() { - return ""; - } - - @Override - public ListFlowsRequest injectToken(ListFlowsRequest payload, String token) { - return ListFlowsRequest.newBuilder(payload).setPageToken(token).build(); - } - - @Override - public ListFlowsRequest injectPageSize(ListFlowsRequest payload, int pageSize) { - return ListFlowsRequest.newBuilder(payload).setPageSize(pageSize).build(); - } - - @Override - public Integer extractPageSize(ListFlowsRequest payload) { - return payload.getPageSize(); - } - - @Override - public String extractNextToken(ListFlowsResponse payload) { - return payload.getNextPageToken(); - } - - @Override - public Iterable extractResources(ListFlowsResponse payload) { - return payload.getFlowsList() != null - ? payload.getFlowsList() - : ImmutableList.of(); - } - }; - - private static final PagedListResponseFactory< - ListFlowsRequest, ListFlowsResponse, ListFlowsPagedResponse> - LIST_FLOWS_PAGE_STR_FACT = - new PagedListResponseFactory< - ListFlowsRequest, ListFlowsResponse, ListFlowsPagedResponse>() { - @Override - public ApiFuture getFuturePagedResponse( - UnaryCallable callable, - ListFlowsRequest request, - ApiCallContext context, - ApiFuture futureResponse) { - PageContext pageContext = - PageContext.create(callable, LIST_FLOWS_PAGE_STR_DESC, request, context); - return ListFlowsPagedResponse.createAsync(pageContext, futureResponse); - } - }; - /** Builder for FlowsStubSettings. */ public static class Builder extends StubSettings.Builder { private final ImmutableList> unaryMethodSettingsBuilders; - private final UnaryCallSettings.Builder createFlowSettings; private final UnaryCallSettings.Builder deleteFlowSettings; private final PagedCallSettings.Builder< @@ -293,7 +293,6 @@ public static class Builder extends StubSettings.Builder trainFlowSettings; private final OperationCallSettings.Builder trainFlowOperationSettings; - private static final ImmutableMap> RETRYABLE_CODE_DEFINITIONS; @@ -301,14 +300,8 @@ public static class Builder extends StubSettings.Builder> definitions = ImmutableMap.builder(); definitions.put( - "retry_policy_1_codes", - ImmutableSet.copyOf(Lists.newArrayList(StatusCode.Code.UNAVAILABLE))); - definitions.put("no_retry_codes", ImmutableSet.copyOf(Lists.newArrayList())); - definitions.put( - "retry_policy_2_codes", + "retry_policy_0_codes", ImmutableSet.copyOf(Lists.newArrayList(StatusCode.Code.UNAVAILABLE))); - definitions.put( - "no_retry_1_codes", ImmutableSet.copyOf(Lists.newArrayList())); RETRYABLE_CODE_DEFINITIONS = definitions.build(); } @@ -327,50 +320,23 @@ public static class Builder extends StubSettings.Builder>of( + createFlowSettings, + deleteFlowSettings, + listFlowsSettings, + getFlowSettings, + updateFlowSettings, + trainFlowSettings); + } + private static Builder createDefault() { - Builder builder = new Builder((ClientContext) null); + Builder builder = new Builder(((ClientContext) null)); + builder.setTransportChannelProvider(defaultTransportChannelProvider()); builder.setCredentialsProvider(defaultCredentialsProviderBuilder().build()); builder.setInternalHeaderProvider(defaultApiClientHeaderProviderBuilder().build()); builder.setEndpoint(getDefaultEndpoint()); + return initDefaults(builder); } private static Builder initDefaults(Builder builder) { - builder .createFlowSettings() - .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_1_codes")) - .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_1_params")); + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params")); builder .deleteFlowSettings() - .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_1_codes")) - .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_1_params")); + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params")); builder .listFlowsSettings() - .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_1_codes")) - .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_1_params")); + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params")); builder .getFlowSettings() - .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_1_codes")) - .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_1_params")); + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params")); builder .updateFlowSettings() - .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_1_codes")) - .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_1_params")); + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params")); builder .trainFlowSettings() - .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_1_codes")) - .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_1_params")); + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params")); + builder .trainFlowOperationSettings() .setInitialCallSettings( UnaryCallSettings.newUnaryCallSettingsBuilder() - .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_1_codes")) - .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_1_params")) + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params")) .build()) .setResponseTransformer( ProtoOperationTransformers.ResponseTransformer.create(Empty.class)) @@ -439,40 +427,19 @@ private static Builder initDefaults(Builder builder) { .setPollingAlgorithm( OperationTimedPollAlgorithm.create( RetrySettings.newBuilder() - .setInitialRetryDelay(Duration.ofMillis(500L)) + .setInitialRetryDelay(Duration.ofMillis(5000L)) .setRetryDelayMultiplier(1.5) - .setMaxRetryDelay(Duration.ofMillis(5000L)) - .setInitialRpcTimeout(Duration.ZERO) // ignored - .setRpcTimeoutMultiplier(1.0) // ignored - .setMaxRpcTimeout(Duration.ZERO) // ignored + .setMaxRetryDelay(Duration.ofMillis(45000L)) + .setInitialRpcTimeout(Duration.ZERO) + .setRpcTimeoutMultiplier(1.0) + .setMaxRpcTimeout(Duration.ZERO) .setTotalTimeout(Duration.ofMillis(300000L)) .build())); return builder; } - protected Builder(FlowsStubSettings settings) { - super(settings); - - createFlowSettings = settings.createFlowSettings.toBuilder(); - deleteFlowSettings = settings.deleteFlowSettings.toBuilder(); - listFlowsSettings = settings.listFlowsSettings.toBuilder(); - getFlowSettings = settings.getFlowSettings.toBuilder(); - updateFlowSettings = settings.updateFlowSettings.toBuilder(); - trainFlowSettings = settings.trainFlowSettings.toBuilder(); - trainFlowOperationSettings = settings.trainFlowOperationSettings.toBuilder(); - - unaryMethodSettingsBuilders = - ImmutableList.>of( - createFlowSettings, - deleteFlowSettings, - listFlowsSettings, - getFlowSettings, - updateFlowSettings, - trainFlowSettings); - } - - // NEXT_MAJOR_VER: remove 'throws Exception' + // NEXT_MAJOR_VER: remove 'throws Exception'. /** * Applies the given settings updater function to all of the unary API methods in this service. * diff --git a/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3/stub/GrpcAgentsCallableFactory.java b/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3/stub/GrpcAgentsCallableFactory.java index b3c6a9f4a..85ae3965b 100644 --- a/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3/stub/GrpcAgentsCallableFactory.java +++ b/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3/stub/GrpcAgentsCallableFactory.java @@ -5,7 +5,7 @@ * 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 + * 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, @@ -13,9 +13,9 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.google.cloud.dialogflow.cx.v3.stub; -import com.google.api.core.BetaApi; import com.google.api.gax.grpc.GrpcCallSettings; import com.google.api.gax.grpc.GrpcCallableFactory; import com.google.api.gax.grpc.GrpcStubCallableFactory; @@ -31,18 +31,19 @@ import com.google.api.gax.rpc.StreamingCallSettings; import com.google.api.gax.rpc.UnaryCallSettings; import com.google.api.gax.rpc.UnaryCallable; +import com.google.longrunning.Operation; import com.google.longrunning.stub.OperationsStub; import javax.annotation.Generated; -// AUTO-GENERATED DOCUMENTATION AND CLASS +// AUTO-GENERATED DOCUMENTATION AND CLASS. /** - * gRPC callable factory implementation for Dialogflow API. + * gRPC callable factory implementation for the Agents service API. * *

This class is for advanced usage. */ @Generated("by gapic-generator") -@BetaApi("The surface for use by generated code is not stable yet and may change in the future.") public class GrpcAgentsCallableFactory implements GrpcStubCallableFactory { + @Override public UnaryCallable createUnaryCallable( GrpcCallSettings grpcCallSettings, @@ -55,61 +56,58 @@ public UnaryCallable createUnaryCalla public UnaryCallable createPagedCallable( GrpcCallSettings grpcCallSettings, - PagedCallSettings pagedCallSettings, + PagedCallSettings callSettings, ClientContext clientContext) { - return GrpcCallableFactory.createPagedCallable( - grpcCallSettings, pagedCallSettings, clientContext); + return GrpcCallableFactory.createPagedCallable(grpcCallSettings, callSettings, clientContext); } @Override public UnaryCallable createBatchingCallable( GrpcCallSettings grpcCallSettings, - BatchingCallSettings batchingCallSettings, + BatchingCallSettings callSettings, ClientContext clientContext) { return GrpcCallableFactory.createBatchingCallable( - grpcCallSettings, batchingCallSettings, clientContext); + grpcCallSettings, callSettings, clientContext); } - @BetaApi( - "The surface for long-running operations is not stable yet and may change in the future.") @Override public OperationCallable createOperationCallable( - GrpcCallSettings grpcCallSettings, - OperationCallSettings operationCallSettings, + GrpcCallSettings grpcCallSettings, + OperationCallSettings callSettings, ClientContext clientContext, OperationsStub operationsStub) { return GrpcCallableFactory.createOperationCallable( - grpcCallSettings, operationCallSettings, clientContext, operationsStub); + grpcCallSettings, callSettings, clientContext, operationsStub); } @Override public BidiStreamingCallable createBidiStreamingCallable( GrpcCallSettings grpcCallSettings, - StreamingCallSettings streamingCallSettings, + StreamingCallSettings callSettings, ClientContext clientContext) { return GrpcCallableFactory.createBidiStreamingCallable( - grpcCallSettings, streamingCallSettings, clientContext); + grpcCallSettings, callSettings, clientContext); } @Override public ServerStreamingCallable createServerStreamingCallable( GrpcCallSettings grpcCallSettings, - ServerStreamingCallSettings streamingCallSettings, + ServerStreamingCallSettings callSettings, ClientContext clientContext) { return GrpcCallableFactory.createServerStreamingCallable( - grpcCallSettings, streamingCallSettings, clientContext); + grpcCallSettings, callSettings, clientContext); } @Override public ClientStreamingCallable createClientStreamingCallable( GrpcCallSettings grpcCallSettings, - StreamingCallSettings streamingCallSettings, + StreamingCallSettings callSettings, ClientContext clientContext) { return GrpcCallableFactory.createClientStreamingCallable( - grpcCallSettings, streamingCallSettings, clientContext); + grpcCallSettings, callSettings, clientContext); } } diff --git a/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3/stub/GrpcAgentsStub.java b/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3/stub/GrpcAgentsStub.java index aee0bc897..47f4a8ec8 100644 --- a/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3/stub/GrpcAgentsStub.java +++ b/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3/stub/GrpcAgentsStub.java @@ -5,7 +5,7 @@ * 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 + * 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, @@ -13,11 +13,11 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.google.cloud.dialogflow.cx.v3.stub; import static com.google.cloud.dialogflow.cx.v3.AgentsClient.ListAgentsPagedResponse; -import com.google.api.core.BetaApi; import com.google.api.gax.core.BackgroundResource; import com.google.api.gax.core.BackgroundResourceAggregation; import com.google.api.gax.grpc.GrpcCallSettings; @@ -48,16 +48,14 @@ import java.util.concurrent.TimeUnit; import javax.annotation.Generated; -// AUTO-GENERATED DOCUMENTATION AND CLASS +// AUTO-GENERATED DOCUMENTATION AND CLASS. /** - * gRPC stub implementation for Dialogflow API. + * gRPC stub implementation for the Agents service API. * *

This class is for advanced usage and reflects the underlying API directly. */ -@Generated("by gapic-generator") -@BetaApi("A restructuring of stub classes is planned, so this may break in the future") +@Generated("by gapic-generator-java") public class GrpcAgentsStub extends AgentsStub { - private static final MethodDescriptor listAgentsMethodDescriptor = MethodDescriptor.newBuilder() @@ -66,6 +64,7 @@ public class GrpcAgentsStub extends AgentsStub { .setRequestMarshaller(ProtoUtils.marshaller(ListAgentsRequest.getDefaultInstance())) .setResponseMarshaller(ProtoUtils.marshaller(ListAgentsResponse.getDefaultInstance())) .build(); + private static final MethodDescriptor getAgentMethodDescriptor = MethodDescriptor.newBuilder() .setType(MethodDescriptor.MethodType.UNARY) @@ -73,6 +72,7 @@ public class GrpcAgentsStub extends AgentsStub { .setRequestMarshaller(ProtoUtils.marshaller(GetAgentRequest.getDefaultInstance())) .setResponseMarshaller(ProtoUtils.marshaller(Agent.getDefaultInstance())) .build(); + private static final MethodDescriptor createAgentMethodDescriptor = MethodDescriptor.newBuilder() .setType(MethodDescriptor.MethodType.UNARY) @@ -80,6 +80,7 @@ public class GrpcAgentsStub extends AgentsStub { .setRequestMarshaller(ProtoUtils.marshaller(CreateAgentRequest.getDefaultInstance())) .setResponseMarshaller(ProtoUtils.marshaller(Agent.getDefaultInstance())) .build(); + private static final MethodDescriptor updateAgentMethodDescriptor = MethodDescriptor.newBuilder() .setType(MethodDescriptor.MethodType.UNARY) @@ -87,6 +88,7 @@ public class GrpcAgentsStub extends AgentsStub { .setRequestMarshaller(ProtoUtils.marshaller(UpdateAgentRequest.getDefaultInstance())) .setResponseMarshaller(ProtoUtils.marshaller(Agent.getDefaultInstance())) .build(); + private static final MethodDescriptor deleteAgentMethodDescriptor = MethodDescriptor.newBuilder() .setType(MethodDescriptor.MethodType.UNARY) @@ -94,6 +96,7 @@ public class GrpcAgentsStub extends AgentsStub { .setRequestMarshaller(ProtoUtils.marshaller(DeleteAgentRequest.getDefaultInstance())) .setResponseMarshaller(ProtoUtils.marshaller(Empty.getDefaultInstance())) .build(); + private static final MethodDescriptor exportAgentMethodDescriptor = MethodDescriptor.newBuilder() .setType(MethodDescriptor.MethodType.UNARY) @@ -101,6 +104,7 @@ public class GrpcAgentsStub extends AgentsStub { .setRequestMarshaller(ProtoUtils.marshaller(ExportAgentRequest.getDefaultInstance())) .setResponseMarshaller(ProtoUtils.marshaller(Operation.getDefaultInstance())) .build(); + private static final MethodDescriptor restoreAgentMethodDescriptor = MethodDescriptor.newBuilder() @@ -110,9 +114,6 @@ public class GrpcAgentsStub extends AgentsStub { .setResponseMarshaller(ProtoUtils.marshaller(Operation.getDefaultInstance())) .build(); - private final BackgroundResource backgroundResources; - private final GrpcOperationsStub operationsStub; - private final UnaryCallable listAgentsCallable; private final UnaryCallable listAgentsPagedCallable; private final UnaryCallable getAgentCallable; @@ -125,6 +126,8 @@ public class GrpcAgentsStub extends AgentsStub { private final UnaryCallable restoreAgentCallable; private final OperationCallable restoreAgentOperationCallable; + private final BackgroundResource backgroundResources; + private final GrpcOperationsStub operationsStub; private final GrpcStubCallableFactory callableFactory; public static final GrpcAgentsStub create(AgentsStubSettings settings) throws IOException { @@ -280,7 +283,7 @@ public Map extract(RestoreAgentRequest request) { exportAgentTransportSettings, settings.exportAgentOperationSettings(), clientContext, - this.operationsStub); + operationsStub); this.restoreAgentCallable = callableFactory.createUnaryCallable( restoreAgentTransportSettings, settings.restoreAgentSettings(), clientContext); @@ -289,24 +292,24 @@ public Map extract(RestoreAgentRequest request) { restoreAgentTransportSettings, settings.restoreAgentOperationSettings(), clientContext, - this.operationsStub); + operationsStub); - backgroundResources = new BackgroundResourceAggregation(clientContext.getBackgroundResources()); + this.backgroundResources = + new BackgroundResourceAggregation(clientContext.getBackgroundResources()); } - @BetaApi("The surface for use by generated code is not stable yet and may change in the future.") public GrpcOperationsStub getOperationsStub() { return operationsStub; } - public UnaryCallable listAgentsPagedCallable() { - return listAgentsPagedCallable; - } - public UnaryCallable listAgentsCallable() { return listAgentsCallable; } + public UnaryCallable listAgentsPagedCallable() { + return listAgentsPagedCallable; + } + public UnaryCallable getAgentCallable() { return getAgentCallable; } @@ -323,25 +326,23 @@ public UnaryCallable deleteAgentCallable() { return deleteAgentCallable; } - @BetaApi("The surface for use by generated code is not stable yet and may change in the future.") + public UnaryCallable exportAgentCallable() { + return exportAgentCallable; + } + public OperationCallable exportAgentOperationCallable() { return exportAgentOperationCallable; } - public UnaryCallable exportAgentCallable() { - return exportAgentCallable; + public UnaryCallable restoreAgentCallable() { + return restoreAgentCallable; } - @BetaApi("The surface for use by generated code is not stable yet and may change in the future.") public OperationCallable restoreAgentOperationCallable() { return restoreAgentOperationCallable; } - public UnaryCallable restoreAgentCallable() { - return restoreAgentCallable; - } - @Override public final void close() { shutdown(); diff --git a/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3/stub/GrpcEntityTypesCallableFactory.java b/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3/stub/GrpcEntityTypesCallableFactory.java index adc82304d..eb8395bc7 100644 --- a/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3/stub/GrpcEntityTypesCallableFactory.java +++ b/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3/stub/GrpcEntityTypesCallableFactory.java @@ -5,7 +5,7 @@ * 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 + * 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, @@ -13,9 +13,9 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.google.cloud.dialogflow.cx.v3.stub; -import com.google.api.core.BetaApi; import com.google.api.gax.grpc.GrpcCallSettings; import com.google.api.gax.grpc.GrpcCallableFactory; import com.google.api.gax.grpc.GrpcStubCallableFactory; @@ -31,18 +31,19 @@ import com.google.api.gax.rpc.StreamingCallSettings; import com.google.api.gax.rpc.UnaryCallSettings; import com.google.api.gax.rpc.UnaryCallable; +import com.google.longrunning.Operation; import com.google.longrunning.stub.OperationsStub; import javax.annotation.Generated; -// AUTO-GENERATED DOCUMENTATION AND CLASS +// AUTO-GENERATED DOCUMENTATION AND CLASS. /** - * gRPC callable factory implementation for Dialogflow API. + * gRPC callable factory implementation for the EntityTypes service API. * *

This class is for advanced usage. */ @Generated("by gapic-generator") -@BetaApi("The surface for use by generated code is not stable yet and may change in the future.") public class GrpcEntityTypesCallableFactory implements GrpcStubCallableFactory { + @Override public UnaryCallable createUnaryCallable( GrpcCallSettings grpcCallSettings, @@ -55,61 +56,58 @@ public UnaryCallable createUnaryCalla public UnaryCallable createPagedCallable( GrpcCallSettings grpcCallSettings, - PagedCallSettings pagedCallSettings, + PagedCallSettings callSettings, ClientContext clientContext) { - return GrpcCallableFactory.createPagedCallable( - grpcCallSettings, pagedCallSettings, clientContext); + return GrpcCallableFactory.createPagedCallable(grpcCallSettings, callSettings, clientContext); } @Override public UnaryCallable createBatchingCallable( GrpcCallSettings grpcCallSettings, - BatchingCallSettings batchingCallSettings, + BatchingCallSettings callSettings, ClientContext clientContext) { return GrpcCallableFactory.createBatchingCallable( - grpcCallSettings, batchingCallSettings, clientContext); + grpcCallSettings, callSettings, clientContext); } - @BetaApi( - "The surface for long-running operations is not stable yet and may change in the future.") @Override public OperationCallable createOperationCallable( - GrpcCallSettings grpcCallSettings, - OperationCallSettings operationCallSettings, + GrpcCallSettings grpcCallSettings, + OperationCallSettings callSettings, ClientContext clientContext, OperationsStub operationsStub) { return GrpcCallableFactory.createOperationCallable( - grpcCallSettings, operationCallSettings, clientContext, operationsStub); + grpcCallSettings, callSettings, clientContext, operationsStub); } @Override public BidiStreamingCallable createBidiStreamingCallable( GrpcCallSettings grpcCallSettings, - StreamingCallSettings streamingCallSettings, + StreamingCallSettings callSettings, ClientContext clientContext) { return GrpcCallableFactory.createBidiStreamingCallable( - grpcCallSettings, streamingCallSettings, clientContext); + grpcCallSettings, callSettings, clientContext); } @Override public ServerStreamingCallable createServerStreamingCallable( GrpcCallSettings grpcCallSettings, - ServerStreamingCallSettings streamingCallSettings, + ServerStreamingCallSettings callSettings, ClientContext clientContext) { return GrpcCallableFactory.createServerStreamingCallable( - grpcCallSettings, streamingCallSettings, clientContext); + grpcCallSettings, callSettings, clientContext); } @Override public ClientStreamingCallable createClientStreamingCallable( GrpcCallSettings grpcCallSettings, - StreamingCallSettings streamingCallSettings, + StreamingCallSettings callSettings, ClientContext clientContext) { return GrpcCallableFactory.createClientStreamingCallable( - grpcCallSettings, streamingCallSettings, clientContext); + grpcCallSettings, callSettings, clientContext); } } diff --git a/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3/stub/GrpcEntityTypesStub.java b/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3/stub/GrpcEntityTypesStub.java index 24cff0e2f..64ec3c7ea 100644 --- a/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3/stub/GrpcEntityTypesStub.java +++ b/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3/stub/GrpcEntityTypesStub.java @@ -5,7 +5,7 @@ * 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 + * 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, @@ -13,11 +13,11 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.google.cloud.dialogflow.cx.v3.stub; import static com.google.cloud.dialogflow.cx.v3.EntityTypesClient.ListEntityTypesPagedResponse; -import com.google.api.core.BetaApi; import com.google.api.gax.core.BackgroundResource; import com.google.api.gax.core.BackgroundResourceAggregation; import com.google.api.gax.grpc.GrpcCallSettings; @@ -33,6 +33,7 @@ import com.google.cloud.dialogflow.cx.v3.ListEntityTypesResponse; import com.google.cloud.dialogflow.cx.v3.UpdateEntityTypeRequest; import com.google.common.collect.ImmutableMap; +import com.google.longrunning.stub.GrpcOperationsStub; import com.google.protobuf.Empty; import io.grpc.MethodDescriptor; import io.grpc.protobuf.ProtoUtils; @@ -41,16 +42,14 @@ import java.util.concurrent.TimeUnit; import javax.annotation.Generated; -// AUTO-GENERATED DOCUMENTATION AND CLASS +// AUTO-GENERATED DOCUMENTATION AND CLASS. /** - * gRPC stub implementation for Dialogflow API. + * gRPC stub implementation for the EntityTypes service API. * *

This class is for advanced usage and reflects the underlying API directly. */ -@Generated("by gapic-generator") -@BetaApi("A restructuring of stub classes is planned, so this may break in the future") +@Generated("by gapic-generator-java") public class GrpcEntityTypesStub extends EntityTypesStub { - private static final MethodDescriptor listEntityTypesMethodDescriptor = MethodDescriptor.newBuilder() @@ -61,6 +60,7 @@ public class GrpcEntityTypesStub extends EntityTypesStub { .setResponseMarshaller( ProtoUtils.marshaller(ListEntityTypesResponse.getDefaultInstance())) .build(); + private static final MethodDescriptor getEntityTypeMethodDescriptor = MethodDescriptor.newBuilder() @@ -70,6 +70,7 @@ public class GrpcEntityTypesStub extends EntityTypesStub { ProtoUtils.marshaller(GetEntityTypeRequest.getDefaultInstance())) .setResponseMarshaller(ProtoUtils.marshaller(EntityType.getDefaultInstance())) .build(); + private static final MethodDescriptor createEntityTypeMethodDescriptor = MethodDescriptor.newBuilder() @@ -79,6 +80,7 @@ public class GrpcEntityTypesStub extends EntityTypesStub { ProtoUtils.marshaller(CreateEntityTypeRequest.getDefaultInstance())) .setResponseMarshaller(ProtoUtils.marshaller(EntityType.getDefaultInstance())) .build(); + private static final MethodDescriptor updateEntityTypeMethodDescriptor = MethodDescriptor.newBuilder() @@ -88,6 +90,7 @@ public class GrpcEntityTypesStub extends EntityTypesStub { ProtoUtils.marshaller(UpdateEntityTypeRequest.getDefaultInstance())) .setResponseMarshaller(ProtoUtils.marshaller(EntityType.getDefaultInstance())) .build(); + private static final MethodDescriptor deleteEntityTypeMethodDescriptor = MethodDescriptor.newBuilder() @@ -98,8 +101,6 @@ public class GrpcEntityTypesStub extends EntityTypesStub { .setResponseMarshaller(ProtoUtils.marshaller(Empty.getDefaultInstance())) .build(); - private final BackgroundResource backgroundResources; - private final UnaryCallable listEntityTypesCallable; private final UnaryCallable @@ -109,6 +110,8 @@ public class GrpcEntityTypesStub extends EntityTypesStub { private final UnaryCallable updateEntityTypeCallable; private final UnaryCallable deleteEntityTypeCallable; + private final BackgroundResource backgroundResources; + private final GrpcOperationsStub operationsStub; private final GrpcStubCallableFactory callableFactory; public static final GrpcEntityTypesStub create(EntityTypesStubSettings settings) @@ -147,6 +150,7 @@ protected GrpcEntityTypesStub( GrpcStubCallableFactory callableFactory) throws IOException { this.callableFactory = callableFactory; + this.operationsStub = GrpcOperationsStub.create(clientContext, callableFactory); GrpcCallSettings listEntityTypesTransportSettings = @@ -235,18 +239,23 @@ public Map extract(DeleteEntityTypeRequest request) { callableFactory.createUnaryCallable( deleteEntityTypeTransportSettings, settings.deleteEntityTypeSettings(), clientContext); - backgroundResources = new BackgroundResourceAggregation(clientContext.getBackgroundResources()); + this.backgroundResources = + new BackgroundResourceAggregation(clientContext.getBackgroundResources()); } - public UnaryCallable - listEntityTypesPagedCallable() { - return listEntityTypesPagedCallable; + public GrpcOperationsStub getOperationsStub() { + return operationsStub; } public UnaryCallable listEntityTypesCallable() { return listEntityTypesCallable; } + public UnaryCallable + listEntityTypesPagedCallable() { + return listEntityTypesPagedCallable; + } + public UnaryCallable getEntityTypeCallable() { return getEntityTypeCallable; } diff --git a/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3/stub/GrpcEnvironmentsCallableFactory.java b/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3/stub/GrpcEnvironmentsCallableFactory.java index 47b8ad918..40dbc708d 100644 --- a/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3/stub/GrpcEnvironmentsCallableFactory.java +++ b/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3/stub/GrpcEnvironmentsCallableFactory.java @@ -5,7 +5,7 @@ * 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 + * 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, @@ -13,9 +13,9 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.google.cloud.dialogflow.cx.v3.stub; -import com.google.api.core.BetaApi; import com.google.api.gax.grpc.GrpcCallSettings; import com.google.api.gax.grpc.GrpcCallableFactory; import com.google.api.gax.grpc.GrpcStubCallableFactory; @@ -31,18 +31,19 @@ import com.google.api.gax.rpc.StreamingCallSettings; import com.google.api.gax.rpc.UnaryCallSettings; import com.google.api.gax.rpc.UnaryCallable; +import com.google.longrunning.Operation; import com.google.longrunning.stub.OperationsStub; import javax.annotation.Generated; -// AUTO-GENERATED DOCUMENTATION AND CLASS +// AUTO-GENERATED DOCUMENTATION AND CLASS. /** - * gRPC callable factory implementation for Dialogflow API. + * gRPC callable factory implementation for the Environments service API. * *

This class is for advanced usage. */ @Generated("by gapic-generator") -@BetaApi("The surface for use by generated code is not stable yet and may change in the future.") public class GrpcEnvironmentsCallableFactory implements GrpcStubCallableFactory { + @Override public UnaryCallable createUnaryCallable( GrpcCallSettings grpcCallSettings, @@ -55,61 +56,58 @@ public UnaryCallable createUnaryCalla public UnaryCallable createPagedCallable( GrpcCallSettings grpcCallSettings, - PagedCallSettings pagedCallSettings, + PagedCallSettings callSettings, ClientContext clientContext) { - return GrpcCallableFactory.createPagedCallable( - grpcCallSettings, pagedCallSettings, clientContext); + return GrpcCallableFactory.createPagedCallable(grpcCallSettings, callSettings, clientContext); } @Override public UnaryCallable createBatchingCallable( GrpcCallSettings grpcCallSettings, - BatchingCallSettings batchingCallSettings, + BatchingCallSettings callSettings, ClientContext clientContext) { return GrpcCallableFactory.createBatchingCallable( - grpcCallSettings, batchingCallSettings, clientContext); + grpcCallSettings, callSettings, clientContext); } - @BetaApi( - "The surface for long-running operations is not stable yet and may change in the future.") @Override public OperationCallable createOperationCallable( - GrpcCallSettings grpcCallSettings, - OperationCallSettings operationCallSettings, + GrpcCallSettings grpcCallSettings, + OperationCallSettings callSettings, ClientContext clientContext, OperationsStub operationsStub) { return GrpcCallableFactory.createOperationCallable( - grpcCallSettings, operationCallSettings, clientContext, operationsStub); + grpcCallSettings, callSettings, clientContext, operationsStub); } @Override public BidiStreamingCallable createBidiStreamingCallable( GrpcCallSettings grpcCallSettings, - StreamingCallSettings streamingCallSettings, + StreamingCallSettings callSettings, ClientContext clientContext) { return GrpcCallableFactory.createBidiStreamingCallable( - grpcCallSettings, streamingCallSettings, clientContext); + grpcCallSettings, callSettings, clientContext); } @Override public ServerStreamingCallable createServerStreamingCallable( GrpcCallSettings grpcCallSettings, - ServerStreamingCallSettings streamingCallSettings, + ServerStreamingCallSettings callSettings, ClientContext clientContext) { return GrpcCallableFactory.createServerStreamingCallable( - grpcCallSettings, streamingCallSettings, clientContext); + grpcCallSettings, callSettings, clientContext); } @Override public ClientStreamingCallable createClientStreamingCallable( GrpcCallSettings grpcCallSettings, - StreamingCallSettings streamingCallSettings, + StreamingCallSettings callSettings, ClientContext clientContext) { return GrpcCallableFactory.createClientStreamingCallable( - grpcCallSettings, streamingCallSettings, clientContext); + grpcCallSettings, callSettings, clientContext); } } diff --git a/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3/stub/GrpcEnvironmentsStub.java b/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3/stub/GrpcEnvironmentsStub.java index fa0a466c8..601fc7468 100644 --- a/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3/stub/GrpcEnvironmentsStub.java +++ b/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3/stub/GrpcEnvironmentsStub.java @@ -5,7 +5,7 @@ * 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 + * 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, @@ -13,12 +13,12 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.google.cloud.dialogflow.cx.v3.stub; import static com.google.cloud.dialogflow.cx.v3.EnvironmentsClient.ListEnvironmentsPagedResponse; import static com.google.cloud.dialogflow.cx.v3.EnvironmentsClient.LookupEnvironmentHistoryPagedResponse; -import com.google.api.core.BetaApi; import com.google.api.gax.core.BackgroundResource; import com.google.api.gax.core.BackgroundResourceAggregation; import com.google.api.gax.grpc.GrpcCallSettings; @@ -48,16 +48,14 @@ import java.util.concurrent.TimeUnit; import javax.annotation.Generated; -// AUTO-GENERATED DOCUMENTATION AND CLASS +// AUTO-GENERATED DOCUMENTATION AND CLASS. /** - * gRPC stub implementation for Dialogflow API. + * gRPC stub implementation for the Environments service API. * *

This class is for advanced usage and reflects the underlying API directly. */ -@Generated("by gapic-generator") -@BetaApi("A restructuring of stub classes is planned, so this may break in the future") +@Generated("by gapic-generator-java") public class GrpcEnvironmentsStub extends EnvironmentsStub { - private static final MethodDescriptor listEnvironmentsMethodDescriptor = MethodDescriptor.newBuilder() @@ -68,6 +66,7 @@ public class GrpcEnvironmentsStub extends EnvironmentsStub { .setResponseMarshaller( ProtoUtils.marshaller(ListEnvironmentsResponse.getDefaultInstance())) .build(); + private static final MethodDescriptor getEnvironmentMethodDescriptor = MethodDescriptor.newBuilder() @@ -77,6 +76,7 @@ public class GrpcEnvironmentsStub extends EnvironmentsStub { ProtoUtils.marshaller(GetEnvironmentRequest.getDefaultInstance())) .setResponseMarshaller(ProtoUtils.marshaller(Environment.getDefaultInstance())) .build(); + private static final MethodDescriptor createEnvironmentMethodDescriptor = MethodDescriptor.newBuilder() @@ -86,6 +86,7 @@ public class GrpcEnvironmentsStub extends EnvironmentsStub { ProtoUtils.marshaller(CreateEnvironmentRequest.getDefaultInstance())) .setResponseMarshaller(ProtoUtils.marshaller(Operation.getDefaultInstance())) .build(); + private static final MethodDescriptor updateEnvironmentMethodDescriptor = MethodDescriptor.newBuilder() @@ -95,6 +96,7 @@ public class GrpcEnvironmentsStub extends EnvironmentsStub { ProtoUtils.marshaller(UpdateEnvironmentRequest.getDefaultInstance())) .setResponseMarshaller(ProtoUtils.marshaller(Operation.getDefaultInstance())) .build(); + private static final MethodDescriptor deleteEnvironmentMethodDescriptor = MethodDescriptor.newBuilder() @@ -104,6 +106,7 @@ public class GrpcEnvironmentsStub extends EnvironmentsStub { ProtoUtils.marshaller(DeleteEnvironmentRequest.getDefaultInstance())) .setResponseMarshaller(ProtoUtils.marshaller(Empty.getDefaultInstance())) .build(); + private static final MethodDescriptor< LookupEnvironmentHistoryRequest, LookupEnvironmentHistoryResponse> lookupEnvironmentHistoryMethodDescriptor = @@ -118,9 +121,6 @@ public class GrpcEnvironmentsStub extends EnvironmentsStub { ProtoUtils.marshaller(LookupEnvironmentHistoryResponse.getDefaultInstance())) .build(); - private final BackgroundResource backgroundResources; - private final GrpcOperationsStub operationsStub; - private final UnaryCallable listEnvironmentsCallable; private final UnaryCallable @@ -139,6 +139,8 @@ public class GrpcEnvironmentsStub extends EnvironmentsStub { LookupEnvironmentHistoryRequest, LookupEnvironmentHistoryPagedResponse> lookupEnvironmentHistoryPagedCallable; + private final BackgroundResource backgroundResources; + private final GrpcOperationsStub operationsStub; private final GrpcStubCallableFactory callableFactory; public static final GrpcEnvironmentsStub create(EnvironmentsStubSettings settings) @@ -281,7 +283,7 @@ public Map extract(LookupEnvironmentHistoryRequest request) { createEnvironmentTransportSettings, settings.createEnvironmentOperationSettings(), clientContext, - this.operationsStub); + operationsStub); this.updateEnvironmentCallable = callableFactory.createUnaryCallable( updateEnvironmentTransportSettings, @@ -292,7 +294,7 @@ public Map extract(LookupEnvironmentHistoryRequest request) { updateEnvironmentTransportSettings, settings.updateEnvironmentOperationSettings(), clientContext, - this.operationsStub); + operationsStub); this.deleteEnvironmentCallable = callableFactory.createUnaryCallable( deleteEnvironmentTransportSettings, @@ -309,62 +311,60 @@ public Map extract(LookupEnvironmentHistoryRequest request) { settings.lookupEnvironmentHistorySettings(), clientContext); - backgroundResources = new BackgroundResourceAggregation(clientContext.getBackgroundResources()); + this.backgroundResources = + new BackgroundResourceAggregation(clientContext.getBackgroundResources()); } - @BetaApi("The surface for use by generated code is not stable yet and may change in the future.") public GrpcOperationsStub getOperationsStub() { return operationsStub; } - public UnaryCallable - listEnvironmentsPagedCallable() { - return listEnvironmentsPagedCallable; - } - public UnaryCallable listEnvironmentsCallable() { return listEnvironmentsCallable; } + public UnaryCallable + listEnvironmentsPagedCallable() { + return listEnvironmentsPagedCallable; + } + public UnaryCallable getEnvironmentCallable() { return getEnvironmentCallable; } - @BetaApi("The surface for use by generated code is not stable yet and may change in the future.") + public UnaryCallable createEnvironmentCallable() { + return createEnvironmentCallable; + } + public OperationCallable createEnvironmentOperationCallable() { return createEnvironmentOperationCallable; } - public UnaryCallable createEnvironmentCallable() { - return createEnvironmentCallable; + public UnaryCallable updateEnvironmentCallable() { + return updateEnvironmentCallable; } - @BetaApi("The surface for use by generated code is not stable yet and may change in the future.") public OperationCallable updateEnvironmentOperationCallable() { return updateEnvironmentOperationCallable; } - public UnaryCallable updateEnvironmentCallable() { - return updateEnvironmentCallable; - } - public UnaryCallable deleteEnvironmentCallable() { return deleteEnvironmentCallable; } - public UnaryCallable - lookupEnvironmentHistoryPagedCallable() { - return lookupEnvironmentHistoryPagedCallable; - } - public UnaryCallable lookupEnvironmentHistoryCallable() { return lookupEnvironmentHistoryCallable; } + public UnaryCallable + lookupEnvironmentHistoryPagedCallable() { + return lookupEnvironmentHistoryPagedCallable; + } + @Override public final void close() { shutdown(); diff --git a/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3/stub/GrpcFlowsCallableFactory.java b/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3/stub/GrpcFlowsCallableFactory.java index f029bfa66..ac4d9854c 100644 --- a/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3/stub/GrpcFlowsCallableFactory.java +++ b/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3/stub/GrpcFlowsCallableFactory.java @@ -5,7 +5,7 @@ * 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 + * 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, @@ -13,9 +13,9 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.google.cloud.dialogflow.cx.v3.stub; -import com.google.api.core.BetaApi; import com.google.api.gax.grpc.GrpcCallSettings; import com.google.api.gax.grpc.GrpcCallableFactory; import com.google.api.gax.grpc.GrpcStubCallableFactory; @@ -31,18 +31,19 @@ import com.google.api.gax.rpc.StreamingCallSettings; import com.google.api.gax.rpc.UnaryCallSettings; import com.google.api.gax.rpc.UnaryCallable; +import com.google.longrunning.Operation; import com.google.longrunning.stub.OperationsStub; import javax.annotation.Generated; -// AUTO-GENERATED DOCUMENTATION AND CLASS +// AUTO-GENERATED DOCUMENTATION AND CLASS. /** - * gRPC callable factory implementation for Dialogflow API. + * gRPC callable factory implementation for the Flows service API. * *

This class is for advanced usage. */ @Generated("by gapic-generator") -@BetaApi("The surface for use by generated code is not stable yet and may change in the future.") public class GrpcFlowsCallableFactory implements GrpcStubCallableFactory { + @Override public UnaryCallable createUnaryCallable( GrpcCallSettings grpcCallSettings, @@ -55,61 +56,58 @@ public UnaryCallable createUnaryCalla public UnaryCallable createPagedCallable( GrpcCallSettings grpcCallSettings, - PagedCallSettings pagedCallSettings, + PagedCallSettings callSettings, ClientContext clientContext) { - return GrpcCallableFactory.createPagedCallable( - grpcCallSettings, pagedCallSettings, clientContext); + return GrpcCallableFactory.createPagedCallable(grpcCallSettings, callSettings, clientContext); } @Override public UnaryCallable createBatchingCallable( GrpcCallSettings grpcCallSettings, - BatchingCallSettings batchingCallSettings, + BatchingCallSettings callSettings, ClientContext clientContext) { return GrpcCallableFactory.createBatchingCallable( - grpcCallSettings, batchingCallSettings, clientContext); + grpcCallSettings, callSettings, clientContext); } - @BetaApi( - "The surface for long-running operations is not stable yet and may change in the future.") @Override public OperationCallable createOperationCallable( - GrpcCallSettings grpcCallSettings, - OperationCallSettings operationCallSettings, + GrpcCallSettings grpcCallSettings, + OperationCallSettings callSettings, ClientContext clientContext, OperationsStub operationsStub) { return GrpcCallableFactory.createOperationCallable( - grpcCallSettings, operationCallSettings, clientContext, operationsStub); + grpcCallSettings, callSettings, clientContext, operationsStub); } @Override public BidiStreamingCallable createBidiStreamingCallable( GrpcCallSettings grpcCallSettings, - StreamingCallSettings streamingCallSettings, + StreamingCallSettings callSettings, ClientContext clientContext) { return GrpcCallableFactory.createBidiStreamingCallable( - grpcCallSettings, streamingCallSettings, clientContext); + grpcCallSettings, callSettings, clientContext); } @Override public ServerStreamingCallable createServerStreamingCallable( GrpcCallSettings grpcCallSettings, - ServerStreamingCallSettings streamingCallSettings, + ServerStreamingCallSettings callSettings, ClientContext clientContext) { return GrpcCallableFactory.createServerStreamingCallable( - grpcCallSettings, streamingCallSettings, clientContext); + grpcCallSettings, callSettings, clientContext); } @Override public ClientStreamingCallable createClientStreamingCallable( GrpcCallSettings grpcCallSettings, - StreamingCallSettings streamingCallSettings, + StreamingCallSettings callSettings, ClientContext clientContext) { return GrpcCallableFactory.createClientStreamingCallable( - grpcCallSettings, streamingCallSettings, clientContext); + grpcCallSettings, callSettings, clientContext); } } diff --git a/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3/stub/GrpcFlowsStub.java b/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3/stub/GrpcFlowsStub.java index 48f50c864..6d07ec3dc 100644 --- a/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3/stub/GrpcFlowsStub.java +++ b/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3/stub/GrpcFlowsStub.java @@ -5,7 +5,7 @@ * 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 + * 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, @@ -13,11 +13,11 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.google.cloud.dialogflow.cx.v3.stub; import static com.google.cloud.dialogflow.cx.v3.FlowsClient.ListFlowsPagedResponse; -import com.google.api.core.BetaApi; import com.google.api.gax.core.BackgroundResource; import com.google.api.gax.core.BackgroundResourceAggregation; import com.google.api.gax.grpc.GrpcCallSettings; @@ -46,16 +46,14 @@ import java.util.concurrent.TimeUnit; import javax.annotation.Generated; -// AUTO-GENERATED DOCUMENTATION AND CLASS +// AUTO-GENERATED DOCUMENTATION AND CLASS. /** - * gRPC stub implementation for Dialogflow API. + * gRPC stub implementation for the Flows service API. * *

This class is for advanced usage and reflects the underlying API directly. */ -@Generated("by gapic-generator") -@BetaApi("A restructuring of stub classes is planned, so this may break in the future") +@Generated("by gapic-generator-java") public class GrpcFlowsStub extends FlowsStub { - private static final MethodDescriptor createFlowMethodDescriptor = MethodDescriptor.newBuilder() .setType(MethodDescriptor.MethodType.UNARY) @@ -63,6 +61,7 @@ public class GrpcFlowsStub extends FlowsStub { .setRequestMarshaller(ProtoUtils.marshaller(CreateFlowRequest.getDefaultInstance())) .setResponseMarshaller(ProtoUtils.marshaller(Flow.getDefaultInstance())) .build(); + private static final MethodDescriptor deleteFlowMethodDescriptor = MethodDescriptor.newBuilder() .setType(MethodDescriptor.MethodType.UNARY) @@ -70,6 +69,7 @@ public class GrpcFlowsStub extends FlowsStub { .setRequestMarshaller(ProtoUtils.marshaller(DeleteFlowRequest.getDefaultInstance())) .setResponseMarshaller(ProtoUtils.marshaller(Empty.getDefaultInstance())) .build(); + private static final MethodDescriptor listFlowsMethodDescriptor = MethodDescriptor.newBuilder() @@ -78,6 +78,7 @@ public class GrpcFlowsStub extends FlowsStub { .setRequestMarshaller(ProtoUtils.marshaller(ListFlowsRequest.getDefaultInstance())) .setResponseMarshaller(ProtoUtils.marshaller(ListFlowsResponse.getDefaultInstance())) .build(); + private static final MethodDescriptor getFlowMethodDescriptor = MethodDescriptor.newBuilder() .setType(MethodDescriptor.MethodType.UNARY) @@ -85,6 +86,7 @@ public class GrpcFlowsStub extends FlowsStub { .setRequestMarshaller(ProtoUtils.marshaller(GetFlowRequest.getDefaultInstance())) .setResponseMarshaller(ProtoUtils.marshaller(Flow.getDefaultInstance())) .build(); + private static final MethodDescriptor updateFlowMethodDescriptor = MethodDescriptor.newBuilder() .setType(MethodDescriptor.MethodType.UNARY) @@ -92,6 +94,7 @@ public class GrpcFlowsStub extends FlowsStub { .setRequestMarshaller(ProtoUtils.marshaller(UpdateFlowRequest.getDefaultInstance())) .setResponseMarshaller(ProtoUtils.marshaller(Flow.getDefaultInstance())) .build(); + private static final MethodDescriptor trainFlowMethodDescriptor = MethodDescriptor.newBuilder() .setType(MethodDescriptor.MethodType.UNARY) @@ -100,9 +103,6 @@ public class GrpcFlowsStub extends FlowsStub { .setResponseMarshaller(ProtoUtils.marshaller(Operation.getDefaultInstance())) .build(); - private final BackgroundResource backgroundResources; - private final GrpcOperationsStub operationsStub; - private final UnaryCallable createFlowCallable; private final UnaryCallable deleteFlowCallable; private final UnaryCallable listFlowsCallable; @@ -112,6 +112,8 @@ public class GrpcFlowsStub extends FlowsStub { private final UnaryCallable trainFlowCallable; private final OperationCallable trainFlowOperationCallable; + private final BackgroundResource backgroundResources; + private final GrpcOperationsStub operationsStub; private final GrpcStubCallableFactory callableFactory; public static final GrpcFlowsStub create(FlowsStubSettings settings) throws IOException { @@ -254,12 +256,12 @@ public Map extract(TrainFlowRequest request) { trainFlowTransportSettings, settings.trainFlowOperationSettings(), clientContext, - this.operationsStub); + operationsStub); - backgroundResources = new BackgroundResourceAggregation(clientContext.getBackgroundResources()); + this.backgroundResources = + new BackgroundResourceAggregation(clientContext.getBackgroundResources()); } - @BetaApi("The surface for use by generated code is not stable yet and may change in the future.") public GrpcOperationsStub getOperationsStub() { return operationsStub; } @@ -272,14 +274,14 @@ public UnaryCallable deleteFlowCallable() { return deleteFlowCallable; } - public UnaryCallable listFlowsPagedCallable() { - return listFlowsPagedCallable; - } - public UnaryCallable listFlowsCallable() { return listFlowsCallable; } + public UnaryCallable listFlowsPagedCallable() { + return listFlowsPagedCallable; + } + public UnaryCallable getFlowCallable() { return getFlowCallable; } @@ -288,15 +290,14 @@ public UnaryCallable updateFlowCallable() { return updateFlowCallable; } - @BetaApi("The surface for use by generated code is not stable yet and may change in the future.") - public OperationCallable trainFlowOperationCallable() { - return trainFlowOperationCallable; - } - public UnaryCallable trainFlowCallable() { return trainFlowCallable; } + public OperationCallable trainFlowOperationCallable() { + return trainFlowOperationCallable; + } + @Override public final void close() { shutdown(); diff --git a/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3/stub/GrpcIntentsCallableFactory.java b/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3/stub/GrpcIntentsCallableFactory.java index a5dc15c25..5bfe77608 100644 --- a/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3/stub/GrpcIntentsCallableFactory.java +++ b/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3/stub/GrpcIntentsCallableFactory.java @@ -5,7 +5,7 @@ * 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 + * 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, @@ -13,9 +13,9 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.google.cloud.dialogflow.cx.v3.stub; -import com.google.api.core.BetaApi; import com.google.api.gax.grpc.GrpcCallSettings; import com.google.api.gax.grpc.GrpcCallableFactory; import com.google.api.gax.grpc.GrpcStubCallableFactory; @@ -31,18 +31,19 @@ import com.google.api.gax.rpc.StreamingCallSettings; import com.google.api.gax.rpc.UnaryCallSettings; import com.google.api.gax.rpc.UnaryCallable; +import com.google.longrunning.Operation; import com.google.longrunning.stub.OperationsStub; import javax.annotation.Generated; -// AUTO-GENERATED DOCUMENTATION AND CLASS +// AUTO-GENERATED DOCUMENTATION AND CLASS. /** - * gRPC callable factory implementation for Dialogflow API. + * gRPC callable factory implementation for the Intents service API. * *

This class is for advanced usage. */ @Generated("by gapic-generator") -@BetaApi("The surface for use by generated code is not stable yet and may change in the future.") public class GrpcIntentsCallableFactory implements GrpcStubCallableFactory { + @Override public UnaryCallable createUnaryCallable( GrpcCallSettings grpcCallSettings, @@ -55,61 +56,58 @@ public UnaryCallable createUnaryCalla public UnaryCallable createPagedCallable( GrpcCallSettings grpcCallSettings, - PagedCallSettings pagedCallSettings, + PagedCallSettings callSettings, ClientContext clientContext) { - return GrpcCallableFactory.createPagedCallable( - grpcCallSettings, pagedCallSettings, clientContext); + return GrpcCallableFactory.createPagedCallable(grpcCallSettings, callSettings, clientContext); } @Override public UnaryCallable createBatchingCallable( GrpcCallSettings grpcCallSettings, - BatchingCallSettings batchingCallSettings, + BatchingCallSettings callSettings, ClientContext clientContext) { return GrpcCallableFactory.createBatchingCallable( - grpcCallSettings, batchingCallSettings, clientContext); + grpcCallSettings, callSettings, clientContext); } - @BetaApi( - "The surface for long-running operations is not stable yet and may change in the future.") @Override public OperationCallable createOperationCallable( - GrpcCallSettings grpcCallSettings, - OperationCallSettings operationCallSettings, + GrpcCallSettings grpcCallSettings, + OperationCallSettings callSettings, ClientContext clientContext, OperationsStub operationsStub) { return GrpcCallableFactory.createOperationCallable( - grpcCallSettings, operationCallSettings, clientContext, operationsStub); + grpcCallSettings, callSettings, clientContext, operationsStub); } @Override public BidiStreamingCallable createBidiStreamingCallable( GrpcCallSettings grpcCallSettings, - StreamingCallSettings streamingCallSettings, + StreamingCallSettings callSettings, ClientContext clientContext) { return GrpcCallableFactory.createBidiStreamingCallable( - grpcCallSettings, streamingCallSettings, clientContext); + grpcCallSettings, callSettings, clientContext); } @Override public ServerStreamingCallable createServerStreamingCallable( GrpcCallSettings grpcCallSettings, - ServerStreamingCallSettings streamingCallSettings, + ServerStreamingCallSettings callSettings, ClientContext clientContext) { return GrpcCallableFactory.createServerStreamingCallable( - grpcCallSettings, streamingCallSettings, clientContext); + grpcCallSettings, callSettings, clientContext); } @Override public ClientStreamingCallable createClientStreamingCallable( GrpcCallSettings grpcCallSettings, - StreamingCallSettings streamingCallSettings, + StreamingCallSettings callSettings, ClientContext clientContext) { return GrpcCallableFactory.createClientStreamingCallable( - grpcCallSettings, streamingCallSettings, clientContext); + grpcCallSettings, callSettings, clientContext); } } diff --git a/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3/stub/GrpcIntentsStub.java b/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3/stub/GrpcIntentsStub.java index 34c139bfb..55ca6f342 100644 --- a/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3/stub/GrpcIntentsStub.java +++ b/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3/stub/GrpcIntentsStub.java @@ -5,7 +5,7 @@ * 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 + * 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, @@ -13,11 +13,11 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.google.cloud.dialogflow.cx.v3.stub; import static com.google.cloud.dialogflow.cx.v3.IntentsClient.ListIntentsPagedResponse; -import com.google.api.core.BetaApi; import com.google.api.gax.core.BackgroundResource; import com.google.api.gax.core.BackgroundResourceAggregation; import com.google.api.gax.grpc.GrpcCallSettings; @@ -33,6 +33,7 @@ import com.google.cloud.dialogflow.cx.v3.ListIntentsResponse; import com.google.cloud.dialogflow.cx.v3.UpdateIntentRequest; import com.google.common.collect.ImmutableMap; +import com.google.longrunning.stub.GrpcOperationsStub; import com.google.protobuf.Empty; import io.grpc.MethodDescriptor; import io.grpc.protobuf.ProtoUtils; @@ -41,16 +42,14 @@ import java.util.concurrent.TimeUnit; import javax.annotation.Generated; -// AUTO-GENERATED DOCUMENTATION AND CLASS +// AUTO-GENERATED DOCUMENTATION AND CLASS. /** - * gRPC stub implementation for Dialogflow API. + * gRPC stub implementation for the Intents service API. * *

This class is for advanced usage and reflects the underlying API directly. */ -@Generated("by gapic-generator") -@BetaApi("A restructuring of stub classes is planned, so this may break in the future") +@Generated("by gapic-generator-java") public class GrpcIntentsStub extends IntentsStub { - private static final MethodDescriptor listIntentsMethodDescriptor = MethodDescriptor.newBuilder() @@ -60,6 +59,7 @@ public class GrpcIntentsStub extends IntentsStub { .setResponseMarshaller( ProtoUtils.marshaller(ListIntentsResponse.getDefaultInstance())) .build(); + private static final MethodDescriptor getIntentMethodDescriptor = MethodDescriptor.newBuilder() .setType(MethodDescriptor.MethodType.UNARY) @@ -67,6 +67,7 @@ public class GrpcIntentsStub extends IntentsStub { .setRequestMarshaller(ProtoUtils.marshaller(GetIntentRequest.getDefaultInstance())) .setResponseMarshaller(ProtoUtils.marshaller(Intent.getDefaultInstance())) .build(); + private static final MethodDescriptor createIntentMethodDescriptor = MethodDescriptor.newBuilder() .setType(MethodDescriptor.MethodType.UNARY) @@ -74,6 +75,7 @@ public class GrpcIntentsStub extends IntentsStub { .setRequestMarshaller(ProtoUtils.marshaller(CreateIntentRequest.getDefaultInstance())) .setResponseMarshaller(ProtoUtils.marshaller(Intent.getDefaultInstance())) .build(); + private static final MethodDescriptor updateIntentMethodDescriptor = MethodDescriptor.newBuilder() .setType(MethodDescriptor.MethodType.UNARY) @@ -81,6 +83,7 @@ public class GrpcIntentsStub extends IntentsStub { .setRequestMarshaller(ProtoUtils.marshaller(UpdateIntentRequest.getDefaultInstance())) .setResponseMarshaller(ProtoUtils.marshaller(Intent.getDefaultInstance())) .build(); + private static final MethodDescriptor deleteIntentMethodDescriptor = MethodDescriptor.newBuilder() .setType(MethodDescriptor.MethodType.UNARY) @@ -89,8 +92,6 @@ public class GrpcIntentsStub extends IntentsStub { .setResponseMarshaller(ProtoUtils.marshaller(Empty.getDefaultInstance())) .build(); - private final BackgroundResource backgroundResources; - private final UnaryCallable listIntentsCallable; private final UnaryCallable listIntentsPagedCallable; @@ -99,6 +100,8 @@ public class GrpcIntentsStub extends IntentsStub { private final UnaryCallable updateIntentCallable; private final UnaryCallable deleteIntentCallable; + private final BackgroundResource backgroundResources; + private final GrpcOperationsStub operationsStub; private final GrpcStubCallableFactory callableFactory; public static final GrpcIntentsStub create(IntentsStubSettings settings) throws IOException { @@ -134,6 +137,7 @@ protected GrpcIntentsStub( GrpcStubCallableFactory callableFactory) throws IOException { this.callableFactory = callableFactory; + this.operationsStub = GrpcOperationsStub.create(clientContext, callableFactory); GrpcCallSettings listIntentsTransportSettings = GrpcCallSettings.newBuilder() @@ -220,17 +224,22 @@ public Map extract(DeleteIntentRequest request) { callableFactory.createUnaryCallable( deleteIntentTransportSettings, settings.deleteIntentSettings(), clientContext); - backgroundResources = new BackgroundResourceAggregation(clientContext.getBackgroundResources()); + this.backgroundResources = + new BackgroundResourceAggregation(clientContext.getBackgroundResources()); } - public UnaryCallable listIntentsPagedCallable() { - return listIntentsPagedCallable; + public GrpcOperationsStub getOperationsStub() { + return operationsStub; } public UnaryCallable listIntentsCallable() { return listIntentsCallable; } + public UnaryCallable listIntentsPagedCallable() { + return listIntentsPagedCallable; + } + public UnaryCallable getIntentCallable() { return getIntentCallable; } diff --git a/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3/stub/GrpcPagesCallableFactory.java b/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3/stub/GrpcPagesCallableFactory.java index c58978775..d47dc9879 100644 --- a/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3/stub/GrpcPagesCallableFactory.java +++ b/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3/stub/GrpcPagesCallableFactory.java @@ -5,7 +5,7 @@ * 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 + * 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, @@ -13,9 +13,9 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.google.cloud.dialogflow.cx.v3.stub; -import com.google.api.core.BetaApi; import com.google.api.gax.grpc.GrpcCallSettings; import com.google.api.gax.grpc.GrpcCallableFactory; import com.google.api.gax.grpc.GrpcStubCallableFactory; @@ -31,18 +31,19 @@ import com.google.api.gax.rpc.StreamingCallSettings; import com.google.api.gax.rpc.UnaryCallSettings; import com.google.api.gax.rpc.UnaryCallable; +import com.google.longrunning.Operation; import com.google.longrunning.stub.OperationsStub; import javax.annotation.Generated; -// AUTO-GENERATED DOCUMENTATION AND CLASS +// AUTO-GENERATED DOCUMENTATION AND CLASS. /** - * gRPC callable factory implementation for Dialogflow API. + * gRPC callable factory implementation for the Pages service API. * *

This class is for advanced usage. */ @Generated("by gapic-generator") -@BetaApi("The surface for use by generated code is not stable yet and may change in the future.") public class GrpcPagesCallableFactory implements GrpcStubCallableFactory { + @Override public UnaryCallable createUnaryCallable( GrpcCallSettings grpcCallSettings, @@ -55,61 +56,58 @@ public UnaryCallable createUnaryCalla public UnaryCallable createPagedCallable( GrpcCallSettings grpcCallSettings, - PagedCallSettings pagedCallSettings, + PagedCallSettings callSettings, ClientContext clientContext) { - return GrpcCallableFactory.createPagedCallable( - grpcCallSettings, pagedCallSettings, clientContext); + return GrpcCallableFactory.createPagedCallable(grpcCallSettings, callSettings, clientContext); } @Override public UnaryCallable createBatchingCallable( GrpcCallSettings grpcCallSettings, - BatchingCallSettings batchingCallSettings, + BatchingCallSettings callSettings, ClientContext clientContext) { return GrpcCallableFactory.createBatchingCallable( - grpcCallSettings, batchingCallSettings, clientContext); + grpcCallSettings, callSettings, clientContext); } - @BetaApi( - "The surface for long-running operations is not stable yet and may change in the future.") @Override public OperationCallable createOperationCallable( - GrpcCallSettings grpcCallSettings, - OperationCallSettings operationCallSettings, + GrpcCallSettings grpcCallSettings, + OperationCallSettings callSettings, ClientContext clientContext, OperationsStub operationsStub) { return GrpcCallableFactory.createOperationCallable( - grpcCallSettings, operationCallSettings, clientContext, operationsStub); + grpcCallSettings, callSettings, clientContext, operationsStub); } @Override public BidiStreamingCallable createBidiStreamingCallable( GrpcCallSettings grpcCallSettings, - StreamingCallSettings streamingCallSettings, + StreamingCallSettings callSettings, ClientContext clientContext) { return GrpcCallableFactory.createBidiStreamingCallable( - grpcCallSettings, streamingCallSettings, clientContext); + grpcCallSettings, callSettings, clientContext); } @Override public ServerStreamingCallable createServerStreamingCallable( GrpcCallSettings grpcCallSettings, - ServerStreamingCallSettings streamingCallSettings, + ServerStreamingCallSettings callSettings, ClientContext clientContext) { return GrpcCallableFactory.createServerStreamingCallable( - grpcCallSettings, streamingCallSettings, clientContext); + grpcCallSettings, callSettings, clientContext); } @Override public ClientStreamingCallable createClientStreamingCallable( GrpcCallSettings grpcCallSettings, - StreamingCallSettings streamingCallSettings, + StreamingCallSettings callSettings, ClientContext clientContext) { return GrpcCallableFactory.createClientStreamingCallable( - grpcCallSettings, streamingCallSettings, clientContext); + grpcCallSettings, callSettings, clientContext); } } diff --git a/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3/stub/GrpcPagesStub.java b/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3/stub/GrpcPagesStub.java index 33c5e49ce..b52f66cfd 100644 --- a/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3/stub/GrpcPagesStub.java +++ b/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3/stub/GrpcPagesStub.java @@ -5,7 +5,7 @@ * 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 + * 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, @@ -13,11 +13,11 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.google.cloud.dialogflow.cx.v3.stub; import static com.google.cloud.dialogflow.cx.v3.PagesClient.ListPagesPagedResponse; -import com.google.api.core.BetaApi; import com.google.api.gax.core.BackgroundResource; import com.google.api.gax.core.BackgroundResourceAggregation; import com.google.api.gax.grpc.GrpcCallSettings; @@ -33,6 +33,7 @@ import com.google.cloud.dialogflow.cx.v3.Page; import com.google.cloud.dialogflow.cx.v3.UpdatePageRequest; import com.google.common.collect.ImmutableMap; +import com.google.longrunning.stub.GrpcOperationsStub; import com.google.protobuf.Empty; import io.grpc.MethodDescriptor; import io.grpc.protobuf.ProtoUtils; @@ -41,16 +42,14 @@ import java.util.concurrent.TimeUnit; import javax.annotation.Generated; -// AUTO-GENERATED DOCUMENTATION AND CLASS +// AUTO-GENERATED DOCUMENTATION AND CLASS. /** - * gRPC stub implementation for Dialogflow API. + * gRPC stub implementation for the Pages service API. * *

This class is for advanced usage and reflects the underlying API directly. */ -@Generated("by gapic-generator") -@BetaApi("A restructuring of stub classes is planned, so this may break in the future") +@Generated("by gapic-generator-java") public class GrpcPagesStub extends PagesStub { - private static final MethodDescriptor listPagesMethodDescriptor = MethodDescriptor.newBuilder() @@ -59,6 +58,7 @@ public class GrpcPagesStub extends PagesStub { .setRequestMarshaller(ProtoUtils.marshaller(ListPagesRequest.getDefaultInstance())) .setResponseMarshaller(ProtoUtils.marshaller(ListPagesResponse.getDefaultInstance())) .build(); + private static final MethodDescriptor getPageMethodDescriptor = MethodDescriptor.newBuilder() .setType(MethodDescriptor.MethodType.UNARY) @@ -66,6 +66,7 @@ public class GrpcPagesStub extends PagesStub { .setRequestMarshaller(ProtoUtils.marshaller(GetPageRequest.getDefaultInstance())) .setResponseMarshaller(ProtoUtils.marshaller(Page.getDefaultInstance())) .build(); + private static final MethodDescriptor createPageMethodDescriptor = MethodDescriptor.newBuilder() .setType(MethodDescriptor.MethodType.UNARY) @@ -73,6 +74,7 @@ public class GrpcPagesStub extends PagesStub { .setRequestMarshaller(ProtoUtils.marshaller(CreatePageRequest.getDefaultInstance())) .setResponseMarshaller(ProtoUtils.marshaller(Page.getDefaultInstance())) .build(); + private static final MethodDescriptor updatePageMethodDescriptor = MethodDescriptor.newBuilder() .setType(MethodDescriptor.MethodType.UNARY) @@ -80,6 +82,7 @@ public class GrpcPagesStub extends PagesStub { .setRequestMarshaller(ProtoUtils.marshaller(UpdatePageRequest.getDefaultInstance())) .setResponseMarshaller(ProtoUtils.marshaller(Page.getDefaultInstance())) .build(); + private static final MethodDescriptor deletePageMethodDescriptor = MethodDescriptor.newBuilder() .setType(MethodDescriptor.MethodType.UNARY) @@ -88,8 +91,6 @@ public class GrpcPagesStub extends PagesStub { .setResponseMarshaller(ProtoUtils.marshaller(Empty.getDefaultInstance())) .build(); - private final BackgroundResource backgroundResources; - private final UnaryCallable listPagesCallable; private final UnaryCallable listPagesPagedCallable; private final UnaryCallable getPageCallable; @@ -97,6 +98,8 @@ public class GrpcPagesStub extends PagesStub { private final UnaryCallable updatePageCallable; private final UnaryCallable deletePageCallable; + private final BackgroundResource backgroundResources; + private final GrpcOperationsStub operationsStub; private final GrpcStubCallableFactory callableFactory; public static final GrpcPagesStub create(PagesStubSettings settings) throws IOException { @@ -132,6 +135,7 @@ protected GrpcPagesStub( GrpcStubCallableFactory callableFactory) throws IOException { this.callableFactory = callableFactory; + this.operationsStub = GrpcOperationsStub.create(clientContext, callableFactory); GrpcCallSettings listPagesTransportSettings = GrpcCallSettings.newBuilder() @@ -218,17 +222,22 @@ public Map extract(DeletePageRequest request) { callableFactory.createUnaryCallable( deletePageTransportSettings, settings.deletePageSettings(), clientContext); - backgroundResources = new BackgroundResourceAggregation(clientContext.getBackgroundResources()); + this.backgroundResources = + new BackgroundResourceAggregation(clientContext.getBackgroundResources()); } - public UnaryCallable listPagesPagedCallable() { - return listPagesPagedCallable; + public GrpcOperationsStub getOperationsStub() { + return operationsStub; } public UnaryCallable listPagesCallable() { return listPagesCallable; } + public UnaryCallable listPagesPagedCallable() { + return listPagesPagedCallable; + } + public UnaryCallable getPageCallable() { return getPageCallable; } diff --git a/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3/stub/GrpcSecuritySettingsServiceCallableFactory.java b/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3/stub/GrpcSecuritySettingsServiceCallableFactory.java index 47d00bc03..03c7fb881 100644 --- a/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3/stub/GrpcSecuritySettingsServiceCallableFactory.java +++ b/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3/stub/GrpcSecuritySettingsServiceCallableFactory.java @@ -5,7 +5,7 @@ * 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 + * 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, @@ -13,9 +13,9 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.google.cloud.dialogflow.cx.v3.stub; -import com.google.api.core.BetaApi; import com.google.api.gax.grpc.GrpcCallSettings; import com.google.api.gax.grpc.GrpcCallableFactory; import com.google.api.gax.grpc.GrpcStubCallableFactory; @@ -31,18 +31,19 @@ import com.google.api.gax.rpc.StreamingCallSettings; import com.google.api.gax.rpc.UnaryCallSettings; import com.google.api.gax.rpc.UnaryCallable; +import com.google.longrunning.Operation; import com.google.longrunning.stub.OperationsStub; import javax.annotation.Generated; -// AUTO-GENERATED DOCUMENTATION AND CLASS +// AUTO-GENERATED DOCUMENTATION AND CLASS. /** - * gRPC callable factory implementation for Dialogflow API. + * gRPC callable factory implementation for the SecuritySettingsService service API. * *

This class is for advanced usage. */ @Generated("by gapic-generator") -@BetaApi("The surface for use by generated code is not stable yet and may change in the future.") public class GrpcSecuritySettingsServiceCallableFactory implements GrpcStubCallableFactory { + @Override public UnaryCallable createUnaryCallable( GrpcCallSettings grpcCallSettings, @@ -55,61 +56,58 @@ public UnaryCallable createUnaryCalla public UnaryCallable createPagedCallable( GrpcCallSettings grpcCallSettings, - PagedCallSettings pagedCallSettings, + PagedCallSettings callSettings, ClientContext clientContext) { - return GrpcCallableFactory.createPagedCallable( - grpcCallSettings, pagedCallSettings, clientContext); + return GrpcCallableFactory.createPagedCallable(grpcCallSettings, callSettings, clientContext); } @Override public UnaryCallable createBatchingCallable( GrpcCallSettings grpcCallSettings, - BatchingCallSettings batchingCallSettings, + BatchingCallSettings callSettings, ClientContext clientContext) { return GrpcCallableFactory.createBatchingCallable( - grpcCallSettings, batchingCallSettings, clientContext); + grpcCallSettings, callSettings, clientContext); } - @BetaApi( - "The surface for long-running operations is not stable yet and may change in the future.") @Override public OperationCallable createOperationCallable( - GrpcCallSettings grpcCallSettings, - OperationCallSettings operationCallSettings, + GrpcCallSettings grpcCallSettings, + OperationCallSettings callSettings, ClientContext clientContext, OperationsStub operationsStub) { return GrpcCallableFactory.createOperationCallable( - grpcCallSettings, operationCallSettings, clientContext, operationsStub); + grpcCallSettings, callSettings, clientContext, operationsStub); } @Override public BidiStreamingCallable createBidiStreamingCallable( GrpcCallSettings grpcCallSettings, - StreamingCallSettings streamingCallSettings, + StreamingCallSettings callSettings, ClientContext clientContext) { return GrpcCallableFactory.createBidiStreamingCallable( - grpcCallSettings, streamingCallSettings, clientContext); + grpcCallSettings, callSettings, clientContext); } @Override public ServerStreamingCallable createServerStreamingCallable( GrpcCallSettings grpcCallSettings, - ServerStreamingCallSettings streamingCallSettings, + ServerStreamingCallSettings callSettings, ClientContext clientContext) { return GrpcCallableFactory.createServerStreamingCallable( - grpcCallSettings, streamingCallSettings, clientContext); + grpcCallSettings, callSettings, clientContext); } @Override public ClientStreamingCallable createClientStreamingCallable( GrpcCallSettings grpcCallSettings, - StreamingCallSettings streamingCallSettings, + StreamingCallSettings callSettings, ClientContext clientContext) { return GrpcCallableFactory.createClientStreamingCallable( - grpcCallSettings, streamingCallSettings, clientContext); + grpcCallSettings, callSettings, clientContext); } } diff --git a/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3/stub/GrpcSecuritySettingsServiceStub.java b/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3/stub/GrpcSecuritySettingsServiceStub.java index f1a7b5a94..920c68bb4 100644 --- a/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3/stub/GrpcSecuritySettingsServiceStub.java +++ b/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3/stub/GrpcSecuritySettingsServiceStub.java @@ -5,7 +5,7 @@ * 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 + * 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, @@ -13,11 +13,11 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.google.cloud.dialogflow.cx.v3.stub; import static com.google.cloud.dialogflow.cx.v3.SecuritySettingsServiceClient.ListSecuritySettingsPagedResponse; -import com.google.api.core.BetaApi; import com.google.api.gax.core.BackgroundResource; import com.google.api.gax.core.BackgroundResourceAggregation; import com.google.api.gax.grpc.GrpcCallSettings; @@ -33,6 +33,7 @@ import com.google.cloud.dialogflow.cx.v3.SecuritySettings; import com.google.cloud.dialogflow.cx.v3.UpdateSecuritySettingsRequest; import com.google.common.collect.ImmutableMap; +import com.google.longrunning.stub.GrpcOperationsStub; import com.google.protobuf.Empty; import io.grpc.MethodDescriptor; import io.grpc.protobuf.ProtoUtils; @@ -41,16 +42,14 @@ import java.util.concurrent.TimeUnit; import javax.annotation.Generated; -// AUTO-GENERATED DOCUMENTATION AND CLASS +// AUTO-GENERATED DOCUMENTATION AND CLASS. /** - * gRPC stub implementation for Dialogflow API. + * gRPC stub implementation for the SecuritySettingsService service API. * *

This class is for advanced usage and reflects the underlying API directly. */ -@Generated("by gapic-generator") -@BetaApi("A restructuring of stub classes is planned, so this may break in the future") +@Generated("by gapic-generator-java") public class GrpcSecuritySettingsServiceStub extends SecuritySettingsServiceStub { - private static final MethodDescriptor createSecuritySettingsMethodDescriptor = MethodDescriptor.newBuilder() @@ -61,6 +60,7 @@ public class GrpcSecuritySettingsServiceStub extends SecuritySettingsServiceStub ProtoUtils.marshaller(CreateSecuritySettingsRequest.getDefaultInstance())) .setResponseMarshaller(ProtoUtils.marshaller(SecuritySettings.getDefaultInstance())) .build(); + private static final MethodDescriptor getSecuritySettingsMethodDescriptor = MethodDescriptor.newBuilder() @@ -71,6 +71,7 @@ public class GrpcSecuritySettingsServiceStub extends SecuritySettingsServiceStub ProtoUtils.marshaller(GetSecuritySettingsRequest.getDefaultInstance())) .setResponseMarshaller(ProtoUtils.marshaller(SecuritySettings.getDefaultInstance())) .build(); + private static final MethodDescriptor updateSecuritySettingsMethodDescriptor = MethodDescriptor.newBuilder() @@ -81,6 +82,7 @@ public class GrpcSecuritySettingsServiceStub extends SecuritySettingsServiceStub ProtoUtils.marshaller(UpdateSecuritySettingsRequest.getDefaultInstance())) .setResponseMarshaller(ProtoUtils.marshaller(SecuritySettings.getDefaultInstance())) .build(); + private static final MethodDescriptor listSecuritySettingsMethodDescriptor = MethodDescriptor.newBuilder() @@ -92,6 +94,7 @@ public class GrpcSecuritySettingsServiceStub extends SecuritySettingsServiceStub .setResponseMarshaller( ProtoUtils.marshaller(ListSecuritySettingsResponse.getDefaultInstance())) .build(); + private static final MethodDescriptor deleteSecuritySettingsMethodDescriptor = MethodDescriptor.newBuilder() @@ -103,8 +106,6 @@ public class GrpcSecuritySettingsServiceStub extends SecuritySettingsServiceStub .setResponseMarshaller(ProtoUtils.marshaller(Empty.getDefaultInstance())) .build(); - private final BackgroundResource backgroundResources; - private final UnaryCallable createSecuritySettingsCallable; private final UnaryCallable @@ -117,6 +118,8 @@ public class GrpcSecuritySettingsServiceStub extends SecuritySettingsServiceStub listSecuritySettingsPagedCallable; private final UnaryCallable deleteSecuritySettingsCallable; + private final BackgroundResource backgroundResources; + private final GrpcOperationsStub operationsStub; private final GrpcStubCallableFactory callableFactory; public static final GrpcSecuritySettingsServiceStub create( @@ -158,6 +161,7 @@ protected GrpcSecuritySettingsServiceStub( GrpcStubCallableFactory callableFactory) throws IOException { this.callableFactory = callableFactory; + this.operationsStub = GrpcOperationsStub.create(clientContext, callableFactory); GrpcCallSettings createSecuritySettingsTransportSettings = @@ -262,7 +266,12 @@ public Map extract(DeleteSecuritySettingsRequest request) { settings.deleteSecuritySettingsSettings(), clientContext); - backgroundResources = new BackgroundResourceAggregation(clientContext.getBackgroundResources()); + this.backgroundResources = + new BackgroundResourceAggregation(clientContext.getBackgroundResources()); + } + + public GrpcOperationsStub getOperationsStub() { + return operationsStub; } public UnaryCallable @@ -279,16 +288,16 @@ public UnaryCallable getSecuritySe return updateSecuritySettingsCallable; } - public UnaryCallable - listSecuritySettingsPagedCallable() { - return listSecuritySettingsPagedCallable; - } - public UnaryCallable listSecuritySettingsCallable() { return listSecuritySettingsCallable; } + public UnaryCallable + listSecuritySettingsPagedCallable() { + return listSecuritySettingsPagedCallable; + } + public UnaryCallable deleteSecuritySettingsCallable() { return deleteSecuritySettingsCallable; } diff --git a/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3/stub/GrpcSessionEntityTypesCallableFactory.java b/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3/stub/GrpcSessionEntityTypesCallableFactory.java index 5c3059130..2f6260246 100644 --- a/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3/stub/GrpcSessionEntityTypesCallableFactory.java +++ b/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3/stub/GrpcSessionEntityTypesCallableFactory.java @@ -5,7 +5,7 @@ * 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 + * 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, @@ -13,9 +13,9 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.google.cloud.dialogflow.cx.v3.stub; -import com.google.api.core.BetaApi; import com.google.api.gax.grpc.GrpcCallSettings; import com.google.api.gax.grpc.GrpcCallableFactory; import com.google.api.gax.grpc.GrpcStubCallableFactory; @@ -31,18 +31,19 @@ import com.google.api.gax.rpc.StreamingCallSettings; import com.google.api.gax.rpc.UnaryCallSettings; import com.google.api.gax.rpc.UnaryCallable; +import com.google.longrunning.Operation; import com.google.longrunning.stub.OperationsStub; import javax.annotation.Generated; -// AUTO-GENERATED DOCUMENTATION AND CLASS +// AUTO-GENERATED DOCUMENTATION AND CLASS. /** - * gRPC callable factory implementation for Dialogflow API. + * gRPC callable factory implementation for the SessionEntityTypes service API. * *

This class is for advanced usage. */ @Generated("by gapic-generator") -@BetaApi("The surface for use by generated code is not stable yet and may change in the future.") public class GrpcSessionEntityTypesCallableFactory implements GrpcStubCallableFactory { + @Override public UnaryCallable createUnaryCallable( GrpcCallSettings grpcCallSettings, @@ -55,61 +56,58 @@ public UnaryCallable createUnaryCalla public UnaryCallable createPagedCallable( GrpcCallSettings grpcCallSettings, - PagedCallSettings pagedCallSettings, + PagedCallSettings callSettings, ClientContext clientContext) { - return GrpcCallableFactory.createPagedCallable( - grpcCallSettings, pagedCallSettings, clientContext); + return GrpcCallableFactory.createPagedCallable(grpcCallSettings, callSettings, clientContext); } @Override public UnaryCallable createBatchingCallable( GrpcCallSettings grpcCallSettings, - BatchingCallSettings batchingCallSettings, + BatchingCallSettings callSettings, ClientContext clientContext) { return GrpcCallableFactory.createBatchingCallable( - grpcCallSettings, batchingCallSettings, clientContext); + grpcCallSettings, callSettings, clientContext); } - @BetaApi( - "The surface for long-running operations is not stable yet and may change in the future.") @Override public OperationCallable createOperationCallable( - GrpcCallSettings grpcCallSettings, - OperationCallSettings operationCallSettings, + GrpcCallSettings grpcCallSettings, + OperationCallSettings callSettings, ClientContext clientContext, OperationsStub operationsStub) { return GrpcCallableFactory.createOperationCallable( - grpcCallSettings, operationCallSettings, clientContext, operationsStub); + grpcCallSettings, callSettings, clientContext, operationsStub); } @Override public BidiStreamingCallable createBidiStreamingCallable( GrpcCallSettings grpcCallSettings, - StreamingCallSettings streamingCallSettings, + StreamingCallSettings callSettings, ClientContext clientContext) { return GrpcCallableFactory.createBidiStreamingCallable( - grpcCallSettings, streamingCallSettings, clientContext); + grpcCallSettings, callSettings, clientContext); } @Override public ServerStreamingCallable createServerStreamingCallable( GrpcCallSettings grpcCallSettings, - ServerStreamingCallSettings streamingCallSettings, + ServerStreamingCallSettings callSettings, ClientContext clientContext) { return GrpcCallableFactory.createServerStreamingCallable( - grpcCallSettings, streamingCallSettings, clientContext); + grpcCallSettings, callSettings, clientContext); } @Override public ClientStreamingCallable createClientStreamingCallable( GrpcCallSettings grpcCallSettings, - StreamingCallSettings streamingCallSettings, + StreamingCallSettings callSettings, ClientContext clientContext) { return GrpcCallableFactory.createClientStreamingCallable( - grpcCallSettings, streamingCallSettings, clientContext); + grpcCallSettings, callSettings, clientContext); } } diff --git a/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3/stub/GrpcSessionEntityTypesStub.java b/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3/stub/GrpcSessionEntityTypesStub.java index 51b28194b..53a22136c 100644 --- a/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3/stub/GrpcSessionEntityTypesStub.java +++ b/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3/stub/GrpcSessionEntityTypesStub.java @@ -5,7 +5,7 @@ * 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 + * 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, @@ -13,11 +13,11 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.google.cloud.dialogflow.cx.v3.stub; import static com.google.cloud.dialogflow.cx.v3.SessionEntityTypesClient.ListSessionEntityTypesPagedResponse; -import com.google.api.core.BetaApi; import com.google.api.gax.core.BackgroundResource; import com.google.api.gax.core.BackgroundResourceAggregation; import com.google.api.gax.grpc.GrpcCallSettings; @@ -33,6 +33,7 @@ import com.google.cloud.dialogflow.cx.v3.SessionEntityType; import com.google.cloud.dialogflow.cx.v3.UpdateSessionEntityTypeRequest; import com.google.common.collect.ImmutableMap; +import com.google.longrunning.stub.GrpcOperationsStub; import com.google.protobuf.Empty; import io.grpc.MethodDescriptor; import io.grpc.protobuf.ProtoUtils; @@ -41,16 +42,14 @@ import java.util.concurrent.TimeUnit; import javax.annotation.Generated; -// AUTO-GENERATED DOCUMENTATION AND CLASS +// AUTO-GENERATED DOCUMENTATION AND CLASS. /** - * gRPC stub implementation for Dialogflow API. + * gRPC stub implementation for the SessionEntityTypes service API. * *

This class is for advanced usage and reflects the underlying API directly. */ -@Generated("by gapic-generator") -@BetaApi("A restructuring of stub classes is planned, so this may break in the future") +@Generated("by gapic-generator-java") public class GrpcSessionEntityTypesStub extends SessionEntityTypesStub { - private static final MethodDescriptor< ListSessionEntityTypesRequest, ListSessionEntityTypesResponse> listSessionEntityTypesMethodDescriptor = @@ -64,6 +63,7 @@ public class GrpcSessionEntityTypesStub extends SessionEntityTypesStub { .setResponseMarshaller( ProtoUtils.marshaller(ListSessionEntityTypesResponse.getDefaultInstance())) .build(); + private static final MethodDescriptor getSessionEntityTypeMethodDescriptor = MethodDescriptor.newBuilder() @@ -74,6 +74,7 @@ public class GrpcSessionEntityTypesStub extends SessionEntityTypesStub { ProtoUtils.marshaller(GetSessionEntityTypeRequest.getDefaultInstance())) .setResponseMarshaller(ProtoUtils.marshaller(SessionEntityType.getDefaultInstance())) .build(); + private static final MethodDescriptor createSessionEntityTypeMethodDescriptor = MethodDescriptor.newBuilder() @@ -84,6 +85,7 @@ public class GrpcSessionEntityTypesStub extends SessionEntityTypesStub { ProtoUtils.marshaller(CreateSessionEntityTypeRequest.getDefaultInstance())) .setResponseMarshaller(ProtoUtils.marshaller(SessionEntityType.getDefaultInstance())) .build(); + private static final MethodDescriptor updateSessionEntityTypeMethodDescriptor = MethodDescriptor.newBuilder() @@ -94,6 +96,7 @@ public class GrpcSessionEntityTypesStub extends SessionEntityTypesStub { ProtoUtils.marshaller(UpdateSessionEntityTypeRequest.getDefaultInstance())) .setResponseMarshaller(ProtoUtils.marshaller(SessionEntityType.getDefaultInstance())) .build(); + private static final MethodDescriptor deleteSessionEntityTypeMethodDescriptor = MethodDescriptor.newBuilder() @@ -105,8 +108,6 @@ public class GrpcSessionEntityTypesStub extends SessionEntityTypesStub { .setResponseMarshaller(ProtoUtils.marshaller(Empty.getDefaultInstance())) .build(); - private final BackgroundResource backgroundResources; - private final UnaryCallable listSessionEntityTypesCallable; private final UnaryCallable @@ -120,6 +121,8 @@ public class GrpcSessionEntityTypesStub extends SessionEntityTypesStub { private final UnaryCallable deleteSessionEntityTypeCallable; + private final BackgroundResource backgroundResources; + private final GrpcOperationsStub operationsStub; private final GrpcStubCallableFactory callableFactory; public static final GrpcSessionEntityTypesStub create(SessionEntityTypesStubSettings settings) @@ -160,6 +163,7 @@ protected GrpcSessionEntityTypesStub( GrpcStubCallableFactory callableFactory) throws IOException { this.callableFactory = callableFactory; + this.operationsStub = GrpcOperationsStub.create(clientContext, callableFactory); GrpcCallSettings listSessionEntityTypesTransportSettings = @@ -266,12 +270,12 @@ public Map extract(DeleteSessionEntityTypeRequest request) { settings.deleteSessionEntityTypeSettings(), clientContext); - backgroundResources = new BackgroundResourceAggregation(clientContext.getBackgroundResources()); + this.backgroundResources = + new BackgroundResourceAggregation(clientContext.getBackgroundResources()); } - public UnaryCallable - listSessionEntityTypesPagedCallable() { - return listSessionEntityTypesPagedCallable; + public GrpcOperationsStub getOperationsStub() { + return operationsStub; } public UnaryCallable @@ -279,6 +283,11 @@ public Map extract(DeleteSessionEntityTypeRequest request) { return listSessionEntityTypesCallable; } + public UnaryCallable + listSessionEntityTypesPagedCallable() { + return listSessionEntityTypesPagedCallable; + } + public UnaryCallable getSessionEntityTypeCallable() { return getSessionEntityTypeCallable; diff --git a/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3/stub/GrpcSessionsCallableFactory.java b/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3/stub/GrpcSessionsCallableFactory.java index 186d37f1d..8d62a7f92 100644 --- a/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3/stub/GrpcSessionsCallableFactory.java +++ b/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3/stub/GrpcSessionsCallableFactory.java @@ -5,7 +5,7 @@ * 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 + * 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, @@ -13,9 +13,9 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.google.cloud.dialogflow.cx.v3.stub; -import com.google.api.core.BetaApi; import com.google.api.gax.grpc.GrpcCallSettings; import com.google.api.gax.grpc.GrpcCallableFactory; import com.google.api.gax.grpc.GrpcStubCallableFactory; @@ -31,18 +31,19 @@ import com.google.api.gax.rpc.StreamingCallSettings; import com.google.api.gax.rpc.UnaryCallSettings; import com.google.api.gax.rpc.UnaryCallable; +import com.google.longrunning.Operation; import com.google.longrunning.stub.OperationsStub; import javax.annotation.Generated; -// AUTO-GENERATED DOCUMENTATION AND CLASS +// AUTO-GENERATED DOCUMENTATION AND CLASS. /** - * gRPC callable factory implementation for Dialogflow API. + * gRPC callable factory implementation for the Sessions service API. * *

This class is for advanced usage. */ @Generated("by gapic-generator") -@BetaApi("The surface for use by generated code is not stable yet and may change in the future.") public class GrpcSessionsCallableFactory implements GrpcStubCallableFactory { + @Override public UnaryCallable createUnaryCallable( GrpcCallSettings grpcCallSettings, @@ -55,61 +56,58 @@ public UnaryCallable createUnaryCalla public UnaryCallable createPagedCallable( GrpcCallSettings grpcCallSettings, - PagedCallSettings pagedCallSettings, + PagedCallSettings callSettings, ClientContext clientContext) { - return GrpcCallableFactory.createPagedCallable( - grpcCallSettings, pagedCallSettings, clientContext); + return GrpcCallableFactory.createPagedCallable(grpcCallSettings, callSettings, clientContext); } @Override public UnaryCallable createBatchingCallable( GrpcCallSettings grpcCallSettings, - BatchingCallSettings batchingCallSettings, + BatchingCallSettings callSettings, ClientContext clientContext) { return GrpcCallableFactory.createBatchingCallable( - grpcCallSettings, batchingCallSettings, clientContext); + grpcCallSettings, callSettings, clientContext); } - @BetaApi( - "The surface for long-running operations is not stable yet and may change in the future.") @Override public OperationCallable createOperationCallable( - GrpcCallSettings grpcCallSettings, - OperationCallSettings operationCallSettings, + GrpcCallSettings grpcCallSettings, + OperationCallSettings callSettings, ClientContext clientContext, OperationsStub operationsStub) { return GrpcCallableFactory.createOperationCallable( - grpcCallSettings, operationCallSettings, clientContext, operationsStub); + grpcCallSettings, callSettings, clientContext, operationsStub); } @Override public BidiStreamingCallable createBidiStreamingCallable( GrpcCallSettings grpcCallSettings, - StreamingCallSettings streamingCallSettings, + StreamingCallSettings callSettings, ClientContext clientContext) { return GrpcCallableFactory.createBidiStreamingCallable( - grpcCallSettings, streamingCallSettings, clientContext); + grpcCallSettings, callSettings, clientContext); } @Override public ServerStreamingCallable createServerStreamingCallable( GrpcCallSettings grpcCallSettings, - ServerStreamingCallSettings streamingCallSettings, + ServerStreamingCallSettings callSettings, ClientContext clientContext) { return GrpcCallableFactory.createServerStreamingCallable( - grpcCallSettings, streamingCallSettings, clientContext); + grpcCallSettings, callSettings, clientContext); } @Override public ClientStreamingCallable createClientStreamingCallable( GrpcCallSettings grpcCallSettings, - StreamingCallSettings streamingCallSettings, + StreamingCallSettings callSettings, ClientContext clientContext) { return GrpcCallableFactory.createClientStreamingCallable( - grpcCallSettings, streamingCallSettings, clientContext); + grpcCallSettings, callSettings, clientContext); } } diff --git a/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3/stub/GrpcSessionsStub.java b/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3/stub/GrpcSessionsStub.java index ca6187c94..d40d66ca8 100644 --- a/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3/stub/GrpcSessionsStub.java +++ b/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3/stub/GrpcSessionsStub.java @@ -5,7 +5,7 @@ * 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 + * 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, @@ -13,9 +13,9 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.google.cloud.dialogflow.cx.v3.stub; -import com.google.api.core.BetaApi; import com.google.api.gax.core.BackgroundResource; import com.google.api.gax.core.BackgroundResourceAggregation; import com.google.api.gax.grpc.GrpcCallSettings; @@ -33,6 +33,7 @@ import com.google.cloud.dialogflow.cx.v3.StreamingDetectIntentRequest; import com.google.cloud.dialogflow.cx.v3.StreamingDetectIntentResponse; import com.google.common.collect.ImmutableMap; +import com.google.longrunning.stub.GrpcOperationsStub; import io.grpc.MethodDescriptor; import io.grpc.protobuf.ProtoUtils; import java.io.IOException; @@ -40,16 +41,14 @@ import java.util.concurrent.TimeUnit; import javax.annotation.Generated; -// AUTO-GENERATED DOCUMENTATION AND CLASS +// AUTO-GENERATED DOCUMENTATION AND CLASS. /** - * gRPC stub implementation for Dialogflow API. + * gRPC stub implementation for the Sessions service API. * *

This class is for advanced usage and reflects the underlying API directly. */ -@Generated("by gapic-generator") -@BetaApi("A restructuring of stub classes is planned, so this may break in the future") +@Generated("by gapic-generator-java") public class GrpcSessionsStub extends SessionsStub { - private static final MethodDescriptor detectIntentMethodDescriptor = MethodDescriptor.newBuilder() @@ -59,6 +58,7 @@ public class GrpcSessionsStub extends SessionsStub { .setResponseMarshaller( ProtoUtils.marshaller(DetectIntentResponse.getDefaultInstance())) .build(); + private static final MethodDescriptor streamingDetectIntentMethodDescriptor = MethodDescriptor.newBuilder() @@ -69,6 +69,7 @@ public class GrpcSessionsStub extends SessionsStub { .setResponseMarshaller( ProtoUtils.marshaller(StreamingDetectIntentResponse.getDefaultInstance())) .build(); + private static final MethodDescriptor matchIntentMethodDescriptor = MethodDescriptor.newBuilder() @@ -78,6 +79,7 @@ public class GrpcSessionsStub extends SessionsStub { .setResponseMarshaller( ProtoUtils.marshaller(MatchIntentResponse.getDefaultInstance())) .build(); + private static final MethodDescriptor fulfillIntentMethodDescriptor = MethodDescriptor.newBuilder() @@ -89,14 +91,14 @@ public class GrpcSessionsStub extends SessionsStub { ProtoUtils.marshaller(FulfillIntentResponse.getDefaultInstance())) .build(); - private final BackgroundResource backgroundResources; - private final UnaryCallable detectIntentCallable; private final BidiStreamingCallable streamingDetectIntentCallable; private final UnaryCallable matchIntentCallable; private final UnaryCallable fulfillIntentCallable; + private final BackgroundResource backgroundResources; + private final GrpcOperationsStub operationsStub; private final GrpcStubCallableFactory callableFactory; public static final GrpcSessionsStub create(SessionsStubSettings settings) throws IOException { @@ -132,6 +134,7 @@ protected GrpcSessionsStub( GrpcStubCallableFactory callableFactory) throws IOException { this.callableFactory = callableFactory; + this.operationsStub = GrpcOperationsStub.create(clientContext, callableFactory); GrpcCallSettings detectIntentTransportSettings = GrpcCallSettings.newBuilder() @@ -196,7 +199,12 @@ public Map extract(FulfillIntentRequest request) { callableFactory.createUnaryCallable( fulfillIntentTransportSettings, settings.fulfillIntentSettings(), clientContext); - backgroundResources = new BackgroundResourceAggregation(clientContext.getBackgroundResources()); + this.backgroundResources = + new BackgroundResourceAggregation(clientContext.getBackgroundResources()); + } + + public GrpcOperationsStub getOperationsStub() { + return operationsStub; } public UnaryCallable detectIntentCallable() { diff --git a/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3/stub/GrpcTransitionRouteGroupsCallableFactory.java b/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3/stub/GrpcTransitionRouteGroupsCallableFactory.java index b2e2a710e..65c8f7e60 100644 --- a/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3/stub/GrpcTransitionRouteGroupsCallableFactory.java +++ b/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3/stub/GrpcTransitionRouteGroupsCallableFactory.java @@ -5,7 +5,7 @@ * 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 + * 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, @@ -13,9 +13,9 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.google.cloud.dialogflow.cx.v3.stub; -import com.google.api.core.BetaApi; import com.google.api.gax.grpc.GrpcCallSettings; import com.google.api.gax.grpc.GrpcCallableFactory; import com.google.api.gax.grpc.GrpcStubCallableFactory; @@ -31,18 +31,19 @@ import com.google.api.gax.rpc.StreamingCallSettings; import com.google.api.gax.rpc.UnaryCallSettings; import com.google.api.gax.rpc.UnaryCallable; +import com.google.longrunning.Operation; import com.google.longrunning.stub.OperationsStub; import javax.annotation.Generated; -// AUTO-GENERATED DOCUMENTATION AND CLASS +// AUTO-GENERATED DOCUMENTATION AND CLASS. /** - * gRPC callable factory implementation for Dialogflow API. + * gRPC callable factory implementation for the TransitionRouteGroups service API. * *

This class is for advanced usage. */ @Generated("by gapic-generator") -@BetaApi("The surface for use by generated code is not stable yet and may change in the future.") public class GrpcTransitionRouteGroupsCallableFactory implements GrpcStubCallableFactory { + @Override public UnaryCallable createUnaryCallable( GrpcCallSettings grpcCallSettings, @@ -55,61 +56,58 @@ public UnaryCallable createUnaryCalla public UnaryCallable createPagedCallable( GrpcCallSettings grpcCallSettings, - PagedCallSettings pagedCallSettings, + PagedCallSettings callSettings, ClientContext clientContext) { - return GrpcCallableFactory.createPagedCallable( - grpcCallSettings, pagedCallSettings, clientContext); + return GrpcCallableFactory.createPagedCallable(grpcCallSettings, callSettings, clientContext); } @Override public UnaryCallable createBatchingCallable( GrpcCallSettings grpcCallSettings, - BatchingCallSettings batchingCallSettings, + BatchingCallSettings callSettings, ClientContext clientContext) { return GrpcCallableFactory.createBatchingCallable( - grpcCallSettings, batchingCallSettings, clientContext); + grpcCallSettings, callSettings, clientContext); } - @BetaApi( - "The surface for long-running operations is not stable yet and may change in the future.") @Override public OperationCallable createOperationCallable( - GrpcCallSettings grpcCallSettings, - OperationCallSettings operationCallSettings, + GrpcCallSettings grpcCallSettings, + OperationCallSettings callSettings, ClientContext clientContext, OperationsStub operationsStub) { return GrpcCallableFactory.createOperationCallable( - grpcCallSettings, operationCallSettings, clientContext, operationsStub); + grpcCallSettings, callSettings, clientContext, operationsStub); } @Override public BidiStreamingCallable createBidiStreamingCallable( GrpcCallSettings grpcCallSettings, - StreamingCallSettings streamingCallSettings, + StreamingCallSettings callSettings, ClientContext clientContext) { return GrpcCallableFactory.createBidiStreamingCallable( - grpcCallSettings, streamingCallSettings, clientContext); + grpcCallSettings, callSettings, clientContext); } @Override public ServerStreamingCallable createServerStreamingCallable( GrpcCallSettings grpcCallSettings, - ServerStreamingCallSettings streamingCallSettings, + ServerStreamingCallSettings callSettings, ClientContext clientContext) { return GrpcCallableFactory.createServerStreamingCallable( - grpcCallSettings, streamingCallSettings, clientContext); + grpcCallSettings, callSettings, clientContext); } @Override public ClientStreamingCallable createClientStreamingCallable( GrpcCallSettings grpcCallSettings, - StreamingCallSettings streamingCallSettings, + StreamingCallSettings callSettings, ClientContext clientContext) { return GrpcCallableFactory.createClientStreamingCallable( - grpcCallSettings, streamingCallSettings, clientContext); + grpcCallSettings, callSettings, clientContext); } } diff --git a/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3/stub/GrpcTransitionRouteGroupsStub.java b/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3/stub/GrpcTransitionRouteGroupsStub.java index e5029fd8b..00bb534c4 100644 --- a/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3/stub/GrpcTransitionRouteGroupsStub.java +++ b/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3/stub/GrpcTransitionRouteGroupsStub.java @@ -5,7 +5,7 @@ * 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 + * 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, @@ -13,11 +13,11 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.google.cloud.dialogflow.cx.v3.stub; import static com.google.cloud.dialogflow.cx.v3.TransitionRouteGroupsClient.ListTransitionRouteGroupsPagedResponse; -import com.google.api.core.BetaApi; import com.google.api.gax.core.BackgroundResource; import com.google.api.gax.core.BackgroundResourceAggregation; import com.google.api.gax.grpc.GrpcCallSettings; @@ -33,6 +33,7 @@ import com.google.cloud.dialogflow.cx.v3.TransitionRouteGroup; import com.google.cloud.dialogflow.cx.v3.UpdateTransitionRouteGroupRequest; import com.google.common.collect.ImmutableMap; +import com.google.longrunning.stub.GrpcOperationsStub; import com.google.protobuf.Empty; import io.grpc.MethodDescriptor; import io.grpc.protobuf.ProtoUtils; @@ -41,16 +42,14 @@ import java.util.concurrent.TimeUnit; import javax.annotation.Generated; -// AUTO-GENERATED DOCUMENTATION AND CLASS +// AUTO-GENERATED DOCUMENTATION AND CLASS. /** - * gRPC stub implementation for Dialogflow API. + * gRPC stub implementation for the TransitionRouteGroups service API. * *

This class is for advanced usage and reflects the underlying API directly. */ -@Generated("by gapic-generator") -@BetaApi("A restructuring of stub classes is planned, so this may break in the future") +@Generated("by gapic-generator-java") public class GrpcTransitionRouteGroupsStub extends TransitionRouteGroupsStub { - private static final MethodDescriptor< ListTransitionRouteGroupsRequest, ListTransitionRouteGroupsResponse> listTransitionRouteGroupsMethodDescriptor = @@ -64,6 +63,7 @@ public class GrpcTransitionRouteGroupsStub extends TransitionRouteGroupsStub { .setResponseMarshaller( ProtoUtils.marshaller(ListTransitionRouteGroupsResponse.getDefaultInstance())) .build(); + private static final MethodDescriptor getTransitionRouteGroupMethodDescriptor = MethodDescriptor.newBuilder() @@ -75,6 +75,7 @@ public class GrpcTransitionRouteGroupsStub extends TransitionRouteGroupsStub { .setResponseMarshaller( ProtoUtils.marshaller(TransitionRouteGroup.getDefaultInstance())) .build(); + private static final MethodDescriptor createTransitionRouteGroupMethodDescriptor = MethodDescriptor.newBuilder() @@ -86,6 +87,7 @@ public class GrpcTransitionRouteGroupsStub extends TransitionRouteGroupsStub { .setResponseMarshaller( ProtoUtils.marshaller(TransitionRouteGroup.getDefaultInstance())) .build(); + private static final MethodDescriptor updateTransitionRouteGroupMethodDescriptor = MethodDescriptor.newBuilder() @@ -97,6 +99,7 @@ public class GrpcTransitionRouteGroupsStub extends TransitionRouteGroupsStub { .setResponseMarshaller( ProtoUtils.marshaller(TransitionRouteGroup.getDefaultInstance())) .build(); + private static final MethodDescriptor deleteTransitionRouteGroupMethodDescriptor = MethodDescriptor.newBuilder() @@ -108,8 +111,6 @@ public class GrpcTransitionRouteGroupsStub extends TransitionRouteGroupsStub { .setResponseMarshaller(ProtoUtils.marshaller(Empty.getDefaultInstance())) .build(); - private final BackgroundResource backgroundResources; - private final UnaryCallable listTransitionRouteGroupsCallable; private final UnaryCallable< @@ -124,6 +125,8 @@ public class GrpcTransitionRouteGroupsStub extends TransitionRouteGroupsStub { private final UnaryCallable deleteTransitionRouteGroupCallable; + private final BackgroundResource backgroundResources; + private final GrpcOperationsStub operationsStub; private final GrpcStubCallableFactory callableFactory; public static final GrpcTransitionRouteGroupsStub create( @@ -164,6 +167,7 @@ protected GrpcTransitionRouteGroupsStub( GrpcStubCallableFactory callableFactory) throws IOException { this.callableFactory = callableFactory; + this.operationsStub = GrpcOperationsStub.create(clientContext, callableFactory); GrpcCallSettings listTransitionRouteGroupsTransportSettings = @@ -273,12 +277,12 @@ public Map extract( settings.deleteTransitionRouteGroupSettings(), clientContext); - backgroundResources = new BackgroundResourceAggregation(clientContext.getBackgroundResources()); + this.backgroundResources = + new BackgroundResourceAggregation(clientContext.getBackgroundResources()); } - public UnaryCallable - listTransitionRouteGroupsPagedCallable() { - return listTransitionRouteGroupsPagedCallable; + public GrpcOperationsStub getOperationsStub() { + return operationsStub; } public UnaryCallable @@ -286,6 +290,11 @@ public Map extract( return listTransitionRouteGroupsCallable; } + public UnaryCallable + listTransitionRouteGroupsPagedCallable() { + return listTransitionRouteGroupsPagedCallable; + } + public UnaryCallable getTransitionRouteGroupCallable() { return getTransitionRouteGroupCallable; diff --git a/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3/stub/GrpcVersionsCallableFactory.java b/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3/stub/GrpcVersionsCallableFactory.java index 7b7ac0241..2f208608d 100644 --- a/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3/stub/GrpcVersionsCallableFactory.java +++ b/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3/stub/GrpcVersionsCallableFactory.java @@ -5,7 +5,7 @@ * 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 + * 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, @@ -13,9 +13,9 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.google.cloud.dialogflow.cx.v3.stub; -import com.google.api.core.BetaApi; import com.google.api.gax.grpc.GrpcCallSettings; import com.google.api.gax.grpc.GrpcCallableFactory; import com.google.api.gax.grpc.GrpcStubCallableFactory; @@ -31,18 +31,19 @@ import com.google.api.gax.rpc.StreamingCallSettings; import com.google.api.gax.rpc.UnaryCallSettings; import com.google.api.gax.rpc.UnaryCallable; +import com.google.longrunning.Operation; import com.google.longrunning.stub.OperationsStub; import javax.annotation.Generated; -// AUTO-GENERATED DOCUMENTATION AND CLASS +// AUTO-GENERATED DOCUMENTATION AND CLASS. /** - * gRPC callable factory implementation for Dialogflow API. + * gRPC callable factory implementation for the Versions service API. * *

This class is for advanced usage. */ @Generated("by gapic-generator") -@BetaApi("The surface for use by generated code is not stable yet and may change in the future.") public class GrpcVersionsCallableFactory implements GrpcStubCallableFactory { + @Override public UnaryCallable createUnaryCallable( GrpcCallSettings grpcCallSettings, @@ -55,61 +56,58 @@ public UnaryCallable createUnaryCalla public UnaryCallable createPagedCallable( GrpcCallSettings grpcCallSettings, - PagedCallSettings pagedCallSettings, + PagedCallSettings callSettings, ClientContext clientContext) { - return GrpcCallableFactory.createPagedCallable( - grpcCallSettings, pagedCallSettings, clientContext); + return GrpcCallableFactory.createPagedCallable(grpcCallSettings, callSettings, clientContext); } @Override public UnaryCallable createBatchingCallable( GrpcCallSettings grpcCallSettings, - BatchingCallSettings batchingCallSettings, + BatchingCallSettings callSettings, ClientContext clientContext) { return GrpcCallableFactory.createBatchingCallable( - grpcCallSettings, batchingCallSettings, clientContext); + grpcCallSettings, callSettings, clientContext); } - @BetaApi( - "The surface for long-running operations is not stable yet and may change in the future.") @Override public OperationCallable createOperationCallable( - GrpcCallSettings grpcCallSettings, - OperationCallSettings operationCallSettings, + GrpcCallSettings grpcCallSettings, + OperationCallSettings callSettings, ClientContext clientContext, OperationsStub operationsStub) { return GrpcCallableFactory.createOperationCallable( - grpcCallSettings, operationCallSettings, clientContext, operationsStub); + grpcCallSettings, callSettings, clientContext, operationsStub); } @Override public BidiStreamingCallable createBidiStreamingCallable( GrpcCallSettings grpcCallSettings, - StreamingCallSettings streamingCallSettings, + StreamingCallSettings callSettings, ClientContext clientContext) { return GrpcCallableFactory.createBidiStreamingCallable( - grpcCallSettings, streamingCallSettings, clientContext); + grpcCallSettings, callSettings, clientContext); } @Override public ServerStreamingCallable createServerStreamingCallable( GrpcCallSettings grpcCallSettings, - ServerStreamingCallSettings streamingCallSettings, + ServerStreamingCallSettings callSettings, ClientContext clientContext) { return GrpcCallableFactory.createServerStreamingCallable( - grpcCallSettings, streamingCallSettings, clientContext); + grpcCallSettings, callSettings, clientContext); } @Override public ClientStreamingCallable createClientStreamingCallable( GrpcCallSettings grpcCallSettings, - StreamingCallSettings streamingCallSettings, + StreamingCallSettings callSettings, ClientContext clientContext) { return GrpcCallableFactory.createClientStreamingCallable( - grpcCallSettings, streamingCallSettings, clientContext); + grpcCallSettings, callSettings, clientContext); } } diff --git a/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3/stub/GrpcVersionsStub.java b/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3/stub/GrpcVersionsStub.java index c0463720a..ea32efd63 100644 --- a/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3/stub/GrpcVersionsStub.java +++ b/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3/stub/GrpcVersionsStub.java @@ -5,7 +5,7 @@ * 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 + * 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, @@ -13,11 +13,11 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.google.cloud.dialogflow.cx.v3.stub; import static com.google.cloud.dialogflow.cx.v3.VersionsClient.ListVersionsPagedResponse; -import com.google.api.core.BetaApi; import com.google.api.gax.core.BackgroundResource; import com.google.api.gax.core.BackgroundResourceAggregation; import com.google.api.gax.grpc.GrpcCallSettings; @@ -47,16 +47,14 @@ import java.util.concurrent.TimeUnit; import javax.annotation.Generated; -// AUTO-GENERATED DOCUMENTATION AND CLASS +// AUTO-GENERATED DOCUMENTATION AND CLASS. /** - * gRPC stub implementation for Dialogflow API. + * gRPC stub implementation for the Versions service API. * *

This class is for advanced usage and reflects the underlying API directly. */ -@Generated("by gapic-generator") -@BetaApi("A restructuring of stub classes is planned, so this may break in the future") +@Generated("by gapic-generator-java") public class GrpcVersionsStub extends VersionsStub { - private static final MethodDescriptor listVersionsMethodDescriptor = MethodDescriptor.newBuilder() @@ -66,6 +64,7 @@ public class GrpcVersionsStub extends VersionsStub { .setResponseMarshaller( ProtoUtils.marshaller(ListVersionsResponse.getDefaultInstance())) .build(); + private static final MethodDescriptor getVersionMethodDescriptor = MethodDescriptor.newBuilder() .setType(MethodDescriptor.MethodType.UNARY) @@ -73,6 +72,7 @@ public class GrpcVersionsStub extends VersionsStub { .setRequestMarshaller(ProtoUtils.marshaller(GetVersionRequest.getDefaultInstance())) .setResponseMarshaller(ProtoUtils.marshaller(Version.getDefaultInstance())) .build(); + private static final MethodDescriptor createVersionMethodDescriptor = MethodDescriptor.newBuilder() @@ -82,6 +82,7 @@ public class GrpcVersionsStub extends VersionsStub { ProtoUtils.marshaller(CreateVersionRequest.getDefaultInstance())) .setResponseMarshaller(ProtoUtils.marshaller(Operation.getDefaultInstance())) .build(); + private static final MethodDescriptor updateVersionMethodDescriptor = MethodDescriptor.newBuilder() @@ -91,6 +92,7 @@ public class GrpcVersionsStub extends VersionsStub { ProtoUtils.marshaller(UpdateVersionRequest.getDefaultInstance())) .setResponseMarshaller(ProtoUtils.marshaller(Version.getDefaultInstance())) .build(); + private static final MethodDescriptor deleteVersionMethodDescriptor = MethodDescriptor.newBuilder() .setType(MethodDescriptor.MethodType.UNARY) @@ -98,6 +100,7 @@ public class GrpcVersionsStub extends VersionsStub { .setRequestMarshaller(ProtoUtils.marshaller(DeleteVersionRequest.getDefaultInstance())) .setResponseMarshaller(ProtoUtils.marshaller(Empty.getDefaultInstance())) .build(); + private static final MethodDescriptor loadVersionMethodDescriptor = MethodDescriptor.newBuilder() .setType(MethodDescriptor.MethodType.UNARY) @@ -106,9 +109,6 @@ public class GrpcVersionsStub extends VersionsStub { .setResponseMarshaller(ProtoUtils.marshaller(Operation.getDefaultInstance())) .build(); - private final BackgroundResource backgroundResources; - private final GrpcOperationsStub operationsStub; - private final UnaryCallable listVersionsCallable; private final UnaryCallable listVersionsPagedCallable; @@ -121,6 +121,8 @@ public class GrpcVersionsStub extends VersionsStub { private final UnaryCallable loadVersionCallable; private final OperationCallable loadVersionOperationCallable; + private final BackgroundResource backgroundResources; + private final GrpcOperationsStub operationsStub; private final GrpcStubCallableFactory callableFactory; public static final GrpcVersionsStub create(VersionsStubSettings settings) throws IOException { @@ -254,7 +256,7 @@ public Map extract(LoadVersionRequest request) { createVersionTransportSettings, settings.createVersionOperationSettings(), clientContext, - this.operationsStub); + operationsStub); this.updateVersionCallable = callableFactory.createUnaryCallable( updateVersionTransportSettings, settings.updateVersionSettings(), clientContext); @@ -269,38 +271,37 @@ public Map extract(LoadVersionRequest request) { loadVersionTransportSettings, settings.loadVersionOperationSettings(), clientContext, - this.operationsStub); + operationsStub); - backgroundResources = new BackgroundResourceAggregation(clientContext.getBackgroundResources()); + this.backgroundResources = + new BackgroundResourceAggregation(clientContext.getBackgroundResources()); } - @BetaApi("The surface for use by generated code is not stable yet and may change in the future.") public GrpcOperationsStub getOperationsStub() { return operationsStub; } - public UnaryCallable listVersionsPagedCallable() { - return listVersionsPagedCallable; - } - public UnaryCallable listVersionsCallable() { return listVersionsCallable; } + public UnaryCallable listVersionsPagedCallable() { + return listVersionsPagedCallable; + } + public UnaryCallable getVersionCallable() { return getVersionCallable; } - @BetaApi("The surface for use by generated code is not stable yet and may change in the future.") + public UnaryCallable createVersionCallable() { + return createVersionCallable; + } + public OperationCallable createVersionOperationCallable() { return createVersionOperationCallable; } - public UnaryCallable createVersionCallable() { - return createVersionCallable; - } - public UnaryCallable updateVersionCallable() { return updateVersionCallable; } @@ -309,15 +310,14 @@ public UnaryCallable deleteVersionCallable() { return deleteVersionCallable; } - @BetaApi("The surface for use by generated code is not stable yet and may change in the future.") - public OperationCallable loadVersionOperationCallable() { - return loadVersionOperationCallable; - } - public UnaryCallable loadVersionCallable() { return loadVersionCallable; } + public OperationCallable loadVersionOperationCallable() { + return loadVersionOperationCallable; + } + @Override public final void close() { shutdown(); diff --git a/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3/stub/GrpcWebhooksCallableFactory.java b/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3/stub/GrpcWebhooksCallableFactory.java index 6739bf802..c1e205a13 100644 --- a/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3/stub/GrpcWebhooksCallableFactory.java +++ b/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3/stub/GrpcWebhooksCallableFactory.java @@ -5,7 +5,7 @@ * 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 + * 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, @@ -13,9 +13,9 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.google.cloud.dialogflow.cx.v3.stub; -import com.google.api.core.BetaApi; import com.google.api.gax.grpc.GrpcCallSettings; import com.google.api.gax.grpc.GrpcCallableFactory; import com.google.api.gax.grpc.GrpcStubCallableFactory; @@ -31,18 +31,19 @@ import com.google.api.gax.rpc.StreamingCallSettings; import com.google.api.gax.rpc.UnaryCallSettings; import com.google.api.gax.rpc.UnaryCallable; +import com.google.longrunning.Operation; import com.google.longrunning.stub.OperationsStub; import javax.annotation.Generated; -// AUTO-GENERATED DOCUMENTATION AND CLASS +// AUTO-GENERATED DOCUMENTATION AND CLASS. /** - * gRPC callable factory implementation for Dialogflow API. + * gRPC callable factory implementation for the Webhooks service API. * *

This class is for advanced usage. */ @Generated("by gapic-generator") -@BetaApi("The surface for use by generated code is not stable yet and may change in the future.") public class GrpcWebhooksCallableFactory implements GrpcStubCallableFactory { + @Override public UnaryCallable createUnaryCallable( GrpcCallSettings grpcCallSettings, @@ -55,61 +56,58 @@ public UnaryCallable createUnaryCalla public UnaryCallable createPagedCallable( GrpcCallSettings grpcCallSettings, - PagedCallSettings pagedCallSettings, + PagedCallSettings callSettings, ClientContext clientContext) { - return GrpcCallableFactory.createPagedCallable( - grpcCallSettings, pagedCallSettings, clientContext); + return GrpcCallableFactory.createPagedCallable(grpcCallSettings, callSettings, clientContext); } @Override public UnaryCallable createBatchingCallable( GrpcCallSettings grpcCallSettings, - BatchingCallSettings batchingCallSettings, + BatchingCallSettings callSettings, ClientContext clientContext) { return GrpcCallableFactory.createBatchingCallable( - grpcCallSettings, batchingCallSettings, clientContext); + grpcCallSettings, callSettings, clientContext); } - @BetaApi( - "The surface for long-running operations is not stable yet and may change in the future.") @Override public OperationCallable createOperationCallable( - GrpcCallSettings grpcCallSettings, - OperationCallSettings operationCallSettings, + GrpcCallSettings grpcCallSettings, + OperationCallSettings callSettings, ClientContext clientContext, OperationsStub operationsStub) { return GrpcCallableFactory.createOperationCallable( - grpcCallSettings, operationCallSettings, clientContext, operationsStub); + grpcCallSettings, callSettings, clientContext, operationsStub); } @Override public BidiStreamingCallable createBidiStreamingCallable( GrpcCallSettings grpcCallSettings, - StreamingCallSettings streamingCallSettings, + StreamingCallSettings callSettings, ClientContext clientContext) { return GrpcCallableFactory.createBidiStreamingCallable( - grpcCallSettings, streamingCallSettings, clientContext); + grpcCallSettings, callSettings, clientContext); } @Override public ServerStreamingCallable createServerStreamingCallable( GrpcCallSettings grpcCallSettings, - ServerStreamingCallSettings streamingCallSettings, + ServerStreamingCallSettings callSettings, ClientContext clientContext) { return GrpcCallableFactory.createServerStreamingCallable( - grpcCallSettings, streamingCallSettings, clientContext); + grpcCallSettings, callSettings, clientContext); } @Override public ClientStreamingCallable createClientStreamingCallable( GrpcCallSettings grpcCallSettings, - StreamingCallSettings streamingCallSettings, + StreamingCallSettings callSettings, ClientContext clientContext) { return GrpcCallableFactory.createClientStreamingCallable( - grpcCallSettings, streamingCallSettings, clientContext); + grpcCallSettings, callSettings, clientContext); } } diff --git a/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3/stub/GrpcWebhooksStub.java b/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3/stub/GrpcWebhooksStub.java index f5cccddb2..8ba87efee 100644 --- a/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3/stub/GrpcWebhooksStub.java +++ b/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3/stub/GrpcWebhooksStub.java @@ -5,7 +5,7 @@ * 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 + * 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, @@ -13,11 +13,11 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.google.cloud.dialogflow.cx.v3.stub; import static com.google.cloud.dialogflow.cx.v3.WebhooksClient.ListWebhooksPagedResponse; -import com.google.api.core.BetaApi; import com.google.api.gax.core.BackgroundResource; import com.google.api.gax.core.BackgroundResourceAggregation; import com.google.api.gax.grpc.GrpcCallSettings; @@ -33,6 +33,7 @@ import com.google.cloud.dialogflow.cx.v3.UpdateWebhookRequest; import com.google.cloud.dialogflow.cx.v3.Webhook; import com.google.common.collect.ImmutableMap; +import com.google.longrunning.stub.GrpcOperationsStub; import com.google.protobuf.Empty; import io.grpc.MethodDescriptor; import io.grpc.protobuf.ProtoUtils; @@ -41,16 +42,14 @@ import java.util.concurrent.TimeUnit; import javax.annotation.Generated; -// AUTO-GENERATED DOCUMENTATION AND CLASS +// AUTO-GENERATED DOCUMENTATION AND CLASS. /** - * gRPC stub implementation for Dialogflow API. + * gRPC stub implementation for the Webhooks service API. * *

This class is for advanced usage and reflects the underlying API directly. */ -@Generated("by gapic-generator") -@BetaApi("A restructuring of stub classes is planned, so this may break in the future") +@Generated("by gapic-generator-java") public class GrpcWebhooksStub extends WebhooksStub { - private static final MethodDescriptor listWebhooksMethodDescriptor = MethodDescriptor.newBuilder() @@ -60,6 +59,7 @@ public class GrpcWebhooksStub extends WebhooksStub { .setResponseMarshaller( ProtoUtils.marshaller(ListWebhooksResponse.getDefaultInstance())) .build(); + private static final MethodDescriptor getWebhookMethodDescriptor = MethodDescriptor.newBuilder() .setType(MethodDescriptor.MethodType.UNARY) @@ -67,6 +67,7 @@ public class GrpcWebhooksStub extends WebhooksStub { .setRequestMarshaller(ProtoUtils.marshaller(GetWebhookRequest.getDefaultInstance())) .setResponseMarshaller(ProtoUtils.marshaller(Webhook.getDefaultInstance())) .build(); + private static final MethodDescriptor createWebhookMethodDescriptor = MethodDescriptor.newBuilder() @@ -76,6 +77,7 @@ public class GrpcWebhooksStub extends WebhooksStub { ProtoUtils.marshaller(CreateWebhookRequest.getDefaultInstance())) .setResponseMarshaller(ProtoUtils.marshaller(Webhook.getDefaultInstance())) .build(); + private static final MethodDescriptor updateWebhookMethodDescriptor = MethodDescriptor.newBuilder() @@ -85,6 +87,7 @@ public class GrpcWebhooksStub extends WebhooksStub { ProtoUtils.marshaller(UpdateWebhookRequest.getDefaultInstance())) .setResponseMarshaller(ProtoUtils.marshaller(Webhook.getDefaultInstance())) .build(); + private static final MethodDescriptor deleteWebhookMethodDescriptor = MethodDescriptor.newBuilder() .setType(MethodDescriptor.MethodType.UNARY) @@ -93,8 +96,6 @@ public class GrpcWebhooksStub extends WebhooksStub { .setResponseMarshaller(ProtoUtils.marshaller(Empty.getDefaultInstance())) .build(); - private final BackgroundResource backgroundResources; - private final UnaryCallable listWebhooksCallable; private final UnaryCallable listWebhooksPagedCallable; @@ -103,6 +104,8 @@ public class GrpcWebhooksStub extends WebhooksStub { private final UnaryCallable updateWebhookCallable; private final UnaryCallable deleteWebhookCallable; + private final BackgroundResource backgroundResources; + private final GrpcOperationsStub operationsStub; private final GrpcStubCallableFactory callableFactory; public static final GrpcWebhooksStub create(WebhooksStubSettings settings) throws IOException { @@ -138,6 +141,7 @@ protected GrpcWebhooksStub( GrpcStubCallableFactory callableFactory) throws IOException { this.callableFactory = callableFactory; + this.operationsStub = GrpcOperationsStub.create(clientContext, callableFactory); GrpcCallSettings listWebhooksTransportSettings = GrpcCallSettings.newBuilder() @@ -224,17 +228,22 @@ public Map extract(DeleteWebhookRequest request) { callableFactory.createUnaryCallable( deleteWebhookTransportSettings, settings.deleteWebhookSettings(), clientContext); - backgroundResources = new BackgroundResourceAggregation(clientContext.getBackgroundResources()); + this.backgroundResources = + new BackgroundResourceAggregation(clientContext.getBackgroundResources()); } - public UnaryCallable listWebhooksPagedCallable() { - return listWebhooksPagedCallable; + public GrpcOperationsStub getOperationsStub() { + return operationsStub; } public UnaryCallable listWebhooksCallable() { return listWebhooksCallable; } + public UnaryCallable listWebhooksPagedCallable() { + return listWebhooksPagedCallable; + } + public UnaryCallable getWebhookCallable() { return getWebhookCallable; } diff --git a/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3/stub/IntentsStub.java b/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3/stub/IntentsStub.java index 500c7ec0f..b4b5736a0 100644 --- a/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3/stub/IntentsStub.java +++ b/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3/stub/IntentsStub.java @@ -5,7 +5,7 @@ * 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 + * 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, @@ -13,11 +13,11 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.google.cloud.dialogflow.cx.v3.stub; import static com.google.cloud.dialogflow.cx.v3.IntentsClient.ListIntentsPagedResponse; -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.cx.v3.CreateIntentRequest; @@ -30,14 +30,13 @@ import com.google.protobuf.Empty; import javax.annotation.Generated; -// AUTO-GENERATED DOCUMENTATION AND CLASS +// AUTO-GENERATED DOCUMENTATION AND CLASS. /** - * Base stub class for Dialogflow API. + * Base stub class for the Intents service API. * *

This class is for advanced usage and reflects the underlying API directly. */ @Generated("by gapic-generator") -@BetaApi("A restructuring of stub classes is planned, so this may break in the future") public abstract class IntentsStub implements BackgroundResource { public UnaryCallable listIntentsPagedCallable() { diff --git a/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3/stub/IntentsStubSettings.java b/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3/stub/IntentsStubSettings.java index 9bb240af0..78a9999da 100644 --- a/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3/stub/IntentsStubSettings.java +++ b/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3/stub/IntentsStubSettings.java @@ -5,7 +5,7 @@ * 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 + * 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, @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.google.cloud.dialogflow.cx.v3.stub; import static com.google.cloud.dialogflow.cx.v3.IntentsClient.ListIntentsPagedResponse; @@ -56,7 +57,7 @@ import javax.annotation.Generated; import org.threeten.bp.Duration; -// AUTO-GENERATED DOCUMENTATION AND CLASS +// AUTO-GENERATED DOCUMENTATION AND CLASS. /** * Settings class to configure an instance of {@link IntentsStub}. * @@ -73,21 +74,22 @@ * *

For example, to set the total timeout of getIntent to 30 seconds: * - *

- * 
- * IntentsStubSettings.Builder intentsSettingsBuilder =
- *     IntentsStubSettings.newBuilder();
+ * 
{@code
+ * IntentsStubSettings.Builder intentsSettingsBuilder = IntentsStubSettings.newBuilder();
  * intentsSettingsBuilder
  *     .getIntentSettings()
  *     .setRetrySettings(
- *         intentsSettingsBuilder.getIntentSettings().getRetrySettings().toBuilder()
+ *         intentsSettingsBuilder
+ *             .getIntentSettings()
+ *             .getRetrySettings()
+ *             .toBuilder()
  *             .setTotalTimeout(Duration.ofSeconds(30))
  *             .build());
  * IntentsStubSettings intentsSettings = intentsSettingsBuilder.build();
- * 
- * 
+ * }
*/ -@Generated("by gapic-generator") +@BetaApi +@Generated("by gapic-generator-java") public class IntentsStubSettings extends StubSettings { /** The default scopes of the service. */ private static final ImmutableList DEFAULT_SERVICE_SCOPES = @@ -103,6 +105,59 @@ public class IntentsStubSettings extends StubSettings { private final UnaryCallSettings updateIntentSettings; private final UnaryCallSettings deleteIntentSettings; + private static final PagedListDescriptor + LIST_INTENTS_PAGE_STR_DESC = + new PagedListDescriptor() { + @Override + public String emptyToken() { + return ""; + } + + @Override + public ListIntentsRequest injectToken(ListIntentsRequest payload, String token) { + return ListIntentsRequest.newBuilder(payload).setPageToken(token).build(); + } + + @Override + public ListIntentsRequest injectPageSize(ListIntentsRequest payload, int pageSize) { + return ListIntentsRequest.newBuilder(payload).setPageSize(pageSize).build(); + } + + @Override + public Integer extractPageSize(ListIntentsRequest payload) { + return payload.getPageSize(); + } + + @Override + public String extractNextToken(ListIntentsResponse payload) { + return payload.getNextPageToken(); + } + + @Override + public Iterable extractResources(ListIntentsResponse payload) { + return payload.getIntentsList() == null + ? ImmutableList.of() + : payload.getIntentsList(); + } + }; + + private static final PagedListResponseFactory< + ListIntentsRequest, ListIntentsResponse, ListIntentsPagedResponse> + LIST_INTENTS_PAGE_STR_FACT = + new PagedListResponseFactory< + ListIntentsRequest, ListIntentsResponse, ListIntentsPagedResponse>() { + @Override + public ApiFuture getFuturePagedResponse( + UnaryCallable callable, + ListIntentsRequest request, + ApiCallContext context, + ApiFuture futureResponse) { + PageContext pageContext = + PageContext.create(callable, LIST_INTENTS_PAGE_STR_DESC, request, context); + return ListIntentsPagedResponse.createAsync(pageContext, futureResponse); + } + }; + /** Returns the object with the settings used for calls to listIntents. */ public PagedCallSettings listIntentsSettings() { @@ -135,10 +190,10 @@ public IntentsStub createStub() throws IOException { .getTransportName() .equals(GrpcTransportChannel.getGrpcTransportName())) { return GrpcIntentsStub.create(this); - } else { - throw new UnsupportedOperationException( - "Transport not supported: " + getTransportChannelProvider().getTransportName()); } + throw new UnsupportedOperationException( + String.format( + "Transport not supported: %s", getTransportChannelProvider().getTransportName())); } /** Returns a builder for the default ExecutorProvider for this service. */ @@ -204,63 +259,9 @@ protected IntentsStubSettings(Builder settingsBuilder) throws IOException { deleteIntentSettings = settingsBuilder.deleteIntentSettings().build(); } - private static final PagedListDescriptor - LIST_INTENTS_PAGE_STR_DESC = - new PagedListDescriptor() { - @Override - public String emptyToken() { - return ""; - } - - @Override - public ListIntentsRequest injectToken(ListIntentsRequest payload, String token) { - return ListIntentsRequest.newBuilder(payload).setPageToken(token).build(); - } - - @Override - public ListIntentsRequest injectPageSize(ListIntentsRequest payload, int pageSize) { - return ListIntentsRequest.newBuilder(payload).setPageSize(pageSize).build(); - } - - @Override - public Integer extractPageSize(ListIntentsRequest payload) { - return payload.getPageSize(); - } - - @Override - public String extractNextToken(ListIntentsResponse payload) { - return payload.getNextPageToken(); - } - - @Override - public Iterable extractResources(ListIntentsResponse payload) { - return payload.getIntentsList() != null - ? payload.getIntentsList() - : ImmutableList.of(); - } - }; - - private static final PagedListResponseFactory< - ListIntentsRequest, ListIntentsResponse, ListIntentsPagedResponse> - LIST_INTENTS_PAGE_STR_FACT = - new PagedListResponseFactory< - ListIntentsRequest, ListIntentsResponse, ListIntentsPagedResponse>() { - @Override - public ApiFuture getFuturePagedResponse( - UnaryCallable callable, - ListIntentsRequest request, - ApiCallContext context, - ApiFuture futureResponse) { - PageContext pageContext = - PageContext.create(callable, LIST_INTENTS_PAGE_STR_DESC, request, context); - return ListIntentsPagedResponse.createAsync(pageContext, futureResponse); - } - }; - /** Builder for IntentsStubSettings. */ public static class Builder extends StubSettings.Builder { private final ImmutableList> unaryMethodSettingsBuilders; - private final PagedCallSettings.Builder< ListIntentsRequest, ListIntentsResponse, ListIntentsPagedResponse> listIntentsSettings; @@ -268,7 +269,6 @@ public static class Builder extends StubSettings.Builder createIntentSettings; private final UnaryCallSettings.Builder updateIntentSettings; private final UnaryCallSettings.Builder deleteIntentSettings; - private static final ImmutableMap> RETRYABLE_CODE_DEFINITIONS; @@ -276,14 +276,8 @@ public static class Builder extends StubSettings.Builder> definitions = ImmutableMap.builder(); definitions.put( - "retry_policy_1_codes", + "retry_policy_0_codes", ImmutableSet.copyOf(Lists.newArrayList(StatusCode.Code.UNAVAILABLE))); - definitions.put("no_retry_codes", ImmutableSet.copyOf(Lists.newArrayList())); - definitions.put( - "retry_policy_2_codes", - ImmutableSet.copyOf(Lists.newArrayList(StatusCode.Code.UNAVAILABLE))); - definitions.put( - "no_retry_1_codes", ImmutableSet.copyOf(Lists.newArrayList())); RETRYABLE_CODE_DEFINITIONS = definitions.build(); } @@ -302,46 +296,21 @@ public static class Builder extends StubSettings.Builder>of( + listIntentsSettings, + getIntentSettings, + createIntentSettings, + updateIntentSettings, + deleteIntentSettings); + } + private static Builder createDefault() { - Builder builder = new Builder((ClientContext) null); + Builder builder = new Builder(((ClientContext) null)); + builder.setTransportChannelProvider(defaultTransportChannelProvider()); builder.setCredentialsProvider(defaultCredentialsProviderBuilder().build()); builder.setInternalHeaderProvider(defaultApiClientHeaderProviderBuilder().build()); builder.setEndpoint(getDefaultEndpoint()); + return initDefaults(builder); } private static Builder initDefaults(Builder builder) { - builder .listIntentsSettings() - .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_1_codes")) - .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_1_params")); + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params")); builder .getIntentSettings() - .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_1_codes")) - .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_1_params")); + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params")); builder .createIntentSettings() - .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_1_codes")) - .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_1_params")); + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params")); builder .updateIntentSettings() - .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_1_codes")) - .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_1_params")); + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params")); builder .deleteIntentSettings() - .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_1_codes")) - .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_1_params")); + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params")); return builder; } - protected Builder(IntentsStubSettings settings) { - super(settings); - - listIntentsSettings = settings.listIntentsSettings.toBuilder(); - getIntentSettings = settings.getIntentSettings.toBuilder(); - createIntentSettings = settings.createIntentSettings.toBuilder(); - updateIntentSettings = settings.updateIntentSettings.toBuilder(); - deleteIntentSettings = settings.deleteIntentSettings.toBuilder(); - - unaryMethodSettingsBuilders = - ImmutableList.>of( - listIntentsSettings, - getIntentSettings, - createIntentSettings, - updateIntentSettings, - deleteIntentSettings); - } - - // NEXT_MAJOR_VER: remove 'throws Exception' + // NEXT_MAJOR_VER: remove 'throws Exception'. /** * Applies the given settings updater function to all of the unary API methods in this service. * diff --git a/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3/stub/PagesStub.java b/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3/stub/PagesStub.java index dadd64b0a..11e82584b 100644 --- a/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3/stub/PagesStub.java +++ b/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3/stub/PagesStub.java @@ -5,7 +5,7 @@ * 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 + * 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, @@ -13,11 +13,11 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.google.cloud.dialogflow.cx.v3.stub; import static com.google.cloud.dialogflow.cx.v3.PagesClient.ListPagesPagedResponse; -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.cx.v3.CreatePageRequest; @@ -30,14 +30,13 @@ import com.google.protobuf.Empty; import javax.annotation.Generated; -// AUTO-GENERATED DOCUMENTATION AND CLASS +// AUTO-GENERATED DOCUMENTATION AND CLASS. /** - * Base stub class for Dialogflow API. + * Base stub class for the Pages service API. * *

This class is for advanced usage and reflects the underlying API directly. */ @Generated("by gapic-generator") -@BetaApi("A restructuring of stub classes is planned, so this may break in the future") public abstract class PagesStub implements BackgroundResource { public UnaryCallable listPagesPagedCallable() { diff --git a/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3/stub/PagesStubSettings.java b/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3/stub/PagesStubSettings.java index 8a6dad8e8..446f70bb5 100644 --- a/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3/stub/PagesStubSettings.java +++ b/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3/stub/PagesStubSettings.java @@ -5,7 +5,7 @@ * 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 + * 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, @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.google.cloud.dialogflow.cx.v3.stub; import static com.google.cloud.dialogflow.cx.v3.PagesClient.ListPagesPagedResponse; @@ -56,7 +57,7 @@ import javax.annotation.Generated; import org.threeten.bp.Duration; -// AUTO-GENERATED DOCUMENTATION AND CLASS +// AUTO-GENERATED DOCUMENTATION AND CLASS. /** * Settings class to configure an instance of {@link PagesStub}. * @@ -73,21 +74,22 @@ * *

For example, to set the total timeout of getPage to 30 seconds: * - *

- * 
- * PagesStubSettings.Builder pagesSettingsBuilder =
- *     PagesStubSettings.newBuilder();
+ * 
{@code
+ * PagesStubSettings.Builder pagesSettingsBuilder = PagesStubSettings.newBuilder();
  * pagesSettingsBuilder
  *     .getPageSettings()
  *     .setRetrySettings(
- *         pagesSettingsBuilder.getPageSettings().getRetrySettings().toBuilder()
+ *         pagesSettingsBuilder
+ *             .getPageSettings()
+ *             .getRetrySettings()
+ *             .toBuilder()
  *             .setTotalTimeout(Duration.ofSeconds(30))
  *             .build());
  * PagesStubSettings pagesSettings = pagesSettingsBuilder.build();
- * 
- * 
+ * }
*/ -@Generated("by gapic-generator") +@BetaApi +@Generated("by gapic-generator-java") public class PagesStubSettings extends StubSettings { /** The default scopes of the service. */ private static final ImmutableList DEFAULT_SERVICE_SCOPES = @@ -103,6 +105,59 @@ public class PagesStubSettings extends StubSettings { private final UnaryCallSettings updatePageSettings; private final UnaryCallSettings deletePageSettings; + private static final PagedListDescriptor + LIST_PAGES_PAGE_STR_DESC = + new PagedListDescriptor() { + @Override + public String emptyToken() { + return ""; + } + + @Override + public ListPagesRequest injectToken(ListPagesRequest payload, String token) { + return ListPagesRequest.newBuilder(payload).setPageToken(token).build(); + } + + @Override + public ListPagesRequest injectPageSize(ListPagesRequest payload, int pageSize) { + return ListPagesRequest.newBuilder(payload).setPageSize(pageSize).build(); + } + + @Override + public Integer extractPageSize(ListPagesRequest payload) { + return payload.getPageSize(); + } + + @Override + public String extractNextToken(ListPagesResponse payload) { + return payload.getNextPageToken(); + } + + @Override + public Iterable extractResources(ListPagesResponse payload) { + return payload.getPagesList() == null + ? ImmutableList.of() + : payload.getPagesList(); + } + }; + + private static final PagedListResponseFactory< + ListPagesRequest, ListPagesResponse, ListPagesPagedResponse> + LIST_PAGES_PAGE_STR_FACT = + new PagedListResponseFactory< + ListPagesRequest, ListPagesResponse, ListPagesPagedResponse>() { + @Override + public ApiFuture getFuturePagedResponse( + UnaryCallable callable, + ListPagesRequest request, + ApiCallContext context, + ApiFuture futureResponse) { + PageContext pageContext = + PageContext.create(callable, LIST_PAGES_PAGE_STR_DESC, request, context); + return ListPagesPagedResponse.createAsync(pageContext, futureResponse); + } + }; + /** Returns the object with the settings used for calls to listPages. */ public PagedCallSettings listPagesSettings() { @@ -135,10 +190,10 @@ public PagesStub createStub() throws IOException { .getTransportName() .equals(GrpcTransportChannel.getGrpcTransportName())) { return GrpcPagesStub.create(this); - } else { - throw new UnsupportedOperationException( - "Transport not supported: " + getTransportChannelProvider().getTransportName()); } + throw new UnsupportedOperationException( + String.format( + "Transport not supported: %s", getTransportChannelProvider().getTransportName())); } /** Returns a builder for the default ExecutorProvider for this service. */ @@ -204,63 +259,9 @@ protected PagesStubSettings(Builder settingsBuilder) throws IOException { deletePageSettings = settingsBuilder.deletePageSettings().build(); } - private static final PagedListDescriptor - LIST_PAGES_PAGE_STR_DESC = - new PagedListDescriptor() { - @Override - public String emptyToken() { - return ""; - } - - @Override - public ListPagesRequest injectToken(ListPagesRequest payload, String token) { - return ListPagesRequest.newBuilder(payload).setPageToken(token).build(); - } - - @Override - public ListPagesRequest injectPageSize(ListPagesRequest payload, int pageSize) { - return ListPagesRequest.newBuilder(payload).setPageSize(pageSize).build(); - } - - @Override - public Integer extractPageSize(ListPagesRequest payload) { - return payload.getPageSize(); - } - - @Override - public String extractNextToken(ListPagesResponse payload) { - return payload.getNextPageToken(); - } - - @Override - public Iterable extractResources(ListPagesResponse payload) { - return payload.getPagesList() != null - ? payload.getPagesList() - : ImmutableList.of(); - } - }; - - private static final PagedListResponseFactory< - ListPagesRequest, ListPagesResponse, ListPagesPagedResponse> - LIST_PAGES_PAGE_STR_FACT = - new PagedListResponseFactory< - ListPagesRequest, ListPagesResponse, ListPagesPagedResponse>() { - @Override - public ApiFuture getFuturePagedResponse( - UnaryCallable callable, - ListPagesRequest request, - ApiCallContext context, - ApiFuture futureResponse) { - PageContext pageContext = - PageContext.create(callable, LIST_PAGES_PAGE_STR_DESC, request, context); - return ListPagesPagedResponse.createAsync(pageContext, futureResponse); - } - }; - /** Builder for PagesStubSettings. */ public static class Builder extends StubSettings.Builder { private final ImmutableList> unaryMethodSettingsBuilders; - private final PagedCallSettings.Builder< ListPagesRequest, ListPagesResponse, ListPagesPagedResponse> listPagesSettings; @@ -268,7 +269,6 @@ public static class Builder extends StubSettings.Builder createPageSettings; private final UnaryCallSettings.Builder updatePageSettings; private final UnaryCallSettings.Builder deletePageSettings; - private static final ImmutableMap> RETRYABLE_CODE_DEFINITIONS; @@ -276,14 +276,8 @@ public static class Builder extends StubSettings.Builder> definitions = ImmutableMap.builder(); definitions.put( - "retry_policy_1_codes", + "retry_policy_0_codes", ImmutableSet.copyOf(Lists.newArrayList(StatusCode.Code.UNAVAILABLE))); - definitions.put("no_retry_codes", ImmutableSet.copyOf(Lists.newArrayList())); - definitions.put( - "retry_policy_2_codes", - ImmutableSet.copyOf(Lists.newArrayList(StatusCode.Code.UNAVAILABLE))); - definitions.put( - "no_retry_1_codes", ImmutableSet.copyOf(Lists.newArrayList())); RETRYABLE_CODE_DEFINITIONS = definitions.build(); } @@ -302,46 +296,21 @@ public static class Builder extends StubSettings.Builder>of( + listPagesSettings, + getPageSettings, + createPageSettings, + updatePageSettings, + deletePageSettings); + } + private static Builder createDefault() { - Builder builder = new Builder((ClientContext) null); + Builder builder = new Builder(((ClientContext) null)); + builder.setTransportChannelProvider(defaultTransportChannelProvider()); builder.setCredentialsProvider(defaultCredentialsProviderBuilder().build()); builder.setInternalHeaderProvider(defaultApiClientHeaderProviderBuilder().build()); builder.setEndpoint(getDefaultEndpoint()); + return initDefaults(builder); } private static Builder initDefaults(Builder builder) { - builder .listPagesSettings() - .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_1_codes")) - .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_1_params")); + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params")); builder .getPageSettings() - .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_1_codes")) - .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_1_params")); + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params")); builder .createPageSettings() - .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_1_codes")) - .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_1_params")); + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params")); builder .updatePageSettings() - .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_1_codes")) - .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_1_params")); + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params")); builder .deletePageSettings() - .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_1_codes")) - .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_1_params")); + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params")); return builder; } - protected Builder(PagesStubSettings settings) { - super(settings); - - listPagesSettings = settings.listPagesSettings.toBuilder(); - getPageSettings = settings.getPageSettings.toBuilder(); - createPageSettings = settings.createPageSettings.toBuilder(); - updatePageSettings = settings.updatePageSettings.toBuilder(); - deletePageSettings = settings.deletePageSettings.toBuilder(); - - unaryMethodSettingsBuilders = - ImmutableList.>of( - listPagesSettings, - getPageSettings, - createPageSettings, - updatePageSettings, - deletePageSettings); - } - - // NEXT_MAJOR_VER: remove 'throws Exception' + // NEXT_MAJOR_VER: remove 'throws Exception'. /** * Applies the given settings updater function to all of the unary API methods in this service. * diff --git a/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3/stub/SecuritySettingsServiceStub.java b/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3/stub/SecuritySettingsServiceStub.java index 1e92511cc..b49dfd4c8 100644 --- a/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3/stub/SecuritySettingsServiceStub.java +++ b/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3/stub/SecuritySettingsServiceStub.java @@ -5,7 +5,7 @@ * 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 + * 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, @@ -13,11 +13,11 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.google.cloud.dialogflow.cx.v3.stub; import static com.google.cloud.dialogflow.cx.v3.SecuritySettingsServiceClient.ListSecuritySettingsPagedResponse; -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.cx.v3.CreateSecuritySettingsRequest; @@ -30,14 +30,13 @@ import com.google.protobuf.Empty; import javax.annotation.Generated; -// AUTO-GENERATED DOCUMENTATION AND CLASS +// AUTO-GENERATED DOCUMENTATION AND CLASS. /** - * Base stub class for Dialogflow API. + * Base stub class for the SecuritySettingsService service API. * *

This class is for advanced usage and reflects the underlying API directly. */ @Generated("by gapic-generator") -@BetaApi("A restructuring of stub classes is planned, so this may break in the future") public abstract class SecuritySettingsServiceStub implements BackgroundResource { public UnaryCallable diff --git a/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3/stub/SecuritySettingsServiceStubSettings.java b/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3/stub/SecuritySettingsServiceStubSettings.java index b39f1f704..460e733b3 100644 --- a/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3/stub/SecuritySettingsServiceStubSettings.java +++ b/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3/stub/SecuritySettingsServiceStubSettings.java @@ -5,7 +5,7 @@ * 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 + * 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, @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.google.cloud.dialogflow.cx.v3.stub; import static com.google.cloud.dialogflow.cx.v3.SecuritySettingsServiceClient.ListSecuritySettingsPagedResponse; @@ -56,7 +57,7 @@ import javax.annotation.Generated; import org.threeten.bp.Duration; -// AUTO-GENERATED DOCUMENTATION AND CLASS +// AUTO-GENERATED DOCUMENTATION AND CLASS. /** * Settings class to configure an instance of {@link SecuritySettingsServiceStub}. * @@ -73,21 +74,24 @@ * *

For example, to set the total timeout of createSecuritySettings to 30 seconds: * - *

- * 
+ * 
{@code
  * SecuritySettingsServiceStubSettings.Builder securitySettingsServiceSettingsBuilder =
  *     SecuritySettingsServiceStubSettings.newBuilder();
  * securitySettingsServiceSettingsBuilder
  *     .createSecuritySettingsSettings()
  *     .setRetrySettings(
- *         securitySettingsServiceSettingsBuilder.createSecuritySettingsSettings().getRetrySettings().toBuilder()
+ *         securitySettingsServiceSettingsBuilder
+ *             .createSecuritySettingsSettings()
+ *             .getRetrySettings()
+ *             .toBuilder()
  *             .setTotalTimeout(Duration.ofSeconds(30))
  *             .build());
- * SecuritySettingsServiceStubSettings securitySettingsServiceSettings = securitySettingsServiceSettingsBuilder.build();
- * 
- * 
+ * SecuritySettingsServiceStubSettings securitySettingsServiceSettings = + * securitySettingsServiceSettingsBuilder.build(); + * }
*/ -@Generated("by gapic-generator") +@BetaApi +@Generated("by gapic-generator-java") public class SecuritySettingsServiceStubSettings extends StubSettings { /** The default scopes of the service. */ @@ -111,6 +115,71 @@ public class SecuritySettingsServiceStubSettings private final UnaryCallSettings deleteSecuritySettingsSettings; + private static final PagedListDescriptor< + ListSecuritySettingsRequest, ListSecuritySettingsResponse, SecuritySettings> + LIST_SECURITY_SETTINGS_PAGE_STR_DESC = + new PagedListDescriptor< + ListSecuritySettingsRequest, ListSecuritySettingsResponse, SecuritySettings>() { + @Override + public String emptyToken() { + return ""; + } + + @Override + public ListSecuritySettingsRequest injectToken( + ListSecuritySettingsRequest payload, String token) { + return ListSecuritySettingsRequest.newBuilder(payload).setPageToken(token).build(); + } + + @Override + public ListSecuritySettingsRequest injectPageSize( + ListSecuritySettingsRequest payload, int pageSize) { + return ListSecuritySettingsRequest.newBuilder(payload).setPageSize(pageSize).build(); + } + + @Override + public Integer extractPageSize(ListSecuritySettingsRequest payload) { + return payload.getPageSize(); + } + + @Override + public String extractNextToken(ListSecuritySettingsResponse payload) { + return payload.getNextPageToken(); + } + + @Override + public Iterable extractResources( + ListSecuritySettingsResponse payload) { + return payload.getSecuritySettingsList() == null + ? ImmutableList.of() + : payload.getSecuritySettingsList(); + } + }; + + private static final PagedListResponseFactory< + ListSecuritySettingsRequest, + ListSecuritySettingsResponse, + ListSecuritySettingsPagedResponse> + LIST_SECURITY_SETTINGS_PAGE_STR_FACT = + new PagedListResponseFactory< + ListSecuritySettingsRequest, + ListSecuritySettingsResponse, + ListSecuritySettingsPagedResponse>() { + @Override + public ApiFuture getFuturePagedResponse( + UnaryCallable callable, + ListSecuritySettingsRequest request, + ApiCallContext context, + ApiFuture futureResponse) { + PageContext< + ListSecuritySettingsRequest, ListSecuritySettingsResponse, SecuritySettings> + pageContext = + PageContext.create( + callable, LIST_SECURITY_SETTINGS_PAGE_STR_DESC, request, context); + return ListSecuritySettingsPagedResponse.createAsync(pageContext, futureResponse); + } + }; + /** Returns the object with the settings used for calls to createSecuritySettings. */ public UnaryCallSettings createSecuritySettingsSettings() { @@ -149,10 +218,10 @@ public SecuritySettingsServiceStub createStub() throws IOException { .getTransportName() .equals(GrpcTransportChannel.getGrpcTransportName())) { return GrpcSecuritySettingsServiceStub.create(this); - } else { - throw new UnsupportedOperationException( - "Transport not supported: " + getTransportChannelProvider().getTransportName()); } + throw new UnsupportedOperationException( + String.format( + "Transport not supported: %s", getTransportChannelProvider().getTransportName())); } /** Returns a builder for the default ExecutorProvider for this service. */ @@ -219,76 +288,10 @@ protected SecuritySettingsServiceStubSettings(Builder settingsBuilder) throws IO deleteSecuritySettingsSettings = settingsBuilder.deleteSecuritySettingsSettings().build(); } - private static final PagedListDescriptor< - ListSecuritySettingsRequest, ListSecuritySettingsResponse, SecuritySettings> - LIST_SECURITY_SETTINGS_PAGE_STR_DESC = - new PagedListDescriptor< - ListSecuritySettingsRequest, ListSecuritySettingsResponse, SecuritySettings>() { - @Override - public String emptyToken() { - return ""; - } - - @Override - public ListSecuritySettingsRequest injectToken( - ListSecuritySettingsRequest payload, String token) { - return ListSecuritySettingsRequest.newBuilder(payload).setPageToken(token).build(); - } - - @Override - public ListSecuritySettingsRequest injectPageSize( - ListSecuritySettingsRequest payload, int pageSize) { - return ListSecuritySettingsRequest.newBuilder(payload).setPageSize(pageSize).build(); - } - - @Override - public Integer extractPageSize(ListSecuritySettingsRequest payload) { - return payload.getPageSize(); - } - - @Override - public String extractNextToken(ListSecuritySettingsResponse payload) { - return payload.getNextPageToken(); - } - - @Override - public Iterable extractResources( - ListSecuritySettingsResponse payload) { - return payload.getSecuritySettingsList() != null - ? payload.getSecuritySettingsList() - : ImmutableList.of(); - } - }; - - private static final PagedListResponseFactory< - ListSecuritySettingsRequest, - ListSecuritySettingsResponse, - ListSecuritySettingsPagedResponse> - LIST_SECURITY_SETTINGS_PAGE_STR_FACT = - new PagedListResponseFactory< - ListSecuritySettingsRequest, - ListSecuritySettingsResponse, - ListSecuritySettingsPagedResponse>() { - @Override - public ApiFuture getFuturePagedResponse( - UnaryCallable callable, - ListSecuritySettingsRequest request, - ApiCallContext context, - ApiFuture futureResponse) { - PageContext< - ListSecuritySettingsRequest, ListSecuritySettingsResponse, SecuritySettings> - pageContext = - PageContext.create( - callable, LIST_SECURITY_SETTINGS_PAGE_STR_DESC, request, context); - return ListSecuritySettingsPagedResponse.createAsync(pageContext, futureResponse); - } - }; - /** Builder for SecuritySettingsServiceStubSettings. */ public static class Builder extends StubSettings.Builder { private final ImmutableList> unaryMethodSettingsBuilders; - private final UnaryCallSettings.Builder createSecuritySettingsSettings; private final UnaryCallSettings.Builder @@ -302,7 +305,6 @@ public static class Builder listSecuritySettingsSettings; private final UnaryCallSettings.Builder deleteSecuritySettingsSettings; - private static final ImmutableMap> RETRYABLE_CODE_DEFINITIONS; @@ -310,14 +312,8 @@ public static class Builder ImmutableMap.Builder> definitions = ImmutableMap.builder(); definitions.put( - "retry_policy_1_codes", + "retry_policy_0_codes", ImmutableSet.copyOf(Lists.newArrayList(StatusCode.Code.UNAVAILABLE))); - definitions.put("no_retry_codes", ImmutableSet.copyOf(Lists.newArrayList())); - definitions.put( - "retry_policy_2_codes", - ImmutableSet.copyOf(Lists.newArrayList(StatusCode.Code.UNAVAILABLE))); - definitions.put( - "no_retry_1_codes", ImmutableSet.copyOf(Lists.newArrayList())); RETRYABLE_CODE_DEFINITIONS = definitions.build(); } @@ -336,47 +332,22 @@ public static class Builder .setMaxRpcTimeout(Duration.ofMillis(60000L)) .setTotalTimeout(Duration.ofMillis(60000L)) .build(); - definitions.put("retry_policy_1_params", settings); - settings = - RetrySettings.newBuilder() - .setInitialRetryDelay(Duration.ofMillis(100L)) - .setRetryDelayMultiplier(1.3) - .setMaxRetryDelay(Duration.ofMillis(60000L)) - .setInitialRpcTimeout(Duration.ofMillis(220000L)) - .setRpcTimeoutMultiplier(1.0) - .setMaxRpcTimeout(Duration.ofMillis(220000L)) - .setTotalTimeout(Duration.ofMillis(220000L)) - .build(); - definitions.put("retry_policy_2_params", settings); - settings = RetrySettings.newBuilder().setRpcTimeoutMultiplier(1.0).build(); - definitions.put("no_retry_params", settings); - settings = - RetrySettings.newBuilder() - .setInitialRpcTimeout(Duration.ofMillis(220000L)) - .setRpcTimeoutMultiplier(1.0) - .setMaxRpcTimeout(Duration.ofMillis(220000L)) - .setTotalTimeout(Duration.ofMillis(220000L)) - .build(); - definitions.put("no_retry_1_params", settings); + definitions.put("retry_policy_0_params", settings); RETRY_PARAM_DEFINITIONS = definitions.build(); } protected Builder() { - this((ClientContext) null); + this(((ClientContext) null)); } protected Builder(ClientContext clientContext) { super(clientContext); createSecuritySettingsSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); - getSecuritySettingsSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); - updateSecuritySettingsSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); - listSecuritySettingsSettings = PagedCallSettings.newBuilder(LIST_SECURITY_SETTINGS_PAGE_STR_FACT); - deleteSecuritySettingsSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); unaryMethodSettingsBuilders = @@ -386,68 +357,68 @@ protected Builder(ClientContext clientContext) { updateSecuritySettingsSettings, listSecuritySettingsSettings, deleteSecuritySettingsSettings); - initDefaults(this); } + protected Builder(SecuritySettingsServiceStubSettings settings) { + super(settings); + + createSecuritySettingsSettings = settings.createSecuritySettingsSettings.toBuilder(); + getSecuritySettingsSettings = settings.getSecuritySettingsSettings.toBuilder(); + updateSecuritySettingsSettings = settings.updateSecuritySettingsSettings.toBuilder(); + listSecuritySettingsSettings = settings.listSecuritySettingsSettings.toBuilder(); + deleteSecuritySettingsSettings = settings.deleteSecuritySettingsSettings.toBuilder(); + + unaryMethodSettingsBuilders = + ImmutableList.>of( + createSecuritySettingsSettings, + getSecuritySettingsSettings, + updateSecuritySettingsSettings, + listSecuritySettingsSettings, + deleteSecuritySettingsSettings); + } + private static Builder createDefault() { - Builder builder = new Builder((ClientContext) null); + Builder builder = new Builder(((ClientContext) null)); + builder.setTransportChannelProvider(defaultTransportChannelProvider()); builder.setCredentialsProvider(defaultCredentialsProviderBuilder().build()); builder.setInternalHeaderProvider(defaultApiClientHeaderProviderBuilder().build()); builder.setEndpoint(getDefaultEndpoint()); + return initDefaults(builder); } private static Builder initDefaults(Builder builder) { - builder .createSecuritySettingsSettings() - .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_1_codes")) - .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_1_params")); + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params")); builder .getSecuritySettingsSettings() - .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_1_codes")) - .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_1_params")); + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params")); builder .updateSecuritySettingsSettings() - .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_1_codes")) - .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_1_params")); + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params")); builder .listSecuritySettingsSettings() - .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_1_codes")) - .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_1_params")); + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params")); builder .deleteSecuritySettingsSettings() - .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_1_codes")) - .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_1_params")); + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params")); return builder; } - protected Builder(SecuritySettingsServiceStubSettings settings) { - super(settings); - - createSecuritySettingsSettings = settings.createSecuritySettingsSettings.toBuilder(); - getSecuritySettingsSettings = settings.getSecuritySettingsSettings.toBuilder(); - updateSecuritySettingsSettings = settings.updateSecuritySettingsSettings.toBuilder(); - listSecuritySettingsSettings = settings.listSecuritySettingsSettings.toBuilder(); - deleteSecuritySettingsSettings = settings.deleteSecuritySettingsSettings.toBuilder(); - - unaryMethodSettingsBuilders = - ImmutableList.>of( - createSecuritySettingsSettings, - getSecuritySettingsSettings, - updateSecuritySettingsSettings, - listSecuritySettingsSettings, - deleteSecuritySettingsSettings); - } - - // NEXT_MAJOR_VER: remove 'throws Exception' + // NEXT_MAJOR_VER: remove 'throws Exception'. /** * Applies the given settings updater function to all of the unary API methods in this service. * diff --git a/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3/stub/SessionEntityTypesStub.java b/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3/stub/SessionEntityTypesStub.java index e4b13241d..4b688c7f0 100644 --- a/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3/stub/SessionEntityTypesStub.java +++ b/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3/stub/SessionEntityTypesStub.java @@ -5,7 +5,7 @@ * 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 + * 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, @@ -13,11 +13,11 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.google.cloud.dialogflow.cx.v3.stub; import static com.google.cloud.dialogflow.cx.v3.SessionEntityTypesClient.ListSessionEntityTypesPagedResponse; -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.cx.v3.CreateSessionEntityTypeRequest; @@ -30,14 +30,13 @@ import com.google.protobuf.Empty; import javax.annotation.Generated; -// AUTO-GENERATED DOCUMENTATION AND CLASS +// AUTO-GENERATED DOCUMENTATION AND CLASS. /** - * Base stub class for Dialogflow API. + * Base stub class for the SessionEntityTypes service API. * *

This class is for advanced usage and reflects the underlying API directly. */ @Generated("by gapic-generator") -@BetaApi("A restructuring of stub classes is planned, so this may break in the future") public abstract class SessionEntityTypesStub implements BackgroundResource { public UnaryCallable diff --git a/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3/stub/SessionEntityTypesStubSettings.java b/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3/stub/SessionEntityTypesStubSettings.java index c8d9c853c..26022ad38 100644 --- a/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3/stub/SessionEntityTypesStubSettings.java +++ b/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3/stub/SessionEntityTypesStubSettings.java @@ -5,7 +5,7 @@ * 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 + * 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, @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.google.cloud.dialogflow.cx.v3.stub; import static com.google.cloud.dialogflow.cx.v3.SessionEntityTypesClient.ListSessionEntityTypesPagedResponse; @@ -56,7 +57,7 @@ import javax.annotation.Generated; import org.threeten.bp.Duration; -// AUTO-GENERATED DOCUMENTATION AND CLASS +// AUTO-GENERATED DOCUMENTATION AND CLASS. /** * Settings class to configure an instance of {@link SessionEntityTypesStub}. * @@ -73,21 +74,24 @@ * *

For example, to set the total timeout of getSessionEntityType to 30 seconds: * - *

- * 
+ * 
{@code
  * SessionEntityTypesStubSettings.Builder sessionEntityTypesSettingsBuilder =
  *     SessionEntityTypesStubSettings.newBuilder();
  * sessionEntityTypesSettingsBuilder
  *     .getSessionEntityTypeSettings()
  *     .setRetrySettings(
- *         sessionEntityTypesSettingsBuilder.getSessionEntityTypeSettings().getRetrySettings().toBuilder()
+ *         sessionEntityTypesSettingsBuilder
+ *             .getSessionEntityTypeSettings()
+ *             .getRetrySettings()
+ *             .toBuilder()
  *             .setTotalTimeout(Duration.ofSeconds(30))
  *             .build());
- * SessionEntityTypesStubSettings sessionEntityTypesSettings = sessionEntityTypesSettingsBuilder.build();
- * 
- * 
+ * SessionEntityTypesStubSettings sessionEntityTypesSettings = + * sessionEntityTypesSettingsBuilder.build(); + * }
*/ -@Generated("by gapic-generator") +@BetaApi +@Generated("by gapic-generator-java") public class SessionEntityTypesStubSettings extends StubSettings { /** The default scopes of the service. */ private static final ImmutableList DEFAULT_SERVICE_SCOPES = @@ -110,6 +114,76 @@ public class SessionEntityTypesStubSettings extends StubSettings deleteSessionEntityTypeSettings; + private static final PagedListDescriptor< + ListSessionEntityTypesRequest, ListSessionEntityTypesResponse, SessionEntityType> + LIST_SESSION_ENTITY_TYPES_PAGE_STR_DESC = + new PagedListDescriptor< + ListSessionEntityTypesRequest, ListSessionEntityTypesResponse, SessionEntityType>() { + @Override + public String emptyToken() { + return ""; + } + + @Override + public ListSessionEntityTypesRequest injectToken( + ListSessionEntityTypesRequest payload, String token) { + return ListSessionEntityTypesRequest.newBuilder(payload).setPageToken(token).build(); + } + + @Override + public ListSessionEntityTypesRequest injectPageSize( + ListSessionEntityTypesRequest payload, int pageSize) { + return ListSessionEntityTypesRequest.newBuilder(payload) + .setPageSize(pageSize) + .build(); + } + + @Override + public Integer extractPageSize(ListSessionEntityTypesRequest payload) { + return payload.getPageSize(); + } + + @Override + public String extractNextToken(ListSessionEntityTypesResponse payload) { + return payload.getNextPageToken(); + } + + @Override + public Iterable extractResources( + ListSessionEntityTypesResponse payload) { + return payload.getSessionEntityTypesList() == null + ? ImmutableList.of() + : payload.getSessionEntityTypesList(); + } + }; + + private static final PagedListResponseFactory< + ListSessionEntityTypesRequest, + ListSessionEntityTypesResponse, + ListSessionEntityTypesPagedResponse> + LIST_SESSION_ENTITY_TYPES_PAGE_STR_FACT = + new PagedListResponseFactory< + ListSessionEntityTypesRequest, + ListSessionEntityTypesResponse, + ListSessionEntityTypesPagedResponse>() { + @Override + public ApiFuture getFuturePagedResponse( + UnaryCallable + callable, + ListSessionEntityTypesRequest request, + ApiCallContext context, + ApiFuture futureResponse) { + PageContext< + ListSessionEntityTypesRequest, + ListSessionEntityTypesResponse, + SessionEntityType> + pageContext = + PageContext.create( + callable, LIST_SESSION_ENTITY_TYPES_PAGE_STR_DESC, request, context); + return ListSessionEntityTypesPagedResponse.createAsync(pageContext, futureResponse); + } + }; + /** Returns the object with the settings used for calls to listSessionEntityTypes. */ public PagedCallSettings< ListSessionEntityTypesRequest, @@ -149,10 +223,10 @@ public SessionEntityTypesStub createStub() throws IOException { .getTransportName() .equals(GrpcTransportChannel.getGrpcTransportName())) { return GrpcSessionEntityTypesStub.create(this); - } else { - throw new UnsupportedOperationException( - "Transport not supported: " + getTransportChannelProvider().getTransportName()); } + throw new UnsupportedOperationException( + String.format( + "Transport not supported: %s", getTransportChannelProvider().getTransportName())); } /** Returns a builder for the default ExecutorProvider for this service. */ @@ -219,81 +293,10 @@ protected SessionEntityTypesStubSettings(Builder settingsBuilder) throws IOExcep deleteSessionEntityTypeSettings = settingsBuilder.deleteSessionEntityTypeSettings().build(); } - private static final PagedListDescriptor< - ListSessionEntityTypesRequest, ListSessionEntityTypesResponse, SessionEntityType> - LIST_SESSION_ENTITY_TYPES_PAGE_STR_DESC = - new PagedListDescriptor< - ListSessionEntityTypesRequest, ListSessionEntityTypesResponse, SessionEntityType>() { - @Override - public String emptyToken() { - return ""; - } - - @Override - public ListSessionEntityTypesRequest injectToken( - ListSessionEntityTypesRequest payload, String token) { - return ListSessionEntityTypesRequest.newBuilder(payload).setPageToken(token).build(); - } - - @Override - public ListSessionEntityTypesRequest injectPageSize( - ListSessionEntityTypesRequest payload, int pageSize) { - return ListSessionEntityTypesRequest.newBuilder(payload) - .setPageSize(pageSize) - .build(); - } - - @Override - public Integer extractPageSize(ListSessionEntityTypesRequest payload) { - return payload.getPageSize(); - } - - @Override - public String extractNextToken(ListSessionEntityTypesResponse payload) { - return payload.getNextPageToken(); - } - - @Override - public Iterable extractResources( - ListSessionEntityTypesResponse payload) { - return payload.getSessionEntityTypesList() != null - ? payload.getSessionEntityTypesList() - : ImmutableList.of(); - } - }; - - private static final PagedListResponseFactory< - ListSessionEntityTypesRequest, - ListSessionEntityTypesResponse, - ListSessionEntityTypesPagedResponse> - LIST_SESSION_ENTITY_TYPES_PAGE_STR_FACT = - new PagedListResponseFactory< - ListSessionEntityTypesRequest, - ListSessionEntityTypesResponse, - ListSessionEntityTypesPagedResponse>() { - @Override - public ApiFuture getFuturePagedResponse( - UnaryCallable - callable, - ListSessionEntityTypesRequest request, - ApiCallContext context, - ApiFuture futureResponse) { - PageContext< - ListSessionEntityTypesRequest, - ListSessionEntityTypesResponse, - SessionEntityType> - pageContext = - PageContext.create( - callable, LIST_SESSION_ENTITY_TYPES_PAGE_STR_DESC, request, context); - return ListSessionEntityTypesPagedResponse.createAsync(pageContext, futureResponse); - } - }; - /** Builder for SessionEntityTypesStubSettings. */ public static class Builder extends StubSettings.Builder { private final ImmutableList> unaryMethodSettingsBuilders; - private final PagedCallSettings.Builder< ListSessionEntityTypesRequest, ListSessionEntityTypesResponse, @@ -307,7 +310,6 @@ public static class Builder updateSessionEntityTypeSettings; private final UnaryCallSettings.Builder deleteSessionEntityTypeSettings; - private static final ImmutableMap> RETRYABLE_CODE_DEFINITIONS; @@ -315,14 +317,8 @@ public static class Builder ImmutableMap.Builder> definitions = ImmutableMap.builder(); definitions.put( - "retry_policy_1_codes", - ImmutableSet.copyOf(Lists.newArrayList(StatusCode.Code.UNAVAILABLE))); - definitions.put("no_retry_codes", ImmutableSet.copyOf(Lists.newArrayList())); - definitions.put( - "retry_policy_2_codes", + "retry_policy_0_codes", ImmutableSet.copyOf(Lists.newArrayList(StatusCode.Code.UNAVAILABLE))); - definitions.put( - "no_retry_1_codes", ImmutableSet.copyOf(Lists.newArrayList())); RETRYABLE_CODE_DEFINITIONS = definitions.build(); } @@ -341,33 +337,12 @@ public static class Builder .setMaxRpcTimeout(Duration.ofMillis(60000L)) .setTotalTimeout(Duration.ofMillis(60000L)) .build(); - definitions.put("retry_policy_1_params", settings); - settings = - RetrySettings.newBuilder() - .setInitialRetryDelay(Duration.ofMillis(100L)) - .setRetryDelayMultiplier(1.3) - .setMaxRetryDelay(Duration.ofMillis(60000L)) - .setInitialRpcTimeout(Duration.ofMillis(220000L)) - .setRpcTimeoutMultiplier(1.0) - .setMaxRpcTimeout(Duration.ofMillis(220000L)) - .setTotalTimeout(Duration.ofMillis(220000L)) - .build(); - definitions.put("retry_policy_2_params", settings); - settings = RetrySettings.newBuilder().setRpcTimeoutMultiplier(1.0).build(); - definitions.put("no_retry_params", settings); - settings = - RetrySettings.newBuilder() - .setInitialRpcTimeout(Duration.ofMillis(220000L)) - .setRpcTimeoutMultiplier(1.0) - .setMaxRpcTimeout(Duration.ofMillis(220000L)) - .setTotalTimeout(Duration.ofMillis(220000L)) - .build(); - definitions.put("no_retry_1_params", settings); + definitions.put("retry_policy_0_params", settings); RETRY_PARAM_DEFINITIONS = definitions.build(); } protected Builder() { - this((ClientContext) null); + this(((ClientContext) null)); } protected Builder(ClientContext clientContext) { @@ -375,13 +350,9 @@ protected Builder(ClientContext clientContext) { listSessionEntityTypesSettings = PagedCallSettings.newBuilder(LIST_SESSION_ENTITY_TYPES_PAGE_STR_FACT); - getSessionEntityTypeSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); - createSessionEntityTypeSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); - updateSessionEntityTypeSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); - deleteSessionEntityTypeSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); unaryMethodSettingsBuilders = @@ -391,68 +362,68 @@ protected Builder(ClientContext clientContext) { createSessionEntityTypeSettings, updateSessionEntityTypeSettings, deleteSessionEntityTypeSettings); - initDefaults(this); } + protected Builder(SessionEntityTypesStubSettings settings) { + super(settings); + + listSessionEntityTypesSettings = settings.listSessionEntityTypesSettings.toBuilder(); + getSessionEntityTypeSettings = settings.getSessionEntityTypeSettings.toBuilder(); + createSessionEntityTypeSettings = settings.createSessionEntityTypeSettings.toBuilder(); + updateSessionEntityTypeSettings = settings.updateSessionEntityTypeSettings.toBuilder(); + deleteSessionEntityTypeSettings = settings.deleteSessionEntityTypeSettings.toBuilder(); + + unaryMethodSettingsBuilders = + ImmutableList.>of( + listSessionEntityTypesSettings, + getSessionEntityTypeSettings, + createSessionEntityTypeSettings, + updateSessionEntityTypeSettings, + deleteSessionEntityTypeSettings); + } + private static Builder createDefault() { - Builder builder = new Builder((ClientContext) null); + Builder builder = new Builder(((ClientContext) null)); + builder.setTransportChannelProvider(defaultTransportChannelProvider()); builder.setCredentialsProvider(defaultCredentialsProviderBuilder().build()); builder.setInternalHeaderProvider(defaultApiClientHeaderProviderBuilder().build()); builder.setEndpoint(getDefaultEndpoint()); + return initDefaults(builder); } private static Builder initDefaults(Builder builder) { - builder .listSessionEntityTypesSettings() - .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_1_codes")) - .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_1_params")); + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params")); builder .getSessionEntityTypeSettings() - .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_1_codes")) - .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_1_params")); + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params")); builder .createSessionEntityTypeSettings() - .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_1_codes")) - .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_1_params")); + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params")); builder .updateSessionEntityTypeSettings() - .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_1_codes")) - .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_1_params")); + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params")); builder .deleteSessionEntityTypeSettings() - .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_1_codes")) - .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_1_params")); + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params")); return builder; } - protected Builder(SessionEntityTypesStubSettings settings) { - super(settings); - - listSessionEntityTypesSettings = settings.listSessionEntityTypesSettings.toBuilder(); - getSessionEntityTypeSettings = settings.getSessionEntityTypeSettings.toBuilder(); - createSessionEntityTypeSettings = settings.createSessionEntityTypeSettings.toBuilder(); - updateSessionEntityTypeSettings = settings.updateSessionEntityTypeSettings.toBuilder(); - deleteSessionEntityTypeSettings = settings.deleteSessionEntityTypeSettings.toBuilder(); - - unaryMethodSettingsBuilders = - ImmutableList.>of( - listSessionEntityTypesSettings, - getSessionEntityTypeSettings, - createSessionEntityTypeSettings, - updateSessionEntityTypeSettings, - deleteSessionEntityTypeSettings); - } - - // NEXT_MAJOR_VER: remove 'throws Exception' + // NEXT_MAJOR_VER: remove 'throws Exception'. /** * Applies the given settings updater function to all of the unary API methods in this service. * diff --git a/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3/stub/SessionsStub.java b/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3/stub/SessionsStub.java index 6d406284f..36802f5be 100644 --- a/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3/stub/SessionsStub.java +++ b/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3/stub/SessionsStub.java @@ -5,7 +5,7 @@ * 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 + * 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, @@ -13,9 +13,9 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.google.cloud.dialogflow.cx.v3.stub; -import com.google.api.core.BetaApi; import com.google.api.gax.core.BackgroundResource; import com.google.api.gax.rpc.BidiStreamingCallable; import com.google.api.gax.rpc.UnaryCallable; @@ -29,14 +29,13 @@ import com.google.cloud.dialogflow.cx.v3.StreamingDetectIntentResponse; import javax.annotation.Generated; -// AUTO-GENERATED DOCUMENTATION AND CLASS +// AUTO-GENERATED DOCUMENTATION AND CLASS. /** - * Base stub class for Dialogflow API. + * Base stub class for the Sessions service API. * *

This class is for advanced usage and reflects the underlying API directly. */ @Generated("by gapic-generator") -@BetaApi("A restructuring of stub classes is planned, so this may break in the future") public abstract class SessionsStub implements BackgroundResource { public UnaryCallable detectIntentCallable() { diff --git a/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3/stub/SessionsStubSettings.java b/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3/stub/SessionsStubSettings.java index 7da137a92..915b4013e 100644 --- a/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3/stub/SessionsStubSettings.java +++ b/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3/stub/SessionsStubSettings.java @@ -5,7 +5,7 @@ * 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 + * 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, @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.google.cloud.dialogflow.cx.v3.stub; import com.google.api.core.ApiFunction; @@ -48,7 +49,7 @@ import javax.annotation.Generated; import org.threeten.bp.Duration; -// AUTO-GENERATED DOCUMENTATION AND CLASS +// AUTO-GENERATED DOCUMENTATION AND CLASS. /** * Settings class to configure an instance of {@link SessionsStub}. * @@ -65,21 +66,22 @@ * *

For example, to set the total timeout of detectIntent to 30 seconds: * - *

- * 
- * SessionsStubSettings.Builder sessionsSettingsBuilder =
- *     SessionsStubSettings.newBuilder();
+ * 
{@code
+ * SessionsStubSettings.Builder sessionsSettingsBuilder = SessionsStubSettings.newBuilder();
  * sessionsSettingsBuilder
  *     .detectIntentSettings()
  *     .setRetrySettings(
- *         sessionsSettingsBuilder.detectIntentSettings().getRetrySettings().toBuilder()
+ *         sessionsSettingsBuilder
+ *             .detectIntentSettings()
+ *             .getRetrySettings()
+ *             .toBuilder()
  *             .setTotalTimeout(Duration.ofSeconds(30))
  *             .build());
  * SessionsStubSettings sessionsSettings = sessionsSettingsBuilder.build();
- * 
- * 
+ * }
*/ -@Generated("by gapic-generator") +@BetaApi +@Generated("by gapic-generator-java") public class SessionsStubSettings extends StubSettings { /** The default scopes of the service. */ private static final ImmutableList DEFAULT_SERVICE_SCOPES = @@ -122,10 +124,10 @@ public SessionsStub createStub() throws IOException { .getTransportName() .equals(GrpcTransportChannel.getGrpcTransportName())) { return GrpcSessionsStub.create(this); - } else { - throw new UnsupportedOperationException( - "Transport not supported: " + getTransportChannelProvider().getTransportName()); } + throw new UnsupportedOperationException( + String.format( + "Transport not supported: %s", getTransportChannelProvider().getTransportName())); } /** Returns a builder for the default ExecutorProvider for this service. */ @@ -193,7 +195,6 @@ protected SessionsStubSettings(Builder settingsBuilder) throws IOException { /** Builder for SessionsStubSettings. */ public static class Builder extends StubSettings.Builder { private final ImmutableList> unaryMethodSettingsBuilders; - private final UnaryCallSettings.Builder detectIntentSettings; private final StreamingCallSettings.Builder< @@ -203,7 +204,6 @@ public static class Builder extends StubSettings.Builder fulfillIntentSettings; - private static final ImmutableMap> RETRYABLE_CODE_DEFINITIONS; @@ -213,12 +213,11 @@ public static class Builder extends StubSettings.BuildernewArrayList(StatusCode.Code.UNAVAILABLE))); - definitions.put("no_retry_codes", ImmutableSet.copyOf(Lists.newArrayList())); definitions.put( - "retry_policy_2_codes", - ImmutableSet.copyOf(Lists.newArrayList(StatusCode.Code.UNAVAILABLE))); + "no_retry_2_codes", ImmutableSet.copyOf(Lists.newArrayList())); definitions.put( - "no_retry_1_codes", ImmutableSet.copyOf(Lists.newArrayList())); + "retry_policy_0_codes", + ImmutableSet.copyOf(Lists.newArrayList(StatusCode.Code.UNAVAILABLE))); RETRYABLE_CODE_DEFINITIONS = definitions.build(); } @@ -232,101 +231,96 @@ public static class Builder extends StubSettings.Builder>of( detectIntentSettings, matchIntentSettings, fulfillIntentSettings); - initDefaults(this); } + protected Builder(SessionsStubSettings settings) { + super(settings); + + detectIntentSettings = settings.detectIntentSettings.toBuilder(); + streamingDetectIntentSettings = settings.streamingDetectIntentSettings.toBuilder(); + matchIntentSettings = settings.matchIntentSettings.toBuilder(); + fulfillIntentSettings = settings.fulfillIntentSettings.toBuilder(); + + unaryMethodSettingsBuilders = + ImmutableList.>of( + detectIntentSettings, matchIntentSettings, fulfillIntentSettings); + } + private static Builder createDefault() { - Builder builder = new Builder((ClientContext) null); + Builder builder = new Builder(((ClientContext) null)); + builder.setTransportChannelProvider(defaultTransportChannelProvider()); builder.setCredentialsProvider(defaultCredentialsProviderBuilder().build()); builder.setInternalHeaderProvider(defaultApiClientHeaderProviderBuilder().build()); builder.setEndpoint(getDefaultEndpoint()); + return initDefaults(builder); } private static Builder initDefaults(Builder builder) { - builder .detectIntentSettings() - .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_2_codes")) - .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_2_params")); + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_1_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_1_params")); builder .matchIntentSettings() - .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_1_codes")) - .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_1_params")); + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params")); builder .fulfillIntentSettings() - .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_1_codes")) - .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_1_params")); + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params")); return builder; } - protected Builder(SessionsStubSettings settings) { - super(settings); - - detectIntentSettings = settings.detectIntentSettings.toBuilder(); - streamingDetectIntentSettings = settings.streamingDetectIntentSettings.toBuilder(); - matchIntentSettings = settings.matchIntentSettings.toBuilder(); - fulfillIntentSettings = settings.fulfillIntentSettings.toBuilder(); - - unaryMethodSettingsBuilders = - ImmutableList.>of( - detectIntentSettings, matchIntentSettings, fulfillIntentSettings); - } - - // NEXT_MAJOR_VER: remove 'throws Exception' + // NEXT_MAJOR_VER: remove 'throws Exception'. /** * Applies the given settings updater function to all of the unary API methods in this service. * diff --git a/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3/stub/TransitionRouteGroupsStub.java b/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3/stub/TransitionRouteGroupsStub.java index b6d94ed2c..ecb70c747 100644 --- a/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3/stub/TransitionRouteGroupsStub.java +++ b/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3/stub/TransitionRouteGroupsStub.java @@ -5,7 +5,7 @@ * 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 + * 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, @@ -13,11 +13,11 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.google.cloud.dialogflow.cx.v3.stub; import static com.google.cloud.dialogflow.cx.v3.TransitionRouteGroupsClient.ListTransitionRouteGroupsPagedResponse; -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.cx.v3.CreateTransitionRouteGroupRequest; @@ -30,14 +30,13 @@ import com.google.protobuf.Empty; import javax.annotation.Generated; -// AUTO-GENERATED DOCUMENTATION AND CLASS +// AUTO-GENERATED DOCUMENTATION AND CLASS. /** - * Base stub class for Dialogflow API. + * Base stub class for the TransitionRouteGroups service API. * *

This class is for advanced usage and reflects the underlying API directly. */ @Generated("by gapic-generator") -@BetaApi("A restructuring of stub classes is planned, so this may break in the future") public abstract class TransitionRouteGroupsStub implements BackgroundResource { public UnaryCallable diff --git a/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3/stub/TransitionRouteGroupsStubSettings.java b/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3/stub/TransitionRouteGroupsStubSettings.java index c097f3280..65e998d4e 100644 --- a/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3/stub/TransitionRouteGroupsStubSettings.java +++ b/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3/stub/TransitionRouteGroupsStubSettings.java @@ -5,7 +5,7 @@ * 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 + * 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, @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.google.cloud.dialogflow.cx.v3.stub; import static com.google.cloud.dialogflow.cx.v3.TransitionRouteGroupsClient.ListTransitionRouteGroupsPagedResponse; @@ -56,7 +57,7 @@ import javax.annotation.Generated; import org.threeten.bp.Duration; -// AUTO-GENERATED DOCUMENTATION AND CLASS +// AUTO-GENERATED DOCUMENTATION AND CLASS. /** * Settings class to configure an instance of {@link TransitionRouteGroupsStub}. * @@ -73,21 +74,24 @@ * *

For example, to set the total timeout of getTransitionRouteGroup to 30 seconds: * - *

- * 
+ * 
{@code
  * TransitionRouteGroupsStubSettings.Builder transitionRouteGroupsSettingsBuilder =
  *     TransitionRouteGroupsStubSettings.newBuilder();
  * transitionRouteGroupsSettingsBuilder
  *     .getTransitionRouteGroupSettings()
  *     .setRetrySettings(
- *         transitionRouteGroupsSettingsBuilder.getTransitionRouteGroupSettings().getRetrySettings().toBuilder()
+ *         transitionRouteGroupsSettingsBuilder
+ *             .getTransitionRouteGroupSettings()
+ *             .getRetrySettings()
+ *             .toBuilder()
  *             .setTotalTimeout(Duration.ofSeconds(30))
  *             .build());
- * TransitionRouteGroupsStubSettings transitionRouteGroupsSettings = transitionRouteGroupsSettingsBuilder.build();
- * 
- * 
+ * TransitionRouteGroupsStubSettings transitionRouteGroupsSettings = + * transitionRouteGroupsSettingsBuilder.build(); + * }
*/ -@Generated("by gapic-generator") +@BetaApi +@Generated("by gapic-generator-java") public class TransitionRouteGroupsStubSettings extends StubSettings { /** The default scopes of the service. */ @@ -111,6 +115,81 @@ public class TransitionRouteGroupsStubSettings private final UnaryCallSettings deleteTransitionRouteGroupSettings; + private static final PagedListDescriptor< + ListTransitionRouteGroupsRequest, ListTransitionRouteGroupsResponse, TransitionRouteGroup> + LIST_TRANSITION_ROUTE_GROUPS_PAGE_STR_DESC = + new PagedListDescriptor< + ListTransitionRouteGroupsRequest, + ListTransitionRouteGroupsResponse, + TransitionRouteGroup>() { + @Override + public String emptyToken() { + return ""; + } + + @Override + public ListTransitionRouteGroupsRequest injectToken( + ListTransitionRouteGroupsRequest payload, String token) { + return ListTransitionRouteGroupsRequest.newBuilder(payload) + .setPageToken(token) + .build(); + } + + @Override + public ListTransitionRouteGroupsRequest injectPageSize( + ListTransitionRouteGroupsRequest payload, int pageSize) { + return ListTransitionRouteGroupsRequest.newBuilder(payload) + .setPageSize(pageSize) + .build(); + } + + @Override + public Integer extractPageSize(ListTransitionRouteGroupsRequest payload) { + return payload.getPageSize(); + } + + @Override + public String extractNextToken(ListTransitionRouteGroupsResponse payload) { + return payload.getNextPageToken(); + } + + @Override + public Iterable extractResources( + ListTransitionRouteGroupsResponse payload) { + return payload.getTransitionRouteGroupsList() == null + ? ImmutableList.of() + : payload.getTransitionRouteGroupsList(); + } + }; + + private static final PagedListResponseFactory< + ListTransitionRouteGroupsRequest, + ListTransitionRouteGroupsResponse, + ListTransitionRouteGroupsPagedResponse> + LIST_TRANSITION_ROUTE_GROUPS_PAGE_STR_FACT = + new PagedListResponseFactory< + ListTransitionRouteGroupsRequest, + ListTransitionRouteGroupsResponse, + ListTransitionRouteGroupsPagedResponse>() { + @Override + public ApiFuture getFuturePagedResponse( + UnaryCallable + callable, + ListTransitionRouteGroupsRequest request, + ApiCallContext context, + ApiFuture futureResponse) { + PageContext< + ListTransitionRouteGroupsRequest, + ListTransitionRouteGroupsResponse, + TransitionRouteGroup> + pageContext = + PageContext.create( + callable, LIST_TRANSITION_ROUTE_GROUPS_PAGE_STR_DESC, request, context); + return ListTransitionRouteGroupsPagedResponse.createAsync( + pageContext, futureResponse); + } + }; + /** Returns the object with the settings used for calls to listTransitionRouteGroups. */ public PagedCallSettings< ListTransitionRouteGroupsRequest, @@ -150,10 +229,10 @@ public TransitionRouteGroupsStub createStub() throws IOException { .getTransportName() .equals(GrpcTransportChannel.getGrpcTransportName())) { return GrpcTransitionRouteGroupsStub.create(this); - } else { - throw new UnsupportedOperationException( - "Transport not supported: " + getTransportChannelProvider().getTransportName()); } + throw new UnsupportedOperationException( + String.format( + "Transport not supported: %s", getTransportChannelProvider().getTransportName())); } /** Returns a builder for the default ExecutorProvider for this service. */ @@ -223,86 +302,10 @@ protected TransitionRouteGroupsStubSettings(Builder settingsBuilder) throws IOEx settingsBuilder.deleteTransitionRouteGroupSettings().build(); } - private static final PagedListDescriptor< - ListTransitionRouteGroupsRequest, ListTransitionRouteGroupsResponse, TransitionRouteGroup> - LIST_TRANSITION_ROUTE_GROUPS_PAGE_STR_DESC = - new PagedListDescriptor< - ListTransitionRouteGroupsRequest, - ListTransitionRouteGroupsResponse, - TransitionRouteGroup>() { - @Override - public String emptyToken() { - return ""; - } - - @Override - public ListTransitionRouteGroupsRequest injectToken( - ListTransitionRouteGroupsRequest payload, String token) { - return ListTransitionRouteGroupsRequest.newBuilder(payload) - .setPageToken(token) - .build(); - } - - @Override - public ListTransitionRouteGroupsRequest injectPageSize( - ListTransitionRouteGroupsRequest payload, int pageSize) { - return ListTransitionRouteGroupsRequest.newBuilder(payload) - .setPageSize(pageSize) - .build(); - } - - @Override - public Integer extractPageSize(ListTransitionRouteGroupsRequest payload) { - return payload.getPageSize(); - } - - @Override - public String extractNextToken(ListTransitionRouteGroupsResponse payload) { - return payload.getNextPageToken(); - } - - @Override - public Iterable extractResources( - ListTransitionRouteGroupsResponse payload) { - return payload.getTransitionRouteGroupsList() != null - ? payload.getTransitionRouteGroupsList() - : ImmutableList.of(); - } - }; - - private static final PagedListResponseFactory< - ListTransitionRouteGroupsRequest, - ListTransitionRouteGroupsResponse, - ListTransitionRouteGroupsPagedResponse> - LIST_TRANSITION_ROUTE_GROUPS_PAGE_STR_FACT = - new PagedListResponseFactory< - ListTransitionRouteGroupsRequest, - ListTransitionRouteGroupsResponse, - ListTransitionRouteGroupsPagedResponse>() { - @Override - public ApiFuture getFuturePagedResponse( - UnaryCallable - callable, - ListTransitionRouteGroupsRequest request, - ApiCallContext context, - ApiFuture futureResponse) { - PageContext< - ListTransitionRouteGroupsRequest, - ListTransitionRouteGroupsResponse, - TransitionRouteGroup> - pageContext = - PageContext.create( - callable, LIST_TRANSITION_ROUTE_GROUPS_PAGE_STR_DESC, request, context); - return ListTransitionRouteGroupsPagedResponse.createAsync( - pageContext, futureResponse); - } - }; - /** Builder for TransitionRouteGroupsStubSettings. */ public static class Builder extends StubSettings.Builder { private final ImmutableList> unaryMethodSettingsBuilders; - private final PagedCallSettings.Builder< ListTransitionRouteGroupsRequest, ListTransitionRouteGroupsResponse, @@ -316,7 +319,6 @@ public static class Builder updateTransitionRouteGroupSettings; private final UnaryCallSettings.Builder deleteTransitionRouteGroupSettings; - private static final ImmutableMap> RETRYABLE_CODE_DEFINITIONS; @@ -324,14 +326,8 @@ public static class Builder ImmutableMap.Builder> definitions = ImmutableMap.builder(); definitions.put( - "retry_policy_1_codes", - ImmutableSet.copyOf(Lists.newArrayList(StatusCode.Code.UNAVAILABLE))); - definitions.put("no_retry_codes", ImmutableSet.copyOf(Lists.newArrayList())); - definitions.put( - "retry_policy_2_codes", + "retry_policy_0_codes", ImmutableSet.copyOf(Lists.newArrayList(StatusCode.Code.UNAVAILABLE))); - definitions.put( - "no_retry_1_codes", ImmutableSet.copyOf(Lists.newArrayList())); RETRYABLE_CODE_DEFINITIONS = definitions.build(); } @@ -350,33 +346,12 @@ public static class Builder .setMaxRpcTimeout(Duration.ofMillis(60000L)) .setTotalTimeout(Duration.ofMillis(60000L)) .build(); - definitions.put("retry_policy_1_params", settings); - settings = - RetrySettings.newBuilder() - .setInitialRetryDelay(Duration.ofMillis(100L)) - .setRetryDelayMultiplier(1.3) - .setMaxRetryDelay(Duration.ofMillis(60000L)) - .setInitialRpcTimeout(Duration.ofMillis(220000L)) - .setRpcTimeoutMultiplier(1.0) - .setMaxRpcTimeout(Duration.ofMillis(220000L)) - .setTotalTimeout(Duration.ofMillis(220000L)) - .build(); - definitions.put("retry_policy_2_params", settings); - settings = RetrySettings.newBuilder().setRpcTimeoutMultiplier(1.0).build(); - definitions.put("no_retry_params", settings); - settings = - RetrySettings.newBuilder() - .setInitialRpcTimeout(Duration.ofMillis(220000L)) - .setRpcTimeoutMultiplier(1.0) - .setMaxRpcTimeout(Duration.ofMillis(220000L)) - .setTotalTimeout(Duration.ofMillis(220000L)) - .build(); - definitions.put("no_retry_1_params", settings); + definitions.put("retry_policy_0_params", settings); RETRY_PARAM_DEFINITIONS = definitions.build(); } protected Builder() { - this((ClientContext) null); + this(((ClientContext) null)); } protected Builder(ClientContext clientContext) { @@ -384,13 +359,9 @@ protected Builder(ClientContext clientContext) { listTransitionRouteGroupsSettings = PagedCallSettings.newBuilder(LIST_TRANSITION_ROUTE_GROUPS_PAGE_STR_FACT); - getTransitionRouteGroupSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); - createTransitionRouteGroupSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); - updateTransitionRouteGroupSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); - deleteTransitionRouteGroupSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); unaryMethodSettingsBuilders = @@ -400,68 +371,68 @@ protected Builder(ClientContext clientContext) { createTransitionRouteGroupSettings, updateTransitionRouteGroupSettings, deleteTransitionRouteGroupSettings); - initDefaults(this); } + protected Builder(TransitionRouteGroupsStubSettings settings) { + super(settings); + + listTransitionRouteGroupsSettings = settings.listTransitionRouteGroupsSettings.toBuilder(); + getTransitionRouteGroupSettings = settings.getTransitionRouteGroupSettings.toBuilder(); + createTransitionRouteGroupSettings = settings.createTransitionRouteGroupSettings.toBuilder(); + updateTransitionRouteGroupSettings = settings.updateTransitionRouteGroupSettings.toBuilder(); + deleteTransitionRouteGroupSettings = settings.deleteTransitionRouteGroupSettings.toBuilder(); + + unaryMethodSettingsBuilders = + ImmutableList.>of( + listTransitionRouteGroupsSettings, + getTransitionRouteGroupSettings, + createTransitionRouteGroupSettings, + updateTransitionRouteGroupSettings, + deleteTransitionRouteGroupSettings); + } + private static Builder createDefault() { - Builder builder = new Builder((ClientContext) null); + Builder builder = new Builder(((ClientContext) null)); + builder.setTransportChannelProvider(defaultTransportChannelProvider()); builder.setCredentialsProvider(defaultCredentialsProviderBuilder().build()); builder.setInternalHeaderProvider(defaultApiClientHeaderProviderBuilder().build()); builder.setEndpoint(getDefaultEndpoint()); + return initDefaults(builder); } private static Builder initDefaults(Builder builder) { - builder .listTransitionRouteGroupsSettings() - .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_1_codes")) - .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_1_params")); + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params")); builder .getTransitionRouteGroupSettings() - .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_1_codes")) - .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_1_params")); + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params")); builder .createTransitionRouteGroupSettings() - .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_1_codes")) - .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_1_params")); + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params")); builder .updateTransitionRouteGroupSettings() - .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_1_codes")) - .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_1_params")); + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params")); builder .deleteTransitionRouteGroupSettings() - .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_1_codes")) - .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_1_params")); + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params")); return builder; } - protected Builder(TransitionRouteGroupsStubSettings settings) { - super(settings); - - listTransitionRouteGroupsSettings = settings.listTransitionRouteGroupsSettings.toBuilder(); - getTransitionRouteGroupSettings = settings.getTransitionRouteGroupSettings.toBuilder(); - createTransitionRouteGroupSettings = settings.createTransitionRouteGroupSettings.toBuilder(); - updateTransitionRouteGroupSettings = settings.updateTransitionRouteGroupSettings.toBuilder(); - deleteTransitionRouteGroupSettings = settings.deleteTransitionRouteGroupSettings.toBuilder(); - - unaryMethodSettingsBuilders = - ImmutableList.>of( - listTransitionRouteGroupsSettings, - getTransitionRouteGroupSettings, - createTransitionRouteGroupSettings, - updateTransitionRouteGroupSettings, - deleteTransitionRouteGroupSettings); - } - - // NEXT_MAJOR_VER: remove 'throws Exception' + // NEXT_MAJOR_VER: remove 'throws Exception'. /** * Applies the given settings updater function to all of the unary API methods in this service. * diff --git a/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3/stub/VersionsStub.java b/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3/stub/VersionsStub.java index 697bbd4c1..005936a03 100644 --- a/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3/stub/VersionsStub.java +++ b/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3/stub/VersionsStub.java @@ -5,7 +5,7 @@ * 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 + * 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, @@ -13,11 +13,11 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.google.cloud.dialogflow.cx.v3.stub; import static com.google.cloud.dialogflow.cx.v3.VersionsClient.ListVersionsPagedResponse; -import com.google.api.core.BetaApi; import com.google.api.gax.core.BackgroundResource; import com.google.api.gax.rpc.OperationCallable; import com.google.api.gax.rpc.UnaryCallable; @@ -36,17 +36,15 @@ import com.google.protobuf.Struct; import javax.annotation.Generated; -// AUTO-GENERATED DOCUMENTATION AND CLASS +// AUTO-GENERATED DOCUMENTATION AND CLASS. /** - * Base stub class for Dialogflow API. + * Base stub class for the Versions service API. * *

This class is for advanced usage and reflects the underlying API directly. */ @Generated("by gapic-generator") -@BetaApi("A restructuring of stub classes is planned, so this may break in the future") public abstract class VersionsStub implements BackgroundResource { - @BetaApi("The surface for use by generated code is not stable yet and may change in the future.") public OperationsStub getOperationsStub() { throw new UnsupportedOperationException("Not implemented: getOperationsStub()"); } @@ -63,7 +61,6 @@ public UnaryCallable getVersionCallable() { throw new UnsupportedOperationException("Not implemented: getVersionCallable()"); } - @BetaApi("The surface for use by generated code is not stable yet and may change in the future.") public OperationCallable createVersionOperationCallable() { throw new UnsupportedOperationException("Not implemented: createVersionOperationCallable()"); @@ -81,7 +78,6 @@ public UnaryCallable deleteVersionCallable() { throw new UnsupportedOperationException("Not implemented: deleteVersionCallable()"); } - @BetaApi("The surface for use by generated code is not stable yet and may change in the future.") public OperationCallable loadVersionOperationCallable() { throw new UnsupportedOperationException("Not implemented: loadVersionOperationCallable()"); } diff --git a/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3/stub/VersionsStubSettings.java b/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3/stub/VersionsStubSettings.java index 0dd151b4b..bbbc4ecc3 100644 --- a/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3/stub/VersionsStubSettings.java +++ b/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3/stub/VersionsStubSettings.java @@ -5,7 +5,7 @@ * 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 + * 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, @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.google.cloud.dialogflow.cx.v3.stub; import static com.google.cloud.dialogflow.cx.v3.VersionsClient.ListVersionsPagedResponse; @@ -64,7 +65,7 @@ import javax.annotation.Generated; import org.threeten.bp.Duration; -// AUTO-GENERATED DOCUMENTATION AND CLASS +// AUTO-GENERATED DOCUMENTATION AND CLASS. /** * Settings class to configure an instance of {@link VersionsStub}. * @@ -81,21 +82,22 @@ * *

For example, to set the total timeout of getVersion to 30 seconds: * - *

- * 
- * VersionsStubSettings.Builder versionsSettingsBuilder =
- *     VersionsStubSettings.newBuilder();
+ * 
{@code
+ * VersionsStubSettings.Builder versionsSettingsBuilder = VersionsStubSettings.newBuilder();
  * versionsSettingsBuilder
  *     .getVersionSettings()
  *     .setRetrySettings(
- *         versionsSettingsBuilder.getVersionSettings().getRetrySettings().toBuilder()
+ *         versionsSettingsBuilder
+ *             .getVersionSettings()
+ *             .getRetrySettings()
+ *             .toBuilder()
  *             .setTotalTimeout(Duration.ofSeconds(30))
  *             .build());
  * VersionsStubSettings versionsSettings = versionsSettingsBuilder.build();
- * 
- * 
+ * }
*/ -@Generated("by gapic-generator") +@BetaApi +@Generated("by gapic-generator-java") public class VersionsStubSettings extends StubSettings { /** The default scopes of the service. */ private static final ImmutableList DEFAULT_SERVICE_SCOPES = @@ -117,6 +119,59 @@ public class VersionsStubSettings extends StubSettings { private final OperationCallSettings loadVersionOperationSettings; + private static final PagedListDescriptor + LIST_VERSIONS_PAGE_STR_DESC = + new PagedListDescriptor() { + @Override + public String emptyToken() { + return ""; + } + + @Override + public ListVersionsRequest injectToken(ListVersionsRequest payload, String token) { + return ListVersionsRequest.newBuilder(payload).setPageToken(token).build(); + } + + @Override + public ListVersionsRequest injectPageSize(ListVersionsRequest payload, int pageSize) { + return ListVersionsRequest.newBuilder(payload).setPageSize(pageSize).build(); + } + + @Override + public Integer extractPageSize(ListVersionsRequest payload) { + return payload.getPageSize(); + } + + @Override + public String extractNextToken(ListVersionsResponse payload) { + return payload.getNextPageToken(); + } + + @Override + public Iterable extractResources(ListVersionsResponse payload) { + return payload.getVersionsList() == null + ? ImmutableList.of() + : payload.getVersionsList(); + } + }; + + private static final PagedListResponseFactory< + ListVersionsRequest, ListVersionsResponse, ListVersionsPagedResponse> + LIST_VERSIONS_PAGE_STR_FACT = + new PagedListResponseFactory< + ListVersionsRequest, ListVersionsResponse, ListVersionsPagedResponse>() { + @Override + public ApiFuture getFuturePagedResponse( + UnaryCallable callable, + ListVersionsRequest request, + ApiCallContext context, + ApiFuture futureResponse) { + PageContext pageContext = + PageContext.create(callable, LIST_VERSIONS_PAGE_STR_DESC, request, context); + return ListVersionsPagedResponse.createAsync(pageContext, futureResponse); + } + }; + /** Returns the object with the settings used for calls to listVersions. */ public PagedCallSettings listVersionsSettings() { @@ -134,7 +189,6 @@ public UnaryCallSettings createVersionSettings( } /** Returns the object with the settings used for calls to createVersion. */ - @BetaApi("The surface for use by generated code is not stable yet and may change in the future.") public OperationCallSettings createVersionOperationSettings() { return createVersionOperationSettings; @@ -156,7 +210,6 @@ public UnaryCallSettings loadVersionSettings() { } /** Returns the object with the settings used for calls to loadVersion. */ - @BetaApi("The surface for use by generated code is not stable yet and may change in the future.") public OperationCallSettings loadVersionOperationSettings() { return loadVersionOperationSettings; } @@ -167,10 +220,10 @@ public VersionsStub createStub() throws IOException { .getTransportName() .equals(GrpcTransportChannel.getGrpcTransportName())) { return GrpcVersionsStub.create(this); - } else { - throw new UnsupportedOperationException( - "Transport not supported: " + getTransportChannelProvider().getTransportName()); } + throw new UnsupportedOperationException( + String.format( + "Transport not supported: %s", getTransportChannelProvider().getTransportName())); } /** Returns a builder for the default ExecutorProvider for this service. */ @@ -239,63 +292,9 @@ protected VersionsStubSettings(Builder settingsBuilder) throws IOException { loadVersionOperationSettings = settingsBuilder.loadVersionOperationSettings().build(); } - private static final PagedListDescriptor - LIST_VERSIONS_PAGE_STR_DESC = - new PagedListDescriptor() { - @Override - public String emptyToken() { - return ""; - } - - @Override - public ListVersionsRequest injectToken(ListVersionsRequest payload, String token) { - return ListVersionsRequest.newBuilder(payload).setPageToken(token).build(); - } - - @Override - public ListVersionsRequest injectPageSize(ListVersionsRequest payload, int pageSize) { - return ListVersionsRequest.newBuilder(payload).setPageSize(pageSize).build(); - } - - @Override - public Integer extractPageSize(ListVersionsRequest payload) { - return payload.getPageSize(); - } - - @Override - public String extractNextToken(ListVersionsResponse payload) { - return payload.getNextPageToken(); - } - - @Override - public Iterable extractResources(ListVersionsResponse payload) { - return payload.getVersionsList() != null - ? payload.getVersionsList() - : ImmutableList.of(); - } - }; - - private static final PagedListResponseFactory< - ListVersionsRequest, ListVersionsResponse, ListVersionsPagedResponse> - LIST_VERSIONS_PAGE_STR_FACT = - new PagedListResponseFactory< - ListVersionsRequest, ListVersionsResponse, ListVersionsPagedResponse>() { - @Override - public ApiFuture getFuturePagedResponse( - UnaryCallable callable, - ListVersionsRequest request, - ApiCallContext context, - ApiFuture futureResponse) { - PageContext pageContext = - PageContext.create(callable, LIST_VERSIONS_PAGE_STR_DESC, request, context); - return ListVersionsPagedResponse.createAsync(pageContext, futureResponse); - } - }; - /** Builder for VersionsStubSettings. */ public static class Builder extends StubSettings.Builder { private final ImmutableList> unaryMethodSettingsBuilders; - private final PagedCallSettings.Builder< ListVersionsRequest, ListVersionsResponse, ListVersionsPagedResponse> listVersionsSettings; @@ -309,7 +308,6 @@ public static class Builder extends StubSettings.Builder loadVersionSettings; private final OperationCallSettings.Builder loadVersionOperationSettings; - private static final ImmutableMap> RETRYABLE_CODE_DEFINITIONS; @@ -317,14 +315,8 @@ public static class Builder extends StubSettings.Builder> definitions = ImmutableMap.builder(); definitions.put( - "retry_policy_1_codes", + "retry_policy_0_codes", ImmutableSet.copyOf(Lists.newArrayList(StatusCode.Code.UNAVAILABLE))); - definitions.put("no_retry_codes", ImmutableSet.copyOf(Lists.newArrayList())); - definitions.put( - "retry_policy_2_codes", - ImmutableSet.copyOf(Lists.newArrayList(StatusCode.Code.UNAVAILABLE))); - definitions.put( - "no_retry_1_codes", ImmutableSet.copyOf(Lists.newArrayList())); RETRYABLE_CODE_DEFINITIONS = definitions.build(); } @@ -343,52 +335,24 @@ public static class Builder extends StubSettings.Builder>of( + listVersionsSettings, + getVersionSettings, + createVersionSettings, + updateVersionSettings, + deleteVersionSettings, + loadVersionSettings); + } + private static Builder createDefault() { - Builder builder = new Builder((ClientContext) null); + Builder builder = new Builder(((ClientContext) null)); + builder.setTransportChannelProvider(defaultTransportChannelProvider()); builder.setCredentialsProvider(defaultCredentialsProviderBuilder().build()); builder.setInternalHeaderProvider(defaultApiClientHeaderProviderBuilder().build()); builder.setEndpoint(getDefaultEndpoint()); + return initDefaults(builder); } private static Builder initDefaults(Builder builder) { - builder .listVersionsSettings() - .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_1_codes")) - .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_1_params")); + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params")); builder .getVersionSettings() - .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_1_codes")) - .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_1_params")); + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params")); builder .createVersionSettings() - .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_1_codes")) - .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_1_params")); + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params")); builder .updateVersionSettings() - .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_1_codes")) - .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_1_params")); + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params")); builder .deleteVersionSettings() - .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_1_codes")) - .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_1_params")); + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params")); builder .loadVersionSettings() - .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_1_codes")) - .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_1_params")); + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params")); + builder .createVersionOperationSettings() .setInitialCallSettings( UnaryCallSettings .newUnaryCallSettingsBuilder() - .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_1_codes")) - .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_1_params")) + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params")) .build()) .setResponseTransformer( ProtoOperationTransformers.ResponseTransformer.create(Version.class)) @@ -459,20 +446,21 @@ private static Builder initDefaults(Builder builder) { .setPollingAlgorithm( OperationTimedPollAlgorithm.create( RetrySettings.newBuilder() - .setInitialRetryDelay(Duration.ofMillis(500L)) + .setInitialRetryDelay(Duration.ofMillis(5000L)) .setRetryDelayMultiplier(1.5) - .setMaxRetryDelay(Duration.ofMillis(5000L)) - .setInitialRpcTimeout(Duration.ZERO) // ignored - .setRpcTimeoutMultiplier(1.0) // ignored - .setMaxRpcTimeout(Duration.ZERO) // ignored + .setMaxRetryDelay(Duration.ofMillis(45000L)) + .setInitialRpcTimeout(Duration.ZERO) + .setRpcTimeoutMultiplier(1.0) + .setMaxRpcTimeout(Duration.ZERO) .setTotalTimeout(Duration.ofMillis(300000L)) .build())); + builder .loadVersionOperationSettings() .setInitialCallSettings( UnaryCallSettings.newUnaryCallSettingsBuilder() - .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_1_codes")) - .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_1_params")) + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params")) .build()) .setResponseTransformer( ProtoOperationTransformers.ResponseTransformer.create(Empty.class)) @@ -481,41 +469,19 @@ private static Builder initDefaults(Builder builder) { .setPollingAlgorithm( OperationTimedPollAlgorithm.create( RetrySettings.newBuilder() - .setInitialRetryDelay(Duration.ofMillis(500L)) + .setInitialRetryDelay(Duration.ofMillis(5000L)) .setRetryDelayMultiplier(1.5) - .setMaxRetryDelay(Duration.ofMillis(5000L)) - .setInitialRpcTimeout(Duration.ZERO) // ignored - .setRpcTimeoutMultiplier(1.0) // ignored - .setMaxRpcTimeout(Duration.ZERO) // ignored + .setMaxRetryDelay(Duration.ofMillis(45000L)) + .setInitialRpcTimeout(Duration.ZERO) + .setRpcTimeoutMultiplier(1.0) + .setMaxRpcTimeout(Duration.ZERO) .setTotalTimeout(Duration.ofMillis(300000L)) .build())); return builder; } - protected Builder(VersionsStubSettings settings) { - super(settings); - - listVersionsSettings = settings.listVersionsSettings.toBuilder(); - getVersionSettings = settings.getVersionSettings.toBuilder(); - createVersionSettings = settings.createVersionSettings.toBuilder(); - createVersionOperationSettings = settings.createVersionOperationSettings.toBuilder(); - updateVersionSettings = settings.updateVersionSettings.toBuilder(); - deleteVersionSettings = settings.deleteVersionSettings.toBuilder(); - loadVersionSettings = settings.loadVersionSettings.toBuilder(); - loadVersionOperationSettings = settings.loadVersionOperationSettings.toBuilder(); - - unaryMethodSettingsBuilders = - ImmutableList.>of( - listVersionsSettings, - getVersionSettings, - createVersionSettings, - updateVersionSettings, - deleteVersionSettings, - loadVersionSettings); - } - - // NEXT_MAJOR_VER: remove 'throws Exception' + // NEXT_MAJOR_VER: remove 'throws Exception'. /** * Applies the given settings updater function to all of the unary API methods in this service. * diff --git a/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3/stub/WebhooksStub.java b/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3/stub/WebhooksStub.java index 9a3e4d06e..4cac7fe04 100644 --- a/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3/stub/WebhooksStub.java +++ b/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3/stub/WebhooksStub.java @@ -5,7 +5,7 @@ * 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 + * 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, @@ -13,11 +13,11 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.google.cloud.dialogflow.cx.v3.stub; import static com.google.cloud.dialogflow.cx.v3.WebhooksClient.ListWebhooksPagedResponse; -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.cx.v3.CreateWebhookRequest; @@ -30,14 +30,13 @@ import com.google.protobuf.Empty; import javax.annotation.Generated; -// AUTO-GENERATED DOCUMENTATION AND CLASS +// AUTO-GENERATED DOCUMENTATION AND CLASS. /** - * Base stub class for Dialogflow API. + * Base stub class for the Webhooks service API. * *

This class is for advanced usage and reflects the underlying API directly. */ @Generated("by gapic-generator") -@BetaApi("A restructuring of stub classes is planned, so this may break in the future") public abstract class WebhooksStub implements BackgroundResource { public UnaryCallable listWebhooksPagedCallable() { diff --git a/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3/stub/WebhooksStubSettings.java b/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3/stub/WebhooksStubSettings.java index 33730a96e..a2c6f1661 100644 --- a/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3/stub/WebhooksStubSettings.java +++ b/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3/stub/WebhooksStubSettings.java @@ -5,7 +5,7 @@ * 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 + * 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, @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.google.cloud.dialogflow.cx.v3.stub; import static com.google.cloud.dialogflow.cx.v3.WebhooksClient.ListWebhooksPagedResponse; @@ -56,7 +57,7 @@ import javax.annotation.Generated; import org.threeten.bp.Duration; -// AUTO-GENERATED DOCUMENTATION AND CLASS +// AUTO-GENERATED DOCUMENTATION AND CLASS. /** * Settings class to configure an instance of {@link WebhooksStub}. * @@ -73,21 +74,22 @@ * *

For example, to set the total timeout of getWebhook to 30 seconds: * - *

- * 
- * WebhooksStubSettings.Builder webhooksSettingsBuilder =
- *     WebhooksStubSettings.newBuilder();
+ * 
{@code
+ * WebhooksStubSettings.Builder webhooksSettingsBuilder = WebhooksStubSettings.newBuilder();
  * webhooksSettingsBuilder
  *     .getWebhookSettings()
  *     .setRetrySettings(
- *         webhooksSettingsBuilder.getWebhookSettings().getRetrySettings().toBuilder()
+ *         webhooksSettingsBuilder
+ *             .getWebhookSettings()
+ *             .getRetrySettings()
+ *             .toBuilder()
  *             .setTotalTimeout(Duration.ofSeconds(30))
  *             .build());
  * WebhooksStubSettings webhooksSettings = webhooksSettingsBuilder.build();
- * 
- * 
+ * }
*/ -@Generated("by gapic-generator") +@BetaApi +@Generated("by gapic-generator-java") public class WebhooksStubSettings extends StubSettings { /** The default scopes of the service. */ private static final ImmutableList DEFAULT_SERVICE_SCOPES = @@ -104,6 +106,59 @@ public class WebhooksStubSettings extends StubSettings { private final UnaryCallSettings updateWebhookSettings; private final UnaryCallSettings deleteWebhookSettings; + private static final PagedListDescriptor + LIST_WEBHOOKS_PAGE_STR_DESC = + new PagedListDescriptor() { + @Override + public String emptyToken() { + return ""; + } + + @Override + public ListWebhooksRequest injectToken(ListWebhooksRequest payload, String token) { + return ListWebhooksRequest.newBuilder(payload).setPageToken(token).build(); + } + + @Override + public ListWebhooksRequest injectPageSize(ListWebhooksRequest payload, int pageSize) { + return ListWebhooksRequest.newBuilder(payload).setPageSize(pageSize).build(); + } + + @Override + public Integer extractPageSize(ListWebhooksRequest payload) { + return payload.getPageSize(); + } + + @Override + public String extractNextToken(ListWebhooksResponse payload) { + return payload.getNextPageToken(); + } + + @Override + public Iterable extractResources(ListWebhooksResponse payload) { + return payload.getWebhooksList() == null + ? ImmutableList.of() + : payload.getWebhooksList(); + } + }; + + private static final PagedListResponseFactory< + ListWebhooksRequest, ListWebhooksResponse, ListWebhooksPagedResponse> + LIST_WEBHOOKS_PAGE_STR_FACT = + new PagedListResponseFactory< + ListWebhooksRequest, ListWebhooksResponse, ListWebhooksPagedResponse>() { + @Override + public ApiFuture getFuturePagedResponse( + UnaryCallable callable, + ListWebhooksRequest request, + ApiCallContext context, + ApiFuture futureResponse) { + PageContext pageContext = + PageContext.create(callable, LIST_WEBHOOKS_PAGE_STR_DESC, request, context); + return ListWebhooksPagedResponse.createAsync(pageContext, futureResponse); + } + }; + /** Returns the object with the settings used for calls to listWebhooks. */ public PagedCallSettings listWebhooksSettings() { @@ -136,10 +191,10 @@ public WebhooksStub createStub() throws IOException { .getTransportName() .equals(GrpcTransportChannel.getGrpcTransportName())) { return GrpcWebhooksStub.create(this); - } else { - throw new UnsupportedOperationException( - "Transport not supported: " + getTransportChannelProvider().getTransportName()); } + throw new UnsupportedOperationException( + String.format( + "Transport not supported: %s", getTransportChannelProvider().getTransportName())); } /** Returns a builder for the default ExecutorProvider for this service. */ @@ -205,63 +260,9 @@ protected WebhooksStubSettings(Builder settingsBuilder) throws IOException { deleteWebhookSettings = settingsBuilder.deleteWebhookSettings().build(); } - private static final PagedListDescriptor - LIST_WEBHOOKS_PAGE_STR_DESC = - new PagedListDescriptor() { - @Override - public String emptyToken() { - return ""; - } - - @Override - public ListWebhooksRequest injectToken(ListWebhooksRequest payload, String token) { - return ListWebhooksRequest.newBuilder(payload).setPageToken(token).build(); - } - - @Override - public ListWebhooksRequest injectPageSize(ListWebhooksRequest payload, int pageSize) { - return ListWebhooksRequest.newBuilder(payload).setPageSize(pageSize).build(); - } - - @Override - public Integer extractPageSize(ListWebhooksRequest payload) { - return payload.getPageSize(); - } - - @Override - public String extractNextToken(ListWebhooksResponse payload) { - return payload.getNextPageToken(); - } - - @Override - public Iterable extractResources(ListWebhooksResponse payload) { - return payload.getWebhooksList() != null - ? payload.getWebhooksList() - : ImmutableList.of(); - } - }; - - private static final PagedListResponseFactory< - ListWebhooksRequest, ListWebhooksResponse, ListWebhooksPagedResponse> - LIST_WEBHOOKS_PAGE_STR_FACT = - new PagedListResponseFactory< - ListWebhooksRequest, ListWebhooksResponse, ListWebhooksPagedResponse>() { - @Override - public ApiFuture getFuturePagedResponse( - UnaryCallable callable, - ListWebhooksRequest request, - ApiCallContext context, - ApiFuture futureResponse) { - PageContext pageContext = - PageContext.create(callable, LIST_WEBHOOKS_PAGE_STR_DESC, request, context); - return ListWebhooksPagedResponse.createAsync(pageContext, futureResponse); - } - }; - /** Builder for WebhooksStubSettings. */ public static class Builder extends StubSettings.Builder { private final ImmutableList> unaryMethodSettingsBuilders; - private final PagedCallSettings.Builder< ListWebhooksRequest, ListWebhooksResponse, ListWebhooksPagedResponse> listWebhooksSettings; @@ -269,7 +270,6 @@ public static class Builder extends StubSettings.Builder createWebhookSettings; private final UnaryCallSettings.Builder updateWebhookSettings; private final UnaryCallSettings.Builder deleteWebhookSettings; - private static final ImmutableMap> RETRYABLE_CODE_DEFINITIONS; @@ -277,14 +277,8 @@ public static class Builder extends StubSettings.Builder> definitions = ImmutableMap.builder(); definitions.put( - "retry_policy_1_codes", + "retry_policy_0_codes", ImmutableSet.copyOf(Lists.newArrayList(StatusCode.Code.UNAVAILABLE))); - definitions.put("no_retry_codes", ImmutableSet.copyOf(Lists.newArrayList())); - definitions.put( - "retry_policy_2_codes", - ImmutableSet.copyOf(Lists.newArrayList(StatusCode.Code.UNAVAILABLE))); - definitions.put( - "no_retry_1_codes", ImmutableSet.copyOf(Lists.newArrayList())); RETRYABLE_CODE_DEFINITIONS = definitions.build(); } @@ -303,46 +297,21 @@ public static class Builder extends StubSettings.Builder>of( + listWebhooksSettings, + getWebhookSettings, + createWebhookSettings, + updateWebhookSettings, + deleteWebhookSettings); + } + private static Builder createDefault() { - Builder builder = new Builder((ClientContext) null); + Builder builder = new Builder(((ClientContext) null)); + builder.setTransportChannelProvider(defaultTransportChannelProvider()); builder.setCredentialsProvider(defaultCredentialsProviderBuilder().build()); builder.setInternalHeaderProvider(defaultApiClientHeaderProviderBuilder().build()); builder.setEndpoint(getDefaultEndpoint()); + return initDefaults(builder); } private static Builder initDefaults(Builder builder) { - builder .listWebhooksSettings() - .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_1_codes")) - .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_1_params")); + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params")); builder .getWebhookSettings() - .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_1_codes")) - .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_1_params")); + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params")); builder .createWebhookSettings() - .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_1_codes")) - .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_1_params")); + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params")); builder .updateWebhookSettings() - .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_1_codes")) - .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_1_params")); + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params")); builder .deleteWebhookSettings() - .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_1_codes")) - .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_1_params")); + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params")); return builder; } - protected Builder(WebhooksStubSettings settings) { - super(settings); - - listWebhooksSettings = settings.listWebhooksSettings.toBuilder(); - getWebhookSettings = settings.getWebhookSettings.toBuilder(); - createWebhookSettings = settings.createWebhookSettings.toBuilder(); - updateWebhookSettings = settings.updateWebhookSettings.toBuilder(); - deleteWebhookSettings = settings.deleteWebhookSettings.toBuilder(); - - unaryMethodSettingsBuilders = - ImmutableList.>of( - listWebhooksSettings, - getWebhookSettings, - createWebhookSettings, - updateWebhookSettings, - deleteWebhookSettings); - } - - // NEXT_MAJOR_VER: remove 'throws Exception' + // NEXT_MAJOR_VER: remove 'throws Exception'. /** * Applies the given settings updater function to all of the unary API methods in this service. * diff --git a/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3beta1/AgentsClient.java b/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3beta1/AgentsClient.java index fc0a047d1..41c7c8ebc 100644 --- a/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3beta1/AgentsClient.java +++ b/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3beta1/AgentsClient.java @@ -5,7 +5,7 @@ * 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 + * 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, @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.google.cloud.dialogflow.cx.v3beta1; import com.google.api.core.ApiFunction; @@ -40,23 +41,14 @@ import java.util.concurrent.TimeUnit; import javax.annotation.Generated; -// AUTO-GENERATED DOCUMENTATION AND SERVICE +// AUTO-GENERATED DOCUMENTATION AND CLASS. /** * Service Description: Service for managing [Agents][google.cloud.dialogflow.cx.v3beta1.Agent]. * *

This class provides the ability to make remote calls to the backing service through method * calls that map to API methods. Sample code to get started: * - *

- * 
- * try (AgentsClient agentsClient = AgentsClient.create()) {
- *   AgentName name = AgentName.of("[PROJECT]", "[LOCATION]", "[AGENT]");
- *   Agent response = agentsClient.getAgent(name);
- * }
- * 
- * 
- * - *

Note: close() needs to be called on the agentsClient object to clean up resources such as + *

Note: close() needs to be called on the AgentsClient object to clean up resources such as * threads. In the example above, try-with-resources is used, which automatically calls close(). * *

The surface of this class includes several types of Java methods for each of the API's @@ -84,30 +76,25 @@ * *

To customize credentials: * - *

- * 
+ * 
{@code
  * AgentsSettings agentsSettings =
  *     AgentsSettings.newBuilder()
  *         .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
  *         .build();
- * AgentsClient agentsClient =
- *     AgentsClient.create(agentsSettings);
- * 
- * 
+ * AgentsClient agentsClient = AgentsClient.create(agentsSettings); + * }
* - * To customize the endpoint: + *

To customize the endpoint: * - *

- * 
- * AgentsSettings agentsSettings =
- *     AgentsSettings.newBuilder().setEndpoint(myEndpoint).build();
- * AgentsClient agentsClient =
- *     AgentsClient.create(agentsSettings);
- * 
- * 
+ *
{@code
+ * AgentsSettings agentsSettings = AgentsSettings.newBuilder().setEndpoint(myEndpoint).build();
+ * AgentsClient agentsClient = AgentsClient.create(agentsSettings);
+ * }
+ * + *

Please refer to the GitHub repository's samples for more quickstart code snippets. */ -@Generated("by gapic-generator") @BetaApi +@Generated("by gapic-generator") public class AgentsClient implements BackgroundResource { private final AgentsSettings settings; private final AgentsStub stub; @@ -128,7 +115,7 @@ public static final AgentsClient create(AgentsSettings settings) throws IOExcept /** * Constructs an instance of AgentsClient, using the given stub for making calls. This is for - * advanced usage - prefer to use AgentsSettings}. + * advanced usage - prefer using create(AgentsSettings). */ @BetaApi("A restructuring of stub classes is planned, so this may break in the future") public static final AgentsClient create(AgentsStub stub) { @@ -165,27 +152,14 @@ public AgentsStub getStub() { * Returns the OperationsClient that can be used to query the status of a long-running operation * returned by another API method call. */ - @BetaApi( - "The surface for long-running operations is not stable yet and may change in the future.") public final OperationsClient getOperationsClient() { return operationsClient; } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Returns the list of all agents in the specified location. * - *

Sample code: - * - *


-   * try (AgentsClient agentsClient = AgentsClient.create()) {
-   *   LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
-   *   for (Agent element : agentsClient.listAgents(parent).iterateAll()) {
-   *     // doThingsWith(element);
-   *   }
-   * }
-   * 
- * * @param parent Required. The location to list all agents for. Format: `projects/<Project * ID>/locations/<Location ID>`. * @throws com.google.api.gax.rpc.ApiException if the remote call fails @@ -196,21 +170,10 @@ public final ListAgentsPagedResponse listAgents(LocationName parent) { return listAgents(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Returns the list of all agents in the specified location. * - *

Sample code: - * - *


-   * try (AgentsClient agentsClient = AgentsClient.create()) {
-   *   LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
-   *   for (Agent element : agentsClient.listAgents(parent.toString()).iterateAll()) {
-   *     // doThingsWith(element);
-   *   }
-   * }
-   * 
- * * @param parent Required. The location to list all agents for. Format: `projects/<Project * ID>/locations/<Location ID>`. * @throws com.google.api.gax.rpc.ApiException if the remote call fails @@ -220,24 +183,10 @@ public final ListAgentsPagedResponse listAgents(String parent) { return listAgents(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Returns the list of all agents in the specified location. * - *

Sample code: - * - *


-   * try (AgentsClient agentsClient = AgentsClient.create()) {
-   *   LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
-   *   ListAgentsRequest request = ListAgentsRequest.newBuilder()
-   *     .setParent(parent.toString())
-   *     .build();
-   *   for (Agent element : agentsClient.listAgents(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 */ @@ -245,74 +194,30 @@ public final ListAgentsPagedResponse listAgents(ListAgentsRequest request) { return listAgentsPagedCallable().call(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Returns the list of all agents in the specified location. * *

Sample code: - * - *


-   * try (AgentsClient agentsClient = AgentsClient.create()) {
-   *   LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
-   *   ListAgentsRequest request = ListAgentsRequest.newBuilder()
-   *     .setParent(parent.toString())
-   *     .build();
-   *   ApiFuture<ListAgentsPagedResponse> future = agentsClient.listAgentsPagedCallable().futureCall(request);
-   *   // Do something
-   *   for (Agent element : future.get().iterateAll()) {
-   *     // doThingsWith(element);
-   *   }
-   * }
-   * 
*/ public final UnaryCallable listAgentsPagedCallable() { return stub.listAgentsPagedCallable(); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Returns the list of all agents in the specified location. * *

Sample code: - * - *


-   * try (AgentsClient agentsClient = AgentsClient.create()) {
-   *   LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
-   *   ListAgentsRequest request = ListAgentsRequest.newBuilder()
-   *     .setParent(parent.toString())
-   *     .build();
-   *   while (true) {
-   *     ListAgentsResponse response = agentsClient.listAgentsCallable().call(request);
-   *     for (Agent element : response.getAgentsList()) {
-   *       // doThingsWith(element);
-   *     }
-   *     String nextPageToken = response.getNextPageToken();
-   *     if (!Strings.isNullOrEmpty(nextPageToken)) {
-   *       request = request.toBuilder().setPageToken(nextPageToken).build();
-   *     } else {
-   *       break;
-   *     }
-   *   }
-   * }
-   * 
*/ public final UnaryCallable listAgentsCallable() { return stub.listAgentsCallable(); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Retrieves the specified agent. * - *

Sample code: - * - *


-   * try (AgentsClient agentsClient = AgentsClient.create()) {
-   *   AgentName name = AgentName.of("[PROJECT]", "[LOCATION]", "[AGENT]");
-   *   Agent response = agentsClient.getAgent(name);
-   * }
-   * 
- * * @param name Required. The name of the agent. Format: `projects/<Project * ID>/locations/<Location ID>/agents/<Agent ID>`. * @throws com.google.api.gax.rpc.ApiException if the remote call fails @@ -323,19 +228,10 @@ public final Agent getAgent(AgentName name) { return getAgent(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Retrieves the specified agent. * - *

Sample code: - * - *


-   * try (AgentsClient agentsClient = AgentsClient.create()) {
-   *   AgentName name = AgentName.of("[PROJECT]", "[LOCATION]", "[AGENT]");
-   *   Agent response = agentsClient.getAgent(name.toString());
-   * }
-   * 
- * * @param name Required. The name of the agent. Format: `projects/<Project * ID>/locations/<Location ID>/agents/<Agent ID>`. * @throws com.google.api.gax.rpc.ApiException if the remote call fails @@ -345,22 +241,10 @@ public final Agent getAgent(String name) { return getAgent(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Retrieves the specified agent. * - *

Sample code: - * - *


-   * try (AgentsClient agentsClient = AgentsClient.create()) {
-   *   AgentName name = AgentName.of("[PROJECT]", "[LOCATION]", "[AGENT]");
-   *   GetAgentRequest request = GetAgentRequest.newBuilder()
-   *     .setName(name.toString())
-   *     .build();
-   *   Agent response = agentsClient.getAgent(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 */ @@ -368,42 +252,20 @@ public final Agent getAgent(GetAgentRequest request) { return getAgentCallable().call(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Retrieves the specified agent. * *

Sample code: - * - *


-   * try (AgentsClient agentsClient = AgentsClient.create()) {
-   *   AgentName name = AgentName.of("[PROJECT]", "[LOCATION]", "[AGENT]");
-   *   GetAgentRequest request = GetAgentRequest.newBuilder()
-   *     .setName(name.toString())
-   *     .build();
-   *   ApiFuture<Agent> future = agentsClient.getAgentCallable().futureCall(request);
-   *   // Do something
-   *   Agent response = future.get();
-   * }
-   * 
*/ public final UnaryCallable getAgentCallable() { return stub.getAgentCallable(); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Creates an agent in the specified location. * - *

Sample code: - * - *


-   * try (AgentsClient agentsClient = AgentsClient.create()) {
-   *   LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
-   *   Agent agent = Agent.newBuilder().build();
-   *   Agent response = agentsClient.createAgent(parent, agent);
-   * }
-   * 
- * * @param parent Required. The location to create a agent for. Format: `projects/<Project * ID>/locations/<Location ID>`. * @param agent Required. The agent to create. @@ -418,20 +280,10 @@ public final Agent createAgent(LocationName parent, Agent agent) { return createAgent(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Creates an agent in the specified location. * - *

Sample code: - * - *


-   * try (AgentsClient agentsClient = AgentsClient.create()) {
-   *   LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
-   *   Agent agent = Agent.newBuilder().build();
-   *   Agent response = agentsClient.createAgent(parent.toString(), agent);
-   * }
-   * 
- * * @param parent Required. The location to create a agent for. Format: `projects/<Project * ID>/locations/<Location ID>`. * @param agent Required. The agent to create. @@ -443,24 +295,10 @@ public final Agent createAgent(String parent, Agent agent) { return createAgent(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Creates an agent in the specified location. * - *

Sample code: - * - *


-   * try (AgentsClient agentsClient = AgentsClient.create()) {
-   *   LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
-   *   Agent agent = Agent.newBuilder().build();
-   *   CreateAgentRequest request = CreateAgentRequest.newBuilder()
-   *     .setParent(parent.toString())
-   *     .setAgent(agent)
-   *     .build();
-   *   Agent response = agentsClient.createAgent(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 */ @@ -468,44 +306,20 @@ public final Agent createAgent(CreateAgentRequest request) { return createAgentCallable().call(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Creates an agent in the specified location. * *

Sample code: - * - *


-   * try (AgentsClient agentsClient = AgentsClient.create()) {
-   *   LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
-   *   Agent agent = Agent.newBuilder().build();
-   *   CreateAgentRequest request = CreateAgentRequest.newBuilder()
-   *     .setParent(parent.toString())
-   *     .setAgent(agent)
-   *     .build();
-   *   ApiFuture<Agent> future = agentsClient.createAgentCallable().futureCall(request);
-   *   // Do something
-   *   Agent response = future.get();
-   * }
-   * 
*/ public final UnaryCallable createAgentCallable() { return stub.createAgentCallable(); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Updates the specified agent. * - *

Sample code: - * - *


-   * try (AgentsClient agentsClient = AgentsClient.create()) {
-   *   Agent agent = Agent.newBuilder().build();
-   *   FieldMask updateMask = FieldMask.newBuilder().build();
-   *   Agent response = agentsClient.updateAgent(agent, updateMask);
-   * }
-   * 
- * * @param agent Required. The agent to update. * @param updateMask The mask to control which fields get updated. If the mask is not present, all * fields will be updated. @@ -517,22 +331,10 @@ public final Agent updateAgent(Agent agent, FieldMask updateMask) { return updateAgent(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Updates the specified agent. * - *

Sample code: - * - *


-   * try (AgentsClient agentsClient = AgentsClient.create()) {
-   *   Agent agent = Agent.newBuilder().build();
-   *   UpdateAgentRequest request = UpdateAgentRequest.newBuilder()
-   *     .setAgent(agent)
-   *     .build();
-   *   Agent response = agentsClient.updateAgent(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 */ @@ -540,41 +342,20 @@ public final Agent updateAgent(UpdateAgentRequest request) { return updateAgentCallable().call(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Updates the specified agent. * *

Sample code: - * - *


-   * try (AgentsClient agentsClient = AgentsClient.create()) {
-   *   Agent agent = Agent.newBuilder().build();
-   *   UpdateAgentRequest request = UpdateAgentRequest.newBuilder()
-   *     .setAgent(agent)
-   *     .build();
-   *   ApiFuture<Agent> future = agentsClient.updateAgentCallable().futureCall(request);
-   *   // Do something
-   *   Agent response = future.get();
-   * }
-   * 
*/ public final UnaryCallable updateAgentCallable() { return stub.updateAgentCallable(); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Deletes the specified agent. * - *

Sample code: - * - *


-   * try (AgentsClient agentsClient = AgentsClient.create()) {
-   *   AgentName name = AgentName.of("[PROJECT]", "[LOCATION]", "[AGENT]");
-   *   agentsClient.deleteAgent(name);
-   * }
-   * 
- * * @param name Required. The name of the agent to delete. Format: `projects/<Project * ID>/locations/<Location ID>/agents/<Agent ID>`. * @throws com.google.api.gax.rpc.ApiException if the remote call fails @@ -585,19 +366,10 @@ public final void deleteAgent(AgentName name) { deleteAgent(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Deletes the specified agent. * - *

Sample code: - * - *


-   * try (AgentsClient agentsClient = AgentsClient.create()) {
-   *   AgentName name = AgentName.of("[PROJECT]", "[LOCATION]", "[AGENT]");
-   *   agentsClient.deleteAgent(name.toString());
-   * }
-   * 
- * * @param name Required. The name of the agent to delete. Format: `projects/<Project * ID>/locations/<Location ID>/agents/<Agent ID>`. * @throws com.google.api.gax.rpc.ApiException if the remote call fails @@ -607,22 +379,10 @@ public final void deleteAgent(String name) { deleteAgent(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Deletes the specified agent. * - *

Sample code: - * - *


-   * try (AgentsClient agentsClient = AgentsClient.create()) {
-   *   AgentName name = AgentName.of("[PROJECT]", "[LOCATION]", "[AGENT]");
-   *   DeleteAgentRequest request = DeleteAgentRequest.newBuilder()
-   *     .setName(name.toString())
-   *     .build();
-   *   agentsClient.deleteAgent(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 */ @@ -630,129 +390,64 @@ public final void deleteAgent(DeleteAgentRequest request) { deleteAgentCallable().call(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Deletes the specified agent. * *

Sample code: - * - *


-   * try (AgentsClient agentsClient = AgentsClient.create()) {
-   *   AgentName name = AgentName.of("[PROJECT]", "[LOCATION]", "[AGENT]");
-   *   DeleteAgentRequest request = DeleteAgentRequest.newBuilder()
-   *     .setName(name.toString())
-   *     .build();
-   *   ApiFuture<Void> future = agentsClient.deleteAgentCallable().futureCall(request);
-   *   // Do something
-   *   future.get();
-   * }
-   * 
*/ public final UnaryCallable deleteAgentCallable() { return stub.deleteAgentCallable(); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Exports the specified agent to a binary file. * - *

Sample code: - * - *


-   * try (AgentsClient agentsClient = AgentsClient.create()) {
-   *   AgentName name = AgentName.of("[PROJECT]", "[LOCATION]", "[AGENT]");
-   *   ExportAgentRequest request = ExportAgentRequest.newBuilder()
-   *     .setName(name.toString())
-   *     .build();
-   *   ExportAgentResponse response = agentsClient.exportAgentAsync(request).get();
-   * }
-   * 
- * * @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 */ - @BetaApi( - "The surface for long-running operations is not stable yet and may change in the future.") public final OperationFuture exportAgentAsync( ExportAgentRequest request) { return exportAgentOperationCallable().futureCall(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Exports the specified agent to a binary file. * *

Sample code: - * - *


-   * try (AgentsClient agentsClient = AgentsClient.create()) {
-   *   AgentName name = AgentName.of("[PROJECT]", "[LOCATION]", "[AGENT]");
-   *   ExportAgentRequest request = ExportAgentRequest.newBuilder()
-   *     .setName(name.toString())
-   *     .build();
-   *   OperationFuture<ExportAgentResponse, Struct> future = agentsClient.exportAgentOperationCallable().futureCall(request);
-   *   // Do something
-   *   ExportAgentResponse response = future.get();
-   * }
-   * 
*/ - @BetaApi("The surface for use by generated code is not stable yet and may change in the future.") public final OperationCallable exportAgentOperationCallable() { return stub.exportAgentOperationCallable(); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Exports the specified agent to a binary file. * *

Sample code: - * - *


-   * try (AgentsClient agentsClient = AgentsClient.create()) {
-   *   AgentName name = AgentName.of("[PROJECT]", "[LOCATION]", "[AGENT]");
-   *   ExportAgentRequest request = ExportAgentRequest.newBuilder()
-   *     .setName(name.toString())
-   *     .build();
-   *   ApiFuture<Operation> future = agentsClient.exportAgentCallable().futureCall(request);
-   *   // Do something
-   *   Operation response = future.get();
-   * }
-   * 
*/ public final UnaryCallable exportAgentCallable() { return stub.exportAgentCallable(); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Restores the specified agent from a binary file. * *

Replaces the current agent with a new one. Note that all existing resources in agent (e.g. * intents, entity types, flows) will be removed. * - *

Sample code: - * - *


-   * try (AgentsClient agentsClient = AgentsClient.create()) {
-   *   AgentName name = AgentName.of("[PROJECT]", "[LOCATION]", "[AGENT]");
-   *   RestoreAgentRequest request = RestoreAgentRequest.newBuilder()
-   *     .setName(name.toString())
-   *     .build();
-   *   agentsClient.restoreAgentAsync(request).get();
-   * }
-   * 
- * * @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 */ - @BetaApi( - "The surface for long-running operations is not stable yet and may change in the future.") public final OperationFuture restoreAgentAsync(RestoreAgentRequest request) { return restoreAgentOperationCallable().futureCall(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Restores the specified agent from a binary file. * @@ -760,26 +455,13 @@ public final OperationFuture restoreAgentAsync(RestoreAgentReques * intents, entity types, flows) will be removed. * *

Sample code: - * - *


-   * try (AgentsClient agentsClient = AgentsClient.create()) {
-   *   AgentName name = AgentName.of("[PROJECT]", "[LOCATION]", "[AGENT]");
-   *   RestoreAgentRequest request = RestoreAgentRequest.newBuilder()
-   *     .setName(name.toString())
-   *     .build();
-   *   OperationFuture<Empty, Struct> future = agentsClient.restoreAgentOperationCallable().futureCall(request);
-   *   // Do something
-   *   future.get();
-   * }
-   * 
*/ - @BetaApi("The surface for use by generated code is not stable yet and may change in the future.") public final OperationCallable restoreAgentOperationCallable() { return stub.restoreAgentOperationCallable(); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Restores the specified agent from a binary file. * @@ -787,18 +469,6 @@ public final OperationFuture restoreAgentAsync(RestoreAgentReques * intents, entity types, flows) will be removed. * *

Sample code: - * - *


-   * try (AgentsClient agentsClient = AgentsClient.create()) {
-   *   AgentName name = AgentName.of("[PROJECT]", "[LOCATION]", "[AGENT]");
-   *   RestoreAgentRequest request = RestoreAgentRequest.newBuilder()
-   *     .setName(name.toString())
-   *     .build();
-   *   ApiFuture<Operation> future = agentsClient.restoreAgentCallable().futureCall(request);
-   *   // Do something
-   *   future.get();
-   * }
-   * 
*/ public final UnaryCallable restoreAgentCallable() { return stub.restoreAgentCallable(); diff --git a/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3beta1/AgentsSettings.java b/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3beta1/AgentsSettings.java index 5659d6fcf..81b55b3fd 100644 --- a/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3beta1/AgentsSettings.java +++ b/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3beta1/AgentsSettings.java @@ -5,7 +5,7 @@ * 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 + * 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, @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.google.cloud.dialogflow.cx.v3beta1; import static com.google.cloud.dialogflow.cx.v3beta1.AgentsClient.ListAgentsPagedResponse; @@ -37,7 +38,7 @@ import java.util.List; import javax.annotation.Generated; -// AUTO-GENERATED DOCUMENTATION AND CLASS +// AUTO-GENERATED DOCUMENTATION AND CLASS. /** * Settings class to configure an instance of {@link AgentsClient}. * @@ -54,23 +55,23 @@ * *

For example, to set the total timeout of getAgent to 30 seconds: * - *

- * 
- * AgentsSettings.Builder agentsSettingsBuilder =
- *     AgentsSettings.newBuilder();
+ * 
{@code
+ * AgentsSettings.Builder agentsSettingsBuilder = AgentsSettings.newBuilder();
  * agentsSettingsBuilder
  *     .getAgentSettings()
  *     .setRetrySettings(
- *         agentsSettingsBuilder.getAgentSettings().getRetrySettings().toBuilder()
+ *         agentsSettingsBuilder
+ *             .getAgentSettings()
+ *             .getRetrySettings()
+ *             .toBuilder()
  *             .setTotalTimeout(Duration.ofSeconds(30))
  *             .build());
  * AgentsSettings agentsSettings = agentsSettingsBuilder.build();
- * 
- * 
+ * }
*/ -@Generated("by gapic-generator") -@BetaApi +@Generated("by gapic-generator-java") public class AgentsSettings extends ClientSettings { + /** Returns the object with the settings used for calls to listAgents. */ public PagedCallSettings listAgentsSettings() { @@ -103,8 +104,6 @@ public UnaryCallSettings exportAgentSettings() { } /** Returns the object with the settings used for calls to exportAgent. */ - @BetaApi( - "The surface for long-running operations is not stable yet and may change in the future.") public OperationCallSettings exportAgentOperationSettings() { return ((AgentsStubSettings) getStubSettings()).exportAgentOperationSettings(); @@ -116,8 +115,6 @@ public UnaryCallSettings restoreAgentSettings() } /** Returns the object with the settings used for calls to restoreAgent. */ - @BetaApi( - "The surface for long-running operations is not stable yet and may change in the future.") public OperationCallSettings restoreAgentOperationSettings() { return ((AgentsStubSettings) getStubSettings()).restoreAgentOperationSettings(); } @@ -181,18 +178,15 @@ protected AgentsSettings(Builder settingsBuilder) throws IOException { /** Builder for AgentsSettings. */ public static class Builder extends ClientSettings.Builder { + protected Builder() throws IOException { - this((ClientContext) null); + this(((ClientContext) null)); } protected Builder(ClientContext clientContext) { super(AgentsStubSettings.newBuilder(clientContext)); } - private static Builder createDefault() { - return new Builder(AgentsStubSettings.newBuilder()); - } - protected Builder(AgentsSettings settings) { super(settings.getStubSettings().toBuilder()); } @@ -201,11 +195,15 @@ protected Builder(AgentsStubSettings.Builder stubSettings) { super(stubSettings); } + private static Builder createDefault() { + return new Builder(AgentsStubSettings.newBuilder()); + } + public AgentsStubSettings.Builder getStubSettingsBuilder() { return ((AgentsStubSettings.Builder) getStubSettings()); } - // NEXT_MAJOR_VER: remove 'throws Exception' + // NEXT_MAJOR_VER: remove 'throws Exception'. /** * Applies the given settings updater function to all of the unary API methods in this service. * @@ -250,8 +248,6 @@ public UnaryCallSettings.Builder exportAgentSetti } /** Returns the builder for the settings used for calls to exportAgent. */ - @BetaApi( - "The surface for long-running operations is not stable yet and may change in the future.") public OperationCallSettings.Builder exportAgentOperationSettings() { return getStubSettingsBuilder().exportAgentOperationSettings(); @@ -263,8 +259,6 @@ public UnaryCallSettings.Builder restoreAgentSet } /** Returns the builder for the settings used for calls to restoreAgent. */ - @BetaApi( - "The surface for long-running operations is not stable yet and may change in the future.") public OperationCallSettings.Builder restoreAgentOperationSettings() { return getStubSettingsBuilder().restoreAgentOperationSettings(); diff --git a/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3beta1/EntityTypesClient.java b/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3beta1/EntityTypesClient.java index b52e299fd..621a86e16 100644 --- a/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3beta1/EntityTypesClient.java +++ b/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3beta1/EntityTypesClient.java @@ -5,7 +5,7 @@ * 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 + * 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, @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.google.cloud.dialogflow.cx.v3beta1; import com.google.api.core.ApiFunction; @@ -35,7 +36,7 @@ import java.util.concurrent.TimeUnit; import javax.annotation.Generated; -// AUTO-GENERATED DOCUMENTATION AND SERVICE +// AUTO-GENERATED DOCUMENTATION AND CLASS. /** * Service Description: Service for managing * [EntityTypes][google.cloud.dialogflow.cx.v3beta1.EntityType]. @@ -43,16 +44,7 @@ *

This class provides the ability to make remote calls to the backing service through method * calls that map to API methods. Sample code to get started: * - *

- * 
- * try (EntityTypesClient entityTypesClient = EntityTypesClient.create()) {
- *   EntityTypeName name = EntityTypeName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[ENTITY_TYPE]");
- *   EntityType response = entityTypesClient.getEntityType(name);
- * }
- * 
- * 
- * - *

Note: close() needs to be called on the entityTypesClient object to clean up resources such as + *

Note: close() needs to be called on the EntityTypesClient object to clean up resources such as * threads. In the example above, try-with-resources is used, which automatically calls close(). * *

The surface of this class includes several types of Java methods for each of the API's @@ -80,30 +72,26 @@ * *

To customize credentials: * - *

- * 
+ * 
{@code
  * EntityTypesSettings entityTypesSettings =
  *     EntityTypesSettings.newBuilder()
  *         .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
  *         .build();
- * EntityTypesClient entityTypesClient =
- *     EntityTypesClient.create(entityTypesSettings);
- * 
- * 
+ * EntityTypesClient entityTypesClient = EntityTypesClient.create(entityTypesSettings); + * }
* - * To customize the endpoint: + *

To customize the endpoint: * - *

- * 
+ * 
{@code
  * EntityTypesSettings entityTypesSettings =
  *     EntityTypesSettings.newBuilder().setEndpoint(myEndpoint).build();
- * EntityTypesClient entityTypesClient =
- *     EntityTypesClient.create(entityTypesSettings);
- * 
- * 
+ * EntityTypesClient entityTypesClient = EntityTypesClient.create(entityTypesSettings); + * }
+ * + *

Please refer to the GitHub repository's samples for more quickstart code snippets. */ -@Generated("by gapic-generator") @BetaApi +@Generated("by gapic-generator") public class EntityTypesClient implements BackgroundResource { private final EntityTypesSettings settings; private final EntityTypesStub stub; @@ -123,7 +111,7 @@ public static final EntityTypesClient create(EntityTypesSettings settings) throw /** * Constructs an instance of EntityTypesClient, using the given stub for making calls. This is for - * advanced usage - prefer to use EntityTypesSettings}. + * advanced usage - prefer using create(EntityTypesSettings). */ @BetaApi("A restructuring of stub classes is planned, so this may break in the future") public static final EntityTypesClient create(EntityTypesStub stub) { @@ -155,21 +143,10 @@ public EntityTypesStub getStub() { return stub; } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Returns the list of all entity types in the specified agent. * - *

Sample code: - * - *


-   * try (EntityTypesClient entityTypesClient = EntityTypesClient.create()) {
-   *   AgentName parent = AgentName.of("[PROJECT]", "[LOCATION]", "[AGENT]");
-   *   for (EntityType element : entityTypesClient.listEntityTypes(parent).iterateAll()) {
-   *     // doThingsWith(element);
-   *   }
-   * }
-   * 
- * * @param parent Required. The agent to list all entity types for. Format: `projects/<Project * ID>/locations/<Location ID>/agents/<Agent ID>`. * @throws com.google.api.gax.rpc.ApiException if the remote call fails @@ -182,21 +159,10 @@ public final ListEntityTypesPagedResponse listEntityTypes(AgentName parent) { return listEntityTypes(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Returns the list of all entity types in the specified agent. * - *

Sample code: - * - *


-   * try (EntityTypesClient entityTypesClient = EntityTypesClient.create()) {
-   *   AgentName parent = AgentName.of("[PROJECT]", "[LOCATION]", "[AGENT]");
-   *   for (EntityType element : entityTypesClient.listEntityTypes(parent.toString()).iterateAll()) {
-   *     // doThingsWith(element);
-   *   }
-   * }
-   * 
- * * @param parent Required. The agent to list all entity types for. Format: `projects/<Project * ID>/locations/<Location ID>/agents/<Agent ID>`. * @throws com.google.api.gax.rpc.ApiException if the remote call fails @@ -206,24 +172,10 @@ public final ListEntityTypesPagedResponse listEntityTypes(String parent) { return listEntityTypes(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Returns the list of all entity types in the specified agent. * - *

Sample code: - * - *


-   * try (EntityTypesClient entityTypesClient = EntityTypesClient.create()) {
-   *   AgentName parent = AgentName.of("[PROJECT]", "[LOCATION]", "[AGENT]");
-   *   ListEntityTypesRequest request = ListEntityTypesRequest.newBuilder()
-   *     .setParent(parent.toString())
-   *     .build();
-   *   for (EntityType element : entityTypesClient.listEntityTypes(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 */ @@ -231,76 +183,32 @@ public final ListEntityTypesPagedResponse listEntityTypes(ListEntityTypesRequest return listEntityTypesPagedCallable().call(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Returns the list of all entity types in the specified agent. * *

Sample code: - * - *


-   * try (EntityTypesClient entityTypesClient = EntityTypesClient.create()) {
-   *   AgentName parent = AgentName.of("[PROJECT]", "[LOCATION]", "[AGENT]");
-   *   ListEntityTypesRequest request = ListEntityTypesRequest.newBuilder()
-   *     .setParent(parent.toString())
-   *     .build();
-   *   ApiFuture<ListEntityTypesPagedResponse> future = entityTypesClient.listEntityTypesPagedCallable().futureCall(request);
-   *   // Do something
-   *   for (EntityType element : future.get().iterateAll()) {
-   *     // doThingsWith(element);
-   *   }
-   * }
-   * 
*/ public final UnaryCallable listEntityTypesPagedCallable() { return stub.listEntityTypesPagedCallable(); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Returns the list of all entity types in the specified agent. * *

Sample code: - * - *


-   * try (EntityTypesClient entityTypesClient = EntityTypesClient.create()) {
-   *   AgentName parent = AgentName.of("[PROJECT]", "[LOCATION]", "[AGENT]");
-   *   ListEntityTypesRequest request = ListEntityTypesRequest.newBuilder()
-   *     .setParent(parent.toString())
-   *     .build();
-   *   while (true) {
-   *     ListEntityTypesResponse response = entityTypesClient.listEntityTypesCallable().call(request);
-   *     for (EntityType element : response.getEntityTypesList()) {
-   *       // doThingsWith(element);
-   *     }
-   *     String nextPageToken = response.getNextPageToken();
-   *     if (!Strings.isNullOrEmpty(nextPageToken)) {
-   *       request = request.toBuilder().setPageToken(nextPageToken).build();
-   *     } else {
-   *       break;
-   *     }
-   *   }
-   * }
-   * 
*/ public final UnaryCallable listEntityTypesCallable() { return stub.listEntityTypesCallable(); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Retrieves the specified entity type. * - *

Sample code: - * - *


-   * try (EntityTypesClient entityTypesClient = EntityTypesClient.create()) {
-   *   EntityTypeName name = EntityTypeName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[ENTITY_TYPE]");
-   *   EntityType response = entityTypesClient.getEntityType(name);
-   * }
-   * 
- * * @param name Required. The name of the entity type. Format: `projects/<Project * ID>/locations/<Location ID>/agents/<Agent ID>/entityTypes/<Entity Type * ID>`. @@ -312,19 +220,10 @@ public final EntityType getEntityType(EntityTypeName name) { return getEntityType(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Retrieves the specified entity type. * - *

Sample code: - * - *


-   * try (EntityTypesClient entityTypesClient = EntityTypesClient.create()) {
-   *   EntityTypeName name = EntityTypeName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[ENTITY_TYPE]");
-   *   EntityType response = entityTypesClient.getEntityType(name.toString());
-   * }
-   * 
- * * @param name Required. The name of the entity type. Format: `projects/<Project * ID>/locations/<Location ID>/agents/<Agent ID>/entityTypes/<Entity Type * ID>`. @@ -335,22 +234,10 @@ public final EntityType getEntityType(String name) { return getEntityType(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Retrieves the specified entity type. * - *

Sample code: - * - *


-   * try (EntityTypesClient entityTypesClient = EntityTypesClient.create()) {
-   *   EntityTypeName name = EntityTypeName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[ENTITY_TYPE]");
-   *   GetEntityTypeRequest request = GetEntityTypeRequest.newBuilder()
-   *     .setName(name.toString())
-   *     .build();
-   *   EntityType response = entityTypesClient.getEntityType(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 */ @@ -358,42 +245,20 @@ public final EntityType getEntityType(GetEntityTypeRequest request) { return getEntityTypeCallable().call(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Retrieves the specified entity type. * *

Sample code: - * - *


-   * try (EntityTypesClient entityTypesClient = EntityTypesClient.create()) {
-   *   EntityTypeName name = EntityTypeName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[ENTITY_TYPE]");
-   *   GetEntityTypeRequest request = GetEntityTypeRequest.newBuilder()
-   *     .setName(name.toString())
-   *     .build();
-   *   ApiFuture<EntityType> future = entityTypesClient.getEntityTypeCallable().futureCall(request);
-   *   // Do something
-   *   EntityType response = future.get();
-   * }
-   * 
*/ public final UnaryCallable getEntityTypeCallable() { return stub.getEntityTypeCallable(); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Creates an entity type in the specified agent. * - *

Sample code: - * - *


-   * try (EntityTypesClient entityTypesClient = EntityTypesClient.create()) {
-   *   AgentName parent = AgentName.of("[PROJECT]", "[LOCATION]", "[AGENT]");
-   *   EntityType entityType = EntityType.newBuilder().build();
-   *   EntityType response = entityTypesClient.createEntityType(parent, entityType);
-   * }
-   * 
- * * @param parent Required. The agent to create a entity type for. Format: `projects/<Project * ID>/locations/<Location ID>/agents/<Agent ID>`. * @param entityType Required. The entity type to create. @@ -408,20 +273,10 @@ public final EntityType createEntityType(AgentName parent, EntityType entityType return createEntityType(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Creates an entity type in the specified agent. * - *

Sample code: - * - *


-   * try (EntityTypesClient entityTypesClient = EntityTypesClient.create()) {
-   *   AgentName parent = AgentName.of("[PROJECT]", "[LOCATION]", "[AGENT]");
-   *   EntityType entityType = EntityType.newBuilder().build();
-   *   EntityType response = entityTypesClient.createEntityType(parent.toString(), entityType);
-   * }
-   * 
- * * @param parent Required. The agent to create a entity type for. Format: `projects/<Project * ID>/locations/<Location ID>/agents/<Agent ID>`. * @param entityType Required. The entity type to create. @@ -433,24 +288,10 @@ public final EntityType createEntityType(String parent, EntityType entityType) { return createEntityType(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Creates an entity type in the specified agent. * - *

Sample code: - * - *


-   * try (EntityTypesClient entityTypesClient = EntityTypesClient.create()) {
-   *   AgentName parent = AgentName.of("[PROJECT]", "[LOCATION]", "[AGENT]");
-   *   EntityType entityType = EntityType.newBuilder().build();
-   *   CreateEntityTypeRequest request = CreateEntityTypeRequest.newBuilder()
-   *     .setParent(parent.toString())
-   *     .setEntityType(entityType)
-   *     .build();
-   *   EntityType response = entityTypesClient.createEntityType(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 */ @@ -458,44 +299,20 @@ public final EntityType createEntityType(CreateEntityTypeRequest request) { return createEntityTypeCallable().call(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Creates an entity type in the specified agent. * *

Sample code: - * - *


-   * try (EntityTypesClient entityTypesClient = EntityTypesClient.create()) {
-   *   AgentName parent = AgentName.of("[PROJECT]", "[LOCATION]", "[AGENT]");
-   *   EntityType entityType = EntityType.newBuilder().build();
-   *   CreateEntityTypeRequest request = CreateEntityTypeRequest.newBuilder()
-   *     .setParent(parent.toString())
-   *     .setEntityType(entityType)
-   *     .build();
-   *   ApiFuture<EntityType> future = entityTypesClient.createEntityTypeCallable().futureCall(request);
-   *   // Do something
-   *   EntityType response = future.get();
-   * }
-   * 
*/ public final UnaryCallable createEntityTypeCallable() { return stub.createEntityTypeCallable(); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Updates the specified entity type. * - *

Sample code: - * - *


-   * try (EntityTypesClient entityTypesClient = EntityTypesClient.create()) {
-   *   EntityType entityType = EntityType.newBuilder().build();
-   *   FieldMask updateMask = FieldMask.newBuilder().build();
-   *   EntityType response = entityTypesClient.updateEntityType(entityType, updateMask);
-   * }
-   * 
- * * @param entityType Required. The entity type to update. * @param updateMask The mask to control which fields get updated. * @throws com.google.api.gax.rpc.ApiException if the remote call fails @@ -509,22 +326,10 @@ public final EntityType updateEntityType(EntityType entityType, FieldMask update return updateEntityType(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Updates the specified entity type. * - *

Sample code: - * - *


-   * try (EntityTypesClient entityTypesClient = EntityTypesClient.create()) {
-   *   EntityType entityType = EntityType.newBuilder().build();
-   *   UpdateEntityTypeRequest request = UpdateEntityTypeRequest.newBuilder()
-   *     .setEntityType(entityType)
-   *     .build();
-   *   EntityType response = entityTypesClient.updateEntityType(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 */ @@ -532,41 +337,20 @@ public final EntityType updateEntityType(UpdateEntityTypeRequest request) { return updateEntityTypeCallable().call(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Updates the specified entity type. * *

Sample code: - * - *


-   * try (EntityTypesClient entityTypesClient = EntityTypesClient.create()) {
-   *   EntityType entityType = EntityType.newBuilder().build();
-   *   UpdateEntityTypeRequest request = UpdateEntityTypeRequest.newBuilder()
-   *     .setEntityType(entityType)
-   *     .build();
-   *   ApiFuture<EntityType> future = entityTypesClient.updateEntityTypeCallable().futureCall(request);
-   *   // Do something
-   *   EntityType response = future.get();
-   * }
-   * 
*/ public final UnaryCallable updateEntityTypeCallable() { return stub.updateEntityTypeCallable(); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Deletes the specified entity type. * - *

Sample code: - * - *


-   * try (EntityTypesClient entityTypesClient = EntityTypesClient.create()) {
-   *   EntityTypeName name = EntityTypeName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[ENTITY_TYPE]");
-   *   entityTypesClient.deleteEntityType(name);
-   * }
-   * 
- * * @param name Required. The name of the entity type to delete. Format: `projects/<Project * ID>/locations/<Location ID>/agents/<Agent ID>/entityTypes/<Entity Type * ID>`. @@ -578,19 +362,10 @@ public final void deleteEntityType(EntityTypeName name) { deleteEntityType(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Deletes the specified entity type. * - *

Sample code: - * - *


-   * try (EntityTypesClient entityTypesClient = EntityTypesClient.create()) {
-   *   EntityTypeName name = EntityTypeName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[ENTITY_TYPE]");
-   *   entityTypesClient.deleteEntityType(name.toString());
-   * }
-   * 
- * * @param name Required. The name of the entity type to delete. Format: `projects/<Project * ID>/locations/<Location ID>/agents/<Agent ID>/entityTypes/<Entity Type * ID>`. @@ -601,22 +376,10 @@ public final void deleteEntityType(String name) { deleteEntityType(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Deletes the specified entity type. * - *

Sample code: - * - *


-   * try (EntityTypesClient entityTypesClient = EntityTypesClient.create()) {
-   *   EntityTypeName name = EntityTypeName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[ENTITY_TYPE]");
-   *   DeleteEntityTypeRequest request = DeleteEntityTypeRequest.newBuilder()
-   *     .setName(name.toString())
-   *     .build();
-   *   entityTypesClient.deleteEntityType(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 */ @@ -624,23 +387,11 @@ public final void deleteEntityType(DeleteEntityTypeRequest request) { deleteEntityTypeCallable().call(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Deletes the specified entity type. * *

Sample code: - * - *


-   * try (EntityTypesClient entityTypesClient = EntityTypesClient.create()) {
-   *   EntityTypeName name = EntityTypeName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[ENTITY_TYPE]");
-   *   DeleteEntityTypeRequest request = DeleteEntityTypeRequest.newBuilder()
-   *     .setName(name.toString())
-   *     .build();
-   *   ApiFuture<Void> future = entityTypesClient.deleteEntityTypeCallable().futureCall(request);
-   *   // Do something
-   *   future.get();
-   * }
-   * 
*/ public final UnaryCallable deleteEntityTypeCallable() { return stub.deleteEntityTypeCallable(); diff --git a/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3beta1/EntityTypesSettings.java b/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3beta1/EntityTypesSettings.java index 08ef354c6..878cafedc 100644 --- a/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3beta1/EntityTypesSettings.java +++ b/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3beta1/EntityTypesSettings.java @@ -5,7 +5,7 @@ * 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 + * 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, @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.google.cloud.dialogflow.cx.v3beta1; import static com.google.cloud.dialogflow.cx.v3beta1.EntityTypesClient.ListEntityTypesPagedResponse; @@ -34,7 +35,7 @@ import java.util.List; import javax.annotation.Generated; -// AUTO-GENERATED DOCUMENTATION AND CLASS +// AUTO-GENERATED DOCUMENTATION AND CLASS. /** * Settings class to configure an instance of {@link EntityTypesClient}. * @@ -51,23 +52,23 @@ * *

For example, to set the total timeout of getEntityType to 30 seconds: * - *

- * 
- * EntityTypesSettings.Builder entityTypesSettingsBuilder =
- *     EntityTypesSettings.newBuilder();
+ * 
{@code
+ * EntityTypesSettings.Builder entityTypesSettingsBuilder = EntityTypesSettings.newBuilder();
  * entityTypesSettingsBuilder
  *     .getEntityTypeSettings()
  *     .setRetrySettings(
- *         entityTypesSettingsBuilder.getEntityTypeSettings().getRetrySettings().toBuilder()
+ *         entityTypesSettingsBuilder
+ *             .getEntityTypeSettings()
+ *             .getRetrySettings()
+ *             .toBuilder()
  *             .setTotalTimeout(Duration.ofSeconds(30))
  *             .build());
  * EntityTypesSettings entityTypesSettings = entityTypesSettingsBuilder.build();
- * 
- * 
+ * }
*/ -@Generated("by gapic-generator") -@BetaApi +@Generated("by gapic-generator-java") public class EntityTypesSettings extends ClientSettings { + /** Returns the object with the settings used for calls to listEntityTypes. */ public PagedCallSettings< ListEntityTypesRequest, ListEntityTypesResponse, ListEntityTypesPagedResponse> @@ -154,18 +155,15 @@ protected EntityTypesSettings(Builder settingsBuilder) throws IOException { /** Builder for EntityTypesSettings. */ public static class Builder extends ClientSettings.Builder { + protected Builder() throws IOException { - this((ClientContext) null); + this(((ClientContext) null)); } protected Builder(ClientContext clientContext) { super(EntityTypesStubSettings.newBuilder(clientContext)); } - private static Builder createDefault() { - return new Builder(EntityTypesStubSettings.newBuilder()); - } - protected Builder(EntityTypesSettings settings) { super(settings.getStubSettings().toBuilder()); } @@ -174,11 +172,15 @@ protected Builder(EntityTypesStubSettings.Builder stubSettings) { super(stubSettings); } + private static Builder createDefault() { + return new Builder(EntityTypesStubSettings.newBuilder()); + } + public EntityTypesStubSettings.Builder getStubSettingsBuilder() { return ((EntityTypesStubSettings.Builder) getStubSettings()); } - // NEXT_MAJOR_VER: remove 'throws Exception' + // NEXT_MAJOR_VER: remove 'throws Exception'. /** * Applies the given settings updater function to all of the unary API methods in this service. * diff --git a/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3beta1/EnvironmentsClient.java b/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3beta1/EnvironmentsClient.java index c6fec5e31..4e698d3f6 100644 --- a/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3beta1/EnvironmentsClient.java +++ b/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3beta1/EnvironmentsClient.java @@ -5,7 +5,7 @@ * 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 + * 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, @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.google.cloud.dialogflow.cx.v3beta1; import com.google.api.core.ApiFunction; @@ -40,7 +41,7 @@ import java.util.concurrent.TimeUnit; import javax.annotation.Generated; -// AUTO-GENERATED DOCUMENTATION AND SERVICE +// AUTO-GENERATED DOCUMENTATION AND CLASS. /** * Service Description: Service for managing * [Environments][google.cloud.dialogflow.cx.v3beta1.Environment]. @@ -48,16 +49,7 @@ *

This class provides the ability to make remote calls to the backing service through method * calls that map to API methods. Sample code to get started: * - *

- * 
- * try (EnvironmentsClient environmentsClient = EnvironmentsClient.create()) {
- *   EnvironmentName name = EnvironmentName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[ENVIRONMENT]");
- *   Environment response = environmentsClient.getEnvironment(name);
- * }
- * 
- * 
- * - *

Note: close() needs to be called on the environmentsClient object to clean up resources such + *

Note: close() needs to be called on the EnvironmentsClient object to clean up resources such * as threads. In the example above, try-with-resources is used, which automatically calls close(). * *

The surface of this class includes several types of Java methods for each of the API's @@ -85,30 +77,26 @@ * *

To customize credentials: * - *

- * 
+ * 
{@code
  * EnvironmentsSettings environmentsSettings =
  *     EnvironmentsSettings.newBuilder()
  *         .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
  *         .build();
- * EnvironmentsClient environmentsClient =
- *     EnvironmentsClient.create(environmentsSettings);
- * 
- * 
+ * EnvironmentsClient environmentsClient = EnvironmentsClient.create(environmentsSettings); + * }
* - * To customize the endpoint: + *

To customize the endpoint: * - *

- * 
+ * 
{@code
  * EnvironmentsSettings environmentsSettings =
  *     EnvironmentsSettings.newBuilder().setEndpoint(myEndpoint).build();
- * EnvironmentsClient environmentsClient =
- *     EnvironmentsClient.create(environmentsSettings);
- * 
- * 
+ * EnvironmentsClient environmentsClient = EnvironmentsClient.create(environmentsSettings); + * }
+ * + *

Please refer to the GitHub repository's samples for more quickstart code snippets. */ -@Generated("by gapic-generator") @BetaApi +@Generated("by gapic-generator") public class EnvironmentsClient implements BackgroundResource { private final EnvironmentsSettings settings; private final EnvironmentsStub stub; @@ -129,7 +117,7 @@ public static final EnvironmentsClient create(EnvironmentsSettings settings) thr /** * Constructs an instance of EnvironmentsClient, using the given stub for making calls. This is - * for advanced usage - prefer to use EnvironmentsSettings}. + * for advanced usage - prefer using create(EnvironmentsSettings). */ @BetaApi("A restructuring of stub classes is planned, so this may break in the future") public static final EnvironmentsClient create(EnvironmentsStub stub) { @@ -167,28 +155,15 @@ public EnvironmentsStub getStub() { * Returns the OperationsClient that can be used to query the status of a long-running operation * returned by another API method call. */ - @BetaApi( - "The surface for long-running operations is not stable yet and may change in the future.") public final OperationsClient getOperationsClient() { return operationsClient; } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Returns the list of all environments in the specified * [Agent][google.cloud.dialogflow.cx.v3beta1.Agent]. * - *

Sample code: - * - *


-   * try (EnvironmentsClient environmentsClient = EnvironmentsClient.create()) {
-   *   AgentName parent = AgentName.of("[PROJECT]", "[LOCATION]", "[AGENT]");
-   *   for (Environment element : environmentsClient.listEnvironments(parent).iterateAll()) {
-   *     // doThingsWith(element);
-   *   }
-   * }
-   * 
- * * @param parent Required. The [Agent][google.cloud.dialogflow.cx.v3beta1.Agent] to list all * environments for. Format: `projects/<Project ID>/locations/<Location * ID>/agents/<Agent ID>`. @@ -202,22 +177,11 @@ public final ListEnvironmentsPagedResponse listEnvironments(AgentName parent) { return listEnvironments(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Returns the list of all environments in the specified * [Agent][google.cloud.dialogflow.cx.v3beta1.Agent]. * - *

Sample code: - * - *


-   * try (EnvironmentsClient environmentsClient = EnvironmentsClient.create()) {
-   *   AgentName parent = AgentName.of("[PROJECT]", "[LOCATION]", "[AGENT]");
-   *   for (Environment element : environmentsClient.listEnvironments(parent.toString()).iterateAll()) {
-   *     // doThingsWith(element);
-   *   }
-   * }
-   * 
- * * @param parent Required. The [Agent][google.cloud.dialogflow.cx.v3beta1.Agent] to list all * environments for. Format: `projects/<Project ID>/locations/<Location * ID>/agents/<Agent ID>`. @@ -229,25 +193,11 @@ public final ListEnvironmentsPagedResponse listEnvironments(String parent) { return listEnvironments(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Returns the list of all environments in the specified * [Agent][google.cloud.dialogflow.cx.v3beta1.Agent]. * - *

Sample code: - * - *


-   * try (EnvironmentsClient environmentsClient = EnvironmentsClient.create()) {
-   *   AgentName parent = AgentName.of("[PROJECT]", "[LOCATION]", "[AGENT]");
-   *   ListEnvironmentsRequest request = ListEnvironmentsRequest.newBuilder()
-   *     .setParent(parent.toString())
-   *     .build();
-   *   for (Environment element : environmentsClient.listEnvironments(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 */ @@ -255,78 +205,34 @@ public final ListEnvironmentsPagedResponse listEnvironments(ListEnvironmentsRequ return listEnvironmentsPagedCallable().call(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Returns the list of all environments in the specified * [Agent][google.cloud.dialogflow.cx.v3beta1.Agent]. * *

Sample code: - * - *


-   * try (EnvironmentsClient environmentsClient = EnvironmentsClient.create()) {
-   *   AgentName parent = AgentName.of("[PROJECT]", "[LOCATION]", "[AGENT]");
-   *   ListEnvironmentsRequest request = ListEnvironmentsRequest.newBuilder()
-   *     .setParent(parent.toString())
-   *     .build();
-   *   ApiFuture<ListEnvironmentsPagedResponse> future = environmentsClient.listEnvironmentsPagedCallable().futureCall(request);
-   *   // Do something
-   *   for (Environment element : future.get().iterateAll()) {
-   *     // doThingsWith(element);
-   *   }
-   * }
-   * 
*/ public final UnaryCallable listEnvironmentsPagedCallable() { return stub.listEnvironmentsPagedCallable(); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Returns the list of all environments in the specified * [Agent][google.cloud.dialogflow.cx.v3beta1.Agent]. * *

Sample code: - * - *


-   * try (EnvironmentsClient environmentsClient = EnvironmentsClient.create()) {
-   *   AgentName parent = AgentName.of("[PROJECT]", "[LOCATION]", "[AGENT]");
-   *   ListEnvironmentsRequest request = ListEnvironmentsRequest.newBuilder()
-   *     .setParent(parent.toString())
-   *     .build();
-   *   while (true) {
-   *     ListEnvironmentsResponse response = environmentsClient.listEnvironmentsCallable().call(request);
-   *     for (Environment element : response.getEnvironmentsList()) {
-   *       // doThingsWith(element);
-   *     }
-   *     String nextPageToken = response.getNextPageToken();
-   *     if (!Strings.isNullOrEmpty(nextPageToken)) {
-   *       request = request.toBuilder().setPageToken(nextPageToken).build();
-   *     } else {
-   *       break;
-   *     }
-   *   }
-   * }
-   * 
*/ public final UnaryCallable listEnvironmentsCallable() { return stub.listEnvironmentsCallable(); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Retrieves the specified [Environment][google.cloud.dialogflow.cx.v3beta1.Environment]. * - *

Sample code: - * - *


-   * try (EnvironmentsClient environmentsClient = EnvironmentsClient.create()) {
-   *   EnvironmentName name = EnvironmentName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[ENVIRONMENT]");
-   *   Environment response = environmentsClient.getEnvironment(name);
-   * }
-   * 
- * * @param name Required. The name of the * [Environment][google.cloud.dialogflow.cx.v3beta1.Environment]. Format: * `projects/<Project ID>/locations/<Location ID>/agents/<Agent @@ -339,19 +245,10 @@ public final Environment getEnvironment(EnvironmentName name) { return getEnvironment(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Retrieves the specified [Environment][google.cloud.dialogflow.cx.v3beta1.Environment]. * - *

Sample code: - * - *


-   * try (EnvironmentsClient environmentsClient = EnvironmentsClient.create()) {
-   *   EnvironmentName name = EnvironmentName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[ENVIRONMENT]");
-   *   Environment response = environmentsClient.getEnvironment(name.toString());
-   * }
-   * 
- * * @param name Required. The name of the * [Environment][google.cloud.dialogflow.cx.v3beta1.Environment]. Format: * `projects/<Project ID>/locations/<Location ID>/agents/<Agent @@ -363,22 +260,10 @@ public final Environment getEnvironment(String name) { return getEnvironment(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Retrieves the specified [Environment][google.cloud.dialogflow.cx.v3beta1.Environment]. * - *

Sample code: - * - *


-   * try (EnvironmentsClient environmentsClient = EnvironmentsClient.create()) {
-   *   EnvironmentName name = EnvironmentName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[ENVIRONMENT]");
-   *   GetEnvironmentRequest request = GetEnvironmentRequest.newBuilder()
-   *     .setName(name.toString())
-   *     .build();
-   *   Environment response = environmentsClient.getEnvironment(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 */ @@ -386,51 +271,27 @@ public final Environment getEnvironment(GetEnvironmentRequest request) { return getEnvironmentCallable().call(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Retrieves the specified [Environment][google.cloud.dialogflow.cx.v3beta1.Environment]. * *

Sample code: - * - *


-   * try (EnvironmentsClient environmentsClient = EnvironmentsClient.create()) {
-   *   EnvironmentName name = EnvironmentName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[ENVIRONMENT]");
-   *   GetEnvironmentRequest request = GetEnvironmentRequest.newBuilder()
-   *     .setName(name.toString())
-   *     .build();
-   *   ApiFuture<Environment> future = environmentsClient.getEnvironmentCallable().futureCall(request);
-   *   // Do something
-   *   Environment response = future.get();
-   * }
-   * 
*/ public final UnaryCallable getEnvironmentCallable() { return stub.getEnvironmentCallable(); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Creates an [Environment][google.cloud.dialogflow.cx.v3beta1.Environment] in the specified * [Agent][google.cloud.dialogflow.cx.v3beta1.Agent]. * - *

Sample code: - * - *


-   * try (EnvironmentsClient environmentsClient = EnvironmentsClient.create()) {
-   *   AgentName parent = AgentName.of("[PROJECT]", "[LOCATION]", "[AGENT]");
-   *   Environment environment = Environment.newBuilder().build();
-   *   Environment response = environmentsClient.createEnvironmentAsync(parent, environment).get();
-   * }
-   * 
- * * @param parent Required. The [Agent][google.cloud.dialogflow.cx.v3beta1.Agent] to create an * [Environment][google.cloud.dialogflow.cx.v3beta1.Environment] for. Format: * `projects/<Project ID>/locations/<Location ID>/agents/<Agent ID>`. * @param environment Required. The environment to create. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ - @BetaApi( - "The surface for long-running operations is not stable yet and may change in the future.") public final OperationFuture createEnvironmentAsync( AgentName parent, Environment environment) { CreateEnvironmentRequest request = @@ -441,29 +302,17 @@ public final OperationFuture createEnvironmentAsync( return createEnvironmentAsync(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Creates an [Environment][google.cloud.dialogflow.cx.v3beta1.Environment] in the specified * [Agent][google.cloud.dialogflow.cx.v3beta1.Agent]. * - *

Sample code: - * - *


-   * try (EnvironmentsClient environmentsClient = EnvironmentsClient.create()) {
-   *   AgentName parent = AgentName.of("[PROJECT]", "[LOCATION]", "[AGENT]");
-   *   Environment environment = Environment.newBuilder().build();
-   *   Environment response = environmentsClient.createEnvironmentAsync(parent.toString(), environment).get();
-   * }
-   * 
- * * @param parent Required. The [Agent][google.cloud.dialogflow.cx.v3beta1.Agent] to create an * [Environment][google.cloud.dialogflow.cx.v3beta1.Environment] for. Format: * `projects/<Project ID>/locations/<Location ID>/agents/<Agent ID>`. * @param environment Required. The environment to create. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ - @BetaApi( - "The surface for long-running operations is not stable yet and may change in the future.") public final OperationFuture createEnvironmentAsync( String parent, Environment environment) { CreateEnvironmentRequest request = @@ -471,107 +320,50 @@ public final OperationFuture createEnvironmentAsync( return createEnvironmentAsync(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Creates an [Environment][google.cloud.dialogflow.cx.v3beta1.Environment] in the specified * [Agent][google.cloud.dialogflow.cx.v3beta1.Agent]. * - *

Sample code: - * - *


-   * try (EnvironmentsClient environmentsClient = EnvironmentsClient.create()) {
-   *   AgentName parent = AgentName.of("[PROJECT]", "[LOCATION]", "[AGENT]");
-   *   Environment environment = Environment.newBuilder().build();
-   *   CreateEnvironmentRequest request = CreateEnvironmentRequest.newBuilder()
-   *     .setParent(parent.toString())
-   *     .setEnvironment(environment)
-   *     .build();
-   *   Environment response = environmentsClient.createEnvironmentAsync(request).get();
-   * }
-   * 
- * * @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 */ - @BetaApi( - "The surface for long-running operations is not stable yet and may change in the future.") public final OperationFuture createEnvironmentAsync( CreateEnvironmentRequest request) { return createEnvironmentOperationCallable().futureCall(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Creates an [Environment][google.cloud.dialogflow.cx.v3beta1.Environment] in the specified * [Agent][google.cloud.dialogflow.cx.v3beta1.Agent]. * *

Sample code: - * - *


-   * try (EnvironmentsClient environmentsClient = EnvironmentsClient.create()) {
-   *   AgentName parent = AgentName.of("[PROJECT]", "[LOCATION]", "[AGENT]");
-   *   Environment environment = Environment.newBuilder().build();
-   *   CreateEnvironmentRequest request = CreateEnvironmentRequest.newBuilder()
-   *     .setParent(parent.toString())
-   *     .setEnvironment(environment)
-   *     .build();
-   *   OperationFuture<Environment, Struct> future = environmentsClient.createEnvironmentOperationCallable().futureCall(request);
-   *   // Do something
-   *   Environment response = future.get();
-   * }
-   * 
*/ - @BetaApi("The surface for use by generated code is not stable yet and may change in the future.") public final OperationCallable createEnvironmentOperationCallable() { return stub.createEnvironmentOperationCallable(); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Creates an [Environment][google.cloud.dialogflow.cx.v3beta1.Environment] in the specified * [Agent][google.cloud.dialogflow.cx.v3beta1.Agent]. * *

Sample code: - * - *


-   * try (EnvironmentsClient environmentsClient = EnvironmentsClient.create()) {
-   *   AgentName parent = AgentName.of("[PROJECT]", "[LOCATION]", "[AGENT]");
-   *   Environment environment = Environment.newBuilder().build();
-   *   CreateEnvironmentRequest request = CreateEnvironmentRequest.newBuilder()
-   *     .setParent(parent.toString())
-   *     .setEnvironment(environment)
-   *     .build();
-   *   ApiFuture<Operation> future = environmentsClient.createEnvironmentCallable().futureCall(request);
-   *   // Do something
-   *   Operation response = future.get();
-   * }
-   * 
*/ public final UnaryCallable createEnvironmentCallable() { return stub.createEnvironmentCallable(); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Updates the specified [Environment][google.cloud.dialogflow.cx.v3beta1.Environment]. * - *

Sample code: - * - *


-   * try (EnvironmentsClient environmentsClient = EnvironmentsClient.create()) {
-   *   Environment environment = Environment.newBuilder().build();
-   *   FieldMask updateMask = FieldMask.newBuilder().build();
-   *   Environment response = environmentsClient.updateEnvironmentAsync(environment, updateMask).get();
-   * }
-   * 
- * * @param environment Required. The environment to update. * @param updateMask Required. The mask to control which fields get updated. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ - @BetaApi( - "The surface for long-running operations is not stable yet and may change in the future.") public final OperationFuture updateEnvironmentAsync( Environment environment, FieldMask updateMask) { UpdateEnvironmentRequest request = @@ -582,97 +374,43 @@ public final OperationFuture updateEnvironmentAsync( return updateEnvironmentAsync(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Updates the specified [Environment][google.cloud.dialogflow.cx.v3beta1.Environment]. * - *

Sample code: - * - *


-   * try (EnvironmentsClient environmentsClient = EnvironmentsClient.create()) {
-   *   Environment environment = Environment.newBuilder().build();
-   *   FieldMask updateMask = FieldMask.newBuilder().build();
-   *   UpdateEnvironmentRequest request = UpdateEnvironmentRequest.newBuilder()
-   *     .setEnvironment(environment)
-   *     .setUpdateMask(updateMask)
-   *     .build();
-   *   Environment response = environmentsClient.updateEnvironmentAsync(request).get();
-   * }
-   * 
- * * @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 */ - @BetaApi( - "The surface for long-running operations is not stable yet and may change in the future.") public final OperationFuture updateEnvironmentAsync( UpdateEnvironmentRequest request) { return updateEnvironmentOperationCallable().futureCall(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Updates the specified [Environment][google.cloud.dialogflow.cx.v3beta1.Environment]. * *

Sample code: - * - *


-   * try (EnvironmentsClient environmentsClient = EnvironmentsClient.create()) {
-   *   Environment environment = Environment.newBuilder().build();
-   *   FieldMask updateMask = FieldMask.newBuilder().build();
-   *   UpdateEnvironmentRequest request = UpdateEnvironmentRequest.newBuilder()
-   *     .setEnvironment(environment)
-   *     .setUpdateMask(updateMask)
-   *     .build();
-   *   OperationFuture<Environment, Struct> future = environmentsClient.updateEnvironmentOperationCallable().futureCall(request);
-   *   // Do something
-   *   Environment response = future.get();
-   * }
-   * 
*/ - @BetaApi("The surface for use by generated code is not stable yet and may change in the future.") public final OperationCallable updateEnvironmentOperationCallable() { return stub.updateEnvironmentOperationCallable(); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Updates the specified [Environment][google.cloud.dialogflow.cx.v3beta1.Environment]. * *

Sample code: - * - *


-   * try (EnvironmentsClient environmentsClient = EnvironmentsClient.create()) {
-   *   Environment environment = Environment.newBuilder().build();
-   *   FieldMask updateMask = FieldMask.newBuilder().build();
-   *   UpdateEnvironmentRequest request = UpdateEnvironmentRequest.newBuilder()
-   *     .setEnvironment(environment)
-   *     .setUpdateMask(updateMask)
-   *     .build();
-   *   ApiFuture<Operation> future = environmentsClient.updateEnvironmentCallable().futureCall(request);
-   *   // Do something
-   *   Operation response = future.get();
-   * }
-   * 
*/ public final UnaryCallable updateEnvironmentCallable() { return stub.updateEnvironmentCallable(); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Deletes the specified [Environment][google.cloud.dialogflow.cx.v3beta1.Environment]. * - *

Sample code: - * - *


-   * try (EnvironmentsClient environmentsClient = EnvironmentsClient.create()) {
-   *   EnvironmentName name = EnvironmentName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[ENVIRONMENT]");
-   *   environmentsClient.deleteEnvironment(name);
-   * }
-   * 
- * * @param name Required. The name of the * [Environment][google.cloud.dialogflow.cx.v3beta1.Environment] to delete. Format: * `projects/<Project ID>/locations/<Location ID>/agents/<Agent @@ -687,19 +425,10 @@ public final void deleteEnvironment(EnvironmentName name) { deleteEnvironment(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Deletes the specified [Environment][google.cloud.dialogflow.cx.v3beta1.Environment]. * - *

Sample code: - * - *


-   * try (EnvironmentsClient environmentsClient = EnvironmentsClient.create()) {
-   *   EnvironmentName name = EnvironmentName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[ENVIRONMENT]");
-   *   environmentsClient.deleteEnvironment(name.toString());
-   * }
-   * 
- * * @param name Required. The name of the * [Environment][google.cloud.dialogflow.cx.v3beta1.Environment] to delete. Format: * `projects/<Project ID>/locations/<Location ID>/agents/<Agent @@ -711,22 +440,10 @@ public final void deleteEnvironment(String name) { deleteEnvironment(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Deletes the specified [Environment][google.cloud.dialogflow.cx.v3beta1.Environment]. * - *

Sample code: - * - *


-   * try (EnvironmentsClient environmentsClient = EnvironmentsClient.create()) {
-   *   EnvironmentName name = EnvironmentName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[ENVIRONMENT]");
-   *   DeleteEnvironmentRequest request = DeleteEnvironmentRequest.newBuilder()
-   *     .setName(name.toString())
-   *     .build();
-   *   environmentsClient.deleteEnvironment(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 */ @@ -734,44 +451,21 @@ public final void deleteEnvironment(DeleteEnvironmentRequest request) { deleteEnvironmentCallable().call(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Deletes the specified [Environment][google.cloud.dialogflow.cx.v3beta1.Environment]. * *

Sample code: - * - *


-   * try (EnvironmentsClient environmentsClient = EnvironmentsClient.create()) {
-   *   EnvironmentName name = EnvironmentName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[ENVIRONMENT]");
-   *   DeleteEnvironmentRequest request = DeleteEnvironmentRequest.newBuilder()
-   *     .setName(name.toString())
-   *     .build();
-   *   ApiFuture<Void> future = environmentsClient.deleteEnvironmentCallable().futureCall(request);
-   *   // Do something
-   *   future.get();
-   * }
-   * 
*/ public final UnaryCallable deleteEnvironmentCallable() { return stub.deleteEnvironmentCallable(); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Looks up the history of the specified * [Environment][google.cloud.dialogflow.cx.v3beta1.Environment]. * - *

Sample code: - * - *


-   * try (EnvironmentsClient environmentsClient = EnvironmentsClient.create()) {
-   *   EnvironmentName name = EnvironmentName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[ENVIRONMENT]");
-   *   for (Environment element : environmentsClient.lookupEnvironmentHistory(name).iterateAll()) {
-   *     // doThingsWith(element);
-   *   }
-   * }
-   * 
- * * @param name Required. Resource name of the environment to look up the history for. Format: * `projects/<Project ID>/locations/<Location ID>/agents/<Agent * ID>/environments/<Environment ID>`. @@ -786,22 +480,11 @@ public final LookupEnvironmentHistoryPagedResponse lookupEnvironmentHistory( return lookupEnvironmentHistory(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Looks up the history of the specified * [Environment][google.cloud.dialogflow.cx.v3beta1.Environment]. * - *

Sample code: - * - *


-   * try (EnvironmentsClient environmentsClient = EnvironmentsClient.create()) {
-   *   EnvironmentName name = EnvironmentName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[ENVIRONMENT]");
-   *   for (Environment element : environmentsClient.lookupEnvironmentHistory(name.toString()).iterateAll()) {
-   *     // doThingsWith(element);
-   *   }
-   * }
-   * 
- * * @param name Required. Resource name of the environment to look up the history for. Format: * `projects/<Project ID>/locations/<Location ID>/agents/<Agent * ID>/environments/<Environment ID>`. @@ -813,25 +496,11 @@ public final LookupEnvironmentHistoryPagedResponse lookupEnvironmentHistory(Stri return lookupEnvironmentHistory(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Looks up the history of the specified * [Environment][google.cloud.dialogflow.cx.v3beta1.Environment]. * - *

Sample code: - * - *


-   * try (EnvironmentsClient environmentsClient = EnvironmentsClient.create()) {
-   *   EnvironmentName name = EnvironmentName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[ENVIRONMENT]");
-   *   LookupEnvironmentHistoryRequest request = LookupEnvironmentHistoryRequest.newBuilder()
-   *     .setName(name.toString())
-   *     .build();
-   *   for (Environment element : environmentsClient.lookupEnvironmentHistory(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 */ @@ -840,59 +509,24 @@ public final LookupEnvironmentHistoryPagedResponse lookupEnvironmentHistory( return lookupEnvironmentHistoryPagedCallable().call(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Looks up the history of the specified * [Environment][google.cloud.dialogflow.cx.v3beta1.Environment]. * *

Sample code: - * - *


-   * try (EnvironmentsClient environmentsClient = EnvironmentsClient.create()) {
-   *   EnvironmentName name = EnvironmentName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[ENVIRONMENT]");
-   *   LookupEnvironmentHistoryRequest request = LookupEnvironmentHistoryRequest.newBuilder()
-   *     .setName(name.toString())
-   *     .build();
-   *   ApiFuture<LookupEnvironmentHistoryPagedResponse> future = environmentsClient.lookupEnvironmentHistoryPagedCallable().futureCall(request);
-   *   // Do something
-   *   for (Environment element : future.get().iterateAll()) {
-   *     // doThingsWith(element);
-   *   }
-   * }
-   * 
*/ public final UnaryCallable lookupEnvironmentHistoryPagedCallable() { return stub.lookupEnvironmentHistoryPagedCallable(); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Looks up the history of the specified * [Environment][google.cloud.dialogflow.cx.v3beta1.Environment]. * *

Sample code: - * - *


-   * try (EnvironmentsClient environmentsClient = EnvironmentsClient.create()) {
-   *   EnvironmentName name = EnvironmentName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[ENVIRONMENT]");
-   *   LookupEnvironmentHistoryRequest request = LookupEnvironmentHistoryRequest.newBuilder()
-   *     .setName(name.toString())
-   *     .build();
-   *   while (true) {
-   *     LookupEnvironmentHistoryResponse response = environmentsClient.lookupEnvironmentHistoryCallable().call(request);
-   *     for (Environment element : response.getEnvironmentsList()) {
-   *       // doThingsWith(element);
-   *     }
-   *     String nextPageToken = response.getNextPageToken();
-   *     if (!Strings.isNullOrEmpty(nextPageToken)) {
-   *       request = request.toBuilder().setPageToken(nextPageToken).build();
-   *     } else {
-   *       break;
-   *     }
-   *   }
-   * }
-   * 
*/ public final UnaryCallable lookupEnvironmentHistoryCallable() { diff --git a/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3beta1/EnvironmentsSettings.java b/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3beta1/EnvironmentsSettings.java index 608ddfaa4..a171dd7b2 100644 --- a/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3beta1/EnvironmentsSettings.java +++ b/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3beta1/EnvironmentsSettings.java @@ -5,7 +5,7 @@ * 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 + * 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, @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.google.cloud.dialogflow.cx.v3beta1; import static com.google.cloud.dialogflow.cx.v3beta1.EnvironmentsClient.ListEnvironmentsPagedResponse; @@ -38,7 +39,7 @@ import java.util.List; import javax.annotation.Generated; -// AUTO-GENERATED DOCUMENTATION AND CLASS +// AUTO-GENERATED DOCUMENTATION AND CLASS. /** * Settings class to configure an instance of {@link EnvironmentsClient}. * @@ -55,23 +56,23 @@ * *

For example, to set the total timeout of getEnvironment to 30 seconds: * - *

- * 
- * EnvironmentsSettings.Builder environmentsSettingsBuilder =
- *     EnvironmentsSettings.newBuilder();
+ * 
{@code
+ * EnvironmentsSettings.Builder environmentsSettingsBuilder = EnvironmentsSettings.newBuilder();
  * environmentsSettingsBuilder
  *     .getEnvironmentSettings()
  *     .setRetrySettings(
- *         environmentsSettingsBuilder.getEnvironmentSettings().getRetrySettings().toBuilder()
+ *         environmentsSettingsBuilder
+ *             .getEnvironmentSettings()
+ *             .getRetrySettings()
+ *             .toBuilder()
  *             .setTotalTimeout(Duration.ofSeconds(30))
  *             .build());
  * EnvironmentsSettings environmentsSettings = environmentsSettingsBuilder.build();
- * 
- * 
+ * }
*/ -@Generated("by gapic-generator") -@BetaApi +@Generated("by gapic-generator-java") public class EnvironmentsSettings extends ClientSettings { + /** Returns the object with the settings used for calls to listEnvironments. */ public PagedCallSettings< ListEnvironmentsRequest, ListEnvironmentsResponse, ListEnvironmentsPagedResponse> @@ -90,8 +91,6 @@ public UnaryCallSettings createEnvironmentS } /** Returns the object with the settings used for calls to createEnvironment. */ - @BetaApi( - "The surface for long-running operations is not stable yet and may change in the future.") public OperationCallSettings createEnvironmentOperationSettings() { return ((EnvironmentsStubSettings) getStubSettings()).createEnvironmentOperationSettings(); @@ -103,8 +102,6 @@ public UnaryCallSettings updateEnvironmentS } /** Returns the object with the settings used for calls to updateEnvironment. */ - @BetaApi( - "The surface for long-running operations is not stable yet and may change in the future.") public OperationCallSettings updateEnvironmentOperationSettings() { return ((EnvironmentsStubSettings) getStubSettings()).updateEnvironmentOperationSettings(); @@ -184,18 +181,15 @@ protected EnvironmentsSettings(Builder settingsBuilder) throws IOException { /** Builder for EnvironmentsSettings. */ public static class Builder extends ClientSettings.Builder { + protected Builder() throws IOException { - this((ClientContext) null); + this(((ClientContext) null)); } protected Builder(ClientContext clientContext) { super(EnvironmentsStubSettings.newBuilder(clientContext)); } - private static Builder createDefault() { - return new Builder(EnvironmentsStubSettings.newBuilder()); - } - protected Builder(EnvironmentsSettings settings) { super(settings.getStubSettings().toBuilder()); } @@ -204,11 +198,15 @@ protected Builder(EnvironmentsStubSettings.Builder stubSettings) { super(stubSettings); } + private static Builder createDefault() { + return new Builder(EnvironmentsStubSettings.newBuilder()); + } + public EnvironmentsStubSettings.Builder getStubSettingsBuilder() { return ((EnvironmentsStubSettings.Builder) getStubSettings()); } - // NEXT_MAJOR_VER: remove 'throws Exception' + // NEXT_MAJOR_VER: remove 'throws Exception'. /** * Applies the given settings updater function to all of the unary API methods in this service. * @@ -240,8 +238,6 @@ public UnaryCallSettings.Builder getEnvironm } /** Returns the builder for the settings used for calls to createEnvironment. */ - @BetaApi( - "The surface for long-running operations is not stable yet and may change in the future.") public OperationCallSettings.Builder createEnvironmentOperationSettings() { return getStubSettingsBuilder().createEnvironmentOperationSettings(); @@ -254,8 +250,6 @@ public UnaryCallSettings.Builder getEnvironm } /** Returns the builder for the settings used for calls to updateEnvironment. */ - @BetaApi( - "The surface for long-running operations is not stable yet and may change in the future.") public OperationCallSettings.Builder updateEnvironmentOperationSettings() { return getStubSettingsBuilder().updateEnvironmentOperationSettings(); diff --git a/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3beta1/FlowsClient.java b/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3beta1/FlowsClient.java index 1aba5a124..23117a2a8 100644 --- a/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3beta1/FlowsClient.java +++ b/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3beta1/FlowsClient.java @@ -5,7 +5,7 @@ * 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 + * 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, @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.google.cloud.dialogflow.cx.v3beta1; import com.google.api.core.ApiFunction; @@ -40,24 +41,14 @@ import java.util.concurrent.TimeUnit; import javax.annotation.Generated; -// AUTO-GENERATED DOCUMENTATION AND SERVICE +// AUTO-GENERATED DOCUMENTATION AND CLASS. /** * Service Description: Service for managing [Flows][google.cloud.dialogflow.cx.v3beta1.Flow]. * *

This class provides the ability to make remote calls to the backing service through method * calls that map to API methods. Sample code to get started: * - *

- * 
- * try (FlowsClient flowsClient = FlowsClient.create()) {
- *   AgentName parent = AgentName.of("[PROJECT]", "[LOCATION]", "[AGENT]");
- *   Flow flow = Flow.newBuilder().build();
- *   Flow response = flowsClient.createFlow(parent, flow);
- * }
- * 
- * 
- * - *

Note: close() needs to be called on the flowsClient object to clean up resources such as + *

Note: close() needs to be called on the FlowsClient object to clean up resources such as * threads. In the example above, try-with-resources is used, which automatically calls close(). * *

The surface of this class includes several types of Java methods for each of the API's @@ -85,30 +76,25 @@ * *

To customize credentials: * - *

- * 
+ * 
{@code
  * FlowsSettings flowsSettings =
  *     FlowsSettings.newBuilder()
  *         .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
  *         .build();
- * FlowsClient flowsClient =
- *     FlowsClient.create(flowsSettings);
- * 
- * 
+ * FlowsClient flowsClient = FlowsClient.create(flowsSettings); + * }
* - * To customize the endpoint: + *

To customize the endpoint: * - *

- * 
- * FlowsSettings flowsSettings =
- *     FlowsSettings.newBuilder().setEndpoint(myEndpoint).build();
- * FlowsClient flowsClient =
- *     FlowsClient.create(flowsSettings);
- * 
- * 
+ *
{@code
+ * FlowsSettings flowsSettings = FlowsSettings.newBuilder().setEndpoint(myEndpoint).build();
+ * FlowsClient flowsClient = FlowsClient.create(flowsSettings);
+ * }
+ * + *

Please refer to the GitHub repository's samples for more quickstart code snippets. */ -@Generated("by gapic-generator") @BetaApi +@Generated("by gapic-generator") public class FlowsClient implements BackgroundResource { private final FlowsSettings settings; private final FlowsStub stub; @@ -129,7 +115,7 @@ public static final FlowsClient create(FlowsSettings settings) throws IOExceptio /** * Constructs an instance of FlowsClient, using the given stub for making calls. This is for - * advanced usage - prefer to use FlowsSettings}. + * advanced usage - prefer using create(FlowsSettings). */ @BetaApi("A restructuring of stub classes is planned, so this may break in the future") public static final FlowsClient create(FlowsStub stub) { @@ -166,26 +152,14 @@ public FlowsStub getStub() { * Returns the OperationsClient that can be used to query the status of a long-running operation * returned by another API method call. */ - @BetaApi( - "The surface for long-running operations is not stable yet and may change in the future.") public final OperationsClient getOperationsClient() { return operationsClient; } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Creates a flow in the specified agent. * - *

Sample code: - * - *


-   * try (FlowsClient flowsClient = FlowsClient.create()) {
-   *   AgentName parent = AgentName.of("[PROJECT]", "[LOCATION]", "[AGENT]");
-   *   Flow flow = Flow.newBuilder().build();
-   *   Flow response = flowsClient.createFlow(parent, flow);
-   * }
-   * 
- * * @param parent Required. The agent to create a flow for. Format: `projects/<Project * ID>/locations/<Location ID>/agents/<Agent ID>`. * @param flow Required. The flow to create. @@ -200,20 +174,10 @@ public final Flow createFlow(AgentName parent, Flow flow) { return createFlow(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Creates a flow in the specified agent. * - *

Sample code: - * - *


-   * try (FlowsClient flowsClient = FlowsClient.create()) {
-   *   AgentName parent = AgentName.of("[PROJECT]", "[LOCATION]", "[AGENT]");
-   *   Flow flow = Flow.newBuilder().build();
-   *   Flow response = flowsClient.createFlow(parent.toString(), flow);
-   * }
-   * 
- * * @param parent Required. The agent to create a flow for. Format: `projects/<Project * ID>/locations/<Location ID>/agents/<Agent ID>`. * @param flow Required. The flow to create. @@ -225,24 +189,10 @@ public final Flow createFlow(String parent, Flow flow) { return createFlow(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Creates a flow in the specified agent. * - *

Sample code: - * - *


-   * try (FlowsClient flowsClient = FlowsClient.create()) {
-   *   AgentName parent = AgentName.of("[PROJECT]", "[LOCATION]", "[AGENT]");
-   *   Flow flow = Flow.newBuilder().build();
-   *   CreateFlowRequest request = CreateFlowRequest.newBuilder()
-   *     .setParent(parent.toString())
-   *     .setFlow(flow)
-   *     .build();
-   *   Flow response = flowsClient.createFlow(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 */ @@ -250,43 +200,20 @@ public final Flow createFlow(CreateFlowRequest request) { return createFlowCallable().call(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Creates a flow in the specified agent. * *

Sample code: - * - *


-   * try (FlowsClient flowsClient = FlowsClient.create()) {
-   *   AgentName parent = AgentName.of("[PROJECT]", "[LOCATION]", "[AGENT]");
-   *   Flow flow = Flow.newBuilder().build();
-   *   CreateFlowRequest request = CreateFlowRequest.newBuilder()
-   *     .setParent(parent.toString())
-   *     .setFlow(flow)
-   *     .build();
-   *   ApiFuture<Flow> future = flowsClient.createFlowCallable().futureCall(request);
-   *   // Do something
-   *   Flow response = future.get();
-   * }
-   * 
*/ public final UnaryCallable createFlowCallable() { return stub.createFlowCallable(); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Deletes a specified flow. * - *

Sample code: - * - *


-   * try (FlowsClient flowsClient = FlowsClient.create()) {
-   *   FlowName name = FlowName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]");
-   *   flowsClient.deleteFlow(name);
-   * }
-   * 
- * * @param name Required. The name of the flow to delete. Format: `projects/<Project * ID>/locations/<Location ID>/agents/<Agent ID>/flows/<Flow ID>`. * @throws com.google.api.gax.rpc.ApiException if the remote call fails @@ -297,19 +224,10 @@ public final void deleteFlow(FlowName name) { deleteFlow(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Deletes a specified flow. * - *

Sample code: - * - *


-   * try (FlowsClient flowsClient = FlowsClient.create()) {
-   *   FlowName name = FlowName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]");
-   *   flowsClient.deleteFlow(name.toString());
-   * }
-   * 
- * * @param name Required. The name of the flow to delete. Format: `projects/<Project * ID>/locations/<Location ID>/agents/<Agent ID>/flows/<Flow ID>`. * @throws com.google.api.gax.rpc.ApiException if the remote call fails @@ -319,22 +237,10 @@ public final void deleteFlow(String name) { deleteFlow(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Deletes a specified flow. * - *

Sample code: - * - *


-   * try (FlowsClient flowsClient = FlowsClient.create()) {
-   *   FlowName name = FlowName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]");
-   *   DeleteFlowRequest request = DeleteFlowRequest.newBuilder()
-   *     .setName(name.toString())
-   *     .build();
-   *   flowsClient.deleteFlow(request);
-   * }
-   * 
- * * @param request The request object containing all of the parameters for the API call. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ @@ -342,43 +248,20 @@ public final void deleteFlow(DeleteFlowRequest request) { deleteFlowCallable().call(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Deletes a specified flow. * *

Sample code: - * - *


-   * try (FlowsClient flowsClient = FlowsClient.create()) {
-   *   FlowName name = FlowName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]");
-   *   DeleteFlowRequest request = DeleteFlowRequest.newBuilder()
-   *     .setName(name.toString())
-   *     .build();
-   *   ApiFuture<Void> future = flowsClient.deleteFlowCallable().futureCall(request);
-   *   // Do something
-   *   future.get();
-   * }
-   * 
*/ public final UnaryCallable deleteFlowCallable() { return stub.deleteFlowCallable(); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Returns the list of all flows in the specified agent. * - *

Sample code: - * - *


-   * try (FlowsClient flowsClient = FlowsClient.create()) {
-   *   AgentName parent = AgentName.of("[PROJECT]", "[LOCATION]", "[AGENT]");
-   *   for (Flow element : flowsClient.listFlows(parent).iterateAll()) {
-   *     // doThingsWith(element);
-   *   }
-   * }
-   * 
- * * @param parent Required. The agent containing the flows. Format: `projects/<Project * ID>/locations/<Location ID>/agents/<Agent ID>`. * @throws com.google.api.gax.rpc.ApiException if the remote call fails @@ -389,21 +272,10 @@ public final ListFlowsPagedResponse listFlows(AgentName parent) { return listFlows(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Returns the list of all flows in the specified agent. * - *

Sample code: - * - *


-   * try (FlowsClient flowsClient = FlowsClient.create()) {
-   *   AgentName parent = AgentName.of("[PROJECT]", "[LOCATION]", "[AGENT]");
-   *   for (Flow element : flowsClient.listFlows(parent.toString()).iterateAll()) {
-   *     // doThingsWith(element);
-   *   }
-   * }
-   * 
- * * @param parent Required. The agent containing the flows. Format: `projects/<Project * ID>/locations/<Location ID>/agents/<Agent ID>`. * @throws com.google.api.gax.rpc.ApiException if the remote call fails @@ -413,24 +285,10 @@ public final ListFlowsPagedResponse listFlows(String parent) { return listFlows(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Returns the list of all flows in the specified agent. * - *

Sample code: - * - *


-   * try (FlowsClient flowsClient = FlowsClient.create()) {
-   *   AgentName parent = AgentName.of("[PROJECT]", "[LOCATION]", "[AGENT]");
-   *   ListFlowsRequest request = ListFlowsRequest.newBuilder()
-   *     .setParent(parent.toString())
-   *     .build();
-   *   for (Flow element : flowsClient.listFlows(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 */ @@ -438,74 +296,30 @@ public final ListFlowsPagedResponse listFlows(ListFlowsRequest request) { return listFlowsPagedCallable().call(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Returns the list of all flows in the specified agent. * *

Sample code: - * - *


-   * try (FlowsClient flowsClient = FlowsClient.create()) {
-   *   AgentName parent = AgentName.of("[PROJECT]", "[LOCATION]", "[AGENT]");
-   *   ListFlowsRequest request = ListFlowsRequest.newBuilder()
-   *     .setParent(parent.toString())
-   *     .build();
-   *   ApiFuture<ListFlowsPagedResponse> future = flowsClient.listFlowsPagedCallable().futureCall(request);
-   *   // Do something
-   *   for (Flow element : future.get().iterateAll()) {
-   *     // doThingsWith(element);
-   *   }
-   * }
-   * 
*/ public final UnaryCallable listFlowsPagedCallable() { return stub.listFlowsPagedCallable(); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Returns the list of all flows in the specified agent. * *

Sample code: - * - *


-   * try (FlowsClient flowsClient = FlowsClient.create()) {
-   *   AgentName parent = AgentName.of("[PROJECT]", "[LOCATION]", "[AGENT]");
-   *   ListFlowsRequest request = ListFlowsRequest.newBuilder()
-   *     .setParent(parent.toString())
-   *     .build();
-   *   while (true) {
-   *     ListFlowsResponse response = flowsClient.listFlowsCallable().call(request);
-   *     for (Flow element : response.getFlowsList()) {
-   *       // doThingsWith(element);
-   *     }
-   *     String nextPageToken = response.getNextPageToken();
-   *     if (!Strings.isNullOrEmpty(nextPageToken)) {
-   *       request = request.toBuilder().setPageToken(nextPageToken).build();
-   *     } else {
-   *       break;
-   *     }
-   *   }
-   * }
-   * 
*/ public final UnaryCallable listFlowsCallable() { return stub.listFlowsCallable(); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Retrieves the specified flow. * - *

Sample code: - * - *


-   * try (FlowsClient flowsClient = FlowsClient.create()) {
-   *   FlowName name = FlowName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]");
-   *   Flow response = flowsClient.getFlow(name);
-   * }
-   * 
- * * @param name Required. The name of the flow to get. Format: `projects/<Project * ID>/locations/<Location ID>/agents/<Agent ID>/flows/<Flow ID>`. * @throws com.google.api.gax.rpc.ApiException if the remote call fails @@ -516,19 +330,10 @@ public final Flow getFlow(FlowName name) { return getFlow(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Retrieves the specified flow. * - *

Sample code: - * - *


-   * try (FlowsClient flowsClient = FlowsClient.create()) {
-   *   FlowName name = FlowName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]");
-   *   Flow response = flowsClient.getFlow(name.toString());
-   * }
-   * 
- * * @param name Required. The name of the flow to get. Format: `projects/<Project * ID>/locations/<Location ID>/agents/<Agent ID>/flows/<Flow ID>`. * @throws com.google.api.gax.rpc.ApiException if the remote call fails @@ -538,22 +343,10 @@ public final Flow getFlow(String name) { return getFlow(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Retrieves the specified flow. * - *

Sample code: - * - *


-   * try (FlowsClient flowsClient = FlowsClient.create()) {
-   *   FlowName name = FlowName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]");
-   *   GetFlowRequest request = GetFlowRequest.newBuilder()
-   *     .setName(name.toString())
-   *     .build();
-   *   Flow response = flowsClient.getFlow(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 */ @@ -561,42 +354,20 @@ public final Flow getFlow(GetFlowRequest request) { return getFlowCallable().call(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Retrieves the specified flow. * *

Sample code: - * - *


-   * try (FlowsClient flowsClient = FlowsClient.create()) {
-   *   FlowName name = FlowName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]");
-   *   GetFlowRequest request = GetFlowRequest.newBuilder()
-   *     .setName(name.toString())
-   *     .build();
-   *   ApiFuture<Flow> future = flowsClient.getFlowCallable().futureCall(request);
-   *   // Do something
-   *   Flow response = future.get();
-   * }
-   * 
*/ public final UnaryCallable getFlowCallable() { return stub.getFlowCallable(); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Updates the specified flow. * - *

Sample code: - * - *


-   * try (FlowsClient flowsClient = FlowsClient.create()) {
-   *   Flow flow = Flow.newBuilder().build();
-   *   FieldMask updateMask = FieldMask.newBuilder().build();
-   *   Flow response = flowsClient.updateFlow(flow, updateMask);
-   * }
-   * 
- * * @param flow Required. The flow to update. * @param updateMask Required. The mask to control which fields get updated. If `update_mask` is * not specified, an error will be returned. @@ -608,24 +379,10 @@ public final Flow updateFlow(Flow flow, FieldMask updateMask) { return updateFlow(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Updates the specified flow. * - *

Sample code: - * - *


-   * try (FlowsClient flowsClient = FlowsClient.create()) {
-   *   Flow flow = Flow.newBuilder().build();
-   *   FieldMask updateMask = FieldMask.newBuilder().build();
-   *   UpdateFlowRequest request = UpdateFlowRequest.newBuilder()
-   *     .setFlow(flow)
-   *     .setUpdateMask(updateMask)
-   *     .build();
-   *   Flow response = flowsClient.updateFlow(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 */ @@ -633,144 +390,69 @@ public final Flow updateFlow(UpdateFlowRequest request) { return updateFlowCallable().call(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Updates the specified flow. * *

Sample code: - * - *


-   * try (FlowsClient flowsClient = FlowsClient.create()) {
-   *   Flow flow = Flow.newBuilder().build();
-   *   FieldMask updateMask = FieldMask.newBuilder().build();
-   *   UpdateFlowRequest request = UpdateFlowRequest.newBuilder()
-   *     .setFlow(flow)
-   *     .setUpdateMask(updateMask)
-   *     .build();
-   *   ApiFuture<Flow> future = flowsClient.updateFlowCallable().futureCall(request);
-   *   // Do something
-   *   Flow response = future.get();
-   * }
-   * 
*/ public final UnaryCallable updateFlowCallable() { return stub.updateFlowCallable(); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Trains the specified flow. Note that only the flow in 'draft' environment is trained. * - *

Sample code: - * - *


-   * try (FlowsClient flowsClient = FlowsClient.create()) {
-   *   FlowName name = FlowName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]");
-   *   flowsClient.trainFlowAsync(name).get();
-   * }
-   * 
- * * @param name Required. The flow to train. Format: `projects/<Project * ID>/locations/<Location ID>/agents/<Agent ID>/flows/<Flow ID>`. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ - @BetaApi( - "The surface for long-running operations is not stable yet and may change in the future.") public final OperationFuture trainFlowAsync(FlowName name) { TrainFlowRequest request = TrainFlowRequest.newBuilder().setName(name == null ? null : name.toString()).build(); return trainFlowAsync(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Trains the specified flow. Note that only the flow in 'draft' environment is trained. * - *

Sample code: - * - *


-   * try (FlowsClient flowsClient = FlowsClient.create()) {
-   *   FlowName name = FlowName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]");
-   *   flowsClient.trainFlowAsync(name.toString()).get();
-   * }
-   * 
- * * @param name Required. The flow to train. Format: `projects/<Project * ID>/locations/<Location ID>/agents/<Agent ID>/flows/<Flow ID>`. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ - @BetaApi( - "The surface for long-running operations is not stable yet and may change in the future.") public final OperationFuture trainFlowAsync(String name) { TrainFlowRequest request = TrainFlowRequest.newBuilder().setName(name).build(); return trainFlowAsync(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Trains the specified flow. Note that only the flow in 'draft' environment is trained. * - *

Sample code: - * - *


-   * try (FlowsClient flowsClient = FlowsClient.create()) {
-   *   FlowName name = FlowName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]");
-   *   TrainFlowRequest request = TrainFlowRequest.newBuilder()
-   *     .setName(name.toString())
-   *     .build();
-   *   flowsClient.trainFlowAsync(request).get();
-   * }
-   * 
- * * @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 */ - @BetaApi( - "The surface for long-running operations is not stable yet and may change in the future.") public final OperationFuture trainFlowAsync(TrainFlowRequest request) { return trainFlowOperationCallable().futureCall(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Trains the specified flow. Note that only the flow in 'draft' environment is trained. * *

Sample code: - * - *


-   * try (FlowsClient flowsClient = FlowsClient.create()) {
-   *   FlowName name = FlowName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]");
-   *   TrainFlowRequest request = TrainFlowRequest.newBuilder()
-   *     .setName(name.toString())
-   *     .build();
-   *   OperationFuture<Empty, Struct> future = flowsClient.trainFlowOperationCallable().futureCall(request);
-   *   // Do something
-   *   future.get();
-   * }
-   * 
*/ - @BetaApi("The surface for use by generated code is not stable yet and may change in the future.") public final OperationCallable trainFlowOperationCallable() { return stub.trainFlowOperationCallable(); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Trains the specified flow. Note that only the flow in 'draft' environment is trained. * *

Sample code: - * - *


-   * try (FlowsClient flowsClient = FlowsClient.create()) {
-   *   FlowName name = FlowName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]");
-   *   TrainFlowRequest request = TrainFlowRequest.newBuilder()
-   *     .setName(name.toString())
-   *     .build();
-   *   ApiFuture<Operation> future = flowsClient.trainFlowCallable().futureCall(request);
-   *   // Do something
-   *   future.get();
-   * }
-   * 
*/ public final UnaryCallable trainFlowCallable() { return stub.trainFlowCallable(); diff --git a/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3beta1/FlowsSettings.java b/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3beta1/FlowsSettings.java index 2a321216d..7b95a7b2d 100644 --- a/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3beta1/FlowsSettings.java +++ b/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3beta1/FlowsSettings.java @@ -5,7 +5,7 @@ * 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 + * 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, @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.google.cloud.dialogflow.cx.v3beta1; import static com.google.cloud.dialogflow.cx.v3beta1.FlowsClient.ListFlowsPagedResponse; @@ -37,7 +38,7 @@ import java.util.List; import javax.annotation.Generated; -// AUTO-GENERATED DOCUMENTATION AND CLASS +// AUTO-GENERATED DOCUMENTATION AND CLASS. /** * Settings class to configure an instance of {@link FlowsClient}. * @@ -54,23 +55,23 @@ * *

For example, to set the total timeout of createFlow to 30 seconds: * - *

- * 
- * FlowsSettings.Builder flowsSettingsBuilder =
- *     FlowsSettings.newBuilder();
+ * 
{@code
+ * FlowsSettings.Builder flowsSettingsBuilder = FlowsSettings.newBuilder();
  * flowsSettingsBuilder
  *     .createFlowSettings()
  *     .setRetrySettings(
- *         flowsSettingsBuilder.createFlowSettings().getRetrySettings().toBuilder()
+ *         flowsSettingsBuilder
+ *             .createFlowSettings()
+ *             .getRetrySettings()
+ *             .toBuilder()
  *             .setTotalTimeout(Duration.ofSeconds(30))
  *             .build());
  * FlowsSettings flowsSettings = flowsSettingsBuilder.build();
- * 
- * 
+ * }
*/ -@Generated("by gapic-generator") -@BetaApi +@Generated("by gapic-generator-java") public class FlowsSettings extends ClientSettings { + /** Returns the object with the settings used for calls to createFlow. */ public UnaryCallSettings createFlowSettings() { return ((FlowsStubSettings) getStubSettings()).createFlowSettings(); @@ -103,8 +104,6 @@ public UnaryCallSettings trainFlowSettings() { } /** Returns the object with the settings used for calls to trainFlow. */ - @BetaApi( - "The surface for long-running operations is not stable yet and may change in the future.") public OperationCallSettings trainFlowOperationSettings() { return ((FlowsStubSettings) getStubSettings()).trainFlowOperationSettings(); } @@ -168,18 +167,15 @@ protected FlowsSettings(Builder settingsBuilder) throws IOException { /** Builder for FlowsSettings. */ public static class Builder extends ClientSettings.Builder { + protected Builder() throws IOException { - this((ClientContext) null); + this(((ClientContext) null)); } protected Builder(ClientContext clientContext) { super(FlowsStubSettings.newBuilder(clientContext)); } - private static Builder createDefault() { - return new Builder(FlowsStubSettings.newBuilder()); - } - protected Builder(FlowsSettings settings) { super(settings.getStubSettings().toBuilder()); } @@ -188,11 +184,15 @@ protected Builder(FlowsStubSettings.Builder stubSettings) { super(stubSettings); } + private static Builder createDefault() { + return new Builder(FlowsStubSettings.newBuilder()); + } + public FlowsStubSettings.Builder getStubSettingsBuilder() { return ((FlowsStubSettings.Builder) getStubSettings()); } - // NEXT_MAJOR_VER: remove 'throws Exception' + // NEXT_MAJOR_VER: remove 'throws Exception'. /** * Applies the given settings updater function to all of the unary API methods in this service. * @@ -237,8 +237,6 @@ public UnaryCallSettings.Builder trainFlowSettings( } /** Returns the builder for the settings used for calls to trainFlow. */ - @BetaApi( - "The surface for long-running operations is not stable yet and may change in the future.") public OperationCallSettings.Builder trainFlowOperationSettings() { return getStubSettingsBuilder().trainFlowOperationSettings(); diff --git a/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3beta1/IntentsClient.java b/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3beta1/IntentsClient.java index a76007393..261ffdf6c 100644 --- a/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3beta1/IntentsClient.java +++ b/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3beta1/IntentsClient.java @@ -5,7 +5,7 @@ * 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 + * 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, @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.google.cloud.dialogflow.cx.v3beta1; import com.google.api.core.ApiFunction; @@ -35,23 +36,14 @@ import java.util.concurrent.TimeUnit; import javax.annotation.Generated; -// AUTO-GENERATED DOCUMENTATION AND SERVICE +// AUTO-GENERATED DOCUMENTATION AND CLASS. /** * Service Description: Service for managing [Intents][google.cloud.dialogflow.cx.v3beta1.Intent]. * *

This class provides the ability to make remote calls to the backing service through method * calls that map to API methods. Sample code to get started: * - *

- * 
- * try (IntentsClient intentsClient = IntentsClient.create()) {
- *   IntentName name = IntentName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[INTENT]");
- *   Intent response = intentsClient.getIntent(name);
- * }
- * 
- * 
- * - *

Note: close() needs to be called on the intentsClient object to clean up resources such as + *

Note: close() needs to be called on the IntentsClient object to clean up resources such as * threads. In the example above, try-with-resources is used, which automatically calls close(). * *

The surface of this class includes several types of Java methods for each of the API's @@ -79,30 +71,25 @@ * *

To customize credentials: * - *

- * 
+ * 
{@code
  * IntentsSettings intentsSettings =
  *     IntentsSettings.newBuilder()
  *         .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
  *         .build();
- * IntentsClient intentsClient =
- *     IntentsClient.create(intentsSettings);
- * 
- * 
+ * IntentsClient intentsClient = IntentsClient.create(intentsSettings); + * }
* - * To customize the endpoint: + *

To customize the endpoint: * - *

- * 
- * IntentsSettings intentsSettings =
- *     IntentsSettings.newBuilder().setEndpoint(myEndpoint).build();
- * IntentsClient intentsClient =
- *     IntentsClient.create(intentsSettings);
- * 
- * 
+ *
{@code
+ * IntentsSettings intentsSettings = IntentsSettings.newBuilder().setEndpoint(myEndpoint).build();
+ * IntentsClient intentsClient = IntentsClient.create(intentsSettings);
+ * }
+ * + *

Please refer to the GitHub repository's samples for more quickstart code snippets. */ -@Generated("by gapic-generator") @BetaApi +@Generated("by gapic-generator") public class IntentsClient implements BackgroundResource { private final IntentsSettings settings; private final IntentsStub stub; @@ -122,7 +109,7 @@ public static final IntentsClient create(IntentsSettings settings) throws IOExce /** * Constructs an instance of IntentsClient, using the given stub for making calls. This is for - * advanced usage - prefer to use IntentsSettings}. + * advanced usage - prefer using create(IntentsSettings). */ @BetaApi("A restructuring of stub classes is planned, so this may break in the future") public static final IntentsClient create(IntentsStub stub) { @@ -153,21 +140,10 @@ public IntentsStub getStub() { return stub; } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Returns the list of all intents in the specified agent. * - *

Sample code: - * - *


-   * try (IntentsClient intentsClient = IntentsClient.create()) {
-   *   AgentName parent = AgentName.of("[PROJECT]", "[LOCATION]", "[AGENT]");
-   *   for (Intent element : intentsClient.listIntents(parent).iterateAll()) {
-   *     // doThingsWith(element);
-   *   }
-   * }
-   * 
- * * @param parent Required. The agent to list all intents for. Format: `projects/<Project * ID>/locations/<Location ID>/agents/<Agent ID>`. * @throws com.google.api.gax.rpc.ApiException if the remote call fails @@ -180,21 +156,10 @@ public final ListIntentsPagedResponse listIntents(AgentName parent) { return listIntents(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Returns the list of all intents in the specified agent. * - *

Sample code: - * - *


-   * try (IntentsClient intentsClient = IntentsClient.create()) {
-   *   AgentName parent = AgentName.of("[PROJECT]", "[LOCATION]", "[AGENT]");
-   *   for (Intent element : intentsClient.listIntents(parent.toString()).iterateAll()) {
-   *     // doThingsWith(element);
-   *   }
-   * }
-   * 
- * * @param parent Required. The agent to list all intents for. Format: `projects/<Project * ID>/locations/<Location ID>/agents/<Agent ID>`. * @throws com.google.api.gax.rpc.ApiException if the remote call fails @@ -204,24 +169,10 @@ public final ListIntentsPagedResponse listIntents(String parent) { return listIntents(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Returns the list of all intents in the specified agent. * - *

Sample code: - * - *


-   * try (IntentsClient intentsClient = IntentsClient.create()) {
-   *   AgentName parent = AgentName.of("[PROJECT]", "[LOCATION]", "[AGENT]");
-   *   ListIntentsRequest request = ListIntentsRequest.newBuilder()
-   *     .setParent(parent.toString())
-   *     .build();
-   *   for (Intent element : intentsClient.listIntents(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 */ @@ -229,75 +180,31 @@ public final ListIntentsPagedResponse listIntents(ListIntentsRequest request) { return listIntentsPagedCallable().call(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Returns the list of all intents in the specified agent. * *

Sample code: - * - *


-   * try (IntentsClient intentsClient = IntentsClient.create()) {
-   *   AgentName parent = AgentName.of("[PROJECT]", "[LOCATION]", "[AGENT]");
-   *   ListIntentsRequest request = ListIntentsRequest.newBuilder()
-   *     .setParent(parent.toString())
-   *     .build();
-   *   ApiFuture<ListIntentsPagedResponse> future = intentsClient.listIntentsPagedCallable().futureCall(request);
-   *   // Do something
-   *   for (Intent element : future.get().iterateAll()) {
-   *     // doThingsWith(element);
-   *   }
-   * }
-   * 
*/ public final UnaryCallable listIntentsPagedCallable() { return stub.listIntentsPagedCallable(); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Returns the list of all intents in the specified agent. * *

Sample code: - * - *


-   * try (IntentsClient intentsClient = IntentsClient.create()) {
-   *   AgentName parent = AgentName.of("[PROJECT]", "[LOCATION]", "[AGENT]");
-   *   ListIntentsRequest request = ListIntentsRequest.newBuilder()
-   *     .setParent(parent.toString())
-   *     .build();
-   *   while (true) {
-   *     ListIntentsResponse response = intentsClient.listIntentsCallable().call(request);
-   *     for (Intent element : response.getIntentsList()) {
-   *       // doThingsWith(element);
-   *     }
-   *     String nextPageToken = response.getNextPageToken();
-   *     if (!Strings.isNullOrEmpty(nextPageToken)) {
-   *       request = request.toBuilder().setPageToken(nextPageToken).build();
-   *     } else {
-   *       break;
-   *     }
-   *   }
-   * }
-   * 
*/ public final UnaryCallable listIntentsCallable() { return stub.listIntentsCallable(); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Retrieves the specified intent. * - *

Sample code: - * - *


-   * try (IntentsClient intentsClient = IntentsClient.create()) {
-   *   IntentName name = IntentName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[INTENT]");
-   *   Intent response = intentsClient.getIntent(name);
-   * }
-   * 
- * * @param name Required. The name of the intent. Format: `projects/<Project * ID>/locations/<Location ID>/agents/<Agent ID>/intents/<Intent ID>`. * @throws com.google.api.gax.rpc.ApiException if the remote call fails @@ -308,19 +215,10 @@ public final Intent getIntent(IntentName name) { return getIntent(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Retrieves the specified intent. * - *

Sample code: - * - *


-   * try (IntentsClient intentsClient = IntentsClient.create()) {
-   *   IntentName name = IntentName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[INTENT]");
-   *   Intent response = intentsClient.getIntent(name.toString());
-   * }
-   * 
- * * @param name Required. The name of the intent. Format: `projects/<Project * ID>/locations/<Location ID>/agents/<Agent ID>/intents/<Intent ID>`. * @throws com.google.api.gax.rpc.ApiException if the remote call fails @@ -330,22 +228,10 @@ public final Intent getIntent(String name) { return getIntent(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Retrieves the specified intent. * - *

Sample code: - * - *


-   * try (IntentsClient intentsClient = IntentsClient.create()) {
-   *   IntentName name = IntentName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[INTENT]");
-   *   GetIntentRequest request = GetIntentRequest.newBuilder()
-   *     .setName(name.toString())
-   *     .build();
-   *   Intent response = intentsClient.getIntent(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 */ @@ -353,42 +239,20 @@ public final Intent getIntent(GetIntentRequest request) { return getIntentCallable().call(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Retrieves the specified intent. * *

Sample code: - * - *


-   * try (IntentsClient intentsClient = IntentsClient.create()) {
-   *   IntentName name = IntentName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[INTENT]");
-   *   GetIntentRequest request = GetIntentRequest.newBuilder()
-   *     .setName(name.toString())
-   *     .build();
-   *   ApiFuture<Intent> future = intentsClient.getIntentCallable().futureCall(request);
-   *   // Do something
-   *   Intent response = future.get();
-   * }
-   * 
*/ public final UnaryCallable getIntentCallable() { return stub.getIntentCallable(); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Creates an intent in the specified agent. * - *

Sample code: - * - *


-   * try (IntentsClient intentsClient = IntentsClient.create()) {
-   *   AgentName parent = AgentName.of("[PROJECT]", "[LOCATION]", "[AGENT]");
-   *   Intent intent = Intent.newBuilder().build();
-   *   Intent response = intentsClient.createIntent(parent, intent);
-   * }
-   * 
- * * @param parent Required. The agent to create an intent for. Format: `projects/<Project * ID>/locations/<Location ID>/agents/<Agent ID>`. * @param intent Required. The intent to create. @@ -403,20 +267,10 @@ public final Intent createIntent(AgentName parent, Intent intent) { return createIntent(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Creates an intent in the specified agent. * - *

Sample code: - * - *


-   * try (IntentsClient intentsClient = IntentsClient.create()) {
-   *   AgentName parent = AgentName.of("[PROJECT]", "[LOCATION]", "[AGENT]");
-   *   Intent intent = Intent.newBuilder().build();
-   *   Intent response = intentsClient.createIntent(parent.toString(), intent);
-   * }
-   * 
- * * @param parent Required. The agent to create an intent for. Format: `projects/<Project * ID>/locations/<Location ID>/agents/<Agent ID>`. * @param intent Required. The intent to create. @@ -428,24 +282,10 @@ public final Intent createIntent(String parent, Intent intent) { return createIntent(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Creates an intent in the specified agent. * - *

Sample code: - * - *


-   * try (IntentsClient intentsClient = IntentsClient.create()) {
-   *   AgentName parent = AgentName.of("[PROJECT]", "[LOCATION]", "[AGENT]");
-   *   Intent intent = Intent.newBuilder().build();
-   *   CreateIntentRequest request = CreateIntentRequest.newBuilder()
-   *     .setParent(parent.toString())
-   *     .setIntent(intent)
-   *     .build();
-   *   Intent response = intentsClient.createIntent(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 */ @@ -453,44 +293,20 @@ public final Intent createIntent(CreateIntentRequest request) { return createIntentCallable().call(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Creates an intent in the specified agent. * *

Sample code: - * - *


-   * try (IntentsClient intentsClient = IntentsClient.create()) {
-   *   AgentName parent = AgentName.of("[PROJECT]", "[LOCATION]", "[AGENT]");
-   *   Intent intent = Intent.newBuilder().build();
-   *   CreateIntentRequest request = CreateIntentRequest.newBuilder()
-   *     .setParent(parent.toString())
-   *     .setIntent(intent)
-   *     .build();
-   *   ApiFuture<Intent> future = intentsClient.createIntentCallable().futureCall(request);
-   *   // Do something
-   *   Intent response = future.get();
-   * }
-   * 
*/ public final UnaryCallable createIntentCallable() { return stub.createIntentCallable(); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Updates the specified intent. * - *

Sample code: - * - *


-   * try (IntentsClient intentsClient = IntentsClient.create()) {
-   *   Intent intent = Intent.newBuilder().build();
-   *   FieldMask updateMask = FieldMask.newBuilder().build();
-   *   Intent response = intentsClient.updateIntent(intent, updateMask);
-   * }
-   * 
- * * @param intent Required. The intent to update. * @param updateMask The mask to control which fields get updated. If the mask is not present, all * fields will be updated. @@ -502,22 +318,10 @@ public final Intent updateIntent(Intent intent, FieldMask updateMask) { return updateIntent(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Updates the specified intent. * - *

Sample code: - * - *


-   * try (IntentsClient intentsClient = IntentsClient.create()) {
-   *   Intent intent = Intent.newBuilder().build();
-   *   UpdateIntentRequest request = UpdateIntentRequest.newBuilder()
-   *     .setIntent(intent)
-   *     .build();
-   *   Intent response = intentsClient.updateIntent(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 */ @@ -525,41 +329,20 @@ public final Intent updateIntent(UpdateIntentRequest request) { return updateIntentCallable().call(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Updates the specified intent. * *

Sample code: - * - *


-   * try (IntentsClient intentsClient = IntentsClient.create()) {
-   *   Intent intent = Intent.newBuilder().build();
-   *   UpdateIntentRequest request = UpdateIntentRequest.newBuilder()
-   *     .setIntent(intent)
-   *     .build();
-   *   ApiFuture<Intent> future = intentsClient.updateIntentCallable().futureCall(request);
-   *   // Do something
-   *   Intent response = future.get();
-   * }
-   * 
*/ public final UnaryCallable updateIntentCallable() { return stub.updateIntentCallable(); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Deletes the specified intent. * - *

Sample code: - * - *


-   * try (IntentsClient intentsClient = IntentsClient.create()) {
-   *   IntentName name = IntentName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[INTENT]");
-   *   intentsClient.deleteIntent(name);
-   * }
-   * 
- * * @param name Required. The name of the intent to delete. Format: `projects/<Project * ID>/locations/<Location ID>/agents/<Agent ID>/intents/<Intent ID>`. * @throws com.google.api.gax.rpc.ApiException if the remote call fails @@ -570,19 +353,10 @@ public final void deleteIntent(IntentName name) { deleteIntent(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Deletes the specified intent. * - *

Sample code: - * - *


-   * try (IntentsClient intentsClient = IntentsClient.create()) {
-   *   IntentName name = IntentName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[INTENT]");
-   *   intentsClient.deleteIntent(name.toString());
-   * }
-   * 
- * * @param name Required. The name of the intent to delete. Format: `projects/<Project * ID>/locations/<Location ID>/agents/<Agent ID>/intents/<Intent ID>`. * @throws com.google.api.gax.rpc.ApiException if the remote call fails @@ -592,22 +366,10 @@ public final void deleteIntent(String name) { deleteIntent(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Deletes the specified intent. * - *

Sample code: - * - *


-   * try (IntentsClient intentsClient = IntentsClient.create()) {
-   *   IntentName name = IntentName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[INTENT]");
-   *   DeleteIntentRequest request = DeleteIntentRequest.newBuilder()
-   *     .setName(name.toString())
-   *     .build();
-   *   intentsClient.deleteIntent(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 */ @@ -615,23 +377,11 @@ public final void deleteIntent(DeleteIntentRequest request) { deleteIntentCallable().call(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Deletes the specified intent. * *

Sample code: - * - *


-   * try (IntentsClient intentsClient = IntentsClient.create()) {
-   *   IntentName name = IntentName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[INTENT]");
-   *   DeleteIntentRequest request = DeleteIntentRequest.newBuilder()
-   *     .setName(name.toString())
-   *     .build();
-   *   ApiFuture<Void> future = intentsClient.deleteIntentCallable().futureCall(request);
-   *   // Do something
-   *   future.get();
-   * }
-   * 
*/ public final UnaryCallable deleteIntentCallable() { return stub.deleteIntentCallable(); diff --git a/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3beta1/IntentsSettings.java b/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3beta1/IntentsSettings.java index 298bf5345..f70eecefe 100644 --- a/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3beta1/IntentsSettings.java +++ b/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3beta1/IntentsSettings.java @@ -5,7 +5,7 @@ * 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 + * 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, @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.google.cloud.dialogflow.cx.v3beta1; import static com.google.cloud.dialogflow.cx.v3beta1.IntentsClient.ListIntentsPagedResponse; @@ -34,7 +35,7 @@ import java.util.List; import javax.annotation.Generated; -// AUTO-GENERATED DOCUMENTATION AND CLASS +// AUTO-GENERATED DOCUMENTATION AND CLASS. /** * Settings class to configure an instance of {@link IntentsClient}. * @@ -51,23 +52,23 @@ * *

For example, to set the total timeout of getIntent to 30 seconds: * - *

- * 
- * IntentsSettings.Builder intentsSettingsBuilder =
- *     IntentsSettings.newBuilder();
+ * 
{@code
+ * IntentsSettings.Builder intentsSettingsBuilder = IntentsSettings.newBuilder();
  * intentsSettingsBuilder
  *     .getIntentSettings()
  *     .setRetrySettings(
- *         intentsSettingsBuilder.getIntentSettings().getRetrySettings().toBuilder()
+ *         intentsSettingsBuilder
+ *             .getIntentSettings()
+ *             .getRetrySettings()
+ *             .toBuilder()
  *             .setTotalTimeout(Duration.ofSeconds(30))
  *             .build());
  * IntentsSettings intentsSettings = intentsSettingsBuilder.build();
- * 
- * 
+ * }
*/ -@Generated("by gapic-generator") -@BetaApi +@Generated("by gapic-generator-java") public class IntentsSettings extends ClientSettings { + /** Returns the object with the settings used for calls to listIntents. */ public PagedCallSettings listIntentsSettings() { @@ -153,18 +154,15 @@ protected IntentsSettings(Builder settingsBuilder) throws IOException { /** Builder for IntentsSettings. */ public static class Builder extends ClientSettings.Builder { + protected Builder() throws IOException { - this((ClientContext) null); + this(((ClientContext) null)); } protected Builder(ClientContext clientContext) { super(IntentsStubSettings.newBuilder(clientContext)); } - private static Builder createDefault() { - return new Builder(IntentsStubSettings.newBuilder()); - } - protected Builder(IntentsSettings settings) { super(settings.getStubSettings().toBuilder()); } @@ -173,11 +171,15 @@ protected Builder(IntentsStubSettings.Builder stubSettings) { super(stubSettings); } + private static Builder createDefault() { + return new Builder(IntentsStubSettings.newBuilder()); + } + public IntentsStubSettings.Builder getStubSettingsBuilder() { return ((IntentsStubSettings.Builder) getStubSettings()); } - // NEXT_MAJOR_VER: remove 'throws Exception' + // NEXT_MAJOR_VER: remove 'throws Exception'. /** * Applies the given settings updater function to all of the unary API methods in this service. * diff --git a/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3beta1/PagesClient.java b/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3beta1/PagesClient.java index b481c31a0..246ba5ed5 100644 --- a/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3beta1/PagesClient.java +++ b/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3beta1/PagesClient.java @@ -5,7 +5,7 @@ * 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 + * 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, @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.google.cloud.dialogflow.cx.v3beta1; import com.google.api.core.ApiFunction; @@ -35,23 +36,14 @@ import java.util.concurrent.TimeUnit; import javax.annotation.Generated; -// AUTO-GENERATED DOCUMENTATION AND SERVICE +// AUTO-GENERATED DOCUMENTATION AND CLASS. /** * Service Description: Service for managing [Pages][google.cloud.dialogflow.cx.v3beta1.Page]. * *

This class provides the ability to make remote calls to the backing service through method * calls that map to API methods. Sample code to get started: * - *

- * 
- * try (PagesClient pagesClient = PagesClient.create()) {
- *   PageName name = PageName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]", "[PAGE]");
- *   Page response = pagesClient.getPage(name);
- * }
- * 
- * 
- * - *

Note: close() needs to be called on the pagesClient object to clean up resources such as + *

Note: close() needs to be called on the PagesClient object to clean up resources such as * threads. In the example above, try-with-resources is used, which automatically calls close(). * *

The surface of this class includes several types of Java methods for each of the API's @@ -79,30 +71,25 @@ * *

To customize credentials: * - *

- * 
+ * 
{@code
  * PagesSettings pagesSettings =
  *     PagesSettings.newBuilder()
  *         .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
  *         .build();
- * PagesClient pagesClient =
- *     PagesClient.create(pagesSettings);
- * 
- * 
+ * PagesClient pagesClient = PagesClient.create(pagesSettings); + * }
* - * To customize the endpoint: + *

To customize the endpoint: * - *

- * 
- * PagesSettings pagesSettings =
- *     PagesSettings.newBuilder().setEndpoint(myEndpoint).build();
- * PagesClient pagesClient =
- *     PagesClient.create(pagesSettings);
- * 
- * 
+ *
{@code
+ * PagesSettings pagesSettings = PagesSettings.newBuilder().setEndpoint(myEndpoint).build();
+ * PagesClient pagesClient = PagesClient.create(pagesSettings);
+ * }
+ * + *

Please refer to the GitHub repository's samples for more quickstart code snippets. */ -@Generated("by gapic-generator") @BetaApi +@Generated("by gapic-generator") public class PagesClient implements BackgroundResource { private final PagesSettings settings; private final PagesStub stub; @@ -122,7 +109,7 @@ public static final PagesClient create(PagesSettings settings) throws IOExceptio /** * Constructs an instance of PagesClient, using the given stub for making calls. This is for - * advanced usage - prefer to use PagesSettings}. + * advanced usage - prefer using create(PagesSettings). */ @BetaApi("A restructuring of stub classes is planned, so this may break in the future") public static final PagesClient create(PagesStub stub) { @@ -153,21 +140,10 @@ public PagesStub getStub() { return stub; } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Returns the list of all pages in the specified flow. * - *

Sample code: - * - *


-   * try (PagesClient pagesClient = PagesClient.create()) {
-   *   FlowName parent = FlowName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]");
-   *   for (Page element : pagesClient.listPages(parent).iterateAll()) {
-   *     // doThingsWith(element);
-   *   }
-   * }
-   * 
- * * @param parent Required. The flow to list all pages for. Format: `projects/<Project * ID>/locations/<Location ID>/agents/<Agent ID>/flows/<Flow ID>`. * @throws com.google.api.gax.rpc.ApiException if the remote call fails @@ -178,21 +154,10 @@ public final ListPagesPagedResponse listPages(FlowName parent) { return listPages(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Returns the list of all pages in the specified flow. * - *

Sample code: - * - *


-   * try (PagesClient pagesClient = PagesClient.create()) {
-   *   FlowName parent = FlowName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]");
-   *   for (Page element : pagesClient.listPages(parent.toString()).iterateAll()) {
-   *     // doThingsWith(element);
-   *   }
-   * }
-   * 
- * * @param parent Required. The flow to list all pages for. Format: `projects/<Project * ID>/locations/<Location ID>/agents/<Agent ID>/flows/<Flow ID>`. * @throws com.google.api.gax.rpc.ApiException if the remote call fails @@ -202,24 +167,10 @@ public final ListPagesPagedResponse listPages(String parent) { return listPages(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Returns the list of all pages in the specified flow. * - *

Sample code: - * - *


-   * try (PagesClient pagesClient = PagesClient.create()) {
-   *   FlowName parent = FlowName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]");
-   *   ListPagesRequest request = ListPagesRequest.newBuilder()
-   *     .setParent(parent.toString())
-   *     .build();
-   *   for (Page element : pagesClient.listPages(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 */ @@ -227,74 +178,30 @@ public final ListPagesPagedResponse listPages(ListPagesRequest request) { return listPagesPagedCallable().call(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Returns the list of all pages in the specified flow. * *

Sample code: - * - *


-   * try (PagesClient pagesClient = PagesClient.create()) {
-   *   FlowName parent = FlowName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]");
-   *   ListPagesRequest request = ListPagesRequest.newBuilder()
-   *     .setParent(parent.toString())
-   *     .build();
-   *   ApiFuture<ListPagesPagedResponse> future = pagesClient.listPagesPagedCallable().futureCall(request);
-   *   // Do something
-   *   for (Page element : future.get().iterateAll()) {
-   *     // doThingsWith(element);
-   *   }
-   * }
-   * 
*/ public final UnaryCallable listPagesPagedCallable() { return stub.listPagesPagedCallable(); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Returns the list of all pages in the specified flow. * *

Sample code: - * - *


-   * try (PagesClient pagesClient = PagesClient.create()) {
-   *   FlowName parent = FlowName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]");
-   *   ListPagesRequest request = ListPagesRequest.newBuilder()
-   *     .setParent(parent.toString())
-   *     .build();
-   *   while (true) {
-   *     ListPagesResponse response = pagesClient.listPagesCallable().call(request);
-   *     for (Page element : response.getPagesList()) {
-   *       // doThingsWith(element);
-   *     }
-   *     String nextPageToken = response.getNextPageToken();
-   *     if (!Strings.isNullOrEmpty(nextPageToken)) {
-   *       request = request.toBuilder().setPageToken(nextPageToken).build();
-   *     } else {
-   *       break;
-   *     }
-   *   }
-   * }
-   * 
*/ public final UnaryCallable listPagesCallable() { return stub.listPagesCallable(); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Retrieves the specified page. * - *

Sample code: - * - *


-   * try (PagesClient pagesClient = PagesClient.create()) {
-   *   PageName name = PageName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]", "[PAGE]");
-   *   Page response = pagesClient.getPage(name);
-   * }
-   * 
- * * @param name Required. The name of the page. Format: `projects/<Project * ID>/locations/<Location ID>/agents/<Agent ID>/flows/<Flow * ID>/pages/<Page ID>`. @@ -306,19 +213,10 @@ public final Page getPage(PageName name) { return getPage(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Retrieves the specified page. * - *

Sample code: - * - *


-   * try (PagesClient pagesClient = PagesClient.create()) {
-   *   PageName name = PageName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]", "[PAGE]");
-   *   Page response = pagesClient.getPage(name.toString());
-   * }
-   * 
- * * @param name Required. The name of the page. Format: `projects/<Project * ID>/locations/<Location ID>/agents/<Agent ID>/flows/<Flow * ID>/pages/<Page ID>`. @@ -329,22 +227,10 @@ public final Page getPage(String name) { return getPage(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Retrieves the specified page. * - *

Sample code: - * - *


-   * try (PagesClient pagesClient = PagesClient.create()) {
-   *   PageName name = PageName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]", "[PAGE]");
-   *   GetPageRequest request = GetPageRequest.newBuilder()
-   *     .setName(name.toString())
-   *     .build();
-   *   Page response = pagesClient.getPage(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 */ @@ -352,42 +238,20 @@ public final Page getPage(GetPageRequest request) { return getPageCallable().call(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Retrieves the specified page. * *

Sample code: - * - *


-   * try (PagesClient pagesClient = PagesClient.create()) {
-   *   PageName name = PageName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]", "[PAGE]");
-   *   GetPageRequest request = GetPageRequest.newBuilder()
-   *     .setName(name.toString())
-   *     .build();
-   *   ApiFuture<Page> future = pagesClient.getPageCallable().futureCall(request);
-   *   // Do something
-   *   Page response = future.get();
-   * }
-   * 
*/ public final UnaryCallable getPageCallable() { return stub.getPageCallable(); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Creates a page in the specified flow. * - *

Sample code: - * - *


-   * try (PagesClient pagesClient = PagesClient.create()) {
-   *   FlowName parent = FlowName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]");
-   *   Page page = Page.newBuilder().build();
-   *   Page response = pagesClient.createPage(parent, page);
-   * }
-   * 
- * * @param parent Required. The flow to create a page for. Format: `projects/<Project * ID>/locations/<Location ID>/agents/<Agent ID>/flows/<Flow ID>`. * @param page Required. The page to create. @@ -402,20 +266,10 @@ public final Page createPage(FlowName parent, Page page) { return createPage(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Creates a page in the specified flow. * - *

Sample code: - * - *


-   * try (PagesClient pagesClient = PagesClient.create()) {
-   *   FlowName parent = FlowName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]");
-   *   Page page = Page.newBuilder().build();
-   *   Page response = pagesClient.createPage(parent.toString(), page);
-   * }
-   * 
- * * @param parent Required. The flow to create a page for. Format: `projects/<Project * ID>/locations/<Location ID>/agents/<Agent ID>/flows/<Flow ID>`. * @param page Required. The page to create. @@ -427,24 +281,10 @@ public final Page createPage(String parent, Page page) { return createPage(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Creates a page in the specified flow. * - *

Sample code: - * - *


-   * try (PagesClient pagesClient = PagesClient.create()) {
-   *   FlowName parent = FlowName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]");
-   *   Page page = Page.newBuilder().build();
-   *   CreatePageRequest request = CreatePageRequest.newBuilder()
-   *     .setParent(parent.toString())
-   *     .setPage(page)
-   *     .build();
-   *   Page response = pagesClient.createPage(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 */ @@ -452,44 +292,20 @@ public final Page createPage(CreatePageRequest request) { return createPageCallable().call(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Creates a page in the specified flow. * *

Sample code: - * - *


-   * try (PagesClient pagesClient = PagesClient.create()) {
-   *   FlowName parent = FlowName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]");
-   *   Page page = Page.newBuilder().build();
-   *   CreatePageRequest request = CreatePageRequest.newBuilder()
-   *     .setParent(parent.toString())
-   *     .setPage(page)
-   *     .build();
-   *   ApiFuture<Page> future = pagesClient.createPageCallable().futureCall(request);
-   *   // Do something
-   *   Page response = future.get();
-   * }
-   * 
*/ public final UnaryCallable createPageCallable() { return stub.createPageCallable(); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Updates the specified page. * - *

Sample code: - * - *


-   * try (PagesClient pagesClient = PagesClient.create()) {
-   *   Page page = Page.newBuilder().build();
-   *   FieldMask updateMask = FieldMask.newBuilder().build();
-   *   Page response = pagesClient.updatePage(page, updateMask);
-   * }
-   * 
- * * @param page Required. The page to update. * @param updateMask The mask to control which fields get updated. If the mask is not present, all * fields will be updated. @@ -501,22 +317,10 @@ public final Page updatePage(Page page, FieldMask updateMask) { return updatePage(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Updates the specified page. * - *

Sample code: - * - *


-   * try (PagesClient pagesClient = PagesClient.create()) {
-   *   Page page = Page.newBuilder().build();
-   *   UpdatePageRequest request = UpdatePageRequest.newBuilder()
-   *     .setPage(page)
-   *     .build();
-   *   Page response = pagesClient.updatePage(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 */ @@ -524,41 +328,20 @@ public final Page updatePage(UpdatePageRequest request) { return updatePageCallable().call(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Updates the specified page. * *

Sample code: - * - *


-   * try (PagesClient pagesClient = PagesClient.create()) {
-   *   Page page = Page.newBuilder().build();
-   *   UpdatePageRequest request = UpdatePageRequest.newBuilder()
-   *     .setPage(page)
-   *     .build();
-   *   ApiFuture<Page> future = pagesClient.updatePageCallable().futureCall(request);
-   *   // Do something
-   *   Page response = future.get();
-   * }
-   * 
*/ public final UnaryCallable updatePageCallable() { return stub.updatePageCallable(); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Deletes the specified page. * - *

Sample code: - * - *


-   * try (PagesClient pagesClient = PagesClient.create()) {
-   *   PageName name = PageName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]", "[PAGE]");
-   *   pagesClient.deletePage(name);
-   * }
-   * 
- * * @param name Required. The name of the page to delete. Format: `projects/<Project * ID>/locations/<Location ID>/agents/<Agent ID>/Flows/<flow * ID>/pages/<Page ID>`. @@ -570,19 +353,10 @@ public final void deletePage(PageName name) { deletePage(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Deletes the specified page. * - *

Sample code: - * - *


-   * try (PagesClient pagesClient = PagesClient.create()) {
-   *   PageName name = PageName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]", "[PAGE]");
-   *   pagesClient.deletePage(name.toString());
-   * }
-   * 
- * * @param name Required. The name of the page to delete. Format: `projects/<Project * ID>/locations/<Location ID>/agents/<Agent ID>/Flows/<flow * ID>/pages/<Page ID>`. @@ -593,22 +367,10 @@ public final void deletePage(String name) { deletePage(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Deletes the specified page. * - *

Sample code: - * - *


-   * try (PagesClient pagesClient = PagesClient.create()) {
-   *   PageName name = PageName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]", "[PAGE]");
-   *   DeletePageRequest request = DeletePageRequest.newBuilder()
-   *     .setName(name.toString())
-   *     .build();
-   *   pagesClient.deletePage(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 */ @@ -616,23 +378,11 @@ public final void deletePage(DeletePageRequest request) { deletePageCallable().call(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Deletes the specified page. * *

Sample code: - * - *


-   * try (PagesClient pagesClient = PagesClient.create()) {
-   *   PageName name = PageName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]", "[PAGE]");
-   *   DeletePageRequest request = DeletePageRequest.newBuilder()
-   *     .setName(name.toString())
-   *     .build();
-   *   ApiFuture<Void> future = pagesClient.deletePageCallable().futureCall(request);
-   *   // Do something
-   *   future.get();
-   * }
-   * 
*/ public final UnaryCallable deletePageCallable() { return stub.deletePageCallable(); diff --git a/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3beta1/PagesSettings.java b/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3beta1/PagesSettings.java index 61cbe4cdc..e5ea3dd6b 100644 --- a/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3beta1/PagesSettings.java +++ b/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3beta1/PagesSettings.java @@ -5,7 +5,7 @@ * 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 + * 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, @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.google.cloud.dialogflow.cx.v3beta1; import static com.google.cloud.dialogflow.cx.v3beta1.PagesClient.ListPagesPagedResponse; @@ -34,7 +35,7 @@ import java.util.List; import javax.annotation.Generated; -// AUTO-GENERATED DOCUMENTATION AND CLASS +// AUTO-GENERATED DOCUMENTATION AND CLASS. /** * Settings class to configure an instance of {@link PagesClient}. * @@ -51,23 +52,23 @@ * *

For example, to set the total timeout of getPage to 30 seconds: * - *

- * 
- * PagesSettings.Builder pagesSettingsBuilder =
- *     PagesSettings.newBuilder();
+ * 
{@code
+ * PagesSettings.Builder pagesSettingsBuilder = PagesSettings.newBuilder();
  * pagesSettingsBuilder
  *     .getPageSettings()
  *     .setRetrySettings(
- *         pagesSettingsBuilder.getPageSettings().getRetrySettings().toBuilder()
+ *         pagesSettingsBuilder
+ *             .getPageSettings()
+ *             .getRetrySettings()
+ *             .toBuilder()
  *             .setTotalTimeout(Duration.ofSeconds(30))
  *             .build());
  * PagesSettings pagesSettings = pagesSettingsBuilder.build();
- * 
- * 
+ * }
*/ -@Generated("by gapic-generator") -@BetaApi +@Generated("by gapic-generator-java") public class PagesSettings extends ClientSettings { + /** Returns the object with the settings used for calls to listPages. */ public PagedCallSettings listPagesSettings() { @@ -153,18 +154,15 @@ protected PagesSettings(Builder settingsBuilder) throws IOException { /** Builder for PagesSettings. */ public static class Builder extends ClientSettings.Builder { + protected Builder() throws IOException { - this((ClientContext) null); + this(((ClientContext) null)); } protected Builder(ClientContext clientContext) { super(PagesStubSettings.newBuilder(clientContext)); } - private static Builder createDefault() { - return new Builder(PagesStubSettings.newBuilder()); - } - protected Builder(PagesSettings settings) { super(settings.getStubSettings().toBuilder()); } @@ -173,11 +171,15 @@ protected Builder(PagesStubSettings.Builder stubSettings) { super(stubSettings); } + private static Builder createDefault() { + return new Builder(PagesStubSettings.newBuilder()); + } + public PagesStubSettings.Builder getStubSettingsBuilder() { return ((PagesStubSettings.Builder) getStubSettings()); } - // NEXT_MAJOR_VER: remove 'throws Exception' + // NEXT_MAJOR_VER: remove 'throws Exception'. /** * Applies the given settings updater function to all of the unary API methods in this service. * diff --git a/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3beta1/SessionEntityTypesClient.java b/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3beta1/SessionEntityTypesClient.java index c97b36bd7..a031cbe21 100644 --- a/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3beta1/SessionEntityTypesClient.java +++ b/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3beta1/SessionEntityTypesClient.java @@ -5,7 +5,7 @@ * 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 + * 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, @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.google.cloud.dialogflow.cx.v3beta1; import com.google.api.core.ApiFunction; @@ -35,7 +36,7 @@ import java.util.concurrent.TimeUnit; import javax.annotation.Generated; -// AUTO-GENERATED DOCUMENTATION AND SERVICE +// AUTO-GENERATED DOCUMENTATION AND CLASS. /** * Service Description: Service for managing * [SessionEntityTypes][google.cloud.dialogflow.cx.v3beta1.SessionEntityType]. @@ -43,16 +44,7 @@ *

This class provides the ability to make remote calls to the backing service through method * calls that map to API methods. Sample code to get started: * - *

- * 
- * try (SessionEntityTypesClient sessionEntityTypesClient = SessionEntityTypesClient.create()) {
- *   SessionEntityTypeName name = SessionEntityTypeName.ofProjectLocationAgentSessionEntityTypeName("[PROJECT]", "[LOCATION]", "[AGENT]", "[SESSION]", "[ENTITY_TYPE]");
- *   SessionEntityType response = sessionEntityTypesClient.getSessionEntityType(name);
- * }
- * 
- * 
- * - *

Note: close() needs to be called on the sessionEntityTypesClient object to clean up resources + *

Note: close() needs to be called on the SessionEntityTypesClient object to clean up resources * such as threads. In the example above, try-with-resources is used, which automatically calls * close(). * @@ -81,30 +73,28 @@ * *

To customize credentials: * - *

- * 
+ * 
{@code
  * SessionEntityTypesSettings sessionEntityTypesSettings =
  *     SessionEntityTypesSettings.newBuilder()
  *         .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
  *         .build();
  * SessionEntityTypesClient sessionEntityTypesClient =
  *     SessionEntityTypesClient.create(sessionEntityTypesSettings);
- * 
- * 
+ * }
* - * To customize the endpoint: + *

To customize the endpoint: * - *

- * 
+ * 
{@code
  * SessionEntityTypesSettings sessionEntityTypesSettings =
  *     SessionEntityTypesSettings.newBuilder().setEndpoint(myEndpoint).build();
  * SessionEntityTypesClient sessionEntityTypesClient =
  *     SessionEntityTypesClient.create(sessionEntityTypesSettings);
- * 
- * 
+ * }
+ * + *

Please refer to the GitHub repository's samples for more quickstart code snippets. */ -@Generated("by gapic-generator") @BetaApi +@Generated("by gapic-generator") public class SessionEntityTypesClient implements BackgroundResource { private final SessionEntityTypesSettings settings; private final SessionEntityTypesStub stub; @@ -125,7 +115,7 @@ public static final SessionEntityTypesClient create(SessionEntityTypesSettings s /** * Constructs an instance of SessionEntityTypesClient, using the given stub for making calls. This - * is for advanced usage - prefer to use SessionEntityTypesSettings}. + * is for advanced usage - prefer using create(SessionEntityTypesSettings). */ @BetaApi("A restructuring of stub classes is planned, so this may break in the future") public static final SessionEntityTypesClient create(SessionEntityTypesStub stub) { @@ -157,21 +147,10 @@ public SessionEntityTypesStub getStub() { return stub; } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Returns the list of all session entity types in the specified session. * - *

Sample code: - * - *


-   * try (SessionEntityTypesClient sessionEntityTypesClient = SessionEntityTypesClient.create()) {
-   *   SessionName parent = SessionName.ofProjectLocationAgentSessionName("[PROJECT]", "[LOCATION]", "[AGENT]", "[SESSION]");
-   *   for (SessionEntityType element : sessionEntityTypesClient.listSessionEntityTypes(parent).iterateAll()) {
-   *     // doThingsWith(element);
-   *   }
-   * }
-   * 
- * * @param parent Required. The session to list all session entity types from. Format: * `projects/<Project ID>/locations/<Location ID>/agents/<Agent * ID>/sessions/<Session ID>` or `projects/<Project ID>/locations/<Location @@ -187,21 +166,10 @@ public final ListSessionEntityTypesPagedResponse listSessionEntityTypes(SessionN return listSessionEntityTypes(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Returns the list of all session entity types in the specified session. * - *

Sample code: - * - *


-   * try (SessionEntityTypesClient sessionEntityTypesClient = SessionEntityTypesClient.create()) {
-   *   SessionName parent = SessionName.ofProjectLocationAgentSessionName("[PROJECT]", "[LOCATION]", "[AGENT]", "[SESSION]");
-   *   for (SessionEntityType element : sessionEntityTypesClient.listSessionEntityTypes(parent.toString()).iterateAll()) {
-   *     // doThingsWith(element);
-   *   }
-   * }
-   * 
- * * @param parent Required. The session to list all session entity types from. Format: * `projects/<Project ID>/locations/<Location ID>/agents/<Agent * ID>/sessions/<Session ID>` or `projects/<Project ID>/locations/<Location @@ -215,24 +183,10 @@ public final ListSessionEntityTypesPagedResponse listSessionEntityTypes(String p return listSessionEntityTypes(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Returns the list of all session entity types in the specified session. * - *

Sample code: - * - *


-   * try (SessionEntityTypesClient sessionEntityTypesClient = SessionEntityTypesClient.create()) {
-   *   SessionName parent = SessionName.ofProjectLocationAgentSessionName("[PROJECT]", "[LOCATION]", "[AGENT]", "[SESSION]");
-   *   ListSessionEntityTypesRequest request = ListSessionEntityTypesRequest.newBuilder()
-   *     .setParent(parent.toString())
-   *     .build();
-   *   for (SessionEntityType element : sessionEntityTypesClient.listSessionEntityTypes(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 */ @@ -241,76 +195,32 @@ public final ListSessionEntityTypesPagedResponse listSessionEntityTypes( return listSessionEntityTypesPagedCallable().call(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Returns the list of all session entity types in the specified session. * *

Sample code: - * - *


-   * try (SessionEntityTypesClient sessionEntityTypesClient = SessionEntityTypesClient.create()) {
-   *   SessionName parent = SessionName.ofProjectLocationAgentSessionName("[PROJECT]", "[LOCATION]", "[AGENT]", "[SESSION]");
-   *   ListSessionEntityTypesRequest request = ListSessionEntityTypesRequest.newBuilder()
-   *     .setParent(parent.toString())
-   *     .build();
-   *   ApiFuture<ListSessionEntityTypesPagedResponse> future = sessionEntityTypesClient.listSessionEntityTypesPagedCallable().futureCall(request);
-   *   // Do something
-   *   for (SessionEntityType element : future.get().iterateAll()) {
-   *     // doThingsWith(element);
-   *   }
-   * }
-   * 
*/ public final UnaryCallable listSessionEntityTypesPagedCallable() { return stub.listSessionEntityTypesPagedCallable(); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Returns the list of all session entity types in the specified session. * *

Sample code: - * - *


-   * try (SessionEntityTypesClient sessionEntityTypesClient = SessionEntityTypesClient.create()) {
-   *   SessionName parent = SessionName.ofProjectLocationAgentSessionName("[PROJECT]", "[LOCATION]", "[AGENT]", "[SESSION]");
-   *   ListSessionEntityTypesRequest request = ListSessionEntityTypesRequest.newBuilder()
-   *     .setParent(parent.toString())
-   *     .build();
-   *   while (true) {
-   *     ListSessionEntityTypesResponse response = sessionEntityTypesClient.listSessionEntityTypesCallable().call(request);
-   *     for (SessionEntityType element : response.getSessionEntityTypesList()) {
-   *       // doThingsWith(element);
-   *     }
-   *     String nextPageToken = response.getNextPageToken();
-   *     if (!Strings.isNullOrEmpty(nextPageToken)) {
-   *       request = request.toBuilder().setPageToken(nextPageToken).build();
-   *     } else {
-   *       break;
-   *     }
-   *   }
-   * }
-   * 
*/ public final UnaryCallable listSessionEntityTypesCallable() { return stub.listSessionEntityTypesCallable(); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Retrieves the specified session entity type. * - *

Sample code: - * - *


-   * try (SessionEntityTypesClient sessionEntityTypesClient = SessionEntityTypesClient.create()) {
-   *   SessionEntityTypeName name = SessionEntityTypeName.ofProjectLocationAgentSessionEntityTypeName("[PROJECT]", "[LOCATION]", "[AGENT]", "[SESSION]", "[ENTITY_TYPE]");
-   *   SessionEntityType response = sessionEntityTypesClient.getSessionEntityType(name);
-   * }
-   * 
- * * @param name Required. The name of the session entity type. Format: `projects/<Project * ID>/locations/<Location ID>/agents/<Agent ID>/sessions/<Session * ID>/entityTypes/<Entity Type ID>` or `projects/<Project @@ -327,19 +237,10 @@ public final SessionEntityType getSessionEntityType(SessionEntityTypeName name) return getSessionEntityType(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Retrieves the specified session entity type. * - *

Sample code: - * - *


-   * try (SessionEntityTypesClient sessionEntityTypesClient = SessionEntityTypesClient.create()) {
-   *   SessionEntityTypeName name = SessionEntityTypeName.ofProjectLocationAgentSessionEntityTypeName("[PROJECT]", "[LOCATION]", "[AGENT]", "[SESSION]", "[ENTITY_TYPE]");
-   *   SessionEntityType response = sessionEntityTypesClient.getSessionEntityType(name.toString());
-   * }
-   * 
- * * @param name Required. The name of the session entity type. Format: `projects/<Project * ID>/locations/<Location ID>/agents/<Agent ID>/sessions/<Session * ID>/entityTypes/<Entity Type ID>` or `projects/<Project @@ -354,22 +255,10 @@ public final SessionEntityType getSessionEntityType(String name) { return getSessionEntityType(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Retrieves the specified session entity type. * - *

Sample code: - * - *


-   * try (SessionEntityTypesClient sessionEntityTypesClient = SessionEntityTypesClient.create()) {
-   *   SessionEntityTypeName name = SessionEntityTypeName.ofProjectLocationAgentSessionEntityTypeName("[PROJECT]", "[LOCATION]", "[AGENT]", "[SESSION]", "[ENTITY_TYPE]");
-   *   GetSessionEntityTypeRequest request = GetSessionEntityTypeRequest.newBuilder()
-   *     .setName(name.toString())
-   *     .build();
-   *   SessionEntityType response = sessionEntityTypesClient.getSessionEntityType(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 */ @@ -377,45 +266,23 @@ public final SessionEntityType getSessionEntityType(GetSessionEntityTypeRequest return getSessionEntityTypeCallable().call(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Retrieves the specified session entity type. * *

Sample code: - * - *


-   * try (SessionEntityTypesClient sessionEntityTypesClient = SessionEntityTypesClient.create()) {
-   *   SessionEntityTypeName name = SessionEntityTypeName.ofProjectLocationAgentSessionEntityTypeName("[PROJECT]", "[LOCATION]", "[AGENT]", "[SESSION]", "[ENTITY_TYPE]");
-   *   GetSessionEntityTypeRequest request = GetSessionEntityTypeRequest.newBuilder()
-   *     .setName(name.toString())
-   *     .build();
-   *   ApiFuture<SessionEntityType> future = sessionEntityTypesClient.getSessionEntityTypeCallable().futureCall(request);
-   *   // Do something
-   *   SessionEntityType response = future.get();
-   * }
-   * 
*/ public final UnaryCallable getSessionEntityTypeCallable() { return stub.getSessionEntityTypeCallable(); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Creates a session entity type. * *

If the specified session entity type already exists, overrides the session entity type. * - *

Sample code: - * - *


-   * try (SessionEntityTypesClient sessionEntityTypesClient = SessionEntityTypesClient.create()) {
-   *   SessionName parent = SessionName.ofProjectLocationAgentSessionName("[PROJECT]", "[LOCATION]", "[AGENT]", "[SESSION]");
-   *   SessionEntityType sessionEntityType = SessionEntityType.newBuilder().build();
-   *   SessionEntityType response = sessionEntityTypesClient.createSessionEntityType(parent, sessionEntityType);
-   * }
-   * 
- * * @param parent Required. The session to create a session entity type for. Format: * `projects/<Project ID>/locations/<Location ID>/agents/<Agent * ID>/sessions/<Session ID>` or `projects/<Project ID>/locations/<Location @@ -434,22 +301,12 @@ public final SessionEntityType createSessionEntityType( return createSessionEntityType(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Creates a session entity type. * *

If the specified session entity type already exists, overrides the session entity type. * - *

Sample code: - * - *


-   * try (SessionEntityTypesClient sessionEntityTypesClient = SessionEntityTypesClient.create()) {
-   *   SessionName parent = SessionName.ofProjectLocationAgentSessionName("[PROJECT]", "[LOCATION]", "[AGENT]", "[SESSION]");
-   *   SessionEntityType sessionEntityType = SessionEntityType.newBuilder().build();
-   *   SessionEntityType response = sessionEntityTypesClient.createSessionEntityType(parent.toString(), sessionEntityType);
-   * }
-   * 
- * * @param parent Required. The session to create a session entity type for. Format: * `projects/<Project ID>/locations/<Location ID>/agents/<Agent * ID>/sessions/<Session ID>` or `projects/<Project ID>/locations/<Location @@ -468,26 +325,12 @@ public final SessionEntityType createSessionEntityType( return createSessionEntityType(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Creates a session entity type. * *

If the specified session entity type already exists, overrides the session entity type. * - *

Sample code: - * - *


-   * try (SessionEntityTypesClient sessionEntityTypesClient = SessionEntityTypesClient.create()) {
-   *   SessionName parent = SessionName.ofProjectLocationAgentSessionName("[PROJECT]", "[LOCATION]", "[AGENT]", "[SESSION]");
-   *   SessionEntityType sessionEntityType = SessionEntityType.newBuilder().build();
-   *   CreateSessionEntityTypeRequest request = CreateSessionEntityTypeRequest.newBuilder()
-   *     .setParent(parent.toString())
-   *     .setSessionEntityType(sessionEntityType)
-   *     .build();
-   *   SessionEntityType response = sessionEntityTypesClient.createSessionEntityType(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 */ @@ -495,47 +338,23 @@ public final SessionEntityType createSessionEntityType(CreateSessionEntityTypeRe return createSessionEntityTypeCallable().call(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Creates a session entity type. * *

If the specified session entity type already exists, overrides the session entity type. * *

Sample code: - * - *


-   * try (SessionEntityTypesClient sessionEntityTypesClient = SessionEntityTypesClient.create()) {
-   *   SessionName parent = SessionName.ofProjectLocationAgentSessionName("[PROJECT]", "[LOCATION]", "[AGENT]", "[SESSION]");
-   *   SessionEntityType sessionEntityType = SessionEntityType.newBuilder().build();
-   *   CreateSessionEntityTypeRequest request = CreateSessionEntityTypeRequest.newBuilder()
-   *     .setParent(parent.toString())
-   *     .setSessionEntityType(sessionEntityType)
-   *     .build();
-   *   ApiFuture<SessionEntityType> future = sessionEntityTypesClient.createSessionEntityTypeCallable().futureCall(request);
-   *   // Do something
-   *   SessionEntityType response = future.get();
-   * }
-   * 
*/ public final UnaryCallable createSessionEntityTypeCallable() { return stub.createSessionEntityTypeCallable(); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Updates the specified session entity type. * - *

Sample code: - * - *


-   * try (SessionEntityTypesClient sessionEntityTypesClient = SessionEntityTypesClient.create()) {
-   *   SessionEntityType sessionEntityType = SessionEntityType.newBuilder().build();
-   *   FieldMask updateMask = FieldMask.newBuilder().build();
-   *   SessionEntityType response = sessionEntityTypesClient.updateSessionEntityType(sessionEntityType, updateMask);
-   * }
-   * 
- * * @param sessionEntityType Required. The session entity type to update. Format: * `projects/<Project ID>/locations/<Location ID>/agents/<Agent * ID>/sessions/<Session ID>/entityTypes/<Entity Type ID>` or @@ -556,22 +375,10 @@ public final SessionEntityType updateSessionEntityType( return updateSessionEntityType(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Updates the specified session entity type. * - *

Sample code: - * - *


-   * try (SessionEntityTypesClient sessionEntityTypesClient = SessionEntityTypesClient.create()) {
-   *   SessionEntityType sessionEntityType = SessionEntityType.newBuilder().build();
-   *   UpdateSessionEntityTypeRequest request = UpdateSessionEntityTypeRequest.newBuilder()
-   *     .setSessionEntityType(sessionEntityType)
-   *     .build();
-   *   SessionEntityType response = sessionEntityTypesClient.updateSessionEntityType(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 */ @@ -579,42 +386,21 @@ public final SessionEntityType updateSessionEntityType(UpdateSessionEntityTypeRe return updateSessionEntityTypeCallable().call(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Updates the specified session entity type. * *

Sample code: - * - *


-   * try (SessionEntityTypesClient sessionEntityTypesClient = SessionEntityTypesClient.create()) {
-   *   SessionEntityType sessionEntityType = SessionEntityType.newBuilder().build();
-   *   UpdateSessionEntityTypeRequest request = UpdateSessionEntityTypeRequest.newBuilder()
-   *     .setSessionEntityType(sessionEntityType)
-   *     .build();
-   *   ApiFuture<SessionEntityType> future = sessionEntityTypesClient.updateSessionEntityTypeCallable().futureCall(request);
-   *   // Do something
-   *   SessionEntityType response = future.get();
-   * }
-   * 
*/ public final UnaryCallable updateSessionEntityTypeCallable() { return stub.updateSessionEntityTypeCallable(); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Deletes the specified session entity type. * - *

Sample code: - * - *


-   * try (SessionEntityTypesClient sessionEntityTypesClient = SessionEntityTypesClient.create()) {
-   *   SessionEntityTypeName name = SessionEntityTypeName.ofProjectLocationAgentSessionEntityTypeName("[PROJECT]", "[LOCATION]", "[AGENT]", "[SESSION]", "[ENTITY_TYPE]");
-   *   sessionEntityTypesClient.deleteSessionEntityType(name);
-   * }
-   * 
- * * @param name Required. The name of the session entity type to delete. Format: * `projects/<Project ID>/locations/<Location ID>/agents/<Agent * ID>/sessions/<Session ID>/entityTypes/<Entity Type ID>` or @@ -632,19 +418,10 @@ public final void deleteSessionEntityType(SessionEntityTypeName name) { deleteSessionEntityType(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Deletes the specified session entity type. * - *

Sample code: - * - *


-   * try (SessionEntityTypesClient sessionEntityTypesClient = SessionEntityTypesClient.create()) {
-   *   SessionEntityTypeName name = SessionEntityTypeName.ofProjectLocationAgentSessionEntityTypeName("[PROJECT]", "[LOCATION]", "[AGENT]", "[SESSION]", "[ENTITY_TYPE]");
-   *   sessionEntityTypesClient.deleteSessionEntityType(name.toString());
-   * }
-   * 
- * * @param name Required. The name of the session entity type to delete. Format: * `projects/<Project ID>/locations/<Location ID>/agents/<Agent * ID>/sessions/<Session ID>/entityTypes/<Entity Type ID>` or @@ -660,22 +437,10 @@ public final void deleteSessionEntityType(String name) { deleteSessionEntityType(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Deletes the specified session entity type. * - *

Sample code: - * - *


-   * try (SessionEntityTypesClient sessionEntityTypesClient = SessionEntityTypesClient.create()) {
-   *   SessionEntityTypeName name = SessionEntityTypeName.ofProjectLocationAgentSessionEntityTypeName("[PROJECT]", "[LOCATION]", "[AGENT]", "[SESSION]", "[ENTITY_TYPE]");
-   *   DeleteSessionEntityTypeRequest request = DeleteSessionEntityTypeRequest.newBuilder()
-   *     .setName(name.toString())
-   *     .build();
-   *   sessionEntityTypesClient.deleteSessionEntityType(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 */ @@ -683,23 +448,11 @@ public final void deleteSessionEntityType(DeleteSessionEntityTypeRequest request deleteSessionEntityTypeCallable().call(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Deletes the specified session entity type. * *

Sample code: - * - *


-   * try (SessionEntityTypesClient sessionEntityTypesClient = SessionEntityTypesClient.create()) {
-   *   SessionEntityTypeName name = SessionEntityTypeName.ofProjectLocationAgentSessionEntityTypeName("[PROJECT]", "[LOCATION]", "[AGENT]", "[SESSION]", "[ENTITY_TYPE]");
-   *   DeleteSessionEntityTypeRequest request = DeleteSessionEntityTypeRequest.newBuilder()
-   *     .setName(name.toString())
-   *     .build();
-   *   ApiFuture<Void> future = sessionEntityTypesClient.deleteSessionEntityTypeCallable().futureCall(request);
-   *   // Do something
-   *   future.get();
-   * }
-   * 
*/ public final UnaryCallable deleteSessionEntityTypeCallable() { diff --git a/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3beta1/SessionEntityTypesSettings.java b/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3beta1/SessionEntityTypesSettings.java index 803ee9c52..901eb8107 100644 --- a/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3beta1/SessionEntityTypesSettings.java +++ b/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3beta1/SessionEntityTypesSettings.java @@ -5,7 +5,7 @@ * 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 + * 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, @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.google.cloud.dialogflow.cx.v3beta1; import static com.google.cloud.dialogflow.cx.v3beta1.SessionEntityTypesClient.ListSessionEntityTypesPagedResponse; @@ -34,7 +35,7 @@ import java.util.List; import javax.annotation.Generated; -// AUTO-GENERATED DOCUMENTATION AND CLASS +// AUTO-GENERATED DOCUMENTATION AND CLASS. /** * Settings class to configure an instance of {@link SessionEntityTypesClient}. * @@ -51,23 +52,25 @@ * *

For example, to set the total timeout of getSessionEntityType to 30 seconds: * - *

- * 
+ * 
{@code
  * SessionEntityTypesSettings.Builder sessionEntityTypesSettingsBuilder =
  *     SessionEntityTypesSettings.newBuilder();
  * sessionEntityTypesSettingsBuilder
  *     .getSessionEntityTypeSettings()
  *     .setRetrySettings(
- *         sessionEntityTypesSettingsBuilder.getSessionEntityTypeSettings().getRetrySettings().toBuilder()
+ *         sessionEntityTypesSettingsBuilder
+ *             .getSessionEntityTypeSettings()
+ *             .getRetrySettings()
+ *             .toBuilder()
  *             .setTotalTimeout(Duration.ofSeconds(30))
  *             .build());
- * SessionEntityTypesSettings sessionEntityTypesSettings = sessionEntityTypesSettingsBuilder.build();
- * 
- * 
+ * SessionEntityTypesSettings sessionEntityTypesSettings = + * sessionEntityTypesSettingsBuilder.build(); + * }
*/ -@Generated("by gapic-generator") -@BetaApi +@Generated("by gapic-generator-java") public class SessionEntityTypesSettings extends ClientSettings { + /** Returns the object with the settings used for calls to listSessionEntityTypes. */ public PagedCallSettings< ListSessionEntityTypesRequest, @@ -161,18 +164,15 @@ protected SessionEntityTypesSettings(Builder settingsBuilder) throws IOException /** Builder for SessionEntityTypesSettings. */ public static class Builder extends ClientSettings.Builder { + protected Builder() throws IOException { - this((ClientContext) null); + this(((ClientContext) null)); } protected Builder(ClientContext clientContext) { super(SessionEntityTypesStubSettings.newBuilder(clientContext)); } - private static Builder createDefault() { - return new Builder(SessionEntityTypesStubSettings.newBuilder()); - } - protected Builder(SessionEntityTypesSettings settings) { super(settings.getStubSettings().toBuilder()); } @@ -181,11 +181,15 @@ protected Builder(SessionEntityTypesStubSettings.Builder stubSettings) { super(stubSettings); } + private static Builder createDefault() { + return new Builder(SessionEntityTypesStubSettings.newBuilder()); + } + public SessionEntityTypesStubSettings.Builder getStubSettingsBuilder() { return ((SessionEntityTypesStubSettings.Builder) getStubSettings()); } - // NEXT_MAJOR_VER: remove 'throws Exception' + // NEXT_MAJOR_VER: remove 'throws Exception'. /** * Applies the given settings updater function to all of the unary API methods in this service. * diff --git a/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3beta1/SessionsClient.java b/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3beta1/SessionsClient.java index b04f28d08..9c58e1f25 100644 --- a/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3beta1/SessionsClient.java +++ b/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3beta1/SessionsClient.java @@ -5,7 +5,7 @@ * 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 + * 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, @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.google.cloud.dialogflow.cx.v3beta1; import com.google.api.core.BetaApi; @@ -25,7 +26,7 @@ import java.util.concurrent.TimeUnit; import javax.annotation.Generated; -// AUTO-GENERATED DOCUMENTATION AND SERVICE +// AUTO-GENERATED DOCUMENTATION AND CLASS. /** * Service Description: A session represents an interaction with a user. You retrieve user input and * pass it to the [DetectIntent][google.cloud.dialogflow.cx.v3beta1.Sessions.DetectIntent] method to @@ -34,21 +35,7 @@ *

This class provides the ability to make remote calls to the backing service through method * calls that map to API methods. Sample code to get started: * - *

- * 
- * try (SessionsClient sessionsClient = SessionsClient.create()) {
- *   SessionName session = SessionName.ofProjectLocationAgentSessionName("[PROJECT]", "[LOCATION]", "[AGENT]", "[SESSION]");
- *   QueryInput queryInput = QueryInput.newBuilder().build();
- *   DetectIntentRequest request = DetectIntentRequest.newBuilder()
- *     .setSession(session.toString())
- *     .setQueryInput(queryInput)
- *     .build();
- *   DetectIntentResponse response = sessionsClient.detectIntent(request);
- * }
- * 
- * 
- * - *

Note: close() needs to be called on the sessionsClient object to clean up resources such as + *

Note: close() needs to be called on the SessionsClient object to clean up resources such as * threads. In the example above, try-with-resources is used, which automatically calls close(). * *

The surface of this class includes several types of Java methods for each of the API's @@ -76,30 +63,26 @@ * *

To customize credentials: * - *

- * 
+ * 
{@code
  * SessionsSettings sessionsSettings =
  *     SessionsSettings.newBuilder()
  *         .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
  *         .build();
- * SessionsClient sessionsClient =
- *     SessionsClient.create(sessionsSettings);
- * 
- * 
+ * SessionsClient sessionsClient = SessionsClient.create(sessionsSettings); + * }
* - * To customize the endpoint: + *

To customize the endpoint: * - *

- * 
+ * 
{@code
  * SessionsSettings sessionsSettings =
  *     SessionsSettings.newBuilder().setEndpoint(myEndpoint).build();
- * SessionsClient sessionsClient =
- *     SessionsClient.create(sessionsSettings);
- * 
- * 
+ * SessionsClient sessionsClient = SessionsClient.create(sessionsSettings); + * }
+ * + *

Please refer to the GitHub repository's samples for more quickstart code snippets. */ -@Generated("by gapic-generator") @BetaApi +@Generated("by gapic-generator") public class SessionsClient implements BackgroundResource { private final SessionsSettings settings; private final SessionsStub stub; @@ -119,7 +102,7 @@ public static final SessionsClient create(SessionsSettings settings) throws IOEx /** * Constructs an instance of SessionsClient, using the given stub for making calls. This is for - * advanced usage - prefer to use SessionsSettings}. + * advanced usage - prefer using create(SessionsSettings). */ @BetaApi("A restructuring of stub classes is planned, so this may break in the future") public static final SessionsClient create(SessionsStub stub) { @@ -150,25 +133,14 @@ public SessionsStub getStub() { return stub; } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Processes a natural language query and returns structured, actionable data as a result. This * method is not idempotent, because it may cause session entity types to be updated, which in * turn might affect results of future queries. * - *

Sample code: - * - *


-   * try (SessionsClient sessionsClient = SessionsClient.create()) {
-   *   SessionName session = SessionName.ofProjectLocationAgentSessionName("[PROJECT]", "[LOCATION]", "[AGENT]", "[SESSION]");
-   *   QueryInput queryInput = QueryInput.newBuilder().build();
-   *   DetectIntentRequest request = DetectIntentRequest.newBuilder()
-   *     .setSession(session.toString())
-   *     .setQueryInput(queryInput)
-   *     .build();
-   *   DetectIntentResponse response = sessionsClient.detectIntent(request);
-   * }
-   * 
+ *

Note: Always use agent versions for production traffic. See [Versions and + * environments](https://cloud.google.com/dialogflow/cx/docs/concept/version). * * @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 @@ -177,79 +149,41 @@ public final DetectIntentResponse detectIntent(DetectIntentRequest request) { return detectIntentCallable().call(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Processes a natural language query and returns structured, actionable data as a result. This * method is not idempotent, because it may cause session entity types to be updated, which in * turn might affect results of future queries. * - *

Sample code: + *

Note: Always use agent versions for production traffic. See [Versions and + * environments](https://cloud.google.com/dialogflow/cx/docs/concept/version). * - *


-   * try (SessionsClient sessionsClient = SessionsClient.create()) {
-   *   SessionName session = SessionName.ofProjectLocationAgentSessionName("[PROJECT]", "[LOCATION]", "[AGENT]", "[SESSION]");
-   *   QueryInput queryInput = QueryInput.newBuilder().build();
-   *   DetectIntentRequest request = DetectIntentRequest.newBuilder()
-   *     .setSession(session.toString())
-   *     .setQueryInput(queryInput)
-   *     .build();
-   *   ApiFuture<DetectIntentResponse> future = sessionsClient.detectIntentCallable().futureCall(request);
-   *   // Do something
-   *   DetectIntentResponse response = future.get();
-   * }
-   * 
+ *

Sample code: */ public final UnaryCallable detectIntentCallable() { return stub.detectIntentCallable(); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Processes a natural language query in audio format in a streaming fashion and returns * structured, actionable data as a result. This method is only available via the gRPC API (not * REST). * - *

Sample code: - * - *


-   * try (SessionsClient sessionsClient = SessionsClient.create()) {
-   *   BidiStream<StreamingDetectIntentRequest, StreamingDetectIntentResponse> bidiStream =
-   *       sessionsClient.streamingDetectIntentCallable().call();
+   * 

Note: Always use agent versions for production traffic. See [Versions and + * environments](https://cloud.google.com/dialogflow/cx/docs/concept/version). * - * QueryInput queryInput = QueryInput.newBuilder().build(); - * StreamingDetectIntentRequest request = StreamingDetectIntentRequest.newBuilder() - * .setQueryInput(queryInput) - * .build(); - * bidiStream.send(request); - * for (StreamingDetectIntentResponse response : bidiStream) { - * // Do something when receive a response - * } - * } - *

+ *

Sample code: */ public final BidiStreamingCallable streamingDetectIntentCallable() { return stub.streamingDetectIntentCallable(); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Returns preliminary intent match results, doesn't change the session status. * - *

Sample code: - * - *


-   * try (SessionsClient sessionsClient = SessionsClient.create()) {
-   *   SessionName session = SessionName.ofProjectLocationAgentSessionName("[PROJECT]", "[LOCATION]", "[AGENT]", "[SESSION]");
-   *   QueryInput queryInput = QueryInput.newBuilder().build();
-   *   MatchIntentRequest request = MatchIntentRequest.newBuilder()
-   *     .setSession(session.toString())
-   *     .setQueryInput(queryInput)
-   *     .build();
-   *   MatchIntentResponse response = sessionsClient.matchIntent(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 */ @@ -257,31 +191,17 @@ public final MatchIntentResponse matchIntent(MatchIntentRequest request) { return matchIntentCallable().call(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Returns preliminary intent match results, doesn't change the session status. * *

Sample code: - * - *


-   * try (SessionsClient sessionsClient = SessionsClient.create()) {
-   *   SessionName session = SessionName.ofProjectLocationAgentSessionName("[PROJECT]", "[LOCATION]", "[AGENT]", "[SESSION]");
-   *   QueryInput queryInput = QueryInput.newBuilder().build();
-   *   MatchIntentRequest request = MatchIntentRequest.newBuilder()
-   *     .setSession(session.toString())
-   *     .setQueryInput(queryInput)
-   *     .build();
-   *   ApiFuture<MatchIntentResponse> future = sessionsClient.matchIntentCallable().futureCall(request);
-   *   // Do something
-   *   MatchIntentResponse response = future.get();
-   * }
-   * 
*/ public final UnaryCallable matchIntentCallable() { return stub.matchIntentCallable(); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Fulfills a matched intent returned by * [MatchIntent][google.cloud.dialogflow.cx.v3beta1.Sessions.MatchIntent]. Must be called after @@ -289,15 +209,6 @@ public final UnaryCallable matchIntentC * [MatchIntentResponse][google.cloud.dialogflow.cx.v3beta1.MatchIntentResponse]. Otherwise, the * behavior is undefined. * - *

Sample code: - * - *


-   * try (SessionsClient sessionsClient = SessionsClient.create()) {
-   *   FulfillIntentRequest request = FulfillIntentRequest.newBuilder().build();
-   *   FulfillIntentResponse response = sessionsClient.fulfillIntent(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 */ @@ -305,7 +216,7 @@ public final FulfillIntentResponse fulfillIntent(FulfillIntentRequest request) { return fulfillIntentCallable().call(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Fulfills a matched intent returned by * [MatchIntent][google.cloud.dialogflow.cx.v3beta1.Sessions.MatchIntent]. Must be called after @@ -314,15 +225,6 @@ public final FulfillIntentResponse fulfillIntent(FulfillIntentRequest request) { * behavior is undefined. * *

Sample code: - * - *


-   * try (SessionsClient sessionsClient = SessionsClient.create()) {
-   *   FulfillIntentRequest request = FulfillIntentRequest.newBuilder().build();
-   *   ApiFuture<FulfillIntentResponse> future = sessionsClient.fulfillIntentCallable().futureCall(request);
-   *   // Do something
-   *   FulfillIntentResponse response = future.get();
-   * }
-   * 
*/ public final UnaryCallable fulfillIntentCallable() { return stub.fulfillIntentCallable(); diff --git a/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3beta1/SessionsSettings.java b/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3beta1/SessionsSettings.java index 709df6271..c8eaf4bc3 100644 --- a/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3beta1/SessionsSettings.java +++ b/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3beta1/SessionsSettings.java @@ -5,7 +5,7 @@ * 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 + * 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, @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.google.cloud.dialogflow.cx.v3beta1; import com.google.api.core.ApiFunction; @@ -31,7 +32,7 @@ import java.util.List; import javax.annotation.Generated; -// AUTO-GENERATED DOCUMENTATION AND CLASS +// AUTO-GENERATED DOCUMENTATION AND CLASS. /** * Settings class to configure an instance of {@link SessionsClient}. * @@ -48,23 +49,23 @@ * *

For example, to set the total timeout of detectIntent to 30 seconds: * - *

- * 
- * SessionsSettings.Builder sessionsSettingsBuilder =
- *     SessionsSettings.newBuilder();
+ * 
{@code
+ * SessionsSettings.Builder sessionsSettingsBuilder = SessionsSettings.newBuilder();
  * sessionsSettingsBuilder
  *     .detectIntentSettings()
  *     .setRetrySettings(
- *         sessionsSettingsBuilder.detectIntentSettings().getRetrySettings().toBuilder()
+ *         sessionsSettingsBuilder
+ *             .detectIntentSettings()
+ *             .getRetrySettings()
+ *             .toBuilder()
  *             .setTotalTimeout(Duration.ofSeconds(30))
  *             .build());
  * SessionsSettings sessionsSettings = sessionsSettingsBuilder.build();
- * 
- * 
+ * }
*/ -@Generated("by gapic-generator") -@BetaApi +@Generated("by gapic-generator-java") public class SessionsSettings extends ClientSettings { + /** Returns the object with the settings used for calls to detectIntent. */ public UnaryCallSettings detectIntentSettings() { return ((SessionsStubSettings) getStubSettings()).detectIntentSettings(); @@ -145,18 +146,15 @@ protected SessionsSettings(Builder settingsBuilder) throws IOException { /** Builder for SessionsSettings. */ public static class Builder extends ClientSettings.Builder { + protected Builder() throws IOException { - this((ClientContext) null); + this(((ClientContext) null)); } protected Builder(ClientContext clientContext) { super(SessionsStubSettings.newBuilder(clientContext)); } - private static Builder createDefault() { - return new Builder(SessionsStubSettings.newBuilder()); - } - protected Builder(SessionsSettings settings) { super(settings.getStubSettings().toBuilder()); } @@ -165,11 +163,15 @@ protected Builder(SessionsStubSettings.Builder stubSettings) { super(stubSettings); } + private static Builder createDefault() { + return new Builder(SessionsStubSettings.newBuilder()); + } + public SessionsStubSettings.Builder getStubSettingsBuilder() { return ((SessionsStubSettings.Builder) getStubSettings()); } - // NEXT_MAJOR_VER: remove 'throws Exception' + // NEXT_MAJOR_VER: remove 'throws Exception'. /** * Applies the given settings updater function to all of the unary API methods in this service. * diff --git a/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3beta1/TransitionRouteGroupsClient.java b/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3beta1/TransitionRouteGroupsClient.java index 4e8361932..9d99d6894 100644 --- a/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3beta1/TransitionRouteGroupsClient.java +++ b/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3beta1/TransitionRouteGroupsClient.java @@ -5,7 +5,7 @@ * 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 + * 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, @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.google.cloud.dialogflow.cx.v3beta1; import com.google.api.core.ApiFunction; @@ -35,7 +36,7 @@ import java.util.concurrent.TimeUnit; import javax.annotation.Generated; -// AUTO-GENERATED DOCUMENTATION AND SERVICE +// AUTO-GENERATED DOCUMENTATION AND CLASS. /** * Service Description: Service for managing * [TransitionRouteGroups][google.cloud.dialogflow.cx.v3beta1.TransitionRouteGroup]. @@ -43,16 +44,7 @@ *

This class provides the ability to make remote calls to the backing service through method * calls that map to API methods. Sample code to get started: * - *

- * 
- * try (TransitionRouteGroupsClient transitionRouteGroupsClient = TransitionRouteGroupsClient.create()) {
- *   TransitionRouteGroupName name = TransitionRouteGroupName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]", "[TRANSITION_ROUTE_GROUP]");
- *   TransitionRouteGroup response = transitionRouteGroupsClient.getTransitionRouteGroup(name);
- * }
- * 
- * 
- * - *

Note: close() needs to be called on the transitionRouteGroupsClient object to clean up + *

Note: close() needs to be called on the TransitionRouteGroupsClient object to clean up * resources such as threads. In the example above, try-with-resources is used, which automatically * calls close(). * @@ -81,30 +73,28 @@ * *

To customize credentials: * - *

- * 
+ * 
{@code
  * TransitionRouteGroupsSettings transitionRouteGroupsSettings =
  *     TransitionRouteGroupsSettings.newBuilder()
  *         .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
  *         .build();
  * TransitionRouteGroupsClient transitionRouteGroupsClient =
  *     TransitionRouteGroupsClient.create(transitionRouteGroupsSettings);
- * 
- * 
+ * }
* - * To customize the endpoint: + *

To customize the endpoint: * - *

- * 
+ * 
{@code
  * TransitionRouteGroupsSettings transitionRouteGroupsSettings =
  *     TransitionRouteGroupsSettings.newBuilder().setEndpoint(myEndpoint).build();
  * TransitionRouteGroupsClient transitionRouteGroupsClient =
  *     TransitionRouteGroupsClient.create(transitionRouteGroupsSettings);
- * 
- * 
+ * }
+ * + *

Please refer to the GitHub repository's samples for more quickstart code snippets. */ -@Generated("by gapic-generator") @BetaApi +@Generated("by gapic-generator") public class TransitionRouteGroupsClient implements BackgroundResource { private final TransitionRouteGroupsSettings settings; private final TransitionRouteGroupsStub stub; @@ -125,7 +115,7 @@ public static final TransitionRouteGroupsClient create(TransitionRouteGroupsSett /** * Constructs an instance of TransitionRouteGroupsClient, using the given stub for making calls. - * This is for advanced usage - prefer to use TransitionRouteGroupsSettings}. + * This is for advanced usage - prefer using create(TransitionRouteGroupsSettings). */ @BetaApi("A restructuring of stub classes is planned, so this may break in the future") public static final TransitionRouteGroupsClient create(TransitionRouteGroupsStub stub) { @@ -157,21 +147,10 @@ public TransitionRouteGroupsStub getStub() { return stub; } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Returns the list of all transition route groups in the specified flow. * - *

Sample code: - * - *


-   * try (TransitionRouteGroupsClient transitionRouteGroupsClient = TransitionRouteGroupsClient.create()) {
-   *   FlowName parent = FlowName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]");
-   *   for (TransitionRouteGroup element : transitionRouteGroupsClient.listTransitionRouteGroups(parent).iterateAll()) {
-   *     // doThingsWith(element);
-   *   }
-   * }
-   * 
- * * @param parent Required. The flow to list all transition route groups for. Format: * `projects/<Project ID>/locations/<Location ID>/agents/<Agent * ID>/flows/<Flow ID>`. @@ -185,21 +164,10 @@ public final ListTransitionRouteGroupsPagedResponse listTransitionRouteGroups(Fl return listTransitionRouteGroups(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Returns the list of all transition route groups in the specified flow. * - *

Sample code: - * - *


-   * try (TransitionRouteGroupsClient transitionRouteGroupsClient = TransitionRouteGroupsClient.create()) {
-   *   FlowName parent = FlowName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]");
-   *   for (TransitionRouteGroup element : transitionRouteGroupsClient.listTransitionRouteGroups(parent.toString()).iterateAll()) {
-   *     // doThingsWith(element);
-   *   }
-   * }
-   * 
- * * @param parent Required. The flow to list all transition route groups for. Format: * `projects/<Project ID>/locations/<Location ID>/agents/<Agent * ID>/flows/<Flow ID>`. @@ -211,24 +179,10 @@ public final ListTransitionRouteGroupsPagedResponse listTransitionRouteGroups(St return listTransitionRouteGroups(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Returns the list of all transition route groups in the specified flow. * - *

Sample code: - * - *


-   * try (TransitionRouteGroupsClient transitionRouteGroupsClient = TransitionRouteGroupsClient.create()) {
-   *   FlowName parent = FlowName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]");
-   *   ListTransitionRouteGroupsRequest request = ListTransitionRouteGroupsRequest.newBuilder()
-   *     .setParent(parent.toString())
-   *     .build();
-   *   for (TransitionRouteGroup element : transitionRouteGroupsClient.listTransitionRouteGroups(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 */ @@ -237,25 +191,11 @@ public final ListTransitionRouteGroupsPagedResponse listTransitionRouteGroups( return listTransitionRouteGroupsPagedCallable().call(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Returns the list of all transition route groups in the specified flow. * *

Sample code: - * - *


-   * try (TransitionRouteGroupsClient transitionRouteGroupsClient = TransitionRouteGroupsClient.create()) {
-   *   FlowName parent = FlowName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]");
-   *   ListTransitionRouteGroupsRequest request = ListTransitionRouteGroupsRequest.newBuilder()
-   *     .setParent(parent.toString())
-   *     .build();
-   *   ApiFuture<ListTransitionRouteGroupsPagedResponse> future = transitionRouteGroupsClient.listTransitionRouteGroupsPagedCallable().futureCall(request);
-   *   // Do something
-   *   for (TransitionRouteGroup element : future.get().iterateAll()) {
-   *     // doThingsWith(element);
-   *   }
-   * }
-   * 
*/ public final UnaryCallable< ListTransitionRouteGroupsRequest, ListTransitionRouteGroupsPagedResponse> @@ -263,52 +203,22 @@ public final ListTransitionRouteGroupsPagedResponse listTransitionRouteGroups( return stub.listTransitionRouteGroupsPagedCallable(); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Returns the list of all transition route groups in the specified flow. * *

Sample code: - * - *


-   * try (TransitionRouteGroupsClient transitionRouteGroupsClient = TransitionRouteGroupsClient.create()) {
-   *   FlowName parent = FlowName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]");
-   *   ListTransitionRouteGroupsRequest request = ListTransitionRouteGroupsRequest.newBuilder()
-   *     .setParent(parent.toString())
-   *     .build();
-   *   while (true) {
-   *     ListTransitionRouteGroupsResponse response = transitionRouteGroupsClient.listTransitionRouteGroupsCallable().call(request);
-   *     for (TransitionRouteGroup element : response.getTransitionRouteGroupsList()) {
-   *       // doThingsWith(element);
-   *     }
-   *     String nextPageToken = response.getNextPageToken();
-   *     if (!Strings.isNullOrEmpty(nextPageToken)) {
-   *       request = request.toBuilder().setPageToken(nextPageToken).build();
-   *     } else {
-   *       break;
-   *     }
-   *   }
-   * }
-   * 
*/ public final UnaryCallable listTransitionRouteGroupsCallable() { return stub.listTransitionRouteGroupsCallable(); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Retrieves the specified * [TransitionRouteGroup][google.cloud.dialogflow.cx.v3beta1.TransitionRouteGroup]. * - *

Sample code: - * - *


-   * try (TransitionRouteGroupsClient transitionRouteGroupsClient = TransitionRouteGroupsClient.create()) {
-   *   TransitionRouteGroupName name = TransitionRouteGroupName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]", "[TRANSITION_ROUTE_GROUP]");
-   *   TransitionRouteGroup response = transitionRouteGroupsClient.getTransitionRouteGroup(name);
-   * }
-   * 
- * * @param name Required. The name of the * [TransitionRouteGroup][google.cloud.dialogflow.cx.v3beta1.TransitionRouteGroup]. Format: * `projects/<Project ID>/locations/<Location ID>/agents/<Agent @@ -323,20 +233,11 @@ public final TransitionRouteGroup getTransitionRouteGroup(TransitionRouteGroupNa return getTransitionRouteGroup(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Retrieves the specified * [TransitionRouteGroup][google.cloud.dialogflow.cx.v3beta1.TransitionRouteGroup]. * - *

Sample code: - * - *


-   * try (TransitionRouteGroupsClient transitionRouteGroupsClient = TransitionRouteGroupsClient.create()) {
-   *   TransitionRouteGroupName name = TransitionRouteGroupName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]", "[TRANSITION_ROUTE_GROUP]");
-   *   TransitionRouteGroup response = transitionRouteGroupsClient.getTransitionRouteGroup(name.toString());
-   * }
-   * 
- * * @param name Required. The name of the * [TransitionRouteGroup][google.cloud.dialogflow.cx.v3beta1.TransitionRouteGroup]. Format: * `projects/<Project ID>/locations/<Location ID>/agents/<Agent @@ -349,23 +250,11 @@ public final TransitionRouteGroup getTransitionRouteGroup(String name) { return getTransitionRouteGroup(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Retrieves the specified * [TransitionRouteGroup][google.cloud.dialogflow.cx.v3beta1.TransitionRouteGroup]. * - *

Sample code: - * - *


-   * try (TransitionRouteGroupsClient transitionRouteGroupsClient = TransitionRouteGroupsClient.create()) {
-   *   TransitionRouteGroupName name = TransitionRouteGroupName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]", "[TRANSITION_ROUTE_GROUP]");
-   *   GetTransitionRouteGroupRequest request = GetTransitionRouteGroupRequest.newBuilder()
-   *     .setName(name.toString())
-   *     .build();
-   *   TransitionRouteGroup response = transitionRouteGroupsClient.getTransitionRouteGroup(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 */ @@ -374,45 +263,23 @@ public final TransitionRouteGroup getTransitionRouteGroup( return getTransitionRouteGroupCallable().call(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Retrieves the specified * [TransitionRouteGroup][google.cloud.dialogflow.cx.v3beta1.TransitionRouteGroup]. * *

Sample code: - * - *


-   * try (TransitionRouteGroupsClient transitionRouteGroupsClient = TransitionRouteGroupsClient.create()) {
-   *   TransitionRouteGroupName name = TransitionRouteGroupName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]", "[TRANSITION_ROUTE_GROUP]");
-   *   GetTransitionRouteGroupRequest request = GetTransitionRouteGroupRequest.newBuilder()
-   *     .setName(name.toString())
-   *     .build();
-   *   ApiFuture<TransitionRouteGroup> future = transitionRouteGroupsClient.getTransitionRouteGroupCallable().futureCall(request);
-   *   // Do something
-   *   TransitionRouteGroup response = future.get();
-   * }
-   * 
*/ public final UnaryCallable getTransitionRouteGroupCallable() { return stub.getTransitionRouteGroupCallable(); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Creates an [TransitionRouteGroup][google.cloud.dialogflow.cx.v3beta1.TransitionRouteGroup] in * the specified flow. * - *

Sample code: - * - *


-   * try (TransitionRouteGroupsClient transitionRouteGroupsClient = TransitionRouteGroupsClient.create()) {
-   *   FlowName parent = FlowName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]");
-   *   TransitionRouteGroup transitionRouteGroup = TransitionRouteGroup.newBuilder().build();
-   *   TransitionRouteGroup response = transitionRouteGroupsClient.createTransitionRouteGroup(parent, transitionRouteGroup);
-   * }
-   * 
- * * @param parent Required. The flow to create an * [TransitionRouteGroup][google.cloud.dialogflow.cx.v3beta1.TransitionRouteGroup] for. * Format: `projects/<Project ID>/locations/<Location ID>/agents/<Agent @@ -430,21 +297,11 @@ public final TransitionRouteGroup createTransitionRouteGroup( return createTransitionRouteGroup(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Creates an [TransitionRouteGroup][google.cloud.dialogflow.cx.v3beta1.TransitionRouteGroup] in * the specified flow. * - *

Sample code: - * - *


-   * try (TransitionRouteGroupsClient transitionRouteGroupsClient = TransitionRouteGroupsClient.create()) {
-   *   FlowName parent = FlowName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]");
-   *   TransitionRouteGroup transitionRouteGroup = TransitionRouteGroup.newBuilder().build();
-   *   TransitionRouteGroup response = transitionRouteGroupsClient.createTransitionRouteGroup(parent.toString(), transitionRouteGroup);
-   * }
-   * 
- * * @param parent Required. The flow to create an * [TransitionRouteGroup][google.cloud.dialogflow.cx.v3beta1.TransitionRouteGroup] for. * Format: `projects/<Project ID>/locations/<Location ID>/agents/<Agent @@ -462,25 +319,11 @@ public final TransitionRouteGroup createTransitionRouteGroup( return createTransitionRouteGroup(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Creates an [TransitionRouteGroup][google.cloud.dialogflow.cx.v3beta1.TransitionRouteGroup] in * the specified flow. * - *

Sample code: - * - *


-   * try (TransitionRouteGroupsClient transitionRouteGroupsClient = TransitionRouteGroupsClient.create()) {
-   *   FlowName parent = FlowName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]");
-   *   TransitionRouteGroup transitionRouteGroup = TransitionRouteGroup.newBuilder().build();
-   *   CreateTransitionRouteGroupRequest request = CreateTransitionRouteGroupRequest.newBuilder()
-   *     .setParent(parent.toString())
-   *     .setTransitionRouteGroup(transitionRouteGroup)
-   *     .build();
-   *   TransitionRouteGroup response = transitionRouteGroupsClient.createTransitionRouteGroup(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 */ @@ -489,47 +332,23 @@ public final TransitionRouteGroup createTransitionRouteGroup( return createTransitionRouteGroupCallable().call(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Creates an [TransitionRouteGroup][google.cloud.dialogflow.cx.v3beta1.TransitionRouteGroup] in * the specified flow. * *

Sample code: - * - *


-   * try (TransitionRouteGroupsClient transitionRouteGroupsClient = TransitionRouteGroupsClient.create()) {
-   *   FlowName parent = FlowName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]");
-   *   TransitionRouteGroup transitionRouteGroup = TransitionRouteGroup.newBuilder().build();
-   *   CreateTransitionRouteGroupRequest request = CreateTransitionRouteGroupRequest.newBuilder()
-   *     .setParent(parent.toString())
-   *     .setTransitionRouteGroup(transitionRouteGroup)
-   *     .build();
-   *   ApiFuture<TransitionRouteGroup> future = transitionRouteGroupsClient.createTransitionRouteGroupCallable().futureCall(request);
-   *   // Do something
-   *   TransitionRouteGroup response = future.get();
-   * }
-   * 
*/ public final UnaryCallable createTransitionRouteGroupCallable() { return stub.createTransitionRouteGroupCallable(); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Updates the specified * [TransitionRouteGroup][google.cloud.dialogflow.cx.v3beta1.TransitionRouteGroup]. * - *

Sample code: - * - *


-   * try (TransitionRouteGroupsClient transitionRouteGroupsClient = TransitionRouteGroupsClient.create()) {
-   *   TransitionRouteGroup transitionRouteGroup = TransitionRouteGroup.newBuilder().build();
-   *   FieldMask updateMask = FieldMask.newBuilder().build();
-   *   TransitionRouteGroup response = transitionRouteGroupsClient.updateTransitionRouteGroup(transitionRouteGroup, updateMask);
-   * }
-   * 
- * * @param transitionRouteGroup Required. The transition route group to update. * @param updateMask The mask to control which fields get updated. * @throws com.google.api.gax.rpc.ApiException if the remote call fails @@ -544,23 +363,11 @@ public final TransitionRouteGroup updateTransitionRouteGroup( return updateTransitionRouteGroup(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Updates the specified * [TransitionRouteGroup][google.cloud.dialogflow.cx.v3beta1.TransitionRouteGroup]. * - *

Sample code: - * - *


-   * try (TransitionRouteGroupsClient transitionRouteGroupsClient = TransitionRouteGroupsClient.create()) {
-   *   TransitionRouteGroup transitionRouteGroup = TransitionRouteGroup.newBuilder().build();
-   *   UpdateTransitionRouteGroupRequest request = UpdateTransitionRouteGroupRequest.newBuilder()
-   *     .setTransitionRouteGroup(transitionRouteGroup)
-   *     .build();
-   *   TransitionRouteGroup response = transitionRouteGroupsClient.updateTransitionRouteGroup(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 */ @@ -569,44 +376,23 @@ public final TransitionRouteGroup updateTransitionRouteGroup( return updateTransitionRouteGroupCallable().call(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Updates the specified * [TransitionRouteGroup][google.cloud.dialogflow.cx.v3beta1.TransitionRouteGroup]. * *

Sample code: - * - *


-   * try (TransitionRouteGroupsClient transitionRouteGroupsClient = TransitionRouteGroupsClient.create()) {
-   *   TransitionRouteGroup transitionRouteGroup = TransitionRouteGroup.newBuilder().build();
-   *   UpdateTransitionRouteGroupRequest request = UpdateTransitionRouteGroupRequest.newBuilder()
-   *     .setTransitionRouteGroup(transitionRouteGroup)
-   *     .build();
-   *   ApiFuture<TransitionRouteGroup> future = transitionRouteGroupsClient.updateTransitionRouteGroupCallable().futureCall(request);
-   *   // Do something
-   *   TransitionRouteGroup response = future.get();
-   * }
-   * 
*/ public final UnaryCallable updateTransitionRouteGroupCallable() { return stub.updateTransitionRouteGroupCallable(); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Deletes the specified * [TransitionRouteGroup][google.cloud.dialogflow.cx.v3beta1.TransitionRouteGroup]. * - *

Sample code: - * - *


-   * try (TransitionRouteGroupsClient transitionRouteGroupsClient = TransitionRouteGroupsClient.create()) {
-   *   TransitionRouteGroupName name = TransitionRouteGroupName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]", "[TRANSITION_ROUTE_GROUP]");
-   *   transitionRouteGroupsClient.deleteTransitionRouteGroup(name);
-   * }
-   * 
- * * @param name Required. The name of the * [TransitionRouteGroup][google.cloud.dialogflow.cx.v3beta1.TransitionRouteGroup] to delete. * Format: `projects/<Project ID>/locations/<Location ID>/agents/<Agent @@ -621,20 +407,11 @@ public final void deleteTransitionRouteGroup(TransitionRouteGroupName name) { deleteTransitionRouteGroup(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Deletes the specified * [TransitionRouteGroup][google.cloud.dialogflow.cx.v3beta1.TransitionRouteGroup]. * - *

Sample code: - * - *


-   * try (TransitionRouteGroupsClient transitionRouteGroupsClient = TransitionRouteGroupsClient.create()) {
-   *   TransitionRouteGroupName name = TransitionRouteGroupName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]", "[TRANSITION_ROUTE_GROUP]");
-   *   transitionRouteGroupsClient.deleteTransitionRouteGroup(name.toString());
-   * }
-   * 
- * * @param name Required. The name of the * [TransitionRouteGroup][google.cloud.dialogflow.cx.v3beta1.TransitionRouteGroup] to delete. * Format: `projects/<Project ID>/locations/<Location ID>/agents/<Agent @@ -647,23 +424,11 @@ public final void deleteTransitionRouteGroup(String name) { deleteTransitionRouteGroup(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Deletes the specified * [TransitionRouteGroup][google.cloud.dialogflow.cx.v3beta1.TransitionRouteGroup]. * - *

Sample code: - * - *


-   * try (TransitionRouteGroupsClient transitionRouteGroupsClient = TransitionRouteGroupsClient.create()) {
-   *   TransitionRouteGroupName name = TransitionRouteGroupName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]", "[TRANSITION_ROUTE_GROUP]");
-   *   DeleteTransitionRouteGroupRequest request = DeleteTransitionRouteGroupRequest.newBuilder()
-   *     .setName(name.toString())
-   *     .build();
-   *   transitionRouteGroupsClient.deleteTransitionRouteGroup(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 */ @@ -671,24 +436,12 @@ public final void deleteTransitionRouteGroup(DeleteTransitionRouteGroupRequest r deleteTransitionRouteGroupCallable().call(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Deletes the specified * [TransitionRouteGroup][google.cloud.dialogflow.cx.v3beta1.TransitionRouteGroup]. * *

Sample code: - * - *


-   * try (TransitionRouteGroupsClient transitionRouteGroupsClient = TransitionRouteGroupsClient.create()) {
-   *   TransitionRouteGroupName name = TransitionRouteGroupName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]", "[TRANSITION_ROUTE_GROUP]");
-   *   DeleteTransitionRouteGroupRequest request = DeleteTransitionRouteGroupRequest.newBuilder()
-   *     .setName(name.toString())
-   *     .build();
-   *   ApiFuture<Void> future = transitionRouteGroupsClient.deleteTransitionRouteGroupCallable().futureCall(request);
-   *   // Do something
-   *   future.get();
-   * }
-   * 
*/ public final UnaryCallable deleteTransitionRouteGroupCallable() { diff --git a/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3beta1/TransitionRouteGroupsSettings.java b/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3beta1/TransitionRouteGroupsSettings.java index 729f2af46..826026d28 100644 --- a/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3beta1/TransitionRouteGroupsSettings.java +++ b/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3beta1/TransitionRouteGroupsSettings.java @@ -5,7 +5,7 @@ * 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 + * 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, @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.google.cloud.dialogflow.cx.v3beta1; import static com.google.cloud.dialogflow.cx.v3beta1.TransitionRouteGroupsClient.ListTransitionRouteGroupsPagedResponse; @@ -34,7 +35,7 @@ import java.util.List; import javax.annotation.Generated; -// AUTO-GENERATED DOCUMENTATION AND CLASS +// AUTO-GENERATED DOCUMENTATION AND CLASS. /** * Settings class to configure an instance of {@link TransitionRouteGroupsClient}. * @@ -51,23 +52,25 @@ * *

For example, to set the total timeout of getTransitionRouteGroup to 30 seconds: * - *

- * 
+ * 
{@code
  * TransitionRouteGroupsSettings.Builder transitionRouteGroupsSettingsBuilder =
  *     TransitionRouteGroupsSettings.newBuilder();
  * transitionRouteGroupsSettingsBuilder
  *     .getTransitionRouteGroupSettings()
  *     .setRetrySettings(
- *         transitionRouteGroupsSettingsBuilder.getTransitionRouteGroupSettings().getRetrySettings().toBuilder()
+ *         transitionRouteGroupsSettingsBuilder
+ *             .getTransitionRouteGroupSettings()
+ *             .getRetrySettings()
+ *             .toBuilder()
  *             .setTotalTimeout(Duration.ofSeconds(30))
  *             .build());
- * TransitionRouteGroupsSettings transitionRouteGroupsSettings = transitionRouteGroupsSettingsBuilder.build();
- * 
- * 
+ * TransitionRouteGroupsSettings transitionRouteGroupsSettings = + * transitionRouteGroupsSettingsBuilder.build(); + * }
*/ -@Generated("by gapic-generator") -@BetaApi +@Generated("by gapic-generator-java") public class TransitionRouteGroupsSettings extends ClientSettings { + /** Returns the object with the settings used for calls to listTransitionRouteGroups. */ public PagedCallSettings< ListTransitionRouteGroupsRequest, @@ -167,18 +170,15 @@ protected TransitionRouteGroupsSettings(Builder settingsBuilder) throws IOExcept /** Builder for TransitionRouteGroupsSettings. */ public static class Builder extends ClientSettings.Builder { + protected Builder() throws IOException { - this((ClientContext) null); + this(((ClientContext) null)); } protected Builder(ClientContext clientContext) { super(TransitionRouteGroupsStubSettings.newBuilder(clientContext)); } - private static Builder createDefault() { - return new Builder(TransitionRouteGroupsStubSettings.newBuilder()); - } - protected Builder(TransitionRouteGroupsSettings settings) { super(settings.getStubSettings().toBuilder()); } @@ -187,11 +187,15 @@ protected Builder(TransitionRouteGroupsStubSettings.Builder stubSettings) { super(stubSettings); } + private static Builder createDefault() { + return new Builder(TransitionRouteGroupsStubSettings.newBuilder()); + } + public TransitionRouteGroupsStubSettings.Builder getStubSettingsBuilder() { return ((TransitionRouteGroupsStubSettings.Builder) getStubSettings()); } - // NEXT_MAJOR_VER: remove 'throws Exception' + // NEXT_MAJOR_VER: remove 'throws Exception'. /** * Applies the given settings updater function to all of the unary API methods in this service. * diff --git a/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3beta1/VersionsClient.java b/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3beta1/VersionsClient.java index 1dcd21179..6446f5708 100644 --- a/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3beta1/VersionsClient.java +++ b/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3beta1/VersionsClient.java @@ -5,7 +5,7 @@ * 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 + * 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, @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.google.cloud.dialogflow.cx.v3beta1; import com.google.api.core.ApiFunction; @@ -40,23 +41,14 @@ import java.util.concurrent.TimeUnit; import javax.annotation.Generated; -// AUTO-GENERATED DOCUMENTATION AND SERVICE +// AUTO-GENERATED DOCUMENTATION AND CLASS. /** * Service Description: Service for managing [Versions][google.cloud.dialogflow.cx.v3beta1.Version]. * *

This class provides the ability to make remote calls to the backing service through method * calls that map to API methods. Sample code to get started: * - *

- * 
- * try (VersionsClient versionsClient = VersionsClient.create()) {
- *   VersionName name = VersionName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]", "[VERSION]");
- *   Version response = versionsClient.getVersion(name);
- * }
- * 
- * 
- * - *

Note: close() needs to be called on the versionsClient object to clean up resources such as + *

Note: close() needs to be called on the VersionsClient object to clean up resources such as * threads. In the example above, try-with-resources is used, which automatically calls close(). * *

The surface of this class includes several types of Java methods for each of the API's @@ -84,30 +76,26 @@ * *

To customize credentials: * - *

- * 
+ * 
{@code
  * VersionsSettings versionsSettings =
  *     VersionsSettings.newBuilder()
  *         .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
  *         .build();
- * VersionsClient versionsClient =
- *     VersionsClient.create(versionsSettings);
- * 
- * 
+ * VersionsClient versionsClient = VersionsClient.create(versionsSettings); + * }
* - * To customize the endpoint: + *

To customize the endpoint: * - *

- * 
+ * 
{@code
  * VersionsSettings versionsSettings =
  *     VersionsSettings.newBuilder().setEndpoint(myEndpoint).build();
- * VersionsClient versionsClient =
- *     VersionsClient.create(versionsSettings);
- * 
- * 
+ * VersionsClient versionsClient = VersionsClient.create(versionsSettings); + * }
+ * + *

Please refer to the GitHub repository's samples for more quickstart code snippets. */ -@Generated("by gapic-generator") @BetaApi +@Generated("by gapic-generator") public class VersionsClient implements BackgroundResource { private final VersionsSettings settings; private final VersionsStub stub; @@ -128,7 +116,7 @@ public static final VersionsClient create(VersionsSettings settings) throws IOEx /** * Constructs an instance of VersionsClient, using the given stub for making calls. This is for - * advanced usage - prefer to use VersionsSettings}. + * advanced usage - prefer using create(VersionsSettings). */ @BetaApi("A restructuring of stub classes is planned, so this may break in the future") public static final VersionsClient create(VersionsStub stub) { @@ -165,28 +153,15 @@ public VersionsStub getStub() { * Returns the OperationsClient that can be used to query the status of a long-running operation * returned by another API method call. */ - @BetaApi( - "The surface for long-running operations is not stable yet and may change in the future.") public final OperationsClient getOperationsClient() { return operationsClient; } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Returns the list of all versions in the specified * [Flow][google.cloud.dialogflow.cx.v3beta1.Flow]. * - *

Sample code: - * - *


-   * try (VersionsClient versionsClient = VersionsClient.create()) {
-   *   FlowName parent = FlowName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]");
-   *   for (Version element : versionsClient.listVersions(parent).iterateAll()) {
-   *     // doThingsWith(element);
-   *   }
-   * }
-   * 
- * * @param parent Required. The [Flow][google.cloud.dialogflow.cx.v3beta1.Flow] to list all * versions for. Format: `projects/<Project ID>/locations/<Location * ID>/agents/<Agent ID>/flows/<Flow ID>`. @@ -200,22 +175,11 @@ public final ListVersionsPagedResponse listVersions(FlowName parent) { return listVersions(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Returns the list of all versions in the specified * [Flow][google.cloud.dialogflow.cx.v3beta1.Flow]. * - *

Sample code: - * - *


-   * try (VersionsClient versionsClient = VersionsClient.create()) {
-   *   FlowName parent = FlowName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]");
-   *   for (Version element : versionsClient.listVersions(parent.toString()).iterateAll()) {
-   *     // doThingsWith(element);
-   *   }
-   * }
-   * 
- * * @param parent Required. The [Flow][google.cloud.dialogflow.cx.v3beta1.Flow] to list all * versions for. Format: `projects/<Project ID>/locations/<Location * ID>/agents/<Agent ID>/flows/<Flow ID>`. @@ -226,25 +190,11 @@ public final ListVersionsPagedResponse listVersions(String parent) { return listVersions(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Returns the list of all versions in the specified * [Flow][google.cloud.dialogflow.cx.v3beta1.Flow]. * - *

Sample code: - * - *


-   * try (VersionsClient versionsClient = VersionsClient.create()) {
-   *   FlowName parent = FlowName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]");
-   *   ListVersionsRequest request = ListVersionsRequest.newBuilder()
-   *     .setParent(parent.toString())
-   *     .build();
-   *   for (Version element : versionsClient.listVersions(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 */ @@ -252,77 +202,33 @@ public final ListVersionsPagedResponse listVersions(ListVersionsRequest request) return listVersionsPagedCallable().call(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Returns the list of all versions in the specified * [Flow][google.cloud.dialogflow.cx.v3beta1.Flow]. * *

Sample code: - * - *


-   * try (VersionsClient versionsClient = VersionsClient.create()) {
-   *   FlowName parent = FlowName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]");
-   *   ListVersionsRequest request = ListVersionsRequest.newBuilder()
-   *     .setParent(parent.toString())
-   *     .build();
-   *   ApiFuture<ListVersionsPagedResponse> future = versionsClient.listVersionsPagedCallable().futureCall(request);
-   *   // Do something
-   *   for (Version element : future.get().iterateAll()) {
-   *     // doThingsWith(element);
-   *   }
-   * }
-   * 
*/ public final UnaryCallable listVersionsPagedCallable() { return stub.listVersionsPagedCallable(); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Returns the list of all versions in the specified * [Flow][google.cloud.dialogflow.cx.v3beta1.Flow]. * *

Sample code: - * - *


-   * try (VersionsClient versionsClient = VersionsClient.create()) {
-   *   FlowName parent = FlowName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]");
-   *   ListVersionsRequest request = ListVersionsRequest.newBuilder()
-   *     .setParent(parent.toString())
-   *     .build();
-   *   while (true) {
-   *     ListVersionsResponse response = versionsClient.listVersionsCallable().call(request);
-   *     for (Version element : response.getVersionsList()) {
-   *       // doThingsWith(element);
-   *     }
-   *     String nextPageToken = response.getNextPageToken();
-   *     if (!Strings.isNullOrEmpty(nextPageToken)) {
-   *       request = request.toBuilder().setPageToken(nextPageToken).build();
-   *     } else {
-   *       break;
-   *     }
-   *   }
-   * }
-   * 
*/ public final UnaryCallable listVersionsCallable() { return stub.listVersionsCallable(); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Retrieves the specified [Version][google.cloud.dialogflow.cx.v3beta1.Version]. * - *

Sample code: - * - *


-   * try (VersionsClient versionsClient = VersionsClient.create()) {
-   *   VersionName name = VersionName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]", "[VERSION]");
-   *   Version response = versionsClient.getVersion(name);
-   * }
-   * 
- * * @param name Required. The name of the [Version][google.cloud.dialogflow.cx.v3beta1.Version]. * Format: `projects/<Project ID>/locations/<Location ID>/agents/<Agent * ID>/flows/<Flow ID>/versions/<Version ID>`. @@ -334,19 +240,10 @@ public final Version getVersion(VersionName name) { return getVersion(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Retrieves the specified [Version][google.cloud.dialogflow.cx.v3beta1.Version]. * - *

Sample code: - * - *


-   * try (VersionsClient versionsClient = VersionsClient.create()) {
-   *   VersionName name = VersionName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]", "[VERSION]");
-   *   Version response = versionsClient.getVersion(name.toString());
-   * }
-   * 
- * * @param name Required. The name of the [Version][google.cloud.dialogflow.cx.v3beta1.Version]. * Format: `projects/<Project ID>/locations/<Location ID>/agents/<Agent * ID>/flows/<Flow ID>/versions/<Version ID>`. @@ -357,22 +254,10 @@ public final Version getVersion(String name) { return getVersion(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Retrieves the specified [Version][google.cloud.dialogflow.cx.v3beta1.Version]. * - *

Sample code: - * - *


-   * try (VersionsClient versionsClient = VersionsClient.create()) {
-   *   VersionName name = VersionName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]", "[VERSION]");
-   *   GetVersionRequest request = GetVersionRequest.newBuilder()
-   *     .setName(name.toString())
-   *     .build();
-   *   Version response = versionsClient.getVersion(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 */ @@ -380,51 +265,27 @@ public final Version getVersion(GetVersionRequest request) { return getVersionCallable().call(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Retrieves the specified [Version][google.cloud.dialogflow.cx.v3beta1.Version]. * *

Sample code: - * - *


-   * try (VersionsClient versionsClient = VersionsClient.create()) {
-   *   VersionName name = VersionName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]", "[VERSION]");
-   *   GetVersionRequest request = GetVersionRequest.newBuilder()
-   *     .setName(name.toString())
-   *     .build();
-   *   ApiFuture<Version> future = versionsClient.getVersionCallable().futureCall(request);
-   *   // Do something
-   *   Version response = future.get();
-   * }
-   * 
*/ public final UnaryCallable getVersionCallable() { return stub.getVersionCallable(); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Creates a [Version][google.cloud.dialogflow.cx.v3beta1.Version] in the specified * [Flow][google.cloud.dialogflow.cx.v3beta1.Flow]. * - *

Sample code: - * - *


-   * try (VersionsClient versionsClient = VersionsClient.create()) {
-   *   FlowName parent = FlowName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]");
-   *   Version version = Version.newBuilder().build();
-   *   Version response = versionsClient.createVersionAsync(parent, version).get();
-   * }
-   * 
- * * @param parent Required. The [Flow][google.cloud.dialogflow.cx.v3beta1.Flow] to create an * [Version][google.cloud.dialogflow.cx.v3beta1.Version] for. Format: `projects/<Project * ID>/locations/<Location ID>/agents/<Agent ID>/flows/<Flow ID>`. * @param version Required. The version to create. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ - @BetaApi( - "The surface for long-running operations is not stable yet and may change in the future.") public final OperationFuture createVersionAsync( FlowName parent, Version version) { CreateVersionRequest request = @@ -435,29 +296,17 @@ public final OperationFuture createVers return createVersionAsync(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Creates a [Version][google.cloud.dialogflow.cx.v3beta1.Version] in the specified * [Flow][google.cloud.dialogflow.cx.v3beta1.Flow]. * - *

Sample code: - * - *


-   * try (VersionsClient versionsClient = VersionsClient.create()) {
-   *   FlowName parent = FlowName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]");
-   *   Version version = Version.newBuilder().build();
-   *   Version response = versionsClient.createVersionAsync(parent.toString(), version).get();
-   * }
-   * 
- * * @param parent Required. The [Flow][google.cloud.dialogflow.cx.v3beta1.Flow] to create an * [Version][google.cloud.dialogflow.cx.v3beta1.Version] for. Format: `projects/<Project * ID>/locations/<Location ID>/agents/<Agent ID>/flows/<Flow ID>`. * @param version Required. The version to create. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ - @BetaApi( - "The surface for long-running operations is not stable yet and may change in the future.") public final OperationFuture createVersionAsync( String parent, Version version) { CreateVersionRequest request = @@ -465,101 +314,46 @@ public final OperationFuture createVers return createVersionAsync(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Creates a [Version][google.cloud.dialogflow.cx.v3beta1.Version] in the specified * [Flow][google.cloud.dialogflow.cx.v3beta1.Flow]. * - *

Sample code: - * - *


-   * try (VersionsClient versionsClient = VersionsClient.create()) {
-   *   FlowName parent = FlowName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]");
-   *   Version version = Version.newBuilder().build();
-   *   CreateVersionRequest request = CreateVersionRequest.newBuilder()
-   *     .setParent(parent.toString())
-   *     .setVersion(version)
-   *     .build();
-   *   Version response = versionsClient.createVersionAsync(request).get();
-   * }
-   * 
- * * @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 */ - @BetaApi( - "The surface for long-running operations is not stable yet and may change in the future.") public final OperationFuture createVersionAsync( CreateVersionRequest request) { return createVersionOperationCallable().futureCall(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Creates a [Version][google.cloud.dialogflow.cx.v3beta1.Version] in the specified * [Flow][google.cloud.dialogflow.cx.v3beta1.Flow]. * *

Sample code: - * - *


-   * try (VersionsClient versionsClient = VersionsClient.create()) {
-   *   FlowName parent = FlowName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]");
-   *   Version version = Version.newBuilder().build();
-   *   CreateVersionRequest request = CreateVersionRequest.newBuilder()
-   *     .setParent(parent.toString())
-   *     .setVersion(version)
-   *     .build();
-   *   OperationFuture<Version, CreateVersionOperationMetadata> future = versionsClient.createVersionOperationCallable().futureCall(request);
-   *   // Do something
-   *   Version response = future.get();
-   * }
-   * 
*/ - @BetaApi("The surface for use by generated code is not stable yet and may change in the future.") public final OperationCallable createVersionOperationCallable() { return stub.createVersionOperationCallable(); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Creates a [Version][google.cloud.dialogflow.cx.v3beta1.Version] in the specified * [Flow][google.cloud.dialogflow.cx.v3beta1.Flow]. * *

Sample code: - * - *


-   * try (VersionsClient versionsClient = VersionsClient.create()) {
-   *   FlowName parent = FlowName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]");
-   *   Version version = Version.newBuilder().build();
-   *   CreateVersionRequest request = CreateVersionRequest.newBuilder()
-   *     .setParent(parent.toString())
-   *     .setVersion(version)
-   *     .build();
-   *   ApiFuture<Operation> future = versionsClient.createVersionCallable().futureCall(request);
-   *   // Do something
-   *   Operation response = future.get();
-   * }
-   * 
*/ public final UnaryCallable createVersionCallable() { return stub.createVersionCallable(); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Updates the specified [Version][google.cloud.dialogflow.cx.v3beta1.Version]. * - *

Sample code: - * - *


-   * try (VersionsClient versionsClient = VersionsClient.create()) {
-   *   Version version = Version.newBuilder().build();
-   *   FieldMask updateMask = FieldMask.newBuilder().build();
-   *   Version response = versionsClient.updateVersion(version, updateMask);
-   * }
-   * 
- * * @param version Required. The version to update. * @param updateMask Required. The mask to control which fields get updated. Currently only * `description` and `display_name` can be updated. @@ -571,24 +365,10 @@ public final Version updateVersion(Version version, FieldMask updateMask) { return updateVersion(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Updates the specified [Version][google.cloud.dialogflow.cx.v3beta1.Version]. * - *

Sample code: - * - *


-   * try (VersionsClient versionsClient = VersionsClient.create()) {
-   *   Version version = Version.newBuilder().build();
-   *   FieldMask updateMask = FieldMask.newBuilder().build();
-   *   UpdateVersionRequest request = UpdateVersionRequest.newBuilder()
-   *     .setVersion(version)
-   *     .setUpdateMask(updateMask)
-   *     .build();
-   *   Version response = versionsClient.updateVersion(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 */ @@ -596,43 +376,20 @@ public final Version updateVersion(UpdateVersionRequest request) { return updateVersionCallable().call(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Updates the specified [Version][google.cloud.dialogflow.cx.v3beta1.Version]. * *

Sample code: - * - *


-   * try (VersionsClient versionsClient = VersionsClient.create()) {
-   *   Version version = Version.newBuilder().build();
-   *   FieldMask updateMask = FieldMask.newBuilder().build();
-   *   UpdateVersionRequest request = UpdateVersionRequest.newBuilder()
-   *     .setVersion(version)
-   *     .setUpdateMask(updateMask)
-   *     .build();
-   *   ApiFuture<Version> future = versionsClient.updateVersionCallable().futureCall(request);
-   *   // Do something
-   *   Version response = future.get();
-   * }
-   * 
*/ public final UnaryCallable updateVersionCallable() { return stub.updateVersionCallable(); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Deletes the specified [Version][google.cloud.dialogflow.cx.v3beta1.Version]. * - *

Sample code: - * - *


-   * try (VersionsClient versionsClient = VersionsClient.create()) {
-   *   VersionName name = VersionName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]", "[VERSION]");
-   *   versionsClient.deleteVersion(name);
-   * }
-   * 
- * * @param name Required. The name of the [Version][google.cloud.dialogflow.cx.v3beta1.Version] to * delete. Format: `projects/<Project ID>/locations/<Location ID>/agents/<Agent * ID>/flows/<Flow ID>/versions/<Version ID>`. @@ -644,19 +401,10 @@ public final void deleteVersion(VersionName name) { deleteVersion(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Deletes the specified [Version][google.cloud.dialogflow.cx.v3beta1.Version]. * - *

Sample code: - * - *


-   * try (VersionsClient versionsClient = VersionsClient.create()) {
-   *   VersionName name = VersionName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]", "[VERSION]");
-   *   versionsClient.deleteVersion(name.toString());
-   * }
-   * 
- * * @param name Required. The name of the [Version][google.cloud.dialogflow.cx.v3beta1.Version] to * delete. Format: `projects/<Project ID>/locations/<Location ID>/agents/<Agent * ID>/flows/<Flow ID>/versions/<Version ID>`. @@ -667,22 +415,10 @@ public final void deleteVersion(String name) { deleteVersion(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Deletes the specified [Version][google.cloud.dialogflow.cx.v3beta1.Version]. * - *

Sample code: - * - *


-   * try (VersionsClient versionsClient = VersionsClient.create()) {
-   *   VersionName name = VersionName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]", "[VERSION]");
-   *   DeleteVersionRequest request = DeleteVersionRequest.newBuilder()
-   *     .setName(name.toString())
-   *     .build();
-   *   versionsClient.deleteVersion(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 */ @@ -690,144 +426,71 @@ public final void deleteVersion(DeleteVersionRequest request) { deleteVersionCallable().call(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Deletes the specified [Version][google.cloud.dialogflow.cx.v3beta1.Version]. * *

Sample code: - * - *


-   * try (VersionsClient versionsClient = VersionsClient.create()) {
-   *   VersionName name = VersionName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]", "[VERSION]");
-   *   DeleteVersionRequest request = DeleteVersionRequest.newBuilder()
-   *     .setName(name.toString())
-   *     .build();
-   *   ApiFuture<Void> future = versionsClient.deleteVersionCallable().futureCall(request);
-   *   // Do something
-   *   future.get();
-   * }
-   * 
*/ public final UnaryCallable deleteVersionCallable() { return stub.deleteVersionCallable(); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Loads a specified version to draft version. * - *

Sample code: - * - *


-   * try (VersionsClient versionsClient = VersionsClient.create()) {
-   *   VersionName name = VersionName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]", "[VERSION]");
-   *   versionsClient.loadVersionAsync(name).get();
-   * }
-   * 
- * * @param name Required. The [Version][google.cloud.dialogflow.cx.v3beta1.Version] to be loaded to * draft version. Format: `projects/<Project ID>/locations/<Location * ID>/agents/<Agent ID>/flows/<Flow ID>/versions/<Version ID>`. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ - @BetaApi( - "The surface for long-running operations is not stable yet and may change in the future.") public final OperationFuture loadVersionAsync(VersionName name) { LoadVersionRequest request = LoadVersionRequest.newBuilder().setName(name == null ? null : name.toString()).build(); return loadVersionAsync(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Loads a specified version to draft version. * - *

Sample code: - * - *


-   * try (VersionsClient versionsClient = VersionsClient.create()) {
-   *   VersionName name = VersionName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]", "[VERSION]");
-   *   versionsClient.loadVersionAsync(name.toString()).get();
-   * }
-   * 
- * * @param name Required. The [Version][google.cloud.dialogflow.cx.v3beta1.Version] to be loaded to * draft version. Format: `projects/<Project ID>/locations/<Location * ID>/agents/<Agent ID>/flows/<Flow ID>/versions/<Version ID>`. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ - @BetaApi( - "The surface for long-running operations is not stable yet and may change in the future.") public final OperationFuture loadVersionAsync(String name) { LoadVersionRequest request = LoadVersionRequest.newBuilder().setName(name).build(); return loadVersionAsync(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Loads a specified version to draft version. * - *

Sample code: - * - *


-   * try (VersionsClient versionsClient = VersionsClient.create()) {
-   *   VersionName name = VersionName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]", "[VERSION]");
-   *   LoadVersionRequest request = LoadVersionRequest.newBuilder()
-   *     .setName(name.toString())
-   *     .build();
-   *   versionsClient.loadVersionAsync(request).get();
-   * }
-   * 
- * * @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 */ - @BetaApi( - "The surface for long-running operations is not stable yet and may change in the future.") public final OperationFuture loadVersionAsync(LoadVersionRequest request) { return loadVersionOperationCallable().futureCall(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Loads a specified version to draft version. * *

Sample code: - * - *


-   * try (VersionsClient versionsClient = VersionsClient.create()) {
-   *   VersionName name = VersionName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]", "[VERSION]");
-   *   LoadVersionRequest request = LoadVersionRequest.newBuilder()
-   *     .setName(name.toString())
-   *     .build();
-   *   OperationFuture<Empty, Struct> future = versionsClient.loadVersionOperationCallable().futureCall(request);
-   *   // Do something
-   *   future.get();
-   * }
-   * 
*/ - @BetaApi("The surface for use by generated code is not stable yet and may change in the future.") public final OperationCallable loadVersionOperationCallable() { return stub.loadVersionOperationCallable(); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Loads a specified version to draft version. * *

Sample code: - * - *


-   * try (VersionsClient versionsClient = VersionsClient.create()) {
-   *   VersionName name = VersionName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]", "[VERSION]");
-   *   LoadVersionRequest request = LoadVersionRequest.newBuilder()
-   *     .setName(name.toString())
-   *     .build();
-   *   ApiFuture<Operation> future = versionsClient.loadVersionCallable().futureCall(request);
-   *   // Do something
-   *   future.get();
-   * }
-   * 
*/ public final UnaryCallable loadVersionCallable() { return stub.loadVersionCallable(); diff --git a/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3beta1/VersionsSettings.java b/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3beta1/VersionsSettings.java index d4d987539..f5c6b5e33 100644 --- a/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3beta1/VersionsSettings.java +++ b/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3beta1/VersionsSettings.java @@ -5,7 +5,7 @@ * 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 + * 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, @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.google.cloud.dialogflow.cx.v3beta1; import static com.google.cloud.dialogflow.cx.v3beta1.VersionsClient.ListVersionsPagedResponse; @@ -37,7 +38,7 @@ import java.util.List; import javax.annotation.Generated; -// AUTO-GENERATED DOCUMENTATION AND CLASS +// AUTO-GENERATED DOCUMENTATION AND CLASS. /** * Settings class to configure an instance of {@link VersionsClient}. * @@ -54,23 +55,23 @@ * *

For example, to set the total timeout of getVersion to 30 seconds: * - *

- * 
- * VersionsSettings.Builder versionsSettingsBuilder =
- *     VersionsSettings.newBuilder();
+ * 
{@code
+ * VersionsSettings.Builder versionsSettingsBuilder = VersionsSettings.newBuilder();
  * versionsSettingsBuilder
  *     .getVersionSettings()
  *     .setRetrySettings(
- *         versionsSettingsBuilder.getVersionSettings().getRetrySettings().toBuilder()
+ *         versionsSettingsBuilder
+ *             .getVersionSettings()
+ *             .getRetrySettings()
+ *             .toBuilder()
  *             .setTotalTimeout(Duration.ofSeconds(30))
  *             .build());
  * VersionsSettings versionsSettings = versionsSettingsBuilder.build();
- * 
- * 
+ * }
*/ -@Generated("by gapic-generator") -@BetaApi +@Generated("by gapic-generator-java") public class VersionsSettings extends ClientSettings { + /** Returns the object with the settings used for calls to listVersions. */ public PagedCallSettings listVersionsSettings() { @@ -88,8 +89,6 @@ public UnaryCallSettings createVersionSettings( } /** Returns the object with the settings used for calls to createVersion. */ - @BetaApi( - "The surface for long-running operations is not stable yet and may change in the future.") public OperationCallSettings createVersionOperationSettings() { return ((VersionsStubSettings) getStubSettings()).createVersionOperationSettings(); @@ -111,8 +110,6 @@ public UnaryCallSettings loadVersionSettings() { } /** Returns the object with the settings used for calls to loadVersion. */ - @BetaApi( - "The surface for long-running operations is not stable yet and may change in the future.") public OperationCallSettings loadVersionOperationSettings() { return ((VersionsStubSettings) getStubSettings()).loadVersionOperationSettings(); } @@ -176,18 +173,15 @@ protected VersionsSettings(Builder settingsBuilder) throws IOException { /** Builder for VersionsSettings. */ public static class Builder extends ClientSettings.Builder { + protected Builder() throws IOException { - this((ClientContext) null); + this(((ClientContext) null)); } protected Builder(ClientContext clientContext) { super(VersionsStubSettings.newBuilder(clientContext)); } - private static Builder createDefault() { - return new Builder(VersionsStubSettings.newBuilder()); - } - protected Builder(VersionsSettings settings) { super(settings.getStubSettings().toBuilder()); } @@ -196,11 +190,15 @@ protected Builder(VersionsStubSettings.Builder stubSettings) { super(stubSettings); } + private static Builder createDefault() { + return new Builder(VersionsStubSettings.newBuilder()); + } + public VersionsStubSettings.Builder getStubSettingsBuilder() { return ((VersionsStubSettings.Builder) getStubSettings()); } - // NEXT_MAJOR_VER: remove 'throws Exception' + // NEXT_MAJOR_VER: remove 'throws Exception'. /** * Applies the given settings updater function to all of the unary API methods in this service. * @@ -231,8 +229,6 @@ public UnaryCallSettings.Builder createVersionS } /** Returns the builder for the settings used for calls to createVersion. */ - @BetaApi( - "The surface for long-running operations is not stable yet and may change in the future.") public OperationCallSettings.Builder< CreateVersionRequest, Version, CreateVersionOperationMetadata> createVersionOperationSettings() { @@ -255,8 +251,6 @@ public UnaryCallSettings.Builder loadVersionSetti } /** Returns the builder for the settings used for calls to loadVersion. */ - @BetaApi( - "The surface for long-running operations is not stable yet and may change in the future.") public OperationCallSettings.Builder loadVersionOperationSettings() { return getStubSettingsBuilder().loadVersionOperationSettings(); diff --git a/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3beta1/WebhooksClient.java b/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3beta1/WebhooksClient.java index fac122291..b0a44e5d7 100644 --- a/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3beta1/WebhooksClient.java +++ b/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3beta1/WebhooksClient.java @@ -5,7 +5,7 @@ * 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 + * 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, @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.google.cloud.dialogflow.cx.v3beta1; import com.google.api.core.ApiFunction; @@ -35,23 +36,14 @@ import java.util.concurrent.TimeUnit; import javax.annotation.Generated; -// AUTO-GENERATED DOCUMENTATION AND SERVICE +// AUTO-GENERATED DOCUMENTATION AND CLASS. /** * Service Description: Service for managing [Webhooks][google.cloud.dialogflow.cx.v3beta1.Webhook]. * *

This class provides the ability to make remote calls to the backing service through method * calls that map to API methods. Sample code to get started: * - *

- * 
- * try (WebhooksClient webhooksClient = WebhooksClient.create()) {
- *   WebhookName name = WebhookName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[WEBHOOK]");
- *   Webhook response = webhooksClient.getWebhook(name);
- * }
- * 
- * 
- * - *

Note: close() needs to be called on the webhooksClient object to clean up resources such as + *

Note: close() needs to be called on the WebhooksClient object to clean up resources such as * threads. In the example above, try-with-resources is used, which automatically calls close(). * *

The surface of this class includes several types of Java methods for each of the API's @@ -79,30 +71,26 @@ * *

To customize credentials: * - *

- * 
+ * 
{@code
  * WebhooksSettings webhooksSettings =
  *     WebhooksSettings.newBuilder()
  *         .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
  *         .build();
- * WebhooksClient webhooksClient =
- *     WebhooksClient.create(webhooksSettings);
- * 
- * 
+ * WebhooksClient webhooksClient = WebhooksClient.create(webhooksSettings); + * }
* - * To customize the endpoint: + *

To customize the endpoint: * - *

- * 
+ * 
{@code
  * WebhooksSettings webhooksSettings =
  *     WebhooksSettings.newBuilder().setEndpoint(myEndpoint).build();
- * WebhooksClient webhooksClient =
- *     WebhooksClient.create(webhooksSettings);
- * 
- * 
+ * WebhooksClient webhooksClient = WebhooksClient.create(webhooksSettings); + * }
+ * + *

Please refer to the GitHub repository's samples for more quickstart code snippets. */ -@Generated("by gapic-generator") @BetaApi +@Generated("by gapic-generator") public class WebhooksClient implements BackgroundResource { private final WebhooksSettings settings; private final WebhooksStub stub; @@ -122,7 +110,7 @@ public static final WebhooksClient create(WebhooksSettings settings) throws IOEx /** * Constructs an instance of WebhooksClient, using the given stub for making calls. This is for - * advanced usage - prefer to use WebhooksSettings}. + * advanced usage - prefer using create(WebhooksSettings). */ @BetaApi("A restructuring of stub classes is planned, so this may break in the future") public static final WebhooksClient create(WebhooksStub stub) { @@ -153,21 +141,10 @@ public WebhooksStub getStub() { return stub; } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Returns the list of all webhooks in the specified agent. * - *

Sample code: - * - *


-   * try (WebhooksClient webhooksClient = WebhooksClient.create()) {
-   *   AgentName parent = AgentName.of("[PROJECT]", "[LOCATION]", "[AGENT]");
-   *   for (Webhook element : webhooksClient.listWebhooks(parent).iterateAll()) {
-   *     // doThingsWith(element);
-   *   }
-   * }
-   * 
- * * @param parent Required. The agent to list all webhooks for. Format: `projects/<Project * ID>/locations/<Location ID>/agents/<Agent ID>`. * @throws com.google.api.gax.rpc.ApiException if the remote call fails @@ -180,21 +157,10 @@ public final ListWebhooksPagedResponse listWebhooks(AgentName parent) { return listWebhooks(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Returns the list of all webhooks in the specified agent. * - *

Sample code: - * - *


-   * try (WebhooksClient webhooksClient = WebhooksClient.create()) {
-   *   AgentName parent = AgentName.of("[PROJECT]", "[LOCATION]", "[AGENT]");
-   *   for (Webhook element : webhooksClient.listWebhooks(parent.toString()).iterateAll()) {
-   *     // doThingsWith(element);
-   *   }
-   * }
-   * 
- * * @param parent Required. The agent to list all webhooks for. Format: `projects/<Project * ID>/locations/<Location ID>/agents/<Agent ID>`. * @throws com.google.api.gax.rpc.ApiException if the remote call fails @@ -204,24 +170,10 @@ public final ListWebhooksPagedResponse listWebhooks(String parent) { return listWebhooks(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Returns the list of all webhooks in the specified agent. * - *

Sample code: - * - *


-   * try (WebhooksClient webhooksClient = WebhooksClient.create()) {
-   *   AgentName parent = AgentName.of("[PROJECT]", "[LOCATION]", "[AGENT]");
-   *   ListWebhooksRequest request = ListWebhooksRequest.newBuilder()
-   *     .setParent(parent.toString())
-   *     .build();
-   *   for (Webhook element : webhooksClient.listWebhooks(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 */ @@ -229,75 +181,31 @@ public final ListWebhooksPagedResponse listWebhooks(ListWebhooksRequest request) return listWebhooksPagedCallable().call(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Returns the list of all webhooks in the specified agent. * *

Sample code: - * - *


-   * try (WebhooksClient webhooksClient = WebhooksClient.create()) {
-   *   AgentName parent = AgentName.of("[PROJECT]", "[LOCATION]", "[AGENT]");
-   *   ListWebhooksRequest request = ListWebhooksRequest.newBuilder()
-   *     .setParent(parent.toString())
-   *     .build();
-   *   ApiFuture<ListWebhooksPagedResponse> future = webhooksClient.listWebhooksPagedCallable().futureCall(request);
-   *   // Do something
-   *   for (Webhook element : future.get().iterateAll()) {
-   *     // doThingsWith(element);
-   *   }
-   * }
-   * 
*/ public final UnaryCallable listWebhooksPagedCallable() { return stub.listWebhooksPagedCallable(); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Returns the list of all webhooks in the specified agent. * *

Sample code: - * - *


-   * try (WebhooksClient webhooksClient = WebhooksClient.create()) {
-   *   AgentName parent = AgentName.of("[PROJECT]", "[LOCATION]", "[AGENT]");
-   *   ListWebhooksRequest request = ListWebhooksRequest.newBuilder()
-   *     .setParent(parent.toString())
-   *     .build();
-   *   while (true) {
-   *     ListWebhooksResponse response = webhooksClient.listWebhooksCallable().call(request);
-   *     for (Webhook element : response.getWebhooksList()) {
-   *       // doThingsWith(element);
-   *     }
-   *     String nextPageToken = response.getNextPageToken();
-   *     if (!Strings.isNullOrEmpty(nextPageToken)) {
-   *       request = request.toBuilder().setPageToken(nextPageToken).build();
-   *     } else {
-   *       break;
-   *     }
-   *   }
-   * }
-   * 
*/ public final UnaryCallable listWebhooksCallable() { return stub.listWebhooksCallable(); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Retrieves the specified webhook. * - *

Sample code: - * - *


-   * try (WebhooksClient webhooksClient = WebhooksClient.create()) {
-   *   WebhookName name = WebhookName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[WEBHOOK]");
-   *   Webhook response = webhooksClient.getWebhook(name);
-   * }
-   * 
- * * @param name Required. The name of the webhook. Format: `projects/<Project * ID>/locations/<Location ID>/agents/<Agent ID>/webhooks/<Webhook ID>`. * @throws com.google.api.gax.rpc.ApiException if the remote call fails @@ -308,19 +216,10 @@ public final Webhook getWebhook(WebhookName name) { return getWebhook(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Retrieves the specified webhook. * - *

Sample code: - * - *


-   * try (WebhooksClient webhooksClient = WebhooksClient.create()) {
-   *   WebhookName name = WebhookName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[WEBHOOK]");
-   *   Webhook response = webhooksClient.getWebhook(name.toString());
-   * }
-   * 
- * * @param name Required. The name of the webhook. Format: `projects/<Project * ID>/locations/<Location ID>/agents/<Agent ID>/webhooks/<Webhook ID>`. * @throws com.google.api.gax.rpc.ApiException if the remote call fails @@ -330,22 +229,10 @@ public final Webhook getWebhook(String name) { return getWebhook(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Retrieves the specified webhook. * - *

Sample code: - * - *


-   * try (WebhooksClient webhooksClient = WebhooksClient.create()) {
-   *   WebhookName name = WebhookName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[WEBHOOK]");
-   *   GetWebhookRequest request = GetWebhookRequest.newBuilder()
-   *     .setName(name.toString())
-   *     .build();
-   *   Webhook response = webhooksClient.getWebhook(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 */ @@ -353,42 +240,20 @@ public final Webhook getWebhook(GetWebhookRequest request) { return getWebhookCallable().call(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Retrieves the specified webhook. * *

Sample code: - * - *


-   * try (WebhooksClient webhooksClient = WebhooksClient.create()) {
-   *   WebhookName name = WebhookName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[WEBHOOK]");
-   *   GetWebhookRequest request = GetWebhookRequest.newBuilder()
-   *     .setName(name.toString())
-   *     .build();
-   *   ApiFuture<Webhook> future = webhooksClient.getWebhookCallable().futureCall(request);
-   *   // Do something
-   *   Webhook response = future.get();
-   * }
-   * 
*/ public final UnaryCallable getWebhookCallable() { return stub.getWebhookCallable(); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Creates a webhook in the specified agent. * - *

Sample code: - * - *


-   * try (WebhooksClient webhooksClient = WebhooksClient.create()) {
-   *   AgentName parent = AgentName.of("[PROJECT]", "[LOCATION]", "[AGENT]");
-   *   Webhook webhook = Webhook.newBuilder().build();
-   *   Webhook response = webhooksClient.createWebhook(parent, webhook);
-   * }
-   * 
- * * @param parent Required. The agent to create a webhook for. Format: `projects/<Project * ID>/locations/<Location ID>/agents/<Agent ID>`. * @param webhook Required. The webhook to create. @@ -403,20 +268,10 @@ public final Webhook createWebhook(AgentName parent, Webhook webhook) { return createWebhook(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Creates a webhook in the specified agent. * - *

Sample code: - * - *


-   * try (WebhooksClient webhooksClient = WebhooksClient.create()) {
-   *   AgentName parent = AgentName.of("[PROJECT]", "[LOCATION]", "[AGENT]");
-   *   Webhook webhook = Webhook.newBuilder().build();
-   *   Webhook response = webhooksClient.createWebhook(parent.toString(), webhook);
-   * }
-   * 
- * * @param parent Required. The agent to create a webhook for. Format: `projects/<Project * ID>/locations/<Location ID>/agents/<Agent ID>`. * @param webhook Required. The webhook to create. @@ -428,24 +283,10 @@ public final Webhook createWebhook(String parent, Webhook webhook) { return createWebhook(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Creates a webhook in the specified agent. * - *

Sample code: - * - *


-   * try (WebhooksClient webhooksClient = WebhooksClient.create()) {
-   *   AgentName parent = AgentName.of("[PROJECT]", "[LOCATION]", "[AGENT]");
-   *   Webhook webhook = Webhook.newBuilder().build();
-   *   CreateWebhookRequest request = CreateWebhookRequest.newBuilder()
-   *     .setParent(parent.toString())
-   *     .setWebhook(webhook)
-   *     .build();
-   *   Webhook response = webhooksClient.createWebhook(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 */ @@ -453,44 +294,20 @@ public final Webhook createWebhook(CreateWebhookRequest request) { return createWebhookCallable().call(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Creates a webhook in the specified agent. * *

Sample code: - * - *


-   * try (WebhooksClient webhooksClient = WebhooksClient.create()) {
-   *   AgentName parent = AgentName.of("[PROJECT]", "[LOCATION]", "[AGENT]");
-   *   Webhook webhook = Webhook.newBuilder().build();
-   *   CreateWebhookRequest request = CreateWebhookRequest.newBuilder()
-   *     .setParent(parent.toString())
-   *     .setWebhook(webhook)
-   *     .build();
-   *   ApiFuture<Webhook> future = webhooksClient.createWebhookCallable().futureCall(request);
-   *   // Do something
-   *   Webhook response = future.get();
-   * }
-   * 
*/ public final UnaryCallable createWebhookCallable() { return stub.createWebhookCallable(); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Updates the specified webhook. * - *

Sample code: - * - *


-   * try (WebhooksClient webhooksClient = WebhooksClient.create()) {
-   *   Webhook webhook = Webhook.newBuilder().build();
-   *   FieldMask updateMask = FieldMask.newBuilder().build();
-   *   Webhook response = webhooksClient.updateWebhook(webhook, updateMask);
-   * }
-   * 
- * * @param webhook Required. The webhook to update. * @param updateMask The mask to control which fields get updated. If the mask is not present, all * fields will be updated. @@ -502,22 +319,10 @@ public final Webhook updateWebhook(Webhook webhook, FieldMask updateMask) { return updateWebhook(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Updates the specified webhook. * - *

Sample code: - * - *


-   * try (WebhooksClient webhooksClient = WebhooksClient.create()) {
-   *   Webhook webhook = Webhook.newBuilder().build();
-   *   UpdateWebhookRequest request = UpdateWebhookRequest.newBuilder()
-   *     .setWebhook(webhook)
-   *     .build();
-   *   Webhook response = webhooksClient.updateWebhook(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 */ @@ -525,41 +330,20 @@ public final Webhook updateWebhook(UpdateWebhookRequest request) { return updateWebhookCallable().call(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Updates the specified webhook. * *

Sample code: - * - *


-   * try (WebhooksClient webhooksClient = WebhooksClient.create()) {
-   *   Webhook webhook = Webhook.newBuilder().build();
-   *   UpdateWebhookRequest request = UpdateWebhookRequest.newBuilder()
-   *     .setWebhook(webhook)
-   *     .build();
-   *   ApiFuture<Webhook> future = webhooksClient.updateWebhookCallable().futureCall(request);
-   *   // Do something
-   *   Webhook response = future.get();
-   * }
-   * 
*/ public final UnaryCallable updateWebhookCallable() { return stub.updateWebhookCallable(); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Deletes the specified webhook. * - *

Sample code: - * - *


-   * try (WebhooksClient webhooksClient = WebhooksClient.create()) {
-   *   WebhookName name = WebhookName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[WEBHOOK]");
-   *   webhooksClient.deleteWebhook(name);
-   * }
-   * 
- * * @param name Required. The name of the webhook to delete. Format: `projects/<Project * ID>/locations/<Location ID>/agents/<Agent ID>/webhooks/<Webhook ID>`. * @throws com.google.api.gax.rpc.ApiException if the remote call fails @@ -570,19 +354,10 @@ public final void deleteWebhook(WebhookName name) { deleteWebhook(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Deletes the specified webhook. * - *

Sample code: - * - *


-   * try (WebhooksClient webhooksClient = WebhooksClient.create()) {
-   *   WebhookName name = WebhookName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[WEBHOOK]");
-   *   webhooksClient.deleteWebhook(name.toString());
-   * }
-   * 
- * * @param name Required. The name of the webhook to delete. Format: `projects/<Project * ID>/locations/<Location ID>/agents/<Agent ID>/webhooks/<Webhook ID>`. * @throws com.google.api.gax.rpc.ApiException if the remote call fails @@ -592,22 +367,10 @@ public final void deleteWebhook(String name) { deleteWebhook(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Deletes the specified webhook. * - *

Sample code: - * - *


-   * try (WebhooksClient webhooksClient = WebhooksClient.create()) {
-   *   WebhookName name = WebhookName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[WEBHOOK]");
-   *   DeleteWebhookRequest request = DeleteWebhookRequest.newBuilder()
-   *     .setName(name.toString())
-   *     .build();
-   *   webhooksClient.deleteWebhook(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 */ @@ -615,23 +378,11 @@ public final void deleteWebhook(DeleteWebhookRequest request) { deleteWebhookCallable().call(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Deletes the specified webhook. * *

Sample code: - * - *


-   * try (WebhooksClient webhooksClient = WebhooksClient.create()) {
-   *   WebhookName name = WebhookName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[WEBHOOK]");
-   *   DeleteWebhookRequest request = DeleteWebhookRequest.newBuilder()
-   *     .setName(name.toString())
-   *     .build();
-   *   ApiFuture<Void> future = webhooksClient.deleteWebhookCallable().futureCall(request);
-   *   // Do something
-   *   future.get();
-   * }
-   * 
*/ public final UnaryCallable deleteWebhookCallable() { return stub.deleteWebhookCallable(); diff --git a/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3beta1/WebhooksSettings.java b/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3beta1/WebhooksSettings.java index e4545ff91..adeba06d0 100644 --- a/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3beta1/WebhooksSettings.java +++ b/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3beta1/WebhooksSettings.java @@ -5,7 +5,7 @@ * 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 + * 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, @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.google.cloud.dialogflow.cx.v3beta1; import static com.google.cloud.dialogflow.cx.v3beta1.WebhooksClient.ListWebhooksPagedResponse; @@ -34,7 +35,7 @@ import java.util.List; import javax.annotation.Generated; -// AUTO-GENERATED DOCUMENTATION AND CLASS +// AUTO-GENERATED DOCUMENTATION AND CLASS. /** * Settings class to configure an instance of {@link WebhooksClient}. * @@ -51,23 +52,23 @@ * *

For example, to set the total timeout of getWebhook to 30 seconds: * - *

- * 
- * WebhooksSettings.Builder webhooksSettingsBuilder =
- *     WebhooksSettings.newBuilder();
+ * 
{@code
+ * WebhooksSettings.Builder webhooksSettingsBuilder = WebhooksSettings.newBuilder();
  * webhooksSettingsBuilder
  *     .getWebhookSettings()
  *     .setRetrySettings(
- *         webhooksSettingsBuilder.getWebhookSettings().getRetrySettings().toBuilder()
+ *         webhooksSettingsBuilder
+ *             .getWebhookSettings()
+ *             .getRetrySettings()
+ *             .toBuilder()
  *             .setTotalTimeout(Duration.ofSeconds(30))
  *             .build());
  * WebhooksSettings webhooksSettings = webhooksSettingsBuilder.build();
- * 
- * 
+ * }
*/ -@Generated("by gapic-generator") -@BetaApi +@Generated("by gapic-generator-java") public class WebhooksSettings extends ClientSettings { + /** Returns the object with the settings used for calls to listWebhooks. */ public PagedCallSettings listWebhooksSettings() { @@ -153,18 +154,15 @@ protected WebhooksSettings(Builder settingsBuilder) throws IOException { /** Builder for WebhooksSettings. */ public static class Builder extends ClientSettings.Builder { + protected Builder() throws IOException { - this((ClientContext) null); + this(((ClientContext) null)); } protected Builder(ClientContext clientContext) { super(WebhooksStubSettings.newBuilder(clientContext)); } - private static Builder createDefault() { - return new Builder(WebhooksStubSettings.newBuilder()); - } - protected Builder(WebhooksSettings settings) { super(settings.getStubSettings().toBuilder()); } @@ -173,11 +171,15 @@ protected Builder(WebhooksStubSettings.Builder stubSettings) { super(stubSettings); } + private static Builder createDefault() { + return new Builder(WebhooksStubSettings.newBuilder()); + } + public WebhooksStubSettings.Builder getStubSettingsBuilder() { return ((WebhooksStubSettings.Builder) getStubSettings()); } - // NEXT_MAJOR_VER: remove 'throws Exception' + // NEXT_MAJOR_VER: remove 'throws Exception'. /** * Applies the given settings updater function to all of the unary API methods in this service. * diff --git a/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3beta1/package-info.java b/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3beta1/package-info.java index 69e3355f5..c91a900f2 100644 --- a/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3beta1/package-info.java +++ b/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3beta1/package-info.java @@ -5,7 +5,7 @@ * 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 + * 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, @@ -15,121 +15,48 @@ */ /** - * A client to Dialogflow API. + * The interfaces provided are listed below, along with usage samples. * - *

The interfaces provided are listed below, along with usage samples. - * - *

=========== PagesClient =========== - * - *

Service Description: Service for managing [Pages][google.cloud.dialogflow.cx.v3beta1.Page]. - * - *

Sample for PagesClient: - * - *

- * 
- * try (PagesClient pagesClient = PagesClient.create()) {
- *   PageName name = PageName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]", "[PAGE]");
- *   Page response = pagesClient.getPage(name);
- * }
- * 
- * 
- * - * =========== FlowsClient =========== - * - *

Service Description: Service for managing [Flows][google.cloud.dialogflow.cx.v3beta1.Flow]. - * - *

Sample for FlowsClient: - * - *

- * 
- * try (FlowsClient flowsClient = FlowsClient.create()) {
- *   AgentName parent = AgentName.of("[PROJECT]", "[LOCATION]", "[AGENT]");
- *   Flow flow = Flow.newBuilder().build();
- *   Flow response = flowsClient.createFlow(parent, flow);
- * }
- * 
- * 
- * - * ============ AgentsClient ============ + *

======================= AgentsClient ======================= * *

Service Description: Service for managing [Agents][google.cloud.dialogflow.cx.v3beta1.Agent]. * *

Sample for AgentsClient: * - *

- * 
- * try (AgentsClient agentsClient = AgentsClient.create()) {
- *   AgentName name = AgentName.of("[PROJECT]", "[LOCATION]", "[AGENT]");
- *   Agent response = agentsClient.getAgent(name);
- * }
- * 
- * 
- * - * ================= EntityTypesClient ================= + *

======================= EntityTypesClient ======================= * *

Service Description: Service for managing * [EntityTypes][google.cloud.dialogflow.cx.v3beta1.EntityType]. * *

Sample for EntityTypesClient: * - *

- * 
- * try (EntityTypesClient entityTypesClient = EntityTypesClient.create()) {
- *   EntityTypeName name = EntityTypeName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[ENTITY_TYPE]");
- *   EntityType response = entityTypesClient.getEntityType(name);
- * }
- * 
- * 
- * - * ================== EnvironmentsClient ================== + *

======================= EnvironmentsClient ======================= * *

Service Description: Service for managing * [Environments][google.cloud.dialogflow.cx.v3beta1.Environment]. * *

Sample for EnvironmentsClient: * - *

- * 
- * try (EnvironmentsClient environmentsClient = EnvironmentsClient.create()) {
- *   EnvironmentName name = EnvironmentName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[ENVIRONMENT]");
- *   Environment response = environmentsClient.getEnvironment(name);
- * }
- * 
- * 
+ *

======================= FlowsClient ======================= + * + *

Service Description: Service for managing [Flows][google.cloud.dialogflow.cx.v3beta1.Flow]. * - * ============= IntentsClient ============= + *

Sample for FlowsClient: + * + *

======================= IntentsClient ======================= * *

Service Description: Service for managing * [Intents][google.cloud.dialogflow.cx.v3beta1.Intent]. * *

Sample for IntentsClient: * - *

- * 
- * try (IntentsClient intentsClient = IntentsClient.create()) {
- *   IntentName name = IntentName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[INTENT]");
- *   Intent response = intentsClient.getIntent(name);
- * }
- * 
- * 
- * - * ======================== SessionEntityTypesClient ======================== - * - *

Service Description: Service for managing - * [SessionEntityTypes][google.cloud.dialogflow.cx.v3beta1.SessionEntityType]. + *

======================= PagesClient ======================= * - *

Sample for SessionEntityTypesClient: + *

Service Description: Service for managing [Pages][google.cloud.dialogflow.cx.v3beta1.Page]. * - *

- * 
- * try (SessionEntityTypesClient sessionEntityTypesClient = SessionEntityTypesClient.create()) {
- *   SessionEntityTypeName name = SessionEntityTypeName.ofProjectLocationAgentSessionEntityTypeName("[PROJECT]", "[LOCATION]", "[AGENT]", "[SESSION]", "[ENTITY_TYPE]");
- *   SessionEntityType response = sessionEntityTypesClient.getSessionEntityType(name);
- * }
- * 
- * 
+ *

Sample for PagesClient: * - * ============== SessionsClient ============== + *

======================= SessionsClient ======================= * *

Service Description: A session represents an interaction with a user. You retrieve user input * and pass it to the [DetectIntent][google.cloud.dialogflow.cx.v3beta1.Sessions.DetectIntent] @@ -137,69 +64,35 @@ * *

Sample for SessionsClient: * - *

- * 
- * try (SessionsClient sessionsClient = SessionsClient.create()) {
- *   SessionName session = SessionName.ofProjectLocationAgentSessionName("[PROJECT]", "[LOCATION]", "[AGENT]", "[SESSION]");
- *   QueryInput queryInput = QueryInput.newBuilder().build();
- *   DetectIntentRequest request = DetectIntentRequest.newBuilder()
- *     .setSession(session.toString())
- *     .setQueryInput(queryInput)
- *     .build();
- *   DetectIntentResponse response = sessionsClient.detectIntent(request);
- * }
- * 
- * 
- * - * =========================== TransitionRouteGroupsClient =========================== + *

======================= SessionEntityTypesClient ======================= + * + *

Service Description: Service for managing + * [SessionEntityTypes][google.cloud.dialogflow.cx.v3beta1.SessionEntityType]. + * + *

Sample for SessionEntityTypesClient: + * + *

======================= TransitionRouteGroupsClient ======================= * *

Service Description: Service for managing * [TransitionRouteGroups][google.cloud.dialogflow.cx.v3beta1.TransitionRouteGroup]. * *

Sample for TransitionRouteGroupsClient: * - *

- * 
- * try (TransitionRouteGroupsClient transitionRouteGroupsClient = TransitionRouteGroupsClient.create()) {
- *   TransitionRouteGroupName name = TransitionRouteGroupName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]", "[TRANSITION_ROUTE_GROUP]");
- *   TransitionRouteGroup response = transitionRouteGroupsClient.getTransitionRouteGroup(name);
- * }
- * 
- * 
- * - * ============== VersionsClient ============== + *

======================= VersionsClient ======================= * *

Service Description: Service for managing * [Versions][google.cloud.dialogflow.cx.v3beta1.Version]. * *

Sample for VersionsClient: * - *

- * 
- * try (VersionsClient versionsClient = VersionsClient.create()) {
- *   VersionName name = VersionName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]", "[VERSION]");
- *   Version response = versionsClient.getVersion(name);
- * }
- * 
- * 
- * - * ============== WebhooksClient ============== + *

======================= WebhooksClient ======================= * *

Service Description: Service for managing * [Webhooks][google.cloud.dialogflow.cx.v3beta1.Webhook]. * *

Sample for WebhooksClient: - * - *

- * 
- * try (WebhooksClient webhooksClient = WebhooksClient.create()) {
- *   WebhookName name = WebhookName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[WEBHOOK]");
- *   Webhook response = webhooksClient.getWebhook(name);
- * }
- * 
- * 
*/ -@Generated("by gapic-generator") +@Generated("by gapic-generator-java") package com.google.cloud.dialogflow.cx.v3beta1; import javax.annotation.Generated; diff --git a/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3beta1/stub/AgentsStub.java b/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3beta1/stub/AgentsStub.java index f325d0fde..371879a85 100644 --- a/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3beta1/stub/AgentsStub.java +++ b/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3beta1/stub/AgentsStub.java @@ -5,7 +5,7 @@ * 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 + * 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, @@ -13,11 +13,11 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.google.cloud.dialogflow.cx.v3beta1.stub; import static com.google.cloud.dialogflow.cx.v3beta1.AgentsClient.ListAgentsPagedResponse; -import com.google.api.core.BetaApi; import com.google.api.gax.core.BackgroundResource; import com.google.api.gax.rpc.OperationCallable; import com.google.api.gax.rpc.UnaryCallable; @@ -37,17 +37,15 @@ import com.google.protobuf.Struct; import javax.annotation.Generated; -// AUTO-GENERATED DOCUMENTATION AND CLASS +// AUTO-GENERATED DOCUMENTATION AND CLASS. /** - * Base stub class for Dialogflow API. + * Base stub class for the Agents service API. * *

This class is for advanced usage and reflects the underlying API directly. */ @Generated("by gapic-generator") -@BetaApi("A restructuring of stub classes is planned, so this may break in the future") public abstract class AgentsStub implements BackgroundResource { - @BetaApi("The surface for use by generated code is not stable yet and may change in the future.") public OperationsStub getOperationsStub() { throw new UnsupportedOperationException("Not implemented: getOperationsStub()"); } @@ -76,7 +74,6 @@ public UnaryCallable deleteAgentCallable() { throw new UnsupportedOperationException("Not implemented: deleteAgentCallable()"); } - @BetaApi("The surface for use by generated code is not stable yet and may change in the future.") public OperationCallable exportAgentOperationCallable() { throw new UnsupportedOperationException("Not implemented: exportAgentOperationCallable()"); @@ -86,7 +83,6 @@ public UnaryCallable exportAgentCallable() { throw new UnsupportedOperationException("Not implemented: exportAgentCallable()"); } - @BetaApi("The surface for use by generated code is not stable yet and may change in the future.") public OperationCallable restoreAgentOperationCallable() { throw new UnsupportedOperationException("Not implemented: restoreAgentOperationCallable()"); } diff --git a/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3beta1/stub/AgentsStubSettings.java b/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3beta1/stub/AgentsStubSettings.java index 44b17e650..3daccfc7e 100644 --- a/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3beta1/stub/AgentsStubSettings.java +++ b/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3beta1/stub/AgentsStubSettings.java @@ -5,7 +5,7 @@ * 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 + * 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, @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.google.cloud.dialogflow.cx.v3beta1.stub; import static com.google.cloud.dialogflow.cx.v3beta1.AgentsClient.ListAgentsPagedResponse; @@ -65,7 +66,7 @@ import javax.annotation.Generated; import org.threeten.bp.Duration; -// AUTO-GENERATED DOCUMENTATION AND CLASS +// AUTO-GENERATED DOCUMENTATION AND CLASS. /** * Settings class to configure an instance of {@link AgentsStub}. * @@ -82,22 +83,22 @@ * *

For example, to set the total timeout of getAgent to 30 seconds: * - *

- * 
- * AgentsStubSettings.Builder agentsSettingsBuilder =
- *     AgentsStubSettings.newBuilder();
+ * 
{@code
+ * AgentsStubSettings.Builder agentsSettingsBuilder = AgentsStubSettings.newBuilder();
  * agentsSettingsBuilder
  *     .getAgentSettings()
  *     .setRetrySettings(
- *         agentsSettingsBuilder.getAgentSettings().getRetrySettings().toBuilder()
+ *         agentsSettingsBuilder
+ *             .getAgentSettings()
+ *             .getRetrySettings()
+ *             .toBuilder()
  *             .setTotalTimeout(Duration.ofSeconds(30))
  *             .build());
  * AgentsStubSettings agentsSettings = agentsSettingsBuilder.build();
- * 
- * 
+ * }
*/ -@Generated("by gapic-generator") @BetaApi +@Generated("by gapic-generator-java") public class AgentsStubSettings extends StubSettings { /** The default scopes of the service. */ private static final ImmutableList DEFAULT_SERVICE_SCOPES = @@ -119,6 +120,59 @@ public class AgentsStubSettings extends StubSettings { private final OperationCallSettings restoreAgentOperationSettings; + private static final PagedListDescriptor + LIST_AGENTS_PAGE_STR_DESC = + new PagedListDescriptor() { + @Override + public String emptyToken() { + return ""; + } + + @Override + public ListAgentsRequest injectToken(ListAgentsRequest payload, String token) { + return ListAgentsRequest.newBuilder(payload).setPageToken(token).build(); + } + + @Override + public ListAgentsRequest injectPageSize(ListAgentsRequest payload, int pageSize) { + return ListAgentsRequest.newBuilder(payload).setPageSize(pageSize).build(); + } + + @Override + public Integer extractPageSize(ListAgentsRequest payload) { + return payload.getPageSize(); + } + + @Override + public String extractNextToken(ListAgentsResponse payload) { + return payload.getNextPageToken(); + } + + @Override + public Iterable extractResources(ListAgentsResponse payload) { + return payload.getAgentsList() == null + ? ImmutableList.of() + : payload.getAgentsList(); + } + }; + + private static final PagedListResponseFactory< + ListAgentsRequest, ListAgentsResponse, ListAgentsPagedResponse> + LIST_AGENTS_PAGE_STR_FACT = + new PagedListResponseFactory< + ListAgentsRequest, ListAgentsResponse, ListAgentsPagedResponse>() { + @Override + public ApiFuture getFuturePagedResponse( + UnaryCallable callable, + ListAgentsRequest request, + ApiCallContext context, + ApiFuture futureResponse) { + PageContext pageContext = + PageContext.create(callable, LIST_AGENTS_PAGE_STR_DESC, request, context); + return ListAgentsPagedResponse.createAsync(pageContext, futureResponse); + } + }; + /** Returns the object with the settings used for calls to listAgents. */ public PagedCallSettings listAgentsSettings() { @@ -151,7 +205,6 @@ public UnaryCallSettings exportAgentSettings() { } /** Returns the object with the settings used for calls to exportAgent. */ - @BetaApi("The surface for use by generated code is not stable yet and may change in the future.") public OperationCallSettings exportAgentOperationSettings() { return exportAgentOperationSettings; @@ -163,7 +216,6 @@ public UnaryCallSettings restoreAgentSettings() } /** Returns the object with the settings used for calls to restoreAgent. */ - @BetaApi("The surface for use by generated code is not stable yet and may change in the future.") public OperationCallSettings restoreAgentOperationSettings() { return restoreAgentOperationSettings; } @@ -174,10 +226,10 @@ public AgentsStub createStub() throws IOException { .getTransportName() .equals(GrpcTransportChannel.getGrpcTransportName())) { return GrpcAgentsStub.create(this); - } else { - throw new UnsupportedOperationException( - "Transport not supported: " + getTransportChannelProvider().getTransportName()); } + throw new UnsupportedOperationException( + String.format( + "Transport not supported: %s", getTransportChannelProvider().getTransportName())); } /** Returns a builder for the default ExecutorProvider for this service. */ @@ -247,63 +299,9 @@ protected AgentsStubSettings(Builder settingsBuilder) throws IOException { restoreAgentOperationSettings = settingsBuilder.restoreAgentOperationSettings().build(); } - private static final PagedListDescriptor - LIST_AGENTS_PAGE_STR_DESC = - new PagedListDescriptor() { - @Override - public String emptyToken() { - return ""; - } - - @Override - public ListAgentsRequest injectToken(ListAgentsRequest payload, String token) { - return ListAgentsRequest.newBuilder(payload).setPageToken(token).build(); - } - - @Override - public ListAgentsRequest injectPageSize(ListAgentsRequest payload, int pageSize) { - return ListAgentsRequest.newBuilder(payload).setPageSize(pageSize).build(); - } - - @Override - public Integer extractPageSize(ListAgentsRequest payload) { - return payload.getPageSize(); - } - - @Override - public String extractNextToken(ListAgentsResponse payload) { - return payload.getNextPageToken(); - } - - @Override - public Iterable extractResources(ListAgentsResponse payload) { - return payload.getAgentsList() != null - ? payload.getAgentsList() - : ImmutableList.of(); - } - }; - - private static final PagedListResponseFactory< - ListAgentsRequest, ListAgentsResponse, ListAgentsPagedResponse> - LIST_AGENTS_PAGE_STR_FACT = - new PagedListResponseFactory< - ListAgentsRequest, ListAgentsResponse, ListAgentsPagedResponse>() { - @Override - public ApiFuture getFuturePagedResponse( - UnaryCallable callable, - ListAgentsRequest request, - ApiCallContext context, - ApiFuture futureResponse) { - PageContext pageContext = - PageContext.create(callable, LIST_AGENTS_PAGE_STR_DESC, request, context); - return ListAgentsPagedResponse.createAsync(pageContext, futureResponse); - } - }; - /** Builder for AgentsStubSettings. */ public static class Builder extends StubSettings.Builder { private final ImmutableList> unaryMethodSettingsBuilders; - private final PagedCallSettings.Builder< ListAgentsRequest, ListAgentsResponse, ListAgentsPagedResponse> listAgentsSettings; @@ -317,7 +315,6 @@ public static class Builder extends StubSettings.Builder restoreAgentSettings; private final OperationCallSettings.Builder restoreAgentOperationSettings; - private static final ImmutableMap> RETRYABLE_CODE_DEFINITIONS; @@ -325,14 +322,8 @@ public static class Builder extends StubSettings.Builder> definitions = ImmutableMap.builder(); definitions.put( - "retry_policy_1_codes", - ImmutableSet.copyOf(Lists.newArrayList(StatusCode.Code.UNAVAILABLE))); - definitions.put("no_retry_codes", ImmutableSet.copyOf(Lists.newArrayList())); - definitions.put( - "retry_policy_2_codes", + "retry_policy_0_codes", ImmutableSet.copyOf(Lists.newArrayList(StatusCode.Code.UNAVAILABLE))); - definitions.put( - "no_retry_1_codes", ImmutableSet.copyOf(Lists.newArrayList())); RETRYABLE_CODE_DEFINITIONS = definitions.build(); } @@ -351,54 +342,25 @@ public static class Builder extends StubSettings.Builder>of( + listAgentsSettings, + getAgentSettings, + createAgentSettings, + updateAgentSettings, + deleteAgentSettings, + exportAgentSettings, + restoreAgentSettings); + } + private static Builder createDefault() { - Builder builder = new Builder((ClientContext) null); + Builder builder = new Builder(((ClientContext) null)); + builder.setTransportChannelProvider(defaultTransportChannelProvider()); builder.setCredentialsProvider(defaultCredentialsProviderBuilder().build()); builder.setInternalHeaderProvider(defaultApiClientHeaderProviderBuilder().build()); builder.setEndpoint(getDefaultEndpoint()); + return initDefaults(builder); } private static Builder initDefaults(Builder builder) { - builder .listAgentsSettings() - .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_1_codes")) - .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_1_params")); + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params")); builder .getAgentSettings() - .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_1_codes")) - .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_1_params")); + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params")); builder .createAgentSettings() - .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_1_codes")) - .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_1_params")); + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params")); builder .updateAgentSettings() - .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_1_codes")) - .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_1_params")); + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params")); builder .deleteAgentSettings() - .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_1_codes")) - .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_1_params")); + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params")); builder .exportAgentSettings() - .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_1_codes")) - .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_1_params")); + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params")); builder .restoreAgentSettings() - .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_1_codes")) - .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_1_params")); + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params")); + builder .exportAgentOperationSettings() .setInitialCallSettings( UnaryCallSettings.newUnaryCallSettingsBuilder() - .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_1_codes")) - .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_1_params")) + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params")) .build()) .setResponseTransformer( ProtoOperationTransformers.ResponseTransformer.create(ExportAgentResponse.class)) @@ -473,21 +460,22 @@ private static Builder initDefaults(Builder builder) { .setPollingAlgorithm( OperationTimedPollAlgorithm.create( RetrySettings.newBuilder() - .setInitialRetryDelay(Duration.ofMillis(500L)) + .setInitialRetryDelay(Duration.ofMillis(5000L)) .setRetryDelayMultiplier(1.5) - .setMaxRetryDelay(Duration.ofMillis(5000L)) - .setInitialRpcTimeout(Duration.ZERO) // ignored - .setRpcTimeoutMultiplier(1.0) // ignored - .setMaxRpcTimeout(Duration.ZERO) // ignored + .setMaxRetryDelay(Duration.ofMillis(45000L)) + .setInitialRpcTimeout(Duration.ZERO) + .setRpcTimeoutMultiplier(1.0) + .setMaxRpcTimeout(Duration.ZERO) .setTotalTimeout(Duration.ofMillis(300000L)) .build())); + builder .restoreAgentOperationSettings() .setInitialCallSettings( UnaryCallSettings .newUnaryCallSettingsBuilder() - .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_1_codes")) - .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_1_params")) + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params")) .build()) .setResponseTransformer( ProtoOperationTransformers.ResponseTransformer.create(Empty.class)) @@ -496,43 +484,19 @@ private static Builder initDefaults(Builder builder) { .setPollingAlgorithm( OperationTimedPollAlgorithm.create( RetrySettings.newBuilder() - .setInitialRetryDelay(Duration.ofMillis(500L)) + .setInitialRetryDelay(Duration.ofMillis(5000L)) .setRetryDelayMultiplier(1.5) - .setMaxRetryDelay(Duration.ofMillis(5000L)) - .setInitialRpcTimeout(Duration.ZERO) // ignored - .setRpcTimeoutMultiplier(1.0) // ignored - .setMaxRpcTimeout(Duration.ZERO) // ignored + .setMaxRetryDelay(Duration.ofMillis(45000L)) + .setInitialRpcTimeout(Duration.ZERO) + .setRpcTimeoutMultiplier(1.0) + .setMaxRpcTimeout(Duration.ZERO) .setTotalTimeout(Duration.ofMillis(300000L)) .build())); return builder; } - protected Builder(AgentsStubSettings settings) { - super(settings); - - listAgentsSettings = settings.listAgentsSettings.toBuilder(); - getAgentSettings = settings.getAgentSettings.toBuilder(); - createAgentSettings = settings.createAgentSettings.toBuilder(); - updateAgentSettings = settings.updateAgentSettings.toBuilder(); - deleteAgentSettings = settings.deleteAgentSettings.toBuilder(); - exportAgentSettings = settings.exportAgentSettings.toBuilder(); - exportAgentOperationSettings = settings.exportAgentOperationSettings.toBuilder(); - restoreAgentSettings = settings.restoreAgentSettings.toBuilder(); - restoreAgentOperationSettings = settings.restoreAgentOperationSettings.toBuilder(); - - unaryMethodSettingsBuilders = - ImmutableList.>of( - listAgentsSettings, - getAgentSettings, - createAgentSettings, - updateAgentSettings, - deleteAgentSettings, - exportAgentSettings, - restoreAgentSettings); - } - - // NEXT_MAJOR_VER: remove 'throws Exception' + // NEXT_MAJOR_VER: remove 'throws Exception'. /** * Applies the given settings updater function to all of the unary API methods in this service. * diff --git a/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3beta1/stub/EntityTypesStub.java b/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3beta1/stub/EntityTypesStub.java index 8794c681d..54cabdc2f 100644 --- a/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3beta1/stub/EntityTypesStub.java +++ b/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3beta1/stub/EntityTypesStub.java @@ -5,7 +5,7 @@ * 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 + * 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, @@ -13,11 +13,11 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.google.cloud.dialogflow.cx.v3beta1.stub; import static com.google.cloud.dialogflow.cx.v3beta1.EntityTypesClient.ListEntityTypesPagedResponse; -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.cx.v3beta1.CreateEntityTypeRequest; @@ -30,14 +30,13 @@ import com.google.protobuf.Empty; import javax.annotation.Generated; -// AUTO-GENERATED DOCUMENTATION AND CLASS +// AUTO-GENERATED DOCUMENTATION AND CLASS. /** - * Base stub class for Dialogflow API. + * Base stub class for the EntityTypes service API. * *

This class is for advanced usage and reflects the underlying API directly. */ @Generated("by gapic-generator") -@BetaApi("A restructuring of stub classes is planned, so this may break in the future") public abstract class EntityTypesStub implements BackgroundResource { public UnaryCallable diff --git a/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3beta1/stub/EntityTypesStubSettings.java b/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3beta1/stub/EntityTypesStubSettings.java index e5f50a738..741a49822 100644 --- a/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3beta1/stub/EntityTypesStubSettings.java +++ b/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3beta1/stub/EntityTypesStubSettings.java @@ -5,7 +5,7 @@ * 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 + * 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, @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.google.cloud.dialogflow.cx.v3beta1.stub; import static com.google.cloud.dialogflow.cx.v3beta1.EntityTypesClient.ListEntityTypesPagedResponse; @@ -56,7 +57,7 @@ import javax.annotation.Generated; import org.threeten.bp.Duration; -// AUTO-GENERATED DOCUMENTATION AND CLASS +// AUTO-GENERATED DOCUMENTATION AND CLASS. /** * Settings class to configure an instance of {@link EntityTypesStub}. * @@ -73,22 +74,23 @@ * *

For example, to set the total timeout of getEntityType to 30 seconds: * - *

- * 
+ * 
{@code
  * EntityTypesStubSettings.Builder entityTypesSettingsBuilder =
  *     EntityTypesStubSettings.newBuilder();
  * entityTypesSettingsBuilder
  *     .getEntityTypeSettings()
  *     .setRetrySettings(
- *         entityTypesSettingsBuilder.getEntityTypeSettings().getRetrySettings().toBuilder()
+ *         entityTypesSettingsBuilder
+ *             .getEntityTypeSettings()
+ *             .getRetrySettings()
+ *             .toBuilder()
  *             .setTotalTimeout(Duration.ofSeconds(30))
  *             .build());
  * EntityTypesStubSettings entityTypesSettings = entityTypesSettingsBuilder.build();
- * 
- * 
+ * }
*/ -@Generated("by gapic-generator") @BetaApi +@Generated("by gapic-generator-java") public class EntityTypesStubSettings extends StubSettings { /** The default scopes of the service. */ private static final ImmutableList DEFAULT_SERVICE_SCOPES = @@ -105,6 +107,62 @@ public class EntityTypesStubSettings extends StubSettings updateEntityTypeSettings; private final UnaryCallSettings deleteEntityTypeSettings; + private static final PagedListDescriptor< + ListEntityTypesRequest, ListEntityTypesResponse, EntityType> + LIST_ENTITY_TYPES_PAGE_STR_DESC = + new PagedListDescriptor() { + @Override + public String emptyToken() { + return ""; + } + + @Override + public ListEntityTypesRequest injectToken( + ListEntityTypesRequest payload, String token) { + return ListEntityTypesRequest.newBuilder(payload).setPageToken(token).build(); + } + + @Override + public ListEntityTypesRequest injectPageSize( + ListEntityTypesRequest payload, int pageSize) { + return ListEntityTypesRequest.newBuilder(payload).setPageSize(pageSize).build(); + } + + @Override + public Integer extractPageSize(ListEntityTypesRequest payload) { + return payload.getPageSize(); + } + + @Override + public String extractNextToken(ListEntityTypesResponse payload) { + return payload.getNextPageToken(); + } + + @Override + public Iterable extractResources(ListEntityTypesResponse payload) { + return payload.getEntityTypesList() == null + ? ImmutableList.of() + : payload.getEntityTypesList(); + } + }; + + private static final PagedListResponseFactory< + ListEntityTypesRequest, ListEntityTypesResponse, ListEntityTypesPagedResponse> + LIST_ENTITY_TYPES_PAGE_STR_FACT = + new PagedListResponseFactory< + ListEntityTypesRequest, ListEntityTypesResponse, ListEntityTypesPagedResponse>() { + @Override + public ApiFuture getFuturePagedResponse( + UnaryCallable callable, + ListEntityTypesRequest request, + ApiCallContext context, + ApiFuture futureResponse) { + PageContext pageContext = + PageContext.create(callable, LIST_ENTITY_TYPES_PAGE_STR_DESC, request, context); + return ListEntityTypesPagedResponse.createAsync(pageContext, futureResponse); + } + }; + /** Returns the object with the settings used for calls to listEntityTypes. */ public PagedCallSettings< ListEntityTypesRequest, ListEntityTypesResponse, ListEntityTypesPagedResponse> @@ -138,10 +196,10 @@ public EntityTypesStub createStub() throws IOException { .getTransportName() .equals(GrpcTransportChannel.getGrpcTransportName())) { return GrpcEntityTypesStub.create(this); - } else { - throw new UnsupportedOperationException( - "Transport not supported: " + getTransportChannelProvider().getTransportName()); } + throw new UnsupportedOperationException( + String.format( + "Transport not supported: %s", getTransportChannelProvider().getTransportName())); } /** Returns a builder for the default ExecutorProvider for this service. */ @@ -208,66 +266,9 @@ protected EntityTypesStubSettings(Builder settingsBuilder) throws IOException { deleteEntityTypeSettings = settingsBuilder.deleteEntityTypeSettings().build(); } - private static final PagedListDescriptor< - ListEntityTypesRequest, ListEntityTypesResponse, EntityType> - LIST_ENTITY_TYPES_PAGE_STR_DESC = - new PagedListDescriptor() { - @Override - public String emptyToken() { - return ""; - } - - @Override - public ListEntityTypesRequest injectToken( - ListEntityTypesRequest payload, String token) { - return ListEntityTypesRequest.newBuilder(payload).setPageToken(token).build(); - } - - @Override - public ListEntityTypesRequest injectPageSize( - ListEntityTypesRequest payload, int pageSize) { - return ListEntityTypesRequest.newBuilder(payload).setPageSize(pageSize).build(); - } - - @Override - public Integer extractPageSize(ListEntityTypesRequest payload) { - return payload.getPageSize(); - } - - @Override - public String extractNextToken(ListEntityTypesResponse payload) { - return payload.getNextPageToken(); - } - - @Override - public Iterable extractResources(ListEntityTypesResponse payload) { - return payload.getEntityTypesList() != null - ? payload.getEntityTypesList() - : ImmutableList.of(); - } - }; - - private static final PagedListResponseFactory< - ListEntityTypesRequest, ListEntityTypesResponse, ListEntityTypesPagedResponse> - LIST_ENTITY_TYPES_PAGE_STR_FACT = - new PagedListResponseFactory< - ListEntityTypesRequest, ListEntityTypesResponse, ListEntityTypesPagedResponse>() { - @Override - public ApiFuture getFuturePagedResponse( - UnaryCallable callable, - ListEntityTypesRequest request, - ApiCallContext context, - ApiFuture futureResponse) { - PageContext pageContext = - PageContext.create(callable, LIST_ENTITY_TYPES_PAGE_STR_DESC, request, context); - return ListEntityTypesPagedResponse.createAsync(pageContext, futureResponse); - } - }; - /** Builder for EntityTypesStubSettings. */ public static class Builder extends StubSettings.Builder { private final ImmutableList> unaryMethodSettingsBuilders; - private final PagedCallSettings.Builder< ListEntityTypesRequest, ListEntityTypesResponse, ListEntityTypesPagedResponse> listEntityTypesSettings; @@ -278,7 +279,6 @@ public static class Builder extends StubSettings.Builder deleteEntityTypeSettings; - private static final ImmutableMap> RETRYABLE_CODE_DEFINITIONS; @@ -286,14 +286,8 @@ public static class Builder extends StubSettings.Builder> definitions = ImmutableMap.builder(); definitions.put( - "retry_policy_1_codes", - ImmutableSet.copyOf(Lists.newArrayList(StatusCode.Code.UNAVAILABLE))); - definitions.put("no_retry_codes", ImmutableSet.copyOf(Lists.newArrayList())); - definitions.put( - "retry_policy_2_codes", + "retry_policy_0_codes", ImmutableSet.copyOf(Lists.newArrayList(StatusCode.Code.UNAVAILABLE))); - definitions.put( - "no_retry_1_codes", ImmutableSet.copyOf(Lists.newArrayList())); RETRYABLE_CODE_DEFINITIONS = definitions.build(); } @@ -312,46 +306,21 @@ public static class Builder extends StubSettings.Builder>of( + listEntityTypesSettings, + getEntityTypeSettings, + createEntityTypeSettings, + updateEntityTypeSettings, + deleteEntityTypeSettings); + } + private static Builder createDefault() { - Builder builder = new Builder((ClientContext) null); + Builder builder = new Builder(((ClientContext) null)); + builder.setTransportChannelProvider(defaultTransportChannelProvider()); builder.setCredentialsProvider(defaultCredentialsProviderBuilder().build()); builder.setInternalHeaderProvider(defaultApiClientHeaderProviderBuilder().build()); builder.setEndpoint(getDefaultEndpoint()); + return initDefaults(builder); } private static Builder initDefaults(Builder builder) { - builder .listEntityTypesSettings() - .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_1_codes")) - .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_1_params")); + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params")); builder .getEntityTypeSettings() - .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_1_codes")) - .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_1_params")); + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params")); builder .createEntityTypeSettings() - .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_1_codes")) - .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_1_params")); + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params")); builder .updateEntityTypeSettings() - .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_1_codes")) - .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_1_params")); + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params")); builder .deleteEntityTypeSettings() - .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_1_codes")) - .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_1_params")); + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params")); return builder; } - protected Builder(EntityTypesStubSettings settings) { - super(settings); - - listEntityTypesSettings = settings.listEntityTypesSettings.toBuilder(); - getEntityTypeSettings = settings.getEntityTypeSettings.toBuilder(); - createEntityTypeSettings = settings.createEntityTypeSettings.toBuilder(); - updateEntityTypeSettings = settings.updateEntityTypeSettings.toBuilder(); - deleteEntityTypeSettings = settings.deleteEntityTypeSettings.toBuilder(); - - unaryMethodSettingsBuilders = - ImmutableList.>of( - listEntityTypesSettings, - getEntityTypeSettings, - createEntityTypeSettings, - updateEntityTypeSettings, - deleteEntityTypeSettings); - } - - // NEXT_MAJOR_VER: remove 'throws Exception' + // NEXT_MAJOR_VER: remove 'throws Exception'. /** * Applies the given settings updater function to all of the unary API methods in this service. * diff --git a/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3beta1/stub/EnvironmentsStub.java b/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3beta1/stub/EnvironmentsStub.java index 6064a2c57..5e12d39aa 100644 --- a/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3beta1/stub/EnvironmentsStub.java +++ b/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3beta1/stub/EnvironmentsStub.java @@ -5,7 +5,7 @@ * 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 + * 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, @@ -13,12 +13,12 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.google.cloud.dialogflow.cx.v3beta1.stub; import static com.google.cloud.dialogflow.cx.v3beta1.EnvironmentsClient.ListEnvironmentsPagedResponse; import static com.google.cloud.dialogflow.cx.v3beta1.EnvironmentsClient.LookupEnvironmentHistoryPagedResponse; -import com.google.api.core.BetaApi; import com.google.api.gax.core.BackgroundResource; import com.google.api.gax.rpc.OperationCallable; import com.google.api.gax.rpc.UnaryCallable; @@ -37,17 +37,15 @@ import com.google.protobuf.Struct; import javax.annotation.Generated; -// AUTO-GENERATED DOCUMENTATION AND CLASS +// AUTO-GENERATED DOCUMENTATION AND CLASS. /** - * Base stub class for Dialogflow API. + * Base stub class for the Environments service API. * *

This class is for advanced usage and reflects the underlying API directly. */ @Generated("by gapic-generator") -@BetaApi("A restructuring of stub classes is planned, so this may break in the future") public abstract class EnvironmentsStub implements BackgroundResource { - @BetaApi("The surface for use by generated code is not stable yet and may change in the future.") public OperationsStub getOperationsStub() { throw new UnsupportedOperationException("Not implemented: getOperationsStub()"); } @@ -66,7 +64,6 @@ public UnaryCallable getEnvironmentCallable( throw new UnsupportedOperationException("Not implemented: getEnvironmentCallable()"); } - @BetaApi("The surface for use by generated code is not stable yet and may change in the future.") public OperationCallable createEnvironmentOperationCallable() { throw new UnsupportedOperationException( @@ -77,7 +74,6 @@ public UnaryCallable createEnvironmentCalla throw new UnsupportedOperationException("Not implemented: createEnvironmentCallable()"); } - @BetaApi("The surface for use by generated code is not stable yet and may change in the future.") public OperationCallable updateEnvironmentOperationCallable() { throw new UnsupportedOperationException( diff --git a/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3beta1/stub/EnvironmentsStubSettings.java b/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3beta1/stub/EnvironmentsStubSettings.java index 38a1c5d99..3b444dbfc 100644 --- a/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3beta1/stub/EnvironmentsStubSettings.java +++ b/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3beta1/stub/EnvironmentsStubSettings.java @@ -5,7 +5,7 @@ * 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 + * 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, @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.google.cloud.dialogflow.cx.v3beta1.stub; import static com.google.cloud.dialogflow.cx.v3beta1.EnvironmentsClient.ListEnvironmentsPagedResponse; @@ -65,7 +66,7 @@ import javax.annotation.Generated; import org.threeten.bp.Duration; -// AUTO-GENERATED DOCUMENTATION AND CLASS +// AUTO-GENERATED DOCUMENTATION AND CLASS. /** * Settings class to configure an instance of {@link EnvironmentsStub}. * @@ -82,22 +83,23 @@ * *

For example, to set the total timeout of getEnvironment to 30 seconds: * - *

- * 
+ * 
{@code
  * EnvironmentsStubSettings.Builder environmentsSettingsBuilder =
  *     EnvironmentsStubSettings.newBuilder();
  * environmentsSettingsBuilder
  *     .getEnvironmentSettings()
  *     .setRetrySettings(
- *         environmentsSettingsBuilder.getEnvironmentSettings().getRetrySettings().toBuilder()
+ *         environmentsSettingsBuilder
+ *             .getEnvironmentSettings()
+ *             .getRetrySettings()
+ *             .toBuilder()
  *             .setTotalTimeout(Duration.ofSeconds(30))
  *             .build());
  * EnvironmentsStubSettings environmentsSettings = environmentsSettingsBuilder.build();
- * 
- * 
+ * }
*/ -@Generated("by gapic-generator") @BetaApi +@Generated("by gapic-generator-java") public class EnvironmentsStubSettings extends StubSettings { /** The default scopes of the service. */ private static final ImmutableList DEFAULT_SERVICE_SCOPES = @@ -123,6 +125,137 @@ public class EnvironmentsStubSettings extends StubSettings lookupEnvironmentHistorySettings; + private static final PagedListDescriptor< + ListEnvironmentsRequest, ListEnvironmentsResponse, Environment> + LIST_ENVIRONMENTS_PAGE_STR_DESC = + new PagedListDescriptor< + ListEnvironmentsRequest, ListEnvironmentsResponse, Environment>() { + @Override + public String emptyToken() { + return ""; + } + + @Override + public ListEnvironmentsRequest injectToken( + ListEnvironmentsRequest payload, String token) { + return ListEnvironmentsRequest.newBuilder(payload).setPageToken(token).build(); + } + + @Override + public ListEnvironmentsRequest injectPageSize( + ListEnvironmentsRequest payload, int pageSize) { + return ListEnvironmentsRequest.newBuilder(payload).setPageSize(pageSize).build(); + } + + @Override + public Integer extractPageSize(ListEnvironmentsRequest payload) { + return payload.getPageSize(); + } + + @Override + public String extractNextToken(ListEnvironmentsResponse payload) { + return payload.getNextPageToken(); + } + + @Override + public Iterable extractResources(ListEnvironmentsResponse payload) { + return payload.getEnvironmentsList() == null + ? ImmutableList.of() + : payload.getEnvironmentsList(); + } + }; + + private static final PagedListDescriptor< + LookupEnvironmentHistoryRequest, LookupEnvironmentHistoryResponse, Environment> + LOOKUP_ENVIRONMENT_HISTORY_PAGE_STR_DESC = + new PagedListDescriptor< + LookupEnvironmentHistoryRequest, LookupEnvironmentHistoryResponse, Environment>() { + @Override + public String emptyToken() { + return ""; + } + + @Override + public LookupEnvironmentHistoryRequest injectToken( + LookupEnvironmentHistoryRequest payload, String token) { + return LookupEnvironmentHistoryRequest.newBuilder(payload) + .setPageToken(token) + .build(); + } + + @Override + public LookupEnvironmentHistoryRequest injectPageSize( + LookupEnvironmentHistoryRequest payload, int pageSize) { + return LookupEnvironmentHistoryRequest.newBuilder(payload) + .setPageSize(pageSize) + .build(); + } + + @Override + public Integer extractPageSize(LookupEnvironmentHistoryRequest payload) { + return payload.getPageSize(); + } + + @Override + public String extractNextToken(LookupEnvironmentHistoryResponse payload) { + return payload.getNextPageToken(); + } + + @Override + public Iterable extractResources( + LookupEnvironmentHistoryResponse payload) { + return payload.getEnvironmentsList() == null + ? ImmutableList.of() + : payload.getEnvironmentsList(); + } + }; + + private static final PagedListResponseFactory< + ListEnvironmentsRequest, ListEnvironmentsResponse, ListEnvironmentsPagedResponse> + LIST_ENVIRONMENTS_PAGE_STR_FACT = + new PagedListResponseFactory< + ListEnvironmentsRequest, ListEnvironmentsResponse, ListEnvironmentsPagedResponse>() { + @Override + public ApiFuture getFuturePagedResponse( + UnaryCallable callable, + ListEnvironmentsRequest request, + ApiCallContext context, + ApiFuture futureResponse) { + PageContext + pageContext = + PageContext.create( + callable, LIST_ENVIRONMENTS_PAGE_STR_DESC, request, context); + return ListEnvironmentsPagedResponse.createAsync(pageContext, futureResponse); + } + }; + + private static final PagedListResponseFactory< + LookupEnvironmentHistoryRequest, + LookupEnvironmentHistoryResponse, + LookupEnvironmentHistoryPagedResponse> + LOOKUP_ENVIRONMENT_HISTORY_PAGE_STR_FACT = + new PagedListResponseFactory< + LookupEnvironmentHistoryRequest, + LookupEnvironmentHistoryResponse, + LookupEnvironmentHistoryPagedResponse>() { + @Override + public ApiFuture getFuturePagedResponse( + UnaryCallable + callable, + LookupEnvironmentHistoryRequest request, + ApiCallContext context, + ApiFuture futureResponse) { + PageContext< + LookupEnvironmentHistoryRequest, + LookupEnvironmentHistoryResponse, + Environment> + pageContext = + PageContext.create( + callable, LOOKUP_ENVIRONMENT_HISTORY_PAGE_STR_DESC, request, context); + return LookupEnvironmentHistoryPagedResponse.createAsync(pageContext, futureResponse); + } + }; + /** Returns the object with the settings used for calls to listEnvironments. */ public PagedCallSettings< ListEnvironmentsRequest, ListEnvironmentsResponse, ListEnvironmentsPagedResponse> @@ -141,7 +274,6 @@ public UnaryCallSettings createEnvironmentS } /** Returns the object with the settings used for calls to createEnvironment. */ - @BetaApi("The surface for use by generated code is not stable yet and may change in the future.") public OperationCallSettings createEnvironmentOperationSettings() { return createEnvironmentOperationSettings; @@ -153,7 +285,6 @@ public UnaryCallSettings updateEnvironmentS } /** Returns the object with the settings used for calls to updateEnvironment. */ - @BetaApi("The surface for use by generated code is not stable yet and may change in the future.") public OperationCallSettings updateEnvironmentOperationSettings() { return updateEnvironmentOperationSettings; @@ -179,10 +310,10 @@ public EnvironmentsStub createStub() throws IOException { .getTransportName() .equals(GrpcTransportChannel.getGrpcTransportName())) { return GrpcEnvironmentsStub.create(this); - } else { - throw new UnsupportedOperationException( - "Transport not supported: " + getTransportChannelProvider().getTransportName()); } + throw new UnsupportedOperationException( + String.format( + "Transport not supported: %s", getTransportChannelProvider().getTransportName())); } /** Returns a builder for the default ExecutorProvider for this service. */ @@ -254,141 +385,9 @@ protected EnvironmentsStubSettings(Builder settingsBuilder) throws IOException { lookupEnvironmentHistorySettings = settingsBuilder.lookupEnvironmentHistorySettings().build(); } - private static final PagedListDescriptor< - ListEnvironmentsRequest, ListEnvironmentsResponse, Environment> - LIST_ENVIRONMENTS_PAGE_STR_DESC = - new PagedListDescriptor< - ListEnvironmentsRequest, ListEnvironmentsResponse, Environment>() { - @Override - public String emptyToken() { - return ""; - } - - @Override - public ListEnvironmentsRequest injectToken( - ListEnvironmentsRequest payload, String token) { - return ListEnvironmentsRequest.newBuilder(payload).setPageToken(token).build(); - } - - @Override - public ListEnvironmentsRequest injectPageSize( - ListEnvironmentsRequest payload, int pageSize) { - return ListEnvironmentsRequest.newBuilder(payload).setPageSize(pageSize).build(); - } - - @Override - public Integer extractPageSize(ListEnvironmentsRequest payload) { - return payload.getPageSize(); - } - - @Override - public String extractNextToken(ListEnvironmentsResponse payload) { - return payload.getNextPageToken(); - } - - @Override - public Iterable extractResources(ListEnvironmentsResponse payload) { - return payload.getEnvironmentsList() != null - ? payload.getEnvironmentsList() - : ImmutableList.of(); - } - }; - - private static final PagedListDescriptor< - LookupEnvironmentHistoryRequest, LookupEnvironmentHistoryResponse, Environment> - LOOKUP_ENVIRONMENT_HISTORY_PAGE_STR_DESC = - new PagedListDescriptor< - LookupEnvironmentHistoryRequest, LookupEnvironmentHistoryResponse, Environment>() { - @Override - public String emptyToken() { - return ""; - } - - @Override - public LookupEnvironmentHistoryRequest injectToken( - LookupEnvironmentHistoryRequest payload, String token) { - return LookupEnvironmentHistoryRequest.newBuilder(payload) - .setPageToken(token) - .build(); - } - - @Override - public LookupEnvironmentHistoryRequest injectPageSize( - LookupEnvironmentHistoryRequest payload, int pageSize) { - return LookupEnvironmentHistoryRequest.newBuilder(payload) - .setPageSize(pageSize) - .build(); - } - - @Override - public Integer extractPageSize(LookupEnvironmentHistoryRequest payload) { - return payload.getPageSize(); - } - - @Override - public String extractNextToken(LookupEnvironmentHistoryResponse payload) { - return payload.getNextPageToken(); - } - - @Override - public Iterable extractResources( - LookupEnvironmentHistoryResponse payload) { - return payload.getEnvironmentsList() != null - ? payload.getEnvironmentsList() - : ImmutableList.of(); - } - }; - - private static final PagedListResponseFactory< - ListEnvironmentsRequest, ListEnvironmentsResponse, ListEnvironmentsPagedResponse> - LIST_ENVIRONMENTS_PAGE_STR_FACT = - new PagedListResponseFactory< - ListEnvironmentsRequest, ListEnvironmentsResponse, ListEnvironmentsPagedResponse>() { - @Override - public ApiFuture getFuturePagedResponse( - UnaryCallable callable, - ListEnvironmentsRequest request, - ApiCallContext context, - ApiFuture futureResponse) { - PageContext - pageContext = - PageContext.create( - callable, LIST_ENVIRONMENTS_PAGE_STR_DESC, request, context); - return ListEnvironmentsPagedResponse.createAsync(pageContext, futureResponse); - } - }; - - private static final PagedListResponseFactory< - LookupEnvironmentHistoryRequest, - LookupEnvironmentHistoryResponse, - LookupEnvironmentHistoryPagedResponse> - LOOKUP_ENVIRONMENT_HISTORY_PAGE_STR_FACT = - new PagedListResponseFactory< - LookupEnvironmentHistoryRequest, - LookupEnvironmentHistoryResponse, - LookupEnvironmentHistoryPagedResponse>() { - @Override - public ApiFuture getFuturePagedResponse( - UnaryCallable - callable, - LookupEnvironmentHistoryRequest request, - ApiCallContext context, - ApiFuture futureResponse) { - PageContext< - LookupEnvironmentHistoryRequest, - LookupEnvironmentHistoryResponse, - Environment> - pageContext = - PageContext.create( - callable, LOOKUP_ENVIRONMENT_HISTORY_PAGE_STR_DESC, request, context); - return LookupEnvironmentHistoryPagedResponse.createAsync(pageContext, futureResponse); - } - }; - /** Builder for EnvironmentsStubSettings. */ public static class Builder extends StubSettings.Builder { private final ImmutableList> unaryMethodSettingsBuilders; - private final PagedCallSettings.Builder< ListEnvironmentsRequest, ListEnvironmentsResponse, ListEnvironmentsPagedResponse> listEnvironmentsSettings; @@ -409,7 +408,6 @@ public static class Builder extends StubSettings.Builder lookupEnvironmentHistorySettings; - private static final ImmutableMap> RETRYABLE_CODE_DEFINITIONS; @@ -417,14 +415,8 @@ public static class Builder extends StubSettings.Builder> definitions = ImmutableMap.builder(); definitions.put( - "retry_policy_1_codes", + "retry_policy_0_codes", ImmutableSet.copyOf(Lists.newArrayList(StatusCode.Code.UNAVAILABLE))); - definitions.put("no_retry_codes", ImmutableSet.copyOf(Lists.newArrayList())); - definitions.put( - "retry_policy_2_codes", - ImmutableSet.copyOf(Lists.newArrayList(StatusCode.Code.UNAVAILABLE))); - definitions.put( - "no_retry_1_codes", ImmutableSet.copyOf(Lists.newArrayList())); RETRYABLE_CODE_DEFINITIONS = definitions.build(); } @@ -443,52 +435,24 @@ public static class Builder extends StubSettings.Builder>of( + listEnvironmentsSettings, + getEnvironmentSettings, + createEnvironmentSettings, + updateEnvironmentSettings, + deleteEnvironmentSettings, + lookupEnvironmentHistorySettings); + } + private static Builder createDefault() { - Builder builder = new Builder((ClientContext) null); + Builder builder = new Builder(((ClientContext) null)); + builder.setTransportChannelProvider(defaultTransportChannelProvider()); builder.setCredentialsProvider(defaultCredentialsProviderBuilder().build()); builder.setInternalHeaderProvider(defaultApiClientHeaderProviderBuilder().build()); builder.setEndpoint(getDefaultEndpoint()); + return initDefaults(builder); } private static Builder initDefaults(Builder builder) { - builder .listEnvironmentsSettings() - .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_1_codes")) - .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_1_params")); + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params")); builder .getEnvironmentSettings() - .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_1_codes")) - .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_1_params")); + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params")); builder .createEnvironmentSettings() - .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_1_codes")) - .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_1_params")); + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params")); builder .updateEnvironmentSettings() - .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_1_codes")) - .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_1_params")); + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params")); builder .deleteEnvironmentSettings() - .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_1_codes")) - .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_1_params")); + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params")); builder .lookupEnvironmentHistorySettings() - .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_1_codes")) - .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_1_params")); + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params")); + builder .createEnvironmentOperationSettings() .setInitialCallSettings( UnaryCallSettings .newUnaryCallSettingsBuilder() - .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_1_codes")) - .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_1_params")) + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params")) .build()) .setResponseTransformer( ProtoOperationTransformers.ResponseTransformer.create(Environment.class)) @@ -559,21 +546,22 @@ private static Builder initDefaults(Builder builder) { .setPollingAlgorithm( OperationTimedPollAlgorithm.create( RetrySettings.newBuilder() - .setInitialRetryDelay(Duration.ofMillis(500L)) + .setInitialRetryDelay(Duration.ofMillis(5000L)) .setRetryDelayMultiplier(1.5) - .setMaxRetryDelay(Duration.ofMillis(5000L)) - .setInitialRpcTimeout(Duration.ZERO) // ignored - .setRpcTimeoutMultiplier(1.0) // ignored - .setMaxRpcTimeout(Duration.ZERO) // ignored + .setMaxRetryDelay(Duration.ofMillis(45000L)) + .setInitialRpcTimeout(Duration.ZERO) + .setRpcTimeoutMultiplier(1.0) + .setMaxRpcTimeout(Duration.ZERO) .setTotalTimeout(Duration.ofMillis(300000L)) .build())); + builder .updateEnvironmentOperationSettings() .setInitialCallSettings( UnaryCallSettings .newUnaryCallSettingsBuilder() - .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_1_codes")) - .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_1_params")) + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params")) .build()) .setResponseTransformer( ProtoOperationTransformers.ResponseTransformer.create(Environment.class)) @@ -582,41 +570,19 @@ private static Builder initDefaults(Builder builder) { .setPollingAlgorithm( OperationTimedPollAlgorithm.create( RetrySettings.newBuilder() - .setInitialRetryDelay(Duration.ofMillis(500L)) + .setInitialRetryDelay(Duration.ofMillis(5000L)) .setRetryDelayMultiplier(1.5) - .setMaxRetryDelay(Duration.ofMillis(5000L)) - .setInitialRpcTimeout(Duration.ZERO) // ignored - .setRpcTimeoutMultiplier(1.0) // ignored - .setMaxRpcTimeout(Duration.ZERO) // ignored + .setMaxRetryDelay(Duration.ofMillis(45000L)) + .setInitialRpcTimeout(Duration.ZERO) + .setRpcTimeoutMultiplier(1.0) + .setMaxRpcTimeout(Duration.ZERO) .setTotalTimeout(Duration.ofMillis(300000L)) .build())); return builder; } - protected Builder(EnvironmentsStubSettings settings) { - super(settings); - - listEnvironmentsSettings = settings.listEnvironmentsSettings.toBuilder(); - getEnvironmentSettings = settings.getEnvironmentSettings.toBuilder(); - createEnvironmentSettings = settings.createEnvironmentSettings.toBuilder(); - createEnvironmentOperationSettings = settings.createEnvironmentOperationSettings.toBuilder(); - updateEnvironmentSettings = settings.updateEnvironmentSettings.toBuilder(); - updateEnvironmentOperationSettings = settings.updateEnvironmentOperationSettings.toBuilder(); - deleteEnvironmentSettings = settings.deleteEnvironmentSettings.toBuilder(); - lookupEnvironmentHistorySettings = settings.lookupEnvironmentHistorySettings.toBuilder(); - - unaryMethodSettingsBuilders = - ImmutableList.>of( - listEnvironmentsSettings, - getEnvironmentSettings, - createEnvironmentSettings, - updateEnvironmentSettings, - deleteEnvironmentSettings, - lookupEnvironmentHistorySettings); - } - - // NEXT_MAJOR_VER: remove 'throws Exception' + // NEXT_MAJOR_VER: remove 'throws Exception'. /** * Applies the given settings updater function to all of the unary API methods in this service. * diff --git a/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3beta1/stub/FlowsStub.java b/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3beta1/stub/FlowsStub.java index 37148c1c0..9669af249 100644 --- a/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3beta1/stub/FlowsStub.java +++ b/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3beta1/stub/FlowsStub.java @@ -5,7 +5,7 @@ * 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 + * 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, @@ -13,11 +13,11 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.google.cloud.dialogflow.cx.v3beta1.stub; import static com.google.cloud.dialogflow.cx.v3beta1.FlowsClient.ListFlowsPagedResponse; -import com.google.api.core.BetaApi; import com.google.api.gax.core.BackgroundResource; import com.google.api.gax.rpc.OperationCallable; import com.google.api.gax.rpc.UnaryCallable; @@ -35,17 +35,15 @@ import com.google.protobuf.Struct; import javax.annotation.Generated; -// AUTO-GENERATED DOCUMENTATION AND CLASS +// AUTO-GENERATED DOCUMENTATION AND CLASS. /** - * Base stub class for Dialogflow API. + * Base stub class for the Flows service API. * *

This class is for advanced usage and reflects the underlying API directly. */ @Generated("by gapic-generator") -@BetaApi("A restructuring of stub classes is planned, so this may break in the future") public abstract class FlowsStub implements BackgroundResource { - @BetaApi("The surface for use by generated code is not stable yet and may change in the future.") public OperationsStub getOperationsStub() { throw new UnsupportedOperationException("Not implemented: getOperationsStub()"); } @@ -74,7 +72,6 @@ public UnaryCallable updateFlowCallable() { throw new UnsupportedOperationException("Not implemented: updateFlowCallable()"); } - @BetaApi("The surface for use by generated code is not stable yet and may change in the future.") public OperationCallable trainFlowOperationCallable() { throw new UnsupportedOperationException("Not implemented: trainFlowOperationCallable()"); } diff --git a/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3beta1/stub/FlowsStubSettings.java b/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3beta1/stub/FlowsStubSettings.java index 7ca8bf58a..70165ad17 100644 --- a/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3beta1/stub/FlowsStubSettings.java +++ b/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3beta1/stub/FlowsStubSettings.java @@ -5,7 +5,7 @@ * 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 + * 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, @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.google.cloud.dialogflow.cx.v3beta1.stub; import static com.google.cloud.dialogflow.cx.v3beta1.FlowsClient.ListFlowsPagedResponse; @@ -63,7 +64,7 @@ import javax.annotation.Generated; import org.threeten.bp.Duration; -// AUTO-GENERATED DOCUMENTATION AND CLASS +// AUTO-GENERATED DOCUMENTATION AND CLASS. /** * Settings class to configure an instance of {@link FlowsStub}. * @@ -80,22 +81,22 @@ * *

For example, to set the total timeout of createFlow to 30 seconds: * - *

- * 
- * FlowsStubSettings.Builder flowsSettingsBuilder =
- *     FlowsStubSettings.newBuilder();
+ * 
{@code
+ * FlowsStubSettings.Builder flowsSettingsBuilder = FlowsStubSettings.newBuilder();
  * flowsSettingsBuilder
  *     .createFlowSettings()
  *     .setRetrySettings(
- *         flowsSettingsBuilder.createFlowSettings().getRetrySettings().toBuilder()
+ *         flowsSettingsBuilder
+ *             .createFlowSettings()
+ *             .getRetrySettings()
+ *             .toBuilder()
  *             .setTotalTimeout(Duration.ofSeconds(30))
  *             .build());
  * FlowsStubSettings flowsSettings = flowsSettingsBuilder.build();
- * 
- * 
+ * }
*/ -@Generated("by gapic-generator") @BetaApi +@Generated("by gapic-generator-java") public class FlowsStubSettings extends StubSettings { /** The default scopes of the service. */ private static final ImmutableList DEFAULT_SERVICE_SCOPES = @@ -113,6 +114,59 @@ public class FlowsStubSettings extends StubSettings { private final UnaryCallSettings trainFlowSettings; private final OperationCallSettings trainFlowOperationSettings; + private static final PagedListDescriptor + LIST_FLOWS_PAGE_STR_DESC = + new PagedListDescriptor() { + @Override + public String emptyToken() { + return ""; + } + + @Override + public ListFlowsRequest injectToken(ListFlowsRequest payload, String token) { + return ListFlowsRequest.newBuilder(payload).setPageToken(token).build(); + } + + @Override + public ListFlowsRequest injectPageSize(ListFlowsRequest payload, int pageSize) { + return ListFlowsRequest.newBuilder(payload).setPageSize(pageSize).build(); + } + + @Override + public Integer extractPageSize(ListFlowsRequest payload) { + return payload.getPageSize(); + } + + @Override + public String extractNextToken(ListFlowsResponse payload) { + return payload.getNextPageToken(); + } + + @Override + public Iterable extractResources(ListFlowsResponse payload) { + return payload.getFlowsList() == null + ? ImmutableList.of() + : payload.getFlowsList(); + } + }; + + private static final PagedListResponseFactory< + ListFlowsRequest, ListFlowsResponse, ListFlowsPagedResponse> + LIST_FLOWS_PAGE_STR_FACT = + new PagedListResponseFactory< + ListFlowsRequest, ListFlowsResponse, ListFlowsPagedResponse>() { + @Override + public ApiFuture getFuturePagedResponse( + UnaryCallable callable, + ListFlowsRequest request, + ApiCallContext context, + ApiFuture futureResponse) { + PageContext pageContext = + PageContext.create(callable, LIST_FLOWS_PAGE_STR_DESC, request, context); + return ListFlowsPagedResponse.createAsync(pageContext, futureResponse); + } + }; + /** Returns the object with the settings used for calls to createFlow. */ public UnaryCallSettings createFlowSettings() { return createFlowSettings; @@ -145,7 +199,6 @@ public UnaryCallSettings trainFlowSettings() { } /** Returns the object with the settings used for calls to trainFlow. */ - @BetaApi("The surface for use by generated code is not stable yet and may change in the future.") public OperationCallSettings trainFlowOperationSettings() { return trainFlowOperationSettings; } @@ -156,10 +209,10 @@ public FlowsStub createStub() throws IOException { .getTransportName() .equals(GrpcTransportChannel.getGrpcTransportName())) { return GrpcFlowsStub.create(this); - } else { - throw new UnsupportedOperationException( - "Transport not supported: " + getTransportChannelProvider().getTransportName()); } + throw new UnsupportedOperationException( + String.format( + "Transport not supported: %s", getTransportChannelProvider().getTransportName())); } /** Returns a builder for the default ExecutorProvider for this service. */ @@ -227,63 +280,9 @@ protected FlowsStubSettings(Builder settingsBuilder) throws IOException { trainFlowOperationSettings = settingsBuilder.trainFlowOperationSettings().build(); } - private static final PagedListDescriptor - LIST_FLOWS_PAGE_STR_DESC = - new PagedListDescriptor() { - @Override - public String emptyToken() { - return ""; - } - - @Override - public ListFlowsRequest injectToken(ListFlowsRequest payload, String token) { - return ListFlowsRequest.newBuilder(payload).setPageToken(token).build(); - } - - @Override - public ListFlowsRequest injectPageSize(ListFlowsRequest payload, int pageSize) { - return ListFlowsRequest.newBuilder(payload).setPageSize(pageSize).build(); - } - - @Override - public Integer extractPageSize(ListFlowsRequest payload) { - return payload.getPageSize(); - } - - @Override - public String extractNextToken(ListFlowsResponse payload) { - return payload.getNextPageToken(); - } - - @Override - public Iterable extractResources(ListFlowsResponse payload) { - return payload.getFlowsList() != null - ? payload.getFlowsList() - : ImmutableList.of(); - } - }; - - private static final PagedListResponseFactory< - ListFlowsRequest, ListFlowsResponse, ListFlowsPagedResponse> - LIST_FLOWS_PAGE_STR_FACT = - new PagedListResponseFactory< - ListFlowsRequest, ListFlowsResponse, ListFlowsPagedResponse>() { - @Override - public ApiFuture getFuturePagedResponse( - UnaryCallable callable, - ListFlowsRequest request, - ApiCallContext context, - ApiFuture futureResponse) { - PageContext pageContext = - PageContext.create(callable, LIST_FLOWS_PAGE_STR_DESC, request, context); - return ListFlowsPagedResponse.createAsync(pageContext, futureResponse); - } - }; - /** Builder for FlowsStubSettings. */ public static class Builder extends StubSettings.Builder { private final ImmutableList> unaryMethodSettingsBuilders; - private final UnaryCallSettings.Builder createFlowSettings; private final UnaryCallSettings.Builder deleteFlowSettings; private final PagedCallSettings.Builder< @@ -294,7 +293,6 @@ public static class Builder extends StubSettings.Builder trainFlowSettings; private final OperationCallSettings.Builder trainFlowOperationSettings; - private static final ImmutableMap> RETRYABLE_CODE_DEFINITIONS; @@ -302,14 +300,8 @@ public static class Builder extends StubSettings.Builder> definitions = ImmutableMap.builder(); definitions.put( - "retry_policy_1_codes", - ImmutableSet.copyOf(Lists.newArrayList(StatusCode.Code.UNAVAILABLE))); - definitions.put("no_retry_codes", ImmutableSet.copyOf(Lists.newArrayList())); - definitions.put( - "retry_policy_2_codes", + "retry_policy_0_codes", ImmutableSet.copyOf(Lists.newArrayList(StatusCode.Code.UNAVAILABLE))); - definitions.put( - "no_retry_1_codes", ImmutableSet.copyOf(Lists.newArrayList())); RETRYABLE_CODE_DEFINITIONS = definitions.build(); } @@ -328,50 +320,23 @@ public static class Builder extends StubSettings.Builder>of( + createFlowSettings, + deleteFlowSettings, + listFlowsSettings, + getFlowSettings, + updateFlowSettings, + trainFlowSettings); + } + private static Builder createDefault() { - Builder builder = new Builder((ClientContext) null); + Builder builder = new Builder(((ClientContext) null)); + builder.setTransportChannelProvider(defaultTransportChannelProvider()); builder.setCredentialsProvider(defaultCredentialsProviderBuilder().build()); builder.setInternalHeaderProvider(defaultApiClientHeaderProviderBuilder().build()); builder.setEndpoint(getDefaultEndpoint()); + return initDefaults(builder); } private static Builder initDefaults(Builder builder) { - builder .createFlowSettings() - .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_1_codes")) - .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_1_params")); + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params")); builder .deleteFlowSettings() - .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_1_codes")) - .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_1_params")); + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params")); builder .listFlowsSettings() - .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_1_codes")) - .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_1_params")); + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params")); builder .getFlowSettings() - .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_1_codes")) - .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_1_params")); + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params")); builder .updateFlowSettings() - .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_1_codes")) - .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_1_params")); + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params")); builder .trainFlowSettings() - .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_1_codes")) - .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_1_params")); + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params")); + builder .trainFlowOperationSettings() .setInitialCallSettings( UnaryCallSettings.newUnaryCallSettingsBuilder() - .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_1_codes")) - .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_1_params")) + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params")) .build()) .setResponseTransformer( ProtoOperationTransformers.ResponseTransformer.create(Empty.class)) @@ -440,40 +427,19 @@ private static Builder initDefaults(Builder builder) { .setPollingAlgorithm( OperationTimedPollAlgorithm.create( RetrySettings.newBuilder() - .setInitialRetryDelay(Duration.ofMillis(500L)) + .setInitialRetryDelay(Duration.ofMillis(5000L)) .setRetryDelayMultiplier(1.5) - .setMaxRetryDelay(Duration.ofMillis(5000L)) - .setInitialRpcTimeout(Duration.ZERO) // ignored - .setRpcTimeoutMultiplier(1.0) // ignored - .setMaxRpcTimeout(Duration.ZERO) // ignored + .setMaxRetryDelay(Duration.ofMillis(45000L)) + .setInitialRpcTimeout(Duration.ZERO) + .setRpcTimeoutMultiplier(1.0) + .setMaxRpcTimeout(Duration.ZERO) .setTotalTimeout(Duration.ofMillis(300000L)) .build())); return builder; } - protected Builder(FlowsStubSettings settings) { - super(settings); - - createFlowSettings = settings.createFlowSettings.toBuilder(); - deleteFlowSettings = settings.deleteFlowSettings.toBuilder(); - listFlowsSettings = settings.listFlowsSettings.toBuilder(); - getFlowSettings = settings.getFlowSettings.toBuilder(); - updateFlowSettings = settings.updateFlowSettings.toBuilder(); - trainFlowSettings = settings.trainFlowSettings.toBuilder(); - trainFlowOperationSettings = settings.trainFlowOperationSettings.toBuilder(); - - unaryMethodSettingsBuilders = - ImmutableList.>of( - createFlowSettings, - deleteFlowSettings, - listFlowsSettings, - getFlowSettings, - updateFlowSettings, - trainFlowSettings); - } - - // NEXT_MAJOR_VER: remove 'throws Exception' + // NEXT_MAJOR_VER: remove 'throws Exception'. /** * Applies the given settings updater function to all of the unary API methods in this service. * diff --git a/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3beta1/stub/GrpcAgentsCallableFactory.java b/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3beta1/stub/GrpcAgentsCallableFactory.java index 89e559871..a4bd45952 100644 --- a/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3beta1/stub/GrpcAgentsCallableFactory.java +++ b/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3beta1/stub/GrpcAgentsCallableFactory.java @@ -5,7 +5,7 @@ * 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 + * 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, @@ -13,9 +13,9 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.google.cloud.dialogflow.cx.v3beta1.stub; -import com.google.api.core.BetaApi; import com.google.api.gax.grpc.GrpcCallSettings; import com.google.api.gax.grpc.GrpcCallableFactory; import com.google.api.gax.grpc.GrpcStubCallableFactory; @@ -31,18 +31,19 @@ import com.google.api.gax.rpc.StreamingCallSettings; import com.google.api.gax.rpc.UnaryCallSettings; import com.google.api.gax.rpc.UnaryCallable; +import com.google.longrunning.Operation; import com.google.longrunning.stub.OperationsStub; import javax.annotation.Generated; -// AUTO-GENERATED DOCUMENTATION AND CLASS +// AUTO-GENERATED DOCUMENTATION AND CLASS. /** - * gRPC callable factory implementation for Dialogflow API. + * gRPC callable factory implementation for the Agents service API. * *

This class is for advanced usage. */ @Generated("by gapic-generator") -@BetaApi("The surface for use by generated code is not stable yet and may change in the future.") public class GrpcAgentsCallableFactory implements GrpcStubCallableFactory { + @Override public UnaryCallable createUnaryCallable( GrpcCallSettings grpcCallSettings, @@ -55,61 +56,58 @@ public UnaryCallable createUnaryCalla public UnaryCallable createPagedCallable( GrpcCallSettings grpcCallSettings, - PagedCallSettings pagedCallSettings, + PagedCallSettings callSettings, ClientContext clientContext) { - return GrpcCallableFactory.createPagedCallable( - grpcCallSettings, pagedCallSettings, clientContext); + return GrpcCallableFactory.createPagedCallable(grpcCallSettings, callSettings, clientContext); } @Override public UnaryCallable createBatchingCallable( GrpcCallSettings grpcCallSettings, - BatchingCallSettings batchingCallSettings, + BatchingCallSettings callSettings, ClientContext clientContext) { return GrpcCallableFactory.createBatchingCallable( - grpcCallSettings, batchingCallSettings, clientContext); + grpcCallSettings, callSettings, clientContext); } - @BetaApi( - "The surface for long-running operations is not stable yet and may change in the future.") @Override public OperationCallable createOperationCallable( - GrpcCallSettings grpcCallSettings, - OperationCallSettings operationCallSettings, + GrpcCallSettings grpcCallSettings, + OperationCallSettings callSettings, ClientContext clientContext, OperationsStub operationsStub) { return GrpcCallableFactory.createOperationCallable( - grpcCallSettings, operationCallSettings, clientContext, operationsStub); + grpcCallSettings, callSettings, clientContext, operationsStub); } @Override public BidiStreamingCallable createBidiStreamingCallable( GrpcCallSettings grpcCallSettings, - StreamingCallSettings streamingCallSettings, + StreamingCallSettings callSettings, ClientContext clientContext) { return GrpcCallableFactory.createBidiStreamingCallable( - grpcCallSettings, streamingCallSettings, clientContext); + grpcCallSettings, callSettings, clientContext); } @Override public ServerStreamingCallable createServerStreamingCallable( GrpcCallSettings grpcCallSettings, - ServerStreamingCallSettings streamingCallSettings, + ServerStreamingCallSettings callSettings, ClientContext clientContext) { return GrpcCallableFactory.createServerStreamingCallable( - grpcCallSettings, streamingCallSettings, clientContext); + grpcCallSettings, callSettings, clientContext); } @Override public ClientStreamingCallable createClientStreamingCallable( GrpcCallSettings grpcCallSettings, - StreamingCallSettings streamingCallSettings, + StreamingCallSettings callSettings, ClientContext clientContext) { return GrpcCallableFactory.createClientStreamingCallable( - grpcCallSettings, streamingCallSettings, clientContext); + grpcCallSettings, callSettings, clientContext); } } diff --git a/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3beta1/stub/GrpcAgentsStub.java b/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3beta1/stub/GrpcAgentsStub.java index ae15184d4..a8afd6d19 100644 --- a/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3beta1/stub/GrpcAgentsStub.java +++ b/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3beta1/stub/GrpcAgentsStub.java @@ -5,7 +5,7 @@ * 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 + * 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, @@ -13,11 +13,11 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.google.cloud.dialogflow.cx.v3beta1.stub; import static com.google.cloud.dialogflow.cx.v3beta1.AgentsClient.ListAgentsPagedResponse; -import com.google.api.core.BetaApi; import com.google.api.gax.core.BackgroundResource; import com.google.api.gax.core.BackgroundResourceAggregation; import com.google.api.gax.grpc.GrpcCallSettings; @@ -48,16 +48,14 @@ import java.util.concurrent.TimeUnit; import javax.annotation.Generated; -// AUTO-GENERATED DOCUMENTATION AND CLASS +// AUTO-GENERATED DOCUMENTATION AND CLASS. /** - * gRPC stub implementation for Dialogflow API. + * gRPC stub implementation for the Agents service API. * *

This class is for advanced usage and reflects the underlying API directly. */ -@Generated("by gapic-generator") -@BetaApi("A restructuring of stub classes is planned, so this may break in the future") +@Generated("by gapic-generator-java") public class GrpcAgentsStub extends AgentsStub { - private static final MethodDescriptor listAgentsMethodDescriptor = MethodDescriptor.newBuilder() @@ -66,6 +64,7 @@ public class GrpcAgentsStub extends AgentsStub { .setRequestMarshaller(ProtoUtils.marshaller(ListAgentsRequest.getDefaultInstance())) .setResponseMarshaller(ProtoUtils.marshaller(ListAgentsResponse.getDefaultInstance())) .build(); + private static final MethodDescriptor getAgentMethodDescriptor = MethodDescriptor.newBuilder() .setType(MethodDescriptor.MethodType.UNARY) @@ -73,6 +72,7 @@ public class GrpcAgentsStub extends AgentsStub { .setRequestMarshaller(ProtoUtils.marshaller(GetAgentRequest.getDefaultInstance())) .setResponseMarshaller(ProtoUtils.marshaller(Agent.getDefaultInstance())) .build(); + private static final MethodDescriptor createAgentMethodDescriptor = MethodDescriptor.newBuilder() .setType(MethodDescriptor.MethodType.UNARY) @@ -80,6 +80,7 @@ public class GrpcAgentsStub extends AgentsStub { .setRequestMarshaller(ProtoUtils.marshaller(CreateAgentRequest.getDefaultInstance())) .setResponseMarshaller(ProtoUtils.marshaller(Agent.getDefaultInstance())) .build(); + private static final MethodDescriptor updateAgentMethodDescriptor = MethodDescriptor.newBuilder() .setType(MethodDescriptor.MethodType.UNARY) @@ -87,6 +88,7 @@ public class GrpcAgentsStub extends AgentsStub { .setRequestMarshaller(ProtoUtils.marshaller(UpdateAgentRequest.getDefaultInstance())) .setResponseMarshaller(ProtoUtils.marshaller(Agent.getDefaultInstance())) .build(); + private static final MethodDescriptor deleteAgentMethodDescriptor = MethodDescriptor.newBuilder() .setType(MethodDescriptor.MethodType.UNARY) @@ -94,6 +96,7 @@ public class GrpcAgentsStub extends AgentsStub { .setRequestMarshaller(ProtoUtils.marshaller(DeleteAgentRequest.getDefaultInstance())) .setResponseMarshaller(ProtoUtils.marshaller(Empty.getDefaultInstance())) .build(); + private static final MethodDescriptor exportAgentMethodDescriptor = MethodDescriptor.newBuilder() .setType(MethodDescriptor.MethodType.UNARY) @@ -101,6 +104,7 @@ public class GrpcAgentsStub extends AgentsStub { .setRequestMarshaller(ProtoUtils.marshaller(ExportAgentRequest.getDefaultInstance())) .setResponseMarshaller(ProtoUtils.marshaller(Operation.getDefaultInstance())) .build(); + private static final MethodDescriptor restoreAgentMethodDescriptor = MethodDescriptor.newBuilder() @@ -110,9 +114,6 @@ public class GrpcAgentsStub extends AgentsStub { .setResponseMarshaller(ProtoUtils.marshaller(Operation.getDefaultInstance())) .build(); - private final BackgroundResource backgroundResources; - private final GrpcOperationsStub operationsStub; - private final UnaryCallable listAgentsCallable; private final UnaryCallable listAgentsPagedCallable; private final UnaryCallable getAgentCallable; @@ -125,6 +126,8 @@ public class GrpcAgentsStub extends AgentsStub { private final UnaryCallable restoreAgentCallable; private final OperationCallable restoreAgentOperationCallable; + private final BackgroundResource backgroundResources; + private final GrpcOperationsStub operationsStub; private final GrpcStubCallableFactory callableFactory; public static final GrpcAgentsStub create(AgentsStubSettings settings) throws IOException { @@ -280,7 +283,7 @@ public Map extract(RestoreAgentRequest request) { exportAgentTransportSettings, settings.exportAgentOperationSettings(), clientContext, - this.operationsStub); + operationsStub); this.restoreAgentCallable = callableFactory.createUnaryCallable( restoreAgentTransportSettings, settings.restoreAgentSettings(), clientContext); @@ -289,24 +292,24 @@ public Map extract(RestoreAgentRequest request) { restoreAgentTransportSettings, settings.restoreAgentOperationSettings(), clientContext, - this.operationsStub); + operationsStub); - backgroundResources = new BackgroundResourceAggregation(clientContext.getBackgroundResources()); + this.backgroundResources = + new BackgroundResourceAggregation(clientContext.getBackgroundResources()); } - @BetaApi("The surface for use by generated code is not stable yet and may change in the future.") public GrpcOperationsStub getOperationsStub() { return operationsStub; } - public UnaryCallable listAgentsPagedCallable() { - return listAgentsPagedCallable; - } - public UnaryCallable listAgentsCallable() { return listAgentsCallable; } + public UnaryCallable listAgentsPagedCallable() { + return listAgentsPagedCallable; + } + public UnaryCallable getAgentCallable() { return getAgentCallable; } @@ -323,25 +326,23 @@ public UnaryCallable deleteAgentCallable() { return deleteAgentCallable; } - @BetaApi("The surface for use by generated code is not stable yet and may change in the future.") + public UnaryCallable exportAgentCallable() { + return exportAgentCallable; + } + public OperationCallable exportAgentOperationCallable() { return exportAgentOperationCallable; } - public UnaryCallable exportAgentCallable() { - return exportAgentCallable; + public UnaryCallable restoreAgentCallable() { + return restoreAgentCallable; } - @BetaApi("The surface for use by generated code is not stable yet and may change in the future.") public OperationCallable restoreAgentOperationCallable() { return restoreAgentOperationCallable; } - public UnaryCallable restoreAgentCallable() { - return restoreAgentCallable; - } - @Override public final void close() { shutdown(); diff --git a/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3beta1/stub/GrpcEntityTypesCallableFactory.java b/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3beta1/stub/GrpcEntityTypesCallableFactory.java index d6497a060..3302312a0 100644 --- a/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3beta1/stub/GrpcEntityTypesCallableFactory.java +++ b/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3beta1/stub/GrpcEntityTypesCallableFactory.java @@ -5,7 +5,7 @@ * 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 + * 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, @@ -13,9 +13,9 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.google.cloud.dialogflow.cx.v3beta1.stub; -import com.google.api.core.BetaApi; import com.google.api.gax.grpc.GrpcCallSettings; import com.google.api.gax.grpc.GrpcCallableFactory; import com.google.api.gax.grpc.GrpcStubCallableFactory; @@ -31,18 +31,19 @@ import com.google.api.gax.rpc.StreamingCallSettings; import com.google.api.gax.rpc.UnaryCallSettings; import com.google.api.gax.rpc.UnaryCallable; +import com.google.longrunning.Operation; import com.google.longrunning.stub.OperationsStub; import javax.annotation.Generated; -// AUTO-GENERATED DOCUMENTATION AND CLASS +// AUTO-GENERATED DOCUMENTATION AND CLASS. /** - * gRPC callable factory implementation for Dialogflow API. + * gRPC callable factory implementation for the EntityTypes service API. * *

This class is for advanced usage. */ @Generated("by gapic-generator") -@BetaApi("The surface for use by generated code is not stable yet and may change in the future.") public class GrpcEntityTypesCallableFactory implements GrpcStubCallableFactory { + @Override public UnaryCallable createUnaryCallable( GrpcCallSettings grpcCallSettings, @@ -55,61 +56,58 @@ public UnaryCallable createUnaryCalla public UnaryCallable createPagedCallable( GrpcCallSettings grpcCallSettings, - PagedCallSettings pagedCallSettings, + PagedCallSettings callSettings, ClientContext clientContext) { - return GrpcCallableFactory.createPagedCallable( - grpcCallSettings, pagedCallSettings, clientContext); + return GrpcCallableFactory.createPagedCallable(grpcCallSettings, callSettings, clientContext); } @Override public UnaryCallable createBatchingCallable( GrpcCallSettings grpcCallSettings, - BatchingCallSettings batchingCallSettings, + BatchingCallSettings callSettings, ClientContext clientContext) { return GrpcCallableFactory.createBatchingCallable( - grpcCallSettings, batchingCallSettings, clientContext); + grpcCallSettings, callSettings, clientContext); } - @BetaApi( - "The surface for long-running operations is not stable yet and may change in the future.") @Override public OperationCallable createOperationCallable( - GrpcCallSettings grpcCallSettings, - OperationCallSettings operationCallSettings, + GrpcCallSettings grpcCallSettings, + OperationCallSettings callSettings, ClientContext clientContext, OperationsStub operationsStub) { return GrpcCallableFactory.createOperationCallable( - grpcCallSettings, operationCallSettings, clientContext, operationsStub); + grpcCallSettings, callSettings, clientContext, operationsStub); } @Override public BidiStreamingCallable createBidiStreamingCallable( GrpcCallSettings grpcCallSettings, - StreamingCallSettings streamingCallSettings, + StreamingCallSettings callSettings, ClientContext clientContext) { return GrpcCallableFactory.createBidiStreamingCallable( - grpcCallSettings, streamingCallSettings, clientContext); + grpcCallSettings, callSettings, clientContext); } @Override public ServerStreamingCallable createServerStreamingCallable( GrpcCallSettings grpcCallSettings, - ServerStreamingCallSettings streamingCallSettings, + ServerStreamingCallSettings callSettings, ClientContext clientContext) { return GrpcCallableFactory.createServerStreamingCallable( - grpcCallSettings, streamingCallSettings, clientContext); + grpcCallSettings, callSettings, clientContext); } @Override public ClientStreamingCallable createClientStreamingCallable( GrpcCallSettings grpcCallSettings, - StreamingCallSettings streamingCallSettings, + StreamingCallSettings callSettings, ClientContext clientContext) { return GrpcCallableFactory.createClientStreamingCallable( - grpcCallSettings, streamingCallSettings, clientContext); + grpcCallSettings, callSettings, clientContext); } } diff --git a/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3beta1/stub/GrpcEntityTypesStub.java b/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3beta1/stub/GrpcEntityTypesStub.java index ae1cfb1a5..980ecd845 100644 --- a/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3beta1/stub/GrpcEntityTypesStub.java +++ b/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3beta1/stub/GrpcEntityTypesStub.java @@ -5,7 +5,7 @@ * 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 + * 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, @@ -13,11 +13,11 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.google.cloud.dialogflow.cx.v3beta1.stub; import static com.google.cloud.dialogflow.cx.v3beta1.EntityTypesClient.ListEntityTypesPagedResponse; -import com.google.api.core.BetaApi; import com.google.api.gax.core.BackgroundResource; import com.google.api.gax.core.BackgroundResourceAggregation; import com.google.api.gax.grpc.GrpcCallSettings; @@ -33,6 +33,7 @@ import com.google.cloud.dialogflow.cx.v3beta1.ListEntityTypesResponse; import com.google.cloud.dialogflow.cx.v3beta1.UpdateEntityTypeRequest; import com.google.common.collect.ImmutableMap; +import com.google.longrunning.stub.GrpcOperationsStub; import com.google.protobuf.Empty; import io.grpc.MethodDescriptor; import io.grpc.protobuf.ProtoUtils; @@ -41,16 +42,14 @@ import java.util.concurrent.TimeUnit; import javax.annotation.Generated; -// AUTO-GENERATED DOCUMENTATION AND CLASS +// AUTO-GENERATED DOCUMENTATION AND CLASS. /** - * gRPC stub implementation for Dialogflow API. + * gRPC stub implementation for the EntityTypes service API. * *

This class is for advanced usage and reflects the underlying API directly. */ -@Generated("by gapic-generator") -@BetaApi("A restructuring of stub classes is planned, so this may break in the future") +@Generated("by gapic-generator-java") public class GrpcEntityTypesStub extends EntityTypesStub { - private static final MethodDescriptor listEntityTypesMethodDescriptor = MethodDescriptor.newBuilder() @@ -61,6 +60,7 @@ public class GrpcEntityTypesStub extends EntityTypesStub { .setResponseMarshaller( ProtoUtils.marshaller(ListEntityTypesResponse.getDefaultInstance())) .build(); + private static final MethodDescriptor getEntityTypeMethodDescriptor = MethodDescriptor.newBuilder() @@ -70,6 +70,7 @@ public class GrpcEntityTypesStub extends EntityTypesStub { ProtoUtils.marshaller(GetEntityTypeRequest.getDefaultInstance())) .setResponseMarshaller(ProtoUtils.marshaller(EntityType.getDefaultInstance())) .build(); + private static final MethodDescriptor createEntityTypeMethodDescriptor = MethodDescriptor.newBuilder() @@ -79,6 +80,7 @@ public class GrpcEntityTypesStub extends EntityTypesStub { ProtoUtils.marshaller(CreateEntityTypeRequest.getDefaultInstance())) .setResponseMarshaller(ProtoUtils.marshaller(EntityType.getDefaultInstance())) .build(); + private static final MethodDescriptor updateEntityTypeMethodDescriptor = MethodDescriptor.newBuilder() @@ -88,6 +90,7 @@ public class GrpcEntityTypesStub extends EntityTypesStub { ProtoUtils.marshaller(UpdateEntityTypeRequest.getDefaultInstance())) .setResponseMarshaller(ProtoUtils.marshaller(EntityType.getDefaultInstance())) .build(); + private static final MethodDescriptor deleteEntityTypeMethodDescriptor = MethodDescriptor.newBuilder() @@ -98,8 +101,6 @@ public class GrpcEntityTypesStub extends EntityTypesStub { .setResponseMarshaller(ProtoUtils.marshaller(Empty.getDefaultInstance())) .build(); - private final BackgroundResource backgroundResources; - private final UnaryCallable listEntityTypesCallable; private final UnaryCallable @@ -109,6 +110,8 @@ public class GrpcEntityTypesStub extends EntityTypesStub { private final UnaryCallable updateEntityTypeCallable; private final UnaryCallable deleteEntityTypeCallable; + private final BackgroundResource backgroundResources; + private final GrpcOperationsStub operationsStub; private final GrpcStubCallableFactory callableFactory; public static final GrpcEntityTypesStub create(EntityTypesStubSettings settings) @@ -147,6 +150,7 @@ protected GrpcEntityTypesStub( GrpcStubCallableFactory callableFactory) throws IOException { this.callableFactory = callableFactory; + this.operationsStub = GrpcOperationsStub.create(clientContext, callableFactory); GrpcCallSettings listEntityTypesTransportSettings = @@ -235,18 +239,23 @@ public Map extract(DeleteEntityTypeRequest request) { callableFactory.createUnaryCallable( deleteEntityTypeTransportSettings, settings.deleteEntityTypeSettings(), clientContext); - backgroundResources = new BackgroundResourceAggregation(clientContext.getBackgroundResources()); + this.backgroundResources = + new BackgroundResourceAggregation(clientContext.getBackgroundResources()); } - public UnaryCallable - listEntityTypesPagedCallable() { - return listEntityTypesPagedCallable; + public GrpcOperationsStub getOperationsStub() { + return operationsStub; } public UnaryCallable listEntityTypesCallable() { return listEntityTypesCallable; } + public UnaryCallable + listEntityTypesPagedCallable() { + return listEntityTypesPagedCallable; + } + public UnaryCallable getEntityTypeCallable() { return getEntityTypeCallable; } diff --git a/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3beta1/stub/GrpcEnvironmentsCallableFactory.java b/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3beta1/stub/GrpcEnvironmentsCallableFactory.java index f1a353163..b48d0203d 100644 --- a/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3beta1/stub/GrpcEnvironmentsCallableFactory.java +++ b/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3beta1/stub/GrpcEnvironmentsCallableFactory.java @@ -5,7 +5,7 @@ * 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 + * 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, @@ -13,9 +13,9 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.google.cloud.dialogflow.cx.v3beta1.stub; -import com.google.api.core.BetaApi; import com.google.api.gax.grpc.GrpcCallSettings; import com.google.api.gax.grpc.GrpcCallableFactory; import com.google.api.gax.grpc.GrpcStubCallableFactory; @@ -31,18 +31,19 @@ import com.google.api.gax.rpc.StreamingCallSettings; import com.google.api.gax.rpc.UnaryCallSettings; import com.google.api.gax.rpc.UnaryCallable; +import com.google.longrunning.Operation; import com.google.longrunning.stub.OperationsStub; import javax.annotation.Generated; -// AUTO-GENERATED DOCUMENTATION AND CLASS +// AUTO-GENERATED DOCUMENTATION AND CLASS. /** - * gRPC callable factory implementation for Dialogflow API. + * gRPC callable factory implementation for the Environments service API. * *

This class is for advanced usage. */ @Generated("by gapic-generator") -@BetaApi("The surface for use by generated code is not stable yet and may change in the future.") public class GrpcEnvironmentsCallableFactory implements GrpcStubCallableFactory { + @Override public UnaryCallable createUnaryCallable( GrpcCallSettings grpcCallSettings, @@ -55,61 +56,58 @@ public UnaryCallable createUnaryCalla public UnaryCallable createPagedCallable( GrpcCallSettings grpcCallSettings, - PagedCallSettings pagedCallSettings, + PagedCallSettings callSettings, ClientContext clientContext) { - return GrpcCallableFactory.createPagedCallable( - grpcCallSettings, pagedCallSettings, clientContext); + return GrpcCallableFactory.createPagedCallable(grpcCallSettings, callSettings, clientContext); } @Override public UnaryCallable createBatchingCallable( GrpcCallSettings grpcCallSettings, - BatchingCallSettings batchingCallSettings, + BatchingCallSettings callSettings, ClientContext clientContext) { return GrpcCallableFactory.createBatchingCallable( - grpcCallSettings, batchingCallSettings, clientContext); + grpcCallSettings, callSettings, clientContext); } - @BetaApi( - "The surface for long-running operations is not stable yet and may change in the future.") @Override public OperationCallable createOperationCallable( - GrpcCallSettings grpcCallSettings, - OperationCallSettings operationCallSettings, + GrpcCallSettings grpcCallSettings, + OperationCallSettings callSettings, ClientContext clientContext, OperationsStub operationsStub) { return GrpcCallableFactory.createOperationCallable( - grpcCallSettings, operationCallSettings, clientContext, operationsStub); + grpcCallSettings, callSettings, clientContext, operationsStub); } @Override public BidiStreamingCallable createBidiStreamingCallable( GrpcCallSettings grpcCallSettings, - StreamingCallSettings streamingCallSettings, + StreamingCallSettings callSettings, ClientContext clientContext) { return GrpcCallableFactory.createBidiStreamingCallable( - grpcCallSettings, streamingCallSettings, clientContext); + grpcCallSettings, callSettings, clientContext); } @Override public ServerStreamingCallable createServerStreamingCallable( GrpcCallSettings grpcCallSettings, - ServerStreamingCallSettings streamingCallSettings, + ServerStreamingCallSettings callSettings, ClientContext clientContext) { return GrpcCallableFactory.createServerStreamingCallable( - grpcCallSettings, streamingCallSettings, clientContext); + grpcCallSettings, callSettings, clientContext); } @Override public ClientStreamingCallable createClientStreamingCallable( GrpcCallSettings grpcCallSettings, - StreamingCallSettings streamingCallSettings, + StreamingCallSettings callSettings, ClientContext clientContext) { return GrpcCallableFactory.createClientStreamingCallable( - grpcCallSettings, streamingCallSettings, clientContext); + grpcCallSettings, callSettings, clientContext); } } diff --git a/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3beta1/stub/GrpcEnvironmentsStub.java b/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3beta1/stub/GrpcEnvironmentsStub.java index 2a5593435..f5fe09034 100644 --- a/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3beta1/stub/GrpcEnvironmentsStub.java +++ b/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3beta1/stub/GrpcEnvironmentsStub.java @@ -5,7 +5,7 @@ * 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 + * 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, @@ -13,12 +13,12 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.google.cloud.dialogflow.cx.v3beta1.stub; import static com.google.cloud.dialogflow.cx.v3beta1.EnvironmentsClient.ListEnvironmentsPagedResponse; import static com.google.cloud.dialogflow.cx.v3beta1.EnvironmentsClient.LookupEnvironmentHistoryPagedResponse; -import com.google.api.core.BetaApi; import com.google.api.gax.core.BackgroundResource; import com.google.api.gax.core.BackgroundResourceAggregation; import com.google.api.gax.grpc.GrpcCallSettings; @@ -48,16 +48,14 @@ import java.util.concurrent.TimeUnit; import javax.annotation.Generated; -// AUTO-GENERATED DOCUMENTATION AND CLASS +// AUTO-GENERATED DOCUMENTATION AND CLASS. /** - * gRPC stub implementation for Dialogflow API. + * gRPC stub implementation for the Environments service API. * *

This class is for advanced usage and reflects the underlying API directly. */ -@Generated("by gapic-generator") -@BetaApi("A restructuring of stub classes is planned, so this may break in the future") +@Generated("by gapic-generator-java") public class GrpcEnvironmentsStub extends EnvironmentsStub { - private static final MethodDescriptor listEnvironmentsMethodDescriptor = MethodDescriptor.newBuilder() @@ -68,6 +66,7 @@ public class GrpcEnvironmentsStub extends EnvironmentsStub { .setResponseMarshaller( ProtoUtils.marshaller(ListEnvironmentsResponse.getDefaultInstance())) .build(); + private static final MethodDescriptor getEnvironmentMethodDescriptor = MethodDescriptor.newBuilder() @@ -77,6 +76,7 @@ public class GrpcEnvironmentsStub extends EnvironmentsStub { ProtoUtils.marshaller(GetEnvironmentRequest.getDefaultInstance())) .setResponseMarshaller(ProtoUtils.marshaller(Environment.getDefaultInstance())) .build(); + private static final MethodDescriptor createEnvironmentMethodDescriptor = MethodDescriptor.newBuilder() @@ -87,6 +87,7 @@ public class GrpcEnvironmentsStub extends EnvironmentsStub { ProtoUtils.marshaller(CreateEnvironmentRequest.getDefaultInstance())) .setResponseMarshaller(ProtoUtils.marshaller(Operation.getDefaultInstance())) .build(); + private static final MethodDescriptor updateEnvironmentMethodDescriptor = MethodDescriptor.newBuilder() @@ -97,6 +98,7 @@ public class GrpcEnvironmentsStub extends EnvironmentsStub { ProtoUtils.marshaller(UpdateEnvironmentRequest.getDefaultInstance())) .setResponseMarshaller(ProtoUtils.marshaller(Operation.getDefaultInstance())) .build(); + private static final MethodDescriptor deleteEnvironmentMethodDescriptor = MethodDescriptor.newBuilder() @@ -107,6 +109,7 @@ public class GrpcEnvironmentsStub extends EnvironmentsStub { ProtoUtils.marshaller(DeleteEnvironmentRequest.getDefaultInstance())) .setResponseMarshaller(ProtoUtils.marshaller(Empty.getDefaultInstance())) .build(); + private static final MethodDescriptor< LookupEnvironmentHistoryRequest, LookupEnvironmentHistoryResponse> lookupEnvironmentHistoryMethodDescriptor = @@ -121,9 +124,6 @@ public class GrpcEnvironmentsStub extends EnvironmentsStub { ProtoUtils.marshaller(LookupEnvironmentHistoryResponse.getDefaultInstance())) .build(); - private final BackgroundResource backgroundResources; - private final GrpcOperationsStub operationsStub; - private final UnaryCallable listEnvironmentsCallable; private final UnaryCallable @@ -142,6 +142,8 @@ public class GrpcEnvironmentsStub extends EnvironmentsStub { LookupEnvironmentHistoryRequest, LookupEnvironmentHistoryPagedResponse> lookupEnvironmentHistoryPagedCallable; + private final BackgroundResource backgroundResources; + private final GrpcOperationsStub operationsStub; private final GrpcStubCallableFactory callableFactory; public static final GrpcEnvironmentsStub create(EnvironmentsStubSettings settings) @@ -284,7 +286,7 @@ public Map extract(LookupEnvironmentHistoryRequest request) { createEnvironmentTransportSettings, settings.createEnvironmentOperationSettings(), clientContext, - this.operationsStub); + operationsStub); this.updateEnvironmentCallable = callableFactory.createUnaryCallable( updateEnvironmentTransportSettings, @@ -295,7 +297,7 @@ public Map extract(LookupEnvironmentHistoryRequest request) { updateEnvironmentTransportSettings, settings.updateEnvironmentOperationSettings(), clientContext, - this.operationsStub); + operationsStub); this.deleteEnvironmentCallable = callableFactory.createUnaryCallable( deleteEnvironmentTransportSettings, @@ -312,62 +314,60 @@ public Map extract(LookupEnvironmentHistoryRequest request) { settings.lookupEnvironmentHistorySettings(), clientContext); - backgroundResources = new BackgroundResourceAggregation(clientContext.getBackgroundResources()); + this.backgroundResources = + new BackgroundResourceAggregation(clientContext.getBackgroundResources()); } - @BetaApi("The surface for use by generated code is not stable yet and may change in the future.") public GrpcOperationsStub getOperationsStub() { return operationsStub; } - public UnaryCallable - listEnvironmentsPagedCallable() { - return listEnvironmentsPagedCallable; - } - public UnaryCallable listEnvironmentsCallable() { return listEnvironmentsCallable; } + public UnaryCallable + listEnvironmentsPagedCallable() { + return listEnvironmentsPagedCallable; + } + public UnaryCallable getEnvironmentCallable() { return getEnvironmentCallable; } - @BetaApi("The surface for use by generated code is not stable yet and may change in the future.") + public UnaryCallable createEnvironmentCallable() { + return createEnvironmentCallable; + } + public OperationCallable createEnvironmentOperationCallable() { return createEnvironmentOperationCallable; } - public UnaryCallable createEnvironmentCallable() { - return createEnvironmentCallable; + public UnaryCallable updateEnvironmentCallable() { + return updateEnvironmentCallable; } - @BetaApi("The surface for use by generated code is not stable yet and may change in the future.") public OperationCallable updateEnvironmentOperationCallable() { return updateEnvironmentOperationCallable; } - public UnaryCallable updateEnvironmentCallable() { - return updateEnvironmentCallable; - } - public UnaryCallable deleteEnvironmentCallable() { return deleteEnvironmentCallable; } - public UnaryCallable - lookupEnvironmentHistoryPagedCallable() { - return lookupEnvironmentHistoryPagedCallable; - } - public UnaryCallable lookupEnvironmentHistoryCallable() { return lookupEnvironmentHistoryCallable; } + public UnaryCallable + lookupEnvironmentHistoryPagedCallable() { + return lookupEnvironmentHistoryPagedCallable; + } + @Override public final void close() { shutdown(); diff --git a/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3beta1/stub/GrpcFlowsCallableFactory.java b/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3beta1/stub/GrpcFlowsCallableFactory.java index a8da24a56..baa6a1bb1 100644 --- a/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3beta1/stub/GrpcFlowsCallableFactory.java +++ b/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3beta1/stub/GrpcFlowsCallableFactory.java @@ -5,7 +5,7 @@ * 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 + * 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, @@ -13,9 +13,9 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.google.cloud.dialogflow.cx.v3beta1.stub; -import com.google.api.core.BetaApi; import com.google.api.gax.grpc.GrpcCallSettings; import com.google.api.gax.grpc.GrpcCallableFactory; import com.google.api.gax.grpc.GrpcStubCallableFactory; @@ -31,18 +31,19 @@ import com.google.api.gax.rpc.StreamingCallSettings; import com.google.api.gax.rpc.UnaryCallSettings; import com.google.api.gax.rpc.UnaryCallable; +import com.google.longrunning.Operation; import com.google.longrunning.stub.OperationsStub; import javax.annotation.Generated; -// AUTO-GENERATED DOCUMENTATION AND CLASS +// AUTO-GENERATED DOCUMENTATION AND CLASS. /** - * gRPC callable factory implementation for Dialogflow API. + * gRPC callable factory implementation for the Flows service API. * *

This class is for advanced usage. */ @Generated("by gapic-generator") -@BetaApi("The surface for use by generated code is not stable yet and may change in the future.") public class GrpcFlowsCallableFactory implements GrpcStubCallableFactory { + @Override public UnaryCallable createUnaryCallable( GrpcCallSettings grpcCallSettings, @@ -55,61 +56,58 @@ public UnaryCallable createUnaryCalla public UnaryCallable createPagedCallable( GrpcCallSettings grpcCallSettings, - PagedCallSettings pagedCallSettings, + PagedCallSettings callSettings, ClientContext clientContext) { - return GrpcCallableFactory.createPagedCallable( - grpcCallSettings, pagedCallSettings, clientContext); + return GrpcCallableFactory.createPagedCallable(grpcCallSettings, callSettings, clientContext); } @Override public UnaryCallable createBatchingCallable( GrpcCallSettings grpcCallSettings, - BatchingCallSettings batchingCallSettings, + BatchingCallSettings callSettings, ClientContext clientContext) { return GrpcCallableFactory.createBatchingCallable( - grpcCallSettings, batchingCallSettings, clientContext); + grpcCallSettings, callSettings, clientContext); } - @BetaApi( - "The surface for long-running operations is not stable yet and may change in the future.") @Override public OperationCallable createOperationCallable( - GrpcCallSettings grpcCallSettings, - OperationCallSettings operationCallSettings, + GrpcCallSettings grpcCallSettings, + OperationCallSettings callSettings, ClientContext clientContext, OperationsStub operationsStub) { return GrpcCallableFactory.createOperationCallable( - grpcCallSettings, operationCallSettings, clientContext, operationsStub); + grpcCallSettings, callSettings, clientContext, operationsStub); } @Override public BidiStreamingCallable createBidiStreamingCallable( GrpcCallSettings grpcCallSettings, - StreamingCallSettings streamingCallSettings, + StreamingCallSettings callSettings, ClientContext clientContext) { return GrpcCallableFactory.createBidiStreamingCallable( - grpcCallSettings, streamingCallSettings, clientContext); + grpcCallSettings, callSettings, clientContext); } @Override public ServerStreamingCallable createServerStreamingCallable( GrpcCallSettings grpcCallSettings, - ServerStreamingCallSettings streamingCallSettings, + ServerStreamingCallSettings callSettings, ClientContext clientContext) { return GrpcCallableFactory.createServerStreamingCallable( - grpcCallSettings, streamingCallSettings, clientContext); + grpcCallSettings, callSettings, clientContext); } @Override public ClientStreamingCallable createClientStreamingCallable( GrpcCallSettings grpcCallSettings, - StreamingCallSettings streamingCallSettings, + StreamingCallSettings callSettings, ClientContext clientContext) { return GrpcCallableFactory.createClientStreamingCallable( - grpcCallSettings, streamingCallSettings, clientContext); + grpcCallSettings, callSettings, clientContext); } } diff --git a/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3beta1/stub/GrpcFlowsStub.java b/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3beta1/stub/GrpcFlowsStub.java index ce59e63cf..a55275c88 100644 --- a/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3beta1/stub/GrpcFlowsStub.java +++ b/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3beta1/stub/GrpcFlowsStub.java @@ -5,7 +5,7 @@ * 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 + * 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, @@ -13,11 +13,11 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.google.cloud.dialogflow.cx.v3beta1.stub; import static com.google.cloud.dialogflow.cx.v3beta1.FlowsClient.ListFlowsPagedResponse; -import com.google.api.core.BetaApi; import com.google.api.gax.core.BackgroundResource; import com.google.api.gax.core.BackgroundResourceAggregation; import com.google.api.gax.grpc.GrpcCallSettings; @@ -46,16 +46,14 @@ import java.util.concurrent.TimeUnit; import javax.annotation.Generated; -// AUTO-GENERATED DOCUMENTATION AND CLASS +// AUTO-GENERATED DOCUMENTATION AND CLASS. /** - * gRPC stub implementation for Dialogflow API. + * gRPC stub implementation for the Flows service API. * *

This class is for advanced usage and reflects the underlying API directly. */ -@Generated("by gapic-generator") -@BetaApi("A restructuring of stub classes is planned, so this may break in the future") +@Generated("by gapic-generator-java") public class GrpcFlowsStub extends FlowsStub { - private static final MethodDescriptor createFlowMethodDescriptor = MethodDescriptor.newBuilder() .setType(MethodDescriptor.MethodType.UNARY) @@ -63,6 +61,7 @@ public class GrpcFlowsStub extends FlowsStub { .setRequestMarshaller(ProtoUtils.marshaller(CreateFlowRequest.getDefaultInstance())) .setResponseMarshaller(ProtoUtils.marshaller(Flow.getDefaultInstance())) .build(); + private static final MethodDescriptor deleteFlowMethodDescriptor = MethodDescriptor.newBuilder() .setType(MethodDescriptor.MethodType.UNARY) @@ -70,6 +69,7 @@ public class GrpcFlowsStub extends FlowsStub { .setRequestMarshaller(ProtoUtils.marshaller(DeleteFlowRequest.getDefaultInstance())) .setResponseMarshaller(ProtoUtils.marshaller(Empty.getDefaultInstance())) .build(); + private static final MethodDescriptor listFlowsMethodDescriptor = MethodDescriptor.newBuilder() @@ -78,6 +78,7 @@ public class GrpcFlowsStub extends FlowsStub { .setRequestMarshaller(ProtoUtils.marshaller(ListFlowsRequest.getDefaultInstance())) .setResponseMarshaller(ProtoUtils.marshaller(ListFlowsResponse.getDefaultInstance())) .build(); + private static final MethodDescriptor getFlowMethodDescriptor = MethodDescriptor.newBuilder() .setType(MethodDescriptor.MethodType.UNARY) @@ -85,6 +86,7 @@ public class GrpcFlowsStub extends FlowsStub { .setRequestMarshaller(ProtoUtils.marshaller(GetFlowRequest.getDefaultInstance())) .setResponseMarshaller(ProtoUtils.marshaller(Flow.getDefaultInstance())) .build(); + private static final MethodDescriptor updateFlowMethodDescriptor = MethodDescriptor.newBuilder() .setType(MethodDescriptor.MethodType.UNARY) @@ -92,6 +94,7 @@ public class GrpcFlowsStub extends FlowsStub { .setRequestMarshaller(ProtoUtils.marshaller(UpdateFlowRequest.getDefaultInstance())) .setResponseMarshaller(ProtoUtils.marshaller(Flow.getDefaultInstance())) .build(); + private static final MethodDescriptor trainFlowMethodDescriptor = MethodDescriptor.newBuilder() .setType(MethodDescriptor.MethodType.UNARY) @@ -100,9 +103,6 @@ public class GrpcFlowsStub extends FlowsStub { .setResponseMarshaller(ProtoUtils.marshaller(Operation.getDefaultInstance())) .build(); - private final BackgroundResource backgroundResources; - private final GrpcOperationsStub operationsStub; - private final UnaryCallable createFlowCallable; private final UnaryCallable deleteFlowCallable; private final UnaryCallable listFlowsCallable; @@ -112,6 +112,8 @@ public class GrpcFlowsStub extends FlowsStub { private final UnaryCallable trainFlowCallable; private final OperationCallable trainFlowOperationCallable; + private final BackgroundResource backgroundResources; + private final GrpcOperationsStub operationsStub; private final GrpcStubCallableFactory callableFactory; public static final GrpcFlowsStub create(FlowsStubSettings settings) throws IOException { @@ -254,12 +256,12 @@ public Map extract(TrainFlowRequest request) { trainFlowTransportSettings, settings.trainFlowOperationSettings(), clientContext, - this.operationsStub); + operationsStub); - backgroundResources = new BackgroundResourceAggregation(clientContext.getBackgroundResources()); + this.backgroundResources = + new BackgroundResourceAggregation(clientContext.getBackgroundResources()); } - @BetaApi("The surface for use by generated code is not stable yet and may change in the future.") public GrpcOperationsStub getOperationsStub() { return operationsStub; } @@ -272,14 +274,14 @@ public UnaryCallable deleteFlowCallable() { return deleteFlowCallable; } - public UnaryCallable listFlowsPagedCallable() { - return listFlowsPagedCallable; - } - public UnaryCallable listFlowsCallable() { return listFlowsCallable; } + public UnaryCallable listFlowsPagedCallable() { + return listFlowsPagedCallable; + } + public UnaryCallable getFlowCallable() { return getFlowCallable; } @@ -288,15 +290,14 @@ public UnaryCallable updateFlowCallable() { return updateFlowCallable; } - @BetaApi("The surface for use by generated code is not stable yet and may change in the future.") - public OperationCallable trainFlowOperationCallable() { - return trainFlowOperationCallable; - } - public UnaryCallable trainFlowCallable() { return trainFlowCallable; } + public OperationCallable trainFlowOperationCallable() { + return trainFlowOperationCallable; + } + @Override public final void close() { shutdown(); diff --git a/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3beta1/stub/GrpcIntentsCallableFactory.java b/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3beta1/stub/GrpcIntentsCallableFactory.java index 60ad87cf6..806346858 100644 --- a/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3beta1/stub/GrpcIntentsCallableFactory.java +++ b/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3beta1/stub/GrpcIntentsCallableFactory.java @@ -5,7 +5,7 @@ * 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 + * 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, @@ -13,9 +13,9 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.google.cloud.dialogflow.cx.v3beta1.stub; -import com.google.api.core.BetaApi; import com.google.api.gax.grpc.GrpcCallSettings; import com.google.api.gax.grpc.GrpcCallableFactory; import com.google.api.gax.grpc.GrpcStubCallableFactory; @@ -31,18 +31,19 @@ import com.google.api.gax.rpc.StreamingCallSettings; import com.google.api.gax.rpc.UnaryCallSettings; import com.google.api.gax.rpc.UnaryCallable; +import com.google.longrunning.Operation; import com.google.longrunning.stub.OperationsStub; import javax.annotation.Generated; -// AUTO-GENERATED DOCUMENTATION AND CLASS +// AUTO-GENERATED DOCUMENTATION AND CLASS. /** - * gRPC callable factory implementation for Dialogflow API. + * gRPC callable factory implementation for the Intents service API. * *

This class is for advanced usage. */ @Generated("by gapic-generator") -@BetaApi("The surface for use by generated code is not stable yet and may change in the future.") public class GrpcIntentsCallableFactory implements GrpcStubCallableFactory { + @Override public UnaryCallable createUnaryCallable( GrpcCallSettings grpcCallSettings, @@ -55,61 +56,58 @@ public UnaryCallable createUnaryCalla public UnaryCallable createPagedCallable( GrpcCallSettings grpcCallSettings, - PagedCallSettings pagedCallSettings, + PagedCallSettings callSettings, ClientContext clientContext) { - return GrpcCallableFactory.createPagedCallable( - grpcCallSettings, pagedCallSettings, clientContext); + return GrpcCallableFactory.createPagedCallable(grpcCallSettings, callSettings, clientContext); } @Override public UnaryCallable createBatchingCallable( GrpcCallSettings grpcCallSettings, - BatchingCallSettings batchingCallSettings, + BatchingCallSettings callSettings, ClientContext clientContext) { return GrpcCallableFactory.createBatchingCallable( - grpcCallSettings, batchingCallSettings, clientContext); + grpcCallSettings, callSettings, clientContext); } - @BetaApi( - "The surface for long-running operations is not stable yet and may change in the future.") @Override public OperationCallable createOperationCallable( - GrpcCallSettings grpcCallSettings, - OperationCallSettings operationCallSettings, + GrpcCallSettings grpcCallSettings, + OperationCallSettings callSettings, ClientContext clientContext, OperationsStub operationsStub) { return GrpcCallableFactory.createOperationCallable( - grpcCallSettings, operationCallSettings, clientContext, operationsStub); + grpcCallSettings, callSettings, clientContext, operationsStub); } @Override public BidiStreamingCallable createBidiStreamingCallable( GrpcCallSettings grpcCallSettings, - StreamingCallSettings streamingCallSettings, + StreamingCallSettings callSettings, ClientContext clientContext) { return GrpcCallableFactory.createBidiStreamingCallable( - grpcCallSettings, streamingCallSettings, clientContext); + grpcCallSettings, callSettings, clientContext); } @Override public ServerStreamingCallable createServerStreamingCallable( GrpcCallSettings grpcCallSettings, - ServerStreamingCallSettings streamingCallSettings, + ServerStreamingCallSettings callSettings, ClientContext clientContext) { return GrpcCallableFactory.createServerStreamingCallable( - grpcCallSettings, streamingCallSettings, clientContext); + grpcCallSettings, callSettings, clientContext); } @Override public ClientStreamingCallable createClientStreamingCallable( GrpcCallSettings grpcCallSettings, - StreamingCallSettings streamingCallSettings, + StreamingCallSettings callSettings, ClientContext clientContext) { return GrpcCallableFactory.createClientStreamingCallable( - grpcCallSettings, streamingCallSettings, clientContext); + grpcCallSettings, callSettings, clientContext); } } diff --git a/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3beta1/stub/GrpcIntentsStub.java b/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3beta1/stub/GrpcIntentsStub.java index cffb6c868..d6c143678 100644 --- a/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3beta1/stub/GrpcIntentsStub.java +++ b/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3beta1/stub/GrpcIntentsStub.java @@ -5,7 +5,7 @@ * 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 + * 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, @@ -13,11 +13,11 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.google.cloud.dialogflow.cx.v3beta1.stub; import static com.google.cloud.dialogflow.cx.v3beta1.IntentsClient.ListIntentsPagedResponse; -import com.google.api.core.BetaApi; import com.google.api.gax.core.BackgroundResource; import com.google.api.gax.core.BackgroundResourceAggregation; import com.google.api.gax.grpc.GrpcCallSettings; @@ -33,6 +33,7 @@ import com.google.cloud.dialogflow.cx.v3beta1.ListIntentsResponse; import com.google.cloud.dialogflow.cx.v3beta1.UpdateIntentRequest; import com.google.common.collect.ImmutableMap; +import com.google.longrunning.stub.GrpcOperationsStub; import com.google.protobuf.Empty; import io.grpc.MethodDescriptor; import io.grpc.protobuf.ProtoUtils; @@ -41,16 +42,14 @@ import java.util.concurrent.TimeUnit; import javax.annotation.Generated; -// AUTO-GENERATED DOCUMENTATION AND CLASS +// AUTO-GENERATED DOCUMENTATION AND CLASS. /** - * gRPC stub implementation for Dialogflow API. + * gRPC stub implementation for the Intents service API. * *

This class is for advanced usage and reflects the underlying API directly. */ -@Generated("by gapic-generator") -@BetaApi("A restructuring of stub classes is planned, so this may break in the future") +@Generated("by gapic-generator-java") public class GrpcIntentsStub extends IntentsStub { - private static final MethodDescriptor listIntentsMethodDescriptor = MethodDescriptor.newBuilder() @@ -60,6 +59,7 @@ public class GrpcIntentsStub extends IntentsStub { .setResponseMarshaller( ProtoUtils.marshaller(ListIntentsResponse.getDefaultInstance())) .build(); + private static final MethodDescriptor getIntentMethodDescriptor = MethodDescriptor.newBuilder() .setType(MethodDescriptor.MethodType.UNARY) @@ -67,6 +67,7 @@ public class GrpcIntentsStub extends IntentsStub { .setRequestMarshaller(ProtoUtils.marshaller(GetIntentRequest.getDefaultInstance())) .setResponseMarshaller(ProtoUtils.marshaller(Intent.getDefaultInstance())) .build(); + private static final MethodDescriptor createIntentMethodDescriptor = MethodDescriptor.newBuilder() .setType(MethodDescriptor.MethodType.UNARY) @@ -74,6 +75,7 @@ public class GrpcIntentsStub extends IntentsStub { .setRequestMarshaller(ProtoUtils.marshaller(CreateIntentRequest.getDefaultInstance())) .setResponseMarshaller(ProtoUtils.marshaller(Intent.getDefaultInstance())) .build(); + private static final MethodDescriptor updateIntentMethodDescriptor = MethodDescriptor.newBuilder() .setType(MethodDescriptor.MethodType.UNARY) @@ -81,6 +83,7 @@ public class GrpcIntentsStub extends IntentsStub { .setRequestMarshaller(ProtoUtils.marshaller(UpdateIntentRequest.getDefaultInstance())) .setResponseMarshaller(ProtoUtils.marshaller(Intent.getDefaultInstance())) .build(); + private static final MethodDescriptor deleteIntentMethodDescriptor = MethodDescriptor.newBuilder() .setType(MethodDescriptor.MethodType.UNARY) @@ -89,8 +92,6 @@ public class GrpcIntentsStub extends IntentsStub { .setResponseMarshaller(ProtoUtils.marshaller(Empty.getDefaultInstance())) .build(); - private final BackgroundResource backgroundResources; - private final UnaryCallable listIntentsCallable; private final UnaryCallable listIntentsPagedCallable; @@ -99,6 +100,8 @@ public class GrpcIntentsStub extends IntentsStub { private final UnaryCallable updateIntentCallable; private final UnaryCallable deleteIntentCallable; + private final BackgroundResource backgroundResources; + private final GrpcOperationsStub operationsStub; private final GrpcStubCallableFactory callableFactory; public static final GrpcIntentsStub create(IntentsStubSettings settings) throws IOException { @@ -134,6 +137,7 @@ protected GrpcIntentsStub( GrpcStubCallableFactory callableFactory) throws IOException { this.callableFactory = callableFactory; + this.operationsStub = GrpcOperationsStub.create(clientContext, callableFactory); GrpcCallSettings listIntentsTransportSettings = GrpcCallSettings.newBuilder() @@ -220,17 +224,22 @@ public Map extract(DeleteIntentRequest request) { callableFactory.createUnaryCallable( deleteIntentTransportSettings, settings.deleteIntentSettings(), clientContext); - backgroundResources = new BackgroundResourceAggregation(clientContext.getBackgroundResources()); + this.backgroundResources = + new BackgroundResourceAggregation(clientContext.getBackgroundResources()); } - public UnaryCallable listIntentsPagedCallable() { - return listIntentsPagedCallable; + public GrpcOperationsStub getOperationsStub() { + return operationsStub; } public UnaryCallable listIntentsCallable() { return listIntentsCallable; } + public UnaryCallable listIntentsPagedCallable() { + return listIntentsPagedCallable; + } + public UnaryCallable getIntentCallable() { return getIntentCallable; } diff --git a/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3beta1/stub/GrpcPagesCallableFactory.java b/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3beta1/stub/GrpcPagesCallableFactory.java index 2f4206067..3ff0e65e9 100644 --- a/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3beta1/stub/GrpcPagesCallableFactory.java +++ b/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3beta1/stub/GrpcPagesCallableFactory.java @@ -5,7 +5,7 @@ * 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 + * 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, @@ -13,9 +13,9 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.google.cloud.dialogflow.cx.v3beta1.stub; -import com.google.api.core.BetaApi; import com.google.api.gax.grpc.GrpcCallSettings; import com.google.api.gax.grpc.GrpcCallableFactory; import com.google.api.gax.grpc.GrpcStubCallableFactory; @@ -31,18 +31,19 @@ import com.google.api.gax.rpc.StreamingCallSettings; import com.google.api.gax.rpc.UnaryCallSettings; import com.google.api.gax.rpc.UnaryCallable; +import com.google.longrunning.Operation; import com.google.longrunning.stub.OperationsStub; import javax.annotation.Generated; -// AUTO-GENERATED DOCUMENTATION AND CLASS +// AUTO-GENERATED DOCUMENTATION AND CLASS. /** - * gRPC callable factory implementation for Dialogflow API. + * gRPC callable factory implementation for the Pages service API. * *

This class is for advanced usage. */ @Generated("by gapic-generator") -@BetaApi("The surface for use by generated code is not stable yet and may change in the future.") public class GrpcPagesCallableFactory implements GrpcStubCallableFactory { + @Override public UnaryCallable createUnaryCallable( GrpcCallSettings grpcCallSettings, @@ -55,61 +56,58 @@ public UnaryCallable createUnaryCalla public UnaryCallable createPagedCallable( GrpcCallSettings grpcCallSettings, - PagedCallSettings pagedCallSettings, + PagedCallSettings callSettings, ClientContext clientContext) { - return GrpcCallableFactory.createPagedCallable( - grpcCallSettings, pagedCallSettings, clientContext); + return GrpcCallableFactory.createPagedCallable(grpcCallSettings, callSettings, clientContext); } @Override public UnaryCallable createBatchingCallable( GrpcCallSettings grpcCallSettings, - BatchingCallSettings batchingCallSettings, + BatchingCallSettings callSettings, ClientContext clientContext) { return GrpcCallableFactory.createBatchingCallable( - grpcCallSettings, batchingCallSettings, clientContext); + grpcCallSettings, callSettings, clientContext); } - @BetaApi( - "The surface for long-running operations is not stable yet and may change in the future.") @Override public OperationCallable createOperationCallable( - GrpcCallSettings grpcCallSettings, - OperationCallSettings operationCallSettings, + GrpcCallSettings grpcCallSettings, + OperationCallSettings callSettings, ClientContext clientContext, OperationsStub operationsStub) { return GrpcCallableFactory.createOperationCallable( - grpcCallSettings, operationCallSettings, clientContext, operationsStub); + grpcCallSettings, callSettings, clientContext, operationsStub); } @Override public BidiStreamingCallable createBidiStreamingCallable( GrpcCallSettings grpcCallSettings, - StreamingCallSettings streamingCallSettings, + StreamingCallSettings callSettings, ClientContext clientContext) { return GrpcCallableFactory.createBidiStreamingCallable( - grpcCallSettings, streamingCallSettings, clientContext); + grpcCallSettings, callSettings, clientContext); } @Override public ServerStreamingCallable createServerStreamingCallable( GrpcCallSettings grpcCallSettings, - ServerStreamingCallSettings streamingCallSettings, + ServerStreamingCallSettings callSettings, ClientContext clientContext) { return GrpcCallableFactory.createServerStreamingCallable( - grpcCallSettings, streamingCallSettings, clientContext); + grpcCallSettings, callSettings, clientContext); } @Override public ClientStreamingCallable createClientStreamingCallable( GrpcCallSettings grpcCallSettings, - StreamingCallSettings streamingCallSettings, + StreamingCallSettings callSettings, ClientContext clientContext) { return GrpcCallableFactory.createClientStreamingCallable( - grpcCallSettings, streamingCallSettings, clientContext); + grpcCallSettings, callSettings, clientContext); } } diff --git a/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3beta1/stub/GrpcPagesStub.java b/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3beta1/stub/GrpcPagesStub.java index b9caf90ba..3f3170f1a 100644 --- a/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3beta1/stub/GrpcPagesStub.java +++ b/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3beta1/stub/GrpcPagesStub.java @@ -5,7 +5,7 @@ * 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 + * 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, @@ -13,11 +13,11 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.google.cloud.dialogflow.cx.v3beta1.stub; import static com.google.cloud.dialogflow.cx.v3beta1.PagesClient.ListPagesPagedResponse; -import com.google.api.core.BetaApi; import com.google.api.gax.core.BackgroundResource; import com.google.api.gax.core.BackgroundResourceAggregation; import com.google.api.gax.grpc.GrpcCallSettings; @@ -33,6 +33,7 @@ import com.google.cloud.dialogflow.cx.v3beta1.Page; import com.google.cloud.dialogflow.cx.v3beta1.UpdatePageRequest; import com.google.common.collect.ImmutableMap; +import com.google.longrunning.stub.GrpcOperationsStub; import com.google.protobuf.Empty; import io.grpc.MethodDescriptor; import io.grpc.protobuf.ProtoUtils; @@ -41,16 +42,14 @@ import java.util.concurrent.TimeUnit; import javax.annotation.Generated; -// AUTO-GENERATED DOCUMENTATION AND CLASS +// AUTO-GENERATED DOCUMENTATION AND CLASS. /** - * gRPC stub implementation for Dialogflow API. + * gRPC stub implementation for the Pages service API. * *

This class is for advanced usage and reflects the underlying API directly. */ -@Generated("by gapic-generator") -@BetaApi("A restructuring of stub classes is planned, so this may break in the future") +@Generated("by gapic-generator-java") public class GrpcPagesStub extends PagesStub { - private static final MethodDescriptor listPagesMethodDescriptor = MethodDescriptor.newBuilder() @@ -59,6 +58,7 @@ public class GrpcPagesStub extends PagesStub { .setRequestMarshaller(ProtoUtils.marshaller(ListPagesRequest.getDefaultInstance())) .setResponseMarshaller(ProtoUtils.marshaller(ListPagesResponse.getDefaultInstance())) .build(); + private static final MethodDescriptor getPageMethodDescriptor = MethodDescriptor.newBuilder() .setType(MethodDescriptor.MethodType.UNARY) @@ -66,6 +66,7 @@ public class GrpcPagesStub extends PagesStub { .setRequestMarshaller(ProtoUtils.marshaller(GetPageRequest.getDefaultInstance())) .setResponseMarshaller(ProtoUtils.marshaller(Page.getDefaultInstance())) .build(); + private static final MethodDescriptor createPageMethodDescriptor = MethodDescriptor.newBuilder() .setType(MethodDescriptor.MethodType.UNARY) @@ -73,6 +74,7 @@ public class GrpcPagesStub extends PagesStub { .setRequestMarshaller(ProtoUtils.marshaller(CreatePageRequest.getDefaultInstance())) .setResponseMarshaller(ProtoUtils.marshaller(Page.getDefaultInstance())) .build(); + private static final MethodDescriptor updatePageMethodDescriptor = MethodDescriptor.newBuilder() .setType(MethodDescriptor.MethodType.UNARY) @@ -80,6 +82,7 @@ public class GrpcPagesStub extends PagesStub { .setRequestMarshaller(ProtoUtils.marshaller(UpdatePageRequest.getDefaultInstance())) .setResponseMarshaller(ProtoUtils.marshaller(Page.getDefaultInstance())) .build(); + private static final MethodDescriptor deletePageMethodDescriptor = MethodDescriptor.newBuilder() .setType(MethodDescriptor.MethodType.UNARY) @@ -88,8 +91,6 @@ public class GrpcPagesStub extends PagesStub { .setResponseMarshaller(ProtoUtils.marshaller(Empty.getDefaultInstance())) .build(); - private final BackgroundResource backgroundResources; - private final UnaryCallable listPagesCallable; private final UnaryCallable listPagesPagedCallable; private final UnaryCallable getPageCallable; @@ -97,6 +98,8 @@ public class GrpcPagesStub extends PagesStub { private final UnaryCallable updatePageCallable; private final UnaryCallable deletePageCallable; + private final BackgroundResource backgroundResources; + private final GrpcOperationsStub operationsStub; private final GrpcStubCallableFactory callableFactory; public static final GrpcPagesStub create(PagesStubSettings settings) throws IOException { @@ -132,6 +135,7 @@ protected GrpcPagesStub( GrpcStubCallableFactory callableFactory) throws IOException { this.callableFactory = callableFactory; + this.operationsStub = GrpcOperationsStub.create(clientContext, callableFactory); GrpcCallSettings listPagesTransportSettings = GrpcCallSettings.newBuilder() @@ -218,17 +222,22 @@ public Map extract(DeletePageRequest request) { callableFactory.createUnaryCallable( deletePageTransportSettings, settings.deletePageSettings(), clientContext); - backgroundResources = new BackgroundResourceAggregation(clientContext.getBackgroundResources()); + this.backgroundResources = + new BackgroundResourceAggregation(clientContext.getBackgroundResources()); } - public UnaryCallable listPagesPagedCallable() { - return listPagesPagedCallable; + public GrpcOperationsStub getOperationsStub() { + return operationsStub; } public UnaryCallable listPagesCallable() { return listPagesCallable; } + public UnaryCallable listPagesPagedCallable() { + return listPagesPagedCallable; + } + public UnaryCallable getPageCallable() { return getPageCallable; } diff --git a/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3beta1/stub/GrpcSessionEntityTypesCallableFactory.java b/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3beta1/stub/GrpcSessionEntityTypesCallableFactory.java index 27ec996d6..1e5906d46 100644 --- a/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3beta1/stub/GrpcSessionEntityTypesCallableFactory.java +++ b/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3beta1/stub/GrpcSessionEntityTypesCallableFactory.java @@ -5,7 +5,7 @@ * 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 + * 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, @@ -13,9 +13,9 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.google.cloud.dialogflow.cx.v3beta1.stub; -import com.google.api.core.BetaApi; import com.google.api.gax.grpc.GrpcCallSettings; import com.google.api.gax.grpc.GrpcCallableFactory; import com.google.api.gax.grpc.GrpcStubCallableFactory; @@ -31,18 +31,19 @@ import com.google.api.gax.rpc.StreamingCallSettings; import com.google.api.gax.rpc.UnaryCallSettings; import com.google.api.gax.rpc.UnaryCallable; +import com.google.longrunning.Operation; import com.google.longrunning.stub.OperationsStub; import javax.annotation.Generated; -// AUTO-GENERATED DOCUMENTATION AND CLASS +// AUTO-GENERATED DOCUMENTATION AND CLASS. /** - * gRPC callable factory implementation for Dialogflow API. + * gRPC callable factory implementation for the SessionEntityTypes service API. * *

This class is for advanced usage. */ @Generated("by gapic-generator") -@BetaApi("The surface for use by generated code is not stable yet and may change in the future.") public class GrpcSessionEntityTypesCallableFactory implements GrpcStubCallableFactory { + @Override public UnaryCallable createUnaryCallable( GrpcCallSettings grpcCallSettings, @@ -55,61 +56,58 @@ public UnaryCallable createUnaryCalla public UnaryCallable createPagedCallable( GrpcCallSettings grpcCallSettings, - PagedCallSettings pagedCallSettings, + PagedCallSettings callSettings, ClientContext clientContext) { - return GrpcCallableFactory.createPagedCallable( - grpcCallSettings, pagedCallSettings, clientContext); + return GrpcCallableFactory.createPagedCallable(grpcCallSettings, callSettings, clientContext); } @Override public UnaryCallable createBatchingCallable( GrpcCallSettings grpcCallSettings, - BatchingCallSettings batchingCallSettings, + BatchingCallSettings callSettings, ClientContext clientContext) { return GrpcCallableFactory.createBatchingCallable( - grpcCallSettings, batchingCallSettings, clientContext); + grpcCallSettings, callSettings, clientContext); } - @BetaApi( - "The surface for long-running operations is not stable yet and may change in the future.") @Override public OperationCallable createOperationCallable( - GrpcCallSettings grpcCallSettings, - OperationCallSettings operationCallSettings, + GrpcCallSettings grpcCallSettings, + OperationCallSettings callSettings, ClientContext clientContext, OperationsStub operationsStub) { return GrpcCallableFactory.createOperationCallable( - grpcCallSettings, operationCallSettings, clientContext, operationsStub); + grpcCallSettings, callSettings, clientContext, operationsStub); } @Override public BidiStreamingCallable createBidiStreamingCallable( GrpcCallSettings grpcCallSettings, - StreamingCallSettings streamingCallSettings, + StreamingCallSettings callSettings, ClientContext clientContext) { return GrpcCallableFactory.createBidiStreamingCallable( - grpcCallSettings, streamingCallSettings, clientContext); + grpcCallSettings, callSettings, clientContext); } @Override public ServerStreamingCallable createServerStreamingCallable( GrpcCallSettings grpcCallSettings, - ServerStreamingCallSettings streamingCallSettings, + ServerStreamingCallSettings callSettings, ClientContext clientContext) { return GrpcCallableFactory.createServerStreamingCallable( - grpcCallSettings, streamingCallSettings, clientContext); + grpcCallSettings, callSettings, clientContext); } @Override public ClientStreamingCallable createClientStreamingCallable( GrpcCallSettings grpcCallSettings, - StreamingCallSettings streamingCallSettings, + StreamingCallSettings callSettings, ClientContext clientContext) { return GrpcCallableFactory.createClientStreamingCallable( - grpcCallSettings, streamingCallSettings, clientContext); + grpcCallSettings, callSettings, clientContext); } } diff --git a/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3beta1/stub/GrpcSessionEntityTypesStub.java b/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3beta1/stub/GrpcSessionEntityTypesStub.java index 5476c267c..858cfcc04 100644 --- a/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3beta1/stub/GrpcSessionEntityTypesStub.java +++ b/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3beta1/stub/GrpcSessionEntityTypesStub.java @@ -5,7 +5,7 @@ * 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 + * 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, @@ -13,11 +13,11 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.google.cloud.dialogflow.cx.v3beta1.stub; import static com.google.cloud.dialogflow.cx.v3beta1.SessionEntityTypesClient.ListSessionEntityTypesPagedResponse; -import com.google.api.core.BetaApi; import com.google.api.gax.core.BackgroundResource; import com.google.api.gax.core.BackgroundResourceAggregation; import com.google.api.gax.grpc.GrpcCallSettings; @@ -33,6 +33,7 @@ import com.google.cloud.dialogflow.cx.v3beta1.SessionEntityType; import com.google.cloud.dialogflow.cx.v3beta1.UpdateSessionEntityTypeRequest; import com.google.common.collect.ImmutableMap; +import com.google.longrunning.stub.GrpcOperationsStub; import com.google.protobuf.Empty; import io.grpc.MethodDescriptor; import io.grpc.protobuf.ProtoUtils; @@ -41,16 +42,14 @@ import java.util.concurrent.TimeUnit; import javax.annotation.Generated; -// AUTO-GENERATED DOCUMENTATION AND CLASS +// AUTO-GENERATED DOCUMENTATION AND CLASS. /** - * gRPC stub implementation for Dialogflow API. + * gRPC stub implementation for the SessionEntityTypes service API. * *

This class is for advanced usage and reflects the underlying API directly. */ -@Generated("by gapic-generator") -@BetaApi("A restructuring of stub classes is planned, so this may break in the future") +@Generated("by gapic-generator-java") public class GrpcSessionEntityTypesStub extends SessionEntityTypesStub { - private static final MethodDescriptor< ListSessionEntityTypesRequest, ListSessionEntityTypesResponse> listSessionEntityTypesMethodDescriptor = @@ -64,6 +63,7 @@ public class GrpcSessionEntityTypesStub extends SessionEntityTypesStub { .setResponseMarshaller( ProtoUtils.marshaller(ListSessionEntityTypesResponse.getDefaultInstance())) .build(); + private static final MethodDescriptor getSessionEntityTypeMethodDescriptor = MethodDescriptor.newBuilder() @@ -74,6 +74,7 @@ public class GrpcSessionEntityTypesStub extends SessionEntityTypesStub { ProtoUtils.marshaller(GetSessionEntityTypeRequest.getDefaultInstance())) .setResponseMarshaller(ProtoUtils.marshaller(SessionEntityType.getDefaultInstance())) .build(); + private static final MethodDescriptor createSessionEntityTypeMethodDescriptor = MethodDescriptor.newBuilder() @@ -84,6 +85,7 @@ public class GrpcSessionEntityTypesStub extends SessionEntityTypesStub { ProtoUtils.marshaller(CreateSessionEntityTypeRequest.getDefaultInstance())) .setResponseMarshaller(ProtoUtils.marshaller(SessionEntityType.getDefaultInstance())) .build(); + private static final MethodDescriptor updateSessionEntityTypeMethodDescriptor = MethodDescriptor.newBuilder() @@ -94,6 +96,7 @@ public class GrpcSessionEntityTypesStub extends SessionEntityTypesStub { ProtoUtils.marshaller(UpdateSessionEntityTypeRequest.getDefaultInstance())) .setResponseMarshaller(ProtoUtils.marshaller(SessionEntityType.getDefaultInstance())) .build(); + private static final MethodDescriptor deleteSessionEntityTypeMethodDescriptor = MethodDescriptor.newBuilder() @@ -105,8 +108,6 @@ public class GrpcSessionEntityTypesStub extends SessionEntityTypesStub { .setResponseMarshaller(ProtoUtils.marshaller(Empty.getDefaultInstance())) .build(); - private final BackgroundResource backgroundResources; - private final UnaryCallable listSessionEntityTypesCallable; private final UnaryCallable @@ -120,6 +121,8 @@ public class GrpcSessionEntityTypesStub extends SessionEntityTypesStub { private final UnaryCallable deleteSessionEntityTypeCallable; + private final BackgroundResource backgroundResources; + private final GrpcOperationsStub operationsStub; private final GrpcStubCallableFactory callableFactory; public static final GrpcSessionEntityTypesStub create(SessionEntityTypesStubSettings settings) @@ -160,6 +163,7 @@ protected GrpcSessionEntityTypesStub( GrpcStubCallableFactory callableFactory) throws IOException { this.callableFactory = callableFactory; + this.operationsStub = GrpcOperationsStub.create(clientContext, callableFactory); GrpcCallSettings listSessionEntityTypesTransportSettings = @@ -266,12 +270,12 @@ public Map extract(DeleteSessionEntityTypeRequest request) { settings.deleteSessionEntityTypeSettings(), clientContext); - backgroundResources = new BackgroundResourceAggregation(clientContext.getBackgroundResources()); + this.backgroundResources = + new BackgroundResourceAggregation(clientContext.getBackgroundResources()); } - public UnaryCallable - listSessionEntityTypesPagedCallable() { - return listSessionEntityTypesPagedCallable; + public GrpcOperationsStub getOperationsStub() { + return operationsStub; } public UnaryCallable @@ -279,6 +283,11 @@ public Map extract(DeleteSessionEntityTypeRequest request) { return listSessionEntityTypesCallable; } + public UnaryCallable + listSessionEntityTypesPagedCallable() { + return listSessionEntityTypesPagedCallable; + } + public UnaryCallable getSessionEntityTypeCallable() { return getSessionEntityTypeCallable; diff --git a/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3beta1/stub/GrpcSessionsCallableFactory.java b/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3beta1/stub/GrpcSessionsCallableFactory.java index 47122b3da..66381e99a 100644 --- a/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3beta1/stub/GrpcSessionsCallableFactory.java +++ b/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3beta1/stub/GrpcSessionsCallableFactory.java @@ -5,7 +5,7 @@ * 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 + * 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, @@ -13,9 +13,9 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.google.cloud.dialogflow.cx.v3beta1.stub; -import com.google.api.core.BetaApi; import com.google.api.gax.grpc.GrpcCallSettings; import com.google.api.gax.grpc.GrpcCallableFactory; import com.google.api.gax.grpc.GrpcStubCallableFactory; @@ -31,18 +31,19 @@ import com.google.api.gax.rpc.StreamingCallSettings; import com.google.api.gax.rpc.UnaryCallSettings; import com.google.api.gax.rpc.UnaryCallable; +import com.google.longrunning.Operation; import com.google.longrunning.stub.OperationsStub; import javax.annotation.Generated; -// AUTO-GENERATED DOCUMENTATION AND CLASS +// AUTO-GENERATED DOCUMENTATION AND CLASS. /** - * gRPC callable factory implementation for Dialogflow API. + * gRPC callable factory implementation for the Sessions service API. * *

This class is for advanced usage. */ @Generated("by gapic-generator") -@BetaApi("The surface for use by generated code is not stable yet and may change in the future.") public class GrpcSessionsCallableFactory implements GrpcStubCallableFactory { + @Override public UnaryCallable createUnaryCallable( GrpcCallSettings grpcCallSettings, @@ -55,61 +56,58 @@ public UnaryCallable createUnaryCalla public UnaryCallable createPagedCallable( GrpcCallSettings grpcCallSettings, - PagedCallSettings pagedCallSettings, + PagedCallSettings callSettings, ClientContext clientContext) { - return GrpcCallableFactory.createPagedCallable( - grpcCallSettings, pagedCallSettings, clientContext); + return GrpcCallableFactory.createPagedCallable(grpcCallSettings, callSettings, clientContext); } @Override public UnaryCallable createBatchingCallable( GrpcCallSettings grpcCallSettings, - BatchingCallSettings batchingCallSettings, + BatchingCallSettings callSettings, ClientContext clientContext) { return GrpcCallableFactory.createBatchingCallable( - grpcCallSettings, batchingCallSettings, clientContext); + grpcCallSettings, callSettings, clientContext); } - @BetaApi( - "The surface for long-running operations is not stable yet and may change in the future.") @Override public OperationCallable createOperationCallable( - GrpcCallSettings grpcCallSettings, - OperationCallSettings operationCallSettings, + GrpcCallSettings grpcCallSettings, + OperationCallSettings callSettings, ClientContext clientContext, OperationsStub operationsStub) { return GrpcCallableFactory.createOperationCallable( - grpcCallSettings, operationCallSettings, clientContext, operationsStub); + grpcCallSettings, callSettings, clientContext, operationsStub); } @Override public BidiStreamingCallable createBidiStreamingCallable( GrpcCallSettings grpcCallSettings, - StreamingCallSettings streamingCallSettings, + StreamingCallSettings callSettings, ClientContext clientContext) { return GrpcCallableFactory.createBidiStreamingCallable( - grpcCallSettings, streamingCallSettings, clientContext); + grpcCallSettings, callSettings, clientContext); } @Override public ServerStreamingCallable createServerStreamingCallable( GrpcCallSettings grpcCallSettings, - ServerStreamingCallSettings streamingCallSettings, + ServerStreamingCallSettings callSettings, ClientContext clientContext) { return GrpcCallableFactory.createServerStreamingCallable( - grpcCallSettings, streamingCallSettings, clientContext); + grpcCallSettings, callSettings, clientContext); } @Override public ClientStreamingCallable createClientStreamingCallable( GrpcCallSettings grpcCallSettings, - StreamingCallSettings streamingCallSettings, + StreamingCallSettings callSettings, ClientContext clientContext) { return GrpcCallableFactory.createClientStreamingCallable( - grpcCallSettings, streamingCallSettings, clientContext); + grpcCallSettings, callSettings, clientContext); } } diff --git a/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3beta1/stub/GrpcSessionsStub.java b/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3beta1/stub/GrpcSessionsStub.java index 79c41c521..211e04241 100644 --- a/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3beta1/stub/GrpcSessionsStub.java +++ b/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3beta1/stub/GrpcSessionsStub.java @@ -5,7 +5,7 @@ * 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 + * 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, @@ -13,9 +13,9 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.google.cloud.dialogflow.cx.v3beta1.stub; -import com.google.api.core.BetaApi; import com.google.api.gax.core.BackgroundResource; import com.google.api.gax.core.BackgroundResourceAggregation; import com.google.api.gax.grpc.GrpcCallSettings; @@ -33,6 +33,7 @@ import com.google.cloud.dialogflow.cx.v3beta1.StreamingDetectIntentRequest; import com.google.cloud.dialogflow.cx.v3beta1.StreamingDetectIntentResponse; import com.google.common.collect.ImmutableMap; +import com.google.longrunning.stub.GrpcOperationsStub; import io.grpc.MethodDescriptor; import io.grpc.protobuf.ProtoUtils; import java.io.IOException; @@ -40,16 +41,14 @@ import java.util.concurrent.TimeUnit; import javax.annotation.Generated; -// AUTO-GENERATED DOCUMENTATION AND CLASS +// AUTO-GENERATED DOCUMENTATION AND CLASS. /** - * gRPC stub implementation for Dialogflow API. + * gRPC stub implementation for the Sessions service API. * *

This class is for advanced usage and reflects the underlying API directly. */ -@Generated("by gapic-generator") -@BetaApi("A restructuring of stub classes is planned, so this may break in the future") +@Generated("by gapic-generator-java") public class GrpcSessionsStub extends SessionsStub { - private static final MethodDescriptor detectIntentMethodDescriptor = MethodDescriptor.newBuilder() @@ -59,6 +58,7 @@ public class GrpcSessionsStub extends SessionsStub { .setResponseMarshaller( ProtoUtils.marshaller(DetectIntentResponse.getDefaultInstance())) .build(); + private static final MethodDescriptor streamingDetectIntentMethodDescriptor = MethodDescriptor.newBuilder() @@ -70,6 +70,7 @@ public class GrpcSessionsStub extends SessionsStub { .setResponseMarshaller( ProtoUtils.marshaller(StreamingDetectIntentResponse.getDefaultInstance())) .build(); + private static final MethodDescriptor matchIntentMethodDescriptor = MethodDescriptor.newBuilder() @@ -79,6 +80,7 @@ public class GrpcSessionsStub extends SessionsStub { .setResponseMarshaller( ProtoUtils.marshaller(MatchIntentResponse.getDefaultInstance())) .build(); + private static final MethodDescriptor fulfillIntentMethodDescriptor = MethodDescriptor.newBuilder() @@ -90,14 +92,14 @@ public class GrpcSessionsStub extends SessionsStub { ProtoUtils.marshaller(FulfillIntentResponse.getDefaultInstance())) .build(); - private final BackgroundResource backgroundResources; - private final UnaryCallable detectIntentCallable; private final BidiStreamingCallable streamingDetectIntentCallable; private final UnaryCallable matchIntentCallable; private final UnaryCallable fulfillIntentCallable; + private final BackgroundResource backgroundResources; + private final GrpcOperationsStub operationsStub; private final GrpcStubCallableFactory callableFactory; public static final GrpcSessionsStub create(SessionsStubSettings settings) throws IOException { @@ -133,6 +135,7 @@ protected GrpcSessionsStub( GrpcStubCallableFactory callableFactory) throws IOException { this.callableFactory = callableFactory; + this.operationsStub = GrpcOperationsStub.create(clientContext, callableFactory); GrpcCallSettings detectIntentTransportSettings = GrpcCallSettings.newBuilder() @@ -197,7 +200,12 @@ public Map extract(FulfillIntentRequest request) { callableFactory.createUnaryCallable( fulfillIntentTransportSettings, settings.fulfillIntentSettings(), clientContext); - backgroundResources = new BackgroundResourceAggregation(clientContext.getBackgroundResources()); + this.backgroundResources = + new BackgroundResourceAggregation(clientContext.getBackgroundResources()); + } + + public GrpcOperationsStub getOperationsStub() { + return operationsStub; } public UnaryCallable detectIntentCallable() { diff --git a/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3beta1/stub/GrpcTransitionRouteGroupsCallableFactory.java b/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3beta1/stub/GrpcTransitionRouteGroupsCallableFactory.java index c2368b6e1..5954fb5a2 100644 --- a/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3beta1/stub/GrpcTransitionRouteGroupsCallableFactory.java +++ b/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3beta1/stub/GrpcTransitionRouteGroupsCallableFactory.java @@ -5,7 +5,7 @@ * 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 + * 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, @@ -13,9 +13,9 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.google.cloud.dialogflow.cx.v3beta1.stub; -import com.google.api.core.BetaApi; import com.google.api.gax.grpc.GrpcCallSettings; import com.google.api.gax.grpc.GrpcCallableFactory; import com.google.api.gax.grpc.GrpcStubCallableFactory; @@ -31,18 +31,19 @@ import com.google.api.gax.rpc.StreamingCallSettings; import com.google.api.gax.rpc.UnaryCallSettings; import com.google.api.gax.rpc.UnaryCallable; +import com.google.longrunning.Operation; import com.google.longrunning.stub.OperationsStub; import javax.annotation.Generated; -// AUTO-GENERATED DOCUMENTATION AND CLASS +// AUTO-GENERATED DOCUMENTATION AND CLASS. /** - * gRPC callable factory implementation for Dialogflow API. + * gRPC callable factory implementation for the TransitionRouteGroups service API. * *

This class is for advanced usage. */ @Generated("by gapic-generator") -@BetaApi("The surface for use by generated code is not stable yet and may change in the future.") public class GrpcTransitionRouteGroupsCallableFactory implements GrpcStubCallableFactory { + @Override public UnaryCallable createUnaryCallable( GrpcCallSettings grpcCallSettings, @@ -55,61 +56,58 @@ public UnaryCallable createUnaryCalla public UnaryCallable createPagedCallable( GrpcCallSettings grpcCallSettings, - PagedCallSettings pagedCallSettings, + PagedCallSettings callSettings, ClientContext clientContext) { - return GrpcCallableFactory.createPagedCallable( - grpcCallSettings, pagedCallSettings, clientContext); + return GrpcCallableFactory.createPagedCallable(grpcCallSettings, callSettings, clientContext); } @Override public UnaryCallable createBatchingCallable( GrpcCallSettings grpcCallSettings, - BatchingCallSettings batchingCallSettings, + BatchingCallSettings callSettings, ClientContext clientContext) { return GrpcCallableFactory.createBatchingCallable( - grpcCallSettings, batchingCallSettings, clientContext); + grpcCallSettings, callSettings, clientContext); } - @BetaApi( - "The surface for long-running operations is not stable yet and may change in the future.") @Override public OperationCallable createOperationCallable( - GrpcCallSettings grpcCallSettings, - OperationCallSettings operationCallSettings, + GrpcCallSettings grpcCallSettings, + OperationCallSettings callSettings, ClientContext clientContext, OperationsStub operationsStub) { return GrpcCallableFactory.createOperationCallable( - grpcCallSettings, operationCallSettings, clientContext, operationsStub); + grpcCallSettings, callSettings, clientContext, operationsStub); } @Override public BidiStreamingCallable createBidiStreamingCallable( GrpcCallSettings grpcCallSettings, - StreamingCallSettings streamingCallSettings, + StreamingCallSettings callSettings, ClientContext clientContext) { return GrpcCallableFactory.createBidiStreamingCallable( - grpcCallSettings, streamingCallSettings, clientContext); + grpcCallSettings, callSettings, clientContext); } @Override public ServerStreamingCallable createServerStreamingCallable( GrpcCallSettings grpcCallSettings, - ServerStreamingCallSettings streamingCallSettings, + ServerStreamingCallSettings callSettings, ClientContext clientContext) { return GrpcCallableFactory.createServerStreamingCallable( - grpcCallSettings, streamingCallSettings, clientContext); + grpcCallSettings, callSettings, clientContext); } @Override public ClientStreamingCallable createClientStreamingCallable( GrpcCallSettings grpcCallSettings, - StreamingCallSettings streamingCallSettings, + StreamingCallSettings callSettings, ClientContext clientContext) { return GrpcCallableFactory.createClientStreamingCallable( - grpcCallSettings, streamingCallSettings, clientContext); + grpcCallSettings, callSettings, clientContext); } } diff --git a/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3beta1/stub/GrpcTransitionRouteGroupsStub.java b/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3beta1/stub/GrpcTransitionRouteGroupsStub.java index 25cf8b708..983c4dcfa 100644 --- a/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3beta1/stub/GrpcTransitionRouteGroupsStub.java +++ b/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3beta1/stub/GrpcTransitionRouteGroupsStub.java @@ -5,7 +5,7 @@ * 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 + * 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, @@ -13,11 +13,11 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.google.cloud.dialogflow.cx.v3beta1.stub; import static com.google.cloud.dialogflow.cx.v3beta1.TransitionRouteGroupsClient.ListTransitionRouteGroupsPagedResponse; -import com.google.api.core.BetaApi; import com.google.api.gax.core.BackgroundResource; import com.google.api.gax.core.BackgroundResourceAggregation; import com.google.api.gax.grpc.GrpcCallSettings; @@ -33,6 +33,7 @@ import com.google.cloud.dialogflow.cx.v3beta1.TransitionRouteGroup; import com.google.cloud.dialogflow.cx.v3beta1.UpdateTransitionRouteGroupRequest; import com.google.common.collect.ImmutableMap; +import com.google.longrunning.stub.GrpcOperationsStub; import com.google.protobuf.Empty; import io.grpc.MethodDescriptor; import io.grpc.protobuf.ProtoUtils; @@ -41,16 +42,14 @@ import java.util.concurrent.TimeUnit; import javax.annotation.Generated; -// AUTO-GENERATED DOCUMENTATION AND CLASS +// AUTO-GENERATED DOCUMENTATION AND CLASS. /** - * gRPC stub implementation for Dialogflow API. + * gRPC stub implementation for the TransitionRouteGroups service API. * *

This class is for advanced usage and reflects the underlying API directly. */ -@Generated("by gapic-generator") -@BetaApi("A restructuring of stub classes is planned, so this may break in the future") +@Generated("by gapic-generator-java") public class GrpcTransitionRouteGroupsStub extends TransitionRouteGroupsStub { - private static final MethodDescriptor< ListTransitionRouteGroupsRequest, ListTransitionRouteGroupsResponse> listTransitionRouteGroupsMethodDescriptor = @@ -64,6 +63,7 @@ public class GrpcTransitionRouteGroupsStub extends TransitionRouteGroupsStub { .setResponseMarshaller( ProtoUtils.marshaller(ListTransitionRouteGroupsResponse.getDefaultInstance())) .build(); + private static final MethodDescriptor getTransitionRouteGroupMethodDescriptor = MethodDescriptor.newBuilder() @@ -75,6 +75,7 @@ public class GrpcTransitionRouteGroupsStub extends TransitionRouteGroupsStub { .setResponseMarshaller( ProtoUtils.marshaller(TransitionRouteGroup.getDefaultInstance())) .build(); + private static final MethodDescriptor createTransitionRouteGroupMethodDescriptor = MethodDescriptor.newBuilder() @@ -86,6 +87,7 @@ public class GrpcTransitionRouteGroupsStub extends TransitionRouteGroupsStub { .setResponseMarshaller( ProtoUtils.marshaller(TransitionRouteGroup.getDefaultInstance())) .build(); + private static final MethodDescriptor updateTransitionRouteGroupMethodDescriptor = MethodDescriptor.newBuilder() @@ -97,6 +99,7 @@ public class GrpcTransitionRouteGroupsStub extends TransitionRouteGroupsStub { .setResponseMarshaller( ProtoUtils.marshaller(TransitionRouteGroup.getDefaultInstance())) .build(); + private static final MethodDescriptor deleteTransitionRouteGroupMethodDescriptor = MethodDescriptor.newBuilder() @@ -108,8 +111,6 @@ public class GrpcTransitionRouteGroupsStub extends TransitionRouteGroupsStub { .setResponseMarshaller(ProtoUtils.marshaller(Empty.getDefaultInstance())) .build(); - private final BackgroundResource backgroundResources; - private final UnaryCallable listTransitionRouteGroupsCallable; private final UnaryCallable< @@ -124,6 +125,8 @@ public class GrpcTransitionRouteGroupsStub extends TransitionRouteGroupsStub { private final UnaryCallable deleteTransitionRouteGroupCallable; + private final BackgroundResource backgroundResources; + private final GrpcOperationsStub operationsStub; private final GrpcStubCallableFactory callableFactory; public static final GrpcTransitionRouteGroupsStub create( @@ -164,6 +167,7 @@ protected GrpcTransitionRouteGroupsStub( GrpcStubCallableFactory callableFactory) throws IOException { this.callableFactory = callableFactory; + this.operationsStub = GrpcOperationsStub.create(clientContext, callableFactory); GrpcCallSettings listTransitionRouteGroupsTransportSettings = @@ -273,12 +277,12 @@ public Map extract( settings.deleteTransitionRouteGroupSettings(), clientContext); - backgroundResources = new BackgroundResourceAggregation(clientContext.getBackgroundResources()); + this.backgroundResources = + new BackgroundResourceAggregation(clientContext.getBackgroundResources()); } - public UnaryCallable - listTransitionRouteGroupsPagedCallable() { - return listTransitionRouteGroupsPagedCallable; + public GrpcOperationsStub getOperationsStub() { + return operationsStub; } public UnaryCallable @@ -286,6 +290,11 @@ public Map extract( return listTransitionRouteGroupsCallable; } + public UnaryCallable + listTransitionRouteGroupsPagedCallable() { + return listTransitionRouteGroupsPagedCallable; + } + public UnaryCallable getTransitionRouteGroupCallable() { return getTransitionRouteGroupCallable; diff --git a/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3beta1/stub/GrpcVersionsCallableFactory.java b/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3beta1/stub/GrpcVersionsCallableFactory.java index a91c079f5..0417c5478 100644 --- a/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3beta1/stub/GrpcVersionsCallableFactory.java +++ b/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3beta1/stub/GrpcVersionsCallableFactory.java @@ -5,7 +5,7 @@ * 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 + * 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, @@ -13,9 +13,9 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.google.cloud.dialogflow.cx.v3beta1.stub; -import com.google.api.core.BetaApi; import com.google.api.gax.grpc.GrpcCallSettings; import com.google.api.gax.grpc.GrpcCallableFactory; import com.google.api.gax.grpc.GrpcStubCallableFactory; @@ -31,18 +31,19 @@ import com.google.api.gax.rpc.StreamingCallSettings; import com.google.api.gax.rpc.UnaryCallSettings; import com.google.api.gax.rpc.UnaryCallable; +import com.google.longrunning.Operation; import com.google.longrunning.stub.OperationsStub; import javax.annotation.Generated; -// AUTO-GENERATED DOCUMENTATION AND CLASS +// AUTO-GENERATED DOCUMENTATION AND CLASS. /** - * gRPC callable factory implementation for Dialogflow API. + * gRPC callable factory implementation for the Versions service API. * *

This class is for advanced usage. */ @Generated("by gapic-generator") -@BetaApi("The surface for use by generated code is not stable yet and may change in the future.") public class GrpcVersionsCallableFactory implements GrpcStubCallableFactory { + @Override public UnaryCallable createUnaryCallable( GrpcCallSettings grpcCallSettings, @@ -55,61 +56,58 @@ public UnaryCallable createUnaryCalla public UnaryCallable createPagedCallable( GrpcCallSettings grpcCallSettings, - PagedCallSettings pagedCallSettings, + PagedCallSettings callSettings, ClientContext clientContext) { - return GrpcCallableFactory.createPagedCallable( - grpcCallSettings, pagedCallSettings, clientContext); + return GrpcCallableFactory.createPagedCallable(grpcCallSettings, callSettings, clientContext); } @Override public UnaryCallable createBatchingCallable( GrpcCallSettings grpcCallSettings, - BatchingCallSettings batchingCallSettings, + BatchingCallSettings callSettings, ClientContext clientContext) { return GrpcCallableFactory.createBatchingCallable( - grpcCallSettings, batchingCallSettings, clientContext); + grpcCallSettings, callSettings, clientContext); } - @BetaApi( - "The surface for long-running operations is not stable yet and may change in the future.") @Override public OperationCallable createOperationCallable( - GrpcCallSettings grpcCallSettings, - OperationCallSettings operationCallSettings, + GrpcCallSettings grpcCallSettings, + OperationCallSettings callSettings, ClientContext clientContext, OperationsStub operationsStub) { return GrpcCallableFactory.createOperationCallable( - grpcCallSettings, operationCallSettings, clientContext, operationsStub); + grpcCallSettings, callSettings, clientContext, operationsStub); } @Override public BidiStreamingCallable createBidiStreamingCallable( GrpcCallSettings grpcCallSettings, - StreamingCallSettings streamingCallSettings, + StreamingCallSettings callSettings, ClientContext clientContext) { return GrpcCallableFactory.createBidiStreamingCallable( - grpcCallSettings, streamingCallSettings, clientContext); + grpcCallSettings, callSettings, clientContext); } @Override public ServerStreamingCallable createServerStreamingCallable( GrpcCallSettings grpcCallSettings, - ServerStreamingCallSettings streamingCallSettings, + ServerStreamingCallSettings callSettings, ClientContext clientContext) { return GrpcCallableFactory.createServerStreamingCallable( - grpcCallSettings, streamingCallSettings, clientContext); + grpcCallSettings, callSettings, clientContext); } @Override public ClientStreamingCallable createClientStreamingCallable( GrpcCallSettings grpcCallSettings, - StreamingCallSettings streamingCallSettings, + StreamingCallSettings callSettings, ClientContext clientContext) { return GrpcCallableFactory.createClientStreamingCallable( - grpcCallSettings, streamingCallSettings, clientContext); + grpcCallSettings, callSettings, clientContext); } } diff --git a/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3beta1/stub/GrpcVersionsStub.java b/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3beta1/stub/GrpcVersionsStub.java index c3d8e22f0..3422b9a34 100644 --- a/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3beta1/stub/GrpcVersionsStub.java +++ b/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3beta1/stub/GrpcVersionsStub.java @@ -5,7 +5,7 @@ * 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 + * 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, @@ -13,11 +13,11 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.google.cloud.dialogflow.cx.v3beta1.stub; import static com.google.cloud.dialogflow.cx.v3beta1.VersionsClient.ListVersionsPagedResponse; -import com.google.api.core.BetaApi; import com.google.api.gax.core.BackgroundResource; import com.google.api.gax.core.BackgroundResourceAggregation; import com.google.api.gax.grpc.GrpcCallSettings; @@ -47,16 +47,14 @@ import java.util.concurrent.TimeUnit; import javax.annotation.Generated; -// AUTO-GENERATED DOCUMENTATION AND CLASS +// AUTO-GENERATED DOCUMENTATION AND CLASS. /** - * gRPC stub implementation for Dialogflow API. + * gRPC stub implementation for the Versions service API. * *

This class is for advanced usage and reflects the underlying API directly. */ -@Generated("by gapic-generator") -@BetaApi("A restructuring of stub classes is planned, so this may break in the future") +@Generated("by gapic-generator-java") public class GrpcVersionsStub extends VersionsStub { - private static final MethodDescriptor listVersionsMethodDescriptor = MethodDescriptor.newBuilder() @@ -66,6 +64,7 @@ public class GrpcVersionsStub extends VersionsStub { .setResponseMarshaller( ProtoUtils.marshaller(ListVersionsResponse.getDefaultInstance())) .build(); + private static final MethodDescriptor getVersionMethodDescriptor = MethodDescriptor.newBuilder() .setType(MethodDescriptor.MethodType.UNARY) @@ -73,6 +72,7 @@ public class GrpcVersionsStub extends VersionsStub { .setRequestMarshaller(ProtoUtils.marshaller(GetVersionRequest.getDefaultInstance())) .setResponseMarshaller(ProtoUtils.marshaller(Version.getDefaultInstance())) .build(); + private static final MethodDescriptor createVersionMethodDescriptor = MethodDescriptor.newBuilder() @@ -82,6 +82,7 @@ public class GrpcVersionsStub extends VersionsStub { ProtoUtils.marshaller(CreateVersionRequest.getDefaultInstance())) .setResponseMarshaller(ProtoUtils.marshaller(Operation.getDefaultInstance())) .build(); + private static final MethodDescriptor updateVersionMethodDescriptor = MethodDescriptor.newBuilder() @@ -91,6 +92,7 @@ public class GrpcVersionsStub extends VersionsStub { ProtoUtils.marshaller(UpdateVersionRequest.getDefaultInstance())) .setResponseMarshaller(ProtoUtils.marshaller(Version.getDefaultInstance())) .build(); + private static final MethodDescriptor deleteVersionMethodDescriptor = MethodDescriptor.newBuilder() .setType(MethodDescriptor.MethodType.UNARY) @@ -98,6 +100,7 @@ public class GrpcVersionsStub extends VersionsStub { .setRequestMarshaller(ProtoUtils.marshaller(DeleteVersionRequest.getDefaultInstance())) .setResponseMarshaller(ProtoUtils.marshaller(Empty.getDefaultInstance())) .build(); + private static final MethodDescriptor loadVersionMethodDescriptor = MethodDescriptor.newBuilder() .setType(MethodDescriptor.MethodType.UNARY) @@ -106,9 +109,6 @@ public class GrpcVersionsStub extends VersionsStub { .setResponseMarshaller(ProtoUtils.marshaller(Operation.getDefaultInstance())) .build(); - private final BackgroundResource backgroundResources; - private final GrpcOperationsStub operationsStub; - private final UnaryCallable listVersionsCallable; private final UnaryCallable listVersionsPagedCallable; @@ -121,6 +121,8 @@ public class GrpcVersionsStub extends VersionsStub { private final UnaryCallable loadVersionCallable; private final OperationCallable loadVersionOperationCallable; + private final BackgroundResource backgroundResources; + private final GrpcOperationsStub operationsStub; private final GrpcStubCallableFactory callableFactory; public static final GrpcVersionsStub create(VersionsStubSettings settings) throws IOException { @@ -254,7 +256,7 @@ public Map extract(LoadVersionRequest request) { createVersionTransportSettings, settings.createVersionOperationSettings(), clientContext, - this.operationsStub); + operationsStub); this.updateVersionCallable = callableFactory.createUnaryCallable( updateVersionTransportSettings, settings.updateVersionSettings(), clientContext); @@ -269,38 +271,37 @@ public Map extract(LoadVersionRequest request) { loadVersionTransportSettings, settings.loadVersionOperationSettings(), clientContext, - this.operationsStub); + operationsStub); - backgroundResources = new BackgroundResourceAggregation(clientContext.getBackgroundResources()); + this.backgroundResources = + new BackgroundResourceAggregation(clientContext.getBackgroundResources()); } - @BetaApi("The surface for use by generated code is not stable yet and may change in the future.") public GrpcOperationsStub getOperationsStub() { return operationsStub; } - public UnaryCallable listVersionsPagedCallable() { - return listVersionsPagedCallable; - } - public UnaryCallable listVersionsCallable() { return listVersionsCallable; } + public UnaryCallable listVersionsPagedCallable() { + return listVersionsPagedCallable; + } + public UnaryCallable getVersionCallable() { return getVersionCallable; } - @BetaApi("The surface for use by generated code is not stable yet and may change in the future.") + public UnaryCallable createVersionCallable() { + return createVersionCallable; + } + public OperationCallable createVersionOperationCallable() { return createVersionOperationCallable; } - public UnaryCallable createVersionCallable() { - return createVersionCallable; - } - public UnaryCallable updateVersionCallable() { return updateVersionCallable; } @@ -309,15 +310,14 @@ public UnaryCallable deleteVersionCallable() { return deleteVersionCallable; } - @BetaApi("The surface for use by generated code is not stable yet and may change in the future.") - public OperationCallable loadVersionOperationCallable() { - return loadVersionOperationCallable; - } - public UnaryCallable loadVersionCallable() { return loadVersionCallable; } + public OperationCallable loadVersionOperationCallable() { + return loadVersionOperationCallable; + } + @Override public final void close() { shutdown(); diff --git a/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3beta1/stub/GrpcWebhooksCallableFactory.java b/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3beta1/stub/GrpcWebhooksCallableFactory.java index cc82f36f9..583717c7b 100644 --- a/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3beta1/stub/GrpcWebhooksCallableFactory.java +++ b/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3beta1/stub/GrpcWebhooksCallableFactory.java @@ -5,7 +5,7 @@ * 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 + * 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, @@ -13,9 +13,9 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.google.cloud.dialogflow.cx.v3beta1.stub; -import com.google.api.core.BetaApi; import com.google.api.gax.grpc.GrpcCallSettings; import com.google.api.gax.grpc.GrpcCallableFactory; import com.google.api.gax.grpc.GrpcStubCallableFactory; @@ -31,18 +31,19 @@ import com.google.api.gax.rpc.StreamingCallSettings; import com.google.api.gax.rpc.UnaryCallSettings; import com.google.api.gax.rpc.UnaryCallable; +import com.google.longrunning.Operation; import com.google.longrunning.stub.OperationsStub; import javax.annotation.Generated; -// AUTO-GENERATED DOCUMENTATION AND CLASS +// AUTO-GENERATED DOCUMENTATION AND CLASS. /** - * gRPC callable factory implementation for Dialogflow API. + * gRPC callable factory implementation for the Webhooks service API. * *

This class is for advanced usage. */ @Generated("by gapic-generator") -@BetaApi("The surface for use by generated code is not stable yet and may change in the future.") public class GrpcWebhooksCallableFactory implements GrpcStubCallableFactory { + @Override public UnaryCallable createUnaryCallable( GrpcCallSettings grpcCallSettings, @@ -55,61 +56,58 @@ public UnaryCallable createUnaryCalla public UnaryCallable createPagedCallable( GrpcCallSettings grpcCallSettings, - PagedCallSettings pagedCallSettings, + PagedCallSettings callSettings, ClientContext clientContext) { - return GrpcCallableFactory.createPagedCallable( - grpcCallSettings, pagedCallSettings, clientContext); + return GrpcCallableFactory.createPagedCallable(grpcCallSettings, callSettings, clientContext); } @Override public UnaryCallable createBatchingCallable( GrpcCallSettings grpcCallSettings, - BatchingCallSettings batchingCallSettings, + BatchingCallSettings callSettings, ClientContext clientContext) { return GrpcCallableFactory.createBatchingCallable( - grpcCallSettings, batchingCallSettings, clientContext); + grpcCallSettings, callSettings, clientContext); } - @BetaApi( - "The surface for long-running operations is not stable yet and may change in the future.") @Override public OperationCallable createOperationCallable( - GrpcCallSettings grpcCallSettings, - OperationCallSettings operationCallSettings, + GrpcCallSettings grpcCallSettings, + OperationCallSettings callSettings, ClientContext clientContext, OperationsStub operationsStub) { return GrpcCallableFactory.createOperationCallable( - grpcCallSettings, operationCallSettings, clientContext, operationsStub); + grpcCallSettings, callSettings, clientContext, operationsStub); } @Override public BidiStreamingCallable createBidiStreamingCallable( GrpcCallSettings grpcCallSettings, - StreamingCallSettings streamingCallSettings, + StreamingCallSettings callSettings, ClientContext clientContext) { return GrpcCallableFactory.createBidiStreamingCallable( - grpcCallSettings, streamingCallSettings, clientContext); + grpcCallSettings, callSettings, clientContext); } @Override public ServerStreamingCallable createServerStreamingCallable( GrpcCallSettings grpcCallSettings, - ServerStreamingCallSettings streamingCallSettings, + ServerStreamingCallSettings callSettings, ClientContext clientContext) { return GrpcCallableFactory.createServerStreamingCallable( - grpcCallSettings, streamingCallSettings, clientContext); + grpcCallSettings, callSettings, clientContext); } @Override public ClientStreamingCallable createClientStreamingCallable( GrpcCallSettings grpcCallSettings, - StreamingCallSettings streamingCallSettings, + StreamingCallSettings callSettings, ClientContext clientContext) { return GrpcCallableFactory.createClientStreamingCallable( - grpcCallSettings, streamingCallSettings, clientContext); + grpcCallSettings, callSettings, clientContext); } } diff --git a/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3beta1/stub/GrpcWebhooksStub.java b/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3beta1/stub/GrpcWebhooksStub.java index b61fe2afd..e0de461bb 100644 --- a/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3beta1/stub/GrpcWebhooksStub.java +++ b/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3beta1/stub/GrpcWebhooksStub.java @@ -5,7 +5,7 @@ * 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 + * 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, @@ -13,11 +13,11 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.google.cloud.dialogflow.cx.v3beta1.stub; import static com.google.cloud.dialogflow.cx.v3beta1.WebhooksClient.ListWebhooksPagedResponse; -import com.google.api.core.BetaApi; import com.google.api.gax.core.BackgroundResource; import com.google.api.gax.core.BackgroundResourceAggregation; import com.google.api.gax.grpc.GrpcCallSettings; @@ -33,6 +33,7 @@ import com.google.cloud.dialogflow.cx.v3beta1.UpdateWebhookRequest; import com.google.cloud.dialogflow.cx.v3beta1.Webhook; import com.google.common.collect.ImmutableMap; +import com.google.longrunning.stub.GrpcOperationsStub; import com.google.protobuf.Empty; import io.grpc.MethodDescriptor; import io.grpc.protobuf.ProtoUtils; @@ -41,16 +42,14 @@ import java.util.concurrent.TimeUnit; import javax.annotation.Generated; -// AUTO-GENERATED DOCUMENTATION AND CLASS +// AUTO-GENERATED DOCUMENTATION AND CLASS. /** - * gRPC stub implementation for Dialogflow API. + * gRPC stub implementation for the Webhooks service API. * *

This class is for advanced usage and reflects the underlying API directly. */ -@Generated("by gapic-generator") -@BetaApi("A restructuring of stub classes is planned, so this may break in the future") +@Generated("by gapic-generator-java") public class GrpcWebhooksStub extends WebhooksStub { - private static final MethodDescriptor listWebhooksMethodDescriptor = MethodDescriptor.newBuilder() @@ -60,6 +59,7 @@ public class GrpcWebhooksStub extends WebhooksStub { .setResponseMarshaller( ProtoUtils.marshaller(ListWebhooksResponse.getDefaultInstance())) .build(); + private static final MethodDescriptor getWebhookMethodDescriptor = MethodDescriptor.newBuilder() .setType(MethodDescriptor.MethodType.UNARY) @@ -67,6 +67,7 @@ public class GrpcWebhooksStub extends WebhooksStub { .setRequestMarshaller(ProtoUtils.marshaller(GetWebhookRequest.getDefaultInstance())) .setResponseMarshaller(ProtoUtils.marshaller(Webhook.getDefaultInstance())) .build(); + private static final MethodDescriptor createWebhookMethodDescriptor = MethodDescriptor.newBuilder() @@ -76,6 +77,7 @@ public class GrpcWebhooksStub extends WebhooksStub { ProtoUtils.marshaller(CreateWebhookRequest.getDefaultInstance())) .setResponseMarshaller(ProtoUtils.marshaller(Webhook.getDefaultInstance())) .build(); + private static final MethodDescriptor updateWebhookMethodDescriptor = MethodDescriptor.newBuilder() @@ -85,6 +87,7 @@ public class GrpcWebhooksStub extends WebhooksStub { ProtoUtils.marshaller(UpdateWebhookRequest.getDefaultInstance())) .setResponseMarshaller(ProtoUtils.marshaller(Webhook.getDefaultInstance())) .build(); + private static final MethodDescriptor deleteWebhookMethodDescriptor = MethodDescriptor.newBuilder() .setType(MethodDescriptor.MethodType.UNARY) @@ -93,8 +96,6 @@ public class GrpcWebhooksStub extends WebhooksStub { .setResponseMarshaller(ProtoUtils.marshaller(Empty.getDefaultInstance())) .build(); - private final BackgroundResource backgroundResources; - private final UnaryCallable listWebhooksCallable; private final UnaryCallable listWebhooksPagedCallable; @@ -103,6 +104,8 @@ public class GrpcWebhooksStub extends WebhooksStub { private final UnaryCallable updateWebhookCallable; private final UnaryCallable deleteWebhookCallable; + private final BackgroundResource backgroundResources; + private final GrpcOperationsStub operationsStub; private final GrpcStubCallableFactory callableFactory; public static final GrpcWebhooksStub create(WebhooksStubSettings settings) throws IOException { @@ -138,6 +141,7 @@ protected GrpcWebhooksStub( GrpcStubCallableFactory callableFactory) throws IOException { this.callableFactory = callableFactory; + this.operationsStub = GrpcOperationsStub.create(clientContext, callableFactory); GrpcCallSettings listWebhooksTransportSettings = GrpcCallSettings.newBuilder() @@ -224,17 +228,22 @@ public Map extract(DeleteWebhookRequest request) { callableFactory.createUnaryCallable( deleteWebhookTransportSettings, settings.deleteWebhookSettings(), clientContext); - backgroundResources = new BackgroundResourceAggregation(clientContext.getBackgroundResources()); + this.backgroundResources = + new BackgroundResourceAggregation(clientContext.getBackgroundResources()); } - public UnaryCallable listWebhooksPagedCallable() { - return listWebhooksPagedCallable; + public GrpcOperationsStub getOperationsStub() { + return operationsStub; } public UnaryCallable listWebhooksCallable() { return listWebhooksCallable; } + public UnaryCallable listWebhooksPagedCallable() { + return listWebhooksPagedCallable; + } + public UnaryCallable getWebhookCallable() { return getWebhookCallable; } diff --git a/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3beta1/stub/IntentsStub.java b/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3beta1/stub/IntentsStub.java index 5c3af36e6..f27d4655c 100644 --- a/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3beta1/stub/IntentsStub.java +++ b/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3beta1/stub/IntentsStub.java @@ -5,7 +5,7 @@ * 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 + * 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, @@ -13,11 +13,11 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.google.cloud.dialogflow.cx.v3beta1.stub; import static com.google.cloud.dialogflow.cx.v3beta1.IntentsClient.ListIntentsPagedResponse; -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.cx.v3beta1.CreateIntentRequest; @@ -30,14 +30,13 @@ import com.google.protobuf.Empty; import javax.annotation.Generated; -// AUTO-GENERATED DOCUMENTATION AND CLASS +// AUTO-GENERATED DOCUMENTATION AND CLASS. /** - * Base stub class for Dialogflow API. + * Base stub class for the Intents service API. * *

This class is for advanced usage and reflects the underlying API directly. */ @Generated("by gapic-generator") -@BetaApi("A restructuring of stub classes is planned, so this may break in the future") public abstract class IntentsStub implements BackgroundResource { public UnaryCallable listIntentsPagedCallable() { diff --git a/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3beta1/stub/IntentsStubSettings.java b/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3beta1/stub/IntentsStubSettings.java index 9627f555c..9a59dd958 100644 --- a/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3beta1/stub/IntentsStubSettings.java +++ b/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3beta1/stub/IntentsStubSettings.java @@ -5,7 +5,7 @@ * 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 + * 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, @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.google.cloud.dialogflow.cx.v3beta1.stub; import static com.google.cloud.dialogflow.cx.v3beta1.IntentsClient.ListIntentsPagedResponse; @@ -56,7 +57,7 @@ import javax.annotation.Generated; import org.threeten.bp.Duration; -// AUTO-GENERATED DOCUMENTATION AND CLASS +// AUTO-GENERATED DOCUMENTATION AND CLASS. /** * Settings class to configure an instance of {@link IntentsStub}. * @@ -73,22 +74,22 @@ * *

For example, to set the total timeout of getIntent to 30 seconds: * - *

- * 
- * IntentsStubSettings.Builder intentsSettingsBuilder =
- *     IntentsStubSettings.newBuilder();
+ * 
{@code
+ * IntentsStubSettings.Builder intentsSettingsBuilder = IntentsStubSettings.newBuilder();
  * intentsSettingsBuilder
  *     .getIntentSettings()
  *     .setRetrySettings(
- *         intentsSettingsBuilder.getIntentSettings().getRetrySettings().toBuilder()
+ *         intentsSettingsBuilder
+ *             .getIntentSettings()
+ *             .getRetrySettings()
+ *             .toBuilder()
  *             .setTotalTimeout(Duration.ofSeconds(30))
  *             .build());
  * IntentsStubSettings intentsSettings = intentsSettingsBuilder.build();
- * 
- * 
+ * }
*/ -@Generated("by gapic-generator") @BetaApi +@Generated("by gapic-generator-java") public class IntentsStubSettings extends StubSettings { /** The default scopes of the service. */ private static final ImmutableList DEFAULT_SERVICE_SCOPES = @@ -104,6 +105,59 @@ public class IntentsStubSettings extends StubSettings { private final UnaryCallSettings updateIntentSettings; private final UnaryCallSettings deleteIntentSettings; + private static final PagedListDescriptor + LIST_INTENTS_PAGE_STR_DESC = + new PagedListDescriptor() { + @Override + public String emptyToken() { + return ""; + } + + @Override + public ListIntentsRequest injectToken(ListIntentsRequest payload, String token) { + return ListIntentsRequest.newBuilder(payload).setPageToken(token).build(); + } + + @Override + public ListIntentsRequest injectPageSize(ListIntentsRequest payload, int pageSize) { + return ListIntentsRequest.newBuilder(payload).setPageSize(pageSize).build(); + } + + @Override + public Integer extractPageSize(ListIntentsRequest payload) { + return payload.getPageSize(); + } + + @Override + public String extractNextToken(ListIntentsResponse payload) { + return payload.getNextPageToken(); + } + + @Override + public Iterable extractResources(ListIntentsResponse payload) { + return payload.getIntentsList() == null + ? ImmutableList.of() + : payload.getIntentsList(); + } + }; + + private static final PagedListResponseFactory< + ListIntentsRequest, ListIntentsResponse, ListIntentsPagedResponse> + LIST_INTENTS_PAGE_STR_FACT = + new PagedListResponseFactory< + ListIntentsRequest, ListIntentsResponse, ListIntentsPagedResponse>() { + @Override + public ApiFuture getFuturePagedResponse( + UnaryCallable callable, + ListIntentsRequest request, + ApiCallContext context, + ApiFuture futureResponse) { + PageContext pageContext = + PageContext.create(callable, LIST_INTENTS_PAGE_STR_DESC, request, context); + return ListIntentsPagedResponse.createAsync(pageContext, futureResponse); + } + }; + /** Returns the object with the settings used for calls to listIntents. */ public PagedCallSettings listIntentsSettings() { @@ -136,10 +190,10 @@ public IntentsStub createStub() throws IOException { .getTransportName() .equals(GrpcTransportChannel.getGrpcTransportName())) { return GrpcIntentsStub.create(this); - } else { - throw new UnsupportedOperationException( - "Transport not supported: " + getTransportChannelProvider().getTransportName()); } + throw new UnsupportedOperationException( + String.format( + "Transport not supported: %s", getTransportChannelProvider().getTransportName())); } /** Returns a builder for the default ExecutorProvider for this service. */ @@ -205,63 +259,9 @@ protected IntentsStubSettings(Builder settingsBuilder) throws IOException { deleteIntentSettings = settingsBuilder.deleteIntentSettings().build(); } - private static final PagedListDescriptor - LIST_INTENTS_PAGE_STR_DESC = - new PagedListDescriptor() { - @Override - public String emptyToken() { - return ""; - } - - @Override - public ListIntentsRequest injectToken(ListIntentsRequest payload, String token) { - return ListIntentsRequest.newBuilder(payload).setPageToken(token).build(); - } - - @Override - public ListIntentsRequest injectPageSize(ListIntentsRequest payload, int pageSize) { - return ListIntentsRequest.newBuilder(payload).setPageSize(pageSize).build(); - } - - @Override - public Integer extractPageSize(ListIntentsRequest payload) { - return payload.getPageSize(); - } - - @Override - public String extractNextToken(ListIntentsResponse payload) { - return payload.getNextPageToken(); - } - - @Override - public Iterable extractResources(ListIntentsResponse payload) { - return payload.getIntentsList() != null - ? payload.getIntentsList() - : ImmutableList.of(); - } - }; - - private static final PagedListResponseFactory< - ListIntentsRequest, ListIntentsResponse, ListIntentsPagedResponse> - LIST_INTENTS_PAGE_STR_FACT = - new PagedListResponseFactory< - ListIntentsRequest, ListIntentsResponse, ListIntentsPagedResponse>() { - @Override - public ApiFuture getFuturePagedResponse( - UnaryCallable callable, - ListIntentsRequest request, - ApiCallContext context, - ApiFuture futureResponse) { - PageContext pageContext = - PageContext.create(callable, LIST_INTENTS_PAGE_STR_DESC, request, context); - return ListIntentsPagedResponse.createAsync(pageContext, futureResponse); - } - }; - /** Builder for IntentsStubSettings. */ public static class Builder extends StubSettings.Builder { private final ImmutableList> unaryMethodSettingsBuilders; - private final PagedCallSettings.Builder< ListIntentsRequest, ListIntentsResponse, ListIntentsPagedResponse> listIntentsSettings; @@ -269,7 +269,6 @@ public static class Builder extends StubSettings.Builder createIntentSettings; private final UnaryCallSettings.Builder updateIntentSettings; private final UnaryCallSettings.Builder deleteIntentSettings; - private static final ImmutableMap> RETRYABLE_CODE_DEFINITIONS; @@ -277,14 +276,8 @@ public static class Builder extends StubSettings.Builder> definitions = ImmutableMap.builder(); definitions.put( - "retry_policy_1_codes", + "retry_policy_0_codes", ImmutableSet.copyOf(Lists.newArrayList(StatusCode.Code.UNAVAILABLE))); - definitions.put("no_retry_codes", ImmutableSet.copyOf(Lists.newArrayList())); - definitions.put( - "retry_policy_2_codes", - ImmutableSet.copyOf(Lists.newArrayList(StatusCode.Code.UNAVAILABLE))); - definitions.put( - "no_retry_1_codes", ImmutableSet.copyOf(Lists.newArrayList())); RETRYABLE_CODE_DEFINITIONS = definitions.build(); } @@ -303,46 +296,21 @@ public static class Builder extends StubSettings.Builder>of( + listIntentsSettings, + getIntentSettings, + createIntentSettings, + updateIntentSettings, + deleteIntentSettings); + } + private static Builder createDefault() { - Builder builder = new Builder((ClientContext) null); + Builder builder = new Builder(((ClientContext) null)); + builder.setTransportChannelProvider(defaultTransportChannelProvider()); builder.setCredentialsProvider(defaultCredentialsProviderBuilder().build()); builder.setInternalHeaderProvider(defaultApiClientHeaderProviderBuilder().build()); builder.setEndpoint(getDefaultEndpoint()); + return initDefaults(builder); } private static Builder initDefaults(Builder builder) { - builder .listIntentsSettings() - .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_1_codes")) - .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_1_params")); + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params")); builder .getIntentSettings() - .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_1_codes")) - .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_1_params")); + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params")); builder .createIntentSettings() - .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_1_codes")) - .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_1_params")); + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params")); builder .updateIntentSettings() - .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_1_codes")) - .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_1_params")); + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params")); builder .deleteIntentSettings() - .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_1_codes")) - .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_1_params")); + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params")); return builder; } - protected Builder(IntentsStubSettings settings) { - super(settings); - - listIntentsSettings = settings.listIntentsSettings.toBuilder(); - getIntentSettings = settings.getIntentSettings.toBuilder(); - createIntentSettings = settings.createIntentSettings.toBuilder(); - updateIntentSettings = settings.updateIntentSettings.toBuilder(); - deleteIntentSettings = settings.deleteIntentSettings.toBuilder(); - - unaryMethodSettingsBuilders = - ImmutableList.>of( - listIntentsSettings, - getIntentSettings, - createIntentSettings, - updateIntentSettings, - deleteIntentSettings); - } - - // NEXT_MAJOR_VER: remove 'throws Exception' + // NEXT_MAJOR_VER: remove 'throws Exception'. /** * Applies the given settings updater function to all of the unary API methods in this service. * diff --git a/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3beta1/stub/PagesStub.java b/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3beta1/stub/PagesStub.java index 205752417..8ca9d09ea 100644 --- a/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3beta1/stub/PagesStub.java +++ b/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3beta1/stub/PagesStub.java @@ -5,7 +5,7 @@ * 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 + * 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, @@ -13,11 +13,11 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.google.cloud.dialogflow.cx.v3beta1.stub; import static com.google.cloud.dialogflow.cx.v3beta1.PagesClient.ListPagesPagedResponse; -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.cx.v3beta1.CreatePageRequest; @@ -30,14 +30,13 @@ import com.google.protobuf.Empty; import javax.annotation.Generated; -// AUTO-GENERATED DOCUMENTATION AND CLASS +// AUTO-GENERATED DOCUMENTATION AND CLASS. /** - * Base stub class for Dialogflow API. + * Base stub class for the Pages service API. * *

This class is for advanced usage and reflects the underlying API directly. */ @Generated("by gapic-generator") -@BetaApi("A restructuring of stub classes is planned, so this may break in the future") public abstract class PagesStub implements BackgroundResource { public UnaryCallable listPagesPagedCallable() { diff --git a/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3beta1/stub/PagesStubSettings.java b/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3beta1/stub/PagesStubSettings.java index 4041228e7..19b518cba 100644 --- a/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3beta1/stub/PagesStubSettings.java +++ b/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3beta1/stub/PagesStubSettings.java @@ -5,7 +5,7 @@ * 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 + * 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, @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.google.cloud.dialogflow.cx.v3beta1.stub; import static com.google.cloud.dialogflow.cx.v3beta1.PagesClient.ListPagesPagedResponse; @@ -56,7 +57,7 @@ import javax.annotation.Generated; import org.threeten.bp.Duration; -// AUTO-GENERATED DOCUMENTATION AND CLASS +// AUTO-GENERATED DOCUMENTATION AND CLASS. /** * Settings class to configure an instance of {@link PagesStub}. * @@ -73,22 +74,22 @@ * *

For example, to set the total timeout of getPage to 30 seconds: * - *

- * 
- * PagesStubSettings.Builder pagesSettingsBuilder =
- *     PagesStubSettings.newBuilder();
+ * 
{@code
+ * PagesStubSettings.Builder pagesSettingsBuilder = PagesStubSettings.newBuilder();
  * pagesSettingsBuilder
  *     .getPageSettings()
  *     .setRetrySettings(
- *         pagesSettingsBuilder.getPageSettings().getRetrySettings().toBuilder()
+ *         pagesSettingsBuilder
+ *             .getPageSettings()
+ *             .getRetrySettings()
+ *             .toBuilder()
  *             .setTotalTimeout(Duration.ofSeconds(30))
  *             .build());
  * PagesStubSettings pagesSettings = pagesSettingsBuilder.build();
- * 
- * 
+ * }
*/ -@Generated("by gapic-generator") @BetaApi +@Generated("by gapic-generator-java") public class PagesStubSettings extends StubSettings { /** The default scopes of the service. */ private static final ImmutableList DEFAULT_SERVICE_SCOPES = @@ -104,6 +105,59 @@ public class PagesStubSettings extends StubSettings { private final UnaryCallSettings updatePageSettings; private final UnaryCallSettings deletePageSettings; + private static final PagedListDescriptor + LIST_PAGES_PAGE_STR_DESC = + new PagedListDescriptor() { + @Override + public String emptyToken() { + return ""; + } + + @Override + public ListPagesRequest injectToken(ListPagesRequest payload, String token) { + return ListPagesRequest.newBuilder(payload).setPageToken(token).build(); + } + + @Override + public ListPagesRequest injectPageSize(ListPagesRequest payload, int pageSize) { + return ListPagesRequest.newBuilder(payload).setPageSize(pageSize).build(); + } + + @Override + public Integer extractPageSize(ListPagesRequest payload) { + return payload.getPageSize(); + } + + @Override + public String extractNextToken(ListPagesResponse payload) { + return payload.getNextPageToken(); + } + + @Override + public Iterable extractResources(ListPagesResponse payload) { + return payload.getPagesList() == null + ? ImmutableList.of() + : payload.getPagesList(); + } + }; + + private static final PagedListResponseFactory< + ListPagesRequest, ListPagesResponse, ListPagesPagedResponse> + LIST_PAGES_PAGE_STR_FACT = + new PagedListResponseFactory< + ListPagesRequest, ListPagesResponse, ListPagesPagedResponse>() { + @Override + public ApiFuture getFuturePagedResponse( + UnaryCallable callable, + ListPagesRequest request, + ApiCallContext context, + ApiFuture futureResponse) { + PageContext pageContext = + PageContext.create(callable, LIST_PAGES_PAGE_STR_DESC, request, context); + return ListPagesPagedResponse.createAsync(pageContext, futureResponse); + } + }; + /** Returns the object with the settings used for calls to listPages. */ public PagedCallSettings listPagesSettings() { @@ -136,10 +190,10 @@ public PagesStub createStub() throws IOException { .getTransportName() .equals(GrpcTransportChannel.getGrpcTransportName())) { return GrpcPagesStub.create(this); - } else { - throw new UnsupportedOperationException( - "Transport not supported: " + getTransportChannelProvider().getTransportName()); } + throw new UnsupportedOperationException( + String.format( + "Transport not supported: %s", getTransportChannelProvider().getTransportName())); } /** Returns a builder for the default ExecutorProvider for this service. */ @@ -205,63 +259,9 @@ protected PagesStubSettings(Builder settingsBuilder) throws IOException { deletePageSettings = settingsBuilder.deletePageSettings().build(); } - private static final PagedListDescriptor - LIST_PAGES_PAGE_STR_DESC = - new PagedListDescriptor() { - @Override - public String emptyToken() { - return ""; - } - - @Override - public ListPagesRequest injectToken(ListPagesRequest payload, String token) { - return ListPagesRequest.newBuilder(payload).setPageToken(token).build(); - } - - @Override - public ListPagesRequest injectPageSize(ListPagesRequest payload, int pageSize) { - return ListPagesRequest.newBuilder(payload).setPageSize(pageSize).build(); - } - - @Override - public Integer extractPageSize(ListPagesRequest payload) { - return payload.getPageSize(); - } - - @Override - public String extractNextToken(ListPagesResponse payload) { - return payload.getNextPageToken(); - } - - @Override - public Iterable extractResources(ListPagesResponse payload) { - return payload.getPagesList() != null - ? payload.getPagesList() - : ImmutableList.of(); - } - }; - - private static final PagedListResponseFactory< - ListPagesRequest, ListPagesResponse, ListPagesPagedResponse> - LIST_PAGES_PAGE_STR_FACT = - new PagedListResponseFactory< - ListPagesRequest, ListPagesResponse, ListPagesPagedResponse>() { - @Override - public ApiFuture getFuturePagedResponse( - UnaryCallable callable, - ListPagesRequest request, - ApiCallContext context, - ApiFuture futureResponse) { - PageContext pageContext = - PageContext.create(callable, LIST_PAGES_PAGE_STR_DESC, request, context); - return ListPagesPagedResponse.createAsync(pageContext, futureResponse); - } - }; - /** Builder for PagesStubSettings. */ public static class Builder extends StubSettings.Builder { private final ImmutableList> unaryMethodSettingsBuilders; - private final PagedCallSettings.Builder< ListPagesRequest, ListPagesResponse, ListPagesPagedResponse> listPagesSettings; @@ -269,7 +269,6 @@ public static class Builder extends StubSettings.Builder createPageSettings; private final UnaryCallSettings.Builder updatePageSettings; private final UnaryCallSettings.Builder deletePageSettings; - private static final ImmutableMap> RETRYABLE_CODE_DEFINITIONS; @@ -277,14 +276,8 @@ public static class Builder extends StubSettings.Builder> definitions = ImmutableMap.builder(); definitions.put( - "retry_policy_1_codes", + "retry_policy_0_codes", ImmutableSet.copyOf(Lists.newArrayList(StatusCode.Code.UNAVAILABLE))); - definitions.put("no_retry_codes", ImmutableSet.copyOf(Lists.newArrayList())); - definitions.put( - "retry_policy_2_codes", - ImmutableSet.copyOf(Lists.newArrayList(StatusCode.Code.UNAVAILABLE))); - definitions.put( - "no_retry_1_codes", ImmutableSet.copyOf(Lists.newArrayList())); RETRYABLE_CODE_DEFINITIONS = definitions.build(); } @@ -303,46 +296,21 @@ public static class Builder extends StubSettings.Builder>of( + listPagesSettings, + getPageSettings, + createPageSettings, + updatePageSettings, + deletePageSettings); + } + private static Builder createDefault() { - Builder builder = new Builder((ClientContext) null); + Builder builder = new Builder(((ClientContext) null)); + builder.setTransportChannelProvider(defaultTransportChannelProvider()); builder.setCredentialsProvider(defaultCredentialsProviderBuilder().build()); builder.setInternalHeaderProvider(defaultApiClientHeaderProviderBuilder().build()); builder.setEndpoint(getDefaultEndpoint()); + return initDefaults(builder); } private static Builder initDefaults(Builder builder) { - builder .listPagesSettings() - .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_1_codes")) - .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_1_params")); + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params")); builder .getPageSettings() - .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_1_codes")) - .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_1_params")); + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params")); builder .createPageSettings() - .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_1_codes")) - .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_1_params")); + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params")); builder .updatePageSettings() - .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_1_codes")) - .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_1_params")); + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params")); builder .deletePageSettings() - .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_1_codes")) - .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_1_params")); + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params")); return builder; } - protected Builder(PagesStubSettings settings) { - super(settings); - - listPagesSettings = settings.listPagesSettings.toBuilder(); - getPageSettings = settings.getPageSettings.toBuilder(); - createPageSettings = settings.createPageSettings.toBuilder(); - updatePageSettings = settings.updatePageSettings.toBuilder(); - deletePageSettings = settings.deletePageSettings.toBuilder(); - - unaryMethodSettingsBuilders = - ImmutableList.>of( - listPagesSettings, - getPageSettings, - createPageSettings, - updatePageSettings, - deletePageSettings); - } - - // NEXT_MAJOR_VER: remove 'throws Exception' + // NEXT_MAJOR_VER: remove 'throws Exception'. /** * Applies the given settings updater function to all of the unary API methods in this service. * diff --git a/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3beta1/stub/SessionEntityTypesStub.java b/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3beta1/stub/SessionEntityTypesStub.java index 768ad88bb..8949b964e 100644 --- a/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3beta1/stub/SessionEntityTypesStub.java +++ b/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3beta1/stub/SessionEntityTypesStub.java @@ -5,7 +5,7 @@ * 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 + * 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, @@ -13,11 +13,11 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.google.cloud.dialogflow.cx.v3beta1.stub; import static com.google.cloud.dialogflow.cx.v3beta1.SessionEntityTypesClient.ListSessionEntityTypesPagedResponse; -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.cx.v3beta1.CreateSessionEntityTypeRequest; @@ -30,14 +30,13 @@ import com.google.protobuf.Empty; import javax.annotation.Generated; -// AUTO-GENERATED DOCUMENTATION AND CLASS +// AUTO-GENERATED DOCUMENTATION AND CLASS. /** - * Base stub class for Dialogflow API. + * Base stub class for the SessionEntityTypes service API. * *

This class is for advanced usage and reflects the underlying API directly. */ @Generated("by gapic-generator") -@BetaApi("A restructuring of stub classes is planned, so this may break in the future") public abstract class SessionEntityTypesStub implements BackgroundResource { public UnaryCallable diff --git a/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3beta1/stub/SessionEntityTypesStubSettings.java b/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3beta1/stub/SessionEntityTypesStubSettings.java index 65d27cf0e..dc7ab63a5 100644 --- a/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3beta1/stub/SessionEntityTypesStubSettings.java +++ b/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3beta1/stub/SessionEntityTypesStubSettings.java @@ -5,7 +5,7 @@ * 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 + * 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, @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.google.cloud.dialogflow.cx.v3beta1.stub; import static com.google.cloud.dialogflow.cx.v3beta1.SessionEntityTypesClient.ListSessionEntityTypesPagedResponse; @@ -56,7 +57,7 @@ import javax.annotation.Generated; import org.threeten.bp.Duration; -// AUTO-GENERATED DOCUMENTATION AND CLASS +// AUTO-GENERATED DOCUMENTATION AND CLASS. /** * Settings class to configure an instance of {@link SessionEntityTypesStub}. * @@ -73,22 +74,24 @@ * *

For example, to set the total timeout of getSessionEntityType to 30 seconds: * - *

- * 
+ * 
{@code
  * SessionEntityTypesStubSettings.Builder sessionEntityTypesSettingsBuilder =
  *     SessionEntityTypesStubSettings.newBuilder();
  * sessionEntityTypesSettingsBuilder
  *     .getSessionEntityTypeSettings()
  *     .setRetrySettings(
- *         sessionEntityTypesSettingsBuilder.getSessionEntityTypeSettings().getRetrySettings().toBuilder()
+ *         sessionEntityTypesSettingsBuilder
+ *             .getSessionEntityTypeSettings()
+ *             .getRetrySettings()
+ *             .toBuilder()
  *             .setTotalTimeout(Duration.ofSeconds(30))
  *             .build());
- * SessionEntityTypesStubSettings sessionEntityTypesSettings = sessionEntityTypesSettingsBuilder.build();
- * 
- * 
+ * SessionEntityTypesStubSettings sessionEntityTypesSettings = + * sessionEntityTypesSettingsBuilder.build(); + * }
*/ -@Generated("by gapic-generator") @BetaApi +@Generated("by gapic-generator-java") public class SessionEntityTypesStubSettings extends StubSettings { /** The default scopes of the service. */ private static final ImmutableList DEFAULT_SERVICE_SCOPES = @@ -111,6 +114,76 @@ public class SessionEntityTypesStubSettings extends StubSettings deleteSessionEntityTypeSettings; + private static final PagedListDescriptor< + ListSessionEntityTypesRequest, ListSessionEntityTypesResponse, SessionEntityType> + LIST_SESSION_ENTITY_TYPES_PAGE_STR_DESC = + new PagedListDescriptor< + ListSessionEntityTypesRequest, ListSessionEntityTypesResponse, SessionEntityType>() { + @Override + public String emptyToken() { + return ""; + } + + @Override + public ListSessionEntityTypesRequest injectToken( + ListSessionEntityTypesRequest payload, String token) { + return ListSessionEntityTypesRequest.newBuilder(payload).setPageToken(token).build(); + } + + @Override + public ListSessionEntityTypesRequest injectPageSize( + ListSessionEntityTypesRequest payload, int pageSize) { + return ListSessionEntityTypesRequest.newBuilder(payload) + .setPageSize(pageSize) + .build(); + } + + @Override + public Integer extractPageSize(ListSessionEntityTypesRequest payload) { + return payload.getPageSize(); + } + + @Override + public String extractNextToken(ListSessionEntityTypesResponse payload) { + return payload.getNextPageToken(); + } + + @Override + public Iterable extractResources( + ListSessionEntityTypesResponse payload) { + return payload.getSessionEntityTypesList() == null + ? ImmutableList.of() + : payload.getSessionEntityTypesList(); + } + }; + + private static final PagedListResponseFactory< + ListSessionEntityTypesRequest, + ListSessionEntityTypesResponse, + ListSessionEntityTypesPagedResponse> + LIST_SESSION_ENTITY_TYPES_PAGE_STR_FACT = + new PagedListResponseFactory< + ListSessionEntityTypesRequest, + ListSessionEntityTypesResponse, + ListSessionEntityTypesPagedResponse>() { + @Override + public ApiFuture getFuturePagedResponse( + UnaryCallable + callable, + ListSessionEntityTypesRequest request, + ApiCallContext context, + ApiFuture futureResponse) { + PageContext< + ListSessionEntityTypesRequest, + ListSessionEntityTypesResponse, + SessionEntityType> + pageContext = + PageContext.create( + callable, LIST_SESSION_ENTITY_TYPES_PAGE_STR_DESC, request, context); + return ListSessionEntityTypesPagedResponse.createAsync(pageContext, futureResponse); + } + }; + /** Returns the object with the settings used for calls to listSessionEntityTypes. */ public PagedCallSettings< ListSessionEntityTypesRequest, @@ -150,10 +223,10 @@ public SessionEntityTypesStub createStub() throws IOException { .getTransportName() .equals(GrpcTransportChannel.getGrpcTransportName())) { return GrpcSessionEntityTypesStub.create(this); - } else { - throw new UnsupportedOperationException( - "Transport not supported: " + getTransportChannelProvider().getTransportName()); } + throw new UnsupportedOperationException( + String.format( + "Transport not supported: %s", getTransportChannelProvider().getTransportName())); } /** Returns a builder for the default ExecutorProvider for this service. */ @@ -220,81 +293,10 @@ protected SessionEntityTypesStubSettings(Builder settingsBuilder) throws IOExcep deleteSessionEntityTypeSettings = settingsBuilder.deleteSessionEntityTypeSettings().build(); } - private static final PagedListDescriptor< - ListSessionEntityTypesRequest, ListSessionEntityTypesResponse, SessionEntityType> - LIST_SESSION_ENTITY_TYPES_PAGE_STR_DESC = - new PagedListDescriptor< - ListSessionEntityTypesRequest, ListSessionEntityTypesResponse, SessionEntityType>() { - @Override - public String emptyToken() { - return ""; - } - - @Override - public ListSessionEntityTypesRequest injectToken( - ListSessionEntityTypesRequest payload, String token) { - return ListSessionEntityTypesRequest.newBuilder(payload).setPageToken(token).build(); - } - - @Override - public ListSessionEntityTypesRequest injectPageSize( - ListSessionEntityTypesRequest payload, int pageSize) { - return ListSessionEntityTypesRequest.newBuilder(payload) - .setPageSize(pageSize) - .build(); - } - - @Override - public Integer extractPageSize(ListSessionEntityTypesRequest payload) { - return payload.getPageSize(); - } - - @Override - public String extractNextToken(ListSessionEntityTypesResponse payload) { - return payload.getNextPageToken(); - } - - @Override - public Iterable extractResources( - ListSessionEntityTypesResponse payload) { - return payload.getSessionEntityTypesList() != null - ? payload.getSessionEntityTypesList() - : ImmutableList.of(); - } - }; - - private static final PagedListResponseFactory< - ListSessionEntityTypesRequest, - ListSessionEntityTypesResponse, - ListSessionEntityTypesPagedResponse> - LIST_SESSION_ENTITY_TYPES_PAGE_STR_FACT = - new PagedListResponseFactory< - ListSessionEntityTypesRequest, - ListSessionEntityTypesResponse, - ListSessionEntityTypesPagedResponse>() { - @Override - public ApiFuture getFuturePagedResponse( - UnaryCallable - callable, - ListSessionEntityTypesRequest request, - ApiCallContext context, - ApiFuture futureResponse) { - PageContext< - ListSessionEntityTypesRequest, - ListSessionEntityTypesResponse, - SessionEntityType> - pageContext = - PageContext.create( - callable, LIST_SESSION_ENTITY_TYPES_PAGE_STR_DESC, request, context); - return ListSessionEntityTypesPagedResponse.createAsync(pageContext, futureResponse); - } - }; - /** Builder for SessionEntityTypesStubSettings. */ public static class Builder extends StubSettings.Builder { private final ImmutableList> unaryMethodSettingsBuilders; - private final PagedCallSettings.Builder< ListSessionEntityTypesRequest, ListSessionEntityTypesResponse, @@ -308,7 +310,6 @@ public static class Builder updateSessionEntityTypeSettings; private final UnaryCallSettings.Builder deleteSessionEntityTypeSettings; - private static final ImmutableMap> RETRYABLE_CODE_DEFINITIONS; @@ -316,14 +317,8 @@ public static class Builder ImmutableMap.Builder> definitions = ImmutableMap.builder(); definitions.put( - "retry_policy_1_codes", - ImmutableSet.copyOf(Lists.newArrayList(StatusCode.Code.UNAVAILABLE))); - definitions.put("no_retry_codes", ImmutableSet.copyOf(Lists.newArrayList())); - definitions.put( - "retry_policy_2_codes", + "retry_policy_0_codes", ImmutableSet.copyOf(Lists.newArrayList(StatusCode.Code.UNAVAILABLE))); - definitions.put( - "no_retry_1_codes", ImmutableSet.copyOf(Lists.newArrayList())); RETRYABLE_CODE_DEFINITIONS = definitions.build(); } @@ -342,33 +337,12 @@ public static class Builder .setMaxRpcTimeout(Duration.ofMillis(60000L)) .setTotalTimeout(Duration.ofMillis(60000L)) .build(); - definitions.put("retry_policy_1_params", settings); - settings = - RetrySettings.newBuilder() - .setInitialRetryDelay(Duration.ofMillis(100L)) - .setRetryDelayMultiplier(1.3) - .setMaxRetryDelay(Duration.ofMillis(60000L)) - .setInitialRpcTimeout(Duration.ofMillis(220000L)) - .setRpcTimeoutMultiplier(1.0) - .setMaxRpcTimeout(Duration.ofMillis(220000L)) - .setTotalTimeout(Duration.ofMillis(220000L)) - .build(); - definitions.put("retry_policy_2_params", settings); - settings = RetrySettings.newBuilder().setRpcTimeoutMultiplier(1.0).build(); - definitions.put("no_retry_params", settings); - settings = - RetrySettings.newBuilder() - .setInitialRpcTimeout(Duration.ofMillis(220000L)) - .setRpcTimeoutMultiplier(1.0) - .setMaxRpcTimeout(Duration.ofMillis(220000L)) - .setTotalTimeout(Duration.ofMillis(220000L)) - .build(); - definitions.put("no_retry_1_params", settings); + definitions.put("retry_policy_0_params", settings); RETRY_PARAM_DEFINITIONS = definitions.build(); } protected Builder() { - this((ClientContext) null); + this(((ClientContext) null)); } protected Builder(ClientContext clientContext) { @@ -376,13 +350,9 @@ protected Builder(ClientContext clientContext) { listSessionEntityTypesSettings = PagedCallSettings.newBuilder(LIST_SESSION_ENTITY_TYPES_PAGE_STR_FACT); - getSessionEntityTypeSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); - createSessionEntityTypeSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); - updateSessionEntityTypeSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); - deleteSessionEntityTypeSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); unaryMethodSettingsBuilders = @@ -392,68 +362,68 @@ protected Builder(ClientContext clientContext) { createSessionEntityTypeSettings, updateSessionEntityTypeSettings, deleteSessionEntityTypeSettings); - initDefaults(this); } + protected Builder(SessionEntityTypesStubSettings settings) { + super(settings); + + listSessionEntityTypesSettings = settings.listSessionEntityTypesSettings.toBuilder(); + getSessionEntityTypeSettings = settings.getSessionEntityTypeSettings.toBuilder(); + createSessionEntityTypeSettings = settings.createSessionEntityTypeSettings.toBuilder(); + updateSessionEntityTypeSettings = settings.updateSessionEntityTypeSettings.toBuilder(); + deleteSessionEntityTypeSettings = settings.deleteSessionEntityTypeSettings.toBuilder(); + + unaryMethodSettingsBuilders = + ImmutableList.>of( + listSessionEntityTypesSettings, + getSessionEntityTypeSettings, + createSessionEntityTypeSettings, + updateSessionEntityTypeSettings, + deleteSessionEntityTypeSettings); + } + private static Builder createDefault() { - Builder builder = new Builder((ClientContext) null); + Builder builder = new Builder(((ClientContext) null)); + builder.setTransportChannelProvider(defaultTransportChannelProvider()); builder.setCredentialsProvider(defaultCredentialsProviderBuilder().build()); builder.setInternalHeaderProvider(defaultApiClientHeaderProviderBuilder().build()); builder.setEndpoint(getDefaultEndpoint()); + return initDefaults(builder); } private static Builder initDefaults(Builder builder) { - builder .listSessionEntityTypesSettings() - .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_1_codes")) - .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_1_params")); + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params")); builder .getSessionEntityTypeSettings() - .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_1_codes")) - .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_1_params")); + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params")); builder .createSessionEntityTypeSettings() - .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_1_codes")) - .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_1_params")); + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params")); builder .updateSessionEntityTypeSettings() - .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_1_codes")) - .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_1_params")); + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params")); builder .deleteSessionEntityTypeSettings() - .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_1_codes")) - .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_1_params")); + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params")); return builder; } - protected Builder(SessionEntityTypesStubSettings settings) { - super(settings); - - listSessionEntityTypesSettings = settings.listSessionEntityTypesSettings.toBuilder(); - getSessionEntityTypeSettings = settings.getSessionEntityTypeSettings.toBuilder(); - createSessionEntityTypeSettings = settings.createSessionEntityTypeSettings.toBuilder(); - updateSessionEntityTypeSettings = settings.updateSessionEntityTypeSettings.toBuilder(); - deleteSessionEntityTypeSettings = settings.deleteSessionEntityTypeSettings.toBuilder(); - - unaryMethodSettingsBuilders = - ImmutableList.>of( - listSessionEntityTypesSettings, - getSessionEntityTypeSettings, - createSessionEntityTypeSettings, - updateSessionEntityTypeSettings, - deleteSessionEntityTypeSettings); - } - - // NEXT_MAJOR_VER: remove 'throws Exception' + // NEXT_MAJOR_VER: remove 'throws Exception'. /** * Applies the given settings updater function to all of the unary API methods in this service. * diff --git a/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3beta1/stub/SessionsStub.java b/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3beta1/stub/SessionsStub.java index 40d767ef6..19d6b2a03 100644 --- a/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3beta1/stub/SessionsStub.java +++ b/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3beta1/stub/SessionsStub.java @@ -5,7 +5,7 @@ * 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 + * 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, @@ -13,9 +13,9 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.google.cloud.dialogflow.cx.v3beta1.stub; -import com.google.api.core.BetaApi; import com.google.api.gax.core.BackgroundResource; import com.google.api.gax.rpc.BidiStreamingCallable; import com.google.api.gax.rpc.UnaryCallable; @@ -29,14 +29,13 @@ import com.google.cloud.dialogflow.cx.v3beta1.StreamingDetectIntentResponse; import javax.annotation.Generated; -// AUTO-GENERATED DOCUMENTATION AND CLASS +// AUTO-GENERATED DOCUMENTATION AND CLASS. /** - * Base stub class for Dialogflow API. + * Base stub class for the Sessions service API. * *

This class is for advanced usage and reflects the underlying API directly. */ @Generated("by gapic-generator") -@BetaApi("A restructuring of stub classes is planned, so this may break in the future") public abstract class SessionsStub implements BackgroundResource { public UnaryCallable detectIntentCallable() { diff --git a/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3beta1/stub/SessionsStubSettings.java b/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3beta1/stub/SessionsStubSettings.java index 9e8f7c58b..944973044 100644 --- a/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3beta1/stub/SessionsStubSettings.java +++ b/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3beta1/stub/SessionsStubSettings.java @@ -5,7 +5,7 @@ * 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 + * 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, @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.google.cloud.dialogflow.cx.v3beta1.stub; import com.google.api.core.ApiFunction; @@ -48,7 +49,7 @@ import javax.annotation.Generated; import org.threeten.bp.Duration; -// AUTO-GENERATED DOCUMENTATION AND CLASS +// AUTO-GENERATED DOCUMENTATION AND CLASS. /** * Settings class to configure an instance of {@link SessionsStub}. * @@ -65,22 +66,22 @@ * *

For example, to set the total timeout of detectIntent to 30 seconds: * - *

- * 
- * SessionsStubSettings.Builder sessionsSettingsBuilder =
- *     SessionsStubSettings.newBuilder();
+ * 
{@code
+ * SessionsStubSettings.Builder sessionsSettingsBuilder = SessionsStubSettings.newBuilder();
  * sessionsSettingsBuilder
  *     .detectIntentSettings()
  *     .setRetrySettings(
- *         sessionsSettingsBuilder.detectIntentSettings().getRetrySettings().toBuilder()
+ *         sessionsSettingsBuilder
+ *             .detectIntentSettings()
+ *             .getRetrySettings()
+ *             .toBuilder()
  *             .setTotalTimeout(Duration.ofSeconds(30))
  *             .build());
  * SessionsStubSettings sessionsSettings = sessionsSettingsBuilder.build();
- * 
- * 
+ * }
*/ -@Generated("by gapic-generator") @BetaApi +@Generated("by gapic-generator-java") public class SessionsStubSettings extends StubSettings { /** The default scopes of the service. */ private static final ImmutableList DEFAULT_SERVICE_SCOPES = @@ -123,10 +124,10 @@ public SessionsStub createStub() throws IOException { .getTransportName() .equals(GrpcTransportChannel.getGrpcTransportName())) { return GrpcSessionsStub.create(this); - } else { - throw new UnsupportedOperationException( - "Transport not supported: " + getTransportChannelProvider().getTransportName()); } + throw new UnsupportedOperationException( + String.format( + "Transport not supported: %s", getTransportChannelProvider().getTransportName())); } /** Returns a builder for the default ExecutorProvider for this service. */ @@ -194,7 +195,6 @@ protected SessionsStubSettings(Builder settingsBuilder) throws IOException { /** Builder for SessionsStubSettings. */ public static class Builder extends StubSettings.Builder { private final ImmutableList> unaryMethodSettingsBuilders; - private final UnaryCallSettings.Builder detectIntentSettings; private final StreamingCallSettings.Builder< @@ -204,7 +204,6 @@ public static class Builder extends StubSettings.Builder fulfillIntentSettings; - private static final ImmutableMap> RETRYABLE_CODE_DEFINITIONS; @@ -214,12 +213,11 @@ public static class Builder extends StubSettings.BuildernewArrayList(StatusCode.Code.UNAVAILABLE))); - definitions.put("no_retry_codes", ImmutableSet.copyOf(Lists.newArrayList())); definitions.put( - "retry_policy_2_codes", - ImmutableSet.copyOf(Lists.newArrayList(StatusCode.Code.UNAVAILABLE))); + "no_retry_2_codes", ImmutableSet.copyOf(Lists.newArrayList())); definitions.put( - "no_retry_1_codes", ImmutableSet.copyOf(Lists.newArrayList())); + "retry_policy_0_codes", + ImmutableSet.copyOf(Lists.newArrayList(StatusCode.Code.UNAVAILABLE))); RETRYABLE_CODE_DEFINITIONS = definitions.build(); } @@ -233,101 +231,96 @@ public static class Builder extends StubSettings.Builder>of( detectIntentSettings, matchIntentSettings, fulfillIntentSettings); - initDefaults(this); } + protected Builder(SessionsStubSettings settings) { + super(settings); + + detectIntentSettings = settings.detectIntentSettings.toBuilder(); + streamingDetectIntentSettings = settings.streamingDetectIntentSettings.toBuilder(); + matchIntentSettings = settings.matchIntentSettings.toBuilder(); + fulfillIntentSettings = settings.fulfillIntentSettings.toBuilder(); + + unaryMethodSettingsBuilders = + ImmutableList.>of( + detectIntentSettings, matchIntentSettings, fulfillIntentSettings); + } + private static Builder createDefault() { - Builder builder = new Builder((ClientContext) null); + Builder builder = new Builder(((ClientContext) null)); + builder.setTransportChannelProvider(defaultTransportChannelProvider()); builder.setCredentialsProvider(defaultCredentialsProviderBuilder().build()); builder.setInternalHeaderProvider(defaultApiClientHeaderProviderBuilder().build()); builder.setEndpoint(getDefaultEndpoint()); + return initDefaults(builder); } private static Builder initDefaults(Builder builder) { - builder .detectIntentSettings() - .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_2_codes")) - .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_2_params")); + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_1_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_1_params")); builder .matchIntentSettings() - .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_1_codes")) - .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_1_params")); + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params")); builder .fulfillIntentSettings() - .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_1_codes")) - .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_1_params")); + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params")); return builder; } - protected Builder(SessionsStubSettings settings) { - super(settings); - - detectIntentSettings = settings.detectIntentSettings.toBuilder(); - streamingDetectIntentSettings = settings.streamingDetectIntentSettings.toBuilder(); - matchIntentSettings = settings.matchIntentSettings.toBuilder(); - fulfillIntentSettings = settings.fulfillIntentSettings.toBuilder(); - - unaryMethodSettingsBuilders = - ImmutableList.>of( - detectIntentSettings, matchIntentSettings, fulfillIntentSettings); - } - - // NEXT_MAJOR_VER: remove 'throws Exception' + // NEXT_MAJOR_VER: remove 'throws Exception'. /** * Applies the given settings updater function to all of the unary API methods in this service. * diff --git a/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3beta1/stub/TransitionRouteGroupsStub.java b/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3beta1/stub/TransitionRouteGroupsStub.java index f0ea471c4..50025957a 100644 --- a/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3beta1/stub/TransitionRouteGroupsStub.java +++ b/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3beta1/stub/TransitionRouteGroupsStub.java @@ -5,7 +5,7 @@ * 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 + * 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, @@ -13,11 +13,11 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.google.cloud.dialogflow.cx.v3beta1.stub; import static com.google.cloud.dialogflow.cx.v3beta1.TransitionRouteGroupsClient.ListTransitionRouteGroupsPagedResponse; -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.cx.v3beta1.CreateTransitionRouteGroupRequest; @@ -30,14 +30,13 @@ import com.google.protobuf.Empty; import javax.annotation.Generated; -// AUTO-GENERATED DOCUMENTATION AND CLASS +// AUTO-GENERATED DOCUMENTATION AND CLASS. /** - * Base stub class for Dialogflow API. + * Base stub class for the TransitionRouteGroups service API. * *

This class is for advanced usage and reflects the underlying API directly. */ @Generated("by gapic-generator") -@BetaApi("A restructuring of stub classes is planned, so this may break in the future") public abstract class TransitionRouteGroupsStub implements BackgroundResource { public UnaryCallable diff --git a/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3beta1/stub/TransitionRouteGroupsStubSettings.java b/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3beta1/stub/TransitionRouteGroupsStubSettings.java index b33052338..53fe13e76 100644 --- a/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3beta1/stub/TransitionRouteGroupsStubSettings.java +++ b/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3beta1/stub/TransitionRouteGroupsStubSettings.java @@ -5,7 +5,7 @@ * 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 + * 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, @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.google.cloud.dialogflow.cx.v3beta1.stub; import static com.google.cloud.dialogflow.cx.v3beta1.TransitionRouteGroupsClient.ListTransitionRouteGroupsPagedResponse; @@ -56,7 +57,7 @@ import javax.annotation.Generated; import org.threeten.bp.Duration; -// AUTO-GENERATED DOCUMENTATION AND CLASS +// AUTO-GENERATED DOCUMENTATION AND CLASS. /** * Settings class to configure an instance of {@link TransitionRouteGroupsStub}. * @@ -73,22 +74,24 @@ * *

For example, to set the total timeout of getTransitionRouteGroup to 30 seconds: * - *

- * 
+ * 
{@code
  * TransitionRouteGroupsStubSettings.Builder transitionRouteGroupsSettingsBuilder =
  *     TransitionRouteGroupsStubSettings.newBuilder();
  * transitionRouteGroupsSettingsBuilder
  *     .getTransitionRouteGroupSettings()
  *     .setRetrySettings(
- *         transitionRouteGroupsSettingsBuilder.getTransitionRouteGroupSettings().getRetrySettings().toBuilder()
+ *         transitionRouteGroupsSettingsBuilder
+ *             .getTransitionRouteGroupSettings()
+ *             .getRetrySettings()
+ *             .toBuilder()
  *             .setTotalTimeout(Duration.ofSeconds(30))
  *             .build());
- * TransitionRouteGroupsStubSettings transitionRouteGroupsSettings = transitionRouteGroupsSettingsBuilder.build();
- * 
- * 
+ * TransitionRouteGroupsStubSettings transitionRouteGroupsSettings = + * transitionRouteGroupsSettingsBuilder.build(); + * }
*/ -@Generated("by gapic-generator") @BetaApi +@Generated("by gapic-generator-java") public class TransitionRouteGroupsStubSettings extends StubSettings { /** The default scopes of the service. */ @@ -112,6 +115,81 @@ public class TransitionRouteGroupsStubSettings private final UnaryCallSettings deleteTransitionRouteGroupSettings; + private static final PagedListDescriptor< + ListTransitionRouteGroupsRequest, ListTransitionRouteGroupsResponse, TransitionRouteGroup> + LIST_TRANSITION_ROUTE_GROUPS_PAGE_STR_DESC = + new PagedListDescriptor< + ListTransitionRouteGroupsRequest, + ListTransitionRouteGroupsResponse, + TransitionRouteGroup>() { + @Override + public String emptyToken() { + return ""; + } + + @Override + public ListTransitionRouteGroupsRequest injectToken( + ListTransitionRouteGroupsRequest payload, String token) { + return ListTransitionRouteGroupsRequest.newBuilder(payload) + .setPageToken(token) + .build(); + } + + @Override + public ListTransitionRouteGroupsRequest injectPageSize( + ListTransitionRouteGroupsRequest payload, int pageSize) { + return ListTransitionRouteGroupsRequest.newBuilder(payload) + .setPageSize(pageSize) + .build(); + } + + @Override + public Integer extractPageSize(ListTransitionRouteGroupsRequest payload) { + return payload.getPageSize(); + } + + @Override + public String extractNextToken(ListTransitionRouteGroupsResponse payload) { + return payload.getNextPageToken(); + } + + @Override + public Iterable extractResources( + ListTransitionRouteGroupsResponse payload) { + return payload.getTransitionRouteGroupsList() == null + ? ImmutableList.of() + : payload.getTransitionRouteGroupsList(); + } + }; + + private static final PagedListResponseFactory< + ListTransitionRouteGroupsRequest, + ListTransitionRouteGroupsResponse, + ListTransitionRouteGroupsPagedResponse> + LIST_TRANSITION_ROUTE_GROUPS_PAGE_STR_FACT = + new PagedListResponseFactory< + ListTransitionRouteGroupsRequest, + ListTransitionRouteGroupsResponse, + ListTransitionRouteGroupsPagedResponse>() { + @Override + public ApiFuture getFuturePagedResponse( + UnaryCallable + callable, + ListTransitionRouteGroupsRequest request, + ApiCallContext context, + ApiFuture futureResponse) { + PageContext< + ListTransitionRouteGroupsRequest, + ListTransitionRouteGroupsResponse, + TransitionRouteGroup> + pageContext = + PageContext.create( + callable, LIST_TRANSITION_ROUTE_GROUPS_PAGE_STR_DESC, request, context); + return ListTransitionRouteGroupsPagedResponse.createAsync( + pageContext, futureResponse); + } + }; + /** Returns the object with the settings used for calls to listTransitionRouteGroups. */ public PagedCallSettings< ListTransitionRouteGroupsRequest, @@ -151,10 +229,10 @@ public TransitionRouteGroupsStub createStub() throws IOException { .getTransportName() .equals(GrpcTransportChannel.getGrpcTransportName())) { return GrpcTransitionRouteGroupsStub.create(this); - } else { - throw new UnsupportedOperationException( - "Transport not supported: " + getTransportChannelProvider().getTransportName()); } + throw new UnsupportedOperationException( + String.format( + "Transport not supported: %s", getTransportChannelProvider().getTransportName())); } /** Returns a builder for the default ExecutorProvider for this service. */ @@ -224,86 +302,10 @@ protected TransitionRouteGroupsStubSettings(Builder settingsBuilder) throws IOEx settingsBuilder.deleteTransitionRouteGroupSettings().build(); } - private static final PagedListDescriptor< - ListTransitionRouteGroupsRequest, ListTransitionRouteGroupsResponse, TransitionRouteGroup> - LIST_TRANSITION_ROUTE_GROUPS_PAGE_STR_DESC = - new PagedListDescriptor< - ListTransitionRouteGroupsRequest, - ListTransitionRouteGroupsResponse, - TransitionRouteGroup>() { - @Override - public String emptyToken() { - return ""; - } - - @Override - public ListTransitionRouteGroupsRequest injectToken( - ListTransitionRouteGroupsRequest payload, String token) { - return ListTransitionRouteGroupsRequest.newBuilder(payload) - .setPageToken(token) - .build(); - } - - @Override - public ListTransitionRouteGroupsRequest injectPageSize( - ListTransitionRouteGroupsRequest payload, int pageSize) { - return ListTransitionRouteGroupsRequest.newBuilder(payload) - .setPageSize(pageSize) - .build(); - } - - @Override - public Integer extractPageSize(ListTransitionRouteGroupsRequest payload) { - return payload.getPageSize(); - } - - @Override - public String extractNextToken(ListTransitionRouteGroupsResponse payload) { - return payload.getNextPageToken(); - } - - @Override - public Iterable extractResources( - ListTransitionRouteGroupsResponse payload) { - return payload.getTransitionRouteGroupsList() != null - ? payload.getTransitionRouteGroupsList() - : ImmutableList.of(); - } - }; - - private static final PagedListResponseFactory< - ListTransitionRouteGroupsRequest, - ListTransitionRouteGroupsResponse, - ListTransitionRouteGroupsPagedResponse> - LIST_TRANSITION_ROUTE_GROUPS_PAGE_STR_FACT = - new PagedListResponseFactory< - ListTransitionRouteGroupsRequest, - ListTransitionRouteGroupsResponse, - ListTransitionRouteGroupsPagedResponse>() { - @Override - public ApiFuture getFuturePagedResponse( - UnaryCallable - callable, - ListTransitionRouteGroupsRequest request, - ApiCallContext context, - ApiFuture futureResponse) { - PageContext< - ListTransitionRouteGroupsRequest, - ListTransitionRouteGroupsResponse, - TransitionRouteGroup> - pageContext = - PageContext.create( - callable, LIST_TRANSITION_ROUTE_GROUPS_PAGE_STR_DESC, request, context); - return ListTransitionRouteGroupsPagedResponse.createAsync( - pageContext, futureResponse); - } - }; - /** Builder for TransitionRouteGroupsStubSettings. */ public static class Builder extends StubSettings.Builder { private final ImmutableList> unaryMethodSettingsBuilders; - private final PagedCallSettings.Builder< ListTransitionRouteGroupsRequest, ListTransitionRouteGroupsResponse, @@ -317,7 +319,6 @@ public static class Builder updateTransitionRouteGroupSettings; private final UnaryCallSettings.Builder deleteTransitionRouteGroupSettings; - private static final ImmutableMap> RETRYABLE_CODE_DEFINITIONS; @@ -325,14 +326,8 @@ public static class Builder ImmutableMap.Builder> definitions = ImmutableMap.builder(); definitions.put( - "retry_policy_1_codes", - ImmutableSet.copyOf(Lists.newArrayList(StatusCode.Code.UNAVAILABLE))); - definitions.put("no_retry_codes", ImmutableSet.copyOf(Lists.newArrayList())); - definitions.put( - "retry_policy_2_codes", + "retry_policy_0_codes", ImmutableSet.copyOf(Lists.newArrayList(StatusCode.Code.UNAVAILABLE))); - definitions.put( - "no_retry_1_codes", ImmutableSet.copyOf(Lists.newArrayList())); RETRYABLE_CODE_DEFINITIONS = definitions.build(); } @@ -351,33 +346,12 @@ public static class Builder .setMaxRpcTimeout(Duration.ofMillis(60000L)) .setTotalTimeout(Duration.ofMillis(60000L)) .build(); - definitions.put("retry_policy_1_params", settings); - settings = - RetrySettings.newBuilder() - .setInitialRetryDelay(Duration.ofMillis(100L)) - .setRetryDelayMultiplier(1.3) - .setMaxRetryDelay(Duration.ofMillis(60000L)) - .setInitialRpcTimeout(Duration.ofMillis(220000L)) - .setRpcTimeoutMultiplier(1.0) - .setMaxRpcTimeout(Duration.ofMillis(220000L)) - .setTotalTimeout(Duration.ofMillis(220000L)) - .build(); - definitions.put("retry_policy_2_params", settings); - settings = RetrySettings.newBuilder().setRpcTimeoutMultiplier(1.0).build(); - definitions.put("no_retry_params", settings); - settings = - RetrySettings.newBuilder() - .setInitialRpcTimeout(Duration.ofMillis(220000L)) - .setRpcTimeoutMultiplier(1.0) - .setMaxRpcTimeout(Duration.ofMillis(220000L)) - .setTotalTimeout(Duration.ofMillis(220000L)) - .build(); - definitions.put("no_retry_1_params", settings); + definitions.put("retry_policy_0_params", settings); RETRY_PARAM_DEFINITIONS = definitions.build(); } protected Builder() { - this((ClientContext) null); + this(((ClientContext) null)); } protected Builder(ClientContext clientContext) { @@ -385,13 +359,9 @@ protected Builder(ClientContext clientContext) { listTransitionRouteGroupsSettings = PagedCallSettings.newBuilder(LIST_TRANSITION_ROUTE_GROUPS_PAGE_STR_FACT); - getTransitionRouteGroupSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); - createTransitionRouteGroupSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); - updateTransitionRouteGroupSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); - deleteTransitionRouteGroupSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); unaryMethodSettingsBuilders = @@ -401,68 +371,68 @@ protected Builder(ClientContext clientContext) { createTransitionRouteGroupSettings, updateTransitionRouteGroupSettings, deleteTransitionRouteGroupSettings); - initDefaults(this); } + protected Builder(TransitionRouteGroupsStubSettings settings) { + super(settings); + + listTransitionRouteGroupsSettings = settings.listTransitionRouteGroupsSettings.toBuilder(); + getTransitionRouteGroupSettings = settings.getTransitionRouteGroupSettings.toBuilder(); + createTransitionRouteGroupSettings = settings.createTransitionRouteGroupSettings.toBuilder(); + updateTransitionRouteGroupSettings = settings.updateTransitionRouteGroupSettings.toBuilder(); + deleteTransitionRouteGroupSettings = settings.deleteTransitionRouteGroupSettings.toBuilder(); + + unaryMethodSettingsBuilders = + ImmutableList.>of( + listTransitionRouteGroupsSettings, + getTransitionRouteGroupSettings, + createTransitionRouteGroupSettings, + updateTransitionRouteGroupSettings, + deleteTransitionRouteGroupSettings); + } + private static Builder createDefault() { - Builder builder = new Builder((ClientContext) null); + Builder builder = new Builder(((ClientContext) null)); + builder.setTransportChannelProvider(defaultTransportChannelProvider()); builder.setCredentialsProvider(defaultCredentialsProviderBuilder().build()); builder.setInternalHeaderProvider(defaultApiClientHeaderProviderBuilder().build()); builder.setEndpoint(getDefaultEndpoint()); + return initDefaults(builder); } private static Builder initDefaults(Builder builder) { - builder .listTransitionRouteGroupsSettings() - .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_1_codes")) - .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_1_params")); + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params")); builder .getTransitionRouteGroupSettings() - .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_1_codes")) - .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_1_params")); + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params")); builder .createTransitionRouteGroupSettings() - .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_1_codes")) - .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_1_params")); + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params")); builder .updateTransitionRouteGroupSettings() - .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_1_codes")) - .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_1_params")); + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params")); builder .deleteTransitionRouteGroupSettings() - .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_1_codes")) - .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_1_params")); + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params")); return builder; } - protected Builder(TransitionRouteGroupsStubSettings settings) { - super(settings); - - listTransitionRouteGroupsSettings = settings.listTransitionRouteGroupsSettings.toBuilder(); - getTransitionRouteGroupSettings = settings.getTransitionRouteGroupSettings.toBuilder(); - createTransitionRouteGroupSettings = settings.createTransitionRouteGroupSettings.toBuilder(); - updateTransitionRouteGroupSettings = settings.updateTransitionRouteGroupSettings.toBuilder(); - deleteTransitionRouteGroupSettings = settings.deleteTransitionRouteGroupSettings.toBuilder(); - - unaryMethodSettingsBuilders = - ImmutableList.>of( - listTransitionRouteGroupsSettings, - getTransitionRouteGroupSettings, - createTransitionRouteGroupSettings, - updateTransitionRouteGroupSettings, - deleteTransitionRouteGroupSettings); - } - - // NEXT_MAJOR_VER: remove 'throws Exception' + // NEXT_MAJOR_VER: remove 'throws Exception'. /** * Applies the given settings updater function to all of the unary API methods in this service. * diff --git a/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3beta1/stub/VersionsStub.java b/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3beta1/stub/VersionsStub.java index c8f517ae4..3dcc0eb39 100644 --- a/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3beta1/stub/VersionsStub.java +++ b/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3beta1/stub/VersionsStub.java @@ -5,7 +5,7 @@ * 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 + * 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, @@ -13,11 +13,11 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.google.cloud.dialogflow.cx.v3beta1.stub; import static com.google.cloud.dialogflow.cx.v3beta1.VersionsClient.ListVersionsPagedResponse; -import com.google.api.core.BetaApi; import com.google.api.gax.core.BackgroundResource; import com.google.api.gax.rpc.OperationCallable; import com.google.api.gax.rpc.UnaryCallable; @@ -36,17 +36,15 @@ import com.google.protobuf.Struct; import javax.annotation.Generated; -// AUTO-GENERATED DOCUMENTATION AND CLASS +// AUTO-GENERATED DOCUMENTATION AND CLASS. /** - * Base stub class for Dialogflow API. + * Base stub class for the Versions service API. * *

This class is for advanced usage and reflects the underlying API directly. */ @Generated("by gapic-generator") -@BetaApi("A restructuring of stub classes is planned, so this may break in the future") public abstract class VersionsStub implements BackgroundResource { - @BetaApi("The surface for use by generated code is not stable yet and may change in the future.") public OperationsStub getOperationsStub() { throw new UnsupportedOperationException("Not implemented: getOperationsStub()"); } @@ -63,7 +61,6 @@ public UnaryCallable getVersionCallable() { throw new UnsupportedOperationException("Not implemented: getVersionCallable()"); } - @BetaApi("The surface for use by generated code is not stable yet and may change in the future.") public OperationCallable createVersionOperationCallable() { throw new UnsupportedOperationException("Not implemented: createVersionOperationCallable()"); @@ -81,7 +78,6 @@ public UnaryCallable deleteVersionCallable() { throw new UnsupportedOperationException("Not implemented: deleteVersionCallable()"); } - @BetaApi("The surface for use by generated code is not stable yet and may change in the future.") public OperationCallable loadVersionOperationCallable() { throw new UnsupportedOperationException("Not implemented: loadVersionOperationCallable()"); } diff --git a/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3beta1/stub/VersionsStubSettings.java b/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3beta1/stub/VersionsStubSettings.java index ea2ee7465..8c149dec2 100644 --- a/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3beta1/stub/VersionsStubSettings.java +++ b/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3beta1/stub/VersionsStubSettings.java @@ -5,7 +5,7 @@ * 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 + * 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, @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.google.cloud.dialogflow.cx.v3beta1.stub; import static com.google.cloud.dialogflow.cx.v3beta1.VersionsClient.ListVersionsPagedResponse; @@ -64,7 +65,7 @@ import javax.annotation.Generated; import org.threeten.bp.Duration; -// AUTO-GENERATED DOCUMENTATION AND CLASS +// AUTO-GENERATED DOCUMENTATION AND CLASS. /** * Settings class to configure an instance of {@link VersionsStub}. * @@ -81,22 +82,22 @@ * *

For example, to set the total timeout of getVersion to 30 seconds: * - *

- * 
- * VersionsStubSettings.Builder versionsSettingsBuilder =
- *     VersionsStubSettings.newBuilder();
+ * 
{@code
+ * VersionsStubSettings.Builder versionsSettingsBuilder = VersionsStubSettings.newBuilder();
  * versionsSettingsBuilder
  *     .getVersionSettings()
  *     .setRetrySettings(
- *         versionsSettingsBuilder.getVersionSettings().getRetrySettings().toBuilder()
+ *         versionsSettingsBuilder
+ *             .getVersionSettings()
+ *             .getRetrySettings()
+ *             .toBuilder()
  *             .setTotalTimeout(Duration.ofSeconds(30))
  *             .build());
  * VersionsStubSettings versionsSettings = versionsSettingsBuilder.build();
- * 
- * 
+ * }
*/ -@Generated("by gapic-generator") @BetaApi +@Generated("by gapic-generator-java") public class VersionsStubSettings extends StubSettings { /** The default scopes of the service. */ private static final ImmutableList DEFAULT_SERVICE_SCOPES = @@ -118,6 +119,59 @@ public class VersionsStubSettings extends StubSettings { private final OperationCallSettings loadVersionOperationSettings; + private static final PagedListDescriptor + LIST_VERSIONS_PAGE_STR_DESC = + new PagedListDescriptor() { + @Override + public String emptyToken() { + return ""; + } + + @Override + public ListVersionsRequest injectToken(ListVersionsRequest payload, String token) { + return ListVersionsRequest.newBuilder(payload).setPageToken(token).build(); + } + + @Override + public ListVersionsRequest injectPageSize(ListVersionsRequest payload, int pageSize) { + return ListVersionsRequest.newBuilder(payload).setPageSize(pageSize).build(); + } + + @Override + public Integer extractPageSize(ListVersionsRequest payload) { + return payload.getPageSize(); + } + + @Override + public String extractNextToken(ListVersionsResponse payload) { + return payload.getNextPageToken(); + } + + @Override + public Iterable extractResources(ListVersionsResponse payload) { + return payload.getVersionsList() == null + ? ImmutableList.of() + : payload.getVersionsList(); + } + }; + + private static final PagedListResponseFactory< + ListVersionsRequest, ListVersionsResponse, ListVersionsPagedResponse> + LIST_VERSIONS_PAGE_STR_FACT = + new PagedListResponseFactory< + ListVersionsRequest, ListVersionsResponse, ListVersionsPagedResponse>() { + @Override + public ApiFuture getFuturePagedResponse( + UnaryCallable callable, + ListVersionsRequest request, + ApiCallContext context, + ApiFuture futureResponse) { + PageContext pageContext = + PageContext.create(callable, LIST_VERSIONS_PAGE_STR_DESC, request, context); + return ListVersionsPagedResponse.createAsync(pageContext, futureResponse); + } + }; + /** Returns the object with the settings used for calls to listVersions. */ public PagedCallSettings listVersionsSettings() { @@ -135,7 +189,6 @@ public UnaryCallSettings createVersionSettings( } /** Returns the object with the settings used for calls to createVersion. */ - @BetaApi("The surface for use by generated code is not stable yet and may change in the future.") public OperationCallSettings createVersionOperationSettings() { return createVersionOperationSettings; @@ -157,7 +210,6 @@ public UnaryCallSettings loadVersionSettings() { } /** Returns the object with the settings used for calls to loadVersion. */ - @BetaApi("The surface for use by generated code is not stable yet and may change in the future.") public OperationCallSettings loadVersionOperationSettings() { return loadVersionOperationSettings; } @@ -168,10 +220,10 @@ public VersionsStub createStub() throws IOException { .getTransportName() .equals(GrpcTransportChannel.getGrpcTransportName())) { return GrpcVersionsStub.create(this); - } else { - throw new UnsupportedOperationException( - "Transport not supported: " + getTransportChannelProvider().getTransportName()); } + throw new UnsupportedOperationException( + String.format( + "Transport not supported: %s", getTransportChannelProvider().getTransportName())); } /** Returns a builder for the default ExecutorProvider for this service. */ @@ -240,63 +292,9 @@ protected VersionsStubSettings(Builder settingsBuilder) throws IOException { loadVersionOperationSettings = settingsBuilder.loadVersionOperationSettings().build(); } - private static final PagedListDescriptor - LIST_VERSIONS_PAGE_STR_DESC = - new PagedListDescriptor() { - @Override - public String emptyToken() { - return ""; - } - - @Override - public ListVersionsRequest injectToken(ListVersionsRequest payload, String token) { - return ListVersionsRequest.newBuilder(payload).setPageToken(token).build(); - } - - @Override - public ListVersionsRequest injectPageSize(ListVersionsRequest payload, int pageSize) { - return ListVersionsRequest.newBuilder(payload).setPageSize(pageSize).build(); - } - - @Override - public Integer extractPageSize(ListVersionsRequest payload) { - return payload.getPageSize(); - } - - @Override - public String extractNextToken(ListVersionsResponse payload) { - return payload.getNextPageToken(); - } - - @Override - public Iterable extractResources(ListVersionsResponse payload) { - return payload.getVersionsList() != null - ? payload.getVersionsList() - : ImmutableList.of(); - } - }; - - private static final PagedListResponseFactory< - ListVersionsRequest, ListVersionsResponse, ListVersionsPagedResponse> - LIST_VERSIONS_PAGE_STR_FACT = - new PagedListResponseFactory< - ListVersionsRequest, ListVersionsResponse, ListVersionsPagedResponse>() { - @Override - public ApiFuture getFuturePagedResponse( - UnaryCallable callable, - ListVersionsRequest request, - ApiCallContext context, - ApiFuture futureResponse) { - PageContext pageContext = - PageContext.create(callable, LIST_VERSIONS_PAGE_STR_DESC, request, context); - return ListVersionsPagedResponse.createAsync(pageContext, futureResponse); - } - }; - /** Builder for VersionsStubSettings. */ public static class Builder extends StubSettings.Builder { private final ImmutableList> unaryMethodSettingsBuilders; - private final PagedCallSettings.Builder< ListVersionsRequest, ListVersionsResponse, ListVersionsPagedResponse> listVersionsSettings; @@ -310,7 +308,6 @@ public static class Builder extends StubSettings.Builder loadVersionSettings; private final OperationCallSettings.Builder loadVersionOperationSettings; - private static final ImmutableMap> RETRYABLE_CODE_DEFINITIONS; @@ -318,14 +315,8 @@ public static class Builder extends StubSettings.Builder> definitions = ImmutableMap.builder(); definitions.put( - "retry_policy_1_codes", + "retry_policy_0_codes", ImmutableSet.copyOf(Lists.newArrayList(StatusCode.Code.UNAVAILABLE))); - definitions.put("no_retry_codes", ImmutableSet.copyOf(Lists.newArrayList())); - definitions.put( - "retry_policy_2_codes", - ImmutableSet.copyOf(Lists.newArrayList(StatusCode.Code.UNAVAILABLE))); - definitions.put( - "no_retry_1_codes", ImmutableSet.copyOf(Lists.newArrayList())); RETRYABLE_CODE_DEFINITIONS = definitions.build(); } @@ -344,52 +335,24 @@ public static class Builder extends StubSettings.Builder>of( + listVersionsSettings, + getVersionSettings, + createVersionSettings, + updateVersionSettings, + deleteVersionSettings, + loadVersionSettings); + } + private static Builder createDefault() { - Builder builder = new Builder((ClientContext) null); + Builder builder = new Builder(((ClientContext) null)); + builder.setTransportChannelProvider(defaultTransportChannelProvider()); builder.setCredentialsProvider(defaultCredentialsProviderBuilder().build()); builder.setInternalHeaderProvider(defaultApiClientHeaderProviderBuilder().build()); builder.setEndpoint(getDefaultEndpoint()); + return initDefaults(builder); } private static Builder initDefaults(Builder builder) { - builder .listVersionsSettings() - .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_1_codes")) - .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_1_params")); + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params")); builder .getVersionSettings() - .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_1_codes")) - .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_1_params")); + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params")); builder .createVersionSettings() - .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_1_codes")) - .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_1_params")); + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params")); builder .updateVersionSettings() - .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_1_codes")) - .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_1_params")); + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params")); builder .deleteVersionSettings() - .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_1_codes")) - .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_1_params")); + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params")); builder .loadVersionSettings() - .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_1_codes")) - .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_1_params")); + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params")); + builder .createVersionOperationSettings() .setInitialCallSettings( UnaryCallSettings .newUnaryCallSettingsBuilder() - .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_1_codes")) - .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_1_params")) + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params")) .build()) .setResponseTransformer( ProtoOperationTransformers.ResponseTransformer.create(Version.class)) @@ -460,20 +446,21 @@ private static Builder initDefaults(Builder builder) { .setPollingAlgorithm( OperationTimedPollAlgorithm.create( RetrySettings.newBuilder() - .setInitialRetryDelay(Duration.ofMillis(500L)) + .setInitialRetryDelay(Duration.ofMillis(5000L)) .setRetryDelayMultiplier(1.5) - .setMaxRetryDelay(Duration.ofMillis(5000L)) - .setInitialRpcTimeout(Duration.ZERO) // ignored - .setRpcTimeoutMultiplier(1.0) // ignored - .setMaxRpcTimeout(Duration.ZERO) // ignored + .setMaxRetryDelay(Duration.ofMillis(45000L)) + .setInitialRpcTimeout(Duration.ZERO) + .setRpcTimeoutMultiplier(1.0) + .setMaxRpcTimeout(Duration.ZERO) .setTotalTimeout(Duration.ofMillis(300000L)) .build())); + builder .loadVersionOperationSettings() .setInitialCallSettings( UnaryCallSettings.newUnaryCallSettingsBuilder() - .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_1_codes")) - .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_1_params")) + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params")) .build()) .setResponseTransformer( ProtoOperationTransformers.ResponseTransformer.create(Empty.class)) @@ -482,41 +469,19 @@ private static Builder initDefaults(Builder builder) { .setPollingAlgorithm( OperationTimedPollAlgorithm.create( RetrySettings.newBuilder() - .setInitialRetryDelay(Duration.ofMillis(500L)) + .setInitialRetryDelay(Duration.ofMillis(5000L)) .setRetryDelayMultiplier(1.5) - .setMaxRetryDelay(Duration.ofMillis(5000L)) - .setInitialRpcTimeout(Duration.ZERO) // ignored - .setRpcTimeoutMultiplier(1.0) // ignored - .setMaxRpcTimeout(Duration.ZERO) // ignored + .setMaxRetryDelay(Duration.ofMillis(45000L)) + .setInitialRpcTimeout(Duration.ZERO) + .setRpcTimeoutMultiplier(1.0) + .setMaxRpcTimeout(Duration.ZERO) .setTotalTimeout(Duration.ofMillis(300000L)) .build())); return builder; } - protected Builder(VersionsStubSettings settings) { - super(settings); - - listVersionsSettings = settings.listVersionsSettings.toBuilder(); - getVersionSettings = settings.getVersionSettings.toBuilder(); - createVersionSettings = settings.createVersionSettings.toBuilder(); - createVersionOperationSettings = settings.createVersionOperationSettings.toBuilder(); - updateVersionSettings = settings.updateVersionSettings.toBuilder(); - deleteVersionSettings = settings.deleteVersionSettings.toBuilder(); - loadVersionSettings = settings.loadVersionSettings.toBuilder(); - loadVersionOperationSettings = settings.loadVersionOperationSettings.toBuilder(); - - unaryMethodSettingsBuilders = - ImmutableList.>of( - listVersionsSettings, - getVersionSettings, - createVersionSettings, - updateVersionSettings, - deleteVersionSettings, - loadVersionSettings); - } - - // NEXT_MAJOR_VER: remove 'throws Exception' + // NEXT_MAJOR_VER: remove 'throws Exception'. /** * Applies the given settings updater function to all of the unary API methods in this service. * diff --git a/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3beta1/stub/WebhooksStub.java b/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3beta1/stub/WebhooksStub.java index e0c1fdeb4..cd7ddb77a 100644 --- a/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3beta1/stub/WebhooksStub.java +++ b/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3beta1/stub/WebhooksStub.java @@ -5,7 +5,7 @@ * 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 + * 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, @@ -13,11 +13,11 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.google.cloud.dialogflow.cx.v3beta1.stub; import static com.google.cloud.dialogflow.cx.v3beta1.WebhooksClient.ListWebhooksPagedResponse; -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.cx.v3beta1.CreateWebhookRequest; @@ -30,14 +30,13 @@ import com.google.protobuf.Empty; import javax.annotation.Generated; -// AUTO-GENERATED DOCUMENTATION AND CLASS +// AUTO-GENERATED DOCUMENTATION AND CLASS. /** - * Base stub class for Dialogflow API. + * Base stub class for the Webhooks service API. * *

This class is for advanced usage and reflects the underlying API directly. */ @Generated("by gapic-generator") -@BetaApi("A restructuring of stub classes is planned, so this may break in the future") public abstract class WebhooksStub implements BackgroundResource { public UnaryCallable listWebhooksPagedCallable() { diff --git a/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3beta1/stub/WebhooksStubSettings.java b/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3beta1/stub/WebhooksStubSettings.java index a898bec2d..3cfb9e995 100644 --- a/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3beta1/stub/WebhooksStubSettings.java +++ b/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3beta1/stub/WebhooksStubSettings.java @@ -5,7 +5,7 @@ * 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 + * 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, @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.google.cloud.dialogflow.cx.v3beta1.stub; import static com.google.cloud.dialogflow.cx.v3beta1.WebhooksClient.ListWebhooksPagedResponse; @@ -56,7 +57,7 @@ import javax.annotation.Generated; import org.threeten.bp.Duration; -// AUTO-GENERATED DOCUMENTATION AND CLASS +// AUTO-GENERATED DOCUMENTATION AND CLASS. /** * Settings class to configure an instance of {@link WebhooksStub}. * @@ -73,22 +74,22 @@ * *

For example, to set the total timeout of getWebhook to 30 seconds: * - *

- * 
- * WebhooksStubSettings.Builder webhooksSettingsBuilder =
- *     WebhooksStubSettings.newBuilder();
+ * 
{@code
+ * WebhooksStubSettings.Builder webhooksSettingsBuilder = WebhooksStubSettings.newBuilder();
  * webhooksSettingsBuilder
  *     .getWebhookSettings()
  *     .setRetrySettings(
- *         webhooksSettingsBuilder.getWebhookSettings().getRetrySettings().toBuilder()
+ *         webhooksSettingsBuilder
+ *             .getWebhookSettings()
+ *             .getRetrySettings()
+ *             .toBuilder()
  *             .setTotalTimeout(Duration.ofSeconds(30))
  *             .build());
  * WebhooksStubSettings webhooksSettings = webhooksSettingsBuilder.build();
- * 
- * 
+ * }
*/ -@Generated("by gapic-generator") @BetaApi +@Generated("by gapic-generator-java") public class WebhooksStubSettings extends StubSettings { /** The default scopes of the service. */ private static final ImmutableList DEFAULT_SERVICE_SCOPES = @@ -105,6 +106,59 @@ public class WebhooksStubSettings extends StubSettings { private final UnaryCallSettings updateWebhookSettings; private final UnaryCallSettings deleteWebhookSettings; + private static final PagedListDescriptor + LIST_WEBHOOKS_PAGE_STR_DESC = + new PagedListDescriptor() { + @Override + public String emptyToken() { + return ""; + } + + @Override + public ListWebhooksRequest injectToken(ListWebhooksRequest payload, String token) { + return ListWebhooksRequest.newBuilder(payload).setPageToken(token).build(); + } + + @Override + public ListWebhooksRequest injectPageSize(ListWebhooksRequest payload, int pageSize) { + return ListWebhooksRequest.newBuilder(payload).setPageSize(pageSize).build(); + } + + @Override + public Integer extractPageSize(ListWebhooksRequest payload) { + return payload.getPageSize(); + } + + @Override + public String extractNextToken(ListWebhooksResponse payload) { + return payload.getNextPageToken(); + } + + @Override + public Iterable extractResources(ListWebhooksResponse payload) { + return payload.getWebhooksList() == null + ? ImmutableList.of() + : payload.getWebhooksList(); + } + }; + + private static final PagedListResponseFactory< + ListWebhooksRequest, ListWebhooksResponse, ListWebhooksPagedResponse> + LIST_WEBHOOKS_PAGE_STR_FACT = + new PagedListResponseFactory< + ListWebhooksRequest, ListWebhooksResponse, ListWebhooksPagedResponse>() { + @Override + public ApiFuture getFuturePagedResponse( + UnaryCallable callable, + ListWebhooksRequest request, + ApiCallContext context, + ApiFuture futureResponse) { + PageContext pageContext = + PageContext.create(callable, LIST_WEBHOOKS_PAGE_STR_DESC, request, context); + return ListWebhooksPagedResponse.createAsync(pageContext, futureResponse); + } + }; + /** Returns the object with the settings used for calls to listWebhooks. */ public PagedCallSettings listWebhooksSettings() { @@ -137,10 +191,10 @@ public WebhooksStub createStub() throws IOException { .getTransportName() .equals(GrpcTransportChannel.getGrpcTransportName())) { return GrpcWebhooksStub.create(this); - } else { - throw new UnsupportedOperationException( - "Transport not supported: " + getTransportChannelProvider().getTransportName()); } + throw new UnsupportedOperationException( + String.format( + "Transport not supported: %s", getTransportChannelProvider().getTransportName())); } /** Returns a builder for the default ExecutorProvider for this service. */ @@ -206,63 +260,9 @@ protected WebhooksStubSettings(Builder settingsBuilder) throws IOException { deleteWebhookSettings = settingsBuilder.deleteWebhookSettings().build(); } - private static final PagedListDescriptor - LIST_WEBHOOKS_PAGE_STR_DESC = - new PagedListDescriptor() { - @Override - public String emptyToken() { - return ""; - } - - @Override - public ListWebhooksRequest injectToken(ListWebhooksRequest payload, String token) { - return ListWebhooksRequest.newBuilder(payload).setPageToken(token).build(); - } - - @Override - public ListWebhooksRequest injectPageSize(ListWebhooksRequest payload, int pageSize) { - return ListWebhooksRequest.newBuilder(payload).setPageSize(pageSize).build(); - } - - @Override - public Integer extractPageSize(ListWebhooksRequest payload) { - return payload.getPageSize(); - } - - @Override - public String extractNextToken(ListWebhooksResponse payload) { - return payload.getNextPageToken(); - } - - @Override - public Iterable extractResources(ListWebhooksResponse payload) { - return payload.getWebhooksList() != null - ? payload.getWebhooksList() - : ImmutableList.of(); - } - }; - - private static final PagedListResponseFactory< - ListWebhooksRequest, ListWebhooksResponse, ListWebhooksPagedResponse> - LIST_WEBHOOKS_PAGE_STR_FACT = - new PagedListResponseFactory< - ListWebhooksRequest, ListWebhooksResponse, ListWebhooksPagedResponse>() { - @Override - public ApiFuture getFuturePagedResponse( - UnaryCallable callable, - ListWebhooksRequest request, - ApiCallContext context, - ApiFuture futureResponse) { - PageContext pageContext = - PageContext.create(callable, LIST_WEBHOOKS_PAGE_STR_DESC, request, context); - return ListWebhooksPagedResponse.createAsync(pageContext, futureResponse); - } - }; - /** Builder for WebhooksStubSettings. */ public static class Builder extends StubSettings.Builder { private final ImmutableList> unaryMethodSettingsBuilders; - private final PagedCallSettings.Builder< ListWebhooksRequest, ListWebhooksResponse, ListWebhooksPagedResponse> listWebhooksSettings; @@ -270,7 +270,6 @@ public static class Builder extends StubSettings.Builder createWebhookSettings; private final UnaryCallSettings.Builder updateWebhookSettings; private final UnaryCallSettings.Builder deleteWebhookSettings; - private static final ImmutableMap> RETRYABLE_CODE_DEFINITIONS; @@ -278,14 +277,8 @@ public static class Builder extends StubSettings.Builder> definitions = ImmutableMap.builder(); definitions.put( - "retry_policy_1_codes", + "retry_policy_0_codes", ImmutableSet.copyOf(Lists.newArrayList(StatusCode.Code.UNAVAILABLE))); - definitions.put("no_retry_codes", ImmutableSet.copyOf(Lists.newArrayList())); - definitions.put( - "retry_policy_2_codes", - ImmutableSet.copyOf(Lists.newArrayList(StatusCode.Code.UNAVAILABLE))); - definitions.put( - "no_retry_1_codes", ImmutableSet.copyOf(Lists.newArrayList())); RETRYABLE_CODE_DEFINITIONS = definitions.build(); } @@ -304,46 +297,21 @@ public static class Builder extends StubSettings.Builder>of( + listWebhooksSettings, + getWebhookSettings, + createWebhookSettings, + updateWebhookSettings, + deleteWebhookSettings); + } + private static Builder createDefault() { - Builder builder = new Builder((ClientContext) null); + Builder builder = new Builder(((ClientContext) null)); + builder.setTransportChannelProvider(defaultTransportChannelProvider()); builder.setCredentialsProvider(defaultCredentialsProviderBuilder().build()); builder.setInternalHeaderProvider(defaultApiClientHeaderProviderBuilder().build()); builder.setEndpoint(getDefaultEndpoint()); + return initDefaults(builder); } private static Builder initDefaults(Builder builder) { - builder .listWebhooksSettings() - .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_1_codes")) - .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_1_params")); + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params")); builder .getWebhookSettings() - .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_1_codes")) - .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_1_params")); + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params")); builder .createWebhookSettings() - .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_1_codes")) - .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_1_params")); + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params")); builder .updateWebhookSettings() - .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_1_codes")) - .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_1_params")); + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params")); builder .deleteWebhookSettings() - .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_1_codes")) - .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_1_params")); + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params")); return builder; } - protected Builder(WebhooksStubSettings settings) { - super(settings); - - listWebhooksSettings = settings.listWebhooksSettings.toBuilder(); - getWebhookSettings = settings.getWebhookSettings.toBuilder(); - createWebhookSettings = settings.createWebhookSettings.toBuilder(); - updateWebhookSettings = settings.updateWebhookSettings.toBuilder(); - deleteWebhookSettings = settings.deleteWebhookSettings.toBuilder(); - - unaryMethodSettingsBuilders = - ImmutableList.>of( - listWebhooksSettings, - getWebhookSettings, - createWebhookSettings, - updateWebhookSettings, - deleteWebhookSettings); - } - - // NEXT_MAJOR_VER: remove 'throws Exception' + // NEXT_MAJOR_VER: remove 'throws Exception'. /** * Applies the given settings updater function to all of the unary API methods in this service. * diff --git a/google-cloud-dialogflow-cx/src/test/java/com/google/cloud/dialogflow/cx/v3/AgentsClientTest.java b/google-cloud-dialogflow-cx/src/test/java/com/google/cloud/dialogflow/cx/v3/AgentsClientTest.java index 0e7a52d60..262bea6e2 100644 --- a/google-cloud-dialogflow-cx/src/test/java/com/google/cloud/dialogflow/cx/v3/AgentsClientTest.java +++ b/google-cloud-dialogflow-cx/src/test/java/com/google/cloud/dialogflow/cx/v3/AgentsClientTest.java @@ -5,7 +5,7 @@ * 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 + * 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, @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.google.cloud.dialogflow.cx.v3; import static com.google.cloud.dialogflow.cx.v3.AgentsClient.ListAgentsPagedResponse; @@ -31,13 +32,13 @@ import com.google.protobuf.Any; import com.google.protobuf.Empty; import com.google.protobuf.FieldMask; -import io.grpc.Status; import io.grpc.StatusRuntimeException; import java.io.IOException; import java.util.Arrays; import java.util.List; import java.util.UUID; import java.util.concurrent.ExecutionException; +import javax.annotation.Generated; import org.junit.After; import org.junit.AfterClass; import org.junit.Assert; @@ -45,66 +46,31 @@ import org.junit.BeforeClass; import org.junit.Test; -@javax.annotation.Generated("by GAPIC") +@Generated("by gapic-generator-java") public class AgentsClientTest { - private static MockPages mockPages; - private static MockFlows mockFlows; - private static MockAgents mockAgents; - private static MockEntityTypes mockEntityTypes; - private static MockEnvironments mockEnvironments; - private static MockIntents mockIntents; - private static MockSecuritySettingsService mockSecuritySettingsService; - private static MockSessionEntityTypes mockSessionEntityTypes; - private static MockSessions mockSessions; - private static MockTransitionRouteGroups mockTransitionRouteGroups; - private static MockVersions mockVersions; - private static MockWebhooks mockWebhooks; - private static MockServiceHelper serviceHelper; + private static MockServiceHelper mockServiceHelper; private AgentsClient client; + private static MockAgents mockAgents; private LocalChannelProvider channelProvider; @BeforeClass public static void startStaticServer() { - mockPages = new MockPages(); - mockFlows = new MockFlows(); mockAgents = new MockAgents(); - mockEntityTypes = new MockEntityTypes(); - mockEnvironments = new MockEnvironments(); - mockIntents = new MockIntents(); - mockSecuritySettingsService = new MockSecuritySettingsService(); - mockSessionEntityTypes = new MockSessionEntityTypes(); - mockSessions = new MockSessions(); - mockTransitionRouteGroups = new MockTransitionRouteGroups(); - mockVersions = new MockVersions(); - mockWebhooks = new MockWebhooks(); - serviceHelper = + mockServiceHelper = new MockServiceHelper( - UUID.randomUUID().toString(), - Arrays.asList( - mockPages, - mockFlows, - mockAgents, - mockEntityTypes, - mockEnvironments, - mockIntents, - mockSecuritySettingsService, - mockSessionEntityTypes, - mockSessions, - mockTransitionRouteGroups, - mockVersions, - mockWebhooks)); - serviceHelper.start(); + UUID.randomUUID().toString(), Arrays.asList(mockAgents)); + mockServiceHelper.start(); } @AfterClass public static void stopServer() { - serviceHelper.stop(); + mockServiceHelper.stop(); } @Before public void setUp() throws IOException { - serviceHelper.reset(); - channelProvider = serviceHelper.createChannelProvider(); + mockServiceHelper.reset(); + channelProvider = mockServiceHelper.createChannelProvider(); AgentsSettings settings = AgentsSettings.newBuilder() .setTransportChannelProvider(channelProvider) @@ -119,15 +85,12 @@ public void tearDown() throws Exception { } @Test - @SuppressWarnings("all") - public void listAgentsTest() { - String nextPageToken = ""; - Agent agentsElement = Agent.newBuilder().build(); - List agents = Arrays.asList(agentsElement); + public void listAgentsTest() throws Exception { + Agent responsesElement = Agent.newBuilder().build(); ListAgentsResponse expectedResponse = ListAgentsResponse.newBuilder() - .setNextPageToken(nextPageToken) - .addAllAgents(agents) + .setNextPageToken("") + .addAllAgents(Arrays.asList(responsesElement)) .build(); mockAgents.addResponse(expectedResponse); @@ -136,14 +99,15 @@ public void listAgentsTest() { ListAgentsPagedResponse pagedListResponse = client.listAgents(parent); List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + Assert.assertEquals(1, resources.size()); Assert.assertEquals(expectedResponse.getAgentsList().get(0), resources.get(0)); List actualRequests = mockAgents.getRequests(); Assert.assertEquals(1, actualRequests.size()); - ListAgentsRequest actualRequest = (ListAgentsRequest) actualRequests.get(0); + ListAgentsRequest actualRequest = ((ListAgentsRequest) actualRequests.get(0)); - Assert.assertEquals(parent, LocationName.parse(actualRequest.getParent())); + Assert.assertEquals(parent.toString(), actualRequest.getParent()); Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), @@ -151,44 +115,77 @@ public void listAgentsTest() { } @Test - @SuppressWarnings("all") public void listAgentsExceptionTest() throws Exception { - StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockAgents.addException(exception); try { LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); + client.listAgents(parent); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void listAgentsTest2() throws Exception { + Agent responsesElement = Agent.newBuilder().build(); + ListAgentsResponse expectedResponse = + ListAgentsResponse.newBuilder() + .setNextPageToken("") + .addAllAgents(Arrays.asList(responsesElement)) + .build(); + mockAgents.addResponse(expectedResponse); + + String parent = "parent-995424086"; + + ListAgentsPagedResponse pagedListResponse = client.listAgents(parent); + + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getAgentsList().get(0), resources.get(0)); + + List actualRequests = mockAgents.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + ListAgentsRequest actualRequest = ((ListAgentsRequest) actualRequests.get(0)); + + Assert.assertEquals(parent, actualRequest.getParent()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void listAgentsExceptionTest2() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockAgents.addException(exception); + try { + String parent = "parent-995424086"; client.listAgents(parent); Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { - // Expected exception + // Expected exception. } } @Test - @SuppressWarnings("all") - public void getAgentTest() { - AgentName name2 = AgentName.of("[PROJECT]", "[LOCATION]", "[AGENT]"); - String displayName = "displayName1615086568"; - String defaultLanguageCode = "defaultLanguageCode856575222"; - String timeZone = "timeZone36848094"; - String description = "description-1724546052"; - String avatarUri = "avatarUri-402824826"; - FlowName startFlow = FlowName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]"); - boolean enableStackdriverLogging = true; - boolean enableSpellCorrection = false; + public void getAgentTest() throws Exception { Agent expectedResponse = Agent.newBuilder() - .setName(name2.toString()) - .setDisplayName(displayName) - .setDefaultLanguageCode(defaultLanguageCode) - .setTimeZone(timeZone) - .setDescription(description) - .setAvatarUri(avatarUri) - .setStartFlow(startFlow.toString()) - .setEnableStackdriverLogging(enableStackdriverLogging) - .setEnableSpellCorrection(enableSpellCorrection) + .setName(AgentName.of("[PROJECT]", "[LOCATION]", "[AGENT]").toString()) + .setDisplayName("displayName1714148973") + .setDefaultLanguageCode("defaultLanguageCode2069633606") + .setTimeZone("timeZone-2077180903") + .setDescription("description-1724546052") + .setAvatarUri("avatarUri-428646061") + .setSpeechToTextSettings(SpeechToTextSettings.newBuilder().build()) + .setStartFlow(FlowName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]").toString()) + .setEnableStackdriverLogging(true) + .setEnableSpellCorrection(true) .build(); mockAgents.addResponse(expectedResponse); @@ -199,9 +196,9 @@ public void getAgentTest() { List actualRequests = mockAgents.getRequests(); Assert.assertEquals(1, actualRequests.size()); - GetAgentRequest actualRequest = (GetAgentRequest) actualRequests.get(0); + GetAgentRequest actualRequest = ((GetAgentRequest) actualRequests.get(0)); - Assert.assertEquals(name, AgentName.parse(actualRequest.getName())); + Assert.assertEquals(name.toString(), actualRequest.getName()); Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), @@ -209,44 +206,80 @@ public void getAgentTest() { } @Test - @SuppressWarnings("all") public void getAgentExceptionTest() throws Exception { - StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockAgents.addException(exception); try { AgentName name = AgentName.of("[PROJECT]", "[LOCATION]", "[AGENT]"); + client.getAgent(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + @Test + public void getAgentTest2() throws Exception { + Agent expectedResponse = + Agent.newBuilder() + .setName(AgentName.of("[PROJECT]", "[LOCATION]", "[AGENT]").toString()) + .setDisplayName("displayName1714148973") + .setDefaultLanguageCode("defaultLanguageCode2069633606") + .setTimeZone("timeZone-2077180903") + .setDescription("description-1724546052") + .setAvatarUri("avatarUri-428646061") + .setSpeechToTextSettings(SpeechToTextSettings.newBuilder().build()) + .setStartFlow(FlowName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]").toString()) + .setEnableStackdriverLogging(true) + .setEnableSpellCorrection(true) + .build(); + mockAgents.addResponse(expectedResponse); + + String name = "name3373707"; + + Agent actualResponse = client.getAgent(name); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockAgents.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + GetAgentRequest actualRequest = ((GetAgentRequest) actualRequests.get(0)); + + Assert.assertEquals(name, actualRequest.getName()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void getAgentExceptionTest2() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockAgents.addException(exception); + + try { + String name = "name3373707"; client.getAgent(name); Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { - // Expected exception + // Expected exception. } } @Test - @SuppressWarnings("all") - public void createAgentTest() { - AgentName name = AgentName.of("[PROJECT]", "[LOCATION]", "[AGENT]"); - String displayName = "displayName1615086568"; - String defaultLanguageCode = "defaultLanguageCode856575222"; - String timeZone = "timeZone36848094"; - String description = "description-1724546052"; - String avatarUri = "avatarUri-402824826"; - FlowName startFlow = FlowName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]"); - boolean enableStackdriverLogging = true; - boolean enableSpellCorrection = false; + public void createAgentTest() throws Exception { Agent expectedResponse = Agent.newBuilder() - .setName(name.toString()) - .setDisplayName(displayName) - .setDefaultLanguageCode(defaultLanguageCode) - .setTimeZone(timeZone) - .setDescription(description) - .setAvatarUri(avatarUri) - .setStartFlow(startFlow.toString()) - .setEnableStackdriverLogging(enableStackdriverLogging) - .setEnableSpellCorrection(enableSpellCorrection) + .setName(AgentName.of("[PROJECT]", "[LOCATION]", "[AGENT]").toString()) + .setDisplayName("displayName1714148973") + .setDefaultLanguageCode("defaultLanguageCode2069633606") + .setTimeZone("timeZone-2077180903") + .setDescription("description-1724546052") + .setAvatarUri("avatarUri-428646061") + .setSpeechToTextSettings(SpeechToTextSettings.newBuilder().build()) + .setStartFlow(FlowName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]").toString()) + .setEnableStackdriverLogging(true) + .setEnableSpellCorrection(true) .build(); mockAgents.addResponse(expectedResponse); @@ -258,9 +291,9 @@ public void createAgentTest() { List actualRequests = mockAgents.getRequests(); Assert.assertEquals(1, actualRequests.size()); - CreateAgentRequest actualRequest = (CreateAgentRequest) actualRequests.get(0); + CreateAgentRequest actualRequest = ((CreateAgentRequest) actualRequests.get(0)); - Assert.assertEquals(parent, LocationName.parse(actualRequest.getParent())); + Assert.assertEquals(parent.toString(), actualRequest.getParent()); Assert.assertEquals(agent, actualRequest.getAgent()); Assert.assertTrue( channelProvider.isHeaderSent( @@ -269,45 +302,84 @@ public void createAgentTest() { } @Test - @SuppressWarnings("all") public void createAgentExceptionTest() throws Exception { - StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockAgents.addException(exception); try { LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); Agent agent = Agent.newBuilder().build(); + client.createAgent(parent, agent); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + @Test + public void createAgentTest2() throws Exception { + Agent expectedResponse = + Agent.newBuilder() + .setName(AgentName.of("[PROJECT]", "[LOCATION]", "[AGENT]").toString()) + .setDisplayName("displayName1714148973") + .setDefaultLanguageCode("defaultLanguageCode2069633606") + .setTimeZone("timeZone-2077180903") + .setDescription("description-1724546052") + .setAvatarUri("avatarUri-428646061") + .setSpeechToTextSettings(SpeechToTextSettings.newBuilder().build()) + .setStartFlow(FlowName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]").toString()) + .setEnableStackdriverLogging(true) + .setEnableSpellCorrection(true) + .build(); + mockAgents.addResponse(expectedResponse); + + String parent = "parent-995424086"; + Agent agent = Agent.newBuilder().build(); + + Agent actualResponse = client.createAgent(parent, agent); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockAgents.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + CreateAgentRequest actualRequest = ((CreateAgentRequest) actualRequests.get(0)); + + Assert.assertEquals(parent, actualRequest.getParent()); + Assert.assertEquals(agent, actualRequest.getAgent()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void createAgentExceptionTest2() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockAgents.addException(exception); + + try { + String parent = "parent-995424086"; + Agent agent = Agent.newBuilder().build(); client.createAgent(parent, agent); Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { - // Expected exception + // Expected exception. } } @Test - @SuppressWarnings("all") - public void updateAgentTest() { - AgentName name = AgentName.of("[PROJECT]", "[LOCATION]", "[AGENT]"); - String displayName = "displayName1615086568"; - String defaultLanguageCode = "defaultLanguageCode856575222"; - String timeZone = "timeZone36848094"; - String description = "description-1724546052"; - String avatarUri = "avatarUri-402824826"; - FlowName startFlow = FlowName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]"); - boolean enableStackdriverLogging = true; - boolean enableSpellCorrection = false; + public void updateAgentTest() throws Exception { Agent expectedResponse = Agent.newBuilder() - .setName(name.toString()) - .setDisplayName(displayName) - .setDefaultLanguageCode(defaultLanguageCode) - .setTimeZone(timeZone) - .setDescription(description) - .setAvatarUri(avatarUri) - .setStartFlow(startFlow.toString()) - .setEnableStackdriverLogging(enableStackdriverLogging) - .setEnableSpellCorrection(enableSpellCorrection) + .setName(AgentName.of("[PROJECT]", "[LOCATION]", "[AGENT]").toString()) + .setDisplayName("displayName1714148973") + .setDefaultLanguageCode("defaultLanguageCode2069633606") + .setTimeZone("timeZone-2077180903") + .setDescription("description-1724546052") + .setAvatarUri("avatarUri-428646061") + .setSpeechToTextSettings(SpeechToTextSettings.newBuilder().build()) + .setStartFlow(FlowName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]").toString()) + .setEnableStackdriverLogging(true) + .setEnableSpellCorrection(true) .build(); mockAgents.addResponse(expectedResponse); @@ -319,7 +391,7 @@ public void updateAgentTest() { List actualRequests = mockAgents.getRequests(); Assert.assertEquals(1, actualRequests.size()); - UpdateAgentRequest actualRequest = (UpdateAgentRequest) actualRequests.get(0); + UpdateAgentRequest actualRequest = ((UpdateAgentRequest) actualRequests.get(0)); Assert.assertEquals(agent, actualRequest.getAgent()); Assert.assertEquals(updateMask, actualRequest.getUpdateMask()); @@ -330,25 +402,22 @@ public void updateAgentTest() { } @Test - @SuppressWarnings("all") public void updateAgentExceptionTest() throws Exception { - StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockAgents.addException(exception); try { Agent agent = Agent.newBuilder().build(); FieldMask updateMask = FieldMask.newBuilder().build(); - client.updateAgent(agent, updateMask); Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { - // Expected exception + // Expected exception. } } @Test - @SuppressWarnings("all") - public void deleteAgentTest() { + public void deleteAgentTest() throws Exception { Empty expectedResponse = Empty.newBuilder().build(); mockAgents.addResponse(expectedResponse); @@ -358,9 +427,9 @@ public void deleteAgentTest() { List actualRequests = mockAgents.getRequests(); Assert.assertEquals(1, actualRequests.size()); - DeleteAgentRequest actualRequest = (DeleteAgentRequest) actualRequests.get(0); + DeleteAgentRequest actualRequest = ((DeleteAgentRequest) actualRequests.get(0)); - Assert.assertEquals(name, AgentName.parse(actualRequest.getName())); + Assert.assertEquals(name.toString(), actualRequest.getName()); Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), @@ -368,27 +437,56 @@ public void deleteAgentTest() { } @Test - @SuppressWarnings("all") public void deleteAgentExceptionTest() throws Exception { - StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockAgents.addException(exception); try { AgentName name = AgentName.of("[PROJECT]", "[LOCATION]", "[AGENT]"); + client.deleteAgent(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void deleteAgentTest2() throws Exception { + Empty expectedResponse = Empty.newBuilder().build(); + mockAgents.addResponse(expectedResponse); + + String name = "name3373707"; + client.deleteAgent(name); + + List actualRequests = mockAgents.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + DeleteAgentRequest actualRequest = ((DeleteAgentRequest) actualRequests.get(0)); + + Assert.assertEquals(name, actualRequest.getName()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void deleteAgentExceptionTest2() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockAgents.addException(exception); + + try { + String name = "name3373707"; client.deleteAgent(name); Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { - // Expected exception + // Expected exception. } } @Test - @SuppressWarnings("all") public void exportAgentTest() throws Exception { - String agentUri = "agentUri-1700713166"; - ExportAgentResponse expectedResponse = - ExportAgentResponse.newBuilder().setAgentUri(agentUri).build(); + ExportAgentResponse expectedResponse = ExportAgentResponse.newBuilder().build(); Operation resultOperation = Operation.newBuilder() .setName("exportAgentTest") @@ -397,17 +495,21 @@ public void exportAgentTest() throws Exception { .build(); mockAgents.addResponse(resultOperation); - AgentName name = AgentName.of("[PROJECT]", "[LOCATION]", "[AGENT]"); - ExportAgentRequest request = ExportAgentRequest.newBuilder().setName(name.toString()).build(); + ExportAgentRequest request = + ExportAgentRequest.newBuilder() + .setName(AgentName.of("[PROJECT]", "[LOCATION]", "[AGENT]").toString()) + .setAgentUri("agentUri1469149223") + .build(); ExportAgentResponse actualResponse = client.exportAgentAsync(request).get(); Assert.assertEquals(expectedResponse, actualResponse); List actualRequests = mockAgents.getRequests(); Assert.assertEquals(1, actualRequests.size()); - ExportAgentRequest actualRequest = (ExportAgentRequest) actualRequests.get(0); + ExportAgentRequest actualRequest = ((ExportAgentRequest) actualRequests.get(0)); - Assert.assertEquals(name, AgentName.parse(actualRequest.getName())); + Assert.assertEquals(request.getName(), actualRequest.getName()); + Assert.assertEquals(request.getAgentUri(), actualRequest.getAgentUri()); Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), @@ -415,26 +517,26 @@ public void exportAgentTest() throws Exception { } @Test - @SuppressWarnings("all") public void exportAgentExceptionTest() throws Exception { - StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockAgents.addException(exception); try { - AgentName name = AgentName.of("[PROJECT]", "[LOCATION]", "[AGENT]"); - ExportAgentRequest request = ExportAgentRequest.newBuilder().setName(name.toString()).build(); - + ExportAgentRequest request = + ExportAgentRequest.newBuilder() + .setName(AgentName.of("[PROJECT]", "[LOCATION]", "[AGENT]").toString()) + .setAgentUri("agentUri1469149223") + .build(); client.exportAgentAsync(request).get(); Assert.fail("No exception raised"); } catch (ExecutionException e) { Assert.assertEquals(InvalidArgumentException.class, e.getCause().getClass()); - InvalidArgumentException apiException = (InvalidArgumentException) e.getCause(); + InvalidArgumentException apiException = ((InvalidArgumentException) e.getCause()); Assert.assertEquals(StatusCode.Code.INVALID_ARGUMENT, apiException.getStatusCode().getCode()); } } @Test - @SuppressWarnings("all") public void restoreAgentTest() throws Exception { Empty expectedResponse = Empty.newBuilder().build(); Operation resultOperation = @@ -445,17 +547,20 @@ public void restoreAgentTest() throws Exception { .build(); mockAgents.addResponse(resultOperation); - AgentName name = AgentName.of("[PROJECT]", "[LOCATION]", "[AGENT]"); - RestoreAgentRequest request = RestoreAgentRequest.newBuilder().setName(name.toString()).build(); + RestoreAgentRequest request = + RestoreAgentRequest.newBuilder() + .setName(AgentName.of("[PROJECT]", "[LOCATION]", "[AGENT]").toString()) + .build(); - Empty actualResponse = client.restoreAgentAsync(request).get(); - Assert.assertEquals(expectedResponse, actualResponse); + client.restoreAgentAsync(request).get(); List actualRequests = mockAgents.getRequests(); Assert.assertEquals(1, actualRequests.size()); - RestoreAgentRequest actualRequest = (RestoreAgentRequest) actualRequests.get(0); + RestoreAgentRequest actualRequest = ((RestoreAgentRequest) actualRequests.get(0)); - Assert.assertEquals(name, AgentName.parse(actualRequest.getName())); + Assert.assertEquals(request.getName(), actualRequest.getName()); + Assert.assertEquals(request.getAgentUri(), actualRequest.getAgentUri()); + Assert.assertEquals(request.getAgentContent(), actualRequest.getAgentContent()); Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), @@ -463,21 +568,20 @@ public void restoreAgentTest() throws Exception { } @Test - @SuppressWarnings("all") public void restoreAgentExceptionTest() throws Exception { - StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockAgents.addException(exception); try { - AgentName name = AgentName.of("[PROJECT]", "[LOCATION]", "[AGENT]"); RestoreAgentRequest request = - RestoreAgentRequest.newBuilder().setName(name.toString()).build(); - + RestoreAgentRequest.newBuilder() + .setName(AgentName.of("[PROJECT]", "[LOCATION]", "[AGENT]").toString()) + .build(); client.restoreAgentAsync(request).get(); Assert.fail("No exception raised"); } catch (ExecutionException e) { Assert.assertEquals(InvalidArgumentException.class, e.getCause().getClass()); - InvalidArgumentException apiException = (InvalidArgumentException) e.getCause(); + InvalidArgumentException apiException = ((InvalidArgumentException) e.getCause()); Assert.assertEquals(StatusCode.Code.INVALID_ARGUMENT, apiException.getStatusCode().getCode()); } } diff --git a/google-cloud-dialogflow-cx/src/test/java/com/google/cloud/dialogflow/cx/v3/EntityTypesClientTest.java b/google-cloud-dialogflow-cx/src/test/java/com/google/cloud/dialogflow/cx/v3/EntityTypesClientTest.java index 711920b2a..db0cab2fa 100644 --- a/google-cloud-dialogflow-cx/src/test/java/com/google/cloud/dialogflow/cx/v3/EntityTypesClientTest.java +++ b/google-cloud-dialogflow-cx/src/test/java/com/google/cloud/dialogflow/cx/v3/EntityTypesClientTest.java @@ -5,7 +5,7 @@ * 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 + * 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, @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.google.cloud.dialogflow.cx.v3; import static com.google.cloud.dialogflow.cx.v3.EntityTypesClient.ListEntityTypesPagedResponse; @@ -28,12 +29,13 @@ import com.google.protobuf.AbstractMessage; import com.google.protobuf.Empty; import com.google.protobuf.FieldMask; -import io.grpc.Status; import io.grpc.StatusRuntimeException; import java.io.IOException; +import java.util.ArrayList; import java.util.Arrays; import java.util.List; import java.util.UUID; +import javax.annotation.Generated; import org.junit.After; import org.junit.AfterClass; import org.junit.Assert; @@ -41,66 +43,31 @@ import org.junit.BeforeClass; import org.junit.Test; -@javax.annotation.Generated("by GAPIC") +@Generated("by gapic-generator-java") public class EntityTypesClientTest { - private static MockPages mockPages; - private static MockFlows mockFlows; - private static MockAgents mockAgents; private static MockEntityTypes mockEntityTypes; - private static MockEnvironments mockEnvironments; - private static MockIntents mockIntents; - private static MockSecuritySettingsService mockSecuritySettingsService; - private static MockSessionEntityTypes mockSessionEntityTypes; - private static MockSessions mockSessions; - private static MockTransitionRouteGroups mockTransitionRouteGroups; - private static MockVersions mockVersions; - private static MockWebhooks mockWebhooks; - private static MockServiceHelper serviceHelper; + private static MockServiceHelper mockServiceHelper; private EntityTypesClient client; private LocalChannelProvider channelProvider; @BeforeClass public static void startStaticServer() { - mockPages = new MockPages(); - mockFlows = new MockFlows(); - mockAgents = new MockAgents(); mockEntityTypes = new MockEntityTypes(); - mockEnvironments = new MockEnvironments(); - mockIntents = new MockIntents(); - mockSecuritySettingsService = new MockSecuritySettingsService(); - mockSessionEntityTypes = new MockSessionEntityTypes(); - mockSessions = new MockSessions(); - mockTransitionRouteGroups = new MockTransitionRouteGroups(); - mockVersions = new MockVersions(); - mockWebhooks = new MockWebhooks(); - serviceHelper = + mockServiceHelper = new MockServiceHelper( - UUID.randomUUID().toString(), - Arrays.asList( - mockPages, - mockFlows, - mockAgents, - mockEntityTypes, - mockEnvironments, - mockIntents, - mockSecuritySettingsService, - mockSessionEntityTypes, - mockSessions, - mockTransitionRouteGroups, - mockVersions, - mockWebhooks)); - serviceHelper.start(); + UUID.randomUUID().toString(), Arrays.asList(mockEntityTypes)); + mockServiceHelper.start(); } @AfterClass public static void stopServer() { - serviceHelper.stop(); + mockServiceHelper.stop(); } @Before public void setUp() throws IOException { - serviceHelper.reset(); - channelProvider = serviceHelper.createChannelProvider(); + mockServiceHelper.reset(); + channelProvider = mockServiceHelper.createChannelProvider(); EntityTypesSettings settings = EntityTypesSettings.newBuilder() .setTransportChannelProvider(channelProvider) @@ -115,15 +82,12 @@ public void tearDown() throws Exception { } @Test - @SuppressWarnings("all") - public void listEntityTypesTest() { - String nextPageToken = ""; - EntityType entityTypesElement = EntityType.newBuilder().build(); - List entityTypes = Arrays.asList(entityTypesElement); + public void listEntityTypesTest() throws Exception { + EntityType responsesElement = EntityType.newBuilder().build(); ListEntityTypesResponse expectedResponse = ListEntityTypesResponse.newBuilder() - .setNextPageToken(nextPageToken) - .addAllEntityTypes(entityTypes) + .setNextPageToken("") + .addAllEntityTypes(Arrays.asList(responsesElement)) .build(); mockEntityTypes.addResponse(expectedResponse); @@ -132,14 +96,15 @@ public void listEntityTypesTest() { ListEntityTypesPagedResponse pagedListResponse = client.listEntityTypes(parent); List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + Assert.assertEquals(1, resources.size()); Assert.assertEquals(expectedResponse.getEntityTypesList().get(0), resources.get(0)); List actualRequests = mockEntityTypes.getRequests(); Assert.assertEquals(1, actualRequests.size()); - ListEntityTypesRequest actualRequest = (ListEntityTypesRequest) actualRequests.get(0); + ListEntityTypesRequest actualRequest = ((ListEntityTypesRequest) actualRequests.get(0)); - Assert.assertEquals(parent, AgentName.parse(actualRequest.getParent())); + Assert.assertEquals(parent.toString(), actualRequest.getParent()); Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), @@ -147,32 +112,73 @@ public void listEntityTypesTest() { } @Test - @SuppressWarnings("all") public void listEntityTypesExceptionTest() throws Exception { - StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockEntityTypes.addException(exception); try { AgentName parent = AgentName.of("[PROJECT]", "[LOCATION]", "[AGENT]"); + client.listEntityTypes(parent); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void listEntityTypesTest2() throws Exception { + EntityType responsesElement = EntityType.newBuilder().build(); + ListEntityTypesResponse expectedResponse = + ListEntityTypesResponse.newBuilder() + .setNextPageToken("") + .addAllEntityTypes(Arrays.asList(responsesElement)) + .build(); + mockEntityTypes.addResponse(expectedResponse); + + String parent = "parent-995424086"; + + ListEntityTypesPagedResponse pagedListResponse = client.listEntityTypes(parent); + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getEntityTypesList().get(0), resources.get(0)); + + List actualRequests = mockEntityTypes.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + ListEntityTypesRequest actualRequest = ((ListEntityTypesRequest) actualRequests.get(0)); + + Assert.assertEquals(parent, actualRequest.getParent()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void listEntityTypesExceptionTest2() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockEntityTypes.addException(exception); + + try { + String parent = "parent-995424086"; client.listEntityTypes(parent); Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { - // Expected exception + // Expected exception. } } @Test - @SuppressWarnings("all") - public void getEntityTypeTest() { - EntityTypeName name2 = EntityTypeName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[ENTITY_TYPE]"); - String displayName = "displayName1615086568"; - boolean enableFuzzyExtraction = true; + public void getEntityTypeTest() throws Exception { EntityType expectedResponse = EntityType.newBuilder() - .setName(name2.toString()) - .setDisplayName(displayName) - .setEnableFuzzyExtraction(enableFuzzyExtraction) + .setName( + EntityTypeName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[ENTITY_TYPE]").toString()) + .setDisplayName("displayName1714148973") + .addAllEntities(new ArrayList()) + .addAllExcludedPhrases(new ArrayList()) + .setEnableFuzzyExtraction(true) .build(); mockEntityTypes.addResponse(expectedResponse); @@ -183,9 +189,9 @@ public void getEntityTypeTest() { List actualRequests = mockEntityTypes.getRequests(); Assert.assertEquals(1, actualRequests.size()); - GetEntityTypeRequest actualRequest = (GetEntityTypeRequest) actualRequests.get(0); + GetEntityTypeRequest actualRequest = ((GetEntityTypeRequest) actualRequests.get(0)); - Assert.assertEquals(name, EntityTypeName.parse(actualRequest.getName())); + Assert.assertEquals(name.toString(), actualRequest.getName()); Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), @@ -193,33 +199,73 @@ public void getEntityTypeTest() { } @Test - @SuppressWarnings("all") public void getEntityTypeExceptionTest() throws Exception { - StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockEntityTypes.addException(exception); try { EntityTypeName name = EntityTypeName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[ENTITY_TYPE]"); + client.getEntityType(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void getEntityTypeTest2() throws Exception { + EntityType expectedResponse = + EntityType.newBuilder() + .setName( + EntityTypeName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[ENTITY_TYPE]").toString()) + .setDisplayName("displayName1714148973") + .addAllEntities(new ArrayList()) + .addAllExcludedPhrases(new ArrayList()) + .setEnableFuzzyExtraction(true) + .build(); + mockEntityTypes.addResponse(expectedResponse); + + String name = "name3373707"; + + EntityType actualResponse = client.getEntityType(name); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockEntityTypes.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + GetEntityTypeRequest actualRequest = ((GetEntityTypeRequest) actualRequests.get(0)); + + Assert.assertEquals(name, actualRequest.getName()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void getEntityTypeExceptionTest2() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockEntityTypes.addException(exception); + try { + String name = "name3373707"; client.getEntityType(name); Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { - // Expected exception + // Expected exception. } } @Test - @SuppressWarnings("all") - public void createEntityTypeTest() { - EntityTypeName name = EntityTypeName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[ENTITY_TYPE]"); - String displayName = "displayName1615086568"; - boolean enableFuzzyExtraction = true; + public void createEntityTypeTest() throws Exception { EntityType expectedResponse = EntityType.newBuilder() - .setName(name.toString()) - .setDisplayName(displayName) - .setEnableFuzzyExtraction(enableFuzzyExtraction) + .setName( + EntityTypeName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[ENTITY_TYPE]").toString()) + .setDisplayName("displayName1714148973") + .addAllEntities(new ArrayList()) + .addAllExcludedPhrases(new ArrayList()) + .setEnableFuzzyExtraction(true) .build(); mockEntityTypes.addResponse(expectedResponse); @@ -231,9 +277,9 @@ public void createEntityTypeTest() { List actualRequests = mockEntityTypes.getRequests(); Assert.assertEquals(1, actualRequests.size()); - CreateEntityTypeRequest actualRequest = (CreateEntityTypeRequest) actualRequests.get(0); + CreateEntityTypeRequest actualRequest = ((CreateEntityTypeRequest) actualRequests.get(0)); - Assert.assertEquals(parent, AgentName.parse(actualRequest.getParent())); + Assert.assertEquals(parent.toString(), actualRequest.getParent()); Assert.assertEquals(entityType, actualRequest.getEntityType()); Assert.assertTrue( channelProvider.isHeaderSent( @@ -242,33 +288,76 @@ public void createEntityTypeTest() { } @Test - @SuppressWarnings("all") public void createEntityTypeExceptionTest() throws Exception { - StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockEntityTypes.addException(exception); try { AgentName parent = AgentName.of("[PROJECT]", "[LOCATION]", "[AGENT]"); EntityType entityType = EntityType.newBuilder().build(); + client.createEntityType(parent, entityType); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void createEntityTypeTest2() throws Exception { + EntityType expectedResponse = + EntityType.newBuilder() + .setName( + EntityTypeName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[ENTITY_TYPE]").toString()) + .setDisplayName("displayName1714148973") + .addAllEntities(new ArrayList()) + .addAllExcludedPhrases(new ArrayList()) + .setEnableFuzzyExtraction(true) + .build(); + mockEntityTypes.addResponse(expectedResponse); + + String parent = "parent-995424086"; + EntityType entityType = EntityType.newBuilder().build(); + + EntityType actualResponse = client.createEntityType(parent, entityType); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockEntityTypes.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + CreateEntityTypeRequest actualRequest = ((CreateEntityTypeRequest) actualRequests.get(0)); + + Assert.assertEquals(parent, actualRequest.getParent()); + Assert.assertEquals(entityType, actualRequest.getEntityType()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void createEntityTypeExceptionTest2() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockEntityTypes.addException(exception); + try { + String parent = "parent-995424086"; + EntityType entityType = EntityType.newBuilder().build(); client.createEntityType(parent, entityType); Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { - // Expected exception + // Expected exception. } } @Test - @SuppressWarnings("all") - public void updateEntityTypeTest() { - EntityTypeName name = EntityTypeName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[ENTITY_TYPE]"); - String displayName = "displayName1615086568"; - boolean enableFuzzyExtraction = true; + public void updateEntityTypeTest() throws Exception { EntityType expectedResponse = EntityType.newBuilder() - .setName(name.toString()) - .setDisplayName(displayName) - .setEnableFuzzyExtraction(enableFuzzyExtraction) + .setName( + EntityTypeName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[ENTITY_TYPE]").toString()) + .setDisplayName("displayName1714148973") + .addAllEntities(new ArrayList()) + .addAllExcludedPhrases(new ArrayList()) + .setEnableFuzzyExtraction(true) .build(); mockEntityTypes.addResponse(expectedResponse); @@ -280,7 +369,7 @@ public void updateEntityTypeTest() { List actualRequests = mockEntityTypes.getRequests(); Assert.assertEquals(1, actualRequests.size()); - UpdateEntityTypeRequest actualRequest = (UpdateEntityTypeRequest) actualRequests.get(0); + UpdateEntityTypeRequest actualRequest = ((UpdateEntityTypeRequest) actualRequests.get(0)); Assert.assertEquals(entityType, actualRequest.getEntityType()); Assert.assertEquals(updateMask, actualRequest.getUpdateMask()); @@ -291,25 +380,22 @@ public void updateEntityTypeTest() { } @Test - @SuppressWarnings("all") public void updateEntityTypeExceptionTest() throws Exception { - StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockEntityTypes.addException(exception); try { EntityType entityType = EntityType.newBuilder().build(); FieldMask updateMask = FieldMask.newBuilder().build(); - client.updateEntityType(entityType, updateMask); Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { - // Expected exception + // Expected exception. } } @Test - @SuppressWarnings("all") - public void deleteEntityTypeTest() { + public void deleteEntityTypeTest() throws Exception { Empty expectedResponse = Empty.newBuilder().build(); mockEntityTypes.addResponse(expectedResponse); @@ -319,9 +405,9 @@ public void deleteEntityTypeTest() { List actualRequests = mockEntityTypes.getRequests(); Assert.assertEquals(1, actualRequests.size()); - DeleteEntityTypeRequest actualRequest = (DeleteEntityTypeRequest) actualRequests.get(0); + DeleteEntityTypeRequest actualRequest = ((DeleteEntityTypeRequest) actualRequests.get(0)); - Assert.assertEquals(name, EntityTypeName.parse(actualRequest.getName())); + Assert.assertEquals(name.toString(), actualRequest.getName()); Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), @@ -329,19 +415,51 @@ public void deleteEntityTypeTest() { } @Test - @SuppressWarnings("all") public void deleteEntityTypeExceptionTest() throws Exception { - StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockEntityTypes.addException(exception); try { EntityTypeName name = EntityTypeName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[ENTITY_TYPE]"); + client.deleteEntityType(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void deleteEntityTypeTest2() throws Exception { + Empty expectedResponse = Empty.newBuilder().build(); + mockEntityTypes.addResponse(expectedResponse); + + String name = "name3373707"; + client.deleteEntityType(name); + + List actualRequests = mockEntityTypes.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + DeleteEntityTypeRequest actualRequest = ((DeleteEntityTypeRequest) actualRequests.get(0)); + + Assert.assertEquals(name, actualRequest.getName()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void deleteEntityTypeExceptionTest2() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockEntityTypes.addException(exception); + + try { + String name = "name3373707"; client.deleteEntityType(name); Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { - // Expected exception + // Expected exception. } } } diff --git a/google-cloud-dialogflow-cx/src/test/java/com/google/cloud/dialogflow/cx/v3/EnvironmentsClientTest.java b/google-cloud-dialogflow-cx/src/test/java/com/google/cloud/dialogflow/cx/v3/EnvironmentsClientTest.java index d86a18eb2..02846ffa9 100644 --- a/google-cloud-dialogflow-cx/src/test/java/com/google/cloud/dialogflow/cx/v3/EnvironmentsClientTest.java +++ b/google-cloud-dialogflow-cx/src/test/java/com/google/cloud/dialogflow/cx/v3/EnvironmentsClientTest.java @@ -5,7 +5,7 @@ * 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 + * 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, @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.google.cloud.dialogflow.cx.v3; import static com.google.cloud.dialogflow.cx.v3.EnvironmentsClient.ListEnvironmentsPagedResponse; @@ -32,13 +33,15 @@ import com.google.protobuf.Any; import com.google.protobuf.Empty; import com.google.protobuf.FieldMask; -import io.grpc.Status; +import com.google.protobuf.Timestamp; import io.grpc.StatusRuntimeException; import java.io.IOException; +import java.util.ArrayList; import java.util.Arrays; import java.util.List; import java.util.UUID; import java.util.concurrent.ExecutionException; +import javax.annotation.Generated; import org.junit.After; import org.junit.AfterClass; import org.junit.Assert; @@ -46,66 +49,31 @@ import org.junit.BeforeClass; import org.junit.Test; -@javax.annotation.Generated("by GAPIC") +@Generated("by gapic-generator-java") public class EnvironmentsClientTest { - private static MockPages mockPages; - private static MockFlows mockFlows; - private static MockAgents mockAgents; - private static MockEntityTypes mockEntityTypes; - private static MockEnvironments mockEnvironments; - private static MockIntents mockIntents; - private static MockSecuritySettingsService mockSecuritySettingsService; - private static MockSessionEntityTypes mockSessionEntityTypes; - private static MockSessions mockSessions; - private static MockTransitionRouteGroups mockTransitionRouteGroups; - private static MockVersions mockVersions; - private static MockWebhooks mockWebhooks; - private static MockServiceHelper serviceHelper; + private static MockServiceHelper mockServiceHelper; private EnvironmentsClient client; + private static MockEnvironments mockEnvironments; private LocalChannelProvider channelProvider; @BeforeClass public static void startStaticServer() { - mockPages = new MockPages(); - mockFlows = new MockFlows(); - mockAgents = new MockAgents(); - mockEntityTypes = new MockEntityTypes(); mockEnvironments = new MockEnvironments(); - mockIntents = new MockIntents(); - mockSecuritySettingsService = new MockSecuritySettingsService(); - mockSessionEntityTypes = new MockSessionEntityTypes(); - mockSessions = new MockSessions(); - mockTransitionRouteGroups = new MockTransitionRouteGroups(); - mockVersions = new MockVersions(); - mockWebhooks = new MockWebhooks(); - serviceHelper = + mockServiceHelper = new MockServiceHelper( - UUID.randomUUID().toString(), - Arrays.asList( - mockPages, - mockFlows, - mockAgents, - mockEntityTypes, - mockEnvironments, - mockIntents, - mockSecuritySettingsService, - mockSessionEntityTypes, - mockSessions, - mockTransitionRouteGroups, - mockVersions, - mockWebhooks)); - serviceHelper.start(); + UUID.randomUUID().toString(), Arrays.asList(mockEnvironments)); + mockServiceHelper.start(); } @AfterClass public static void stopServer() { - serviceHelper.stop(); + mockServiceHelper.stop(); } @Before public void setUp() throws IOException { - serviceHelper.reset(); - channelProvider = serviceHelper.createChannelProvider(); + mockServiceHelper.reset(); + channelProvider = mockServiceHelper.createChannelProvider(); EnvironmentsSettings settings = EnvironmentsSettings.newBuilder() .setTransportChannelProvider(channelProvider) @@ -120,15 +88,12 @@ public void tearDown() throws Exception { } @Test - @SuppressWarnings("all") - public void listEnvironmentsTest() { - String nextPageToken = ""; - Environment environmentsElement = Environment.newBuilder().build(); - List environments = Arrays.asList(environmentsElement); + public void listEnvironmentsTest() throws Exception { + Environment responsesElement = Environment.newBuilder().build(); ListEnvironmentsResponse expectedResponse = ListEnvironmentsResponse.newBuilder() - .setNextPageToken(nextPageToken) - .addAllEnvironments(environments) + .setNextPageToken("") + .addAllEnvironments(Arrays.asList(responsesElement)) .build(); mockEnvironments.addResponse(expectedResponse); @@ -137,14 +102,15 @@ public void listEnvironmentsTest() { ListEnvironmentsPagedResponse pagedListResponse = client.listEnvironments(parent); List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + Assert.assertEquals(1, resources.size()); Assert.assertEquals(expectedResponse.getEnvironmentsList().get(0), resources.get(0)); List actualRequests = mockEnvironments.getRequests(); Assert.assertEquals(1, actualRequests.size()); - ListEnvironmentsRequest actualRequest = (ListEnvironmentsRequest) actualRequests.get(0); + ListEnvironmentsRequest actualRequest = ((ListEnvironmentsRequest) actualRequests.get(0)); - Assert.assertEquals(parent, AgentName.parse(actualRequest.getParent())); + Assert.assertEquals(parent.toString(), actualRequest.getParent()); Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), @@ -152,33 +118,74 @@ public void listEnvironmentsTest() { } @Test - @SuppressWarnings("all") public void listEnvironmentsExceptionTest() throws Exception { - StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockEnvironments.addException(exception); try { AgentName parent = AgentName.of("[PROJECT]", "[LOCATION]", "[AGENT]"); + client.listEnvironments(parent); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void listEnvironmentsTest2() throws Exception { + Environment responsesElement = Environment.newBuilder().build(); + ListEnvironmentsResponse expectedResponse = + ListEnvironmentsResponse.newBuilder() + .setNextPageToken("") + .addAllEnvironments(Arrays.asList(responsesElement)) + .build(); + mockEnvironments.addResponse(expectedResponse); + + String parent = "parent-995424086"; + + ListEnvironmentsPagedResponse pagedListResponse = client.listEnvironments(parent); + + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getEnvironmentsList().get(0), resources.get(0)); + + List actualRequests = mockEnvironments.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + ListEnvironmentsRequest actualRequest = ((ListEnvironmentsRequest) actualRequests.get(0)); + + Assert.assertEquals(parent, actualRequest.getParent()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + @Test + public void listEnvironmentsExceptionTest2() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockEnvironments.addException(exception); + + try { + String parent = "parent-995424086"; client.listEnvironments(parent); Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { - // Expected exception + // Expected exception. } } @Test - @SuppressWarnings("all") - public void getEnvironmentTest() { - EnvironmentName name2 = - EnvironmentName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[ENVIRONMENT]"); - String displayName = "displayName1615086568"; - String description = "description-1724546052"; + public void getEnvironmentTest() throws Exception { Environment expectedResponse = Environment.newBuilder() - .setName(name2.toString()) - .setDisplayName(displayName) - .setDescription(description) + .setName( + EnvironmentName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[ENVIRONMENT]") + .toString()) + .setDisplayName("displayName1714148973") + .setDescription("description-1724546052") + .addAllVersionConfigs(new ArrayList()) + .setUpdateTime(Timestamp.newBuilder().build()) .build(); mockEnvironments.addResponse(expectedResponse); @@ -190,9 +197,9 @@ public void getEnvironmentTest() { List actualRequests = mockEnvironments.getRequests(); Assert.assertEquals(1, actualRequests.size()); - GetEnvironmentRequest actualRequest = (GetEnvironmentRequest) actualRequests.get(0); + GetEnvironmentRequest actualRequest = ((GetEnvironmentRequest) actualRequests.get(0)); - Assert.assertEquals(name, EnvironmentName.parse(actualRequest.getName())); + Assert.assertEquals(name.toString(), actualRequest.getName()); Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), @@ -200,34 +207,75 @@ public void getEnvironmentTest() { } @Test - @SuppressWarnings("all") public void getEnvironmentExceptionTest() throws Exception { - StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockEnvironments.addException(exception); try { EnvironmentName name = EnvironmentName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[ENVIRONMENT]"); + client.getEnvironment(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + @Test + public void getEnvironmentTest2() throws Exception { + Environment expectedResponse = + Environment.newBuilder() + .setName( + EnvironmentName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[ENVIRONMENT]") + .toString()) + .setDisplayName("displayName1714148973") + .setDescription("description-1724546052") + .addAllVersionConfigs(new ArrayList()) + .setUpdateTime(Timestamp.newBuilder().build()) + .build(); + mockEnvironments.addResponse(expectedResponse); + + String name = "name3373707"; + + Environment actualResponse = client.getEnvironment(name); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockEnvironments.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + GetEnvironmentRequest actualRequest = ((GetEnvironmentRequest) actualRequests.get(0)); + + Assert.assertEquals(name, actualRequest.getName()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void getEnvironmentExceptionTest2() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockEnvironments.addException(exception); + + try { + String name = "name3373707"; client.getEnvironment(name); Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { - // Expected exception + // Expected exception. } } @Test - @SuppressWarnings("all") public void createEnvironmentTest() throws Exception { - EnvironmentName name = - EnvironmentName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[ENVIRONMENT]"); - String displayName = "displayName1615086568"; - String description = "description-1724546052"; Environment expectedResponse = Environment.newBuilder() - .setName(name.toString()) - .setDisplayName(displayName) - .setDescription(description) + .setName( + EnvironmentName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[ENVIRONMENT]") + .toString()) + .setDisplayName("displayName1714148973") + .setDescription("description-1724546052") + .addAllVersionConfigs(new ArrayList()) + .setUpdateTime(Timestamp.newBuilder().build()) .build(); Operation resultOperation = Operation.newBuilder() @@ -245,9 +293,9 @@ public void createEnvironmentTest() throws Exception { List actualRequests = mockEnvironments.getRequests(); Assert.assertEquals(1, actualRequests.size()); - CreateEnvironmentRequest actualRequest = (CreateEnvironmentRequest) actualRequests.get(0); + CreateEnvironmentRequest actualRequest = ((CreateEnvironmentRequest) actualRequests.get(0)); - Assert.assertEquals(parent, AgentName.parse(actualRequest.getParent())); + Assert.assertEquals(parent.toString(), actualRequest.getParent()); Assert.assertEquals(environment, actualRequest.getEnvironment()); Assert.assertTrue( channelProvider.isHeaderSent( @@ -256,36 +304,88 @@ public void createEnvironmentTest() throws Exception { } @Test - @SuppressWarnings("all") public void createEnvironmentExceptionTest() throws Exception { - StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockEnvironments.addException(exception); try { AgentName parent = AgentName.of("[PROJECT]", "[LOCATION]", "[AGENT]"); Environment environment = Environment.newBuilder().build(); + client.createEnvironmentAsync(parent, environment).get(); + Assert.fail("No exception raised"); + } catch (ExecutionException e) { + Assert.assertEquals(InvalidArgumentException.class, e.getCause().getClass()); + InvalidArgumentException apiException = ((InvalidArgumentException) e.getCause()); + Assert.assertEquals(StatusCode.Code.INVALID_ARGUMENT, apiException.getStatusCode().getCode()); + } + } + + @Test + public void createEnvironmentTest2() throws Exception { + Environment expectedResponse = + Environment.newBuilder() + .setName( + EnvironmentName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[ENVIRONMENT]") + .toString()) + .setDisplayName("displayName1714148973") + .setDescription("description-1724546052") + .addAllVersionConfigs(new ArrayList()) + .setUpdateTime(Timestamp.newBuilder().build()) + .build(); + Operation resultOperation = + Operation.newBuilder() + .setName("createEnvironmentTest") + .setDone(true) + .setResponse(Any.pack(expectedResponse)) + .build(); + mockEnvironments.addResponse(resultOperation); + + String parent = "parent-995424086"; + Environment environment = Environment.newBuilder().build(); + Environment actualResponse = client.createEnvironmentAsync(parent, environment).get(); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockEnvironments.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + CreateEnvironmentRequest actualRequest = ((CreateEnvironmentRequest) actualRequests.get(0)); + + Assert.assertEquals(parent, actualRequest.getParent()); + Assert.assertEquals(environment, actualRequest.getEnvironment()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void createEnvironmentExceptionTest2() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockEnvironments.addException(exception); + + try { + String parent = "parent-995424086"; + Environment environment = Environment.newBuilder().build(); client.createEnvironmentAsync(parent, environment).get(); Assert.fail("No exception raised"); } catch (ExecutionException e) { Assert.assertEquals(InvalidArgumentException.class, e.getCause().getClass()); - InvalidArgumentException apiException = (InvalidArgumentException) e.getCause(); + InvalidArgumentException apiException = ((InvalidArgumentException) e.getCause()); Assert.assertEquals(StatusCode.Code.INVALID_ARGUMENT, apiException.getStatusCode().getCode()); } } @Test - @SuppressWarnings("all") public void updateEnvironmentTest() throws Exception { - EnvironmentName name = - EnvironmentName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[ENVIRONMENT]"); - String displayName = "displayName1615086568"; - String description = "description-1724546052"; Environment expectedResponse = Environment.newBuilder() - .setName(name.toString()) - .setDisplayName(displayName) - .setDescription(description) + .setName( + EnvironmentName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[ENVIRONMENT]") + .toString()) + .setDisplayName("displayName1714148973") + .setDescription("description-1724546052") + .addAllVersionConfigs(new ArrayList()) + .setUpdateTime(Timestamp.newBuilder().build()) .build(); Operation resultOperation = Operation.newBuilder() @@ -303,7 +403,7 @@ public void updateEnvironmentTest() throws Exception { List actualRequests = mockEnvironments.getRequests(); Assert.assertEquals(1, actualRequests.size()); - UpdateEnvironmentRequest actualRequest = (UpdateEnvironmentRequest) actualRequests.get(0); + UpdateEnvironmentRequest actualRequest = ((UpdateEnvironmentRequest) actualRequests.get(0)); Assert.assertEquals(environment, actualRequest.getEnvironment()); Assert.assertEquals(updateMask, actualRequest.getUpdateMask()); @@ -314,27 +414,24 @@ public void updateEnvironmentTest() throws Exception { } @Test - @SuppressWarnings("all") public void updateEnvironmentExceptionTest() throws Exception { - StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockEnvironments.addException(exception); try { Environment environment = Environment.newBuilder().build(); FieldMask updateMask = FieldMask.newBuilder().build(); - client.updateEnvironmentAsync(environment, updateMask).get(); Assert.fail("No exception raised"); } catch (ExecutionException e) { Assert.assertEquals(InvalidArgumentException.class, e.getCause().getClass()); - InvalidArgumentException apiException = (InvalidArgumentException) e.getCause(); + InvalidArgumentException apiException = ((InvalidArgumentException) e.getCause()); Assert.assertEquals(StatusCode.Code.INVALID_ARGUMENT, apiException.getStatusCode().getCode()); } } @Test - @SuppressWarnings("all") - public void deleteEnvironmentTest() { + public void deleteEnvironmentTest() throws Exception { Empty expectedResponse = Empty.newBuilder().build(); mockEnvironments.addResponse(expectedResponse); @@ -345,9 +442,9 @@ public void deleteEnvironmentTest() { List actualRequests = mockEnvironments.getRequests(); Assert.assertEquals(1, actualRequests.size()); - DeleteEnvironmentRequest actualRequest = (DeleteEnvironmentRequest) actualRequests.get(0); + DeleteEnvironmentRequest actualRequest = ((DeleteEnvironmentRequest) actualRequests.get(0)); - Assert.assertEquals(name, EnvironmentName.parse(actualRequest.getName())); + Assert.assertEquals(name.toString(), actualRequest.getName()); Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), @@ -355,32 +452,61 @@ public void deleteEnvironmentTest() { } @Test - @SuppressWarnings("all") public void deleteEnvironmentExceptionTest() throws Exception { - StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockEnvironments.addException(exception); try { EnvironmentName name = EnvironmentName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[ENVIRONMENT]"); + client.deleteEnvironment(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void deleteEnvironmentTest2() throws Exception { + Empty expectedResponse = Empty.newBuilder().build(); + mockEnvironments.addResponse(expectedResponse); + + String name = "name3373707"; + + client.deleteEnvironment(name); + + List actualRequests = mockEnvironments.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + DeleteEnvironmentRequest actualRequest = ((DeleteEnvironmentRequest) actualRequests.get(0)); + + Assert.assertEquals(name, actualRequest.getName()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + @Test + public void deleteEnvironmentExceptionTest2() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockEnvironments.addException(exception); + + try { + String name = "name3373707"; client.deleteEnvironment(name); Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { - // Expected exception + // Expected exception. } } @Test - @SuppressWarnings("all") - public void lookupEnvironmentHistoryTest() { - String nextPageToken = ""; - Environment environmentsElement = Environment.newBuilder().build(); - List environments = Arrays.asList(environmentsElement); + public void lookupEnvironmentHistoryTest() throws Exception { + Environment responsesElement = Environment.newBuilder().build(); LookupEnvironmentHistoryResponse expectedResponse = LookupEnvironmentHistoryResponse.newBuilder() - .setNextPageToken(nextPageToken) - .addAllEnvironments(environments) + .setNextPageToken("") + .addAllEnvironments(Arrays.asList(responsesElement)) .build(); mockEnvironments.addResponse(expectedResponse); @@ -390,15 +516,16 @@ public void lookupEnvironmentHistoryTest() { LookupEnvironmentHistoryPagedResponse pagedListResponse = client.lookupEnvironmentHistory(name); List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + Assert.assertEquals(1, resources.size()); Assert.assertEquals(expectedResponse.getEnvironmentsList().get(0), resources.get(0)); List actualRequests = mockEnvironments.getRequests(); Assert.assertEquals(1, actualRequests.size()); LookupEnvironmentHistoryRequest actualRequest = - (LookupEnvironmentHistoryRequest) actualRequests.get(0); + ((LookupEnvironmentHistoryRequest) actualRequests.get(0)); - Assert.assertEquals(name, EnvironmentName.parse(actualRequest.getName())); + Assert.assertEquals(name.toString(), actualRequest.getName()); Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), @@ -406,19 +533,62 @@ public void lookupEnvironmentHistoryTest() { } @Test - @SuppressWarnings("all") public void lookupEnvironmentHistoryExceptionTest() throws Exception { - StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockEnvironments.addException(exception); try { EnvironmentName name = EnvironmentName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[ENVIRONMENT]"); + client.lookupEnvironmentHistory(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void lookupEnvironmentHistoryTest2() throws Exception { + Environment responsesElement = Environment.newBuilder().build(); + LookupEnvironmentHistoryResponse expectedResponse = + LookupEnvironmentHistoryResponse.newBuilder() + .setNextPageToken("") + .addAllEnvironments(Arrays.asList(responsesElement)) + .build(); + mockEnvironments.addResponse(expectedResponse); + + String name = "name3373707"; + LookupEnvironmentHistoryPagedResponse pagedListResponse = client.lookupEnvironmentHistory(name); + + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getEnvironmentsList().get(0), resources.get(0)); + + List actualRequests = mockEnvironments.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + LookupEnvironmentHistoryRequest actualRequest = + ((LookupEnvironmentHistoryRequest) actualRequests.get(0)); + + Assert.assertEquals(name, actualRequest.getName()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void lookupEnvironmentHistoryExceptionTest2() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockEnvironments.addException(exception); + + try { + String name = "name3373707"; client.lookupEnvironmentHistory(name); Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { - // Expected exception + // Expected exception. } } } diff --git a/google-cloud-dialogflow-cx/src/test/java/com/google/cloud/dialogflow/cx/v3/FlowsClientTest.java b/google-cloud-dialogflow-cx/src/test/java/com/google/cloud/dialogflow/cx/v3/FlowsClientTest.java index 4763fbc27..1e630dd95 100644 --- a/google-cloud-dialogflow-cx/src/test/java/com/google/cloud/dialogflow/cx/v3/FlowsClientTest.java +++ b/google-cloud-dialogflow-cx/src/test/java/com/google/cloud/dialogflow/cx/v3/FlowsClientTest.java @@ -5,7 +5,7 @@ * 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 + * 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, @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.google.cloud.dialogflow.cx.v3; import static com.google.cloud.dialogflow.cx.v3.FlowsClient.ListFlowsPagedResponse; @@ -31,13 +32,14 @@ import com.google.protobuf.Any; import com.google.protobuf.Empty; import com.google.protobuf.FieldMask; -import io.grpc.Status; import io.grpc.StatusRuntimeException; import java.io.IOException; +import java.util.ArrayList; import java.util.Arrays; import java.util.List; import java.util.UUID; import java.util.concurrent.ExecutionException; +import javax.annotation.Generated; import org.junit.After; import org.junit.AfterClass; import org.junit.Assert; @@ -45,66 +47,31 @@ import org.junit.BeforeClass; import org.junit.Test; -@javax.annotation.Generated("by GAPIC") +@Generated("by gapic-generator-java") public class FlowsClientTest { - private static MockPages mockPages; + private static MockServiceHelper mockServiceHelper; private static MockFlows mockFlows; - private static MockAgents mockAgents; - private static MockEntityTypes mockEntityTypes; - private static MockEnvironments mockEnvironments; - private static MockIntents mockIntents; - private static MockSecuritySettingsService mockSecuritySettingsService; - private static MockSessionEntityTypes mockSessionEntityTypes; - private static MockSessions mockSessions; - private static MockTransitionRouteGroups mockTransitionRouteGroups; - private static MockVersions mockVersions; - private static MockWebhooks mockWebhooks; - private static MockServiceHelper serviceHelper; private FlowsClient client; private LocalChannelProvider channelProvider; @BeforeClass public static void startStaticServer() { - mockPages = new MockPages(); mockFlows = new MockFlows(); - mockAgents = new MockAgents(); - mockEntityTypes = new MockEntityTypes(); - mockEnvironments = new MockEnvironments(); - mockIntents = new MockIntents(); - mockSecuritySettingsService = new MockSecuritySettingsService(); - mockSessionEntityTypes = new MockSessionEntityTypes(); - mockSessions = new MockSessions(); - mockTransitionRouteGroups = new MockTransitionRouteGroups(); - mockVersions = new MockVersions(); - mockWebhooks = new MockWebhooks(); - serviceHelper = + mockServiceHelper = new MockServiceHelper( - UUID.randomUUID().toString(), - Arrays.asList( - mockPages, - mockFlows, - mockAgents, - mockEntityTypes, - mockEnvironments, - mockIntents, - mockSecuritySettingsService, - mockSessionEntityTypes, - mockSessions, - mockTransitionRouteGroups, - mockVersions, - mockWebhooks)); - serviceHelper.start(); + UUID.randomUUID().toString(), Arrays.asList(mockFlows)); + mockServiceHelper.start(); } @AfterClass public static void stopServer() { - serviceHelper.stop(); + mockServiceHelper.stop(); } @Before public void setUp() throws IOException { - serviceHelper.reset(); - channelProvider = serviceHelper.createChannelProvider(); + mockServiceHelper.reset(); + channelProvider = mockServiceHelper.createChannelProvider(); FlowsSettings settings = FlowsSettings.newBuilder() .setTransportChannelProvider(channelProvider) @@ -119,16 +86,15 @@ public void tearDown() throws Exception { } @Test - @SuppressWarnings("all") - public void createFlowTest() { - FlowName name = FlowName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]"); - String displayName = "displayName1615086568"; - String description = "description-1724546052"; + public void createFlowTest() throws Exception { Flow expectedResponse = Flow.newBuilder() - .setName(name.toString()) - .setDisplayName(displayName) - .setDescription(description) + .setName(FlowName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]").toString()) + .setDisplayName("displayName1714148973") + .setDescription("description-1724546052") + .addAllTransitionRoutes(new ArrayList()) + .addAllEventHandlers(new ArrayList()) + .setNluSettings(NluSettings.newBuilder().build()) .build(); mockFlows.addResponse(expectedResponse); @@ -140,9 +106,9 @@ public void createFlowTest() { List actualRequests = mockFlows.getRequests(); Assert.assertEquals(1, actualRequests.size()); - CreateFlowRequest actualRequest = (CreateFlowRequest) actualRequests.get(0); + CreateFlowRequest actualRequest = ((CreateFlowRequest) actualRequests.get(0)); - Assert.assertEquals(parent, AgentName.parse(actualRequest.getParent())); + Assert.assertEquals(parent.toString(), actualRequest.getParent()); Assert.assertEquals(flow, actualRequest.getFlow()); Assert.assertTrue( channelProvider.isHeaderSent( @@ -151,25 +117,68 @@ public void createFlowTest() { } @Test - @SuppressWarnings("all") public void createFlowExceptionTest() throws Exception { - StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockFlows.addException(exception); try { AgentName parent = AgentName.of("[PROJECT]", "[LOCATION]", "[AGENT]"); Flow flow = Flow.newBuilder().build(); + client.createFlow(parent, flow); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void createFlowTest2() throws Exception { + Flow expectedResponse = + Flow.newBuilder() + .setName(FlowName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]").toString()) + .setDisplayName("displayName1714148973") + .setDescription("description-1724546052") + .addAllTransitionRoutes(new ArrayList()) + .addAllEventHandlers(new ArrayList()) + .setNluSettings(NluSettings.newBuilder().build()) + .build(); + mockFlows.addResponse(expectedResponse); + + String parent = "parent-995424086"; + Flow flow = Flow.newBuilder().build(); + Flow actualResponse = client.createFlow(parent, flow); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockFlows.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + CreateFlowRequest actualRequest = ((CreateFlowRequest) actualRequests.get(0)); + + Assert.assertEquals(parent, actualRequest.getParent()); + Assert.assertEquals(flow, actualRequest.getFlow()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void createFlowExceptionTest2() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockFlows.addException(exception); + + try { + String parent = "parent-995424086"; + Flow flow = Flow.newBuilder().build(); client.createFlow(parent, flow); Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { - // Expected exception + // Expected exception. } } @Test - @SuppressWarnings("all") - public void deleteFlowTest() { + public void deleteFlowTest() throws Exception { Empty expectedResponse = Empty.newBuilder().build(); mockFlows.addResponse(expectedResponse); @@ -179,9 +188,9 @@ public void deleteFlowTest() { List actualRequests = mockFlows.getRequests(); Assert.assertEquals(1, actualRequests.size()); - DeleteFlowRequest actualRequest = (DeleteFlowRequest) actualRequests.get(0); + DeleteFlowRequest actualRequest = ((DeleteFlowRequest) actualRequests.get(0)); - Assert.assertEquals(name, FlowName.parse(actualRequest.getName())); + Assert.assertEquals(name.toString(), actualRequest.getName()); Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), @@ -189,29 +198,61 @@ public void deleteFlowTest() { } @Test - @SuppressWarnings("all") public void deleteFlowExceptionTest() throws Exception { - StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockFlows.addException(exception); try { FlowName name = FlowName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]"); + client.deleteFlow(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + @Test + public void deleteFlowTest2() throws Exception { + Empty expectedResponse = Empty.newBuilder().build(); + mockFlows.addResponse(expectedResponse); + + String name = "name3373707"; + + client.deleteFlow(name); + + List actualRequests = mockFlows.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + DeleteFlowRequest actualRequest = ((DeleteFlowRequest) actualRequests.get(0)); + + Assert.assertEquals(name, actualRequest.getName()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void deleteFlowExceptionTest2() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockFlows.addException(exception); + + try { + String name = "name3373707"; client.deleteFlow(name); Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { - // Expected exception + // Expected exception. } } @Test - @SuppressWarnings("all") - public void listFlowsTest() { - String nextPageToken = ""; - Flow flowsElement = Flow.newBuilder().build(); - List flows = Arrays.asList(flowsElement); + public void listFlowsTest() throws Exception { + Flow responsesElement = Flow.newBuilder().build(); ListFlowsResponse expectedResponse = - ListFlowsResponse.newBuilder().setNextPageToken(nextPageToken).addAllFlows(flows).build(); + ListFlowsResponse.newBuilder() + .setNextPageToken("") + .addAllFlows(Arrays.asList(responsesElement)) + .build(); mockFlows.addResponse(expectedResponse); AgentName parent = AgentName.of("[PROJECT]", "[LOCATION]", "[AGENT]"); @@ -219,14 +260,15 @@ public void listFlowsTest() { ListFlowsPagedResponse pagedListResponse = client.listFlows(parent); List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + Assert.assertEquals(1, resources.size()); Assert.assertEquals(expectedResponse.getFlowsList().get(0), resources.get(0)); List actualRequests = mockFlows.getRequests(); Assert.assertEquals(1, actualRequests.size()); - ListFlowsRequest actualRequest = (ListFlowsRequest) actualRequests.get(0); + ListFlowsRequest actualRequest = ((ListFlowsRequest) actualRequests.get(0)); - Assert.assertEquals(parent, AgentName.parse(actualRequest.getParent())); + Assert.assertEquals(parent.toString(), actualRequest.getParent()); Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), @@ -234,32 +276,73 @@ public void listFlowsTest() { } @Test - @SuppressWarnings("all") public void listFlowsExceptionTest() throws Exception { - StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockFlows.addException(exception); try { AgentName parent = AgentName.of("[PROJECT]", "[LOCATION]", "[AGENT]"); + client.listFlows(parent); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void listFlowsTest2() throws Exception { + Flow responsesElement = Flow.newBuilder().build(); + ListFlowsResponse expectedResponse = + ListFlowsResponse.newBuilder() + .setNextPageToken("") + .addAllFlows(Arrays.asList(responsesElement)) + .build(); + mockFlows.addResponse(expectedResponse); + + String parent = "parent-995424086"; + + ListFlowsPagedResponse pagedListResponse = client.listFlows(parent); + + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getFlowsList().get(0), resources.get(0)); + + List actualRequests = mockFlows.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + ListFlowsRequest actualRequest = ((ListFlowsRequest) actualRequests.get(0)); + + Assert.assertEquals(parent, actualRequest.getParent()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + @Test + public void listFlowsExceptionTest2() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockFlows.addException(exception); + + try { + String parent = "parent-995424086"; client.listFlows(parent); Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { - // Expected exception + // Expected exception. } } @Test - @SuppressWarnings("all") - public void getFlowTest() { - FlowName name2 = FlowName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]"); - String displayName = "displayName1615086568"; - String description = "description-1724546052"; + public void getFlowTest() throws Exception { Flow expectedResponse = Flow.newBuilder() - .setName(name2.toString()) - .setDisplayName(displayName) - .setDescription(description) + .setName(FlowName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]").toString()) + .setDisplayName("displayName1714148973") + .setDescription("description-1724546052") + .addAllTransitionRoutes(new ArrayList()) + .addAllEventHandlers(new ArrayList()) + .setNluSettings(NluSettings.newBuilder().build()) .build(); mockFlows.addResponse(expectedResponse); @@ -270,9 +353,9 @@ public void getFlowTest() { List actualRequests = mockFlows.getRequests(); Assert.assertEquals(1, actualRequests.size()); - GetFlowRequest actualRequest = (GetFlowRequest) actualRequests.get(0); + GetFlowRequest actualRequest = ((GetFlowRequest) actualRequests.get(0)); - Assert.assertEquals(name, FlowName.parse(actualRequest.getName())); + Assert.assertEquals(name.toString(), actualRequest.getName()); Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), @@ -280,32 +363,72 @@ public void getFlowTest() { } @Test - @SuppressWarnings("all") public void getFlowExceptionTest() throws Exception { - StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockFlows.addException(exception); try { FlowName name = FlowName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]"); + client.getFlow(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + @Test + public void getFlowTest2() throws Exception { + Flow expectedResponse = + Flow.newBuilder() + .setName(FlowName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]").toString()) + .setDisplayName("displayName1714148973") + .setDescription("description-1724546052") + .addAllTransitionRoutes(new ArrayList()) + .addAllEventHandlers(new ArrayList()) + .setNluSettings(NluSettings.newBuilder().build()) + .build(); + mockFlows.addResponse(expectedResponse); + + String name = "name3373707"; + + Flow actualResponse = client.getFlow(name); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockFlows.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + GetFlowRequest actualRequest = ((GetFlowRequest) actualRequests.get(0)); + + Assert.assertEquals(name, actualRequest.getName()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void getFlowExceptionTest2() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockFlows.addException(exception); + + try { + String name = "name3373707"; client.getFlow(name); Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { - // Expected exception + // Expected exception. } } @Test - @SuppressWarnings("all") - public void updateFlowTest() { - FlowName name = FlowName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]"); - String displayName = "displayName1615086568"; - String description = "description-1724546052"; + public void updateFlowTest() throws Exception { Flow expectedResponse = Flow.newBuilder() - .setName(name.toString()) - .setDisplayName(displayName) - .setDescription(description) + .setName(FlowName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]").toString()) + .setDisplayName("displayName1714148973") + .setDescription("description-1724546052") + .addAllTransitionRoutes(new ArrayList()) + .addAllEventHandlers(new ArrayList()) + .setNluSettings(NluSettings.newBuilder().build()) .build(); mockFlows.addResponse(expectedResponse); @@ -317,7 +440,7 @@ public void updateFlowTest() { List actualRequests = mockFlows.getRequests(); Assert.assertEquals(1, actualRequests.size()); - UpdateFlowRequest actualRequest = (UpdateFlowRequest) actualRequests.get(0); + UpdateFlowRequest actualRequest = ((UpdateFlowRequest) actualRequests.get(0)); Assert.assertEquals(flow, actualRequest.getFlow()); Assert.assertEquals(updateMask, actualRequest.getUpdateMask()); @@ -328,24 +451,21 @@ public void updateFlowTest() { } @Test - @SuppressWarnings("all") public void updateFlowExceptionTest() throws Exception { - StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockFlows.addException(exception); try { Flow flow = Flow.newBuilder().build(); FieldMask updateMask = FieldMask.newBuilder().build(); - client.updateFlow(flow, updateMask); Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { - // Expected exception + // Expected exception. } } @Test - @SuppressWarnings("all") public void trainFlowTest() throws Exception { Empty expectedResponse = Empty.newBuilder().build(); Operation resultOperation = @@ -358,14 +478,13 @@ public void trainFlowTest() throws Exception { FlowName name = FlowName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]"); - Empty actualResponse = client.trainFlowAsync(name).get(); - Assert.assertEquals(expectedResponse, actualResponse); + client.trainFlowAsync(name).get(); List actualRequests = mockFlows.getRequests(); Assert.assertEquals(1, actualRequests.size()); - TrainFlowRequest actualRequest = (TrainFlowRequest) actualRequests.get(0); + TrainFlowRequest actualRequest = ((TrainFlowRequest) actualRequests.get(0)); - Assert.assertEquals(name, FlowName.parse(actualRequest.getName())); + Assert.assertEquals(name.toString(), actualRequest.getName()); Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), @@ -373,19 +492,59 @@ public void trainFlowTest() throws Exception { } @Test - @SuppressWarnings("all") public void trainFlowExceptionTest() throws Exception { - StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockFlows.addException(exception); try { FlowName name = FlowName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]"); + client.trainFlowAsync(name).get(); + Assert.fail("No exception raised"); + } catch (ExecutionException e) { + Assert.assertEquals(InvalidArgumentException.class, e.getCause().getClass()); + InvalidArgumentException apiException = ((InvalidArgumentException) e.getCause()); + Assert.assertEquals(StatusCode.Code.INVALID_ARGUMENT, apiException.getStatusCode().getCode()); + } + } + + @Test + public void trainFlowTest2() throws Exception { + Empty expectedResponse = Empty.newBuilder().build(); + Operation resultOperation = + Operation.newBuilder() + .setName("trainFlowTest") + .setDone(true) + .setResponse(Any.pack(expectedResponse)) + .build(); + mockFlows.addResponse(resultOperation); + + String name = "name3373707"; + client.trainFlowAsync(name).get(); + + List actualRequests = mockFlows.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + TrainFlowRequest actualRequest = ((TrainFlowRequest) actualRequests.get(0)); + + Assert.assertEquals(name, actualRequest.getName()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void trainFlowExceptionTest2() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockFlows.addException(exception); + + try { + String name = "name3373707"; client.trainFlowAsync(name).get(); Assert.fail("No exception raised"); } catch (ExecutionException e) { Assert.assertEquals(InvalidArgumentException.class, e.getCause().getClass()); - InvalidArgumentException apiException = (InvalidArgumentException) e.getCause(); + InvalidArgumentException apiException = ((InvalidArgumentException) e.getCause()); Assert.assertEquals(StatusCode.Code.INVALID_ARGUMENT, apiException.getStatusCode().getCode()); } } diff --git a/google-cloud-dialogflow-cx/src/test/java/com/google/cloud/dialogflow/cx/v3/IntentsClientTest.java b/google-cloud-dialogflow-cx/src/test/java/com/google/cloud/dialogflow/cx/v3/IntentsClientTest.java index e6b9bf3e5..db2d2dd0b 100644 --- a/google-cloud-dialogflow-cx/src/test/java/com/google/cloud/dialogflow/cx/v3/IntentsClientTest.java +++ b/google-cloud-dialogflow-cx/src/test/java/com/google/cloud/dialogflow/cx/v3/IntentsClientTest.java @@ -5,7 +5,7 @@ * 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 + * 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, @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.google.cloud.dialogflow.cx.v3; import static com.google.cloud.dialogflow.cx.v3.IntentsClient.ListIntentsPagedResponse; @@ -28,12 +29,14 @@ import com.google.protobuf.AbstractMessage; import com.google.protobuf.Empty; import com.google.protobuf.FieldMask; -import io.grpc.Status; 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; import org.junit.After; import org.junit.AfterClass; import org.junit.Assert; @@ -41,66 +44,31 @@ import org.junit.BeforeClass; import org.junit.Test; -@javax.annotation.Generated("by GAPIC") +@Generated("by gapic-generator-java") public class IntentsClientTest { - private static MockPages mockPages; - private static MockFlows mockFlows; - private static MockAgents mockAgents; - private static MockEntityTypes mockEntityTypes; - private static MockEnvironments mockEnvironments; + private static MockServiceHelper mockServiceHelper; private static MockIntents mockIntents; - private static MockSecuritySettingsService mockSecuritySettingsService; - private static MockSessionEntityTypes mockSessionEntityTypes; - private static MockSessions mockSessions; - private static MockTransitionRouteGroups mockTransitionRouteGroups; - private static MockVersions mockVersions; - private static MockWebhooks mockWebhooks; - private static MockServiceHelper serviceHelper; private IntentsClient client; private LocalChannelProvider channelProvider; @BeforeClass public static void startStaticServer() { - mockPages = new MockPages(); - mockFlows = new MockFlows(); - mockAgents = new MockAgents(); - mockEntityTypes = new MockEntityTypes(); - mockEnvironments = new MockEnvironments(); mockIntents = new MockIntents(); - mockSecuritySettingsService = new MockSecuritySettingsService(); - mockSessionEntityTypes = new MockSessionEntityTypes(); - mockSessions = new MockSessions(); - mockTransitionRouteGroups = new MockTransitionRouteGroups(); - mockVersions = new MockVersions(); - mockWebhooks = new MockWebhooks(); - serviceHelper = + mockServiceHelper = new MockServiceHelper( - UUID.randomUUID().toString(), - Arrays.asList( - mockPages, - mockFlows, - mockAgents, - mockEntityTypes, - mockEnvironments, - mockIntents, - mockSecuritySettingsService, - mockSessionEntityTypes, - mockSessions, - mockTransitionRouteGroups, - mockVersions, - mockWebhooks)); - serviceHelper.start(); + UUID.randomUUID().toString(), Arrays.asList(mockIntents)); + mockServiceHelper.start(); } @AfterClass public static void stopServer() { - serviceHelper.stop(); + mockServiceHelper.stop(); } @Before public void setUp() throws IOException { - serviceHelper.reset(); - channelProvider = serviceHelper.createChannelProvider(); + mockServiceHelper.reset(); + channelProvider = mockServiceHelper.createChannelProvider(); IntentsSettings settings = IntentsSettings.newBuilder() .setTransportChannelProvider(channelProvider) @@ -115,15 +83,12 @@ public void tearDown() throws Exception { } @Test - @SuppressWarnings("all") - public void listIntentsTest() { - String nextPageToken = ""; - Intent intentsElement = Intent.newBuilder().build(); - List intents = Arrays.asList(intentsElement); + public void listIntentsTest() throws Exception { + Intent responsesElement = Intent.newBuilder().build(); ListIntentsResponse expectedResponse = ListIntentsResponse.newBuilder() - .setNextPageToken(nextPageToken) - .addAllIntents(intents) + .setNextPageToken("") + .addAllIntents(Arrays.asList(responsesElement)) .build(); mockIntents.addResponse(expectedResponse); @@ -132,14 +97,15 @@ public void listIntentsTest() { ListIntentsPagedResponse pagedListResponse = client.listIntents(parent); List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + Assert.assertEquals(1, resources.size()); Assert.assertEquals(expectedResponse.getIntentsList().get(0), resources.get(0)); List actualRequests = mockIntents.getRequests(); Assert.assertEquals(1, actualRequests.size()); - ListIntentsRequest actualRequest = (ListIntentsRequest) actualRequests.get(0); + ListIntentsRequest actualRequest = ((ListIntentsRequest) actualRequests.get(0)); - Assert.assertEquals(parent, AgentName.parse(actualRequest.getParent())); + Assert.assertEquals(parent.toString(), actualRequest.getParent()); Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), @@ -147,36 +113,75 @@ public void listIntentsTest() { } @Test - @SuppressWarnings("all") public void listIntentsExceptionTest() throws Exception { - StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockIntents.addException(exception); try { AgentName parent = AgentName.of("[PROJECT]", "[LOCATION]", "[AGENT]"); + client.listIntents(parent); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void listIntentsTest2() throws Exception { + Intent responsesElement = Intent.newBuilder().build(); + ListIntentsResponse expectedResponse = + ListIntentsResponse.newBuilder() + .setNextPageToken("") + .addAllIntents(Arrays.asList(responsesElement)) + .build(); + mockIntents.addResponse(expectedResponse); + + String parent = "parent-995424086"; + + ListIntentsPagedResponse pagedListResponse = client.listIntents(parent); + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getIntentsList().get(0), resources.get(0)); + + List actualRequests = mockIntents.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + ListIntentsRequest actualRequest = ((ListIntentsRequest) actualRequests.get(0)); + + Assert.assertEquals(parent, actualRequest.getParent()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void listIntentsExceptionTest2() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockIntents.addException(exception); + + try { + String parent = "parent-995424086"; client.listIntents(parent); Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { - // Expected exception + // Expected exception. } } @Test - @SuppressWarnings("all") - public void getIntentTest() { - IntentName name2 = IntentName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[INTENT]"); - String displayName = "displayName1615086568"; - int priority = 1165461084; - boolean isFallback = false; - String description = "description-1724546052"; + public void getIntentTest() throws Exception { Intent expectedResponse = Intent.newBuilder() - .setName(name2.toString()) - .setDisplayName(displayName) - .setPriority(priority) - .setIsFallback(isFallback) - .setDescription(description) + .setName(IntentName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[INTENT]").toString()) + .setDisplayName("displayName1714148973") + .addAllTrainingPhrases(new ArrayList()) + .addAllParameters(new ArrayList()) + .setPriority(-1165461084) + .setIsFallback(true) + .putAllLabels(new HashMap()) + .setDescription("description-1724546052") .build(); mockIntents.addResponse(expectedResponse); @@ -187,9 +192,9 @@ public void getIntentTest() { List actualRequests = mockIntents.getRequests(); Assert.assertEquals(1, actualRequests.size()); - GetIntentRequest actualRequest = (GetIntentRequest) actualRequests.get(0); + GetIntentRequest actualRequest = ((GetIntentRequest) actualRequests.get(0)); - Assert.assertEquals(name, IntentName.parse(actualRequest.getName())); + Assert.assertEquals(name.toString(), actualRequest.getName()); Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), @@ -197,36 +202,76 @@ public void getIntentTest() { } @Test - @SuppressWarnings("all") public void getIntentExceptionTest() throws Exception { - StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockIntents.addException(exception); try { IntentName name = IntentName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[INTENT]"); + client.getIntent(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void getIntentTest2() throws Exception { + Intent expectedResponse = + Intent.newBuilder() + .setName(IntentName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[INTENT]").toString()) + .setDisplayName("displayName1714148973") + .addAllTrainingPhrases(new ArrayList()) + .addAllParameters(new ArrayList()) + .setPriority(-1165461084) + .setIsFallback(true) + .putAllLabels(new HashMap()) + .setDescription("description-1724546052") + .build(); + mockIntents.addResponse(expectedResponse); + + String name = "name3373707"; + + Intent actualResponse = client.getIntent(name); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockIntents.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + GetIntentRequest actualRequest = ((GetIntentRequest) actualRequests.get(0)); + + Assert.assertEquals(name, actualRequest.getName()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void getIntentExceptionTest2() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockIntents.addException(exception); + try { + String name = "name3373707"; client.getIntent(name); Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { - // Expected exception + // Expected exception. } } @Test - @SuppressWarnings("all") - public void createIntentTest() { - IntentName name = IntentName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[INTENT]"); - String displayName = "displayName1615086568"; - int priority = 1165461084; - boolean isFallback = false; - String description = "description-1724546052"; + public void createIntentTest() throws Exception { Intent expectedResponse = Intent.newBuilder() - .setName(name.toString()) - .setDisplayName(displayName) - .setPriority(priority) - .setIsFallback(isFallback) - .setDescription(description) + .setName(IntentName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[INTENT]").toString()) + .setDisplayName("displayName1714148973") + .addAllTrainingPhrases(new ArrayList()) + .addAllParameters(new ArrayList()) + .setPriority(-1165461084) + .setIsFallback(true) + .putAllLabels(new HashMap()) + .setDescription("description-1724546052") .build(); mockIntents.addResponse(expectedResponse); @@ -238,9 +283,9 @@ public void createIntentTest() { List actualRequests = mockIntents.getRequests(); Assert.assertEquals(1, actualRequests.size()); - CreateIntentRequest actualRequest = (CreateIntentRequest) actualRequests.get(0); + CreateIntentRequest actualRequest = ((CreateIntentRequest) actualRequests.get(0)); - Assert.assertEquals(parent, AgentName.parse(actualRequest.getParent())); + Assert.assertEquals(parent.toString(), actualRequest.getParent()); Assert.assertEquals(intent, actualRequest.getIntent()); Assert.assertTrue( channelProvider.isHeaderSent( @@ -249,37 +294,80 @@ public void createIntentTest() { } @Test - @SuppressWarnings("all") public void createIntentExceptionTest() throws Exception { - StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockIntents.addException(exception); try { AgentName parent = AgentName.of("[PROJECT]", "[LOCATION]", "[AGENT]"); Intent intent = Intent.newBuilder().build(); + client.createIntent(parent, intent); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void createIntentTest2() throws Exception { + Intent expectedResponse = + Intent.newBuilder() + .setName(IntentName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[INTENT]").toString()) + .setDisplayName("displayName1714148973") + .addAllTrainingPhrases(new ArrayList()) + .addAllParameters(new ArrayList()) + .setPriority(-1165461084) + .setIsFallback(true) + .putAllLabels(new HashMap()) + .setDescription("description-1724546052") + .build(); + mockIntents.addResponse(expectedResponse); + + String parent = "parent-995424086"; + Intent intent = Intent.newBuilder().build(); + + Intent actualResponse = client.createIntent(parent, intent); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockIntents.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + CreateIntentRequest actualRequest = ((CreateIntentRequest) actualRequests.get(0)); + + Assert.assertEquals(parent, actualRequest.getParent()); + Assert.assertEquals(intent, actualRequest.getIntent()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void createIntentExceptionTest2() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockIntents.addException(exception); + try { + String parent = "parent-995424086"; + Intent intent = Intent.newBuilder().build(); client.createIntent(parent, intent); Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { - // Expected exception + // Expected exception. } } @Test - @SuppressWarnings("all") - public void updateIntentTest() { - IntentName name = IntentName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[INTENT]"); - String displayName = "displayName1615086568"; - int priority = 1165461084; - boolean isFallback = false; - String description = "description-1724546052"; + public void updateIntentTest() throws Exception { Intent expectedResponse = Intent.newBuilder() - .setName(name.toString()) - .setDisplayName(displayName) - .setPriority(priority) - .setIsFallback(isFallback) - .setDescription(description) + .setName(IntentName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[INTENT]").toString()) + .setDisplayName("displayName1714148973") + .addAllTrainingPhrases(new ArrayList()) + .addAllParameters(new ArrayList()) + .setPriority(-1165461084) + .setIsFallback(true) + .putAllLabels(new HashMap()) + .setDescription("description-1724546052") .build(); mockIntents.addResponse(expectedResponse); @@ -291,7 +379,7 @@ public void updateIntentTest() { List actualRequests = mockIntents.getRequests(); Assert.assertEquals(1, actualRequests.size()); - UpdateIntentRequest actualRequest = (UpdateIntentRequest) actualRequests.get(0); + UpdateIntentRequest actualRequest = ((UpdateIntentRequest) actualRequests.get(0)); Assert.assertEquals(intent, actualRequest.getIntent()); Assert.assertEquals(updateMask, actualRequest.getUpdateMask()); @@ -302,25 +390,22 @@ public void updateIntentTest() { } @Test - @SuppressWarnings("all") public void updateIntentExceptionTest() throws Exception { - StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockIntents.addException(exception); try { Intent intent = Intent.newBuilder().build(); FieldMask updateMask = FieldMask.newBuilder().build(); - client.updateIntent(intent, updateMask); Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { - // Expected exception + // Expected exception. } } @Test - @SuppressWarnings("all") - public void deleteIntentTest() { + public void deleteIntentTest() throws Exception { Empty expectedResponse = Empty.newBuilder().build(); mockIntents.addResponse(expectedResponse); @@ -330,9 +415,9 @@ public void deleteIntentTest() { List actualRequests = mockIntents.getRequests(); Assert.assertEquals(1, actualRequests.size()); - DeleteIntentRequest actualRequest = (DeleteIntentRequest) actualRequests.get(0); + DeleteIntentRequest actualRequest = ((DeleteIntentRequest) actualRequests.get(0)); - Assert.assertEquals(name, IntentName.parse(actualRequest.getName())); + Assert.assertEquals(name.toString(), actualRequest.getName()); Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), @@ -340,18 +425,50 @@ public void deleteIntentTest() { } @Test - @SuppressWarnings("all") public void deleteIntentExceptionTest() throws Exception { - StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockIntents.addException(exception); try { IntentName name = IntentName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[INTENT]"); + client.deleteIntent(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void deleteIntentTest2() throws Exception { + Empty expectedResponse = Empty.newBuilder().build(); + mockIntents.addResponse(expectedResponse); + + String name = "name3373707"; + client.deleteIntent(name); + + List actualRequests = mockIntents.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + DeleteIntentRequest actualRequest = ((DeleteIntentRequest) actualRequests.get(0)); + + Assert.assertEquals(name, actualRequest.getName()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void deleteIntentExceptionTest2() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockIntents.addException(exception); + + try { + String name = "name3373707"; client.deleteIntent(name); Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { - // Expected exception + // Expected exception. } } } diff --git a/google-cloud-dialogflow-cx/src/test/java/com/google/cloud/dialogflow/cx/v3/MockAgents.java b/google-cloud-dialogflow-cx/src/test/java/com/google/cloud/dialogflow/cx/v3/MockAgents.java index f5a430929..e0d449274 100644 --- a/google-cloud-dialogflow-cx/src/test/java/com/google/cloud/dialogflow/cx/v3/MockAgents.java +++ b/google-cloud-dialogflow-cx/src/test/java/com/google/cloud/dialogflow/cx/v3/MockAgents.java @@ -5,7 +5,7 @@ * 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 + * 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, @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.google.cloud.dialogflow.cx.v3; import com.google.api.core.BetaApi; @@ -20,9 +21,10 @@ import com.google.protobuf.AbstractMessage; import io.grpc.ServerServiceDefinition; import java.util.List; +import javax.annotation.Generated; -@javax.annotation.Generated("by GAPIC") @BetaApi +@Generated("by gapic-generator-java") public class MockAgents implements MockGrpcService { private final MockAgentsImpl serviceImpl; diff --git a/google-cloud-dialogflow-cx/src/test/java/com/google/cloud/dialogflow/cx/v3/MockAgentsImpl.java b/google-cloud-dialogflow-cx/src/test/java/com/google/cloud/dialogflow/cx/v3/MockAgentsImpl.java index 17d17fbf3..426b233e8 100644 --- a/google-cloud-dialogflow-cx/src/test/java/com/google/cloud/dialogflow/cx/v3/MockAgentsImpl.java +++ b/google-cloud-dialogflow-cx/src/test/java/com/google/cloud/dialogflow/cx/v3/MockAgentsImpl.java @@ -5,7 +5,7 @@ * 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 + * 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, @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.google.cloud.dialogflow.cx.v3; import com.google.api.core.BetaApi; @@ -25,9 +26,10 @@ import java.util.LinkedList; import java.util.List; import java.util.Queue; +import javax.annotation.Generated; -@javax.annotation.Generated("by GAPIC") @BetaApi +@Generated("by gapic-generator-java") public class MockAgentsImpl extends AgentsImplBase { private List requests; private Queue responses; @@ -64,10 +66,10 @@ public void listAgents( Object response = responses.remove(); if (response instanceof ListAgentsResponse) { requests.add(request); - responseObserver.onNext((ListAgentsResponse) response); + responseObserver.onNext(((ListAgentsResponse) response)); responseObserver.onCompleted(); } else if (response instanceof Exception) { - responseObserver.onError((Exception) response); + responseObserver.onError(((Exception) response)); } else { responseObserver.onError(new IllegalArgumentException("Unrecognized response type")); } @@ -78,10 +80,10 @@ public void getAgent(GetAgentRequest request, StreamObserver responseObse Object response = responses.remove(); if (response instanceof Agent) { requests.add(request); - responseObserver.onNext((Agent) response); + responseObserver.onNext(((Agent) response)); responseObserver.onCompleted(); } else if (response instanceof Exception) { - responseObserver.onError((Exception) response); + responseObserver.onError(((Exception) response)); } else { responseObserver.onError(new IllegalArgumentException("Unrecognized response type")); } @@ -92,10 +94,10 @@ public void createAgent(CreateAgentRequest request, StreamObserver respon Object response = responses.remove(); if (response instanceof Agent) { requests.add(request); - responseObserver.onNext((Agent) response); + responseObserver.onNext(((Agent) response)); responseObserver.onCompleted(); } else if (response instanceof Exception) { - responseObserver.onError((Exception) response); + responseObserver.onError(((Exception) response)); } else { responseObserver.onError(new IllegalArgumentException("Unrecognized response type")); } @@ -106,10 +108,10 @@ public void updateAgent(UpdateAgentRequest request, StreamObserver respon Object response = responses.remove(); if (response instanceof Agent) { requests.add(request); - responseObserver.onNext((Agent) response); + responseObserver.onNext(((Agent) response)); responseObserver.onCompleted(); } else if (response instanceof Exception) { - responseObserver.onError((Exception) response); + responseObserver.onError(((Exception) response)); } else { responseObserver.onError(new IllegalArgumentException("Unrecognized response type")); } @@ -120,10 +122,10 @@ public void deleteAgent(DeleteAgentRequest request, StreamObserver respon Object response = responses.remove(); if (response instanceof Empty) { requests.add(request); - responseObserver.onNext((Empty) response); + responseObserver.onNext(((Empty) response)); responseObserver.onCompleted(); } else if (response instanceof Exception) { - responseObserver.onError((Exception) response); + responseObserver.onError(((Exception) response)); } else { responseObserver.onError(new IllegalArgumentException("Unrecognized response type")); } @@ -134,10 +136,10 @@ public void exportAgent(ExportAgentRequest request, StreamObserver re Object response = responses.remove(); if (response instanceof Operation) { requests.add(request); - responseObserver.onNext((Operation) response); + responseObserver.onNext(((Operation) response)); responseObserver.onCompleted(); } else if (response instanceof Exception) { - responseObserver.onError((Exception) response); + responseObserver.onError(((Exception) response)); } else { responseObserver.onError(new IllegalArgumentException("Unrecognized response type")); } @@ -149,10 +151,10 @@ public void restoreAgent( Object response = responses.remove(); if (response instanceof Operation) { requests.add(request); - responseObserver.onNext((Operation) response); + responseObserver.onNext(((Operation) response)); responseObserver.onCompleted(); } else if (response instanceof Exception) { - responseObserver.onError((Exception) response); + responseObserver.onError(((Exception) response)); } else { responseObserver.onError(new IllegalArgumentException("Unrecognized response type")); } diff --git a/google-cloud-dialogflow-cx/src/test/java/com/google/cloud/dialogflow/cx/v3/MockEntityTypes.java b/google-cloud-dialogflow-cx/src/test/java/com/google/cloud/dialogflow/cx/v3/MockEntityTypes.java index 1570914a3..3bac14586 100644 --- a/google-cloud-dialogflow-cx/src/test/java/com/google/cloud/dialogflow/cx/v3/MockEntityTypes.java +++ b/google-cloud-dialogflow-cx/src/test/java/com/google/cloud/dialogflow/cx/v3/MockEntityTypes.java @@ -5,7 +5,7 @@ * 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 + * 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, @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.google.cloud.dialogflow.cx.v3; import com.google.api.core.BetaApi; @@ -20,9 +21,10 @@ import com.google.protobuf.AbstractMessage; import io.grpc.ServerServiceDefinition; import java.util.List; +import javax.annotation.Generated; -@javax.annotation.Generated("by GAPIC") @BetaApi +@Generated("by gapic-generator-java") public class MockEntityTypes implements MockGrpcService { private final MockEntityTypesImpl serviceImpl; diff --git a/google-cloud-dialogflow-cx/src/test/java/com/google/cloud/dialogflow/cx/v3/MockEntityTypesImpl.java b/google-cloud-dialogflow-cx/src/test/java/com/google/cloud/dialogflow/cx/v3/MockEntityTypesImpl.java index 605eaef90..dd786e325 100644 --- a/google-cloud-dialogflow-cx/src/test/java/com/google/cloud/dialogflow/cx/v3/MockEntityTypesImpl.java +++ b/google-cloud-dialogflow-cx/src/test/java/com/google/cloud/dialogflow/cx/v3/MockEntityTypesImpl.java @@ -5,7 +5,7 @@ * 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 + * 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, @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.google.cloud.dialogflow.cx.v3; import com.google.api.core.BetaApi; @@ -24,9 +25,10 @@ import java.util.LinkedList; import java.util.List; import java.util.Queue; +import javax.annotation.Generated; -@javax.annotation.Generated("by GAPIC") @BetaApi +@Generated("by gapic-generator-java") public class MockEntityTypesImpl extends EntityTypesImplBase { private List requests; private Queue responses; @@ -63,10 +65,10 @@ public void listEntityTypes( Object response = responses.remove(); if (response instanceof ListEntityTypesResponse) { requests.add(request); - responseObserver.onNext((ListEntityTypesResponse) response); + responseObserver.onNext(((ListEntityTypesResponse) response)); responseObserver.onCompleted(); } else if (response instanceof Exception) { - responseObserver.onError((Exception) response); + responseObserver.onError(((Exception) response)); } else { responseObserver.onError(new IllegalArgumentException("Unrecognized response type")); } @@ -78,10 +80,10 @@ public void getEntityType( Object response = responses.remove(); if (response instanceof EntityType) { requests.add(request); - responseObserver.onNext((EntityType) response); + responseObserver.onNext(((EntityType) response)); responseObserver.onCompleted(); } else if (response instanceof Exception) { - responseObserver.onError((Exception) response); + responseObserver.onError(((Exception) response)); } else { responseObserver.onError(new IllegalArgumentException("Unrecognized response type")); } @@ -93,10 +95,10 @@ public void createEntityType( Object response = responses.remove(); if (response instanceof EntityType) { requests.add(request); - responseObserver.onNext((EntityType) response); + responseObserver.onNext(((EntityType) response)); responseObserver.onCompleted(); } else if (response instanceof Exception) { - responseObserver.onError((Exception) response); + responseObserver.onError(((Exception) response)); } else { responseObserver.onError(new IllegalArgumentException("Unrecognized response type")); } @@ -108,10 +110,10 @@ public void updateEntityType( Object response = responses.remove(); if (response instanceof EntityType) { requests.add(request); - responseObserver.onNext((EntityType) response); + responseObserver.onNext(((EntityType) response)); responseObserver.onCompleted(); } else if (response instanceof Exception) { - responseObserver.onError((Exception) response); + responseObserver.onError(((Exception) response)); } else { responseObserver.onError(new IllegalArgumentException("Unrecognized response type")); } @@ -123,10 +125,10 @@ public void deleteEntityType( Object response = responses.remove(); if (response instanceof Empty) { requests.add(request); - responseObserver.onNext((Empty) response); + responseObserver.onNext(((Empty) response)); responseObserver.onCompleted(); } else if (response instanceof Exception) { - responseObserver.onError((Exception) response); + responseObserver.onError(((Exception) response)); } else { responseObserver.onError(new IllegalArgumentException("Unrecognized response type")); } diff --git a/google-cloud-dialogflow-cx/src/test/java/com/google/cloud/dialogflow/cx/v3/MockEnvironments.java b/google-cloud-dialogflow-cx/src/test/java/com/google/cloud/dialogflow/cx/v3/MockEnvironments.java index 686bffbe8..de9027237 100644 --- a/google-cloud-dialogflow-cx/src/test/java/com/google/cloud/dialogflow/cx/v3/MockEnvironments.java +++ b/google-cloud-dialogflow-cx/src/test/java/com/google/cloud/dialogflow/cx/v3/MockEnvironments.java @@ -5,7 +5,7 @@ * 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 + * 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, @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.google.cloud.dialogflow.cx.v3; import com.google.api.core.BetaApi; @@ -20,9 +21,10 @@ import com.google.protobuf.AbstractMessage; import io.grpc.ServerServiceDefinition; import java.util.List; +import javax.annotation.Generated; -@javax.annotation.Generated("by GAPIC") @BetaApi +@Generated("by gapic-generator-java") public class MockEnvironments implements MockGrpcService { private final MockEnvironmentsImpl serviceImpl; diff --git a/google-cloud-dialogflow-cx/src/test/java/com/google/cloud/dialogflow/cx/v3/MockEnvironmentsImpl.java b/google-cloud-dialogflow-cx/src/test/java/com/google/cloud/dialogflow/cx/v3/MockEnvironmentsImpl.java index 27327036b..de4a9f76c 100644 --- a/google-cloud-dialogflow-cx/src/test/java/com/google/cloud/dialogflow/cx/v3/MockEnvironmentsImpl.java +++ b/google-cloud-dialogflow-cx/src/test/java/com/google/cloud/dialogflow/cx/v3/MockEnvironmentsImpl.java @@ -5,7 +5,7 @@ * 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 + * 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, @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.google.cloud.dialogflow.cx.v3; import com.google.api.core.BetaApi; @@ -25,9 +26,10 @@ import java.util.LinkedList; import java.util.List; import java.util.Queue; +import javax.annotation.Generated; -@javax.annotation.Generated("by GAPIC") @BetaApi +@Generated("by gapic-generator-java") public class MockEnvironmentsImpl extends EnvironmentsImplBase { private List requests; private Queue responses; @@ -64,10 +66,10 @@ public void listEnvironments( Object response = responses.remove(); if (response instanceof ListEnvironmentsResponse) { requests.add(request); - responseObserver.onNext((ListEnvironmentsResponse) response); + responseObserver.onNext(((ListEnvironmentsResponse) response)); responseObserver.onCompleted(); } else if (response instanceof Exception) { - responseObserver.onError((Exception) response); + responseObserver.onError(((Exception) response)); } else { responseObserver.onError(new IllegalArgumentException("Unrecognized response type")); } @@ -79,10 +81,10 @@ public void getEnvironment( Object response = responses.remove(); if (response instanceof Environment) { requests.add(request); - responseObserver.onNext((Environment) response); + responseObserver.onNext(((Environment) response)); responseObserver.onCompleted(); } else if (response instanceof Exception) { - responseObserver.onError((Exception) response); + responseObserver.onError(((Exception) response)); } else { responseObserver.onError(new IllegalArgumentException("Unrecognized response type")); } @@ -94,10 +96,10 @@ public void createEnvironment( Object response = responses.remove(); if (response instanceof Operation) { requests.add(request); - responseObserver.onNext((Operation) response); + responseObserver.onNext(((Operation) response)); responseObserver.onCompleted(); } else if (response instanceof Exception) { - responseObserver.onError((Exception) response); + responseObserver.onError(((Exception) response)); } else { responseObserver.onError(new IllegalArgumentException("Unrecognized response type")); } @@ -109,10 +111,10 @@ public void updateEnvironment( Object response = responses.remove(); if (response instanceof Operation) { requests.add(request); - responseObserver.onNext((Operation) response); + responseObserver.onNext(((Operation) response)); responseObserver.onCompleted(); } else if (response instanceof Exception) { - responseObserver.onError((Exception) response); + responseObserver.onError(((Exception) response)); } else { responseObserver.onError(new IllegalArgumentException("Unrecognized response type")); } @@ -124,10 +126,10 @@ public void deleteEnvironment( Object response = responses.remove(); if (response instanceof Empty) { requests.add(request); - responseObserver.onNext((Empty) response); + responseObserver.onNext(((Empty) response)); responseObserver.onCompleted(); } else if (response instanceof Exception) { - responseObserver.onError((Exception) response); + responseObserver.onError(((Exception) response)); } else { responseObserver.onError(new IllegalArgumentException("Unrecognized response type")); } @@ -140,10 +142,10 @@ public void lookupEnvironmentHistory( Object response = responses.remove(); if (response instanceof LookupEnvironmentHistoryResponse) { requests.add(request); - responseObserver.onNext((LookupEnvironmentHistoryResponse) response); + responseObserver.onNext(((LookupEnvironmentHistoryResponse) response)); responseObserver.onCompleted(); } else if (response instanceof Exception) { - responseObserver.onError((Exception) response); + responseObserver.onError(((Exception) response)); } else { responseObserver.onError(new IllegalArgumentException("Unrecognized response type")); } diff --git a/google-cloud-dialogflow-cx/src/test/java/com/google/cloud/dialogflow/cx/v3/MockFlows.java b/google-cloud-dialogflow-cx/src/test/java/com/google/cloud/dialogflow/cx/v3/MockFlows.java index cc047fe72..99336db3a 100644 --- a/google-cloud-dialogflow-cx/src/test/java/com/google/cloud/dialogflow/cx/v3/MockFlows.java +++ b/google-cloud-dialogflow-cx/src/test/java/com/google/cloud/dialogflow/cx/v3/MockFlows.java @@ -5,7 +5,7 @@ * 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 + * 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, @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.google.cloud.dialogflow.cx.v3; import com.google.api.core.BetaApi; @@ -20,9 +21,10 @@ import com.google.protobuf.AbstractMessage; import io.grpc.ServerServiceDefinition; import java.util.List; +import javax.annotation.Generated; -@javax.annotation.Generated("by GAPIC") @BetaApi +@Generated("by gapic-generator-java") public class MockFlows implements MockGrpcService { private final MockFlowsImpl serviceImpl; diff --git a/google-cloud-dialogflow-cx/src/test/java/com/google/cloud/dialogflow/cx/v3/MockFlowsImpl.java b/google-cloud-dialogflow-cx/src/test/java/com/google/cloud/dialogflow/cx/v3/MockFlowsImpl.java index c050524cc..766767054 100644 --- a/google-cloud-dialogflow-cx/src/test/java/com/google/cloud/dialogflow/cx/v3/MockFlowsImpl.java +++ b/google-cloud-dialogflow-cx/src/test/java/com/google/cloud/dialogflow/cx/v3/MockFlowsImpl.java @@ -5,7 +5,7 @@ * 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 + * 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, @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.google.cloud.dialogflow.cx.v3; import com.google.api.core.BetaApi; @@ -25,9 +26,10 @@ import java.util.LinkedList; import java.util.List; import java.util.Queue; +import javax.annotation.Generated; -@javax.annotation.Generated("by GAPIC") @BetaApi +@Generated("by gapic-generator-java") public class MockFlowsImpl extends FlowsImplBase { private List requests; private Queue responses; @@ -63,10 +65,10 @@ public void createFlow(CreateFlowRequest request, StreamObserver responseO Object response = responses.remove(); if (response instanceof Flow) { requests.add(request); - responseObserver.onNext((Flow) response); + responseObserver.onNext(((Flow) response)); responseObserver.onCompleted(); } else if (response instanceof Exception) { - responseObserver.onError((Exception) response); + responseObserver.onError(((Exception) response)); } else { responseObserver.onError(new IllegalArgumentException("Unrecognized response type")); } @@ -77,10 +79,10 @@ public void deleteFlow(DeleteFlowRequest request, StreamObserver response Object response = responses.remove(); if (response instanceof Empty) { requests.add(request); - responseObserver.onNext((Empty) response); + responseObserver.onNext(((Empty) response)); responseObserver.onCompleted(); } else if (response instanceof Exception) { - responseObserver.onError((Exception) response); + responseObserver.onError(((Exception) response)); } else { responseObserver.onError(new IllegalArgumentException("Unrecognized response type")); } @@ -92,10 +94,10 @@ public void listFlows( Object response = responses.remove(); if (response instanceof ListFlowsResponse) { requests.add(request); - responseObserver.onNext((ListFlowsResponse) response); + responseObserver.onNext(((ListFlowsResponse) response)); responseObserver.onCompleted(); } else if (response instanceof Exception) { - responseObserver.onError((Exception) response); + responseObserver.onError(((Exception) response)); } else { responseObserver.onError(new IllegalArgumentException("Unrecognized response type")); } @@ -106,10 +108,10 @@ public void getFlow(GetFlowRequest request, StreamObserver responseObserve Object response = responses.remove(); if (response instanceof Flow) { requests.add(request); - responseObserver.onNext((Flow) response); + responseObserver.onNext(((Flow) response)); responseObserver.onCompleted(); } else if (response instanceof Exception) { - responseObserver.onError((Exception) response); + responseObserver.onError(((Exception) response)); } else { responseObserver.onError(new IllegalArgumentException("Unrecognized response type")); } @@ -120,10 +122,10 @@ public void updateFlow(UpdateFlowRequest request, StreamObserver responseO Object response = responses.remove(); if (response instanceof Flow) { requests.add(request); - responseObserver.onNext((Flow) response); + responseObserver.onNext(((Flow) response)); responseObserver.onCompleted(); } else if (response instanceof Exception) { - responseObserver.onError((Exception) response); + responseObserver.onError(((Exception) response)); } else { responseObserver.onError(new IllegalArgumentException("Unrecognized response type")); } @@ -134,10 +136,10 @@ public void trainFlow(TrainFlowRequest request, StreamObserver respon Object response = responses.remove(); if (response instanceof Operation) { requests.add(request); - responseObserver.onNext((Operation) response); + responseObserver.onNext(((Operation) response)); responseObserver.onCompleted(); } else if (response instanceof Exception) { - responseObserver.onError((Exception) response); + responseObserver.onError(((Exception) response)); } else { responseObserver.onError(new IllegalArgumentException("Unrecognized response type")); } diff --git a/google-cloud-dialogflow-cx/src/test/java/com/google/cloud/dialogflow/cx/v3/MockIntents.java b/google-cloud-dialogflow-cx/src/test/java/com/google/cloud/dialogflow/cx/v3/MockIntents.java index 34eede986..951d3e6f9 100644 --- a/google-cloud-dialogflow-cx/src/test/java/com/google/cloud/dialogflow/cx/v3/MockIntents.java +++ b/google-cloud-dialogflow-cx/src/test/java/com/google/cloud/dialogflow/cx/v3/MockIntents.java @@ -5,7 +5,7 @@ * 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 + * 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, @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.google.cloud.dialogflow.cx.v3; import com.google.api.core.BetaApi; @@ -20,9 +21,10 @@ import com.google.protobuf.AbstractMessage; import io.grpc.ServerServiceDefinition; import java.util.List; +import javax.annotation.Generated; -@javax.annotation.Generated("by GAPIC") @BetaApi +@Generated("by gapic-generator-java") public class MockIntents implements MockGrpcService { private final MockIntentsImpl serviceImpl; diff --git a/google-cloud-dialogflow-cx/src/test/java/com/google/cloud/dialogflow/cx/v3/MockIntentsImpl.java b/google-cloud-dialogflow-cx/src/test/java/com/google/cloud/dialogflow/cx/v3/MockIntentsImpl.java index 9fee4fd08..97f656563 100644 --- a/google-cloud-dialogflow-cx/src/test/java/com/google/cloud/dialogflow/cx/v3/MockIntentsImpl.java +++ b/google-cloud-dialogflow-cx/src/test/java/com/google/cloud/dialogflow/cx/v3/MockIntentsImpl.java @@ -5,7 +5,7 @@ * 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 + * 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, @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.google.cloud.dialogflow.cx.v3; import com.google.api.core.BetaApi; @@ -24,9 +25,10 @@ import java.util.LinkedList; import java.util.List; import java.util.Queue; +import javax.annotation.Generated; -@javax.annotation.Generated("by GAPIC") @BetaApi +@Generated("by gapic-generator-java") public class MockIntentsImpl extends IntentsImplBase { private List requests; private Queue responses; @@ -63,10 +65,10 @@ public void listIntents( Object response = responses.remove(); if (response instanceof ListIntentsResponse) { requests.add(request); - responseObserver.onNext((ListIntentsResponse) response); + responseObserver.onNext(((ListIntentsResponse) response)); responseObserver.onCompleted(); } else if (response instanceof Exception) { - responseObserver.onError((Exception) response); + responseObserver.onError(((Exception) response)); } else { responseObserver.onError(new IllegalArgumentException("Unrecognized response type")); } @@ -77,10 +79,10 @@ public void getIntent(GetIntentRequest request, StreamObserver responseO Object response = responses.remove(); if (response instanceof Intent) { requests.add(request); - responseObserver.onNext((Intent) response); + responseObserver.onNext(((Intent) response)); responseObserver.onCompleted(); } else if (response instanceof Exception) { - responseObserver.onError((Exception) response); + responseObserver.onError(((Exception) response)); } else { responseObserver.onError(new IllegalArgumentException("Unrecognized response type")); } @@ -91,10 +93,10 @@ public void createIntent(CreateIntentRequest request, StreamObserver res Object response = responses.remove(); if (response instanceof Intent) { requests.add(request); - responseObserver.onNext((Intent) response); + responseObserver.onNext(((Intent) response)); responseObserver.onCompleted(); } else if (response instanceof Exception) { - responseObserver.onError((Exception) response); + responseObserver.onError(((Exception) response)); } else { responseObserver.onError(new IllegalArgumentException("Unrecognized response type")); } @@ -105,10 +107,10 @@ public void updateIntent(UpdateIntentRequest request, StreamObserver res Object response = responses.remove(); if (response instanceof Intent) { requests.add(request); - responseObserver.onNext((Intent) response); + responseObserver.onNext(((Intent) response)); responseObserver.onCompleted(); } else if (response instanceof Exception) { - responseObserver.onError((Exception) response); + responseObserver.onError(((Exception) response)); } else { responseObserver.onError(new IllegalArgumentException("Unrecognized response type")); } @@ -119,10 +121,10 @@ public void deleteIntent(DeleteIntentRequest request, StreamObserver resp Object response = responses.remove(); if (response instanceof Empty) { requests.add(request); - responseObserver.onNext((Empty) response); + responseObserver.onNext(((Empty) response)); responseObserver.onCompleted(); } else if (response instanceof Exception) { - responseObserver.onError((Exception) response); + responseObserver.onError(((Exception) response)); } else { responseObserver.onError(new IllegalArgumentException("Unrecognized response type")); } diff --git a/google-cloud-dialogflow-cx/src/test/java/com/google/cloud/dialogflow/cx/v3/MockPages.java b/google-cloud-dialogflow-cx/src/test/java/com/google/cloud/dialogflow/cx/v3/MockPages.java index 55bfdb8cd..e5a106ff4 100644 --- a/google-cloud-dialogflow-cx/src/test/java/com/google/cloud/dialogflow/cx/v3/MockPages.java +++ b/google-cloud-dialogflow-cx/src/test/java/com/google/cloud/dialogflow/cx/v3/MockPages.java @@ -5,7 +5,7 @@ * 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 + * 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, @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.google.cloud.dialogflow.cx.v3; import com.google.api.core.BetaApi; @@ -20,9 +21,10 @@ import com.google.protobuf.AbstractMessage; import io.grpc.ServerServiceDefinition; import java.util.List; +import javax.annotation.Generated; -@javax.annotation.Generated("by GAPIC") @BetaApi +@Generated("by gapic-generator-java") public class MockPages implements MockGrpcService { private final MockPagesImpl serviceImpl; diff --git a/google-cloud-dialogflow-cx/src/test/java/com/google/cloud/dialogflow/cx/v3/MockPagesImpl.java b/google-cloud-dialogflow-cx/src/test/java/com/google/cloud/dialogflow/cx/v3/MockPagesImpl.java index d776193ca..38854165f 100644 --- a/google-cloud-dialogflow-cx/src/test/java/com/google/cloud/dialogflow/cx/v3/MockPagesImpl.java +++ b/google-cloud-dialogflow-cx/src/test/java/com/google/cloud/dialogflow/cx/v3/MockPagesImpl.java @@ -5,7 +5,7 @@ * 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 + * 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, @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.google.cloud.dialogflow.cx.v3; import com.google.api.core.BetaApi; @@ -24,9 +25,10 @@ import java.util.LinkedList; import java.util.List; import java.util.Queue; +import javax.annotation.Generated; -@javax.annotation.Generated("by GAPIC") @BetaApi +@Generated("by gapic-generator-java") public class MockPagesImpl extends PagesImplBase { private List requests; private Queue responses; @@ -63,10 +65,10 @@ public void listPages( Object response = responses.remove(); if (response instanceof ListPagesResponse) { requests.add(request); - responseObserver.onNext((ListPagesResponse) response); + responseObserver.onNext(((ListPagesResponse) response)); responseObserver.onCompleted(); } else if (response instanceof Exception) { - responseObserver.onError((Exception) response); + responseObserver.onError(((Exception) response)); } else { responseObserver.onError(new IllegalArgumentException("Unrecognized response type")); } @@ -77,10 +79,10 @@ public void getPage(GetPageRequest request, StreamObserver responseObserve Object response = responses.remove(); if (response instanceof Page) { requests.add(request); - responseObserver.onNext((Page) response); + responseObserver.onNext(((Page) response)); responseObserver.onCompleted(); } else if (response instanceof Exception) { - responseObserver.onError((Exception) response); + responseObserver.onError(((Exception) response)); } else { responseObserver.onError(new IllegalArgumentException("Unrecognized response type")); } @@ -91,10 +93,10 @@ public void createPage(CreatePageRequest request, StreamObserver responseO Object response = responses.remove(); if (response instanceof Page) { requests.add(request); - responseObserver.onNext((Page) response); + responseObserver.onNext(((Page) response)); responseObserver.onCompleted(); } else if (response instanceof Exception) { - responseObserver.onError((Exception) response); + responseObserver.onError(((Exception) response)); } else { responseObserver.onError(new IllegalArgumentException("Unrecognized response type")); } @@ -105,10 +107,10 @@ public void updatePage(UpdatePageRequest request, StreamObserver responseO Object response = responses.remove(); if (response instanceof Page) { requests.add(request); - responseObserver.onNext((Page) response); + responseObserver.onNext(((Page) response)); responseObserver.onCompleted(); } else if (response instanceof Exception) { - responseObserver.onError((Exception) response); + responseObserver.onError(((Exception) response)); } else { responseObserver.onError(new IllegalArgumentException("Unrecognized response type")); } @@ -119,10 +121,10 @@ public void deletePage(DeletePageRequest request, StreamObserver response Object response = responses.remove(); if (response instanceof Empty) { requests.add(request); - responseObserver.onNext((Empty) response); + responseObserver.onNext(((Empty) response)); responseObserver.onCompleted(); } else if (response instanceof Exception) { - responseObserver.onError((Exception) response); + responseObserver.onError(((Exception) response)); } else { responseObserver.onError(new IllegalArgumentException("Unrecognized response type")); } diff --git a/google-cloud-dialogflow-cx/src/test/java/com/google/cloud/dialogflow/cx/v3/MockSecuritySettingsService.java b/google-cloud-dialogflow-cx/src/test/java/com/google/cloud/dialogflow/cx/v3/MockSecuritySettingsService.java index 49654edeb..81e7e15bb 100644 --- a/google-cloud-dialogflow-cx/src/test/java/com/google/cloud/dialogflow/cx/v3/MockSecuritySettingsService.java +++ b/google-cloud-dialogflow-cx/src/test/java/com/google/cloud/dialogflow/cx/v3/MockSecuritySettingsService.java @@ -5,7 +5,7 @@ * 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 + * 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, @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.google.cloud.dialogflow.cx.v3; import com.google.api.core.BetaApi; @@ -20,9 +21,10 @@ import com.google.protobuf.AbstractMessage; import io.grpc.ServerServiceDefinition; import java.util.List; +import javax.annotation.Generated; -@javax.annotation.Generated("by GAPIC") @BetaApi +@Generated("by gapic-generator-java") public class MockSecuritySettingsService implements MockGrpcService { private final MockSecuritySettingsServiceImpl serviceImpl; diff --git a/google-cloud-dialogflow-cx/src/test/java/com/google/cloud/dialogflow/cx/v3/MockSecuritySettingsServiceImpl.java b/google-cloud-dialogflow-cx/src/test/java/com/google/cloud/dialogflow/cx/v3/MockSecuritySettingsServiceImpl.java index b0e4e984f..8a74c8fe3 100644 --- a/google-cloud-dialogflow-cx/src/test/java/com/google/cloud/dialogflow/cx/v3/MockSecuritySettingsServiceImpl.java +++ b/google-cloud-dialogflow-cx/src/test/java/com/google/cloud/dialogflow/cx/v3/MockSecuritySettingsServiceImpl.java @@ -5,7 +5,7 @@ * 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 + * 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, @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.google.cloud.dialogflow.cx.v3; import com.google.api.core.BetaApi; @@ -24,9 +25,10 @@ import java.util.LinkedList; import java.util.List; import java.util.Queue; +import javax.annotation.Generated; -@javax.annotation.Generated("by GAPIC") @BetaApi +@Generated("by gapic-generator-java") public class MockSecuritySettingsServiceImpl extends SecuritySettingsServiceImplBase { private List requests; private Queue responses; @@ -63,10 +65,10 @@ public void createSecuritySettings( Object response = responses.remove(); if (response instanceof SecuritySettings) { requests.add(request); - responseObserver.onNext((SecuritySettings) response); + responseObserver.onNext(((SecuritySettings) response)); responseObserver.onCompleted(); } else if (response instanceof Exception) { - responseObserver.onError((Exception) response); + responseObserver.onError(((Exception) response)); } else { responseObserver.onError(new IllegalArgumentException("Unrecognized response type")); } @@ -78,10 +80,10 @@ public void getSecuritySettings( Object response = responses.remove(); if (response instanceof SecuritySettings) { requests.add(request); - responseObserver.onNext((SecuritySettings) response); + responseObserver.onNext(((SecuritySettings) response)); responseObserver.onCompleted(); } else if (response instanceof Exception) { - responseObserver.onError((Exception) response); + responseObserver.onError(((Exception) response)); } else { responseObserver.onError(new IllegalArgumentException("Unrecognized response type")); } @@ -93,10 +95,10 @@ public void updateSecuritySettings( Object response = responses.remove(); if (response instanceof SecuritySettings) { requests.add(request); - responseObserver.onNext((SecuritySettings) response); + responseObserver.onNext(((SecuritySettings) response)); responseObserver.onCompleted(); } else if (response instanceof Exception) { - responseObserver.onError((Exception) response); + responseObserver.onError(((Exception) response)); } else { responseObserver.onError(new IllegalArgumentException("Unrecognized response type")); } @@ -109,10 +111,10 @@ public void listSecuritySettings( Object response = responses.remove(); if (response instanceof ListSecuritySettingsResponse) { requests.add(request); - responseObserver.onNext((ListSecuritySettingsResponse) response); + responseObserver.onNext(((ListSecuritySettingsResponse) response)); responseObserver.onCompleted(); } else if (response instanceof Exception) { - responseObserver.onError((Exception) response); + responseObserver.onError(((Exception) response)); } else { responseObserver.onError(new IllegalArgumentException("Unrecognized response type")); } @@ -124,10 +126,10 @@ public void deleteSecuritySettings( Object response = responses.remove(); if (response instanceof Empty) { requests.add(request); - responseObserver.onNext((Empty) response); + responseObserver.onNext(((Empty) response)); responseObserver.onCompleted(); } else if (response instanceof Exception) { - responseObserver.onError((Exception) response); + responseObserver.onError(((Exception) response)); } else { responseObserver.onError(new IllegalArgumentException("Unrecognized response type")); } diff --git a/google-cloud-dialogflow-cx/src/test/java/com/google/cloud/dialogflow/cx/v3/MockSessionEntityTypes.java b/google-cloud-dialogflow-cx/src/test/java/com/google/cloud/dialogflow/cx/v3/MockSessionEntityTypes.java index ae8a34478..5d48f3dc1 100644 --- a/google-cloud-dialogflow-cx/src/test/java/com/google/cloud/dialogflow/cx/v3/MockSessionEntityTypes.java +++ b/google-cloud-dialogflow-cx/src/test/java/com/google/cloud/dialogflow/cx/v3/MockSessionEntityTypes.java @@ -5,7 +5,7 @@ * 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 + * 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, @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.google.cloud.dialogflow.cx.v3; import com.google.api.core.BetaApi; @@ -20,9 +21,10 @@ import com.google.protobuf.AbstractMessage; import io.grpc.ServerServiceDefinition; import java.util.List; +import javax.annotation.Generated; -@javax.annotation.Generated("by GAPIC") @BetaApi +@Generated("by gapic-generator-java") public class MockSessionEntityTypes implements MockGrpcService { private final MockSessionEntityTypesImpl serviceImpl; diff --git a/google-cloud-dialogflow-cx/src/test/java/com/google/cloud/dialogflow/cx/v3/MockSessionEntityTypesImpl.java b/google-cloud-dialogflow-cx/src/test/java/com/google/cloud/dialogflow/cx/v3/MockSessionEntityTypesImpl.java index 843fe9318..106b68f9d 100644 --- a/google-cloud-dialogflow-cx/src/test/java/com/google/cloud/dialogflow/cx/v3/MockSessionEntityTypesImpl.java +++ b/google-cloud-dialogflow-cx/src/test/java/com/google/cloud/dialogflow/cx/v3/MockSessionEntityTypesImpl.java @@ -5,7 +5,7 @@ * 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 + * 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, @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.google.cloud.dialogflow.cx.v3; import com.google.api.core.BetaApi; @@ -24,9 +25,10 @@ import java.util.LinkedList; import java.util.List; import java.util.Queue; +import javax.annotation.Generated; -@javax.annotation.Generated("by GAPIC") @BetaApi +@Generated("by gapic-generator-java") public class MockSessionEntityTypesImpl extends SessionEntityTypesImplBase { private List requests; private Queue responses; @@ -64,10 +66,10 @@ public void listSessionEntityTypes( Object response = responses.remove(); if (response instanceof ListSessionEntityTypesResponse) { requests.add(request); - responseObserver.onNext((ListSessionEntityTypesResponse) response); + responseObserver.onNext(((ListSessionEntityTypesResponse) response)); responseObserver.onCompleted(); } else if (response instanceof Exception) { - responseObserver.onError((Exception) response); + responseObserver.onError(((Exception) response)); } else { responseObserver.onError(new IllegalArgumentException("Unrecognized response type")); } @@ -79,10 +81,10 @@ public void getSessionEntityType( Object response = responses.remove(); if (response instanceof SessionEntityType) { requests.add(request); - responseObserver.onNext((SessionEntityType) response); + responseObserver.onNext(((SessionEntityType) response)); responseObserver.onCompleted(); } else if (response instanceof Exception) { - responseObserver.onError((Exception) response); + responseObserver.onError(((Exception) response)); } else { responseObserver.onError(new IllegalArgumentException("Unrecognized response type")); } @@ -94,10 +96,10 @@ public void createSessionEntityType( Object response = responses.remove(); if (response instanceof SessionEntityType) { requests.add(request); - responseObserver.onNext((SessionEntityType) response); + responseObserver.onNext(((SessionEntityType) response)); responseObserver.onCompleted(); } else if (response instanceof Exception) { - responseObserver.onError((Exception) response); + responseObserver.onError(((Exception) response)); } else { responseObserver.onError(new IllegalArgumentException("Unrecognized response type")); } @@ -109,10 +111,10 @@ public void updateSessionEntityType( Object response = responses.remove(); if (response instanceof SessionEntityType) { requests.add(request); - responseObserver.onNext((SessionEntityType) response); + responseObserver.onNext(((SessionEntityType) response)); responseObserver.onCompleted(); } else if (response instanceof Exception) { - responseObserver.onError((Exception) response); + responseObserver.onError(((Exception) response)); } else { responseObserver.onError(new IllegalArgumentException("Unrecognized response type")); } @@ -124,10 +126,10 @@ public void deleteSessionEntityType( Object response = responses.remove(); if (response instanceof Empty) { requests.add(request); - responseObserver.onNext((Empty) response); + responseObserver.onNext(((Empty) response)); responseObserver.onCompleted(); } else if (response instanceof Exception) { - responseObserver.onError((Exception) response); + responseObserver.onError(((Exception) response)); } else { responseObserver.onError(new IllegalArgumentException("Unrecognized response type")); } diff --git a/google-cloud-dialogflow-cx/src/test/java/com/google/cloud/dialogflow/cx/v3/MockSessions.java b/google-cloud-dialogflow-cx/src/test/java/com/google/cloud/dialogflow/cx/v3/MockSessions.java index 1841e00b0..9eb8cab4a 100644 --- a/google-cloud-dialogflow-cx/src/test/java/com/google/cloud/dialogflow/cx/v3/MockSessions.java +++ b/google-cloud-dialogflow-cx/src/test/java/com/google/cloud/dialogflow/cx/v3/MockSessions.java @@ -5,7 +5,7 @@ * 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 + * 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, @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.google.cloud.dialogflow.cx.v3; import com.google.api.core.BetaApi; @@ -20,9 +21,10 @@ import com.google.protobuf.AbstractMessage; import io.grpc.ServerServiceDefinition; import java.util.List; +import javax.annotation.Generated; -@javax.annotation.Generated("by GAPIC") @BetaApi +@Generated("by gapic-generator-java") public class MockSessions implements MockGrpcService { private final MockSessionsImpl serviceImpl; diff --git a/google-cloud-dialogflow-cx/src/test/java/com/google/cloud/dialogflow/cx/v3/MockSessionsImpl.java b/google-cloud-dialogflow-cx/src/test/java/com/google/cloud/dialogflow/cx/v3/MockSessionsImpl.java index b51d87b96..9767198e2 100644 --- a/google-cloud-dialogflow-cx/src/test/java/com/google/cloud/dialogflow/cx/v3/MockSessionsImpl.java +++ b/google-cloud-dialogflow-cx/src/test/java/com/google/cloud/dialogflow/cx/v3/MockSessionsImpl.java @@ -5,7 +5,7 @@ * 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 + * 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, @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.google.cloud.dialogflow.cx.v3; import com.google.api.core.BetaApi; @@ -23,9 +24,10 @@ import java.util.LinkedList; import java.util.List; import java.util.Queue; +import javax.annotation.Generated; -@javax.annotation.Generated("by GAPIC") @BetaApi +@Generated("by gapic-generator-java") public class MockSessionsImpl extends SessionsImplBase { private List requests; private Queue responses; @@ -62,10 +64,10 @@ public void detectIntent( Object response = responses.remove(); if (response instanceof DetectIntentResponse) { requests.add(request); - responseObserver.onNext((DetectIntentResponse) response); + responseObserver.onNext(((DetectIntentResponse) response)); responseObserver.onCompleted(); } else if (response instanceof Exception) { - responseObserver.onError((Exception) response); + responseObserver.onError(((Exception) response)); } else { responseObserver.onError(new IllegalArgumentException("Unrecognized response type")); } @@ -81,9 +83,9 @@ public void onNext(StreamingDetectIntentRequest value) { requests.add(value); final Object response = responses.remove(); if (response instanceof StreamingDetectIntentResponse) { - responseObserver.onNext((StreamingDetectIntentResponse) response); + responseObserver.onNext(((StreamingDetectIntentResponse) response)); } else if (response instanceof Exception) { - responseObserver.onError((Exception) response); + responseObserver.onError(((Exception) response)); } else { responseObserver.onError(new IllegalArgumentException("Unrecognized response type")); } @@ -108,10 +110,10 @@ public void matchIntent( Object response = responses.remove(); if (response instanceof MatchIntentResponse) { requests.add(request); - responseObserver.onNext((MatchIntentResponse) response); + responseObserver.onNext(((MatchIntentResponse) response)); responseObserver.onCompleted(); } else if (response instanceof Exception) { - responseObserver.onError((Exception) response); + responseObserver.onError(((Exception) response)); } else { responseObserver.onError(new IllegalArgumentException("Unrecognized response type")); } @@ -123,10 +125,10 @@ public void fulfillIntent( Object response = responses.remove(); if (response instanceof FulfillIntentResponse) { requests.add(request); - responseObserver.onNext((FulfillIntentResponse) response); + responseObserver.onNext(((FulfillIntentResponse) response)); responseObserver.onCompleted(); } else if (response instanceof Exception) { - responseObserver.onError((Exception) response); + responseObserver.onError(((Exception) response)); } else { responseObserver.onError(new IllegalArgumentException("Unrecognized response type")); } diff --git a/google-cloud-dialogflow-cx/src/test/java/com/google/cloud/dialogflow/cx/v3/MockTransitionRouteGroups.java b/google-cloud-dialogflow-cx/src/test/java/com/google/cloud/dialogflow/cx/v3/MockTransitionRouteGroups.java index bb461b792..3ae11fb2f 100644 --- a/google-cloud-dialogflow-cx/src/test/java/com/google/cloud/dialogflow/cx/v3/MockTransitionRouteGroups.java +++ b/google-cloud-dialogflow-cx/src/test/java/com/google/cloud/dialogflow/cx/v3/MockTransitionRouteGroups.java @@ -5,7 +5,7 @@ * 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 + * 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, @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.google.cloud.dialogflow.cx.v3; import com.google.api.core.BetaApi; @@ -20,9 +21,10 @@ import com.google.protobuf.AbstractMessage; import io.grpc.ServerServiceDefinition; import java.util.List; +import javax.annotation.Generated; -@javax.annotation.Generated("by GAPIC") @BetaApi +@Generated("by gapic-generator-java") public class MockTransitionRouteGroups implements MockGrpcService { private final MockTransitionRouteGroupsImpl serviceImpl; diff --git a/google-cloud-dialogflow-cx/src/test/java/com/google/cloud/dialogflow/cx/v3/MockTransitionRouteGroupsImpl.java b/google-cloud-dialogflow-cx/src/test/java/com/google/cloud/dialogflow/cx/v3/MockTransitionRouteGroupsImpl.java index d62d8ed9e..f259f4e7f 100644 --- a/google-cloud-dialogflow-cx/src/test/java/com/google/cloud/dialogflow/cx/v3/MockTransitionRouteGroupsImpl.java +++ b/google-cloud-dialogflow-cx/src/test/java/com/google/cloud/dialogflow/cx/v3/MockTransitionRouteGroupsImpl.java @@ -5,7 +5,7 @@ * 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 + * 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, @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.google.cloud.dialogflow.cx.v3; import com.google.api.core.BetaApi; @@ -24,9 +25,10 @@ import java.util.LinkedList; import java.util.List; import java.util.Queue; +import javax.annotation.Generated; -@javax.annotation.Generated("by GAPIC") @BetaApi +@Generated("by gapic-generator-java") public class MockTransitionRouteGroupsImpl extends TransitionRouteGroupsImplBase { private List requests; private Queue responses; @@ -64,10 +66,10 @@ public void listTransitionRouteGroups( Object response = responses.remove(); if (response instanceof ListTransitionRouteGroupsResponse) { requests.add(request); - responseObserver.onNext((ListTransitionRouteGroupsResponse) response); + responseObserver.onNext(((ListTransitionRouteGroupsResponse) response)); responseObserver.onCompleted(); } else if (response instanceof Exception) { - responseObserver.onError((Exception) response); + responseObserver.onError(((Exception) response)); } else { responseObserver.onError(new IllegalArgumentException("Unrecognized response type")); } @@ -80,10 +82,10 @@ public void getTransitionRouteGroup( Object response = responses.remove(); if (response instanceof TransitionRouteGroup) { requests.add(request); - responseObserver.onNext((TransitionRouteGroup) response); + responseObserver.onNext(((TransitionRouteGroup) response)); responseObserver.onCompleted(); } else if (response instanceof Exception) { - responseObserver.onError((Exception) response); + responseObserver.onError(((Exception) response)); } else { responseObserver.onError(new IllegalArgumentException("Unrecognized response type")); } @@ -96,10 +98,10 @@ public void createTransitionRouteGroup( Object response = responses.remove(); if (response instanceof TransitionRouteGroup) { requests.add(request); - responseObserver.onNext((TransitionRouteGroup) response); + responseObserver.onNext(((TransitionRouteGroup) response)); responseObserver.onCompleted(); } else if (response instanceof Exception) { - responseObserver.onError((Exception) response); + responseObserver.onError(((Exception) response)); } else { responseObserver.onError(new IllegalArgumentException("Unrecognized response type")); } @@ -112,10 +114,10 @@ public void updateTransitionRouteGroup( Object response = responses.remove(); if (response instanceof TransitionRouteGroup) { requests.add(request); - responseObserver.onNext((TransitionRouteGroup) response); + responseObserver.onNext(((TransitionRouteGroup) response)); responseObserver.onCompleted(); } else if (response instanceof Exception) { - responseObserver.onError((Exception) response); + responseObserver.onError(((Exception) response)); } else { responseObserver.onError(new IllegalArgumentException("Unrecognized response type")); } @@ -127,10 +129,10 @@ public void deleteTransitionRouteGroup( Object response = responses.remove(); if (response instanceof Empty) { requests.add(request); - responseObserver.onNext((Empty) response); + responseObserver.onNext(((Empty) response)); responseObserver.onCompleted(); } else if (response instanceof Exception) { - responseObserver.onError((Exception) response); + responseObserver.onError(((Exception) response)); } else { responseObserver.onError(new IllegalArgumentException("Unrecognized response type")); } diff --git a/google-cloud-dialogflow-cx/src/test/java/com/google/cloud/dialogflow/cx/v3/MockVersions.java b/google-cloud-dialogflow-cx/src/test/java/com/google/cloud/dialogflow/cx/v3/MockVersions.java index 8f1e58abf..394f636d9 100644 --- a/google-cloud-dialogflow-cx/src/test/java/com/google/cloud/dialogflow/cx/v3/MockVersions.java +++ b/google-cloud-dialogflow-cx/src/test/java/com/google/cloud/dialogflow/cx/v3/MockVersions.java @@ -5,7 +5,7 @@ * 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 + * 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, @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.google.cloud.dialogflow.cx.v3; import com.google.api.core.BetaApi; @@ -20,9 +21,10 @@ import com.google.protobuf.AbstractMessage; import io.grpc.ServerServiceDefinition; import java.util.List; +import javax.annotation.Generated; -@javax.annotation.Generated("by GAPIC") @BetaApi +@Generated("by gapic-generator-java") public class MockVersions implements MockGrpcService { private final MockVersionsImpl serviceImpl; diff --git a/google-cloud-dialogflow-cx/src/test/java/com/google/cloud/dialogflow/cx/v3/MockVersionsImpl.java b/google-cloud-dialogflow-cx/src/test/java/com/google/cloud/dialogflow/cx/v3/MockVersionsImpl.java index 96393b2c6..085ccb48a 100644 --- a/google-cloud-dialogflow-cx/src/test/java/com/google/cloud/dialogflow/cx/v3/MockVersionsImpl.java +++ b/google-cloud-dialogflow-cx/src/test/java/com/google/cloud/dialogflow/cx/v3/MockVersionsImpl.java @@ -5,7 +5,7 @@ * 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 + * 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, @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.google.cloud.dialogflow.cx.v3; import com.google.api.core.BetaApi; @@ -25,9 +26,10 @@ import java.util.LinkedList; import java.util.List; import java.util.Queue; +import javax.annotation.Generated; -@javax.annotation.Generated("by GAPIC") @BetaApi +@Generated("by gapic-generator-java") public class MockVersionsImpl extends VersionsImplBase { private List requests; private Queue responses; @@ -64,10 +66,10 @@ public void listVersions( Object response = responses.remove(); if (response instanceof ListVersionsResponse) { requests.add(request); - responseObserver.onNext((ListVersionsResponse) response); + responseObserver.onNext(((ListVersionsResponse) response)); responseObserver.onCompleted(); } else if (response instanceof Exception) { - responseObserver.onError((Exception) response); + responseObserver.onError(((Exception) response)); } else { responseObserver.onError(new IllegalArgumentException("Unrecognized response type")); } @@ -78,10 +80,10 @@ public void getVersion(GetVersionRequest request, StreamObserver respon Object response = responses.remove(); if (response instanceof Version) { requests.add(request); - responseObserver.onNext((Version) response); + responseObserver.onNext(((Version) response)); responseObserver.onCompleted(); } else if (response instanceof Exception) { - responseObserver.onError((Exception) response); + responseObserver.onError(((Exception) response)); } else { responseObserver.onError(new IllegalArgumentException("Unrecognized response type")); } @@ -93,10 +95,10 @@ public void createVersion( Object response = responses.remove(); if (response instanceof Operation) { requests.add(request); - responseObserver.onNext((Operation) response); + responseObserver.onNext(((Operation) response)); responseObserver.onCompleted(); } else if (response instanceof Exception) { - responseObserver.onError((Exception) response); + responseObserver.onError(((Exception) response)); } else { responseObserver.onError(new IllegalArgumentException("Unrecognized response type")); } @@ -108,10 +110,10 @@ public void updateVersion( Object response = responses.remove(); if (response instanceof Version) { requests.add(request); - responseObserver.onNext((Version) response); + responseObserver.onNext(((Version) response)); responseObserver.onCompleted(); } else if (response instanceof Exception) { - responseObserver.onError((Exception) response); + responseObserver.onError(((Exception) response)); } else { responseObserver.onError(new IllegalArgumentException("Unrecognized response type")); } @@ -122,10 +124,10 @@ public void deleteVersion(DeleteVersionRequest request, StreamObserver re Object response = responses.remove(); if (response instanceof Empty) { requests.add(request); - responseObserver.onNext((Empty) response); + responseObserver.onNext(((Empty) response)); responseObserver.onCompleted(); } else if (response instanceof Exception) { - responseObserver.onError((Exception) response); + responseObserver.onError(((Exception) response)); } else { responseObserver.onError(new IllegalArgumentException("Unrecognized response type")); } @@ -136,10 +138,10 @@ public void loadVersion(LoadVersionRequest request, StreamObserver re Object response = responses.remove(); if (response instanceof Operation) { requests.add(request); - responseObserver.onNext((Operation) response); + responseObserver.onNext(((Operation) response)); responseObserver.onCompleted(); } else if (response instanceof Exception) { - responseObserver.onError((Exception) response); + responseObserver.onError(((Exception) response)); } else { responseObserver.onError(new IllegalArgumentException("Unrecognized response type")); } diff --git a/google-cloud-dialogflow-cx/src/test/java/com/google/cloud/dialogflow/cx/v3/MockWebhooks.java b/google-cloud-dialogflow-cx/src/test/java/com/google/cloud/dialogflow/cx/v3/MockWebhooks.java index 3f9ed7427..db8440a77 100644 --- a/google-cloud-dialogflow-cx/src/test/java/com/google/cloud/dialogflow/cx/v3/MockWebhooks.java +++ b/google-cloud-dialogflow-cx/src/test/java/com/google/cloud/dialogflow/cx/v3/MockWebhooks.java @@ -5,7 +5,7 @@ * 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 + * 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, @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.google.cloud.dialogflow.cx.v3; import com.google.api.core.BetaApi; @@ -20,9 +21,10 @@ import com.google.protobuf.AbstractMessage; import io.grpc.ServerServiceDefinition; import java.util.List; +import javax.annotation.Generated; -@javax.annotation.Generated("by GAPIC") @BetaApi +@Generated("by gapic-generator-java") public class MockWebhooks implements MockGrpcService { private final MockWebhooksImpl serviceImpl; diff --git a/google-cloud-dialogflow-cx/src/test/java/com/google/cloud/dialogflow/cx/v3/MockWebhooksImpl.java b/google-cloud-dialogflow-cx/src/test/java/com/google/cloud/dialogflow/cx/v3/MockWebhooksImpl.java index 441bdff4c..dc7411852 100644 --- a/google-cloud-dialogflow-cx/src/test/java/com/google/cloud/dialogflow/cx/v3/MockWebhooksImpl.java +++ b/google-cloud-dialogflow-cx/src/test/java/com/google/cloud/dialogflow/cx/v3/MockWebhooksImpl.java @@ -5,7 +5,7 @@ * 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 + * 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, @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.google.cloud.dialogflow.cx.v3; import com.google.api.core.BetaApi; @@ -24,9 +25,10 @@ import java.util.LinkedList; import java.util.List; import java.util.Queue; +import javax.annotation.Generated; -@javax.annotation.Generated("by GAPIC") @BetaApi +@Generated("by gapic-generator-java") public class MockWebhooksImpl extends WebhooksImplBase { private List requests; private Queue responses; @@ -63,10 +65,10 @@ public void listWebhooks( Object response = responses.remove(); if (response instanceof ListWebhooksResponse) { requests.add(request); - responseObserver.onNext((ListWebhooksResponse) response); + responseObserver.onNext(((ListWebhooksResponse) response)); responseObserver.onCompleted(); } else if (response instanceof Exception) { - responseObserver.onError((Exception) response); + responseObserver.onError(((Exception) response)); } else { responseObserver.onError(new IllegalArgumentException("Unrecognized response type")); } @@ -77,10 +79,10 @@ public void getWebhook(GetWebhookRequest request, StreamObserver respon Object response = responses.remove(); if (response instanceof Webhook) { requests.add(request); - responseObserver.onNext((Webhook) response); + responseObserver.onNext(((Webhook) response)); responseObserver.onCompleted(); } else if (response instanceof Exception) { - responseObserver.onError((Exception) response); + responseObserver.onError(((Exception) response)); } else { responseObserver.onError(new IllegalArgumentException("Unrecognized response type")); } @@ -92,10 +94,10 @@ public void createWebhook( Object response = responses.remove(); if (response instanceof Webhook) { requests.add(request); - responseObserver.onNext((Webhook) response); + responseObserver.onNext(((Webhook) response)); responseObserver.onCompleted(); } else if (response instanceof Exception) { - responseObserver.onError((Exception) response); + responseObserver.onError(((Exception) response)); } else { responseObserver.onError(new IllegalArgumentException("Unrecognized response type")); } @@ -107,10 +109,10 @@ public void updateWebhook( Object response = responses.remove(); if (response instanceof Webhook) { requests.add(request); - responseObserver.onNext((Webhook) response); + responseObserver.onNext(((Webhook) response)); responseObserver.onCompleted(); } else if (response instanceof Exception) { - responseObserver.onError((Exception) response); + responseObserver.onError(((Exception) response)); } else { responseObserver.onError(new IllegalArgumentException("Unrecognized response type")); } @@ -121,10 +123,10 @@ public void deleteWebhook(DeleteWebhookRequest request, StreamObserver re Object response = responses.remove(); if (response instanceof Empty) { requests.add(request); - responseObserver.onNext((Empty) response); + responseObserver.onNext(((Empty) response)); responseObserver.onCompleted(); } else if (response instanceof Exception) { - responseObserver.onError((Exception) response); + responseObserver.onError(((Exception) response)); } else { responseObserver.onError(new IllegalArgumentException("Unrecognized response type")); } diff --git a/google-cloud-dialogflow-cx/src/test/java/com/google/cloud/dialogflow/cx/v3/PagesClientTest.java b/google-cloud-dialogflow-cx/src/test/java/com/google/cloud/dialogflow/cx/v3/PagesClientTest.java index 0ae63db47..ef354691a 100644 --- a/google-cloud-dialogflow-cx/src/test/java/com/google/cloud/dialogflow/cx/v3/PagesClientTest.java +++ b/google-cloud-dialogflow-cx/src/test/java/com/google/cloud/dialogflow/cx/v3/PagesClientTest.java @@ -5,7 +5,7 @@ * 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 + * 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, @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.google.cloud.dialogflow.cx.v3; import static com.google.cloud.dialogflow.cx.v3.PagesClient.ListPagesPagedResponse; @@ -28,12 +29,13 @@ import com.google.protobuf.AbstractMessage; import com.google.protobuf.Empty; import com.google.protobuf.FieldMask; -import io.grpc.Status; import io.grpc.StatusRuntimeException; import java.io.IOException; +import java.util.ArrayList; import java.util.Arrays; import java.util.List; import java.util.UUID; +import javax.annotation.Generated; import org.junit.After; import org.junit.AfterClass; import org.junit.Assert; @@ -41,66 +43,31 @@ import org.junit.BeforeClass; import org.junit.Test; -@javax.annotation.Generated("by GAPIC") +@Generated("by gapic-generator-java") public class PagesClientTest { private static MockPages mockPages; - private static MockFlows mockFlows; - private static MockAgents mockAgents; - private static MockEntityTypes mockEntityTypes; - private static MockEnvironments mockEnvironments; - private static MockIntents mockIntents; - private static MockSecuritySettingsService mockSecuritySettingsService; - private static MockSessionEntityTypes mockSessionEntityTypes; - private static MockSessions mockSessions; - private static MockTransitionRouteGroups mockTransitionRouteGroups; - private static MockVersions mockVersions; - private static MockWebhooks mockWebhooks; - private static MockServiceHelper serviceHelper; + private static MockServiceHelper mockServiceHelper; private PagesClient client; private LocalChannelProvider channelProvider; @BeforeClass public static void startStaticServer() { mockPages = new MockPages(); - mockFlows = new MockFlows(); - mockAgents = new MockAgents(); - mockEntityTypes = new MockEntityTypes(); - mockEnvironments = new MockEnvironments(); - mockIntents = new MockIntents(); - mockSecuritySettingsService = new MockSecuritySettingsService(); - mockSessionEntityTypes = new MockSessionEntityTypes(); - mockSessions = new MockSessions(); - mockTransitionRouteGroups = new MockTransitionRouteGroups(); - mockVersions = new MockVersions(); - mockWebhooks = new MockWebhooks(); - serviceHelper = + mockServiceHelper = new MockServiceHelper( - UUID.randomUUID().toString(), - Arrays.asList( - mockPages, - mockFlows, - mockAgents, - mockEntityTypes, - mockEnvironments, - mockIntents, - mockSecuritySettingsService, - mockSessionEntityTypes, - mockSessions, - mockTransitionRouteGroups, - mockVersions, - mockWebhooks)); - serviceHelper.start(); + UUID.randomUUID().toString(), Arrays.asList(mockPages)); + mockServiceHelper.start(); } @AfterClass public static void stopServer() { - serviceHelper.stop(); + mockServiceHelper.stop(); } @Before public void setUp() throws IOException { - serviceHelper.reset(); - channelProvider = serviceHelper.createChannelProvider(); + mockServiceHelper.reset(); + channelProvider = mockServiceHelper.createChannelProvider(); PagesSettings settings = PagesSettings.newBuilder() .setTransportChannelProvider(channelProvider) @@ -115,13 +82,13 @@ public void tearDown() throws Exception { } @Test - @SuppressWarnings("all") - public void listPagesTest() { - String nextPageToken = ""; - Page pagesElement = Page.newBuilder().build(); - List pages = Arrays.asList(pagesElement); + public void listPagesTest() throws Exception { + Page responsesElement = Page.newBuilder().build(); ListPagesResponse expectedResponse = - ListPagesResponse.newBuilder().setNextPageToken(nextPageToken).addAllPages(pages).build(); + ListPagesResponse.newBuilder() + .setNextPageToken("") + .addAllPages(Arrays.asList(responsesElement)) + .build(); mockPages.addResponse(expectedResponse); FlowName parent = FlowName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]"); @@ -129,14 +96,15 @@ public void listPagesTest() { ListPagesPagedResponse pagedListResponse = client.listPages(parent); List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + Assert.assertEquals(1, resources.size()); Assert.assertEquals(expectedResponse.getPagesList().get(0), resources.get(0)); List actualRequests = mockPages.getRequests(); Assert.assertEquals(1, actualRequests.size()); - ListPagesRequest actualRequest = (ListPagesRequest) actualRequests.get(0); + ListPagesRequest actualRequest = ((ListPagesRequest) actualRequests.get(0)); - Assert.assertEquals(parent, FlowName.parse(actualRequest.getParent())); + Assert.assertEquals(parent.toString(), actualRequest.getParent()); Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), @@ -144,28 +112,76 @@ public void listPagesTest() { } @Test - @SuppressWarnings("all") public void listPagesExceptionTest() throws Exception { - StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockPages.addException(exception); try { FlowName parent = FlowName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]"); + client.listPages(parent); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void listPagesTest2() throws Exception { + Page responsesElement = Page.newBuilder().build(); + ListPagesResponse expectedResponse = + ListPagesResponse.newBuilder() + .setNextPageToken("") + .addAllPages(Arrays.asList(responsesElement)) + .build(); + mockPages.addResponse(expectedResponse); + + String parent = "parent-995424086"; + + ListPagesPagedResponse pagedListResponse = client.listPages(parent); + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getPagesList().get(0), resources.get(0)); + + List actualRequests = mockPages.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + ListPagesRequest actualRequest = ((ListPagesRequest) actualRequests.get(0)); + + Assert.assertEquals(parent, actualRequest.getParent()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void listPagesExceptionTest2() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockPages.addException(exception); + + try { + String parent = "parent-995424086"; client.listPages(parent); Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { - // Expected exception + // Expected exception. } } @Test - @SuppressWarnings("all") - public void getPageTest() { - PageName name2 = PageName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]", "[PAGE]"); - String displayName = "displayName1615086568"; + public void getPageTest() throws Exception { Page expectedResponse = - Page.newBuilder().setName(name2.toString()).setDisplayName(displayName).build(); + Page.newBuilder() + .setName( + PageName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]", "[PAGE]").toString()) + .setDisplayName("displayName1714148973") + .setEntryFulfillment(Fulfillment.newBuilder().build()) + .setForm(Form.newBuilder().build()) + .addAllTransitionRouteGroups(new ArrayList()) + .addAllTransitionRoutes(new ArrayList()) + .addAllEventHandlers(new ArrayList()) + .build(); mockPages.addResponse(expectedResponse); PageName name = PageName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]", "[PAGE]"); @@ -175,9 +191,9 @@ public void getPageTest() { List actualRequests = mockPages.getRequests(); Assert.assertEquals(1, actualRequests.size()); - GetPageRequest actualRequest = (GetPageRequest) actualRequests.get(0); + GetPageRequest actualRequest = ((GetPageRequest) actualRequests.get(0)); - Assert.assertEquals(name, PageName.parse(actualRequest.getName())); + Assert.assertEquals(name.toString(), actualRequest.getName()); Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), @@ -185,28 +201,77 @@ public void getPageTest() { } @Test - @SuppressWarnings("all") public void getPageExceptionTest() throws Exception { - StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockPages.addException(exception); try { PageName name = PageName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]", "[PAGE]"); + client.getPage(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void getPageTest2() throws Exception { + Page expectedResponse = + Page.newBuilder() + .setName( + PageName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]", "[PAGE]").toString()) + .setDisplayName("displayName1714148973") + .setEntryFulfillment(Fulfillment.newBuilder().build()) + .setForm(Form.newBuilder().build()) + .addAllTransitionRouteGroups(new ArrayList()) + .addAllTransitionRoutes(new ArrayList()) + .addAllEventHandlers(new ArrayList()) + .build(); + mockPages.addResponse(expectedResponse); + + String name = "name3373707"; + + Page actualResponse = client.getPage(name); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockPages.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + GetPageRequest actualRequest = ((GetPageRequest) actualRequests.get(0)); + + Assert.assertEquals(name, actualRequest.getName()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void getPageExceptionTest2() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockPages.addException(exception); + try { + String name = "name3373707"; client.getPage(name); Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { - // Expected exception + // Expected exception. } } @Test - @SuppressWarnings("all") - public void createPageTest() { - PageName name = PageName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]", "[PAGE]"); - String displayName = "displayName1615086568"; + public void createPageTest() throws Exception { Page expectedResponse = - Page.newBuilder().setName(name.toString()).setDisplayName(displayName).build(); + Page.newBuilder() + .setName( + PageName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]", "[PAGE]").toString()) + .setDisplayName("displayName1714148973") + .setEntryFulfillment(Fulfillment.newBuilder().build()) + .setForm(Form.newBuilder().build()) + .addAllTransitionRouteGroups(new ArrayList()) + .addAllTransitionRoutes(new ArrayList()) + .addAllEventHandlers(new ArrayList()) + .build(); mockPages.addResponse(expectedResponse); FlowName parent = FlowName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]"); @@ -217,9 +282,9 @@ public void createPageTest() { List actualRequests = mockPages.getRequests(); Assert.assertEquals(1, actualRequests.size()); - CreatePageRequest actualRequest = (CreatePageRequest) actualRequests.get(0); + CreatePageRequest actualRequest = ((CreatePageRequest) actualRequests.get(0)); - Assert.assertEquals(parent, FlowName.parse(actualRequest.getParent())); + Assert.assertEquals(parent.toString(), actualRequest.getParent()); Assert.assertEquals(page, actualRequest.getPage()); Assert.assertTrue( channelProvider.isHeaderSent( @@ -228,29 +293,81 @@ public void createPageTest() { } @Test - @SuppressWarnings("all") public void createPageExceptionTest() throws Exception { - StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockPages.addException(exception); try { FlowName parent = FlowName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]"); Page page = Page.newBuilder().build(); + client.createPage(parent, page); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void createPageTest2() throws Exception { + Page expectedResponse = + Page.newBuilder() + .setName( + PageName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]", "[PAGE]").toString()) + .setDisplayName("displayName1714148973") + .setEntryFulfillment(Fulfillment.newBuilder().build()) + .setForm(Form.newBuilder().build()) + .addAllTransitionRouteGroups(new ArrayList()) + .addAllTransitionRoutes(new ArrayList()) + .addAllEventHandlers(new ArrayList()) + .build(); + mockPages.addResponse(expectedResponse); + + String parent = "parent-995424086"; + Page page = Page.newBuilder().build(); + + Page actualResponse = client.createPage(parent, page); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockPages.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + CreatePageRequest actualRequest = ((CreatePageRequest) actualRequests.get(0)); + + Assert.assertEquals(parent, actualRequest.getParent()); + Assert.assertEquals(page, actualRequest.getPage()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void createPageExceptionTest2() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockPages.addException(exception); + try { + String parent = "parent-995424086"; + Page page = Page.newBuilder().build(); client.createPage(parent, page); Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { - // Expected exception + // Expected exception. } } @Test - @SuppressWarnings("all") - public void updatePageTest() { - PageName name = PageName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]", "[PAGE]"); - String displayName = "displayName1615086568"; + public void updatePageTest() throws Exception { Page expectedResponse = - Page.newBuilder().setName(name.toString()).setDisplayName(displayName).build(); + Page.newBuilder() + .setName( + PageName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]", "[PAGE]").toString()) + .setDisplayName("displayName1714148973") + .setEntryFulfillment(Fulfillment.newBuilder().build()) + .setForm(Form.newBuilder().build()) + .addAllTransitionRouteGroups(new ArrayList()) + .addAllTransitionRoutes(new ArrayList()) + .addAllEventHandlers(new ArrayList()) + .build(); mockPages.addResponse(expectedResponse); Page page = Page.newBuilder().build(); @@ -261,7 +378,7 @@ public void updatePageTest() { List actualRequests = mockPages.getRequests(); Assert.assertEquals(1, actualRequests.size()); - UpdatePageRequest actualRequest = (UpdatePageRequest) actualRequests.get(0); + UpdatePageRequest actualRequest = ((UpdatePageRequest) actualRequests.get(0)); Assert.assertEquals(page, actualRequest.getPage()); Assert.assertEquals(updateMask, actualRequest.getUpdateMask()); @@ -272,25 +389,22 @@ public void updatePageTest() { } @Test - @SuppressWarnings("all") public void updatePageExceptionTest() throws Exception { - StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockPages.addException(exception); try { Page page = Page.newBuilder().build(); FieldMask updateMask = FieldMask.newBuilder().build(); - client.updatePage(page, updateMask); Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { - // Expected exception + // Expected exception. } } @Test - @SuppressWarnings("all") - public void deletePageTest() { + public void deletePageTest() throws Exception { Empty expectedResponse = Empty.newBuilder().build(); mockPages.addResponse(expectedResponse); @@ -300,9 +414,9 @@ public void deletePageTest() { List actualRequests = mockPages.getRequests(); Assert.assertEquals(1, actualRequests.size()); - DeletePageRequest actualRequest = (DeletePageRequest) actualRequests.get(0); + DeletePageRequest actualRequest = ((DeletePageRequest) actualRequests.get(0)); - Assert.assertEquals(name, PageName.parse(actualRequest.getName())); + Assert.assertEquals(name.toString(), actualRequest.getName()); Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), @@ -310,18 +424,50 @@ public void deletePageTest() { } @Test - @SuppressWarnings("all") public void deletePageExceptionTest() throws Exception { - StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockPages.addException(exception); try { PageName name = PageName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]", "[PAGE]"); + client.deletePage(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void deletePageTest2() throws Exception { + Empty expectedResponse = Empty.newBuilder().build(); + mockPages.addResponse(expectedResponse); + + String name = "name3373707"; + client.deletePage(name); + + List actualRequests = mockPages.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + DeletePageRequest actualRequest = ((DeletePageRequest) actualRequests.get(0)); + + Assert.assertEquals(name, actualRequest.getName()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void deletePageExceptionTest2() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockPages.addException(exception); + + try { + String name = "name3373707"; client.deletePage(name); Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { - // Expected exception + // Expected exception. } } } diff --git a/google-cloud-dialogflow-cx/src/test/java/com/google/cloud/dialogflow/cx/v3/SecuritySettingsServiceClientTest.java b/google-cloud-dialogflow-cx/src/test/java/com/google/cloud/dialogflow/cx/v3/SecuritySettingsServiceClientTest.java index ed78b948d..d36fa7b57 100644 --- a/google-cloud-dialogflow-cx/src/test/java/com/google/cloud/dialogflow/cx/v3/SecuritySettingsServiceClientTest.java +++ b/google-cloud-dialogflow-cx/src/test/java/com/google/cloud/dialogflow/cx/v3/SecuritySettingsServiceClientTest.java @@ -5,7 +5,7 @@ * 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 + * 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, @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.google.cloud.dialogflow.cx.v3; import static com.google.cloud.dialogflow.cx.v3.SecuritySettingsServiceClient.ListSecuritySettingsPagedResponse; @@ -28,12 +29,13 @@ import com.google.protobuf.AbstractMessage; import com.google.protobuf.Empty; import com.google.protobuf.FieldMask; -import io.grpc.Status; import io.grpc.StatusRuntimeException; import java.io.IOException; +import java.util.ArrayList; import java.util.Arrays; import java.util.List; import java.util.UUID; +import javax.annotation.Generated; import org.junit.After; import org.junit.AfterClass; import org.junit.Assert; @@ -41,66 +43,32 @@ import org.junit.BeforeClass; import org.junit.Test; -@javax.annotation.Generated("by GAPIC") +@Generated("by gapic-generator-java") public class SecuritySettingsServiceClientTest { - private static MockPages mockPages; - private static MockFlows mockFlows; - private static MockAgents mockAgents; - private static MockEntityTypes mockEntityTypes; - private static MockEnvironments mockEnvironments; - private static MockIntents mockIntents; - private static MockSecuritySettingsService mockSecuritySettingsService; - private static MockSessionEntityTypes mockSessionEntityTypes; - private static MockSessions mockSessions; - private static MockTransitionRouteGroups mockTransitionRouteGroups; - private static MockVersions mockVersions; - private static MockWebhooks mockWebhooks; - private static MockServiceHelper serviceHelper; + private static MockServiceHelper mockServiceHelper; private SecuritySettingsServiceClient client; + private static MockSecuritySettingsService mockSecuritySettingsService; private LocalChannelProvider channelProvider; @BeforeClass public static void startStaticServer() { - mockPages = new MockPages(); - mockFlows = new MockFlows(); - mockAgents = new MockAgents(); - mockEntityTypes = new MockEntityTypes(); - mockEnvironments = new MockEnvironments(); - mockIntents = new MockIntents(); mockSecuritySettingsService = new MockSecuritySettingsService(); - mockSessionEntityTypes = new MockSessionEntityTypes(); - mockSessions = new MockSessions(); - mockTransitionRouteGroups = new MockTransitionRouteGroups(); - mockVersions = new MockVersions(); - mockWebhooks = new MockWebhooks(); - serviceHelper = + mockServiceHelper = new MockServiceHelper( UUID.randomUUID().toString(), - Arrays.asList( - mockPages, - mockFlows, - mockAgents, - mockEntityTypes, - mockEnvironments, - mockIntents, - mockSecuritySettingsService, - mockSessionEntityTypes, - mockSessions, - mockTransitionRouteGroups, - mockVersions, - mockWebhooks)); - serviceHelper.start(); + Arrays.asList(mockSecuritySettingsService)); + mockServiceHelper.start(); } @AfterClass public static void stopServer() { - serviceHelper.stop(); + mockServiceHelper.stop(); } @Before public void setUp() throws IOException { - serviceHelper.reset(); - channelProvider = serviceHelper.createChannelProvider(); + mockServiceHelper.reset(); + channelProvider = mockServiceHelper.createChannelProvider(); SecuritySettingsServiceSettings settings = SecuritySettingsServiceSettings.newBuilder() .setTransportChannelProvider(channelProvider) @@ -115,19 +83,15 @@ public void tearDown() throws Exception { } @Test - @SuppressWarnings("all") - public void createSecuritySettingsTest() { - SecuritySettingsName name = - SecuritySettingsName.of("[PROJECT]", "[LOCATION]", "[SECURITY_SETTINGS]"); - String displayName = "displayName1615086568"; - String inspectTemplate = "inspectTemplate-159468987"; - int retentionWindowDays = 810238885; + public void createSecuritySettingsTest() throws Exception { SecuritySettings expectedResponse = SecuritySettings.newBuilder() - .setName(name.toString()) - .setDisplayName(displayName) - .setInspectTemplate(inspectTemplate) - .setRetentionWindowDays(retentionWindowDays) + .setName( + SecuritySettingsName.of("[PROJECT]", "[LOCATION]", "[SECURITY_SETTINGS]") + .toString()) + .setDisplayName("displayName1714148973") + .setInspectTemplate("inspectTemplate-2053620050") + .addAllPurgeDataTypes(new ArrayList()) .build(); mockSecuritySettingsService.addResponse(expectedResponse); @@ -140,9 +104,9 @@ public void createSecuritySettingsTest() { List actualRequests = mockSecuritySettingsService.getRequests(); Assert.assertEquals(1, actualRequests.size()); CreateSecuritySettingsRequest actualRequest = - (CreateSecuritySettingsRequest) actualRequests.get(0); + ((CreateSecuritySettingsRequest) actualRequests.get(0)); - Assert.assertEquals(parent, LocationName.parse(actualRequest.getParent())); + Assert.assertEquals(parent.toString(), actualRequest.getParent()); Assert.assertEquals(securitySettings, actualRequest.getSecuritySettings()); Assert.assertTrue( channelProvider.isHeaderSent( @@ -151,36 +115,77 @@ public void createSecuritySettingsTest() { } @Test - @SuppressWarnings("all") public void createSecuritySettingsExceptionTest() throws Exception { - StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockSecuritySettingsService.addException(exception); try { LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); SecuritySettings securitySettings = SecuritySettings.newBuilder().build(); + client.createSecuritySettings(parent, securitySettings); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void createSecuritySettingsTest2() throws Exception { + SecuritySettings expectedResponse = + SecuritySettings.newBuilder() + .setName( + SecuritySettingsName.of("[PROJECT]", "[LOCATION]", "[SECURITY_SETTINGS]") + .toString()) + .setDisplayName("displayName1714148973") + .setInspectTemplate("inspectTemplate-2053620050") + .addAllPurgeDataTypes(new ArrayList()) + .build(); + mockSecuritySettingsService.addResponse(expectedResponse); + + String parent = "parent-995424086"; + SecuritySettings securitySettings = SecuritySettings.newBuilder().build(); + + SecuritySettings actualResponse = client.createSecuritySettings(parent, securitySettings); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockSecuritySettingsService.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + CreateSecuritySettingsRequest actualRequest = + ((CreateSecuritySettingsRequest) actualRequests.get(0)); + + Assert.assertEquals(parent, actualRequest.getParent()); + Assert.assertEquals(securitySettings, actualRequest.getSecuritySettings()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + @Test + public void createSecuritySettingsExceptionTest2() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockSecuritySettingsService.addException(exception); + + try { + String parent = "parent-995424086"; + SecuritySettings securitySettings = SecuritySettings.newBuilder().build(); client.createSecuritySettings(parent, securitySettings); Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { - // Expected exception + // Expected exception. } } @Test - @SuppressWarnings("all") - public void getSecuritySettingsTest() { - SecuritySettingsName name2 = - SecuritySettingsName.of("[PROJECT]", "[LOCATION]", "[SECURITY_SETTINGS]"); - String displayName = "displayName1615086568"; - String inspectTemplate = "inspectTemplate-159468987"; - int retentionWindowDays = 810238885; + public void getSecuritySettingsTest() throws Exception { SecuritySettings expectedResponse = SecuritySettings.newBuilder() - .setName(name2.toString()) - .setDisplayName(displayName) - .setInspectTemplate(inspectTemplate) - .setRetentionWindowDays(retentionWindowDays) + .setName( + SecuritySettingsName.of("[PROJECT]", "[LOCATION]", "[SECURITY_SETTINGS]") + .toString()) + .setDisplayName("displayName1714148973") + .setInspectTemplate("inspectTemplate-2053620050") + .addAllPurgeDataTypes(new ArrayList()) .build(); mockSecuritySettingsService.addResponse(expectedResponse); @@ -192,9 +197,9 @@ public void getSecuritySettingsTest() { List actualRequests = mockSecuritySettingsService.getRequests(); Assert.assertEquals(1, actualRequests.size()); - GetSecuritySettingsRequest actualRequest = (GetSecuritySettingsRequest) actualRequests.get(0); + GetSecuritySettingsRequest actualRequest = ((GetSecuritySettingsRequest) actualRequests.get(0)); - Assert.assertEquals(name, SecuritySettingsName.parse(actualRequest.getName())); + Assert.assertEquals(name.toString(), actualRequest.getName()); Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), @@ -202,36 +207,73 @@ public void getSecuritySettingsTest() { } @Test - @SuppressWarnings("all") public void getSecuritySettingsExceptionTest() throws Exception { - StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockSecuritySettingsService.addException(exception); try { SecuritySettingsName name = SecuritySettingsName.of("[PROJECT]", "[LOCATION]", "[SECURITY_SETTINGS]"); + client.getSecuritySettings(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void getSecuritySettingsTest2() throws Exception { + SecuritySettings expectedResponse = + SecuritySettings.newBuilder() + .setName( + SecuritySettingsName.of("[PROJECT]", "[LOCATION]", "[SECURITY_SETTINGS]") + .toString()) + .setDisplayName("displayName1714148973") + .setInspectTemplate("inspectTemplate-2053620050") + .addAllPurgeDataTypes(new ArrayList()) + .build(); + mockSecuritySettingsService.addResponse(expectedResponse); + + String name = "name3373707"; + + SecuritySettings actualResponse = client.getSecuritySettings(name); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockSecuritySettingsService.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + GetSecuritySettingsRequest actualRequest = ((GetSecuritySettingsRequest) actualRequests.get(0)); + + Assert.assertEquals(name, actualRequest.getName()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void getSecuritySettingsExceptionTest2() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockSecuritySettingsService.addException(exception); + try { + String name = "name3373707"; client.getSecuritySettings(name); Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { - // Expected exception + // Expected exception. } } @Test - @SuppressWarnings("all") - public void updateSecuritySettingsTest() { - SecuritySettingsName name = - SecuritySettingsName.of("[PROJECT]", "[LOCATION]", "[SECURITY_SETTINGS]"); - String displayName = "displayName1615086568"; - String inspectTemplate = "inspectTemplate-159468987"; - int retentionWindowDays = 810238885; + public void updateSecuritySettingsTest() throws Exception { SecuritySettings expectedResponse = SecuritySettings.newBuilder() - .setName(name.toString()) - .setDisplayName(displayName) - .setInspectTemplate(inspectTemplate) - .setRetentionWindowDays(retentionWindowDays) + .setName( + SecuritySettingsName.of("[PROJECT]", "[LOCATION]", "[SECURITY_SETTINGS]") + .toString()) + .setDisplayName("displayName1714148973") + .setInspectTemplate("inspectTemplate-2053620050") + .addAllPurgeDataTypes(new ArrayList()) .build(); mockSecuritySettingsService.addResponse(expectedResponse); @@ -244,7 +286,7 @@ public void updateSecuritySettingsTest() { List actualRequests = mockSecuritySettingsService.getRequests(); Assert.assertEquals(1, actualRequests.size()); UpdateSecuritySettingsRequest actualRequest = - (UpdateSecuritySettingsRequest) actualRequests.get(0); + ((UpdateSecuritySettingsRequest) actualRequests.get(0)); Assert.assertEquals(securitySettings, actualRequest.getSecuritySettings()); Assert.assertEquals(updateMask, actualRequest.getUpdateMask()); @@ -255,32 +297,27 @@ public void updateSecuritySettingsTest() { } @Test - @SuppressWarnings("all") public void updateSecuritySettingsExceptionTest() throws Exception { - StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockSecuritySettingsService.addException(exception); try { SecuritySettings securitySettings = SecuritySettings.newBuilder().build(); FieldMask updateMask = FieldMask.newBuilder().build(); - client.updateSecuritySettings(securitySettings, updateMask); Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { - // Expected exception + // Expected exception. } } @Test - @SuppressWarnings("all") - public void listSecuritySettingsTest() { - String nextPageToken = ""; - SecuritySettings securitySettingsElement = SecuritySettings.newBuilder().build(); - List securitySettings = Arrays.asList(securitySettingsElement); + public void listSecuritySettingsTest() throws Exception { + SecuritySettings responsesElement = SecuritySettings.newBuilder().build(); ListSecuritySettingsResponse expectedResponse = ListSecuritySettingsResponse.newBuilder() - .setNextPageToken(nextPageToken) - .addAllSecuritySettings(securitySettings) + .setNextPageToken("") + .addAllSecuritySettings(Arrays.asList(responsesElement)) .build(); mockSecuritySettingsService.addResponse(expectedResponse); @@ -289,14 +326,16 @@ public void listSecuritySettingsTest() { ListSecuritySettingsPagedResponse pagedListResponse = client.listSecuritySettings(parent); List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + Assert.assertEquals(1, resources.size()); Assert.assertEquals(expectedResponse.getSecuritySettingsList().get(0), resources.get(0)); List actualRequests = mockSecuritySettingsService.getRequests(); Assert.assertEquals(1, actualRequests.size()); - ListSecuritySettingsRequest actualRequest = (ListSecuritySettingsRequest) actualRequests.get(0); + ListSecuritySettingsRequest actualRequest = + ((ListSecuritySettingsRequest) actualRequests.get(0)); - Assert.assertEquals(parent, LocationName.parse(actualRequest.getParent())); + Assert.assertEquals(parent.toString(), actualRequest.getParent()); Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), @@ -304,24 +343,66 @@ public void listSecuritySettingsTest() { } @Test - @SuppressWarnings("all") public void listSecuritySettingsExceptionTest() throws Exception { - StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockSecuritySettingsService.addException(exception); try { LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); + client.listSecuritySettings(parent); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void listSecuritySettingsTest2() throws Exception { + SecuritySettings responsesElement = SecuritySettings.newBuilder().build(); + ListSecuritySettingsResponse expectedResponse = + ListSecuritySettingsResponse.newBuilder() + .setNextPageToken("") + .addAllSecuritySettings(Arrays.asList(responsesElement)) + .build(); + mockSecuritySettingsService.addResponse(expectedResponse); + + String parent = "parent-995424086"; + + ListSecuritySettingsPagedResponse pagedListResponse = client.listSecuritySettings(parent); + + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getSecuritySettingsList().get(0), resources.get(0)); + + List actualRequests = mockSecuritySettingsService.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + ListSecuritySettingsRequest actualRequest = + ((ListSecuritySettingsRequest) actualRequests.get(0)); + + Assert.assertEquals(parent, actualRequest.getParent()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void listSecuritySettingsExceptionTest2() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockSecuritySettingsService.addException(exception); + try { + String parent = "parent-995424086"; client.listSecuritySettings(parent); Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { - // Expected exception + // Expected exception. } } @Test - @SuppressWarnings("all") - public void deleteSecuritySettingsTest() { + public void deleteSecuritySettingsTest() throws Exception { Empty expectedResponse = Empty.newBuilder().build(); mockSecuritySettingsService.addResponse(expectedResponse); @@ -333,9 +414,9 @@ public void deleteSecuritySettingsTest() { List actualRequests = mockSecuritySettingsService.getRequests(); Assert.assertEquals(1, actualRequests.size()); DeleteSecuritySettingsRequest actualRequest = - (DeleteSecuritySettingsRequest) actualRequests.get(0); + ((DeleteSecuritySettingsRequest) actualRequests.get(0)); - Assert.assertEquals(name, SecuritySettingsName.parse(actualRequest.getName())); + Assert.assertEquals(name.toString(), actualRequest.getName()); Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), @@ -343,19 +424,52 @@ public void deleteSecuritySettingsTest() { } @Test - @SuppressWarnings("all") public void deleteSecuritySettingsExceptionTest() throws Exception { - StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockSecuritySettingsService.addException(exception); try { SecuritySettingsName name = SecuritySettingsName.of("[PROJECT]", "[LOCATION]", "[SECURITY_SETTINGS]"); + client.deleteSecuritySettings(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void deleteSecuritySettingsTest2() throws Exception { + Empty expectedResponse = Empty.newBuilder().build(); + mockSecuritySettingsService.addResponse(expectedResponse); + + String name = "name3373707"; + client.deleteSecuritySettings(name); + + List actualRequests = mockSecuritySettingsService.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + DeleteSecuritySettingsRequest actualRequest = + ((DeleteSecuritySettingsRequest) actualRequests.get(0)); + + Assert.assertEquals(name, actualRequest.getName()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void deleteSecuritySettingsExceptionTest2() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockSecuritySettingsService.addException(exception); + + try { + String name = "name3373707"; client.deleteSecuritySettings(name); Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { - // Expected exception + // Expected exception. } } } diff --git a/google-cloud-dialogflow-cx/src/test/java/com/google/cloud/dialogflow/cx/v3/SessionEntityTypesClientTest.java b/google-cloud-dialogflow-cx/src/test/java/com/google/cloud/dialogflow/cx/v3/SessionEntityTypesClientTest.java index 52b051d9e..789a9b433 100644 --- a/google-cloud-dialogflow-cx/src/test/java/com/google/cloud/dialogflow/cx/v3/SessionEntityTypesClientTest.java +++ b/google-cloud-dialogflow-cx/src/test/java/com/google/cloud/dialogflow/cx/v3/SessionEntityTypesClientTest.java @@ -5,7 +5,7 @@ * 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 + * 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, @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.google.cloud.dialogflow.cx.v3; import static com.google.cloud.dialogflow.cx.v3.SessionEntityTypesClient.ListSessionEntityTypesPagedResponse; @@ -28,12 +29,13 @@ import com.google.protobuf.AbstractMessage; import com.google.protobuf.Empty; import com.google.protobuf.FieldMask; -import io.grpc.Status; import io.grpc.StatusRuntimeException; import java.io.IOException; +import java.util.ArrayList; import java.util.Arrays; import java.util.List; import java.util.UUID; +import javax.annotation.Generated; import org.junit.After; import org.junit.AfterClass; import org.junit.Assert; @@ -41,66 +43,31 @@ import org.junit.BeforeClass; import org.junit.Test; -@javax.annotation.Generated("by GAPIC") +@Generated("by gapic-generator-java") public class SessionEntityTypesClientTest { - private static MockPages mockPages; - private static MockFlows mockFlows; - private static MockAgents mockAgents; - private static MockEntityTypes mockEntityTypes; - private static MockEnvironments mockEnvironments; - private static MockIntents mockIntents; - private static MockSecuritySettingsService mockSecuritySettingsService; private static MockSessionEntityTypes mockSessionEntityTypes; - private static MockSessions mockSessions; - private static MockTransitionRouteGroups mockTransitionRouteGroups; - private static MockVersions mockVersions; - private static MockWebhooks mockWebhooks; - private static MockServiceHelper serviceHelper; + private static MockServiceHelper mockServiceHelper; private SessionEntityTypesClient client; private LocalChannelProvider channelProvider; @BeforeClass public static void startStaticServer() { - mockPages = new MockPages(); - mockFlows = new MockFlows(); - mockAgents = new MockAgents(); - mockEntityTypes = new MockEntityTypes(); - mockEnvironments = new MockEnvironments(); - mockIntents = new MockIntents(); - mockSecuritySettingsService = new MockSecuritySettingsService(); mockSessionEntityTypes = new MockSessionEntityTypes(); - mockSessions = new MockSessions(); - mockTransitionRouteGroups = new MockTransitionRouteGroups(); - mockVersions = new MockVersions(); - mockWebhooks = new MockWebhooks(); - serviceHelper = + mockServiceHelper = new MockServiceHelper( - UUID.randomUUID().toString(), - Arrays.asList( - mockPages, - mockFlows, - mockAgents, - mockEntityTypes, - mockEnvironments, - mockIntents, - mockSecuritySettingsService, - mockSessionEntityTypes, - mockSessions, - mockTransitionRouteGroups, - mockVersions, - mockWebhooks)); - serviceHelper.start(); + UUID.randomUUID().toString(), Arrays.asList(mockSessionEntityTypes)); + mockServiceHelper.start(); } @AfterClass public static void stopServer() { - serviceHelper.stop(); + mockServiceHelper.stop(); } @Before public void setUp() throws IOException { - serviceHelper.reset(); - channelProvider = serviceHelper.createChannelProvider(); + mockServiceHelper.reset(); + channelProvider = mockServiceHelper.createChannelProvider(); SessionEntityTypesSettings settings = SessionEntityTypesSettings.newBuilder() .setTransportChannelProvider(channelProvider) @@ -115,15 +82,12 @@ public void tearDown() throws Exception { } @Test - @SuppressWarnings("all") - public void listSessionEntityTypesTest() { - String nextPageToken = ""; - SessionEntityType sessionEntityTypesElement = SessionEntityType.newBuilder().build(); - List sessionEntityTypes = Arrays.asList(sessionEntityTypesElement); + public void listSessionEntityTypesTest() throws Exception { + SessionEntityType responsesElement = SessionEntityType.newBuilder().build(); ListSessionEntityTypesResponse expectedResponse = ListSessionEntityTypesResponse.newBuilder() - .setNextPageToken(nextPageToken) - .addAllSessionEntityTypes(sessionEntityTypes) + .setNextPageToken("") + .addAllSessionEntityTypes(Arrays.asList(responsesElement)) .build(); mockSessionEntityTypes.addResponse(expectedResponse); @@ -134,15 +98,16 @@ public void listSessionEntityTypesTest() { ListSessionEntityTypesPagedResponse pagedListResponse = client.listSessionEntityTypes(parent); List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + Assert.assertEquals(1, resources.size()); Assert.assertEquals(expectedResponse.getSessionEntityTypesList().get(0), resources.get(0)); List actualRequests = mockSessionEntityTypes.getRequests(); Assert.assertEquals(1, actualRequests.size()); ListSessionEntityTypesRequest actualRequest = - (ListSessionEntityTypesRequest) actualRequests.get(0); + ((ListSessionEntityTypesRequest) actualRequests.get(0)); - Assert.assertEquals(parent, SessionName.parse(actualRequest.getParent())); + Assert.assertEquals(parent.toString(), actualRequest.getParent()); Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), @@ -150,31 +115,76 @@ public void listSessionEntityTypesTest() { } @Test - @SuppressWarnings("all") public void listSessionEntityTypesExceptionTest() throws Exception { - StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockSessionEntityTypes.addException(exception); try { SessionName parent = SessionName.ofProjectLocationAgentSessionName( "[PROJECT]", "[LOCATION]", "[AGENT]", "[SESSION]"); + client.listSessionEntityTypes(parent); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void listSessionEntityTypesTest2() throws Exception { + SessionEntityType responsesElement = SessionEntityType.newBuilder().build(); + ListSessionEntityTypesResponse expectedResponse = + ListSessionEntityTypesResponse.newBuilder() + .setNextPageToken("") + .addAllSessionEntityTypes(Arrays.asList(responsesElement)) + .build(); + mockSessionEntityTypes.addResponse(expectedResponse); + + String parent = "parent-995424086"; + + ListSessionEntityTypesPagedResponse pagedListResponse = client.listSessionEntityTypes(parent); + + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getSessionEntityTypesList().get(0), resources.get(0)); + + List actualRequests = mockSessionEntityTypes.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + ListSessionEntityTypesRequest actualRequest = + ((ListSessionEntityTypesRequest) actualRequests.get(0)); + + Assert.assertEquals(parent, actualRequest.getParent()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void listSessionEntityTypesExceptionTest2() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockSessionEntityTypes.addException(exception); + try { + String parent = "parent-995424086"; client.listSessionEntityTypes(parent); Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { - // Expected exception + // Expected exception. } } @Test - @SuppressWarnings("all") - public void getSessionEntityTypeTest() { - SessionEntityTypeName name2 = - SessionEntityTypeName.ofProjectLocationAgentSessionEntityTypeName( - "[PROJECT]", "[LOCATION]", "[AGENT]", "[SESSION]", "[ENTITY_TYPE]"); + public void getSessionEntityTypeTest() throws Exception { SessionEntityType expectedResponse = - SessionEntityType.newBuilder().setName(name2.toString()).build(); + SessionEntityType.newBuilder() + .setName( + SessionEntityTypeName.ofProjectLocationAgentSessionEntityTypeName( + "[PROJECT]", "[LOCATION]", "[AGENT]", "[SESSION]", "[ENTITY_TYPE]") + .toString()) + .addAllEntities(new ArrayList()) + .build(); mockSessionEntityTypes.addResponse(expectedResponse); SessionEntityTypeName name = @@ -186,9 +196,10 @@ public void getSessionEntityTypeTest() { List actualRequests = mockSessionEntityTypes.getRequests(); Assert.assertEquals(1, actualRequests.size()); - GetSessionEntityTypeRequest actualRequest = (GetSessionEntityTypeRequest) actualRequests.get(0); + GetSessionEntityTypeRequest actualRequest = + ((GetSessionEntityTypeRequest) actualRequests.get(0)); - Assert.assertEquals(name, SessionEntityTypeName.parse(actualRequest.getName())); + Assert.assertEquals(name.toString(), actualRequest.getName()); Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), @@ -196,31 +207,74 @@ public void getSessionEntityTypeTest() { } @Test - @SuppressWarnings("all") public void getSessionEntityTypeExceptionTest() throws Exception { - StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockSessionEntityTypes.addException(exception); try { SessionEntityTypeName name = SessionEntityTypeName.ofProjectLocationAgentSessionEntityTypeName( "[PROJECT]", "[LOCATION]", "[AGENT]", "[SESSION]", "[ENTITY_TYPE]"); + client.getSessionEntityType(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void getSessionEntityTypeTest2() throws Exception { + SessionEntityType expectedResponse = + SessionEntityType.newBuilder() + .setName( + SessionEntityTypeName.ofProjectLocationAgentSessionEntityTypeName( + "[PROJECT]", "[LOCATION]", "[AGENT]", "[SESSION]", "[ENTITY_TYPE]") + .toString()) + .addAllEntities(new ArrayList()) + .build(); + mockSessionEntityTypes.addResponse(expectedResponse); + String name = "name3373707"; + + SessionEntityType actualResponse = client.getSessionEntityType(name); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockSessionEntityTypes.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + GetSessionEntityTypeRequest actualRequest = + ((GetSessionEntityTypeRequest) actualRequests.get(0)); + + Assert.assertEquals(name, actualRequest.getName()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void getSessionEntityTypeExceptionTest2() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockSessionEntityTypes.addException(exception); + + try { + String name = "name3373707"; client.getSessionEntityType(name); Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { - // Expected exception + // Expected exception. } } @Test - @SuppressWarnings("all") - public void createSessionEntityTypeTest() { - SessionEntityTypeName name = - SessionEntityTypeName.ofProjectLocationAgentSessionEntityTypeName( - "[PROJECT]", "[LOCATION]", "[AGENT]", "[SESSION]", "[ENTITY_TYPE]"); + public void createSessionEntityTypeTest() throws Exception { SessionEntityType expectedResponse = - SessionEntityType.newBuilder().setName(name.toString()).build(); + SessionEntityType.newBuilder() + .setName( + SessionEntityTypeName.ofProjectLocationAgentSessionEntityTypeName( + "[PROJECT]", "[LOCATION]", "[AGENT]", "[SESSION]", "[ENTITY_TYPE]") + .toString()) + .addAllEntities(new ArrayList()) + .build(); mockSessionEntityTypes.addResponse(expectedResponse); SessionName parent = @@ -234,9 +288,9 @@ public void createSessionEntityTypeTest() { List actualRequests = mockSessionEntityTypes.getRequests(); Assert.assertEquals(1, actualRequests.size()); CreateSessionEntityTypeRequest actualRequest = - (CreateSessionEntityTypeRequest) actualRequests.get(0); + ((CreateSessionEntityTypeRequest) actualRequests.get(0)); - Assert.assertEquals(parent, SessionName.parse(actualRequest.getParent())); + Assert.assertEquals(parent.toString(), actualRequest.getParent()); Assert.assertEquals(sessionEntityType, actualRequest.getSessionEntityType()); Assert.assertTrue( channelProvider.isHeaderSent( @@ -245,9 +299,8 @@ public void createSessionEntityTypeTest() { } @Test - @SuppressWarnings("all") public void createSessionEntityTypeExceptionTest() throws Exception { - StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockSessionEntityTypes.addException(exception); try { @@ -255,22 +308,69 @@ public void createSessionEntityTypeExceptionTest() throws Exception { SessionName.ofProjectLocationAgentSessionName( "[PROJECT]", "[LOCATION]", "[AGENT]", "[SESSION]"); SessionEntityType sessionEntityType = SessionEntityType.newBuilder().build(); + client.createSessionEntityType(parent, sessionEntityType); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + @Test + public void createSessionEntityTypeTest2() throws Exception { + SessionEntityType expectedResponse = + SessionEntityType.newBuilder() + .setName( + SessionEntityTypeName.ofProjectLocationAgentSessionEntityTypeName( + "[PROJECT]", "[LOCATION]", "[AGENT]", "[SESSION]", "[ENTITY_TYPE]") + .toString()) + .addAllEntities(new ArrayList()) + .build(); + mockSessionEntityTypes.addResponse(expectedResponse); + + String parent = "parent-995424086"; + SessionEntityType sessionEntityType = SessionEntityType.newBuilder().build(); + + SessionEntityType actualResponse = client.createSessionEntityType(parent, sessionEntityType); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockSessionEntityTypes.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + CreateSessionEntityTypeRequest actualRequest = + ((CreateSessionEntityTypeRequest) actualRequests.get(0)); + + Assert.assertEquals(parent, actualRequest.getParent()); + Assert.assertEquals(sessionEntityType, actualRequest.getSessionEntityType()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void createSessionEntityTypeExceptionTest2() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockSessionEntityTypes.addException(exception); + + try { + String parent = "parent-995424086"; + SessionEntityType sessionEntityType = SessionEntityType.newBuilder().build(); client.createSessionEntityType(parent, sessionEntityType); Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { - // Expected exception + // Expected exception. } } @Test - @SuppressWarnings("all") - public void updateSessionEntityTypeTest() { - SessionEntityTypeName name = - SessionEntityTypeName.ofProjectLocationAgentSessionEntityTypeName( - "[PROJECT]", "[LOCATION]", "[AGENT]", "[SESSION]", "[ENTITY_TYPE]"); + public void updateSessionEntityTypeTest() throws Exception { SessionEntityType expectedResponse = - SessionEntityType.newBuilder().setName(name.toString()).build(); + SessionEntityType.newBuilder() + .setName( + SessionEntityTypeName.ofProjectLocationAgentSessionEntityTypeName( + "[PROJECT]", "[LOCATION]", "[AGENT]", "[SESSION]", "[ENTITY_TYPE]") + .toString()) + .addAllEntities(new ArrayList()) + .build(); mockSessionEntityTypes.addResponse(expectedResponse); SessionEntityType sessionEntityType = SessionEntityType.newBuilder().build(); @@ -283,7 +383,7 @@ public void updateSessionEntityTypeTest() { List actualRequests = mockSessionEntityTypes.getRequests(); Assert.assertEquals(1, actualRequests.size()); UpdateSessionEntityTypeRequest actualRequest = - (UpdateSessionEntityTypeRequest) actualRequests.get(0); + ((UpdateSessionEntityTypeRequest) actualRequests.get(0)); Assert.assertEquals(sessionEntityType, actualRequest.getSessionEntityType()); Assert.assertEquals(updateMask, actualRequest.getUpdateMask()); @@ -294,25 +394,22 @@ public void updateSessionEntityTypeTest() { } @Test - @SuppressWarnings("all") public void updateSessionEntityTypeExceptionTest() throws Exception { - StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockSessionEntityTypes.addException(exception); try { SessionEntityType sessionEntityType = SessionEntityType.newBuilder().build(); FieldMask updateMask = FieldMask.newBuilder().build(); - client.updateSessionEntityType(sessionEntityType, updateMask); Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { - // Expected exception + // Expected exception. } } @Test - @SuppressWarnings("all") - public void deleteSessionEntityTypeTest() { + public void deleteSessionEntityTypeTest() throws Exception { Empty expectedResponse = Empty.newBuilder().build(); mockSessionEntityTypes.addResponse(expectedResponse); @@ -325,9 +422,9 @@ public void deleteSessionEntityTypeTest() { List actualRequests = mockSessionEntityTypes.getRequests(); Assert.assertEquals(1, actualRequests.size()); DeleteSessionEntityTypeRequest actualRequest = - (DeleteSessionEntityTypeRequest) actualRequests.get(0); + ((DeleteSessionEntityTypeRequest) actualRequests.get(0)); - Assert.assertEquals(name, SessionEntityTypeName.parse(actualRequest.getName())); + Assert.assertEquals(name.toString(), actualRequest.getName()); Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), @@ -335,20 +432,53 @@ public void deleteSessionEntityTypeTest() { } @Test - @SuppressWarnings("all") public void deleteSessionEntityTypeExceptionTest() throws Exception { - StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockSessionEntityTypes.addException(exception); try { SessionEntityTypeName name = SessionEntityTypeName.ofProjectLocationAgentSessionEntityTypeName( "[PROJECT]", "[LOCATION]", "[AGENT]", "[SESSION]", "[ENTITY_TYPE]"); + client.deleteSessionEntityType(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void deleteSessionEntityTypeTest2() throws Exception { + Empty expectedResponse = Empty.newBuilder().build(); + mockSessionEntityTypes.addResponse(expectedResponse); + + String name = "name3373707"; + client.deleteSessionEntityType(name); + + List actualRequests = mockSessionEntityTypes.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + DeleteSessionEntityTypeRequest actualRequest = + ((DeleteSessionEntityTypeRequest) actualRequests.get(0)); + + Assert.assertEquals(name, actualRequest.getName()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void deleteSessionEntityTypeExceptionTest2() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockSessionEntityTypes.addException(exception); + + try { + String name = "name3373707"; client.deleteSessionEntityType(name); Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { - // Expected exception + // Expected exception. } } } diff --git a/google-cloud-dialogflow-cx/src/test/java/com/google/cloud/dialogflow/cx/v3/SessionsClientTest.java b/google-cloud-dialogflow-cx/src/test/java/com/google/cloud/dialogflow/cx/v3/SessionsClientTest.java index 055337bc3..d24ca79a0 100644 --- a/google-cloud-dialogflow-cx/src/test/java/com/google/cloud/dialogflow/cx/v3/SessionsClientTest.java +++ b/google-cloud-dialogflow-cx/src/test/java/com/google/cloud/dialogflow/cx/v3/SessionsClientTest.java @@ -5,7 +5,7 @@ * 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 + * 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, @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.google.cloud.dialogflow.cx.v3; import com.google.api.gax.core.NoCredentialsProvider; @@ -28,13 +29,14 @@ import com.google.api.gax.rpc.StatusCode; import com.google.protobuf.AbstractMessage; import com.google.protobuf.ByteString; -import io.grpc.Status; import io.grpc.StatusRuntimeException; import java.io.IOException; +import java.util.ArrayList; import java.util.Arrays; import java.util.List; import java.util.UUID; import java.util.concurrent.ExecutionException; +import javax.annotation.Generated; import org.junit.After; import org.junit.AfterClass; import org.junit.Assert; @@ -42,66 +44,31 @@ import org.junit.BeforeClass; import org.junit.Test; -@javax.annotation.Generated("by GAPIC") +@Generated("by gapic-generator-java") public class SessionsClientTest { - private static MockPages mockPages; - private static MockFlows mockFlows; - private static MockAgents mockAgents; - private static MockEntityTypes mockEntityTypes; - private static MockEnvironments mockEnvironments; - private static MockIntents mockIntents; - private static MockSecuritySettingsService mockSecuritySettingsService; - private static MockSessionEntityTypes mockSessionEntityTypes; - private static MockSessions mockSessions; - private static MockTransitionRouteGroups mockTransitionRouteGroups; - private static MockVersions mockVersions; - private static MockWebhooks mockWebhooks; - private static MockServiceHelper serviceHelper; + private static MockServiceHelper mockServiceHelper; private SessionsClient client; private LocalChannelProvider channelProvider; + private static MockSessions mockSessions; @BeforeClass public static void startStaticServer() { - mockPages = new MockPages(); - mockFlows = new MockFlows(); - mockAgents = new MockAgents(); - mockEntityTypes = new MockEntityTypes(); - mockEnvironments = new MockEnvironments(); - mockIntents = new MockIntents(); - mockSecuritySettingsService = new MockSecuritySettingsService(); - mockSessionEntityTypes = new MockSessionEntityTypes(); mockSessions = new MockSessions(); - mockTransitionRouteGroups = new MockTransitionRouteGroups(); - mockVersions = new MockVersions(); - mockWebhooks = new MockWebhooks(); - serviceHelper = + mockServiceHelper = new MockServiceHelper( - UUID.randomUUID().toString(), - Arrays.asList( - mockPages, - mockFlows, - mockAgents, - mockEntityTypes, - mockEnvironments, - mockIntents, - mockSecuritySettingsService, - mockSessionEntityTypes, - mockSessions, - mockTransitionRouteGroups, - mockVersions, - mockWebhooks)); - serviceHelper.start(); + UUID.randomUUID().toString(), Arrays.asList(mockSessions)); + mockServiceHelper.start(); } @AfterClass public static void stopServer() { - serviceHelper.stop(); + mockServiceHelper.stop(); } @Before public void setUp() throws IOException { - serviceHelper.reset(); - channelProvider = serviceHelper.createChannelProvider(); + mockServiceHelper.reset(); + channelProvider = mockServiceHelper.createChannelProvider(); SessionsSettings settings = SessionsSettings.newBuilder() .setTransportChannelProvider(channelProvider) @@ -116,25 +83,25 @@ public void tearDown() throws Exception { } @Test - @SuppressWarnings("all") - public void detectIntentTest() { - String responseId = "responseId1847552473"; - ByteString outputAudio = ByteString.copyFromUtf8("24"); + public void detectIntentTest() throws Exception { DetectIntentResponse expectedResponse = DetectIntentResponse.newBuilder() - .setResponseId(responseId) - .setOutputAudio(outputAudio) + .setResponseId("responseId-633138884") + .setQueryResult(QueryResult.newBuilder().build()) + .setOutputAudio(ByteString.EMPTY) + .setOutputAudioConfig(OutputAudioConfig.newBuilder().build()) .build(); mockSessions.addResponse(expectedResponse); - SessionName session = - SessionName.ofProjectLocationAgentSessionName( - "[PROJECT]", "[LOCATION]", "[AGENT]", "[SESSION]"); - QueryInput queryInput = QueryInput.newBuilder().build(); DetectIntentRequest request = DetectIntentRequest.newBuilder() - .setSession(session.toString()) - .setQueryInput(queryInput) + .setSession( + SessionName.ofProjectLocationAgentSessionName( + "[PROJECT]", "[LOCATION]", "[AGENT]", "[SESSION]") + .toString()) + .setQueryParams(QueryParameters.newBuilder().build()) + .setQueryInput(QueryInput.newBuilder().build()) + .setOutputAudioConfig(OutputAudioConfig.newBuilder().build()) .build(); DetectIntentResponse actualResponse = client.detectIntent(request); @@ -142,10 +109,12 @@ public void detectIntentTest() { List actualRequests = mockSessions.getRequests(); Assert.assertEquals(1, actualRequests.size()); - DetectIntentRequest actualRequest = (DetectIntentRequest) actualRequests.get(0); + DetectIntentRequest actualRequest = ((DetectIntentRequest) actualRequests.get(0)); - Assert.assertEquals(session, SessionName.parse(actualRequest.getSession())); - Assert.assertEquals(queryInput, actualRequest.getQueryInput()); + Assert.assertEquals(request.getSession(), actualRequest.getSession()); + Assert.assertEquals(request.getQueryParams(), actualRequest.getQueryParams()); + Assert.assertEquals(request.getQueryInput(), actualRequest.getQueryInput()); + Assert.assertEquals(request.getOutputAudioConfig(), actualRequest.getOutputAudioConfig()); Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), @@ -153,38 +122,43 @@ public void detectIntentTest() { } @Test - @SuppressWarnings("all") public void detectIntentExceptionTest() throws Exception { - StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockSessions.addException(exception); try { - SessionName session = - SessionName.ofProjectLocationAgentSessionName( - "[PROJECT]", "[LOCATION]", "[AGENT]", "[SESSION]"); - QueryInput queryInput = QueryInput.newBuilder().build(); DetectIntentRequest request = DetectIntentRequest.newBuilder() - .setSession(session.toString()) - .setQueryInput(queryInput) + .setSession( + SessionName.ofProjectLocationAgentSessionName( + "[PROJECT]", "[LOCATION]", "[AGENT]", "[SESSION]") + .toString()) + .setQueryParams(QueryParameters.newBuilder().build()) + .setQueryInput(QueryInput.newBuilder().build()) + .setOutputAudioConfig(OutputAudioConfig.newBuilder().build()) .build(); - client.detectIntent(request); Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { - // Expected exception + // Expected exception. } } @Test - @SuppressWarnings("all") public void streamingDetectIntentTest() throws Exception { StreamingDetectIntentResponse expectedResponse = StreamingDetectIntentResponse.newBuilder().build(); mockSessions.addResponse(expectedResponse); - QueryInput queryInput = QueryInput.newBuilder().build(); StreamingDetectIntentRequest request = - StreamingDetectIntentRequest.newBuilder().setQueryInput(queryInput).build(); + StreamingDetectIntentRequest.newBuilder() + .setSession( + SessionName.ofProjectLocationAgentSessionName( + "[PROJECT]", "[LOCATION]", "[AGENT]", "[SESSION]") + .toString()) + .setQueryParams(QueryParameters.newBuilder().build()) + .setQueryInput(QueryInput.newBuilder().build()) + .setOutputAudioConfig(OutputAudioConfig.newBuilder().build()) + .build(); MockStreamObserver responseObserver = new MockStreamObserver<>(); @@ -202,13 +176,19 @@ public void streamingDetectIntentTest() throws Exception { } @Test - @SuppressWarnings("all") public void streamingDetectIntentExceptionTest() throws Exception { - StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockSessions.addException(exception); - QueryInput queryInput = QueryInput.newBuilder().build(); StreamingDetectIntentRequest request = - StreamingDetectIntentRequest.newBuilder().setQueryInput(queryInput).build(); + StreamingDetectIntentRequest.newBuilder() + .setSession( + SessionName.ofProjectLocationAgentSessionName( + "[PROJECT]", "[LOCATION]", "[AGENT]", "[SESSION]") + .toString()) + .setQueryParams(QueryParameters.newBuilder().build()) + .setQueryInput(QueryInput.newBuilder().build()) + .setOutputAudioConfig(OutputAudioConfig.newBuilder().build()) + .build(); MockStreamObserver responseObserver = new MockStreamObserver<>(); @@ -224,26 +204,28 @@ public void streamingDetectIntentExceptionTest() throws Exception { Assert.fail("No exception thrown"); } catch (ExecutionException e) { Assert.assertTrue(e.getCause() instanceof InvalidArgumentException); - InvalidArgumentException apiException = (InvalidArgumentException) e.getCause(); + InvalidArgumentException apiException = ((InvalidArgumentException) e.getCause()); Assert.assertEquals(StatusCode.Code.INVALID_ARGUMENT, apiException.getStatusCode().getCode()); } } @Test - @SuppressWarnings("all") - public void matchIntentTest() { - String text = "text3556653"; - MatchIntentResponse expectedResponse = MatchIntentResponse.newBuilder().setText(text).build(); + public void matchIntentTest() throws Exception { + MatchIntentResponse expectedResponse = + MatchIntentResponse.newBuilder() + .addAllMatches(new ArrayList()) + .setCurrentPage(Page.newBuilder().build()) + .build(); mockSessions.addResponse(expectedResponse); - SessionName session = - SessionName.ofProjectLocationAgentSessionName( - "[PROJECT]", "[LOCATION]", "[AGENT]", "[SESSION]"); - QueryInput queryInput = QueryInput.newBuilder().build(); MatchIntentRequest request = MatchIntentRequest.newBuilder() - .setSession(session.toString()) - .setQueryInput(queryInput) + .setSession( + SessionName.ofProjectLocationAgentSessionName( + "[PROJECT]", "[LOCATION]", "[AGENT]", "[SESSION]") + .toString()) + .setQueryParams(QueryParameters.newBuilder().build()) + .setQueryInput(QueryInput.newBuilder().build()) .build(); MatchIntentResponse actualResponse = client.matchIntent(request); @@ -251,10 +233,11 @@ public void matchIntentTest() { List actualRequests = mockSessions.getRequests(); Assert.assertEquals(1, actualRequests.size()); - MatchIntentRequest actualRequest = (MatchIntentRequest) actualRequests.get(0); + MatchIntentRequest actualRequest = ((MatchIntentRequest) actualRequests.get(0)); - Assert.assertEquals(session, SessionName.parse(actualRequest.getSession())); - Assert.assertEquals(queryInput, actualRequest.getQueryInput()); + Assert.assertEquals(request.getSession(), actualRequest.getSession()); + Assert.assertEquals(request.getQueryParams(), actualRequest.getQueryParams()); + Assert.assertEquals(request.getQueryInput(), actualRequest.getQueryInput()); Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), @@ -262,50 +245,55 @@ public void matchIntentTest() { } @Test - @SuppressWarnings("all") public void matchIntentExceptionTest() throws Exception { - StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockSessions.addException(exception); try { - SessionName session = - SessionName.ofProjectLocationAgentSessionName( - "[PROJECT]", "[LOCATION]", "[AGENT]", "[SESSION]"); - QueryInput queryInput = QueryInput.newBuilder().build(); MatchIntentRequest request = MatchIntentRequest.newBuilder() - .setSession(session.toString()) - .setQueryInput(queryInput) + .setSession( + SessionName.ofProjectLocationAgentSessionName( + "[PROJECT]", "[LOCATION]", "[AGENT]", "[SESSION]") + .toString()) + .setQueryParams(QueryParameters.newBuilder().build()) + .setQueryInput(QueryInput.newBuilder().build()) .build(); - client.matchIntent(request); Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { - // Expected exception + // Expected exception. } } @Test - @SuppressWarnings("all") - public void fulfillIntentTest() { - String responseId = "responseId1847552473"; - ByteString outputAudio = ByteString.copyFromUtf8("24"); + public void fulfillIntentTest() throws Exception { FulfillIntentResponse expectedResponse = FulfillIntentResponse.newBuilder() - .setResponseId(responseId) - .setOutputAudio(outputAudio) + .setResponseId("responseId-633138884") + .setQueryResult(QueryResult.newBuilder().build()) + .setOutputAudio(ByteString.EMPTY) + .setOutputAudioConfig(OutputAudioConfig.newBuilder().build()) .build(); mockSessions.addResponse(expectedResponse); - FulfillIntentRequest request = FulfillIntentRequest.newBuilder().build(); + FulfillIntentRequest request = + FulfillIntentRequest.newBuilder() + .setMatchIntentRequest(MatchIntentRequest.newBuilder().build()) + .setMatch(Match.newBuilder().build()) + .setOutputAudioConfig(OutputAudioConfig.newBuilder().build()) + .build(); FulfillIntentResponse actualResponse = client.fulfillIntent(request); Assert.assertEquals(expectedResponse, actualResponse); List actualRequests = mockSessions.getRequests(); Assert.assertEquals(1, actualRequests.size()); - FulfillIntentRequest actualRequest = (FulfillIntentRequest) actualRequests.get(0); + FulfillIntentRequest actualRequest = ((FulfillIntentRequest) actualRequests.get(0)); + Assert.assertEquals(request.getMatchIntentRequest(), actualRequest.getMatchIntentRequest()); + Assert.assertEquals(request.getMatch(), actualRequest.getMatch()); + Assert.assertEquals(request.getOutputAudioConfig(), actualRequest.getOutputAudioConfig()); Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), @@ -313,18 +301,21 @@ public void fulfillIntentTest() { } @Test - @SuppressWarnings("all") public void fulfillIntentExceptionTest() throws Exception { - StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockSessions.addException(exception); try { - FulfillIntentRequest request = FulfillIntentRequest.newBuilder().build(); - + FulfillIntentRequest request = + FulfillIntentRequest.newBuilder() + .setMatchIntentRequest(MatchIntentRequest.newBuilder().build()) + .setMatch(Match.newBuilder().build()) + .setOutputAudioConfig(OutputAudioConfig.newBuilder().build()) + .build(); client.fulfillIntent(request); Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { - // Expected exception + // Expected exception. } } } diff --git a/google-cloud-dialogflow-cx/src/test/java/com/google/cloud/dialogflow/cx/v3/TransitionRouteGroupsClientTest.java b/google-cloud-dialogflow-cx/src/test/java/com/google/cloud/dialogflow/cx/v3/TransitionRouteGroupsClientTest.java index b5dc2fbf2..f4e632d90 100644 --- a/google-cloud-dialogflow-cx/src/test/java/com/google/cloud/dialogflow/cx/v3/TransitionRouteGroupsClientTest.java +++ b/google-cloud-dialogflow-cx/src/test/java/com/google/cloud/dialogflow/cx/v3/TransitionRouteGroupsClientTest.java @@ -5,7 +5,7 @@ * 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 + * 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, @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.google.cloud.dialogflow.cx.v3; import static com.google.cloud.dialogflow.cx.v3.TransitionRouteGroupsClient.ListTransitionRouteGroupsPagedResponse; @@ -28,12 +29,13 @@ import com.google.protobuf.AbstractMessage; import com.google.protobuf.Empty; import com.google.protobuf.FieldMask; -import io.grpc.Status; import io.grpc.StatusRuntimeException; import java.io.IOException; +import java.util.ArrayList; import java.util.Arrays; import java.util.List; import java.util.UUID; +import javax.annotation.Generated; import org.junit.After; import org.junit.AfterClass; import org.junit.Assert; @@ -41,66 +43,32 @@ import org.junit.BeforeClass; import org.junit.Test; -@javax.annotation.Generated("by GAPIC") +@Generated("by gapic-generator-java") public class TransitionRouteGroupsClientTest { - private static MockPages mockPages; - private static MockFlows mockFlows; - private static MockAgents mockAgents; - private static MockEntityTypes mockEntityTypes; - private static MockEnvironments mockEnvironments; - private static MockIntents mockIntents; - private static MockSecuritySettingsService mockSecuritySettingsService; - private static MockSessionEntityTypes mockSessionEntityTypes; - private static MockSessions mockSessions; private static MockTransitionRouteGroups mockTransitionRouteGroups; - private static MockVersions mockVersions; - private static MockWebhooks mockWebhooks; - private static MockServiceHelper serviceHelper; + private static MockServiceHelper mockServiceHelper; private TransitionRouteGroupsClient client; private LocalChannelProvider channelProvider; @BeforeClass public static void startStaticServer() { - mockPages = new MockPages(); - mockFlows = new MockFlows(); - mockAgents = new MockAgents(); - mockEntityTypes = new MockEntityTypes(); - mockEnvironments = new MockEnvironments(); - mockIntents = new MockIntents(); - mockSecuritySettingsService = new MockSecuritySettingsService(); - mockSessionEntityTypes = new MockSessionEntityTypes(); - mockSessions = new MockSessions(); mockTransitionRouteGroups = new MockTransitionRouteGroups(); - mockVersions = new MockVersions(); - mockWebhooks = new MockWebhooks(); - serviceHelper = + mockServiceHelper = new MockServiceHelper( UUID.randomUUID().toString(), - Arrays.asList( - mockPages, - mockFlows, - mockAgents, - mockEntityTypes, - mockEnvironments, - mockIntents, - mockSecuritySettingsService, - mockSessionEntityTypes, - mockSessions, - mockTransitionRouteGroups, - mockVersions, - mockWebhooks)); - serviceHelper.start(); + Arrays.asList(mockTransitionRouteGroups)); + mockServiceHelper.start(); } @AfterClass public static void stopServer() { - serviceHelper.stop(); + mockServiceHelper.stop(); } @Before public void setUp() throws IOException { - serviceHelper.reset(); - channelProvider = serviceHelper.createChannelProvider(); + mockServiceHelper.reset(); + channelProvider = mockServiceHelper.createChannelProvider(); TransitionRouteGroupsSettings settings = TransitionRouteGroupsSettings.newBuilder() .setTransportChannelProvider(channelProvider) @@ -115,15 +83,12 @@ public void tearDown() throws Exception { } @Test - @SuppressWarnings("all") - public void listTransitionRouteGroupsTest() { - String nextPageToken = ""; - TransitionRouteGroup transitionRouteGroupsElement = TransitionRouteGroup.newBuilder().build(); - List transitionRouteGroups = Arrays.asList(transitionRouteGroupsElement); + public void listTransitionRouteGroupsTest() throws Exception { + TransitionRouteGroup responsesElement = TransitionRouteGroup.newBuilder().build(); ListTransitionRouteGroupsResponse expectedResponse = ListTransitionRouteGroupsResponse.newBuilder() - .setNextPageToken(nextPageToken) - .addAllTransitionRouteGroups(transitionRouteGroups) + .setNextPageToken("") + .addAllTransitionRouteGroups(Arrays.asList(responsesElement)) .build(); mockTransitionRouteGroups.addResponse(expectedResponse); @@ -133,15 +98,16 @@ public void listTransitionRouteGroupsTest() { client.listTransitionRouteGroups(parent); List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + Assert.assertEquals(1, resources.size()); Assert.assertEquals(expectedResponse.getTransitionRouteGroupsList().get(0), resources.get(0)); List actualRequests = mockTransitionRouteGroups.getRequests(); Assert.assertEquals(1, actualRequests.size()); ListTransitionRouteGroupsRequest actualRequest = - (ListTransitionRouteGroupsRequest) actualRequests.get(0); + ((ListTransitionRouteGroupsRequest) actualRequests.get(0)); - Assert.assertEquals(parent, FlowName.parse(actualRequest.getParent())); + Assert.assertEquals(parent.toString(), actualRequest.getParent()); Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), @@ -149,32 +115,75 @@ public void listTransitionRouteGroupsTest() { } @Test - @SuppressWarnings("all") public void listTransitionRouteGroupsExceptionTest() throws Exception { - StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockTransitionRouteGroups.addException(exception); try { FlowName parent = FlowName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]"); + client.listTransitionRouteGroups(parent); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void listTransitionRouteGroupsTest2() throws Exception { + TransitionRouteGroup responsesElement = TransitionRouteGroup.newBuilder().build(); + ListTransitionRouteGroupsResponse expectedResponse = + ListTransitionRouteGroupsResponse.newBuilder() + .setNextPageToken("") + .addAllTransitionRouteGroups(Arrays.asList(responsesElement)) + .build(); + mockTransitionRouteGroups.addResponse(expectedResponse); + + String parent = "parent-995424086"; + + ListTransitionRouteGroupsPagedResponse pagedListResponse = + client.listTransitionRouteGroups(parent); + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getTransitionRouteGroupsList().get(0), resources.get(0)); + + List actualRequests = mockTransitionRouteGroups.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + ListTransitionRouteGroupsRequest actualRequest = + ((ListTransitionRouteGroupsRequest) actualRequests.get(0)); + + Assert.assertEquals(parent, actualRequest.getParent()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void listTransitionRouteGroupsExceptionTest2() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockTransitionRouteGroups.addException(exception); + + try { + String parent = "parent-995424086"; client.listTransitionRouteGroups(parent); Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { - // Expected exception + // Expected exception. } } @Test - @SuppressWarnings("all") - public void getTransitionRouteGroupTest() { - TransitionRouteGroupName name2 = - TransitionRouteGroupName.of( - "[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]", "[TRANSITION_ROUTE_GROUP]"); - String displayName = "displayName1615086568"; + public void getTransitionRouteGroupTest() throws Exception { TransitionRouteGroup expectedResponse = TransitionRouteGroup.newBuilder() - .setName(name2.toString()) - .setDisplayName(displayName) + .setName( + TransitionRouteGroupName.of( + "[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]", "[TRANSITION_ROUTE_GROUP]") + .toString()) + .setDisplayName("displayName1714148973") + .addAllTransitionRoutes(new ArrayList()) .build(); mockTransitionRouteGroups.addResponse(expectedResponse); @@ -188,9 +197,9 @@ public void getTransitionRouteGroupTest() { List actualRequests = mockTransitionRouteGroups.getRequests(); Assert.assertEquals(1, actualRequests.size()); GetTransitionRouteGroupRequest actualRequest = - (GetTransitionRouteGroupRequest) actualRequests.get(0); + ((GetTransitionRouteGroupRequest) actualRequests.get(0)); - Assert.assertEquals(name, TransitionRouteGroupName.parse(actualRequest.getName())); + Assert.assertEquals(name.toString(), actualRequest.getName()); Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), @@ -198,34 +207,75 @@ public void getTransitionRouteGroupTest() { } @Test - @SuppressWarnings("all") public void getTransitionRouteGroupExceptionTest() throws Exception { - StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockTransitionRouteGroups.addException(exception); try { TransitionRouteGroupName name = TransitionRouteGroupName.of( "[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]", "[TRANSITION_ROUTE_GROUP]"); + client.getTransitionRouteGroup(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + @Test + public void getTransitionRouteGroupTest2() throws Exception { + TransitionRouteGroup expectedResponse = + TransitionRouteGroup.newBuilder() + .setName( + TransitionRouteGroupName.of( + "[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]", "[TRANSITION_ROUTE_GROUP]") + .toString()) + .setDisplayName("displayName1714148973") + .addAllTransitionRoutes(new ArrayList()) + .build(); + mockTransitionRouteGroups.addResponse(expectedResponse); + + String name = "name3373707"; + + TransitionRouteGroup actualResponse = client.getTransitionRouteGroup(name); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockTransitionRouteGroups.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + GetTransitionRouteGroupRequest actualRequest = + ((GetTransitionRouteGroupRequest) actualRequests.get(0)); + + Assert.assertEquals(name, actualRequest.getName()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void getTransitionRouteGroupExceptionTest2() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockTransitionRouteGroups.addException(exception); + + try { + String name = "name3373707"; client.getTransitionRouteGroup(name); Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { - // Expected exception + // Expected exception. } } @Test - @SuppressWarnings("all") - public void createTransitionRouteGroupTest() { - TransitionRouteGroupName name = - TransitionRouteGroupName.of( - "[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]", "[TRANSITION_ROUTE_GROUP]"); - String displayName = "displayName1615086568"; + public void createTransitionRouteGroupTest() throws Exception { TransitionRouteGroup expectedResponse = TransitionRouteGroup.newBuilder() - .setName(name.toString()) - .setDisplayName(displayName) + .setName( + TransitionRouteGroupName.of( + "[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]", "[TRANSITION_ROUTE_GROUP]") + .toString()) + .setDisplayName("displayName1714148973") + .addAllTransitionRoutes(new ArrayList()) .build(); mockTransitionRouteGroups.addResponse(expectedResponse); @@ -239,9 +289,9 @@ public void createTransitionRouteGroupTest() { List actualRequests = mockTransitionRouteGroups.getRequests(); Assert.assertEquals(1, actualRequests.size()); CreateTransitionRouteGroupRequest actualRequest = - (CreateTransitionRouteGroupRequest) actualRequests.get(0); + ((CreateTransitionRouteGroupRequest) actualRequests.get(0)); - Assert.assertEquals(parent, FlowName.parse(actualRequest.getParent())); + Assert.assertEquals(parent.toString(), actualRequest.getParent()); Assert.assertEquals(transitionRouteGroup, actualRequest.getTransitionRouteGroup()); Assert.assertTrue( channelProvider.isHeaderSent( @@ -250,33 +300,78 @@ public void createTransitionRouteGroupTest() { } @Test - @SuppressWarnings("all") public void createTransitionRouteGroupExceptionTest() throws Exception { - StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockTransitionRouteGroups.addException(exception); try { FlowName parent = FlowName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]"); TransitionRouteGroup transitionRouteGroup = TransitionRouteGroup.newBuilder().build(); + client.createTransitionRouteGroup(parent, transitionRouteGroup); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void createTransitionRouteGroupTest2() throws Exception { + TransitionRouteGroup expectedResponse = + TransitionRouteGroup.newBuilder() + .setName( + TransitionRouteGroupName.of( + "[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]", "[TRANSITION_ROUTE_GROUP]") + .toString()) + .setDisplayName("displayName1714148973") + .addAllTransitionRoutes(new ArrayList()) + .build(); + mockTransitionRouteGroups.addResponse(expectedResponse); + + String parent = "parent-995424086"; + TransitionRouteGroup transitionRouteGroup = TransitionRouteGroup.newBuilder().build(); + + TransitionRouteGroup actualResponse = + client.createTransitionRouteGroup(parent, transitionRouteGroup); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockTransitionRouteGroups.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + CreateTransitionRouteGroupRequest actualRequest = + ((CreateTransitionRouteGroupRequest) actualRequests.get(0)); + + Assert.assertEquals(parent, actualRequest.getParent()); + Assert.assertEquals(transitionRouteGroup, actualRequest.getTransitionRouteGroup()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void createTransitionRouteGroupExceptionTest2() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockTransitionRouteGroups.addException(exception); + try { + String parent = "parent-995424086"; + TransitionRouteGroup transitionRouteGroup = TransitionRouteGroup.newBuilder().build(); client.createTransitionRouteGroup(parent, transitionRouteGroup); Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { - // Expected exception + // Expected exception. } } @Test - @SuppressWarnings("all") - public void updateTransitionRouteGroupTest() { - TransitionRouteGroupName name = - TransitionRouteGroupName.of( - "[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]", "[TRANSITION_ROUTE_GROUP]"); - String displayName = "displayName1615086568"; + public void updateTransitionRouteGroupTest() throws Exception { TransitionRouteGroup expectedResponse = TransitionRouteGroup.newBuilder() - .setName(name.toString()) - .setDisplayName(displayName) + .setName( + TransitionRouteGroupName.of( + "[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]", "[TRANSITION_ROUTE_GROUP]") + .toString()) + .setDisplayName("displayName1714148973") + .addAllTransitionRoutes(new ArrayList()) .build(); mockTransitionRouteGroups.addResponse(expectedResponse); @@ -290,7 +385,7 @@ public void updateTransitionRouteGroupTest() { List actualRequests = mockTransitionRouteGroups.getRequests(); Assert.assertEquals(1, actualRequests.size()); UpdateTransitionRouteGroupRequest actualRequest = - (UpdateTransitionRouteGroupRequest) actualRequests.get(0); + ((UpdateTransitionRouteGroupRequest) actualRequests.get(0)); Assert.assertEquals(transitionRouteGroup, actualRequest.getTransitionRouteGroup()); Assert.assertEquals(updateMask, actualRequest.getUpdateMask()); @@ -301,25 +396,22 @@ public void updateTransitionRouteGroupTest() { } @Test - @SuppressWarnings("all") public void updateTransitionRouteGroupExceptionTest() throws Exception { - StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockTransitionRouteGroups.addException(exception); try { TransitionRouteGroup transitionRouteGroup = TransitionRouteGroup.newBuilder().build(); FieldMask updateMask = FieldMask.newBuilder().build(); - client.updateTransitionRouteGroup(transitionRouteGroup, updateMask); Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { - // Expected exception + // Expected exception. } } @Test - @SuppressWarnings("all") - public void deleteTransitionRouteGroupTest() { + public void deleteTransitionRouteGroupTest() throws Exception { Empty expectedResponse = Empty.newBuilder().build(); mockTransitionRouteGroups.addResponse(expectedResponse); @@ -332,9 +424,9 @@ public void deleteTransitionRouteGroupTest() { List actualRequests = mockTransitionRouteGroups.getRequests(); Assert.assertEquals(1, actualRequests.size()); DeleteTransitionRouteGroupRequest actualRequest = - (DeleteTransitionRouteGroupRequest) actualRequests.get(0); + ((DeleteTransitionRouteGroupRequest) actualRequests.get(0)); - Assert.assertEquals(name, TransitionRouteGroupName.parse(actualRequest.getName())); + Assert.assertEquals(name.toString(), actualRequest.getName()); Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), @@ -342,20 +434,53 @@ public void deleteTransitionRouteGroupTest() { } @Test - @SuppressWarnings("all") public void deleteTransitionRouteGroupExceptionTest() throws Exception { - StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockTransitionRouteGroups.addException(exception); try { TransitionRouteGroupName name = TransitionRouteGroupName.of( "[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]", "[TRANSITION_ROUTE_GROUP]"); + client.deleteTransitionRouteGroup(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void deleteTransitionRouteGroupTest2() throws Exception { + Empty expectedResponse = Empty.newBuilder().build(); + mockTransitionRouteGroups.addResponse(expectedResponse); + + String name = "name3373707"; + client.deleteTransitionRouteGroup(name); + + List actualRequests = mockTransitionRouteGroups.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + DeleteTransitionRouteGroupRequest actualRequest = + ((DeleteTransitionRouteGroupRequest) actualRequests.get(0)); + + Assert.assertEquals(name, actualRequest.getName()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void deleteTransitionRouteGroupExceptionTest2() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockTransitionRouteGroups.addException(exception); + + try { + String name = "name3373707"; client.deleteTransitionRouteGroup(name); Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { - // Expected exception + // Expected exception. } } } diff --git a/google-cloud-dialogflow-cx/src/test/java/com/google/cloud/dialogflow/cx/v3/VersionsClientTest.java b/google-cloud-dialogflow-cx/src/test/java/com/google/cloud/dialogflow/cx/v3/VersionsClientTest.java index 65a5b85c5..945d3dcd3 100644 --- a/google-cloud-dialogflow-cx/src/test/java/com/google/cloud/dialogflow/cx/v3/VersionsClientTest.java +++ b/google-cloud-dialogflow-cx/src/test/java/com/google/cloud/dialogflow/cx/v3/VersionsClientTest.java @@ -5,7 +5,7 @@ * 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 + * 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, @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.google.cloud.dialogflow.cx.v3; import static com.google.cloud.dialogflow.cx.v3.VersionsClient.ListVersionsPagedResponse; @@ -31,13 +32,14 @@ import com.google.protobuf.Any; import com.google.protobuf.Empty; import com.google.protobuf.FieldMask; -import io.grpc.Status; +import com.google.protobuf.Timestamp; import io.grpc.StatusRuntimeException; import java.io.IOException; import java.util.Arrays; import java.util.List; import java.util.UUID; import java.util.concurrent.ExecutionException; +import javax.annotation.Generated; import org.junit.After; import org.junit.AfterClass; import org.junit.Assert; @@ -45,66 +47,31 @@ import org.junit.BeforeClass; import org.junit.Test; -@javax.annotation.Generated("by GAPIC") +@Generated("by gapic-generator-java") public class VersionsClientTest { - private static MockPages mockPages; - private static MockFlows mockFlows; - private static MockAgents mockAgents; - private static MockEntityTypes mockEntityTypes; - private static MockEnvironments mockEnvironments; - private static MockIntents mockIntents; - private static MockSecuritySettingsService mockSecuritySettingsService; - private static MockSessionEntityTypes mockSessionEntityTypes; - private static MockSessions mockSessions; - private static MockTransitionRouteGroups mockTransitionRouteGroups; private static MockVersions mockVersions; - private static MockWebhooks mockWebhooks; - private static MockServiceHelper serviceHelper; + private static MockServiceHelper mockServiceHelper; private VersionsClient client; private LocalChannelProvider channelProvider; @BeforeClass public static void startStaticServer() { - mockPages = new MockPages(); - mockFlows = new MockFlows(); - mockAgents = new MockAgents(); - mockEntityTypes = new MockEntityTypes(); - mockEnvironments = new MockEnvironments(); - mockIntents = new MockIntents(); - mockSecuritySettingsService = new MockSecuritySettingsService(); - mockSessionEntityTypes = new MockSessionEntityTypes(); - mockSessions = new MockSessions(); - mockTransitionRouteGroups = new MockTransitionRouteGroups(); mockVersions = new MockVersions(); - mockWebhooks = new MockWebhooks(); - serviceHelper = + mockServiceHelper = new MockServiceHelper( - UUID.randomUUID().toString(), - Arrays.asList( - mockPages, - mockFlows, - mockAgents, - mockEntityTypes, - mockEnvironments, - mockIntents, - mockSecuritySettingsService, - mockSessionEntityTypes, - mockSessions, - mockTransitionRouteGroups, - mockVersions, - mockWebhooks)); - serviceHelper.start(); + UUID.randomUUID().toString(), Arrays.asList(mockVersions)); + mockServiceHelper.start(); } @AfterClass public static void stopServer() { - serviceHelper.stop(); + mockServiceHelper.stop(); } @Before public void setUp() throws IOException { - serviceHelper.reset(); - channelProvider = serviceHelper.createChannelProvider(); + mockServiceHelper.reset(); + channelProvider = mockServiceHelper.createChannelProvider(); VersionsSettings settings = VersionsSettings.newBuilder() .setTransportChannelProvider(channelProvider) @@ -119,15 +86,12 @@ public void tearDown() throws Exception { } @Test - @SuppressWarnings("all") - public void listVersionsTest() { - String nextPageToken = ""; - Version versionsElement = Version.newBuilder().build(); - List versions = Arrays.asList(versionsElement); + public void listVersionsTest() throws Exception { + Version responsesElement = Version.newBuilder().build(); ListVersionsResponse expectedResponse = ListVersionsResponse.newBuilder() - .setNextPageToken(nextPageToken) - .addAllVersions(versions) + .setNextPageToken("") + .addAllVersions(Arrays.asList(responsesElement)) .build(); mockVersions.addResponse(expectedResponse); @@ -136,14 +100,15 @@ public void listVersionsTest() { ListVersionsPagedResponse pagedListResponse = client.listVersions(parent); List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + Assert.assertEquals(1, resources.size()); Assert.assertEquals(expectedResponse.getVersionsList().get(0), resources.get(0)); List actualRequests = mockVersions.getRequests(); Assert.assertEquals(1, actualRequests.size()); - ListVersionsRequest actualRequest = (ListVersionsRequest) actualRequests.get(0); + ListVersionsRequest actualRequest = ((ListVersionsRequest) actualRequests.get(0)); - Assert.assertEquals(parent, FlowName.parse(actualRequest.getParent())); + Assert.assertEquals(parent.toString(), actualRequest.getParent()); Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), @@ -151,32 +116,74 @@ public void listVersionsTest() { } @Test - @SuppressWarnings("all") public void listVersionsExceptionTest() throws Exception { - StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockVersions.addException(exception); try { FlowName parent = FlowName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]"); + client.listVersions(parent); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void listVersionsTest2() throws Exception { + Version responsesElement = Version.newBuilder().build(); + ListVersionsResponse expectedResponse = + ListVersionsResponse.newBuilder() + .setNextPageToken("") + .addAllVersions(Arrays.asList(responsesElement)) + .build(); + mockVersions.addResponse(expectedResponse); + + String parent = "parent-995424086"; + + ListVersionsPagedResponse pagedListResponse = client.listVersions(parent); + + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getVersionsList().get(0), resources.get(0)); + List actualRequests = mockVersions.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + ListVersionsRequest actualRequest = ((ListVersionsRequest) actualRequests.get(0)); + + Assert.assertEquals(parent, actualRequest.getParent()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void listVersionsExceptionTest2() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockVersions.addException(exception); + + try { + String parent = "parent-995424086"; client.listVersions(parent); Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { - // Expected exception + // Expected exception. } } @Test - @SuppressWarnings("all") - public void getVersionTest() { - VersionName name2 = VersionName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]", "[VERSION]"); - String displayName = "displayName1615086568"; - String description = "description-1724546052"; + public void getVersionTest() throws Exception { Version expectedResponse = Version.newBuilder() - .setName(name2.toString()) - .setDisplayName(displayName) - .setDescription(description) + .setName( + VersionName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]", "[VERSION]") + .toString()) + .setDisplayName("displayName1714148973") + .setDescription("description-1724546052") + .setNluSettings(NluSettings.newBuilder().build()) + .setCreateTime(Timestamp.newBuilder().build()) .build(); mockVersions.addResponse(expectedResponse); @@ -187,9 +194,9 @@ public void getVersionTest() { List actualRequests = mockVersions.getRequests(); Assert.assertEquals(1, actualRequests.size()); - GetVersionRequest actualRequest = (GetVersionRequest) actualRequests.get(0); + GetVersionRequest actualRequest = ((GetVersionRequest) actualRequests.get(0)); - Assert.assertEquals(name, VersionName.parse(actualRequest.getName())); + Assert.assertEquals(name.toString(), actualRequest.getName()); Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), @@ -197,33 +204,75 @@ public void getVersionTest() { } @Test - @SuppressWarnings("all") public void getVersionExceptionTest() throws Exception { - StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockVersions.addException(exception); try { VersionName name = VersionName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]", "[VERSION]"); + client.getVersion(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + @Test + public void getVersionTest2() throws Exception { + Version expectedResponse = + Version.newBuilder() + .setName( + VersionName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]", "[VERSION]") + .toString()) + .setDisplayName("displayName1714148973") + .setDescription("description-1724546052") + .setNluSettings(NluSettings.newBuilder().build()) + .setCreateTime(Timestamp.newBuilder().build()) + .build(); + mockVersions.addResponse(expectedResponse); + + String name = "name3373707"; + + Version actualResponse = client.getVersion(name); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockVersions.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + GetVersionRequest actualRequest = ((GetVersionRequest) actualRequests.get(0)); + + Assert.assertEquals(name, actualRequest.getName()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void getVersionExceptionTest2() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockVersions.addException(exception); + + try { + String name = "name3373707"; client.getVersion(name); Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { - // Expected exception + // Expected exception. } } @Test - @SuppressWarnings("all") public void createVersionTest() throws Exception { - VersionName name = VersionName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]", "[VERSION]"); - String displayName = "displayName1615086568"; - String description = "description-1724546052"; Version expectedResponse = Version.newBuilder() - .setName(name.toString()) - .setDisplayName(displayName) - .setDescription(description) + .setName( + VersionName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]", "[VERSION]") + .toString()) + .setDisplayName("displayName1714148973") + .setDescription("description-1724546052") + .setNluSettings(NluSettings.newBuilder().build()) + .setCreateTime(Timestamp.newBuilder().build()) .build(); Operation resultOperation = Operation.newBuilder() @@ -241,9 +290,9 @@ public void createVersionTest() throws Exception { List actualRequests = mockVersions.getRequests(); Assert.assertEquals(1, actualRequests.size()); - CreateVersionRequest actualRequest = (CreateVersionRequest) actualRequests.get(0); + CreateVersionRequest actualRequest = ((CreateVersionRequest) actualRequests.get(0)); - Assert.assertEquals(parent, FlowName.parse(actualRequest.getParent())); + Assert.assertEquals(parent.toString(), actualRequest.getParent()); Assert.assertEquals(version, actualRequest.getVersion()); Assert.assertTrue( channelProvider.isHeaderSent( @@ -252,35 +301,88 @@ public void createVersionTest() throws Exception { } @Test - @SuppressWarnings("all") public void createVersionExceptionTest() throws Exception { - StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockVersions.addException(exception); try { FlowName parent = FlowName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]"); Version version = Version.newBuilder().build(); + client.createVersionAsync(parent, version).get(); + Assert.fail("No exception raised"); + } catch (ExecutionException e) { + Assert.assertEquals(InvalidArgumentException.class, e.getCause().getClass()); + InvalidArgumentException apiException = ((InvalidArgumentException) e.getCause()); + Assert.assertEquals(StatusCode.Code.INVALID_ARGUMENT, apiException.getStatusCode().getCode()); + } + } + + @Test + public void createVersionTest2() throws Exception { + Version expectedResponse = + Version.newBuilder() + .setName( + VersionName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]", "[VERSION]") + .toString()) + .setDisplayName("displayName1714148973") + .setDescription("description-1724546052") + .setNluSettings(NluSettings.newBuilder().build()) + .setCreateTime(Timestamp.newBuilder().build()) + .build(); + Operation resultOperation = + Operation.newBuilder() + .setName("createVersionTest") + .setDone(true) + .setResponse(Any.pack(expectedResponse)) + .build(); + mockVersions.addResponse(resultOperation); + + String parent = "parent-995424086"; + Version version = Version.newBuilder().build(); + + Version actualResponse = client.createVersionAsync(parent, version).get(); + Assert.assertEquals(expectedResponse, actualResponse); + List actualRequests = mockVersions.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + CreateVersionRequest actualRequest = ((CreateVersionRequest) actualRequests.get(0)); + + Assert.assertEquals(parent, actualRequest.getParent()); + Assert.assertEquals(version, actualRequest.getVersion()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void createVersionExceptionTest2() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockVersions.addException(exception); + + try { + String parent = "parent-995424086"; + Version version = Version.newBuilder().build(); client.createVersionAsync(parent, version).get(); Assert.fail("No exception raised"); } catch (ExecutionException e) { Assert.assertEquals(InvalidArgumentException.class, e.getCause().getClass()); - InvalidArgumentException apiException = (InvalidArgumentException) e.getCause(); + InvalidArgumentException apiException = ((InvalidArgumentException) e.getCause()); Assert.assertEquals(StatusCode.Code.INVALID_ARGUMENT, apiException.getStatusCode().getCode()); } } @Test - @SuppressWarnings("all") - public void updateVersionTest() { - VersionName name = VersionName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]", "[VERSION]"); - String displayName = "displayName1615086568"; - String description = "description-1724546052"; + public void updateVersionTest() throws Exception { Version expectedResponse = Version.newBuilder() - .setName(name.toString()) - .setDisplayName(displayName) - .setDescription(description) + .setName( + VersionName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]", "[VERSION]") + .toString()) + .setDisplayName("displayName1714148973") + .setDescription("description-1724546052") + .setNluSettings(NluSettings.newBuilder().build()) + .setCreateTime(Timestamp.newBuilder().build()) .build(); mockVersions.addResponse(expectedResponse); @@ -292,7 +394,7 @@ public void updateVersionTest() { List actualRequests = mockVersions.getRequests(); Assert.assertEquals(1, actualRequests.size()); - UpdateVersionRequest actualRequest = (UpdateVersionRequest) actualRequests.get(0); + UpdateVersionRequest actualRequest = ((UpdateVersionRequest) actualRequests.get(0)); Assert.assertEquals(version, actualRequest.getVersion()); Assert.assertEquals(updateMask, actualRequest.getUpdateMask()); @@ -303,25 +405,22 @@ public void updateVersionTest() { } @Test - @SuppressWarnings("all") public void updateVersionExceptionTest() throws Exception { - StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockVersions.addException(exception); try { Version version = Version.newBuilder().build(); FieldMask updateMask = FieldMask.newBuilder().build(); - client.updateVersion(version, updateMask); Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { - // Expected exception + // Expected exception. } } @Test - @SuppressWarnings("all") - public void deleteVersionTest() { + public void deleteVersionTest() throws Exception { Empty expectedResponse = Empty.newBuilder().build(); mockVersions.addResponse(expectedResponse); @@ -331,9 +430,9 @@ public void deleteVersionTest() { List actualRequests = mockVersions.getRequests(); Assert.assertEquals(1, actualRequests.size()); - DeleteVersionRequest actualRequest = (DeleteVersionRequest) actualRequests.get(0); + DeleteVersionRequest actualRequest = ((DeleteVersionRequest) actualRequests.get(0)); - Assert.assertEquals(name, VersionName.parse(actualRequest.getName())); + Assert.assertEquals(name.toString(), actualRequest.getName()); Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), @@ -341,24 +440,55 @@ public void deleteVersionTest() { } @Test - @SuppressWarnings("all") public void deleteVersionExceptionTest() throws Exception { - StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockVersions.addException(exception); try { VersionName name = VersionName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]", "[VERSION]"); + client.deleteVersion(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void deleteVersionTest2() throws Exception { + Empty expectedResponse = Empty.newBuilder().build(); + mockVersions.addResponse(expectedResponse); + + String name = "name3373707"; + + client.deleteVersion(name); + + List actualRequests = mockVersions.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + DeleteVersionRequest actualRequest = ((DeleteVersionRequest) actualRequests.get(0)); + Assert.assertEquals(name, actualRequest.getName()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void deleteVersionExceptionTest2() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockVersions.addException(exception); + + try { + String name = "name3373707"; client.deleteVersion(name); Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { - // Expected exception + // Expected exception. } } @Test - @SuppressWarnings("all") public void loadVersionTest() throws Exception { Empty expectedResponse = Empty.newBuilder().build(); Operation resultOperation = @@ -371,14 +501,13 @@ public void loadVersionTest() throws Exception { VersionName name = VersionName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]", "[VERSION]"); - Empty actualResponse = client.loadVersionAsync(name).get(); - Assert.assertEquals(expectedResponse, actualResponse); + client.loadVersionAsync(name).get(); List actualRequests = mockVersions.getRequests(); Assert.assertEquals(1, actualRequests.size()); - LoadVersionRequest actualRequest = (LoadVersionRequest) actualRequests.get(0); + LoadVersionRequest actualRequest = ((LoadVersionRequest) actualRequests.get(0)); - Assert.assertEquals(name, VersionName.parse(actualRequest.getName())); + Assert.assertEquals(name.toString(), actualRequest.getName()); Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), @@ -386,20 +515,60 @@ public void loadVersionTest() throws Exception { } @Test - @SuppressWarnings("all") public void loadVersionExceptionTest() throws Exception { - StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockVersions.addException(exception); try { VersionName name = VersionName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]", "[VERSION]"); + client.loadVersionAsync(name).get(); + Assert.fail("No exception raised"); + } catch (ExecutionException e) { + Assert.assertEquals(InvalidArgumentException.class, e.getCause().getClass()); + InvalidArgumentException apiException = ((InvalidArgumentException) e.getCause()); + Assert.assertEquals(StatusCode.Code.INVALID_ARGUMENT, apiException.getStatusCode().getCode()); + } + } + + @Test + public void loadVersionTest2() throws Exception { + Empty expectedResponse = Empty.newBuilder().build(); + Operation resultOperation = + Operation.newBuilder() + .setName("loadVersionTest") + .setDone(true) + .setResponse(Any.pack(expectedResponse)) + .build(); + mockVersions.addResponse(resultOperation); + + String name = "name3373707"; + + client.loadVersionAsync(name).get(); + + List actualRequests = mockVersions.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + LoadVersionRequest actualRequest = ((LoadVersionRequest) actualRequests.get(0)); + Assert.assertEquals(name, actualRequest.getName()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void loadVersionExceptionTest2() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockVersions.addException(exception); + + try { + String name = "name3373707"; client.loadVersionAsync(name).get(); Assert.fail("No exception raised"); } catch (ExecutionException e) { Assert.assertEquals(InvalidArgumentException.class, e.getCause().getClass()); - InvalidArgumentException apiException = (InvalidArgumentException) e.getCause(); + InvalidArgumentException apiException = ((InvalidArgumentException) e.getCause()); Assert.assertEquals(StatusCode.Code.INVALID_ARGUMENT, apiException.getStatusCode().getCode()); } } diff --git a/google-cloud-dialogflow-cx/src/test/java/com/google/cloud/dialogflow/cx/v3/WebhooksClientTest.java b/google-cloud-dialogflow-cx/src/test/java/com/google/cloud/dialogflow/cx/v3/WebhooksClientTest.java index ea3cd9ad4..87cd03d0d 100644 --- a/google-cloud-dialogflow-cx/src/test/java/com/google/cloud/dialogflow/cx/v3/WebhooksClientTest.java +++ b/google-cloud-dialogflow-cx/src/test/java/com/google/cloud/dialogflow/cx/v3/WebhooksClientTest.java @@ -5,7 +5,7 @@ * 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 + * 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, @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.google.cloud.dialogflow.cx.v3; import static com.google.cloud.dialogflow.cx.v3.WebhooksClient.ListWebhooksPagedResponse; @@ -26,14 +27,15 @@ import com.google.api.gax.rpc.InvalidArgumentException; import com.google.common.collect.Lists; import com.google.protobuf.AbstractMessage; +import com.google.protobuf.Duration; import com.google.protobuf.Empty; import com.google.protobuf.FieldMask; -import io.grpc.Status; import io.grpc.StatusRuntimeException; import java.io.IOException; import java.util.Arrays; import java.util.List; import java.util.UUID; +import javax.annotation.Generated; import org.junit.After; import org.junit.AfterClass; import org.junit.Assert; @@ -41,66 +43,31 @@ import org.junit.BeforeClass; import org.junit.Test; -@javax.annotation.Generated("by GAPIC") +@Generated("by gapic-generator-java") public class WebhooksClientTest { - private static MockPages mockPages; - private static MockFlows mockFlows; - private static MockAgents mockAgents; - private static MockEntityTypes mockEntityTypes; - private static MockEnvironments mockEnvironments; - private static MockIntents mockIntents; - private static MockSecuritySettingsService mockSecuritySettingsService; - private static MockSessionEntityTypes mockSessionEntityTypes; - private static MockSessions mockSessions; - private static MockTransitionRouteGroups mockTransitionRouteGroups; - private static MockVersions mockVersions; private static MockWebhooks mockWebhooks; - private static MockServiceHelper serviceHelper; + private static MockServiceHelper mockServiceHelper; private WebhooksClient client; private LocalChannelProvider channelProvider; @BeforeClass public static void startStaticServer() { - mockPages = new MockPages(); - mockFlows = new MockFlows(); - mockAgents = new MockAgents(); - mockEntityTypes = new MockEntityTypes(); - mockEnvironments = new MockEnvironments(); - mockIntents = new MockIntents(); - mockSecuritySettingsService = new MockSecuritySettingsService(); - mockSessionEntityTypes = new MockSessionEntityTypes(); - mockSessions = new MockSessions(); - mockTransitionRouteGroups = new MockTransitionRouteGroups(); - mockVersions = new MockVersions(); mockWebhooks = new MockWebhooks(); - serviceHelper = + mockServiceHelper = new MockServiceHelper( - UUID.randomUUID().toString(), - Arrays.asList( - mockPages, - mockFlows, - mockAgents, - mockEntityTypes, - mockEnvironments, - mockIntents, - mockSecuritySettingsService, - mockSessionEntityTypes, - mockSessions, - mockTransitionRouteGroups, - mockVersions, - mockWebhooks)); - serviceHelper.start(); + UUID.randomUUID().toString(), Arrays.asList(mockWebhooks)); + mockServiceHelper.start(); } @AfterClass public static void stopServer() { - serviceHelper.stop(); + mockServiceHelper.stop(); } @Before public void setUp() throws IOException { - serviceHelper.reset(); - channelProvider = serviceHelper.createChannelProvider(); + mockServiceHelper.reset(); + channelProvider = mockServiceHelper.createChannelProvider(); WebhooksSettings settings = WebhooksSettings.newBuilder() .setTransportChannelProvider(channelProvider) @@ -115,15 +82,12 @@ public void tearDown() throws Exception { } @Test - @SuppressWarnings("all") - public void listWebhooksTest() { - String nextPageToken = ""; - Webhook webhooksElement = Webhook.newBuilder().build(); - List webhooks = Arrays.asList(webhooksElement); + public void listWebhooksTest() throws Exception { + Webhook responsesElement = Webhook.newBuilder().build(); ListWebhooksResponse expectedResponse = ListWebhooksResponse.newBuilder() - .setNextPageToken(nextPageToken) - .addAllWebhooks(webhooks) + .setNextPageToken("") + .addAllWebhooks(Arrays.asList(responsesElement)) .build(); mockWebhooks.addResponse(expectedResponse); @@ -132,14 +96,15 @@ public void listWebhooksTest() { ListWebhooksPagedResponse pagedListResponse = client.listWebhooks(parent); List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + Assert.assertEquals(1, resources.size()); Assert.assertEquals(expectedResponse.getWebhooksList().get(0), resources.get(0)); List actualRequests = mockWebhooks.getRequests(); Assert.assertEquals(1, actualRequests.size()); - ListWebhooksRequest actualRequest = (ListWebhooksRequest) actualRequests.get(0); + ListWebhooksRequest actualRequest = ((ListWebhooksRequest) actualRequests.get(0)); - Assert.assertEquals(parent, AgentName.parse(actualRequest.getParent())); + Assert.assertEquals(parent.toString(), actualRequest.getParent()); Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), @@ -147,32 +112,71 @@ public void listWebhooksTest() { } @Test - @SuppressWarnings("all") public void listWebhooksExceptionTest() throws Exception { - StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockWebhooks.addException(exception); try { AgentName parent = AgentName.of("[PROJECT]", "[LOCATION]", "[AGENT]"); + client.listWebhooks(parent); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void listWebhooksTest2() throws Exception { + Webhook responsesElement = Webhook.newBuilder().build(); + ListWebhooksResponse expectedResponse = + ListWebhooksResponse.newBuilder() + .setNextPageToken("") + .addAllWebhooks(Arrays.asList(responsesElement)) + .build(); + mockWebhooks.addResponse(expectedResponse); + + String parent = "parent-995424086"; + + ListWebhooksPagedResponse pagedListResponse = client.listWebhooks(parent); + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getWebhooksList().get(0), resources.get(0)); + + List actualRequests = mockWebhooks.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + ListWebhooksRequest actualRequest = ((ListWebhooksRequest) actualRequests.get(0)); + + Assert.assertEquals(parent, actualRequest.getParent()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void listWebhooksExceptionTest2() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockWebhooks.addException(exception); + + try { + String parent = "parent-995424086"; client.listWebhooks(parent); Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { - // Expected exception + // Expected exception. } } @Test - @SuppressWarnings("all") - public void getWebhookTest() { - WebhookName name2 = WebhookName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[WEBHOOK]"); - String displayName = "displayName1615086568"; - boolean disabled = true; + public void getWebhookTest() throws Exception { Webhook expectedResponse = Webhook.newBuilder() - .setName(name2.toString()) - .setDisplayName(displayName) - .setDisabled(disabled) + .setName(WebhookName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[WEBHOOK]").toString()) + .setDisplayName("displayName1714148973") + .setTimeout(Duration.newBuilder().build()) + .setDisabled(true) .build(); mockWebhooks.addResponse(expectedResponse); @@ -183,9 +187,9 @@ public void getWebhookTest() { List actualRequests = mockWebhooks.getRequests(); Assert.assertEquals(1, actualRequests.size()); - GetWebhookRequest actualRequest = (GetWebhookRequest) actualRequests.get(0); + GetWebhookRequest actualRequest = ((GetWebhookRequest) actualRequests.get(0)); - Assert.assertEquals(name, WebhookName.parse(actualRequest.getName())); + Assert.assertEquals(name.toString(), actualRequest.getName()); Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), @@ -193,32 +197,68 @@ public void getWebhookTest() { } @Test - @SuppressWarnings("all") public void getWebhookExceptionTest() throws Exception { - StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockWebhooks.addException(exception); try { WebhookName name = WebhookName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[WEBHOOK]"); + client.getWebhook(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void getWebhookTest2() throws Exception { + Webhook expectedResponse = + Webhook.newBuilder() + .setName(WebhookName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[WEBHOOK]").toString()) + .setDisplayName("displayName1714148973") + .setTimeout(Duration.newBuilder().build()) + .setDisabled(true) + .build(); + mockWebhooks.addResponse(expectedResponse); + + String name = "name3373707"; + + Webhook actualResponse = client.getWebhook(name); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockWebhooks.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + GetWebhookRequest actualRequest = ((GetWebhookRequest) actualRequests.get(0)); + + Assert.assertEquals(name, actualRequest.getName()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void getWebhookExceptionTest2() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockWebhooks.addException(exception); + try { + String name = "name3373707"; client.getWebhook(name); Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { - // Expected exception + // Expected exception. } } @Test - @SuppressWarnings("all") - public void createWebhookTest() { - WebhookName name = WebhookName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[WEBHOOK]"); - String displayName = "displayName1615086568"; - boolean disabled = true; + public void createWebhookTest() throws Exception { Webhook expectedResponse = Webhook.newBuilder() - .setName(name.toString()) - .setDisplayName(displayName) - .setDisabled(disabled) + .setName(WebhookName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[WEBHOOK]").toString()) + .setDisplayName("displayName1714148973") + .setTimeout(Duration.newBuilder().build()) + .setDisabled(true) .build(); mockWebhooks.addResponse(expectedResponse); @@ -230,9 +270,9 @@ public void createWebhookTest() { List actualRequests = mockWebhooks.getRequests(); Assert.assertEquals(1, actualRequests.size()); - CreateWebhookRequest actualRequest = (CreateWebhookRequest) actualRequests.get(0); + CreateWebhookRequest actualRequest = ((CreateWebhookRequest) actualRequests.get(0)); - Assert.assertEquals(parent, AgentName.parse(actualRequest.getParent())); + Assert.assertEquals(parent.toString(), actualRequest.getParent()); Assert.assertEquals(webhook, actualRequest.getWebhook()); Assert.assertTrue( channelProvider.isHeaderSent( @@ -241,33 +281,72 @@ public void createWebhookTest() { } @Test - @SuppressWarnings("all") public void createWebhookExceptionTest() throws Exception { - StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockWebhooks.addException(exception); try { AgentName parent = AgentName.of("[PROJECT]", "[LOCATION]", "[AGENT]"); Webhook webhook = Webhook.newBuilder().build(); + client.createWebhook(parent, webhook); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void createWebhookTest2() throws Exception { + Webhook expectedResponse = + Webhook.newBuilder() + .setName(WebhookName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[WEBHOOK]").toString()) + .setDisplayName("displayName1714148973") + .setTimeout(Duration.newBuilder().build()) + .setDisabled(true) + .build(); + mockWebhooks.addResponse(expectedResponse); + + String parent = "parent-995424086"; + Webhook webhook = Webhook.newBuilder().build(); + + Webhook actualResponse = client.createWebhook(parent, webhook); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockWebhooks.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + CreateWebhookRequest actualRequest = ((CreateWebhookRequest) actualRequests.get(0)); + + Assert.assertEquals(parent, actualRequest.getParent()); + Assert.assertEquals(webhook, actualRequest.getWebhook()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void createWebhookExceptionTest2() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockWebhooks.addException(exception); + try { + String parent = "parent-995424086"; + Webhook webhook = Webhook.newBuilder().build(); client.createWebhook(parent, webhook); Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { - // Expected exception + // Expected exception. } } @Test - @SuppressWarnings("all") - public void updateWebhookTest() { - WebhookName name = WebhookName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[WEBHOOK]"); - String displayName = "displayName1615086568"; - boolean disabled = true; + public void updateWebhookTest() throws Exception { Webhook expectedResponse = Webhook.newBuilder() - .setName(name.toString()) - .setDisplayName(displayName) - .setDisabled(disabled) + .setName(WebhookName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[WEBHOOK]").toString()) + .setDisplayName("displayName1714148973") + .setTimeout(Duration.newBuilder().build()) + .setDisabled(true) .build(); mockWebhooks.addResponse(expectedResponse); @@ -279,7 +358,7 @@ public void updateWebhookTest() { List actualRequests = mockWebhooks.getRequests(); Assert.assertEquals(1, actualRequests.size()); - UpdateWebhookRequest actualRequest = (UpdateWebhookRequest) actualRequests.get(0); + UpdateWebhookRequest actualRequest = ((UpdateWebhookRequest) actualRequests.get(0)); Assert.assertEquals(webhook, actualRequest.getWebhook()); Assert.assertEquals(updateMask, actualRequest.getUpdateMask()); @@ -290,25 +369,22 @@ public void updateWebhookTest() { } @Test - @SuppressWarnings("all") public void updateWebhookExceptionTest() throws Exception { - StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockWebhooks.addException(exception); try { Webhook webhook = Webhook.newBuilder().build(); FieldMask updateMask = FieldMask.newBuilder().build(); - client.updateWebhook(webhook, updateMask); Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { - // Expected exception + // Expected exception. } } @Test - @SuppressWarnings("all") - public void deleteWebhookTest() { + public void deleteWebhookTest() throws Exception { Empty expectedResponse = Empty.newBuilder().build(); mockWebhooks.addResponse(expectedResponse); @@ -318,9 +394,9 @@ public void deleteWebhookTest() { List actualRequests = mockWebhooks.getRequests(); Assert.assertEquals(1, actualRequests.size()); - DeleteWebhookRequest actualRequest = (DeleteWebhookRequest) actualRequests.get(0); + DeleteWebhookRequest actualRequest = ((DeleteWebhookRequest) actualRequests.get(0)); - Assert.assertEquals(name, WebhookName.parse(actualRequest.getName())); + Assert.assertEquals(name.toString(), actualRequest.getName()); Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), @@ -328,18 +404,50 @@ public void deleteWebhookTest() { } @Test - @SuppressWarnings("all") public void deleteWebhookExceptionTest() throws Exception { - StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockWebhooks.addException(exception); try { WebhookName name = WebhookName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[WEBHOOK]"); + client.deleteWebhook(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void deleteWebhookTest2() throws Exception { + Empty expectedResponse = Empty.newBuilder().build(); + mockWebhooks.addResponse(expectedResponse); + + String name = "name3373707"; + client.deleteWebhook(name); + + List actualRequests = mockWebhooks.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + DeleteWebhookRequest actualRequest = ((DeleteWebhookRequest) actualRequests.get(0)); + + Assert.assertEquals(name, actualRequest.getName()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void deleteWebhookExceptionTest2() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockWebhooks.addException(exception); + + try { + String name = "name3373707"; client.deleteWebhook(name); Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { - // Expected exception + // Expected exception. } } } diff --git a/google-cloud-dialogflow-cx/src/test/java/com/google/cloud/dialogflow/cx/v3beta1/AgentsClientTest.java b/google-cloud-dialogflow-cx/src/test/java/com/google/cloud/dialogflow/cx/v3beta1/AgentsClientTest.java index fca8adb89..66d6dc0dd 100644 --- a/google-cloud-dialogflow-cx/src/test/java/com/google/cloud/dialogflow/cx/v3beta1/AgentsClientTest.java +++ b/google-cloud-dialogflow-cx/src/test/java/com/google/cloud/dialogflow/cx/v3beta1/AgentsClientTest.java @@ -5,7 +5,7 @@ * 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 + * 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, @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.google.cloud.dialogflow.cx.v3beta1; import static com.google.cloud.dialogflow.cx.v3beta1.AgentsClient.ListAgentsPagedResponse; @@ -31,13 +32,13 @@ import com.google.protobuf.Any; import com.google.protobuf.Empty; import com.google.protobuf.FieldMask; -import io.grpc.Status; import io.grpc.StatusRuntimeException; import java.io.IOException; import java.util.Arrays; import java.util.List; import java.util.UUID; import java.util.concurrent.ExecutionException; +import javax.annotation.Generated; import org.junit.After; import org.junit.AfterClass; import org.junit.Assert; @@ -45,63 +46,31 @@ import org.junit.BeforeClass; import org.junit.Test; -@javax.annotation.Generated("by GAPIC") +@Generated("by gapic-generator-java") public class AgentsClientTest { - private static MockPages mockPages; - private static MockFlows mockFlows; - private static MockAgents mockAgents; - private static MockEntityTypes mockEntityTypes; - private static MockEnvironments mockEnvironments; - private static MockIntents mockIntents; - private static MockSessionEntityTypes mockSessionEntityTypes; - private static MockSessions mockSessions; - private static MockTransitionRouteGroups mockTransitionRouteGroups; - private static MockVersions mockVersions; - private static MockWebhooks mockWebhooks; - private static MockServiceHelper serviceHelper; + private static MockServiceHelper mockServiceHelper; private AgentsClient client; + private static MockAgents mockAgents; private LocalChannelProvider channelProvider; @BeforeClass public static void startStaticServer() { - mockPages = new MockPages(); - mockFlows = new MockFlows(); mockAgents = new MockAgents(); - mockEntityTypes = new MockEntityTypes(); - mockEnvironments = new MockEnvironments(); - mockIntents = new MockIntents(); - mockSessionEntityTypes = new MockSessionEntityTypes(); - mockSessions = new MockSessions(); - mockTransitionRouteGroups = new MockTransitionRouteGroups(); - mockVersions = new MockVersions(); - mockWebhooks = new MockWebhooks(); - serviceHelper = + mockServiceHelper = new MockServiceHelper( - UUID.randomUUID().toString(), - Arrays.asList( - mockPages, - mockFlows, - mockAgents, - mockEntityTypes, - mockEnvironments, - mockIntents, - mockSessionEntityTypes, - mockSessions, - mockTransitionRouteGroups, - mockVersions, - mockWebhooks)); - serviceHelper.start(); + UUID.randomUUID().toString(), Arrays.asList(mockAgents)); + mockServiceHelper.start(); } @AfterClass public static void stopServer() { - serviceHelper.stop(); + mockServiceHelper.stop(); } @Before public void setUp() throws IOException { - serviceHelper.reset(); - channelProvider = serviceHelper.createChannelProvider(); + mockServiceHelper.reset(); + channelProvider = mockServiceHelper.createChannelProvider(); AgentsSettings settings = AgentsSettings.newBuilder() .setTransportChannelProvider(channelProvider) @@ -116,15 +85,12 @@ public void tearDown() throws Exception { } @Test - @SuppressWarnings("all") - public void listAgentsTest() { - String nextPageToken = ""; - Agent agentsElement = Agent.newBuilder().build(); - List agents = Arrays.asList(agentsElement); + public void listAgentsTest() throws Exception { + Agent responsesElement = Agent.newBuilder().build(); ListAgentsResponse expectedResponse = ListAgentsResponse.newBuilder() - .setNextPageToken(nextPageToken) - .addAllAgents(agents) + .setNextPageToken("") + .addAllAgents(Arrays.asList(responsesElement)) .build(); mockAgents.addResponse(expectedResponse); @@ -133,14 +99,15 @@ public void listAgentsTest() { ListAgentsPagedResponse pagedListResponse = client.listAgents(parent); List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + Assert.assertEquals(1, resources.size()); Assert.assertEquals(expectedResponse.getAgentsList().get(0), resources.get(0)); List actualRequests = mockAgents.getRequests(); Assert.assertEquals(1, actualRequests.size()); - ListAgentsRequest actualRequest = (ListAgentsRequest) actualRequests.get(0); + ListAgentsRequest actualRequest = ((ListAgentsRequest) actualRequests.get(0)); - Assert.assertEquals(parent, LocationName.parse(actualRequest.getParent())); + Assert.assertEquals(parent.toString(), actualRequest.getParent()); Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), @@ -148,44 +115,77 @@ public void listAgentsTest() { } @Test - @SuppressWarnings("all") public void listAgentsExceptionTest() throws Exception { - StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockAgents.addException(exception); try { LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); + client.listAgents(parent); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void listAgentsTest2() throws Exception { + Agent responsesElement = Agent.newBuilder().build(); + ListAgentsResponse expectedResponse = + ListAgentsResponse.newBuilder() + .setNextPageToken("") + .addAllAgents(Arrays.asList(responsesElement)) + .build(); + mockAgents.addResponse(expectedResponse); + + String parent = "parent-995424086"; + + ListAgentsPagedResponse pagedListResponse = client.listAgents(parent); + + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getAgentsList().get(0), resources.get(0)); + + List actualRequests = mockAgents.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + ListAgentsRequest actualRequest = ((ListAgentsRequest) actualRequests.get(0)); + + Assert.assertEquals(parent, actualRequest.getParent()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void listAgentsExceptionTest2() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockAgents.addException(exception); + try { + String parent = "parent-995424086"; client.listAgents(parent); Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { - // Expected exception + // Expected exception. } } @Test - @SuppressWarnings("all") - public void getAgentTest() { - AgentName name2 = AgentName.of("[PROJECT]", "[LOCATION]", "[AGENT]"); - String displayName = "displayName1615086568"; - String defaultLanguageCode = "defaultLanguageCode856575222"; - String timeZone = "timeZone36848094"; - String description = "description-1724546052"; - String avatarUri = "avatarUri-402824826"; - FlowName startFlow = FlowName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]"); - boolean enableStackdriverLogging = true; - boolean enableSpellCorrection = false; + public void getAgentTest() throws Exception { Agent expectedResponse = Agent.newBuilder() - .setName(name2.toString()) - .setDisplayName(displayName) - .setDefaultLanguageCode(defaultLanguageCode) - .setTimeZone(timeZone) - .setDescription(description) - .setAvatarUri(avatarUri) - .setStartFlow(startFlow.toString()) - .setEnableStackdriverLogging(enableStackdriverLogging) - .setEnableSpellCorrection(enableSpellCorrection) + .setName(AgentName.of("[PROJECT]", "[LOCATION]", "[AGENT]").toString()) + .setDisplayName("displayName1714148973") + .setDefaultLanguageCode("defaultLanguageCode2069633606") + .setTimeZone("timeZone-2077180903") + .setDescription("description-1724546052") + .setAvatarUri("avatarUri-428646061") + .setSpeechToTextSettings(SpeechToTextSettings.newBuilder().build()) + .setStartFlow(FlowName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]").toString()) + .setEnableStackdriverLogging(true) + .setEnableSpellCorrection(true) .build(); mockAgents.addResponse(expectedResponse); @@ -196,9 +196,9 @@ public void getAgentTest() { List actualRequests = mockAgents.getRequests(); Assert.assertEquals(1, actualRequests.size()); - GetAgentRequest actualRequest = (GetAgentRequest) actualRequests.get(0); + GetAgentRequest actualRequest = ((GetAgentRequest) actualRequests.get(0)); - Assert.assertEquals(name, AgentName.parse(actualRequest.getName())); + Assert.assertEquals(name.toString(), actualRequest.getName()); Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), @@ -206,44 +206,80 @@ public void getAgentTest() { } @Test - @SuppressWarnings("all") public void getAgentExceptionTest() throws Exception { - StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockAgents.addException(exception); try { AgentName name = AgentName.of("[PROJECT]", "[LOCATION]", "[AGENT]"); + client.getAgent(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + @Test + public void getAgentTest2() throws Exception { + Agent expectedResponse = + Agent.newBuilder() + .setName(AgentName.of("[PROJECT]", "[LOCATION]", "[AGENT]").toString()) + .setDisplayName("displayName1714148973") + .setDefaultLanguageCode("defaultLanguageCode2069633606") + .setTimeZone("timeZone-2077180903") + .setDescription("description-1724546052") + .setAvatarUri("avatarUri-428646061") + .setSpeechToTextSettings(SpeechToTextSettings.newBuilder().build()) + .setStartFlow(FlowName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]").toString()) + .setEnableStackdriverLogging(true) + .setEnableSpellCorrection(true) + .build(); + mockAgents.addResponse(expectedResponse); + + String name = "name3373707"; + + Agent actualResponse = client.getAgent(name); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockAgents.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + GetAgentRequest actualRequest = ((GetAgentRequest) actualRequests.get(0)); + + Assert.assertEquals(name, actualRequest.getName()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void getAgentExceptionTest2() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockAgents.addException(exception); + + try { + String name = "name3373707"; client.getAgent(name); Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { - // Expected exception + // Expected exception. } } @Test - @SuppressWarnings("all") - public void createAgentTest() { - AgentName name = AgentName.of("[PROJECT]", "[LOCATION]", "[AGENT]"); - String displayName = "displayName1615086568"; - String defaultLanguageCode = "defaultLanguageCode856575222"; - String timeZone = "timeZone36848094"; - String description = "description-1724546052"; - String avatarUri = "avatarUri-402824826"; - FlowName startFlow = FlowName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]"); - boolean enableStackdriverLogging = true; - boolean enableSpellCorrection = false; + public void createAgentTest() throws Exception { Agent expectedResponse = Agent.newBuilder() - .setName(name.toString()) - .setDisplayName(displayName) - .setDefaultLanguageCode(defaultLanguageCode) - .setTimeZone(timeZone) - .setDescription(description) - .setAvatarUri(avatarUri) - .setStartFlow(startFlow.toString()) - .setEnableStackdriverLogging(enableStackdriverLogging) - .setEnableSpellCorrection(enableSpellCorrection) + .setName(AgentName.of("[PROJECT]", "[LOCATION]", "[AGENT]").toString()) + .setDisplayName("displayName1714148973") + .setDefaultLanguageCode("defaultLanguageCode2069633606") + .setTimeZone("timeZone-2077180903") + .setDescription("description-1724546052") + .setAvatarUri("avatarUri-428646061") + .setSpeechToTextSettings(SpeechToTextSettings.newBuilder().build()) + .setStartFlow(FlowName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]").toString()) + .setEnableStackdriverLogging(true) + .setEnableSpellCorrection(true) .build(); mockAgents.addResponse(expectedResponse); @@ -255,9 +291,9 @@ public void createAgentTest() { List actualRequests = mockAgents.getRequests(); Assert.assertEquals(1, actualRequests.size()); - CreateAgentRequest actualRequest = (CreateAgentRequest) actualRequests.get(0); + CreateAgentRequest actualRequest = ((CreateAgentRequest) actualRequests.get(0)); - Assert.assertEquals(parent, LocationName.parse(actualRequest.getParent())); + Assert.assertEquals(parent.toString(), actualRequest.getParent()); Assert.assertEquals(agent, actualRequest.getAgent()); Assert.assertTrue( channelProvider.isHeaderSent( @@ -266,45 +302,84 @@ public void createAgentTest() { } @Test - @SuppressWarnings("all") public void createAgentExceptionTest() throws Exception { - StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockAgents.addException(exception); try { LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); Agent agent = Agent.newBuilder().build(); + client.createAgent(parent, agent); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + @Test + public void createAgentTest2() throws Exception { + Agent expectedResponse = + Agent.newBuilder() + .setName(AgentName.of("[PROJECT]", "[LOCATION]", "[AGENT]").toString()) + .setDisplayName("displayName1714148973") + .setDefaultLanguageCode("defaultLanguageCode2069633606") + .setTimeZone("timeZone-2077180903") + .setDescription("description-1724546052") + .setAvatarUri("avatarUri-428646061") + .setSpeechToTextSettings(SpeechToTextSettings.newBuilder().build()) + .setStartFlow(FlowName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]").toString()) + .setEnableStackdriverLogging(true) + .setEnableSpellCorrection(true) + .build(); + mockAgents.addResponse(expectedResponse); + + String parent = "parent-995424086"; + Agent agent = Agent.newBuilder().build(); + + Agent actualResponse = client.createAgent(parent, agent); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockAgents.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + CreateAgentRequest actualRequest = ((CreateAgentRequest) actualRequests.get(0)); + + Assert.assertEquals(parent, actualRequest.getParent()); + Assert.assertEquals(agent, actualRequest.getAgent()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void createAgentExceptionTest2() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockAgents.addException(exception); + + try { + String parent = "parent-995424086"; + Agent agent = Agent.newBuilder().build(); client.createAgent(parent, agent); Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { - // Expected exception + // Expected exception. } } @Test - @SuppressWarnings("all") - public void updateAgentTest() { - AgentName name = AgentName.of("[PROJECT]", "[LOCATION]", "[AGENT]"); - String displayName = "displayName1615086568"; - String defaultLanguageCode = "defaultLanguageCode856575222"; - String timeZone = "timeZone36848094"; - String description = "description-1724546052"; - String avatarUri = "avatarUri-402824826"; - FlowName startFlow = FlowName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]"); - boolean enableStackdriverLogging = true; - boolean enableSpellCorrection = false; + public void updateAgentTest() throws Exception { Agent expectedResponse = Agent.newBuilder() - .setName(name.toString()) - .setDisplayName(displayName) - .setDefaultLanguageCode(defaultLanguageCode) - .setTimeZone(timeZone) - .setDescription(description) - .setAvatarUri(avatarUri) - .setStartFlow(startFlow.toString()) - .setEnableStackdriverLogging(enableStackdriverLogging) - .setEnableSpellCorrection(enableSpellCorrection) + .setName(AgentName.of("[PROJECT]", "[LOCATION]", "[AGENT]").toString()) + .setDisplayName("displayName1714148973") + .setDefaultLanguageCode("defaultLanguageCode2069633606") + .setTimeZone("timeZone-2077180903") + .setDescription("description-1724546052") + .setAvatarUri("avatarUri-428646061") + .setSpeechToTextSettings(SpeechToTextSettings.newBuilder().build()) + .setStartFlow(FlowName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]").toString()) + .setEnableStackdriverLogging(true) + .setEnableSpellCorrection(true) .build(); mockAgents.addResponse(expectedResponse); @@ -316,7 +391,7 @@ public void updateAgentTest() { List actualRequests = mockAgents.getRequests(); Assert.assertEquals(1, actualRequests.size()); - UpdateAgentRequest actualRequest = (UpdateAgentRequest) actualRequests.get(0); + UpdateAgentRequest actualRequest = ((UpdateAgentRequest) actualRequests.get(0)); Assert.assertEquals(agent, actualRequest.getAgent()); Assert.assertEquals(updateMask, actualRequest.getUpdateMask()); @@ -327,25 +402,22 @@ public void updateAgentTest() { } @Test - @SuppressWarnings("all") public void updateAgentExceptionTest() throws Exception { - StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockAgents.addException(exception); try { Agent agent = Agent.newBuilder().build(); FieldMask updateMask = FieldMask.newBuilder().build(); - client.updateAgent(agent, updateMask); Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { - // Expected exception + // Expected exception. } } @Test - @SuppressWarnings("all") - public void deleteAgentTest() { + public void deleteAgentTest() throws Exception { Empty expectedResponse = Empty.newBuilder().build(); mockAgents.addResponse(expectedResponse); @@ -355,9 +427,9 @@ public void deleteAgentTest() { List actualRequests = mockAgents.getRequests(); Assert.assertEquals(1, actualRequests.size()); - DeleteAgentRequest actualRequest = (DeleteAgentRequest) actualRequests.get(0); + DeleteAgentRequest actualRequest = ((DeleteAgentRequest) actualRequests.get(0)); - Assert.assertEquals(name, AgentName.parse(actualRequest.getName())); + Assert.assertEquals(name.toString(), actualRequest.getName()); Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), @@ -365,27 +437,56 @@ public void deleteAgentTest() { } @Test - @SuppressWarnings("all") public void deleteAgentExceptionTest() throws Exception { - StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockAgents.addException(exception); try { AgentName name = AgentName.of("[PROJECT]", "[LOCATION]", "[AGENT]"); + client.deleteAgent(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void deleteAgentTest2() throws Exception { + Empty expectedResponse = Empty.newBuilder().build(); + mockAgents.addResponse(expectedResponse); + + String name = "name3373707"; + client.deleteAgent(name); + + List actualRequests = mockAgents.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + DeleteAgentRequest actualRequest = ((DeleteAgentRequest) actualRequests.get(0)); + + Assert.assertEquals(name, actualRequest.getName()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void deleteAgentExceptionTest2() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockAgents.addException(exception); + + try { + String name = "name3373707"; client.deleteAgent(name); Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { - // Expected exception + // Expected exception. } } @Test - @SuppressWarnings("all") public void exportAgentTest() throws Exception { - String agentUri = "agentUri-1700713166"; - ExportAgentResponse expectedResponse = - ExportAgentResponse.newBuilder().setAgentUri(agentUri).build(); + ExportAgentResponse expectedResponse = ExportAgentResponse.newBuilder().build(); Operation resultOperation = Operation.newBuilder() .setName("exportAgentTest") @@ -394,17 +495,21 @@ public void exportAgentTest() throws Exception { .build(); mockAgents.addResponse(resultOperation); - AgentName name = AgentName.of("[PROJECT]", "[LOCATION]", "[AGENT]"); - ExportAgentRequest request = ExportAgentRequest.newBuilder().setName(name.toString()).build(); + ExportAgentRequest request = + ExportAgentRequest.newBuilder() + .setName(AgentName.of("[PROJECT]", "[LOCATION]", "[AGENT]").toString()) + .setAgentUri("agentUri1469149223") + .build(); ExportAgentResponse actualResponse = client.exportAgentAsync(request).get(); Assert.assertEquals(expectedResponse, actualResponse); List actualRequests = mockAgents.getRequests(); Assert.assertEquals(1, actualRequests.size()); - ExportAgentRequest actualRequest = (ExportAgentRequest) actualRequests.get(0); + ExportAgentRequest actualRequest = ((ExportAgentRequest) actualRequests.get(0)); - Assert.assertEquals(name, AgentName.parse(actualRequest.getName())); + Assert.assertEquals(request.getName(), actualRequest.getName()); + Assert.assertEquals(request.getAgentUri(), actualRequest.getAgentUri()); Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), @@ -412,26 +517,26 @@ public void exportAgentTest() throws Exception { } @Test - @SuppressWarnings("all") public void exportAgentExceptionTest() throws Exception { - StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockAgents.addException(exception); try { - AgentName name = AgentName.of("[PROJECT]", "[LOCATION]", "[AGENT]"); - ExportAgentRequest request = ExportAgentRequest.newBuilder().setName(name.toString()).build(); - + ExportAgentRequest request = + ExportAgentRequest.newBuilder() + .setName(AgentName.of("[PROJECT]", "[LOCATION]", "[AGENT]").toString()) + .setAgentUri("agentUri1469149223") + .build(); client.exportAgentAsync(request).get(); Assert.fail("No exception raised"); } catch (ExecutionException e) { Assert.assertEquals(InvalidArgumentException.class, e.getCause().getClass()); - InvalidArgumentException apiException = (InvalidArgumentException) e.getCause(); + InvalidArgumentException apiException = ((InvalidArgumentException) e.getCause()); Assert.assertEquals(StatusCode.Code.INVALID_ARGUMENT, apiException.getStatusCode().getCode()); } } @Test - @SuppressWarnings("all") public void restoreAgentTest() throws Exception { Empty expectedResponse = Empty.newBuilder().build(); Operation resultOperation = @@ -442,17 +547,20 @@ public void restoreAgentTest() throws Exception { .build(); mockAgents.addResponse(resultOperation); - AgentName name = AgentName.of("[PROJECT]", "[LOCATION]", "[AGENT]"); - RestoreAgentRequest request = RestoreAgentRequest.newBuilder().setName(name.toString()).build(); + RestoreAgentRequest request = + RestoreAgentRequest.newBuilder() + .setName(AgentName.of("[PROJECT]", "[LOCATION]", "[AGENT]").toString()) + .build(); - Empty actualResponse = client.restoreAgentAsync(request).get(); - Assert.assertEquals(expectedResponse, actualResponse); + client.restoreAgentAsync(request).get(); List actualRequests = mockAgents.getRequests(); Assert.assertEquals(1, actualRequests.size()); - RestoreAgentRequest actualRequest = (RestoreAgentRequest) actualRequests.get(0); + RestoreAgentRequest actualRequest = ((RestoreAgentRequest) actualRequests.get(0)); - Assert.assertEquals(name, AgentName.parse(actualRequest.getName())); + Assert.assertEquals(request.getName(), actualRequest.getName()); + Assert.assertEquals(request.getAgentUri(), actualRequest.getAgentUri()); + Assert.assertEquals(request.getAgentContent(), actualRequest.getAgentContent()); Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), @@ -460,21 +568,20 @@ public void restoreAgentTest() throws Exception { } @Test - @SuppressWarnings("all") public void restoreAgentExceptionTest() throws Exception { - StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockAgents.addException(exception); try { - AgentName name = AgentName.of("[PROJECT]", "[LOCATION]", "[AGENT]"); RestoreAgentRequest request = - RestoreAgentRequest.newBuilder().setName(name.toString()).build(); - + RestoreAgentRequest.newBuilder() + .setName(AgentName.of("[PROJECT]", "[LOCATION]", "[AGENT]").toString()) + .build(); client.restoreAgentAsync(request).get(); Assert.fail("No exception raised"); } catch (ExecutionException e) { Assert.assertEquals(InvalidArgumentException.class, e.getCause().getClass()); - InvalidArgumentException apiException = (InvalidArgumentException) e.getCause(); + InvalidArgumentException apiException = ((InvalidArgumentException) e.getCause()); Assert.assertEquals(StatusCode.Code.INVALID_ARGUMENT, apiException.getStatusCode().getCode()); } } diff --git a/google-cloud-dialogflow-cx/src/test/java/com/google/cloud/dialogflow/cx/v3beta1/EntityTypesClientTest.java b/google-cloud-dialogflow-cx/src/test/java/com/google/cloud/dialogflow/cx/v3beta1/EntityTypesClientTest.java index dc208f801..57c97ae89 100644 --- a/google-cloud-dialogflow-cx/src/test/java/com/google/cloud/dialogflow/cx/v3beta1/EntityTypesClientTest.java +++ b/google-cloud-dialogflow-cx/src/test/java/com/google/cloud/dialogflow/cx/v3beta1/EntityTypesClientTest.java @@ -5,7 +5,7 @@ * 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 + * 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, @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.google.cloud.dialogflow.cx.v3beta1; import static com.google.cloud.dialogflow.cx.v3beta1.EntityTypesClient.ListEntityTypesPagedResponse; @@ -28,12 +29,13 @@ import com.google.protobuf.AbstractMessage; import com.google.protobuf.Empty; import com.google.protobuf.FieldMask; -import io.grpc.Status; import io.grpc.StatusRuntimeException; import java.io.IOException; +import java.util.ArrayList; import java.util.Arrays; import java.util.List; import java.util.UUID; +import javax.annotation.Generated; import org.junit.After; import org.junit.AfterClass; import org.junit.Assert; @@ -41,63 +43,31 @@ import org.junit.BeforeClass; import org.junit.Test; -@javax.annotation.Generated("by GAPIC") +@Generated("by gapic-generator-java") public class EntityTypesClientTest { - private static MockPages mockPages; - private static MockFlows mockFlows; - private static MockAgents mockAgents; private static MockEntityTypes mockEntityTypes; - private static MockEnvironments mockEnvironments; - private static MockIntents mockIntents; - private static MockSessionEntityTypes mockSessionEntityTypes; - private static MockSessions mockSessions; - private static MockTransitionRouteGroups mockTransitionRouteGroups; - private static MockVersions mockVersions; - private static MockWebhooks mockWebhooks; - private static MockServiceHelper serviceHelper; + private static MockServiceHelper mockServiceHelper; private EntityTypesClient client; private LocalChannelProvider channelProvider; @BeforeClass public static void startStaticServer() { - mockPages = new MockPages(); - mockFlows = new MockFlows(); - mockAgents = new MockAgents(); mockEntityTypes = new MockEntityTypes(); - mockEnvironments = new MockEnvironments(); - mockIntents = new MockIntents(); - mockSessionEntityTypes = new MockSessionEntityTypes(); - mockSessions = new MockSessions(); - mockTransitionRouteGroups = new MockTransitionRouteGroups(); - mockVersions = new MockVersions(); - mockWebhooks = new MockWebhooks(); - serviceHelper = + mockServiceHelper = new MockServiceHelper( - UUID.randomUUID().toString(), - Arrays.asList( - mockPages, - mockFlows, - mockAgents, - mockEntityTypes, - mockEnvironments, - mockIntents, - mockSessionEntityTypes, - mockSessions, - mockTransitionRouteGroups, - mockVersions, - mockWebhooks)); - serviceHelper.start(); + UUID.randomUUID().toString(), Arrays.asList(mockEntityTypes)); + mockServiceHelper.start(); } @AfterClass public static void stopServer() { - serviceHelper.stop(); + mockServiceHelper.stop(); } @Before public void setUp() throws IOException { - serviceHelper.reset(); - channelProvider = serviceHelper.createChannelProvider(); + mockServiceHelper.reset(); + channelProvider = mockServiceHelper.createChannelProvider(); EntityTypesSettings settings = EntityTypesSettings.newBuilder() .setTransportChannelProvider(channelProvider) @@ -112,15 +82,12 @@ public void tearDown() throws Exception { } @Test - @SuppressWarnings("all") - public void listEntityTypesTest() { - String nextPageToken = ""; - EntityType entityTypesElement = EntityType.newBuilder().build(); - List entityTypes = Arrays.asList(entityTypesElement); + public void listEntityTypesTest() throws Exception { + EntityType responsesElement = EntityType.newBuilder().build(); ListEntityTypesResponse expectedResponse = ListEntityTypesResponse.newBuilder() - .setNextPageToken(nextPageToken) - .addAllEntityTypes(entityTypes) + .setNextPageToken("") + .addAllEntityTypes(Arrays.asList(responsesElement)) .build(); mockEntityTypes.addResponse(expectedResponse); @@ -129,14 +96,15 @@ public void listEntityTypesTest() { ListEntityTypesPagedResponse pagedListResponse = client.listEntityTypes(parent); List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + Assert.assertEquals(1, resources.size()); Assert.assertEquals(expectedResponse.getEntityTypesList().get(0), resources.get(0)); List actualRequests = mockEntityTypes.getRequests(); Assert.assertEquals(1, actualRequests.size()); - ListEntityTypesRequest actualRequest = (ListEntityTypesRequest) actualRequests.get(0); + ListEntityTypesRequest actualRequest = ((ListEntityTypesRequest) actualRequests.get(0)); - Assert.assertEquals(parent, AgentName.parse(actualRequest.getParent())); + Assert.assertEquals(parent.toString(), actualRequest.getParent()); Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), @@ -144,32 +112,73 @@ public void listEntityTypesTest() { } @Test - @SuppressWarnings("all") public void listEntityTypesExceptionTest() throws Exception { - StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockEntityTypes.addException(exception); try { AgentName parent = AgentName.of("[PROJECT]", "[LOCATION]", "[AGENT]"); + client.listEntityTypes(parent); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void listEntityTypesTest2() throws Exception { + EntityType responsesElement = EntityType.newBuilder().build(); + ListEntityTypesResponse expectedResponse = + ListEntityTypesResponse.newBuilder() + .setNextPageToken("") + .addAllEntityTypes(Arrays.asList(responsesElement)) + .build(); + mockEntityTypes.addResponse(expectedResponse); + + String parent = "parent-995424086"; + + ListEntityTypesPagedResponse pagedListResponse = client.listEntityTypes(parent); + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getEntityTypesList().get(0), resources.get(0)); + + List actualRequests = mockEntityTypes.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + ListEntityTypesRequest actualRequest = ((ListEntityTypesRequest) actualRequests.get(0)); + + Assert.assertEquals(parent, actualRequest.getParent()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void listEntityTypesExceptionTest2() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockEntityTypes.addException(exception); + + try { + String parent = "parent-995424086"; client.listEntityTypes(parent); Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { - // Expected exception + // Expected exception. } } @Test - @SuppressWarnings("all") - public void getEntityTypeTest() { - EntityTypeName name2 = EntityTypeName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[ENTITY_TYPE]"); - String displayName = "displayName1615086568"; - boolean enableFuzzyExtraction = true; + public void getEntityTypeTest() throws Exception { EntityType expectedResponse = EntityType.newBuilder() - .setName(name2.toString()) - .setDisplayName(displayName) - .setEnableFuzzyExtraction(enableFuzzyExtraction) + .setName( + EntityTypeName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[ENTITY_TYPE]").toString()) + .setDisplayName("displayName1714148973") + .addAllEntities(new ArrayList()) + .addAllExcludedPhrases(new ArrayList()) + .setEnableFuzzyExtraction(true) .build(); mockEntityTypes.addResponse(expectedResponse); @@ -180,9 +189,9 @@ public void getEntityTypeTest() { List actualRequests = mockEntityTypes.getRequests(); Assert.assertEquals(1, actualRequests.size()); - GetEntityTypeRequest actualRequest = (GetEntityTypeRequest) actualRequests.get(0); + GetEntityTypeRequest actualRequest = ((GetEntityTypeRequest) actualRequests.get(0)); - Assert.assertEquals(name, EntityTypeName.parse(actualRequest.getName())); + Assert.assertEquals(name.toString(), actualRequest.getName()); Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), @@ -190,33 +199,73 @@ public void getEntityTypeTest() { } @Test - @SuppressWarnings("all") public void getEntityTypeExceptionTest() throws Exception { - StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockEntityTypes.addException(exception); try { EntityTypeName name = EntityTypeName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[ENTITY_TYPE]"); + client.getEntityType(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void getEntityTypeTest2() throws Exception { + EntityType expectedResponse = + EntityType.newBuilder() + .setName( + EntityTypeName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[ENTITY_TYPE]").toString()) + .setDisplayName("displayName1714148973") + .addAllEntities(new ArrayList()) + .addAllExcludedPhrases(new ArrayList()) + .setEnableFuzzyExtraction(true) + .build(); + mockEntityTypes.addResponse(expectedResponse); + + String name = "name3373707"; + + EntityType actualResponse = client.getEntityType(name); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockEntityTypes.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + GetEntityTypeRequest actualRequest = ((GetEntityTypeRequest) actualRequests.get(0)); + + Assert.assertEquals(name, actualRequest.getName()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void getEntityTypeExceptionTest2() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockEntityTypes.addException(exception); + try { + String name = "name3373707"; client.getEntityType(name); Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { - // Expected exception + // Expected exception. } } @Test - @SuppressWarnings("all") - public void createEntityTypeTest() { - EntityTypeName name = EntityTypeName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[ENTITY_TYPE]"); - String displayName = "displayName1615086568"; - boolean enableFuzzyExtraction = true; + public void createEntityTypeTest() throws Exception { EntityType expectedResponse = EntityType.newBuilder() - .setName(name.toString()) - .setDisplayName(displayName) - .setEnableFuzzyExtraction(enableFuzzyExtraction) + .setName( + EntityTypeName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[ENTITY_TYPE]").toString()) + .setDisplayName("displayName1714148973") + .addAllEntities(new ArrayList()) + .addAllExcludedPhrases(new ArrayList()) + .setEnableFuzzyExtraction(true) .build(); mockEntityTypes.addResponse(expectedResponse); @@ -228,9 +277,9 @@ public void createEntityTypeTest() { List actualRequests = mockEntityTypes.getRequests(); Assert.assertEquals(1, actualRequests.size()); - CreateEntityTypeRequest actualRequest = (CreateEntityTypeRequest) actualRequests.get(0); + CreateEntityTypeRequest actualRequest = ((CreateEntityTypeRequest) actualRequests.get(0)); - Assert.assertEquals(parent, AgentName.parse(actualRequest.getParent())); + Assert.assertEquals(parent.toString(), actualRequest.getParent()); Assert.assertEquals(entityType, actualRequest.getEntityType()); Assert.assertTrue( channelProvider.isHeaderSent( @@ -239,33 +288,76 @@ public void createEntityTypeTest() { } @Test - @SuppressWarnings("all") public void createEntityTypeExceptionTest() throws Exception { - StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockEntityTypes.addException(exception); try { AgentName parent = AgentName.of("[PROJECT]", "[LOCATION]", "[AGENT]"); EntityType entityType = EntityType.newBuilder().build(); + client.createEntityType(parent, entityType); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void createEntityTypeTest2() throws Exception { + EntityType expectedResponse = + EntityType.newBuilder() + .setName( + EntityTypeName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[ENTITY_TYPE]").toString()) + .setDisplayName("displayName1714148973") + .addAllEntities(new ArrayList()) + .addAllExcludedPhrases(new ArrayList()) + .setEnableFuzzyExtraction(true) + .build(); + mockEntityTypes.addResponse(expectedResponse); + + String parent = "parent-995424086"; + EntityType entityType = EntityType.newBuilder().build(); + + EntityType actualResponse = client.createEntityType(parent, entityType); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockEntityTypes.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + CreateEntityTypeRequest actualRequest = ((CreateEntityTypeRequest) actualRequests.get(0)); + + Assert.assertEquals(parent, actualRequest.getParent()); + Assert.assertEquals(entityType, actualRequest.getEntityType()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void createEntityTypeExceptionTest2() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockEntityTypes.addException(exception); + try { + String parent = "parent-995424086"; + EntityType entityType = EntityType.newBuilder().build(); client.createEntityType(parent, entityType); Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { - // Expected exception + // Expected exception. } } @Test - @SuppressWarnings("all") - public void updateEntityTypeTest() { - EntityTypeName name = EntityTypeName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[ENTITY_TYPE]"); - String displayName = "displayName1615086568"; - boolean enableFuzzyExtraction = true; + public void updateEntityTypeTest() throws Exception { EntityType expectedResponse = EntityType.newBuilder() - .setName(name.toString()) - .setDisplayName(displayName) - .setEnableFuzzyExtraction(enableFuzzyExtraction) + .setName( + EntityTypeName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[ENTITY_TYPE]").toString()) + .setDisplayName("displayName1714148973") + .addAllEntities(new ArrayList()) + .addAllExcludedPhrases(new ArrayList()) + .setEnableFuzzyExtraction(true) .build(); mockEntityTypes.addResponse(expectedResponse); @@ -277,7 +369,7 @@ public void updateEntityTypeTest() { List actualRequests = mockEntityTypes.getRequests(); Assert.assertEquals(1, actualRequests.size()); - UpdateEntityTypeRequest actualRequest = (UpdateEntityTypeRequest) actualRequests.get(0); + UpdateEntityTypeRequest actualRequest = ((UpdateEntityTypeRequest) actualRequests.get(0)); Assert.assertEquals(entityType, actualRequest.getEntityType()); Assert.assertEquals(updateMask, actualRequest.getUpdateMask()); @@ -288,25 +380,22 @@ public void updateEntityTypeTest() { } @Test - @SuppressWarnings("all") public void updateEntityTypeExceptionTest() throws Exception { - StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockEntityTypes.addException(exception); try { EntityType entityType = EntityType.newBuilder().build(); FieldMask updateMask = FieldMask.newBuilder().build(); - client.updateEntityType(entityType, updateMask); Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { - // Expected exception + // Expected exception. } } @Test - @SuppressWarnings("all") - public void deleteEntityTypeTest() { + public void deleteEntityTypeTest() throws Exception { Empty expectedResponse = Empty.newBuilder().build(); mockEntityTypes.addResponse(expectedResponse); @@ -316,9 +405,9 @@ public void deleteEntityTypeTest() { List actualRequests = mockEntityTypes.getRequests(); Assert.assertEquals(1, actualRequests.size()); - DeleteEntityTypeRequest actualRequest = (DeleteEntityTypeRequest) actualRequests.get(0); + DeleteEntityTypeRequest actualRequest = ((DeleteEntityTypeRequest) actualRequests.get(0)); - Assert.assertEquals(name, EntityTypeName.parse(actualRequest.getName())); + Assert.assertEquals(name.toString(), actualRequest.getName()); Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), @@ -326,19 +415,51 @@ public void deleteEntityTypeTest() { } @Test - @SuppressWarnings("all") public void deleteEntityTypeExceptionTest() throws Exception { - StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockEntityTypes.addException(exception); try { EntityTypeName name = EntityTypeName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[ENTITY_TYPE]"); + client.deleteEntityType(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void deleteEntityTypeTest2() throws Exception { + Empty expectedResponse = Empty.newBuilder().build(); + mockEntityTypes.addResponse(expectedResponse); + + String name = "name3373707"; + client.deleteEntityType(name); + + List actualRequests = mockEntityTypes.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + DeleteEntityTypeRequest actualRequest = ((DeleteEntityTypeRequest) actualRequests.get(0)); + + Assert.assertEquals(name, actualRequest.getName()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void deleteEntityTypeExceptionTest2() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockEntityTypes.addException(exception); + + try { + String name = "name3373707"; client.deleteEntityType(name); Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { - // Expected exception + // Expected exception. } } } diff --git a/google-cloud-dialogflow-cx/src/test/java/com/google/cloud/dialogflow/cx/v3beta1/EnvironmentsClientTest.java b/google-cloud-dialogflow-cx/src/test/java/com/google/cloud/dialogflow/cx/v3beta1/EnvironmentsClientTest.java index ff913cbb0..5c08ddf49 100644 --- a/google-cloud-dialogflow-cx/src/test/java/com/google/cloud/dialogflow/cx/v3beta1/EnvironmentsClientTest.java +++ b/google-cloud-dialogflow-cx/src/test/java/com/google/cloud/dialogflow/cx/v3beta1/EnvironmentsClientTest.java @@ -5,7 +5,7 @@ * 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 + * 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, @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.google.cloud.dialogflow.cx.v3beta1; import static com.google.cloud.dialogflow.cx.v3beta1.EnvironmentsClient.ListEnvironmentsPagedResponse; @@ -32,13 +33,15 @@ import com.google.protobuf.Any; import com.google.protobuf.Empty; import com.google.protobuf.FieldMask; -import io.grpc.Status; +import com.google.protobuf.Timestamp; import io.grpc.StatusRuntimeException; import java.io.IOException; +import java.util.ArrayList; import java.util.Arrays; import java.util.List; import java.util.UUID; import java.util.concurrent.ExecutionException; +import javax.annotation.Generated; import org.junit.After; import org.junit.AfterClass; import org.junit.Assert; @@ -46,63 +49,31 @@ import org.junit.BeforeClass; import org.junit.Test; -@javax.annotation.Generated("by GAPIC") +@Generated("by gapic-generator-java") public class EnvironmentsClientTest { - private static MockPages mockPages; - private static MockFlows mockFlows; - private static MockAgents mockAgents; - private static MockEntityTypes mockEntityTypes; - private static MockEnvironments mockEnvironments; - private static MockIntents mockIntents; - private static MockSessionEntityTypes mockSessionEntityTypes; - private static MockSessions mockSessions; - private static MockTransitionRouteGroups mockTransitionRouteGroups; - private static MockVersions mockVersions; - private static MockWebhooks mockWebhooks; - private static MockServiceHelper serviceHelper; + private static MockServiceHelper mockServiceHelper; private EnvironmentsClient client; + private static MockEnvironments mockEnvironments; private LocalChannelProvider channelProvider; @BeforeClass public static void startStaticServer() { - mockPages = new MockPages(); - mockFlows = new MockFlows(); - mockAgents = new MockAgents(); - mockEntityTypes = new MockEntityTypes(); mockEnvironments = new MockEnvironments(); - mockIntents = new MockIntents(); - mockSessionEntityTypes = new MockSessionEntityTypes(); - mockSessions = new MockSessions(); - mockTransitionRouteGroups = new MockTransitionRouteGroups(); - mockVersions = new MockVersions(); - mockWebhooks = new MockWebhooks(); - serviceHelper = + mockServiceHelper = new MockServiceHelper( - UUID.randomUUID().toString(), - Arrays.asList( - mockPages, - mockFlows, - mockAgents, - mockEntityTypes, - mockEnvironments, - mockIntents, - mockSessionEntityTypes, - mockSessions, - mockTransitionRouteGroups, - mockVersions, - mockWebhooks)); - serviceHelper.start(); + UUID.randomUUID().toString(), Arrays.asList(mockEnvironments)); + mockServiceHelper.start(); } @AfterClass public static void stopServer() { - serviceHelper.stop(); + mockServiceHelper.stop(); } @Before public void setUp() throws IOException { - serviceHelper.reset(); - channelProvider = serviceHelper.createChannelProvider(); + mockServiceHelper.reset(); + channelProvider = mockServiceHelper.createChannelProvider(); EnvironmentsSettings settings = EnvironmentsSettings.newBuilder() .setTransportChannelProvider(channelProvider) @@ -117,15 +88,12 @@ public void tearDown() throws Exception { } @Test - @SuppressWarnings("all") - public void listEnvironmentsTest() { - String nextPageToken = ""; - Environment environmentsElement = Environment.newBuilder().build(); - List environments = Arrays.asList(environmentsElement); + public void listEnvironmentsTest() throws Exception { + Environment responsesElement = Environment.newBuilder().build(); ListEnvironmentsResponse expectedResponse = ListEnvironmentsResponse.newBuilder() - .setNextPageToken(nextPageToken) - .addAllEnvironments(environments) + .setNextPageToken("") + .addAllEnvironments(Arrays.asList(responsesElement)) .build(); mockEnvironments.addResponse(expectedResponse); @@ -134,14 +102,15 @@ public void listEnvironmentsTest() { ListEnvironmentsPagedResponse pagedListResponse = client.listEnvironments(parent); List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + Assert.assertEquals(1, resources.size()); Assert.assertEquals(expectedResponse.getEnvironmentsList().get(0), resources.get(0)); List actualRequests = mockEnvironments.getRequests(); Assert.assertEquals(1, actualRequests.size()); - ListEnvironmentsRequest actualRequest = (ListEnvironmentsRequest) actualRequests.get(0); + ListEnvironmentsRequest actualRequest = ((ListEnvironmentsRequest) actualRequests.get(0)); - Assert.assertEquals(parent, AgentName.parse(actualRequest.getParent())); + Assert.assertEquals(parent.toString(), actualRequest.getParent()); Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), @@ -149,33 +118,74 @@ public void listEnvironmentsTest() { } @Test - @SuppressWarnings("all") public void listEnvironmentsExceptionTest() throws Exception { - StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockEnvironments.addException(exception); try { AgentName parent = AgentName.of("[PROJECT]", "[LOCATION]", "[AGENT]"); + client.listEnvironments(parent); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void listEnvironmentsTest2() throws Exception { + Environment responsesElement = Environment.newBuilder().build(); + ListEnvironmentsResponse expectedResponse = + ListEnvironmentsResponse.newBuilder() + .setNextPageToken("") + .addAllEnvironments(Arrays.asList(responsesElement)) + .build(); + mockEnvironments.addResponse(expectedResponse); + + String parent = "parent-995424086"; + + ListEnvironmentsPagedResponse pagedListResponse = client.listEnvironments(parent); + + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getEnvironmentsList().get(0), resources.get(0)); + + List actualRequests = mockEnvironments.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + ListEnvironmentsRequest actualRequest = ((ListEnvironmentsRequest) actualRequests.get(0)); + + Assert.assertEquals(parent, actualRequest.getParent()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + @Test + public void listEnvironmentsExceptionTest2() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockEnvironments.addException(exception); + + try { + String parent = "parent-995424086"; client.listEnvironments(parent); Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { - // Expected exception + // Expected exception. } } @Test - @SuppressWarnings("all") - public void getEnvironmentTest() { - EnvironmentName name2 = - EnvironmentName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[ENVIRONMENT]"); - String displayName = "displayName1615086568"; - String description = "description-1724546052"; + public void getEnvironmentTest() throws Exception { Environment expectedResponse = Environment.newBuilder() - .setName(name2.toString()) - .setDisplayName(displayName) - .setDescription(description) + .setName( + EnvironmentName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[ENVIRONMENT]") + .toString()) + .setDisplayName("displayName1714148973") + .setDescription("description-1724546052") + .addAllVersionConfigs(new ArrayList()) + .setUpdateTime(Timestamp.newBuilder().build()) .build(); mockEnvironments.addResponse(expectedResponse); @@ -187,9 +197,9 @@ public void getEnvironmentTest() { List actualRequests = mockEnvironments.getRequests(); Assert.assertEquals(1, actualRequests.size()); - GetEnvironmentRequest actualRequest = (GetEnvironmentRequest) actualRequests.get(0); + GetEnvironmentRequest actualRequest = ((GetEnvironmentRequest) actualRequests.get(0)); - Assert.assertEquals(name, EnvironmentName.parse(actualRequest.getName())); + Assert.assertEquals(name.toString(), actualRequest.getName()); Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), @@ -197,34 +207,75 @@ public void getEnvironmentTest() { } @Test - @SuppressWarnings("all") public void getEnvironmentExceptionTest() throws Exception { - StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockEnvironments.addException(exception); try { EnvironmentName name = EnvironmentName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[ENVIRONMENT]"); + client.getEnvironment(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + @Test + public void getEnvironmentTest2() throws Exception { + Environment expectedResponse = + Environment.newBuilder() + .setName( + EnvironmentName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[ENVIRONMENT]") + .toString()) + .setDisplayName("displayName1714148973") + .setDescription("description-1724546052") + .addAllVersionConfigs(new ArrayList()) + .setUpdateTime(Timestamp.newBuilder().build()) + .build(); + mockEnvironments.addResponse(expectedResponse); + + String name = "name3373707"; + + Environment actualResponse = client.getEnvironment(name); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockEnvironments.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + GetEnvironmentRequest actualRequest = ((GetEnvironmentRequest) actualRequests.get(0)); + + Assert.assertEquals(name, actualRequest.getName()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void getEnvironmentExceptionTest2() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockEnvironments.addException(exception); + + try { + String name = "name3373707"; client.getEnvironment(name); Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { - // Expected exception + // Expected exception. } } @Test - @SuppressWarnings("all") public void createEnvironmentTest() throws Exception { - EnvironmentName name = - EnvironmentName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[ENVIRONMENT]"); - String displayName = "displayName1615086568"; - String description = "description-1724546052"; Environment expectedResponse = Environment.newBuilder() - .setName(name.toString()) - .setDisplayName(displayName) - .setDescription(description) + .setName( + EnvironmentName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[ENVIRONMENT]") + .toString()) + .setDisplayName("displayName1714148973") + .setDescription("description-1724546052") + .addAllVersionConfigs(new ArrayList()) + .setUpdateTime(Timestamp.newBuilder().build()) .build(); Operation resultOperation = Operation.newBuilder() @@ -242,9 +293,9 @@ public void createEnvironmentTest() throws Exception { List actualRequests = mockEnvironments.getRequests(); Assert.assertEquals(1, actualRequests.size()); - CreateEnvironmentRequest actualRequest = (CreateEnvironmentRequest) actualRequests.get(0); + CreateEnvironmentRequest actualRequest = ((CreateEnvironmentRequest) actualRequests.get(0)); - Assert.assertEquals(parent, AgentName.parse(actualRequest.getParent())); + Assert.assertEquals(parent.toString(), actualRequest.getParent()); Assert.assertEquals(environment, actualRequest.getEnvironment()); Assert.assertTrue( channelProvider.isHeaderSent( @@ -253,36 +304,88 @@ public void createEnvironmentTest() throws Exception { } @Test - @SuppressWarnings("all") public void createEnvironmentExceptionTest() throws Exception { - StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockEnvironments.addException(exception); try { AgentName parent = AgentName.of("[PROJECT]", "[LOCATION]", "[AGENT]"); Environment environment = Environment.newBuilder().build(); + client.createEnvironmentAsync(parent, environment).get(); + Assert.fail("No exception raised"); + } catch (ExecutionException e) { + Assert.assertEquals(InvalidArgumentException.class, e.getCause().getClass()); + InvalidArgumentException apiException = ((InvalidArgumentException) e.getCause()); + Assert.assertEquals(StatusCode.Code.INVALID_ARGUMENT, apiException.getStatusCode().getCode()); + } + } + + @Test + public void createEnvironmentTest2() throws Exception { + Environment expectedResponse = + Environment.newBuilder() + .setName( + EnvironmentName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[ENVIRONMENT]") + .toString()) + .setDisplayName("displayName1714148973") + .setDescription("description-1724546052") + .addAllVersionConfigs(new ArrayList()) + .setUpdateTime(Timestamp.newBuilder().build()) + .build(); + Operation resultOperation = + Operation.newBuilder() + .setName("createEnvironmentTest") + .setDone(true) + .setResponse(Any.pack(expectedResponse)) + .build(); + mockEnvironments.addResponse(resultOperation); + + String parent = "parent-995424086"; + Environment environment = Environment.newBuilder().build(); + Environment actualResponse = client.createEnvironmentAsync(parent, environment).get(); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockEnvironments.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + CreateEnvironmentRequest actualRequest = ((CreateEnvironmentRequest) actualRequests.get(0)); + + Assert.assertEquals(parent, actualRequest.getParent()); + Assert.assertEquals(environment, actualRequest.getEnvironment()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void createEnvironmentExceptionTest2() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockEnvironments.addException(exception); + + try { + String parent = "parent-995424086"; + Environment environment = Environment.newBuilder().build(); client.createEnvironmentAsync(parent, environment).get(); Assert.fail("No exception raised"); } catch (ExecutionException e) { Assert.assertEquals(InvalidArgumentException.class, e.getCause().getClass()); - InvalidArgumentException apiException = (InvalidArgumentException) e.getCause(); + InvalidArgumentException apiException = ((InvalidArgumentException) e.getCause()); Assert.assertEquals(StatusCode.Code.INVALID_ARGUMENT, apiException.getStatusCode().getCode()); } } @Test - @SuppressWarnings("all") public void updateEnvironmentTest() throws Exception { - EnvironmentName name = - EnvironmentName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[ENVIRONMENT]"); - String displayName = "displayName1615086568"; - String description = "description-1724546052"; Environment expectedResponse = Environment.newBuilder() - .setName(name.toString()) - .setDisplayName(displayName) - .setDescription(description) + .setName( + EnvironmentName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[ENVIRONMENT]") + .toString()) + .setDisplayName("displayName1714148973") + .setDescription("description-1724546052") + .addAllVersionConfigs(new ArrayList()) + .setUpdateTime(Timestamp.newBuilder().build()) .build(); Operation resultOperation = Operation.newBuilder() @@ -300,7 +403,7 @@ public void updateEnvironmentTest() throws Exception { List actualRequests = mockEnvironments.getRequests(); Assert.assertEquals(1, actualRequests.size()); - UpdateEnvironmentRequest actualRequest = (UpdateEnvironmentRequest) actualRequests.get(0); + UpdateEnvironmentRequest actualRequest = ((UpdateEnvironmentRequest) actualRequests.get(0)); Assert.assertEquals(environment, actualRequest.getEnvironment()); Assert.assertEquals(updateMask, actualRequest.getUpdateMask()); @@ -311,27 +414,24 @@ public void updateEnvironmentTest() throws Exception { } @Test - @SuppressWarnings("all") public void updateEnvironmentExceptionTest() throws Exception { - StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockEnvironments.addException(exception); try { Environment environment = Environment.newBuilder().build(); FieldMask updateMask = FieldMask.newBuilder().build(); - client.updateEnvironmentAsync(environment, updateMask).get(); Assert.fail("No exception raised"); } catch (ExecutionException e) { Assert.assertEquals(InvalidArgumentException.class, e.getCause().getClass()); - InvalidArgumentException apiException = (InvalidArgumentException) e.getCause(); + InvalidArgumentException apiException = ((InvalidArgumentException) e.getCause()); Assert.assertEquals(StatusCode.Code.INVALID_ARGUMENT, apiException.getStatusCode().getCode()); } } @Test - @SuppressWarnings("all") - public void deleteEnvironmentTest() { + public void deleteEnvironmentTest() throws Exception { Empty expectedResponse = Empty.newBuilder().build(); mockEnvironments.addResponse(expectedResponse); @@ -342,9 +442,9 @@ public void deleteEnvironmentTest() { List actualRequests = mockEnvironments.getRequests(); Assert.assertEquals(1, actualRequests.size()); - DeleteEnvironmentRequest actualRequest = (DeleteEnvironmentRequest) actualRequests.get(0); + DeleteEnvironmentRequest actualRequest = ((DeleteEnvironmentRequest) actualRequests.get(0)); - Assert.assertEquals(name, EnvironmentName.parse(actualRequest.getName())); + Assert.assertEquals(name.toString(), actualRequest.getName()); Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), @@ -352,32 +452,61 @@ public void deleteEnvironmentTest() { } @Test - @SuppressWarnings("all") public void deleteEnvironmentExceptionTest() throws Exception { - StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockEnvironments.addException(exception); try { EnvironmentName name = EnvironmentName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[ENVIRONMENT]"); + client.deleteEnvironment(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void deleteEnvironmentTest2() throws Exception { + Empty expectedResponse = Empty.newBuilder().build(); + mockEnvironments.addResponse(expectedResponse); + + String name = "name3373707"; + + client.deleteEnvironment(name); + + List actualRequests = mockEnvironments.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + DeleteEnvironmentRequest actualRequest = ((DeleteEnvironmentRequest) actualRequests.get(0)); + + Assert.assertEquals(name, actualRequest.getName()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + @Test + public void deleteEnvironmentExceptionTest2() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockEnvironments.addException(exception); + + try { + String name = "name3373707"; client.deleteEnvironment(name); Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { - // Expected exception + // Expected exception. } } @Test - @SuppressWarnings("all") - public void lookupEnvironmentHistoryTest() { - String nextPageToken = ""; - Environment environmentsElement = Environment.newBuilder().build(); - List environments = Arrays.asList(environmentsElement); + public void lookupEnvironmentHistoryTest() throws Exception { + Environment responsesElement = Environment.newBuilder().build(); LookupEnvironmentHistoryResponse expectedResponse = LookupEnvironmentHistoryResponse.newBuilder() - .setNextPageToken(nextPageToken) - .addAllEnvironments(environments) + .setNextPageToken("") + .addAllEnvironments(Arrays.asList(responsesElement)) .build(); mockEnvironments.addResponse(expectedResponse); @@ -387,15 +516,16 @@ public void lookupEnvironmentHistoryTest() { LookupEnvironmentHistoryPagedResponse pagedListResponse = client.lookupEnvironmentHistory(name); List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + Assert.assertEquals(1, resources.size()); Assert.assertEquals(expectedResponse.getEnvironmentsList().get(0), resources.get(0)); List actualRequests = mockEnvironments.getRequests(); Assert.assertEquals(1, actualRequests.size()); LookupEnvironmentHistoryRequest actualRequest = - (LookupEnvironmentHistoryRequest) actualRequests.get(0); + ((LookupEnvironmentHistoryRequest) actualRequests.get(0)); - Assert.assertEquals(name, EnvironmentName.parse(actualRequest.getName())); + Assert.assertEquals(name.toString(), actualRequest.getName()); Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), @@ -403,19 +533,62 @@ public void lookupEnvironmentHistoryTest() { } @Test - @SuppressWarnings("all") public void lookupEnvironmentHistoryExceptionTest() throws Exception { - StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockEnvironments.addException(exception); try { EnvironmentName name = EnvironmentName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[ENVIRONMENT]"); + client.lookupEnvironmentHistory(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void lookupEnvironmentHistoryTest2() throws Exception { + Environment responsesElement = Environment.newBuilder().build(); + LookupEnvironmentHistoryResponse expectedResponse = + LookupEnvironmentHistoryResponse.newBuilder() + .setNextPageToken("") + .addAllEnvironments(Arrays.asList(responsesElement)) + .build(); + mockEnvironments.addResponse(expectedResponse); + + String name = "name3373707"; + LookupEnvironmentHistoryPagedResponse pagedListResponse = client.lookupEnvironmentHistory(name); + + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getEnvironmentsList().get(0), resources.get(0)); + + List actualRequests = mockEnvironments.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + LookupEnvironmentHistoryRequest actualRequest = + ((LookupEnvironmentHistoryRequest) actualRequests.get(0)); + + Assert.assertEquals(name, actualRequest.getName()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void lookupEnvironmentHistoryExceptionTest2() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockEnvironments.addException(exception); + + try { + String name = "name3373707"; client.lookupEnvironmentHistory(name); Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { - // Expected exception + // Expected exception. } } } diff --git a/google-cloud-dialogflow-cx/src/test/java/com/google/cloud/dialogflow/cx/v3beta1/FlowsClientTest.java b/google-cloud-dialogflow-cx/src/test/java/com/google/cloud/dialogflow/cx/v3beta1/FlowsClientTest.java index a0a00ce77..0d6a45d82 100644 --- a/google-cloud-dialogflow-cx/src/test/java/com/google/cloud/dialogflow/cx/v3beta1/FlowsClientTest.java +++ b/google-cloud-dialogflow-cx/src/test/java/com/google/cloud/dialogflow/cx/v3beta1/FlowsClientTest.java @@ -5,7 +5,7 @@ * 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 + * 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, @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.google.cloud.dialogflow.cx.v3beta1; import static com.google.cloud.dialogflow.cx.v3beta1.FlowsClient.ListFlowsPagedResponse; @@ -31,13 +32,14 @@ import com.google.protobuf.Any; import com.google.protobuf.Empty; import com.google.protobuf.FieldMask; -import io.grpc.Status; import io.grpc.StatusRuntimeException; import java.io.IOException; +import java.util.ArrayList; import java.util.Arrays; import java.util.List; import java.util.UUID; import java.util.concurrent.ExecutionException; +import javax.annotation.Generated; import org.junit.After; import org.junit.AfterClass; import org.junit.Assert; @@ -45,63 +47,31 @@ import org.junit.BeforeClass; import org.junit.Test; -@javax.annotation.Generated("by GAPIC") +@Generated("by gapic-generator-java") public class FlowsClientTest { - private static MockPages mockPages; + private static MockServiceHelper mockServiceHelper; private static MockFlows mockFlows; - private static MockAgents mockAgents; - private static MockEntityTypes mockEntityTypes; - private static MockEnvironments mockEnvironments; - private static MockIntents mockIntents; - private static MockSessionEntityTypes mockSessionEntityTypes; - private static MockSessions mockSessions; - private static MockTransitionRouteGroups mockTransitionRouteGroups; - private static MockVersions mockVersions; - private static MockWebhooks mockWebhooks; - private static MockServiceHelper serviceHelper; private FlowsClient client; private LocalChannelProvider channelProvider; @BeforeClass public static void startStaticServer() { - mockPages = new MockPages(); mockFlows = new MockFlows(); - mockAgents = new MockAgents(); - mockEntityTypes = new MockEntityTypes(); - mockEnvironments = new MockEnvironments(); - mockIntents = new MockIntents(); - mockSessionEntityTypes = new MockSessionEntityTypes(); - mockSessions = new MockSessions(); - mockTransitionRouteGroups = new MockTransitionRouteGroups(); - mockVersions = new MockVersions(); - mockWebhooks = new MockWebhooks(); - serviceHelper = + mockServiceHelper = new MockServiceHelper( - UUID.randomUUID().toString(), - Arrays.asList( - mockPages, - mockFlows, - mockAgents, - mockEntityTypes, - mockEnvironments, - mockIntents, - mockSessionEntityTypes, - mockSessions, - mockTransitionRouteGroups, - mockVersions, - mockWebhooks)); - serviceHelper.start(); + UUID.randomUUID().toString(), Arrays.asList(mockFlows)); + mockServiceHelper.start(); } @AfterClass public static void stopServer() { - serviceHelper.stop(); + mockServiceHelper.stop(); } @Before public void setUp() throws IOException { - serviceHelper.reset(); - channelProvider = serviceHelper.createChannelProvider(); + mockServiceHelper.reset(); + channelProvider = mockServiceHelper.createChannelProvider(); FlowsSettings settings = FlowsSettings.newBuilder() .setTransportChannelProvider(channelProvider) @@ -116,16 +86,15 @@ public void tearDown() throws Exception { } @Test - @SuppressWarnings("all") - public void createFlowTest() { - FlowName name = FlowName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]"); - String displayName = "displayName1615086568"; - String description = "description-1724546052"; + public void createFlowTest() throws Exception { Flow expectedResponse = Flow.newBuilder() - .setName(name.toString()) - .setDisplayName(displayName) - .setDescription(description) + .setName(FlowName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]").toString()) + .setDisplayName("displayName1714148973") + .setDescription("description-1724546052") + .addAllTransitionRoutes(new ArrayList()) + .addAllEventHandlers(new ArrayList()) + .setNluSettings(NluSettings.newBuilder().build()) .build(); mockFlows.addResponse(expectedResponse); @@ -137,9 +106,9 @@ public void createFlowTest() { List actualRequests = mockFlows.getRequests(); Assert.assertEquals(1, actualRequests.size()); - CreateFlowRequest actualRequest = (CreateFlowRequest) actualRequests.get(0); + CreateFlowRequest actualRequest = ((CreateFlowRequest) actualRequests.get(0)); - Assert.assertEquals(parent, AgentName.parse(actualRequest.getParent())); + Assert.assertEquals(parent.toString(), actualRequest.getParent()); Assert.assertEquals(flow, actualRequest.getFlow()); Assert.assertTrue( channelProvider.isHeaderSent( @@ -148,25 +117,68 @@ public void createFlowTest() { } @Test - @SuppressWarnings("all") public void createFlowExceptionTest() throws Exception { - StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockFlows.addException(exception); try { AgentName parent = AgentName.of("[PROJECT]", "[LOCATION]", "[AGENT]"); Flow flow = Flow.newBuilder().build(); + client.createFlow(parent, flow); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void createFlowTest2() throws Exception { + Flow expectedResponse = + Flow.newBuilder() + .setName(FlowName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]").toString()) + .setDisplayName("displayName1714148973") + .setDescription("description-1724546052") + .addAllTransitionRoutes(new ArrayList()) + .addAllEventHandlers(new ArrayList()) + .setNluSettings(NluSettings.newBuilder().build()) + .build(); + mockFlows.addResponse(expectedResponse); + + String parent = "parent-995424086"; + Flow flow = Flow.newBuilder().build(); + Flow actualResponse = client.createFlow(parent, flow); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockFlows.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + CreateFlowRequest actualRequest = ((CreateFlowRequest) actualRequests.get(0)); + + Assert.assertEquals(parent, actualRequest.getParent()); + Assert.assertEquals(flow, actualRequest.getFlow()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void createFlowExceptionTest2() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockFlows.addException(exception); + + try { + String parent = "parent-995424086"; + Flow flow = Flow.newBuilder().build(); client.createFlow(parent, flow); Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { - // Expected exception + // Expected exception. } } @Test - @SuppressWarnings("all") - public void deleteFlowTest() { + public void deleteFlowTest() throws Exception { Empty expectedResponse = Empty.newBuilder().build(); mockFlows.addResponse(expectedResponse); @@ -176,9 +188,9 @@ public void deleteFlowTest() { List actualRequests = mockFlows.getRequests(); Assert.assertEquals(1, actualRequests.size()); - DeleteFlowRequest actualRequest = (DeleteFlowRequest) actualRequests.get(0); + DeleteFlowRequest actualRequest = ((DeleteFlowRequest) actualRequests.get(0)); - Assert.assertEquals(name, FlowName.parse(actualRequest.getName())); + Assert.assertEquals(name.toString(), actualRequest.getName()); Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), @@ -186,29 +198,61 @@ public void deleteFlowTest() { } @Test - @SuppressWarnings("all") public void deleteFlowExceptionTest() throws Exception { - StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockFlows.addException(exception); try { FlowName name = FlowName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]"); + client.deleteFlow(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + @Test + public void deleteFlowTest2() throws Exception { + Empty expectedResponse = Empty.newBuilder().build(); + mockFlows.addResponse(expectedResponse); + + String name = "name3373707"; + + client.deleteFlow(name); + + List actualRequests = mockFlows.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + DeleteFlowRequest actualRequest = ((DeleteFlowRequest) actualRequests.get(0)); + + Assert.assertEquals(name, actualRequest.getName()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void deleteFlowExceptionTest2() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockFlows.addException(exception); + + try { + String name = "name3373707"; client.deleteFlow(name); Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { - // Expected exception + // Expected exception. } } @Test - @SuppressWarnings("all") - public void listFlowsTest() { - String nextPageToken = ""; - Flow flowsElement = Flow.newBuilder().build(); - List flows = Arrays.asList(flowsElement); + public void listFlowsTest() throws Exception { + Flow responsesElement = Flow.newBuilder().build(); ListFlowsResponse expectedResponse = - ListFlowsResponse.newBuilder().setNextPageToken(nextPageToken).addAllFlows(flows).build(); + ListFlowsResponse.newBuilder() + .setNextPageToken("") + .addAllFlows(Arrays.asList(responsesElement)) + .build(); mockFlows.addResponse(expectedResponse); AgentName parent = AgentName.of("[PROJECT]", "[LOCATION]", "[AGENT]"); @@ -216,14 +260,15 @@ public void listFlowsTest() { ListFlowsPagedResponse pagedListResponse = client.listFlows(parent); List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + Assert.assertEquals(1, resources.size()); Assert.assertEquals(expectedResponse.getFlowsList().get(0), resources.get(0)); List actualRequests = mockFlows.getRequests(); Assert.assertEquals(1, actualRequests.size()); - ListFlowsRequest actualRequest = (ListFlowsRequest) actualRequests.get(0); + ListFlowsRequest actualRequest = ((ListFlowsRequest) actualRequests.get(0)); - Assert.assertEquals(parent, AgentName.parse(actualRequest.getParent())); + Assert.assertEquals(parent.toString(), actualRequest.getParent()); Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), @@ -231,32 +276,73 @@ public void listFlowsTest() { } @Test - @SuppressWarnings("all") public void listFlowsExceptionTest() throws Exception { - StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockFlows.addException(exception); try { AgentName parent = AgentName.of("[PROJECT]", "[LOCATION]", "[AGENT]"); + client.listFlows(parent); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void listFlowsTest2() throws Exception { + Flow responsesElement = Flow.newBuilder().build(); + ListFlowsResponse expectedResponse = + ListFlowsResponse.newBuilder() + .setNextPageToken("") + .addAllFlows(Arrays.asList(responsesElement)) + .build(); + mockFlows.addResponse(expectedResponse); + + String parent = "parent-995424086"; + + ListFlowsPagedResponse pagedListResponse = client.listFlows(parent); + + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getFlowsList().get(0), resources.get(0)); + + List actualRequests = mockFlows.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + ListFlowsRequest actualRequest = ((ListFlowsRequest) actualRequests.get(0)); + + Assert.assertEquals(parent, actualRequest.getParent()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + @Test + public void listFlowsExceptionTest2() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockFlows.addException(exception); + + try { + String parent = "parent-995424086"; client.listFlows(parent); Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { - // Expected exception + // Expected exception. } } @Test - @SuppressWarnings("all") - public void getFlowTest() { - FlowName name2 = FlowName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]"); - String displayName = "displayName1615086568"; - String description = "description-1724546052"; + public void getFlowTest() throws Exception { Flow expectedResponse = Flow.newBuilder() - .setName(name2.toString()) - .setDisplayName(displayName) - .setDescription(description) + .setName(FlowName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]").toString()) + .setDisplayName("displayName1714148973") + .setDescription("description-1724546052") + .addAllTransitionRoutes(new ArrayList()) + .addAllEventHandlers(new ArrayList()) + .setNluSettings(NluSettings.newBuilder().build()) .build(); mockFlows.addResponse(expectedResponse); @@ -267,9 +353,9 @@ public void getFlowTest() { List actualRequests = mockFlows.getRequests(); Assert.assertEquals(1, actualRequests.size()); - GetFlowRequest actualRequest = (GetFlowRequest) actualRequests.get(0); + GetFlowRequest actualRequest = ((GetFlowRequest) actualRequests.get(0)); - Assert.assertEquals(name, FlowName.parse(actualRequest.getName())); + Assert.assertEquals(name.toString(), actualRequest.getName()); Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), @@ -277,32 +363,72 @@ public void getFlowTest() { } @Test - @SuppressWarnings("all") public void getFlowExceptionTest() throws Exception { - StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockFlows.addException(exception); try { FlowName name = FlowName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]"); + client.getFlow(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + @Test + public void getFlowTest2() throws Exception { + Flow expectedResponse = + Flow.newBuilder() + .setName(FlowName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]").toString()) + .setDisplayName("displayName1714148973") + .setDescription("description-1724546052") + .addAllTransitionRoutes(new ArrayList()) + .addAllEventHandlers(new ArrayList()) + .setNluSettings(NluSettings.newBuilder().build()) + .build(); + mockFlows.addResponse(expectedResponse); + + String name = "name3373707"; + + Flow actualResponse = client.getFlow(name); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockFlows.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + GetFlowRequest actualRequest = ((GetFlowRequest) actualRequests.get(0)); + + Assert.assertEquals(name, actualRequest.getName()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void getFlowExceptionTest2() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockFlows.addException(exception); + + try { + String name = "name3373707"; client.getFlow(name); Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { - // Expected exception + // Expected exception. } } @Test - @SuppressWarnings("all") - public void updateFlowTest() { - FlowName name = FlowName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]"); - String displayName = "displayName1615086568"; - String description = "description-1724546052"; + public void updateFlowTest() throws Exception { Flow expectedResponse = Flow.newBuilder() - .setName(name.toString()) - .setDisplayName(displayName) - .setDescription(description) + .setName(FlowName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]").toString()) + .setDisplayName("displayName1714148973") + .setDescription("description-1724546052") + .addAllTransitionRoutes(new ArrayList()) + .addAllEventHandlers(new ArrayList()) + .setNluSettings(NluSettings.newBuilder().build()) .build(); mockFlows.addResponse(expectedResponse); @@ -314,7 +440,7 @@ public void updateFlowTest() { List actualRequests = mockFlows.getRequests(); Assert.assertEquals(1, actualRequests.size()); - UpdateFlowRequest actualRequest = (UpdateFlowRequest) actualRequests.get(0); + UpdateFlowRequest actualRequest = ((UpdateFlowRequest) actualRequests.get(0)); Assert.assertEquals(flow, actualRequest.getFlow()); Assert.assertEquals(updateMask, actualRequest.getUpdateMask()); @@ -325,24 +451,21 @@ public void updateFlowTest() { } @Test - @SuppressWarnings("all") public void updateFlowExceptionTest() throws Exception { - StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockFlows.addException(exception); try { Flow flow = Flow.newBuilder().build(); FieldMask updateMask = FieldMask.newBuilder().build(); - client.updateFlow(flow, updateMask); Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { - // Expected exception + // Expected exception. } } @Test - @SuppressWarnings("all") public void trainFlowTest() throws Exception { Empty expectedResponse = Empty.newBuilder().build(); Operation resultOperation = @@ -355,14 +478,13 @@ public void trainFlowTest() throws Exception { FlowName name = FlowName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]"); - Empty actualResponse = client.trainFlowAsync(name).get(); - Assert.assertEquals(expectedResponse, actualResponse); + client.trainFlowAsync(name).get(); List actualRequests = mockFlows.getRequests(); Assert.assertEquals(1, actualRequests.size()); - TrainFlowRequest actualRequest = (TrainFlowRequest) actualRequests.get(0); + TrainFlowRequest actualRequest = ((TrainFlowRequest) actualRequests.get(0)); - Assert.assertEquals(name, FlowName.parse(actualRequest.getName())); + Assert.assertEquals(name.toString(), actualRequest.getName()); Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), @@ -370,19 +492,59 @@ public void trainFlowTest() throws Exception { } @Test - @SuppressWarnings("all") public void trainFlowExceptionTest() throws Exception { - StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockFlows.addException(exception); try { FlowName name = FlowName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]"); + client.trainFlowAsync(name).get(); + Assert.fail("No exception raised"); + } catch (ExecutionException e) { + Assert.assertEquals(InvalidArgumentException.class, e.getCause().getClass()); + InvalidArgumentException apiException = ((InvalidArgumentException) e.getCause()); + Assert.assertEquals(StatusCode.Code.INVALID_ARGUMENT, apiException.getStatusCode().getCode()); + } + } + + @Test + public void trainFlowTest2() throws Exception { + Empty expectedResponse = Empty.newBuilder().build(); + Operation resultOperation = + Operation.newBuilder() + .setName("trainFlowTest") + .setDone(true) + .setResponse(Any.pack(expectedResponse)) + .build(); + mockFlows.addResponse(resultOperation); + + String name = "name3373707"; + client.trainFlowAsync(name).get(); + + List actualRequests = mockFlows.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + TrainFlowRequest actualRequest = ((TrainFlowRequest) actualRequests.get(0)); + + Assert.assertEquals(name, actualRequest.getName()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void trainFlowExceptionTest2() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockFlows.addException(exception); + + try { + String name = "name3373707"; client.trainFlowAsync(name).get(); Assert.fail("No exception raised"); } catch (ExecutionException e) { Assert.assertEquals(InvalidArgumentException.class, e.getCause().getClass()); - InvalidArgumentException apiException = (InvalidArgumentException) e.getCause(); + InvalidArgumentException apiException = ((InvalidArgumentException) e.getCause()); Assert.assertEquals(StatusCode.Code.INVALID_ARGUMENT, apiException.getStatusCode().getCode()); } } diff --git a/google-cloud-dialogflow-cx/src/test/java/com/google/cloud/dialogflow/cx/v3beta1/IntentsClientTest.java b/google-cloud-dialogflow-cx/src/test/java/com/google/cloud/dialogflow/cx/v3beta1/IntentsClientTest.java index 0446038fc..60452c8e9 100644 --- a/google-cloud-dialogflow-cx/src/test/java/com/google/cloud/dialogflow/cx/v3beta1/IntentsClientTest.java +++ b/google-cloud-dialogflow-cx/src/test/java/com/google/cloud/dialogflow/cx/v3beta1/IntentsClientTest.java @@ -5,7 +5,7 @@ * 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 + * 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, @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.google.cloud.dialogflow.cx.v3beta1; import static com.google.cloud.dialogflow.cx.v3beta1.IntentsClient.ListIntentsPagedResponse; @@ -28,12 +29,14 @@ import com.google.protobuf.AbstractMessage; import com.google.protobuf.Empty; import com.google.protobuf.FieldMask; -import io.grpc.Status; 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; import org.junit.After; import org.junit.AfterClass; import org.junit.Assert; @@ -41,63 +44,31 @@ import org.junit.BeforeClass; import org.junit.Test; -@javax.annotation.Generated("by GAPIC") +@Generated("by gapic-generator-java") public class IntentsClientTest { - private static MockPages mockPages; - private static MockFlows mockFlows; - private static MockAgents mockAgents; - private static MockEntityTypes mockEntityTypes; - private static MockEnvironments mockEnvironments; + private static MockServiceHelper mockServiceHelper; private static MockIntents mockIntents; - private static MockSessionEntityTypes mockSessionEntityTypes; - private static MockSessions mockSessions; - private static MockTransitionRouteGroups mockTransitionRouteGroups; - private static MockVersions mockVersions; - private static MockWebhooks mockWebhooks; - private static MockServiceHelper serviceHelper; private IntentsClient client; private LocalChannelProvider channelProvider; @BeforeClass public static void startStaticServer() { - mockPages = new MockPages(); - mockFlows = new MockFlows(); - mockAgents = new MockAgents(); - mockEntityTypes = new MockEntityTypes(); - mockEnvironments = new MockEnvironments(); mockIntents = new MockIntents(); - mockSessionEntityTypes = new MockSessionEntityTypes(); - mockSessions = new MockSessions(); - mockTransitionRouteGroups = new MockTransitionRouteGroups(); - mockVersions = new MockVersions(); - mockWebhooks = new MockWebhooks(); - serviceHelper = + mockServiceHelper = new MockServiceHelper( - UUID.randomUUID().toString(), - Arrays.asList( - mockPages, - mockFlows, - mockAgents, - mockEntityTypes, - mockEnvironments, - mockIntents, - mockSessionEntityTypes, - mockSessions, - mockTransitionRouteGroups, - mockVersions, - mockWebhooks)); - serviceHelper.start(); + UUID.randomUUID().toString(), Arrays.asList(mockIntents)); + mockServiceHelper.start(); } @AfterClass public static void stopServer() { - serviceHelper.stop(); + mockServiceHelper.stop(); } @Before public void setUp() throws IOException { - serviceHelper.reset(); - channelProvider = serviceHelper.createChannelProvider(); + mockServiceHelper.reset(); + channelProvider = mockServiceHelper.createChannelProvider(); IntentsSettings settings = IntentsSettings.newBuilder() .setTransportChannelProvider(channelProvider) @@ -112,15 +83,12 @@ public void tearDown() throws Exception { } @Test - @SuppressWarnings("all") - public void listIntentsTest() { - String nextPageToken = ""; - Intent intentsElement = Intent.newBuilder().build(); - List intents = Arrays.asList(intentsElement); + public void listIntentsTest() throws Exception { + Intent responsesElement = Intent.newBuilder().build(); ListIntentsResponse expectedResponse = ListIntentsResponse.newBuilder() - .setNextPageToken(nextPageToken) - .addAllIntents(intents) + .setNextPageToken("") + .addAllIntents(Arrays.asList(responsesElement)) .build(); mockIntents.addResponse(expectedResponse); @@ -129,14 +97,15 @@ public void listIntentsTest() { ListIntentsPagedResponse pagedListResponse = client.listIntents(parent); List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + Assert.assertEquals(1, resources.size()); Assert.assertEquals(expectedResponse.getIntentsList().get(0), resources.get(0)); List actualRequests = mockIntents.getRequests(); Assert.assertEquals(1, actualRequests.size()); - ListIntentsRequest actualRequest = (ListIntentsRequest) actualRequests.get(0); + ListIntentsRequest actualRequest = ((ListIntentsRequest) actualRequests.get(0)); - Assert.assertEquals(parent, AgentName.parse(actualRequest.getParent())); + Assert.assertEquals(parent.toString(), actualRequest.getParent()); Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), @@ -144,36 +113,75 @@ public void listIntentsTest() { } @Test - @SuppressWarnings("all") public void listIntentsExceptionTest() throws Exception { - StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockIntents.addException(exception); try { AgentName parent = AgentName.of("[PROJECT]", "[LOCATION]", "[AGENT]"); + client.listIntents(parent); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void listIntentsTest2() throws Exception { + Intent responsesElement = Intent.newBuilder().build(); + ListIntentsResponse expectedResponse = + ListIntentsResponse.newBuilder() + .setNextPageToken("") + .addAllIntents(Arrays.asList(responsesElement)) + .build(); + mockIntents.addResponse(expectedResponse); + + String parent = "parent-995424086"; + + ListIntentsPagedResponse pagedListResponse = client.listIntents(parent); + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getIntentsList().get(0), resources.get(0)); + + List actualRequests = mockIntents.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + ListIntentsRequest actualRequest = ((ListIntentsRequest) actualRequests.get(0)); + + Assert.assertEquals(parent, actualRequest.getParent()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void listIntentsExceptionTest2() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockIntents.addException(exception); + + try { + String parent = "parent-995424086"; client.listIntents(parent); Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { - // Expected exception + // Expected exception. } } @Test - @SuppressWarnings("all") - public void getIntentTest() { - IntentName name2 = IntentName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[INTENT]"); - String displayName = "displayName1615086568"; - int priority = 1165461084; - boolean isFallback = false; - String description = "description-1724546052"; + public void getIntentTest() throws Exception { Intent expectedResponse = Intent.newBuilder() - .setName(name2.toString()) - .setDisplayName(displayName) - .setPriority(priority) - .setIsFallback(isFallback) - .setDescription(description) + .setName(IntentName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[INTENT]").toString()) + .setDisplayName("displayName1714148973") + .addAllTrainingPhrases(new ArrayList()) + .addAllParameters(new ArrayList()) + .setPriority(-1165461084) + .setIsFallback(true) + .putAllLabels(new HashMap()) + .setDescription("description-1724546052") .build(); mockIntents.addResponse(expectedResponse); @@ -184,9 +192,9 @@ public void getIntentTest() { List actualRequests = mockIntents.getRequests(); Assert.assertEquals(1, actualRequests.size()); - GetIntentRequest actualRequest = (GetIntentRequest) actualRequests.get(0); + GetIntentRequest actualRequest = ((GetIntentRequest) actualRequests.get(0)); - Assert.assertEquals(name, IntentName.parse(actualRequest.getName())); + Assert.assertEquals(name.toString(), actualRequest.getName()); Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), @@ -194,36 +202,76 @@ public void getIntentTest() { } @Test - @SuppressWarnings("all") public void getIntentExceptionTest() throws Exception { - StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockIntents.addException(exception); try { IntentName name = IntentName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[INTENT]"); + client.getIntent(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void getIntentTest2() throws Exception { + Intent expectedResponse = + Intent.newBuilder() + .setName(IntentName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[INTENT]").toString()) + .setDisplayName("displayName1714148973") + .addAllTrainingPhrases(new ArrayList()) + .addAllParameters(new ArrayList()) + .setPriority(-1165461084) + .setIsFallback(true) + .putAllLabels(new HashMap()) + .setDescription("description-1724546052") + .build(); + mockIntents.addResponse(expectedResponse); + + String name = "name3373707"; + + Intent actualResponse = client.getIntent(name); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockIntents.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + GetIntentRequest actualRequest = ((GetIntentRequest) actualRequests.get(0)); + + Assert.assertEquals(name, actualRequest.getName()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void getIntentExceptionTest2() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockIntents.addException(exception); + try { + String name = "name3373707"; client.getIntent(name); Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { - // Expected exception + // Expected exception. } } @Test - @SuppressWarnings("all") - public void createIntentTest() { - IntentName name = IntentName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[INTENT]"); - String displayName = "displayName1615086568"; - int priority = 1165461084; - boolean isFallback = false; - String description = "description-1724546052"; + public void createIntentTest() throws Exception { Intent expectedResponse = Intent.newBuilder() - .setName(name.toString()) - .setDisplayName(displayName) - .setPriority(priority) - .setIsFallback(isFallback) - .setDescription(description) + .setName(IntentName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[INTENT]").toString()) + .setDisplayName("displayName1714148973") + .addAllTrainingPhrases(new ArrayList()) + .addAllParameters(new ArrayList()) + .setPriority(-1165461084) + .setIsFallback(true) + .putAllLabels(new HashMap()) + .setDescription("description-1724546052") .build(); mockIntents.addResponse(expectedResponse); @@ -235,9 +283,9 @@ public void createIntentTest() { List actualRequests = mockIntents.getRequests(); Assert.assertEquals(1, actualRequests.size()); - CreateIntentRequest actualRequest = (CreateIntentRequest) actualRequests.get(0); + CreateIntentRequest actualRequest = ((CreateIntentRequest) actualRequests.get(0)); - Assert.assertEquals(parent, AgentName.parse(actualRequest.getParent())); + Assert.assertEquals(parent.toString(), actualRequest.getParent()); Assert.assertEquals(intent, actualRequest.getIntent()); Assert.assertTrue( channelProvider.isHeaderSent( @@ -246,37 +294,80 @@ public void createIntentTest() { } @Test - @SuppressWarnings("all") public void createIntentExceptionTest() throws Exception { - StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockIntents.addException(exception); try { AgentName parent = AgentName.of("[PROJECT]", "[LOCATION]", "[AGENT]"); Intent intent = Intent.newBuilder().build(); + client.createIntent(parent, intent); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void createIntentTest2() throws Exception { + Intent expectedResponse = + Intent.newBuilder() + .setName(IntentName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[INTENT]").toString()) + .setDisplayName("displayName1714148973") + .addAllTrainingPhrases(new ArrayList()) + .addAllParameters(new ArrayList()) + .setPriority(-1165461084) + .setIsFallback(true) + .putAllLabels(new HashMap()) + .setDescription("description-1724546052") + .build(); + mockIntents.addResponse(expectedResponse); + + String parent = "parent-995424086"; + Intent intent = Intent.newBuilder().build(); + + Intent actualResponse = client.createIntent(parent, intent); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockIntents.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + CreateIntentRequest actualRequest = ((CreateIntentRequest) actualRequests.get(0)); + + Assert.assertEquals(parent, actualRequest.getParent()); + Assert.assertEquals(intent, actualRequest.getIntent()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void createIntentExceptionTest2() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockIntents.addException(exception); + try { + String parent = "parent-995424086"; + Intent intent = Intent.newBuilder().build(); client.createIntent(parent, intent); Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { - // Expected exception + // Expected exception. } } @Test - @SuppressWarnings("all") - public void updateIntentTest() { - IntentName name = IntentName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[INTENT]"); - String displayName = "displayName1615086568"; - int priority = 1165461084; - boolean isFallback = false; - String description = "description-1724546052"; + public void updateIntentTest() throws Exception { Intent expectedResponse = Intent.newBuilder() - .setName(name.toString()) - .setDisplayName(displayName) - .setPriority(priority) - .setIsFallback(isFallback) - .setDescription(description) + .setName(IntentName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[INTENT]").toString()) + .setDisplayName("displayName1714148973") + .addAllTrainingPhrases(new ArrayList()) + .addAllParameters(new ArrayList()) + .setPriority(-1165461084) + .setIsFallback(true) + .putAllLabels(new HashMap()) + .setDescription("description-1724546052") .build(); mockIntents.addResponse(expectedResponse); @@ -288,7 +379,7 @@ public void updateIntentTest() { List actualRequests = mockIntents.getRequests(); Assert.assertEquals(1, actualRequests.size()); - UpdateIntentRequest actualRequest = (UpdateIntentRequest) actualRequests.get(0); + UpdateIntentRequest actualRequest = ((UpdateIntentRequest) actualRequests.get(0)); Assert.assertEquals(intent, actualRequest.getIntent()); Assert.assertEquals(updateMask, actualRequest.getUpdateMask()); @@ -299,25 +390,22 @@ public void updateIntentTest() { } @Test - @SuppressWarnings("all") public void updateIntentExceptionTest() throws Exception { - StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockIntents.addException(exception); try { Intent intent = Intent.newBuilder().build(); FieldMask updateMask = FieldMask.newBuilder().build(); - client.updateIntent(intent, updateMask); Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { - // Expected exception + // Expected exception. } } @Test - @SuppressWarnings("all") - public void deleteIntentTest() { + public void deleteIntentTest() throws Exception { Empty expectedResponse = Empty.newBuilder().build(); mockIntents.addResponse(expectedResponse); @@ -327,9 +415,9 @@ public void deleteIntentTest() { List actualRequests = mockIntents.getRequests(); Assert.assertEquals(1, actualRequests.size()); - DeleteIntentRequest actualRequest = (DeleteIntentRequest) actualRequests.get(0); + DeleteIntentRequest actualRequest = ((DeleteIntentRequest) actualRequests.get(0)); - Assert.assertEquals(name, IntentName.parse(actualRequest.getName())); + Assert.assertEquals(name.toString(), actualRequest.getName()); Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), @@ -337,18 +425,50 @@ public void deleteIntentTest() { } @Test - @SuppressWarnings("all") public void deleteIntentExceptionTest() throws Exception { - StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockIntents.addException(exception); try { IntentName name = IntentName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[INTENT]"); + client.deleteIntent(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void deleteIntentTest2() throws Exception { + Empty expectedResponse = Empty.newBuilder().build(); + mockIntents.addResponse(expectedResponse); + + String name = "name3373707"; + client.deleteIntent(name); + + List actualRequests = mockIntents.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + DeleteIntentRequest actualRequest = ((DeleteIntentRequest) actualRequests.get(0)); + + Assert.assertEquals(name, actualRequest.getName()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void deleteIntentExceptionTest2() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockIntents.addException(exception); + + try { + String name = "name3373707"; client.deleteIntent(name); Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { - // Expected exception + // Expected exception. } } } diff --git a/google-cloud-dialogflow-cx/src/test/java/com/google/cloud/dialogflow/cx/v3beta1/MockAgents.java b/google-cloud-dialogflow-cx/src/test/java/com/google/cloud/dialogflow/cx/v3beta1/MockAgents.java index 740ffe3e5..ebec1fd5e 100644 --- a/google-cloud-dialogflow-cx/src/test/java/com/google/cloud/dialogflow/cx/v3beta1/MockAgents.java +++ b/google-cloud-dialogflow-cx/src/test/java/com/google/cloud/dialogflow/cx/v3beta1/MockAgents.java @@ -5,7 +5,7 @@ * 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 + * 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, @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.google.cloud.dialogflow.cx.v3beta1; import com.google.api.core.BetaApi; @@ -20,9 +21,10 @@ import com.google.protobuf.AbstractMessage; import io.grpc.ServerServiceDefinition; import java.util.List; +import javax.annotation.Generated; -@javax.annotation.Generated("by GAPIC") @BetaApi +@Generated("by gapic-generator-java") public class MockAgents implements MockGrpcService { private final MockAgentsImpl serviceImpl; diff --git a/google-cloud-dialogflow-cx/src/test/java/com/google/cloud/dialogflow/cx/v3beta1/MockAgentsImpl.java b/google-cloud-dialogflow-cx/src/test/java/com/google/cloud/dialogflow/cx/v3beta1/MockAgentsImpl.java index e500b3ac8..491a3fa1a 100644 --- a/google-cloud-dialogflow-cx/src/test/java/com/google/cloud/dialogflow/cx/v3beta1/MockAgentsImpl.java +++ b/google-cloud-dialogflow-cx/src/test/java/com/google/cloud/dialogflow/cx/v3beta1/MockAgentsImpl.java @@ -5,7 +5,7 @@ * 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 + * 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, @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.google.cloud.dialogflow.cx.v3beta1; import com.google.api.core.BetaApi; @@ -25,9 +26,10 @@ import java.util.LinkedList; import java.util.List; import java.util.Queue; +import javax.annotation.Generated; -@javax.annotation.Generated("by GAPIC") @BetaApi +@Generated("by gapic-generator-java") public class MockAgentsImpl extends AgentsImplBase { private List requests; private Queue responses; @@ -64,10 +66,10 @@ public void listAgents( Object response = responses.remove(); if (response instanceof ListAgentsResponse) { requests.add(request); - responseObserver.onNext((ListAgentsResponse) response); + responseObserver.onNext(((ListAgentsResponse) response)); responseObserver.onCompleted(); } else if (response instanceof Exception) { - responseObserver.onError((Exception) response); + responseObserver.onError(((Exception) response)); } else { responseObserver.onError(new IllegalArgumentException("Unrecognized response type")); } @@ -78,10 +80,10 @@ public void getAgent(GetAgentRequest request, StreamObserver responseObse Object response = responses.remove(); if (response instanceof Agent) { requests.add(request); - responseObserver.onNext((Agent) response); + responseObserver.onNext(((Agent) response)); responseObserver.onCompleted(); } else if (response instanceof Exception) { - responseObserver.onError((Exception) response); + responseObserver.onError(((Exception) response)); } else { responseObserver.onError(new IllegalArgumentException("Unrecognized response type")); } @@ -92,10 +94,10 @@ public void createAgent(CreateAgentRequest request, StreamObserver respon Object response = responses.remove(); if (response instanceof Agent) { requests.add(request); - responseObserver.onNext((Agent) response); + responseObserver.onNext(((Agent) response)); responseObserver.onCompleted(); } else if (response instanceof Exception) { - responseObserver.onError((Exception) response); + responseObserver.onError(((Exception) response)); } else { responseObserver.onError(new IllegalArgumentException("Unrecognized response type")); } @@ -106,10 +108,10 @@ public void updateAgent(UpdateAgentRequest request, StreamObserver respon Object response = responses.remove(); if (response instanceof Agent) { requests.add(request); - responseObserver.onNext((Agent) response); + responseObserver.onNext(((Agent) response)); responseObserver.onCompleted(); } else if (response instanceof Exception) { - responseObserver.onError((Exception) response); + responseObserver.onError(((Exception) response)); } else { responseObserver.onError(new IllegalArgumentException("Unrecognized response type")); } @@ -120,10 +122,10 @@ public void deleteAgent(DeleteAgentRequest request, StreamObserver respon Object response = responses.remove(); if (response instanceof Empty) { requests.add(request); - responseObserver.onNext((Empty) response); + responseObserver.onNext(((Empty) response)); responseObserver.onCompleted(); } else if (response instanceof Exception) { - responseObserver.onError((Exception) response); + responseObserver.onError(((Exception) response)); } else { responseObserver.onError(new IllegalArgumentException("Unrecognized response type")); } @@ -134,10 +136,10 @@ public void exportAgent(ExportAgentRequest request, StreamObserver re Object response = responses.remove(); if (response instanceof Operation) { requests.add(request); - responseObserver.onNext((Operation) response); + responseObserver.onNext(((Operation) response)); responseObserver.onCompleted(); } else if (response instanceof Exception) { - responseObserver.onError((Exception) response); + responseObserver.onError(((Exception) response)); } else { responseObserver.onError(new IllegalArgumentException("Unrecognized response type")); } @@ -149,10 +151,10 @@ public void restoreAgent( Object response = responses.remove(); if (response instanceof Operation) { requests.add(request); - responseObserver.onNext((Operation) response); + responseObserver.onNext(((Operation) response)); responseObserver.onCompleted(); } else if (response instanceof Exception) { - responseObserver.onError((Exception) response); + responseObserver.onError(((Exception) response)); } else { responseObserver.onError(new IllegalArgumentException("Unrecognized response type")); } diff --git a/google-cloud-dialogflow-cx/src/test/java/com/google/cloud/dialogflow/cx/v3beta1/MockEntityTypes.java b/google-cloud-dialogflow-cx/src/test/java/com/google/cloud/dialogflow/cx/v3beta1/MockEntityTypes.java index a326826ab..71fa21cc6 100644 --- a/google-cloud-dialogflow-cx/src/test/java/com/google/cloud/dialogflow/cx/v3beta1/MockEntityTypes.java +++ b/google-cloud-dialogflow-cx/src/test/java/com/google/cloud/dialogflow/cx/v3beta1/MockEntityTypes.java @@ -5,7 +5,7 @@ * 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 + * 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, @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.google.cloud.dialogflow.cx.v3beta1; import com.google.api.core.BetaApi; @@ -20,9 +21,10 @@ import com.google.protobuf.AbstractMessage; import io.grpc.ServerServiceDefinition; import java.util.List; +import javax.annotation.Generated; -@javax.annotation.Generated("by GAPIC") @BetaApi +@Generated("by gapic-generator-java") public class MockEntityTypes implements MockGrpcService { private final MockEntityTypesImpl serviceImpl; diff --git a/google-cloud-dialogflow-cx/src/test/java/com/google/cloud/dialogflow/cx/v3beta1/MockEntityTypesImpl.java b/google-cloud-dialogflow-cx/src/test/java/com/google/cloud/dialogflow/cx/v3beta1/MockEntityTypesImpl.java index 6fddd9790..a3a1b6bf9 100644 --- a/google-cloud-dialogflow-cx/src/test/java/com/google/cloud/dialogflow/cx/v3beta1/MockEntityTypesImpl.java +++ b/google-cloud-dialogflow-cx/src/test/java/com/google/cloud/dialogflow/cx/v3beta1/MockEntityTypesImpl.java @@ -5,7 +5,7 @@ * 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 + * 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, @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.google.cloud.dialogflow.cx.v3beta1; import com.google.api.core.BetaApi; @@ -24,9 +25,10 @@ import java.util.LinkedList; import java.util.List; import java.util.Queue; +import javax.annotation.Generated; -@javax.annotation.Generated("by GAPIC") @BetaApi +@Generated("by gapic-generator-java") public class MockEntityTypesImpl extends EntityTypesImplBase { private List requests; private Queue responses; @@ -63,10 +65,10 @@ public void listEntityTypes( Object response = responses.remove(); if (response instanceof ListEntityTypesResponse) { requests.add(request); - responseObserver.onNext((ListEntityTypesResponse) response); + responseObserver.onNext(((ListEntityTypesResponse) response)); responseObserver.onCompleted(); } else if (response instanceof Exception) { - responseObserver.onError((Exception) response); + responseObserver.onError(((Exception) response)); } else { responseObserver.onError(new IllegalArgumentException("Unrecognized response type")); } @@ -78,10 +80,10 @@ public void getEntityType( Object response = responses.remove(); if (response instanceof EntityType) { requests.add(request); - responseObserver.onNext((EntityType) response); + responseObserver.onNext(((EntityType) response)); responseObserver.onCompleted(); } else if (response instanceof Exception) { - responseObserver.onError((Exception) response); + responseObserver.onError(((Exception) response)); } else { responseObserver.onError(new IllegalArgumentException("Unrecognized response type")); } @@ -93,10 +95,10 @@ public void createEntityType( Object response = responses.remove(); if (response instanceof EntityType) { requests.add(request); - responseObserver.onNext((EntityType) response); + responseObserver.onNext(((EntityType) response)); responseObserver.onCompleted(); } else if (response instanceof Exception) { - responseObserver.onError((Exception) response); + responseObserver.onError(((Exception) response)); } else { responseObserver.onError(new IllegalArgumentException("Unrecognized response type")); } @@ -108,10 +110,10 @@ public void updateEntityType( Object response = responses.remove(); if (response instanceof EntityType) { requests.add(request); - responseObserver.onNext((EntityType) response); + responseObserver.onNext(((EntityType) response)); responseObserver.onCompleted(); } else if (response instanceof Exception) { - responseObserver.onError((Exception) response); + responseObserver.onError(((Exception) response)); } else { responseObserver.onError(new IllegalArgumentException("Unrecognized response type")); } @@ -123,10 +125,10 @@ public void deleteEntityType( Object response = responses.remove(); if (response instanceof Empty) { requests.add(request); - responseObserver.onNext((Empty) response); + responseObserver.onNext(((Empty) response)); responseObserver.onCompleted(); } else if (response instanceof Exception) { - responseObserver.onError((Exception) response); + responseObserver.onError(((Exception) response)); } else { responseObserver.onError(new IllegalArgumentException("Unrecognized response type")); } diff --git a/google-cloud-dialogflow-cx/src/test/java/com/google/cloud/dialogflow/cx/v3beta1/MockEnvironments.java b/google-cloud-dialogflow-cx/src/test/java/com/google/cloud/dialogflow/cx/v3beta1/MockEnvironments.java index 5c5888ec7..b3a0d7340 100644 --- a/google-cloud-dialogflow-cx/src/test/java/com/google/cloud/dialogflow/cx/v3beta1/MockEnvironments.java +++ b/google-cloud-dialogflow-cx/src/test/java/com/google/cloud/dialogflow/cx/v3beta1/MockEnvironments.java @@ -5,7 +5,7 @@ * 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 + * 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, @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.google.cloud.dialogflow.cx.v3beta1; import com.google.api.core.BetaApi; @@ -20,9 +21,10 @@ import com.google.protobuf.AbstractMessage; import io.grpc.ServerServiceDefinition; import java.util.List; +import javax.annotation.Generated; -@javax.annotation.Generated("by GAPIC") @BetaApi +@Generated("by gapic-generator-java") public class MockEnvironments implements MockGrpcService { private final MockEnvironmentsImpl serviceImpl; diff --git a/google-cloud-dialogflow-cx/src/test/java/com/google/cloud/dialogflow/cx/v3beta1/MockEnvironmentsImpl.java b/google-cloud-dialogflow-cx/src/test/java/com/google/cloud/dialogflow/cx/v3beta1/MockEnvironmentsImpl.java index 2eb17cdd5..9c2b763b9 100644 --- a/google-cloud-dialogflow-cx/src/test/java/com/google/cloud/dialogflow/cx/v3beta1/MockEnvironmentsImpl.java +++ b/google-cloud-dialogflow-cx/src/test/java/com/google/cloud/dialogflow/cx/v3beta1/MockEnvironmentsImpl.java @@ -5,7 +5,7 @@ * 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 + * 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, @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.google.cloud.dialogflow.cx.v3beta1; import com.google.api.core.BetaApi; @@ -25,9 +26,10 @@ import java.util.LinkedList; import java.util.List; import java.util.Queue; +import javax.annotation.Generated; -@javax.annotation.Generated("by GAPIC") @BetaApi +@Generated("by gapic-generator-java") public class MockEnvironmentsImpl extends EnvironmentsImplBase { private List requests; private Queue responses; @@ -64,10 +66,10 @@ public void listEnvironments( Object response = responses.remove(); if (response instanceof ListEnvironmentsResponse) { requests.add(request); - responseObserver.onNext((ListEnvironmentsResponse) response); + responseObserver.onNext(((ListEnvironmentsResponse) response)); responseObserver.onCompleted(); } else if (response instanceof Exception) { - responseObserver.onError((Exception) response); + responseObserver.onError(((Exception) response)); } else { responseObserver.onError(new IllegalArgumentException("Unrecognized response type")); } @@ -79,10 +81,10 @@ public void getEnvironment( Object response = responses.remove(); if (response instanceof Environment) { requests.add(request); - responseObserver.onNext((Environment) response); + responseObserver.onNext(((Environment) response)); responseObserver.onCompleted(); } else if (response instanceof Exception) { - responseObserver.onError((Exception) response); + responseObserver.onError(((Exception) response)); } else { responseObserver.onError(new IllegalArgumentException("Unrecognized response type")); } @@ -94,10 +96,10 @@ public void createEnvironment( Object response = responses.remove(); if (response instanceof Operation) { requests.add(request); - responseObserver.onNext((Operation) response); + responseObserver.onNext(((Operation) response)); responseObserver.onCompleted(); } else if (response instanceof Exception) { - responseObserver.onError((Exception) response); + responseObserver.onError(((Exception) response)); } else { responseObserver.onError(new IllegalArgumentException("Unrecognized response type")); } @@ -109,10 +111,10 @@ public void updateEnvironment( Object response = responses.remove(); if (response instanceof Operation) { requests.add(request); - responseObserver.onNext((Operation) response); + responseObserver.onNext(((Operation) response)); responseObserver.onCompleted(); } else if (response instanceof Exception) { - responseObserver.onError((Exception) response); + responseObserver.onError(((Exception) response)); } else { responseObserver.onError(new IllegalArgumentException("Unrecognized response type")); } @@ -124,10 +126,10 @@ public void deleteEnvironment( Object response = responses.remove(); if (response instanceof Empty) { requests.add(request); - responseObserver.onNext((Empty) response); + responseObserver.onNext(((Empty) response)); responseObserver.onCompleted(); } else if (response instanceof Exception) { - responseObserver.onError((Exception) response); + responseObserver.onError(((Exception) response)); } else { responseObserver.onError(new IllegalArgumentException("Unrecognized response type")); } @@ -140,10 +142,10 @@ public void lookupEnvironmentHistory( Object response = responses.remove(); if (response instanceof LookupEnvironmentHistoryResponse) { requests.add(request); - responseObserver.onNext((LookupEnvironmentHistoryResponse) response); + responseObserver.onNext(((LookupEnvironmentHistoryResponse) response)); responseObserver.onCompleted(); } else if (response instanceof Exception) { - responseObserver.onError((Exception) response); + responseObserver.onError(((Exception) response)); } else { responseObserver.onError(new IllegalArgumentException("Unrecognized response type")); } diff --git a/google-cloud-dialogflow-cx/src/test/java/com/google/cloud/dialogflow/cx/v3beta1/MockFlows.java b/google-cloud-dialogflow-cx/src/test/java/com/google/cloud/dialogflow/cx/v3beta1/MockFlows.java index 01fed1242..918810d94 100644 --- a/google-cloud-dialogflow-cx/src/test/java/com/google/cloud/dialogflow/cx/v3beta1/MockFlows.java +++ b/google-cloud-dialogflow-cx/src/test/java/com/google/cloud/dialogflow/cx/v3beta1/MockFlows.java @@ -5,7 +5,7 @@ * 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 + * 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, @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.google.cloud.dialogflow.cx.v3beta1; import com.google.api.core.BetaApi; @@ -20,9 +21,10 @@ import com.google.protobuf.AbstractMessage; import io.grpc.ServerServiceDefinition; import java.util.List; +import javax.annotation.Generated; -@javax.annotation.Generated("by GAPIC") @BetaApi +@Generated("by gapic-generator-java") public class MockFlows implements MockGrpcService { private final MockFlowsImpl serviceImpl; diff --git a/google-cloud-dialogflow-cx/src/test/java/com/google/cloud/dialogflow/cx/v3beta1/MockFlowsImpl.java b/google-cloud-dialogflow-cx/src/test/java/com/google/cloud/dialogflow/cx/v3beta1/MockFlowsImpl.java index 5f81de1df..ab7b52e81 100644 --- a/google-cloud-dialogflow-cx/src/test/java/com/google/cloud/dialogflow/cx/v3beta1/MockFlowsImpl.java +++ b/google-cloud-dialogflow-cx/src/test/java/com/google/cloud/dialogflow/cx/v3beta1/MockFlowsImpl.java @@ -5,7 +5,7 @@ * 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 + * 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, @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.google.cloud.dialogflow.cx.v3beta1; import com.google.api.core.BetaApi; @@ -25,9 +26,10 @@ import java.util.LinkedList; import java.util.List; import java.util.Queue; +import javax.annotation.Generated; -@javax.annotation.Generated("by GAPIC") @BetaApi +@Generated("by gapic-generator-java") public class MockFlowsImpl extends FlowsImplBase { private List requests; private Queue responses; @@ -63,10 +65,10 @@ public void createFlow(CreateFlowRequest request, StreamObserver responseO Object response = responses.remove(); if (response instanceof Flow) { requests.add(request); - responseObserver.onNext((Flow) response); + responseObserver.onNext(((Flow) response)); responseObserver.onCompleted(); } else if (response instanceof Exception) { - responseObserver.onError((Exception) response); + responseObserver.onError(((Exception) response)); } else { responseObserver.onError(new IllegalArgumentException("Unrecognized response type")); } @@ -77,10 +79,10 @@ public void deleteFlow(DeleteFlowRequest request, StreamObserver response Object response = responses.remove(); if (response instanceof Empty) { requests.add(request); - responseObserver.onNext((Empty) response); + responseObserver.onNext(((Empty) response)); responseObserver.onCompleted(); } else if (response instanceof Exception) { - responseObserver.onError((Exception) response); + responseObserver.onError(((Exception) response)); } else { responseObserver.onError(new IllegalArgumentException("Unrecognized response type")); } @@ -92,10 +94,10 @@ public void listFlows( Object response = responses.remove(); if (response instanceof ListFlowsResponse) { requests.add(request); - responseObserver.onNext((ListFlowsResponse) response); + responseObserver.onNext(((ListFlowsResponse) response)); responseObserver.onCompleted(); } else if (response instanceof Exception) { - responseObserver.onError((Exception) response); + responseObserver.onError(((Exception) response)); } else { responseObserver.onError(new IllegalArgumentException("Unrecognized response type")); } @@ -106,10 +108,10 @@ public void getFlow(GetFlowRequest request, StreamObserver responseObserve Object response = responses.remove(); if (response instanceof Flow) { requests.add(request); - responseObserver.onNext((Flow) response); + responseObserver.onNext(((Flow) response)); responseObserver.onCompleted(); } else if (response instanceof Exception) { - responseObserver.onError((Exception) response); + responseObserver.onError(((Exception) response)); } else { responseObserver.onError(new IllegalArgumentException("Unrecognized response type")); } @@ -120,10 +122,10 @@ public void updateFlow(UpdateFlowRequest request, StreamObserver responseO Object response = responses.remove(); if (response instanceof Flow) { requests.add(request); - responseObserver.onNext((Flow) response); + responseObserver.onNext(((Flow) response)); responseObserver.onCompleted(); } else if (response instanceof Exception) { - responseObserver.onError((Exception) response); + responseObserver.onError(((Exception) response)); } else { responseObserver.onError(new IllegalArgumentException("Unrecognized response type")); } @@ -134,10 +136,10 @@ public void trainFlow(TrainFlowRequest request, StreamObserver respon Object response = responses.remove(); if (response instanceof Operation) { requests.add(request); - responseObserver.onNext((Operation) response); + responseObserver.onNext(((Operation) response)); responseObserver.onCompleted(); } else if (response instanceof Exception) { - responseObserver.onError((Exception) response); + responseObserver.onError(((Exception) response)); } else { responseObserver.onError(new IllegalArgumentException("Unrecognized response type")); } diff --git a/google-cloud-dialogflow-cx/src/test/java/com/google/cloud/dialogflow/cx/v3beta1/MockIntents.java b/google-cloud-dialogflow-cx/src/test/java/com/google/cloud/dialogflow/cx/v3beta1/MockIntents.java index 67297127e..a6fbfa8c2 100644 --- a/google-cloud-dialogflow-cx/src/test/java/com/google/cloud/dialogflow/cx/v3beta1/MockIntents.java +++ b/google-cloud-dialogflow-cx/src/test/java/com/google/cloud/dialogflow/cx/v3beta1/MockIntents.java @@ -5,7 +5,7 @@ * 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 + * 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, @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.google.cloud.dialogflow.cx.v3beta1; import com.google.api.core.BetaApi; @@ -20,9 +21,10 @@ import com.google.protobuf.AbstractMessage; import io.grpc.ServerServiceDefinition; import java.util.List; +import javax.annotation.Generated; -@javax.annotation.Generated("by GAPIC") @BetaApi +@Generated("by gapic-generator-java") public class MockIntents implements MockGrpcService { private final MockIntentsImpl serviceImpl; diff --git a/google-cloud-dialogflow-cx/src/test/java/com/google/cloud/dialogflow/cx/v3beta1/MockIntentsImpl.java b/google-cloud-dialogflow-cx/src/test/java/com/google/cloud/dialogflow/cx/v3beta1/MockIntentsImpl.java index d51edbb92..4493218ad 100644 --- a/google-cloud-dialogflow-cx/src/test/java/com/google/cloud/dialogflow/cx/v3beta1/MockIntentsImpl.java +++ b/google-cloud-dialogflow-cx/src/test/java/com/google/cloud/dialogflow/cx/v3beta1/MockIntentsImpl.java @@ -5,7 +5,7 @@ * 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 + * 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, @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.google.cloud.dialogflow.cx.v3beta1; import com.google.api.core.BetaApi; @@ -24,9 +25,10 @@ import java.util.LinkedList; import java.util.List; import java.util.Queue; +import javax.annotation.Generated; -@javax.annotation.Generated("by GAPIC") @BetaApi +@Generated("by gapic-generator-java") public class MockIntentsImpl extends IntentsImplBase { private List requests; private Queue responses; @@ -63,10 +65,10 @@ public void listIntents( Object response = responses.remove(); if (response instanceof ListIntentsResponse) { requests.add(request); - responseObserver.onNext((ListIntentsResponse) response); + responseObserver.onNext(((ListIntentsResponse) response)); responseObserver.onCompleted(); } else if (response instanceof Exception) { - responseObserver.onError((Exception) response); + responseObserver.onError(((Exception) response)); } else { responseObserver.onError(new IllegalArgumentException("Unrecognized response type")); } @@ -77,10 +79,10 @@ public void getIntent(GetIntentRequest request, StreamObserver responseO Object response = responses.remove(); if (response instanceof Intent) { requests.add(request); - responseObserver.onNext((Intent) response); + responseObserver.onNext(((Intent) response)); responseObserver.onCompleted(); } else if (response instanceof Exception) { - responseObserver.onError((Exception) response); + responseObserver.onError(((Exception) response)); } else { responseObserver.onError(new IllegalArgumentException("Unrecognized response type")); } @@ -91,10 +93,10 @@ public void createIntent(CreateIntentRequest request, StreamObserver res Object response = responses.remove(); if (response instanceof Intent) { requests.add(request); - responseObserver.onNext((Intent) response); + responseObserver.onNext(((Intent) response)); responseObserver.onCompleted(); } else if (response instanceof Exception) { - responseObserver.onError((Exception) response); + responseObserver.onError(((Exception) response)); } else { responseObserver.onError(new IllegalArgumentException("Unrecognized response type")); } @@ -105,10 +107,10 @@ public void updateIntent(UpdateIntentRequest request, StreamObserver res Object response = responses.remove(); if (response instanceof Intent) { requests.add(request); - responseObserver.onNext((Intent) response); + responseObserver.onNext(((Intent) response)); responseObserver.onCompleted(); } else if (response instanceof Exception) { - responseObserver.onError((Exception) response); + responseObserver.onError(((Exception) response)); } else { responseObserver.onError(new IllegalArgumentException("Unrecognized response type")); } @@ -119,10 +121,10 @@ public void deleteIntent(DeleteIntentRequest request, StreamObserver resp Object response = responses.remove(); if (response instanceof Empty) { requests.add(request); - responseObserver.onNext((Empty) response); + responseObserver.onNext(((Empty) response)); responseObserver.onCompleted(); } else if (response instanceof Exception) { - responseObserver.onError((Exception) response); + responseObserver.onError(((Exception) response)); } else { responseObserver.onError(new IllegalArgumentException("Unrecognized response type")); } diff --git a/google-cloud-dialogflow-cx/src/test/java/com/google/cloud/dialogflow/cx/v3beta1/MockPages.java b/google-cloud-dialogflow-cx/src/test/java/com/google/cloud/dialogflow/cx/v3beta1/MockPages.java index 76faba3d6..f1cc5aec4 100644 --- a/google-cloud-dialogflow-cx/src/test/java/com/google/cloud/dialogflow/cx/v3beta1/MockPages.java +++ b/google-cloud-dialogflow-cx/src/test/java/com/google/cloud/dialogflow/cx/v3beta1/MockPages.java @@ -5,7 +5,7 @@ * 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 + * 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, @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.google.cloud.dialogflow.cx.v3beta1; import com.google.api.core.BetaApi; @@ -20,9 +21,10 @@ import com.google.protobuf.AbstractMessage; import io.grpc.ServerServiceDefinition; import java.util.List; +import javax.annotation.Generated; -@javax.annotation.Generated("by GAPIC") @BetaApi +@Generated("by gapic-generator-java") public class MockPages implements MockGrpcService { private final MockPagesImpl serviceImpl; diff --git a/google-cloud-dialogflow-cx/src/test/java/com/google/cloud/dialogflow/cx/v3beta1/MockPagesImpl.java b/google-cloud-dialogflow-cx/src/test/java/com/google/cloud/dialogflow/cx/v3beta1/MockPagesImpl.java index 13b734fb2..02ee44596 100644 --- a/google-cloud-dialogflow-cx/src/test/java/com/google/cloud/dialogflow/cx/v3beta1/MockPagesImpl.java +++ b/google-cloud-dialogflow-cx/src/test/java/com/google/cloud/dialogflow/cx/v3beta1/MockPagesImpl.java @@ -5,7 +5,7 @@ * 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 + * 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, @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.google.cloud.dialogflow.cx.v3beta1; import com.google.api.core.BetaApi; @@ -24,9 +25,10 @@ import java.util.LinkedList; import java.util.List; import java.util.Queue; +import javax.annotation.Generated; -@javax.annotation.Generated("by GAPIC") @BetaApi +@Generated("by gapic-generator-java") public class MockPagesImpl extends PagesImplBase { private List requests; private Queue responses; @@ -63,10 +65,10 @@ public void listPages( Object response = responses.remove(); if (response instanceof ListPagesResponse) { requests.add(request); - responseObserver.onNext((ListPagesResponse) response); + responseObserver.onNext(((ListPagesResponse) response)); responseObserver.onCompleted(); } else if (response instanceof Exception) { - responseObserver.onError((Exception) response); + responseObserver.onError(((Exception) response)); } else { responseObserver.onError(new IllegalArgumentException("Unrecognized response type")); } @@ -77,10 +79,10 @@ public void getPage(GetPageRequest request, StreamObserver responseObserve Object response = responses.remove(); if (response instanceof Page) { requests.add(request); - responseObserver.onNext((Page) response); + responseObserver.onNext(((Page) response)); responseObserver.onCompleted(); } else if (response instanceof Exception) { - responseObserver.onError((Exception) response); + responseObserver.onError(((Exception) response)); } else { responseObserver.onError(new IllegalArgumentException("Unrecognized response type")); } @@ -91,10 +93,10 @@ public void createPage(CreatePageRequest request, StreamObserver responseO Object response = responses.remove(); if (response instanceof Page) { requests.add(request); - responseObserver.onNext((Page) response); + responseObserver.onNext(((Page) response)); responseObserver.onCompleted(); } else if (response instanceof Exception) { - responseObserver.onError((Exception) response); + responseObserver.onError(((Exception) response)); } else { responseObserver.onError(new IllegalArgumentException("Unrecognized response type")); } @@ -105,10 +107,10 @@ public void updatePage(UpdatePageRequest request, StreamObserver responseO Object response = responses.remove(); if (response instanceof Page) { requests.add(request); - responseObserver.onNext((Page) response); + responseObserver.onNext(((Page) response)); responseObserver.onCompleted(); } else if (response instanceof Exception) { - responseObserver.onError((Exception) response); + responseObserver.onError(((Exception) response)); } else { responseObserver.onError(new IllegalArgumentException("Unrecognized response type")); } @@ -119,10 +121,10 @@ public void deletePage(DeletePageRequest request, StreamObserver response Object response = responses.remove(); if (response instanceof Empty) { requests.add(request); - responseObserver.onNext((Empty) response); + responseObserver.onNext(((Empty) response)); responseObserver.onCompleted(); } else if (response instanceof Exception) { - responseObserver.onError((Exception) response); + responseObserver.onError(((Exception) response)); } else { responseObserver.onError(new IllegalArgumentException("Unrecognized response type")); } diff --git a/google-cloud-dialogflow-cx/src/test/java/com/google/cloud/dialogflow/cx/v3beta1/MockSessionEntityTypes.java b/google-cloud-dialogflow-cx/src/test/java/com/google/cloud/dialogflow/cx/v3beta1/MockSessionEntityTypes.java index aaa494d90..93a482daa 100644 --- a/google-cloud-dialogflow-cx/src/test/java/com/google/cloud/dialogflow/cx/v3beta1/MockSessionEntityTypes.java +++ b/google-cloud-dialogflow-cx/src/test/java/com/google/cloud/dialogflow/cx/v3beta1/MockSessionEntityTypes.java @@ -5,7 +5,7 @@ * 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 + * 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, @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.google.cloud.dialogflow.cx.v3beta1; import com.google.api.core.BetaApi; @@ -20,9 +21,10 @@ import com.google.protobuf.AbstractMessage; import io.grpc.ServerServiceDefinition; import java.util.List; +import javax.annotation.Generated; -@javax.annotation.Generated("by GAPIC") @BetaApi +@Generated("by gapic-generator-java") public class MockSessionEntityTypes implements MockGrpcService { private final MockSessionEntityTypesImpl serviceImpl; diff --git a/google-cloud-dialogflow-cx/src/test/java/com/google/cloud/dialogflow/cx/v3beta1/MockSessionEntityTypesImpl.java b/google-cloud-dialogflow-cx/src/test/java/com/google/cloud/dialogflow/cx/v3beta1/MockSessionEntityTypesImpl.java index 8745b9ab4..11ac2c939 100644 --- a/google-cloud-dialogflow-cx/src/test/java/com/google/cloud/dialogflow/cx/v3beta1/MockSessionEntityTypesImpl.java +++ b/google-cloud-dialogflow-cx/src/test/java/com/google/cloud/dialogflow/cx/v3beta1/MockSessionEntityTypesImpl.java @@ -5,7 +5,7 @@ * 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 + * 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, @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.google.cloud.dialogflow.cx.v3beta1; import com.google.api.core.BetaApi; @@ -24,9 +25,10 @@ import java.util.LinkedList; import java.util.List; import java.util.Queue; +import javax.annotation.Generated; -@javax.annotation.Generated("by GAPIC") @BetaApi +@Generated("by gapic-generator-java") public class MockSessionEntityTypesImpl extends SessionEntityTypesImplBase { private List requests; private Queue responses; @@ -64,10 +66,10 @@ public void listSessionEntityTypes( Object response = responses.remove(); if (response instanceof ListSessionEntityTypesResponse) { requests.add(request); - responseObserver.onNext((ListSessionEntityTypesResponse) response); + responseObserver.onNext(((ListSessionEntityTypesResponse) response)); responseObserver.onCompleted(); } else if (response instanceof Exception) { - responseObserver.onError((Exception) response); + responseObserver.onError(((Exception) response)); } else { responseObserver.onError(new IllegalArgumentException("Unrecognized response type")); } @@ -79,10 +81,10 @@ public void getSessionEntityType( Object response = responses.remove(); if (response instanceof SessionEntityType) { requests.add(request); - responseObserver.onNext((SessionEntityType) response); + responseObserver.onNext(((SessionEntityType) response)); responseObserver.onCompleted(); } else if (response instanceof Exception) { - responseObserver.onError((Exception) response); + responseObserver.onError(((Exception) response)); } else { responseObserver.onError(new IllegalArgumentException("Unrecognized response type")); } @@ -94,10 +96,10 @@ public void createSessionEntityType( Object response = responses.remove(); if (response instanceof SessionEntityType) { requests.add(request); - responseObserver.onNext((SessionEntityType) response); + responseObserver.onNext(((SessionEntityType) response)); responseObserver.onCompleted(); } else if (response instanceof Exception) { - responseObserver.onError((Exception) response); + responseObserver.onError(((Exception) response)); } else { responseObserver.onError(new IllegalArgumentException("Unrecognized response type")); } @@ -109,10 +111,10 @@ public void updateSessionEntityType( Object response = responses.remove(); if (response instanceof SessionEntityType) { requests.add(request); - responseObserver.onNext((SessionEntityType) response); + responseObserver.onNext(((SessionEntityType) response)); responseObserver.onCompleted(); } else if (response instanceof Exception) { - responseObserver.onError((Exception) response); + responseObserver.onError(((Exception) response)); } else { responseObserver.onError(new IllegalArgumentException("Unrecognized response type")); } @@ -124,10 +126,10 @@ public void deleteSessionEntityType( Object response = responses.remove(); if (response instanceof Empty) { requests.add(request); - responseObserver.onNext((Empty) response); + responseObserver.onNext(((Empty) response)); responseObserver.onCompleted(); } else if (response instanceof Exception) { - responseObserver.onError((Exception) response); + responseObserver.onError(((Exception) response)); } else { responseObserver.onError(new IllegalArgumentException("Unrecognized response type")); } diff --git a/google-cloud-dialogflow-cx/src/test/java/com/google/cloud/dialogflow/cx/v3beta1/MockSessions.java b/google-cloud-dialogflow-cx/src/test/java/com/google/cloud/dialogflow/cx/v3beta1/MockSessions.java index 3e1f1fe67..97432b39a 100644 --- a/google-cloud-dialogflow-cx/src/test/java/com/google/cloud/dialogflow/cx/v3beta1/MockSessions.java +++ b/google-cloud-dialogflow-cx/src/test/java/com/google/cloud/dialogflow/cx/v3beta1/MockSessions.java @@ -5,7 +5,7 @@ * 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 + * 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, @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.google.cloud.dialogflow.cx.v3beta1; import com.google.api.core.BetaApi; @@ -20,9 +21,10 @@ import com.google.protobuf.AbstractMessage; import io.grpc.ServerServiceDefinition; import java.util.List; +import javax.annotation.Generated; -@javax.annotation.Generated("by GAPIC") @BetaApi +@Generated("by gapic-generator-java") public class MockSessions implements MockGrpcService { private final MockSessionsImpl serviceImpl; diff --git a/google-cloud-dialogflow-cx/src/test/java/com/google/cloud/dialogflow/cx/v3beta1/MockSessionsImpl.java b/google-cloud-dialogflow-cx/src/test/java/com/google/cloud/dialogflow/cx/v3beta1/MockSessionsImpl.java index da8b721ff..a80c43488 100644 --- a/google-cloud-dialogflow-cx/src/test/java/com/google/cloud/dialogflow/cx/v3beta1/MockSessionsImpl.java +++ b/google-cloud-dialogflow-cx/src/test/java/com/google/cloud/dialogflow/cx/v3beta1/MockSessionsImpl.java @@ -5,7 +5,7 @@ * 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 + * 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, @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.google.cloud.dialogflow.cx.v3beta1; import com.google.api.core.BetaApi; @@ -23,9 +24,10 @@ import java.util.LinkedList; import java.util.List; import java.util.Queue; +import javax.annotation.Generated; -@javax.annotation.Generated("by GAPIC") @BetaApi +@Generated("by gapic-generator-java") public class MockSessionsImpl extends SessionsImplBase { private List requests; private Queue responses; @@ -62,10 +64,10 @@ public void detectIntent( Object response = responses.remove(); if (response instanceof DetectIntentResponse) { requests.add(request); - responseObserver.onNext((DetectIntentResponse) response); + responseObserver.onNext(((DetectIntentResponse) response)); responseObserver.onCompleted(); } else if (response instanceof Exception) { - responseObserver.onError((Exception) response); + responseObserver.onError(((Exception) response)); } else { responseObserver.onError(new IllegalArgumentException("Unrecognized response type")); } @@ -81,9 +83,9 @@ public void onNext(StreamingDetectIntentRequest value) { requests.add(value); final Object response = responses.remove(); if (response instanceof StreamingDetectIntentResponse) { - responseObserver.onNext((StreamingDetectIntentResponse) response); + responseObserver.onNext(((StreamingDetectIntentResponse) response)); } else if (response instanceof Exception) { - responseObserver.onError((Exception) response); + responseObserver.onError(((Exception) response)); } else { responseObserver.onError(new IllegalArgumentException("Unrecognized response type")); } @@ -108,10 +110,10 @@ public void matchIntent( Object response = responses.remove(); if (response instanceof MatchIntentResponse) { requests.add(request); - responseObserver.onNext((MatchIntentResponse) response); + responseObserver.onNext(((MatchIntentResponse) response)); responseObserver.onCompleted(); } else if (response instanceof Exception) { - responseObserver.onError((Exception) response); + responseObserver.onError(((Exception) response)); } else { responseObserver.onError(new IllegalArgumentException("Unrecognized response type")); } @@ -123,10 +125,10 @@ public void fulfillIntent( Object response = responses.remove(); if (response instanceof FulfillIntentResponse) { requests.add(request); - responseObserver.onNext((FulfillIntentResponse) response); + responseObserver.onNext(((FulfillIntentResponse) response)); responseObserver.onCompleted(); } else if (response instanceof Exception) { - responseObserver.onError((Exception) response); + responseObserver.onError(((Exception) response)); } else { responseObserver.onError(new IllegalArgumentException("Unrecognized response type")); } diff --git a/google-cloud-dialogflow-cx/src/test/java/com/google/cloud/dialogflow/cx/v3beta1/MockTransitionRouteGroups.java b/google-cloud-dialogflow-cx/src/test/java/com/google/cloud/dialogflow/cx/v3beta1/MockTransitionRouteGroups.java index c0e8f6d5b..818d38ef0 100644 --- a/google-cloud-dialogflow-cx/src/test/java/com/google/cloud/dialogflow/cx/v3beta1/MockTransitionRouteGroups.java +++ b/google-cloud-dialogflow-cx/src/test/java/com/google/cloud/dialogflow/cx/v3beta1/MockTransitionRouteGroups.java @@ -5,7 +5,7 @@ * 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 + * 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, @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.google.cloud.dialogflow.cx.v3beta1; import com.google.api.core.BetaApi; @@ -20,9 +21,10 @@ import com.google.protobuf.AbstractMessage; import io.grpc.ServerServiceDefinition; import java.util.List; +import javax.annotation.Generated; -@javax.annotation.Generated("by GAPIC") @BetaApi +@Generated("by gapic-generator-java") public class MockTransitionRouteGroups implements MockGrpcService { private final MockTransitionRouteGroupsImpl serviceImpl; diff --git a/google-cloud-dialogflow-cx/src/test/java/com/google/cloud/dialogflow/cx/v3beta1/MockTransitionRouteGroupsImpl.java b/google-cloud-dialogflow-cx/src/test/java/com/google/cloud/dialogflow/cx/v3beta1/MockTransitionRouteGroupsImpl.java index 51e9944a0..1f1725652 100644 --- a/google-cloud-dialogflow-cx/src/test/java/com/google/cloud/dialogflow/cx/v3beta1/MockTransitionRouteGroupsImpl.java +++ b/google-cloud-dialogflow-cx/src/test/java/com/google/cloud/dialogflow/cx/v3beta1/MockTransitionRouteGroupsImpl.java @@ -5,7 +5,7 @@ * 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 + * 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, @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.google.cloud.dialogflow.cx.v3beta1; import com.google.api.core.BetaApi; @@ -24,9 +25,10 @@ import java.util.LinkedList; import java.util.List; import java.util.Queue; +import javax.annotation.Generated; -@javax.annotation.Generated("by GAPIC") @BetaApi +@Generated("by gapic-generator-java") public class MockTransitionRouteGroupsImpl extends TransitionRouteGroupsImplBase { private List requests; private Queue responses; @@ -64,10 +66,10 @@ public void listTransitionRouteGroups( Object response = responses.remove(); if (response instanceof ListTransitionRouteGroupsResponse) { requests.add(request); - responseObserver.onNext((ListTransitionRouteGroupsResponse) response); + responseObserver.onNext(((ListTransitionRouteGroupsResponse) response)); responseObserver.onCompleted(); } else if (response instanceof Exception) { - responseObserver.onError((Exception) response); + responseObserver.onError(((Exception) response)); } else { responseObserver.onError(new IllegalArgumentException("Unrecognized response type")); } @@ -80,10 +82,10 @@ public void getTransitionRouteGroup( Object response = responses.remove(); if (response instanceof TransitionRouteGroup) { requests.add(request); - responseObserver.onNext((TransitionRouteGroup) response); + responseObserver.onNext(((TransitionRouteGroup) response)); responseObserver.onCompleted(); } else if (response instanceof Exception) { - responseObserver.onError((Exception) response); + responseObserver.onError(((Exception) response)); } else { responseObserver.onError(new IllegalArgumentException("Unrecognized response type")); } @@ -96,10 +98,10 @@ public void createTransitionRouteGroup( Object response = responses.remove(); if (response instanceof TransitionRouteGroup) { requests.add(request); - responseObserver.onNext((TransitionRouteGroup) response); + responseObserver.onNext(((TransitionRouteGroup) response)); responseObserver.onCompleted(); } else if (response instanceof Exception) { - responseObserver.onError((Exception) response); + responseObserver.onError(((Exception) response)); } else { responseObserver.onError(new IllegalArgumentException("Unrecognized response type")); } @@ -112,10 +114,10 @@ public void updateTransitionRouteGroup( Object response = responses.remove(); if (response instanceof TransitionRouteGroup) { requests.add(request); - responseObserver.onNext((TransitionRouteGroup) response); + responseObserver.onNext(((TransitionRouteGroup) response)); responseObserver.onCompleted(); } else if (response instanceof Exception) { - responseObserver.onError((Exception) response); + responseObserver.onError(((Exception) response)); } else { responseObserver.onError(new IllegalArgumentException("Unrecognized response type")); } @@ -127,10 +129,10 @@ public void deleteTransitionRouteGroup( Object response = responses.remove(); if (response instanceof Empty) { requests.add(request); - responseObserver.onNext((Empty) response); + responseObserver.onNext(((Empty) response)); responseObserver.onCompleted(); } else if (response instanceof Exception) { - responseObserver.onError((Exception) response); + responseObserver.onError(((Exception) response)); } else { responseObserver.onError(new IllegalArgumentException("Unrecognized response type")); } diff --git a/google-cloud-dialogflow-cx/src/test/java/com/google/cloud/dialogflow/cx/v3beta1/MockVersions.java b/google-cloud-dialogflow-cx/src/test/java/com/google/cloud/dialogflow/cx/v3beta1/MockVersions.java index 0eda34bfe..002931dce 100644 --- a/google-cloud-dialogflow-cx/src/test/java/com/google/cloud/dialogflow/cx/v3beta1/MockVersions.java +++ b/google-cloud-dialogflow-cx/src/test/java/com/google/cloud/dialogflow/cx/v3beta1/MockVersions.java @@ -5,7 +5,7 @@ * 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 + * 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, @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.google.cloud.dialogflow.cx.v3beta1; import com.google.api.core.BetaApi; @@ -20,9 +21,10 @@ import com.google.protobuf.AbstractMessage; import io.grpc.ServerServiceDefinition; import java.util.List; +import javax.annotation.Generated; -@javax.annotation.Generated("by GAPIC") @BetaApi +@Generated("by gapic-generator-java") public class MockVersions implements MockGrpcService { private final MockVersionsImpl serviceImpl; diff --git a/google-cloud-dialogflow-cx/src/test/java/com/google/cloud/dialogflow/cx/v3beta1/MockVersionsImpl.java b/google-cloud-dialogflow-cx/src/test/java/com/google/cloud/dialogflow/cx/v3beta1/MockVersionsImpl.java index e8662d51b..bfd10811e 100644 --- a/google-cloud-dialogflow-cx/src/test/java/com/google/cloud/dialogflow/cx/v3beta1/MockVersionsImpl.java +++ b/google-cloud-dialogflow-cx/src/test/java/com/google/cloud/dialogflow/cx/v3beta1/MockVersionsImpl.java @@ -5,7 +5,7 @@ * 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 + * 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, @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.google.cloud.dialogflow.cx.v3beta1; import com.google.api.core.BetaApi; @@ -25,9 +26,10 @@ import java.util.LinkedList; import java.util.List; import java.util.Queue; +import javax.annotation.Generated; -@javax.annotation.Generated("by GAPIC") @BetaApi +@Generated("by gapic-generator-java") public class MockVersionsImpl extends VersionsImplBase { private List requests; private Queue responses; @@ -64,10 +66,10 @@ public void listVersions( Object response = responses.remove(); if (response instanceof ListVersionsResponse) { requests.add(request); - responseObserver.onNext((ListVersionsResponse) response); + responseObserver.onNext(((ListVersionsResponse) response)); responseObserver.onCompleted(); } else if (response instanceof Exception) { - responseObserver.onError((Exception) response); + responseObserver.onError(((Exception) response)); } else { responseObserver.onError(new IllegalArgumentException("Unrecognized response type")); } @@ -78,10 +80,10 @@ public void getVersion(GetVersionRequest request, StreamObserver respon Object response = responses.remove(); if (response instanceof Version) { requests.add(request); - responseObserver.onNext((Version) response); + responseObserver.onNext(((Version) response)); responseObserver.onCompleted(); } else if (response instanceof Exception) { - responseObserver.onError((Exception) response); + responseObserver.onError(((Exception) response)); } else { responseObserver.onError(new IllegalArgumentException("Unrecognized response type")); } @@ -93,10 +95,10 @@ public void createVersion( Object response = responses.remove(); if (response instanceof Operation) { requests.add(request); - responseObserver.onNext((Operation) response); + responseObserver.onNext(((Operation) response)); responseObserver.onCompleted(); } else if (response instanceof Exception) { - responseObserver.onError((Exception) response); + responseObserver.onError(((Exception) response)); } else { responseObserver.onError(new IllegalArgumentException("Unrecognized response type")); } @@ -108,10 +110,10 @@ public void updateVersion( Object response = responses.remove(); if (response instanceof Version) { requests.add(request); - responseObserver.onNext((Version) response); + responseObserver.onNext(((Version) response)); responseObserver.onCompleted(); } else if (response instanceof Exception) { - responseObserver.onError((Exception) response); + responseObserver.onError(((Exception) response)); } else { responseObserver.onError(new IllegalArgumentException("Unrecognized response type")); } @@ -122,10 +124,10 @@ public void deleteVersion(DeleteVersionRequest request, StreamObserver re Object response = responses.remove(); if (response instanceof Empty) { requests.add(request); - responseObserver.onNext((Empty) response); + responseObserver.onNext(((Empty) response)); responseObserver.onCompleted(); } else if (response instanceof Exception) { - responseObserver.onError((Exception) response); + responseObserver.onError(((Exception) response)); } else { responseObserver.onError(new IllegalArgumentException("Unrecognized response type")); } @@ -136,10 +138,10 @@ public void loadVersion(LoadVersionRequest request, StreamObserver re Object response = responses.remove(); if (response instanceof Operation) { requests.add(request); - responseObserver.onNext((Operation) response); + responseObserver.onNext(((Operation) response)); responseObserver.onCompleted(); } else if (response instanceof Exception) { - responseObserver.onError((Exception) response); + responseObserver.onError(((Exception) response)); } else { responseObserver.onError(new IllegalArgumentException("Unrecognized response type")); } diff --git a/google-cloud-dialogflow-cx/src/test/java/com/google/cloud/dialogflow/cx/v3beta1/MockWebhooks.java b/google-cloud-dialogflow-cx/src/test/java/com/google/cloud/dialogflow/cx/v3beta1/MockWebhooks.java index 08ac7c1a2..7081dbd12 100644 --- a/google-cloud-dialogflow-cx/src/test/java/com/google/cloud/dialogflow/cx/v3beta1/MockWebhooks.java +++ b/google-cloud-dialogflow-cx/src/test/java/com/google/cloud/dialogflow/cx/v3beta1/MockWebhooks.java @@ -5,7 +5,7 @@ * 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 + * 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, @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.google.cloud.dialogflow.cx.v3beta1; import com.google.api.core.BetaApi; @@ -20,9 +21,10 @@ import com.google.protobuf.AbstractMessage; import io.grpc.ServerServiceDefinition; import java.util.List; +import javax.annotation.Generated; -@javax.annotation.Generated("by GAPIC") @BetaApi +@Generated("by gapic-generator-java") public class MockWebhooks implements MockGrpcService { private final MockWebhooksImpl serviceImpl; diff --git a/google-cloud-dialogflow-cx/src/test/java/com/google/cloud/dialogflow/cx/v3beta1/MockWebhooksImpl.java b/google-cloud-dialogflow-cx/src/test/java/com/google/cloud/dialogflow/cx/v3beta1/MockWebhooksImpl.java index 2b8cb77e8..955caa942 100644 --- a/google-cloud-dialogflow-cx/src/test/java/com/google/cloud/dialogflow/cx/v3beta1/MockWebhooksImpl.java +++ b/google-cloud-dialogflow-cx/src/test/java/com/google/cloud/dialogflow/cx/v3beta1/MockWebhooksImpl.java @@ -5,7 +5,7 @@ * 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 + * 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, @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.google.cloud.dialogflow.cx.v3beta1; import com.google.api.core.BetaApi; @@ -24,9 +25,10 @@ import java.util.LinkedList; import java.util.List; import java.util.Queue; +import javax.annotation.Generated; -@javax.annotation.Generated("by GAPIC") @BetaApi +@Generated("by gapic-generator-java") public class MockWebhooksImpl extends WebhooksImplBase { private List requests; private Queue responses; @@ -63,10 +65,10 @@ public void listWebhooks( Object response = responses.remove(); if (response instanceof ListWebhooksResponse) { requests.add(request); - responseObserver.onNext((ListWebhooksResponse) response); + responseObserver.onNext(((ListWebhooksResponse) response)); responseObserver.onCompleted(); } else if (response instanceof Exception) { - responseObserver.onError((Exception) response); + responseObserver.onError(((Exception) response)); } else { responseObserver.onError(new IllegalArgumentException("Unrecognized response type")); } @@ -77,10 +79,10 @@ public void getWebhook(GetWebhookRequest request, StreamObserver respon Object response = responses.remove(); if (response instanceof Webhook) { requests.add(request); - responseObserver.onNext((Webhook) response); + responseObserver.onNext(((Webhook) response)); responseObserver.onCompleted(); } else if (response instanceof Exception) { - responseObserver.onError((Exception) response); + responseObserver.onError(((Exception) response)); } else { responseObserver.onError(new IllegalArgumentException("Unrecognized response type")); } @@ -92,10 +94,10 @@ public void createWebhook( Object response = responses.remove(); if (response instanceof Webhook) { requests.add(request); - responseObserver.onNext((Webhook) response); + responseObserver.onNext(((Webhook) response)); responseObserver.onCompleted(); } else if (response instanceof Exception) { - responseObserver.onError((Exception) response); + responseObserver.onError(((Exception) response)); } else { responseObserver.onError(new IllegalArgumentException("Unrecognized response type")); } @@ -107,10 +109,10 @@ public void updateWebhook( Object response = responses.remove(); if (response instanceof Webhook) { requests.add(request); - responseObserver.onNext((Webhook) response); + responseObserver.onNext(((Webhook) response)); responseObserver.onCompleted(); } else if (response instanceof Exception) { - responseObserver.onError((Exception) response); + responseObserver.onError(((Exception) response)); } else { responseObserver.onError(new IllegalArgumentException("Unrecognized response type")); } @@ -121,10 +123,10 @@ public void deleteWebhook(DeleteWebhookRequest request, StreamObserver re Object response = responses.remove(); if (response instanceof Empty) { requests.add(request); - responseObserver.onNext((Empty) response); + responseObserver.onNext(((Empty) response)); responseObserver.onCompleted(); } else if (response instanceof Exception) { - responseObserver.onError((Exception) response); + responseObserver.onError(((Exception) response)); } else { responseObserver.onError(new IllegalArgumentException("Unrecognized response type")); } diff --git a/google-cloud-dialogflow-cx/src/test/java/com/google/cloud/dialogflow/cx/v3beta1/PagesClientTest.java b/google-cloud-dialogflow-cx/src/test/java/com/google/cloud/dialogflow/cx/v3beta1/PagesClientTest.java index af86c613a..11495dbab 100644 --- a/google-cloud-dialogflow-cx/src/test/java/com/google/cloud/dialogflow/cx/v3beta1/PagesClientTest.java +++ b/google-cloud-dialogflow-cx/src/test/java/com/google/cloud/dialogflow/cx/v3beta1/PagesClientTest.java @@ -5,7 +5,7 @@ * 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 + * 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, @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.google.cloud.dialogflow.cx.v3beta1; import static com.google.cloud.dialogflow.cx.v3beta1.PagesClient.ListPagesPagedResponse; @@ -28,12 +29,13 @@ import com.google.protobuf.AbstractMessage; import com.google.protobuf.Empty; import com.google.protobuf.FieldMask; -import io.grpc.Status; import io.grpc.StatusRuntimeException; import java.io.IOException; +import java.util.ArrayList; import java.util.Arrays; import java.util.List; import java.util.UUID; +import javax.annotation.Generated; import org.junit.After; import org.junit.AfterClass; import org.junit.Assert; @@ -41,63 +43,31 @@ import org.junit.BeforeClass; import org.junit.Test; -@javax.annotation.Generated("by GAPIC") +@Generated("by gapic-generator-java") public class PagesClientTest { private static MockPages mockPages; - private static MockFlows mockFlows; - private static MockAgents mockAgents; - private static MockEntityTypes mockEntityTypes; - private static MockEnvironments mockEnvironments; - private static MockIntents mockIntents; - private static MockSessionEntityTypes mockSessionEntityTypes; - private static MockSessions mockSessions; - private static MockTransitionRouteGroups mockTransitionRouteGroups; - private static MockVersions mockVersions; - private static MockWebhooks mockWebhooks; - private static MockServiceHelper serviceHelper; + private static MockServiceHelper mockServiceHelper; private PagesClient client; private LocalChannelProvider channelProvider; @BeforeClass public static void startStaticServer() { mockPages = new MockPages(); - mockFlows = new MockFlows(); - mockAgents = new MockAgents(); - mockEntityTypes = new MockEntityTypes(); - mockEnvironments = new MockEnvironments(); - mockIntents = new MockIntents(); - mockSessionEntityTypes = new MockSessionEntityTypes(); - mockSessions = new MockSessions(); - mockTransitionRouteGroups = new MockTransitionRouteGroups(); - mockVersions = new MockVersions(); - mockWebhooks = new MockWebhooks(); - serviceHelper = + mockServiceHelper = new MockServiceHelper( - UUID.randomUUID().toString(), - Arrays.asList( - mockPages, - mockFlows, - mockAgents, - mockEntityTypes, - mockEnvironments, - mockIntents, - mockSessionEntityTypes, - mockSessions, - mockTransitionRouteGroups, - mockVersions, - mockWebhooks)); - serviceHelper.start(); + UUID.randomUUID().toString(), Arrays.asList(mockPages)); + mockServiceHelper.start(); } @AfterClass public static void stopServer() { - serviceHelper.stop(); + mockServiceHelper.stop(); } @Before public void setUp() throws IOException { - serviceHelper.reset(); - channelProvider = serviceHelper.createChannelProvider(); + mockServiceHelper.reset(); + channelProvider = mockServiceHelper.createChannelProvider(); PagesSettings settings = PagesSettings.newBuilder() .setTransportChannelProvider(channelProvider) @@ -112,13 +82,13 @@ public void tearDown() throws Exception { } @Test - @SuppressWarnings("all") - public void listPagesTest() { - String nextPageToken = ""; - Page pagesElement = Page.newBuilder().build(); - List pages = Arrays.asList(pagesElement); + public void listPagesTest() throws Exception { + Page responsesElement = Page.newBuilder().build(); ListPagesResponse expectedResponse = - ListPagesResponse.newBuilder().setNextPageToken(nextPageToken).addAllPages(pages).build(); + ListPagesResponse.newBuilder() + .setNextPageToken("") + .addAllPages(Arrays.asList(responsesElement)) + .build(); mockPages.addResponse(expectedResponse); FlowName parent = FlowName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]"); @@ -126,14 +96,15 @@ public void listPagesTest() { ListPagesPagedResponse pagedListResponse = client.listPages(parent); List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + Assert.assertEquals(1, resources.size()); Assert.assertEquals(expectedResponse.getPagesList().get(0), resources.get(0)); List actualRequests = mockPages.getRequests(); Assert.assertEquals(1, actualRequests.size()); - ListPagesRequest actualRequest = (ListPagesRequest) actualRequests.get(0); + ListPagesRequest actualRequest = ((ListPagesRequest) actualRequests.get(0)); - Assert.assertEquals(parent, FlowName.parse(actualRequest.getParent())); + Assert.assertEquals(parent.toString(), actualRequest.getParent()); Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), @@ -141,28 +112,76 @@ public void listPagesTest() { } @Test - @SuppressWarnings("all") public void listPagesExceptionTest() throws Exception { - StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockPages.addException(exception); try { FlowName parent = FlowName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]"); + client.listPages(parent); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void listPagesTest2() throws Exception { + Page responsesElement = Page.newBuilder().build(); + ListPagesResponse expectedResponse = + ListPagesResponse.newBuilder() + .setNextPageToken("") + .addAllPages(Arrays.asList(responsesElement)) + .build(); + mockPages.addResponse(expectedResponse); + + String parent = "parent-995424086"; + + ListPagesPagedResponse pagedListResponse = client.listPages(parent); + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getPagesList().get(0), resources.get(0)); + + List actualRequests = mockPages.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + ListPagesRequest actualRequest = ((ListPagesRequest) actualRequests.get(0)); + + Assert.assertEquals(parent, actualRequest.getParent()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void listPagesExceptionTest2() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockPages.addException(exception); + + try { + String parent = "parent-995424086"; client.listPages(parent); Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { - // Expected exception + // Expected exception. } } @Test - @SuppressWarnings("all") - public void getPageTest() { - PageName name2 = PageName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]", "[PAGE]"); - String displayName = "displayName1615086568"; + public void getPageTest() throws Exception { Page expectedResponse = - Page.newBuilder().setName(name2.toString()).setDisplayName(displayName).build(); + Page.newBuilder() + .setName( + PageName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]", "[PAGE]").toString()) + .setDisplayName("displayName1714148973") + .setEntryFulfillment(Fulfillment.newBuilder().build()) + .setForm(Form.newBuilder().build()) + .addAllTransitionRouteGroups(new ArrayList()) + .addAllTransitionRoutes(new ArrayList()) + .addAllEventHandlers(new ArrayList()) + .build(); mockPages.addResponse(expectedResponse); PageName name = PageName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]", "[PAGE]"); @@ -172,9 +191,9 @@ public void getPageTest() { List actualRequests = mockPages.getRequests(); Assert.assertEquals(1, actualRequests.size()); - GetPageRequest actualRequest = (GetPageRequest) actualRequests.get(0); + GetPageRequest actualRequest = ((GetPageRequest) actualRequests.get(0)); - Assert.assertEquals(name, PageName.parse(actualRequest.getName())); + Assert.assertEquals(name.toString(), actualRequest.getName()); Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), @@ -182,28 +201,77 @@ public void getPageTest() { } @Test - @SuppressWarnings("all") public void getPageExceptionTest() throws Exception { - StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockPages.addException(exception); try { PageName name = PageName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]", "[PAGE]"); + client.getPage(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void getPageTest2() throws Exception { + Page expectedResponse = + Page.newBuilder() + .setName( + PageName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]", "[PAGE]").toString()) + .setDisplayName("displayName1714148973") + .setEntryFulfillment(Fulfillment.newBuilder().build()) + .setForm(Form.newBuilder().build()) + .addAllTransitionRouteGroups(new ArrayList()) + .addAllTransitionRoutes(new ArrayList()) + .addAllEventHandlers(new ArrayList()) + .build(); + mockPages.addResponse(expectedResponse); + + String name = "name3373707"; + + Page actualResponse = client.getPage(name); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockPages.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + GetPageRequest actualRequest = ((GetPageRequest) actualRequests.get(0)); + + Assert.assertEquals(name, actualRequest.getName()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void getPageExceptionTest2() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockPages.addException(exception); + try { + String name = "name3373707"; client.getPage(name); Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { - // Expected exception + // Expected exception. } } @Test - @SuppressWarnings("all") - public void createPageTest() { - PageName name = PageName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]", "[PAGE]"); - String displayName = "displayName1615086568"; + public void createPageTest() throws Exception { Page expectedResponse = - Page.newBuilder().setName(name.toString()).setDisplayName(displayName).build(); + Page.newBuilder() + .setName( + PageName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]", "[PAGE]").toString()) + .setDisplayName("displayName1714148973") + .setEntryFulfillment(Fulfillment.newBuilder().build()) + .setForm(Form.newBuilder().build()) + .addAllTransitionRouteGroups(new ArrayList()) + .addAllTransitionRoutes(new ArrayList()) + .addAllEventHandlers(new ArrayList()) + .build(); mockPages.addResponse(expectedResponse); FlowName parent = FlowName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]"); @@ -214,9 +282,9 @@ public void createPageTest() { List actualRequests = mockPages.getRequests(); Assert.assertEquals(1, actualRequests.size()); - CreatePageRequest actualRequest = (CreatePageRequest) actualRequests.get(0); + CreatePageRequest actualRequest = ((CreatePageRequest) actualRequests.get(0)); - Assert.assertEquals(parent, FlowName.parse(actualRequest.getParent())); + Assert.assertEquals(parent.toString(), actualRequest.getParent()); Assert.assertEquals(page, actualRequest.getPage()); Assert.assertTrue( channelProvider.isHeaderSent( @@ -225,29 +293,81 @@ public void createPageTest() { } @Test - @SuppressWarnings("all") public void createPageExceptionTest() throws Exception { - StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockPages.addException(exception); try { FlowName parent = FlowName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]"); Page page = Page.newBuilder().build(); + client.createPage(parent, page); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void createPageTest2() throws Exception { + Page expectedResponse = + Page.newBuilder() + .setName( + PageName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]", "[PAGE]").toString()) + .setDisplayName("displayName1714148973") + .setEntryFulfillment(Fulfillment.newBuilder().build()) + .setForm(Form.newBuilder().build()) + .addAllTransitionRouteGroups(new ArrayList()) + .addAllTransitionRoutes(new ArrayList()) + .addAllEventHandlers(new ArrayList()) + .build(); + mockPages.addResponse(expectedResponse); + + String parent = "parent-995424086"; + Page page = Page.newBuilder().build(); + + Page actualResponse = client.createPage(parent, page); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockPages.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + CreatePageRequest actualRequest = ((CreatePageRequest) actualRequests.get(0)); + + Assert.assertEquals(parent, actualRequest.getParent()); + Assert.assertEquals(page, actualRequest.getPage()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void createPageExceptionTest2() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockPages.addException(exception); + try { + String parent = "parent-995424086"; + Page page = Page.newBuilder().build(); client.createPage(parent, page); Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { - // Expected exception + // Expected exception. } } @Test - @SuppressWarnings("all") - public void updatePageTest() { - PageName name = PageName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]", "[PAGE]"); - String displayName = "displayName1615086568"; + public void updatePageTest() throws Exception { Page expectedResponse = - Page.newBuilder().setName(name.toString()).setDisplayName(displayName).build(); + Page.newBuilder() + .setName( + PageName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]", "[PAGE]").toString()) + .setDisplayName("displayName1714148973") + .setEntryFulfillment(Fulfillment.newBuilder().build()) + .setForm(Form.newBuilder().build()) + .addAllTransitionRouteGroups(new ArrayList()) + .addAllTransitionRoutes(new ArrayList()) + .addAllEventHandlers(new ArrayList()) + .build(); mockPages.addResponse(expectedResponse); Page page = Page.newBuilder().build(); @@ -258,7 +378,7 @@ public void updatePageTest() { List actualRequests = mockPages.getRequests(); Assert.assertEquals(1, actualRequests.size()); - UpdatePageRequest actualRequest = (UpdatePageRequest) actualRequests.get(0); + UpdatePageRequest actualRequest = ((UpdatePageRequest) actualRequests.get(0)); Assert.assertEquals(page, actualRequest.getPage()); Assert.assertEquals(updateMask, actualRequest.getUpdateMask()); @@ -269,25 +389,22 @@ public void updatePageTest() { } @Test - @SuppressWarnings("all") public void updatePageExceptionTest() throws Exception { - StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockPages.addException(exception); try { Page page = Page.newBuilder().build(); FieldMask updateMask = FieldMask.newBuilder().build(); - client.updatePage(page, updateMask); Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { - // Expected exception + // Expected exception. } } @Test - @SuppressWarnings("all") - public void deletePageTest() { + public void deletePageTest() throws Exception { Empty expectedResponse = Empty.newBuilder().build(); mockPages.addResponse(expectedResponse); @@ -297,9 +414,9 @@ public void deletePageTest() { List actualRequests = mockPages.getRequests(); Assert.assertEquals(1, actualRequests.size()); - DeletePageRequest actualRequest = (DeletePageRequest) actualRequests.get(0); + DeletePageRequest actualRequest = ((DeletePageRequest) actualRequests.get(0)); - Assert.assertEquals(name, PageName.parse(actualRequest.getName())); + Assert.assertEquals(name.toString(), actualRequest.getName()); Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), @@ -307,18 +424,50 @@ public void deletePageTest() { } @Test - @SuppressWarnings("all") public void deletePageExceptionTest() throws Exception { - StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockPages.addException(exception); try { PageName name = PageName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]", "[PAGE]"); + client.deletePage(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void deletePageTest2() throws Exception { + Empty expectedResponse = Empty.newBuilder().build(); + mockPages.addResponse(expectedResponse); + + String name = "name3373707"; + client.deletePage(name); + + List actualRequests = mockPages.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + DeletePageRequest actualRequest = ((DeletePageRequest) actualRequests.get(0)); + + Assert.assertEquals(name, actualRequest.getName()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void deletePageExceptionTest2() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockPages.addException(exception); + + try { + String name = "name3373707"; client.deletePage(name); Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { - // Expected exception + // Expected exception. } } } diff --git a/google-cloud-dialogflow-cx/src/test/java/com/google/cloud/dialogflow/cx/v3beta1/SessionEntityTypesClientTest.java b/google-cloud-dialogflow-cx/src/test/java/com/google/cloud/dialogflow/cx/v3beta1/SessionEntityTypesClientTest.java index c08705f0a..ef795d6b0 100644 --- a/google-cloud-dialogflow-cx/src/test/java/com/google/cloud/dialogflow/cx/v3beta1/SessionEntityTypesClientTest.java +++ b/google-cloud-dialogflow-cx/src/test/java/com/google/cloud/dialogflow/cx/v3beta1/SessionEntityTypesClientTest.java @@ -5,7 +5,7 @@ * 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 + * 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, @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.google.cloud.dialogflow.cx.v3beta1; import static com.google.cloud.dialogflow.cx.v3beta1.SessionEntityTypesClient.ListSessionEntityTypesPagedResponse; @@ -28,12 +29,13 @@ import com.google.protobuf.AbstractMessage; import com.google.protobuf.Empty; import com.google.protobuf.FieldMask; -import io.grpc.Status; import io.grpc.StatusRuntimeException; import java.io.IOException; +import java.util.ArrayList; import java.util.Arrays; import java.util.List; import java.util.UUID; +import javax.annotation.Generated; import org.junit.After; import org.junit.AfterClass; import org.junit.Assert; @@ -41,63 +43,31 @@ import org.junit.BeforeClass; import org.junit.Test; -@javax.annotation.Generated("by GAPIC") +@Generated("by gapic-generator-java") public class SessionEntityTypesClientTest { - private static MockPages mockPages; - private static MockFlows mockFlows; - private static MockAgents mockAgents; - private static MockEntityTypes mockEntityTypes; - private static MockEnvironments mockEnvironments; - private static MockIntents mockIntents; private static MockSessionEntityTypes mockSessionEntityTypes; - private static MockSessions mockSessions; - private static MockTransitionRouteGroups mockTransitionRouteGroups; - private static MockVersions mockVersions; - private static MockWebhooks mockWebhooks; - private static MockServiceHelper serviceHelper; + private static MockServiceHelper mockServiceHelper; private SessionEntityTypesClient client; private LocalChannelProvider channelProvider; @BeforeClass public static void startStaticServer() { - mockPages = new MockPages(); - mockFlows = new MockFlows(); - mockAgents = new MockAgents(); - mockEntityTypes = new MockEntityTypes(); - mockEnvironments = new MockEnvironments(); - mockIntents = new MockIntents(); mockSessionEntityTypes = new MockSessionEntityTypes(); - mockSessions = new MockSessions(); - mockTransitionRouteGroups = new MockTransitionRouteGroups(); - mockVersions = new MockVersions(); - mockWebhooks = new MockWebhooks(); - serviceHelper = + mockServiceHelper = new MockServiceHelper( - UUID.randomUUID().toString(), - Arrays.asList( - mockPages, - mockFlows, - mockAgents, - mockEntityTypes, - mockEnvironments, - mockIntents, - mockSessionEntityTypes, - mockSessions, - mockTransitionRouteGroups, - mockVersions, - mockWebhooks)); - serviceHelper.start(); + UUID.randomUUID().toString(), Arrays.asList(mockSessionEntityTypes)); + mockServiceHelper.start(); } @AfterClass public static void stopServer() { - serviceHelper.stop(); + mockServiceHelper.stop(); } @Before public void setUp() throws IOException { - serviceHelper.reset(); - channelProvider = serviceHelper.createChannelProvider(); + mockServiceHelper.reset(); + channelProvider = mockServiceHelper.createChannelProvider(); SessionEntityTypesSettings settings = SessionEntityTypesSettings.newBuilder() .setTransportChannelProvider(channelProvider) @@ -112,15 +82,12 @@ public void tearDown() throws Exception { } @Test - @SuppressWarnings("all") - public void listSessionEntityTypesTest() { - String nextPageToken = ""; - SessionEntityType sessionEntityTypesElement = SessionEntityType.newBuilder().build(); - List sessionEntityTypes = Arrays.asList(sessionEntityTypesElement); + public void listSessionEntityTypesTest() throws Exception { + SessionEntityType responsesElement = SessionEntityType.newBuilder().build(); ListSessionEntityTypesResponse expectedResponse = ListSessionEntityTypesResponse.newBuilder() - .setNextPageToken(nextPageToken) - .addAllSessionEntityTypes(sessionEntityTypes) + .setNextPageToken("") + .addAllSessionEntityTypes(Arrays.asList(responsesElement)) .build(); mockSessionEntityTypes.addResponse(expectedResponse); @@ -131,15 +98,16 @@ public void listSessionEntityTypesTest() { ListSessionEntityTypesPagedResponse pagedListResponse = client.listSessionEntityTypes(parent); List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + Assert.assertEquals(1, resources.size()); Assert.assertEquals(expectedResponse.getSessionEntityTypesList().get(0), resources.get(0)); List actualRequests = mockSessionEntityTypes.getRequests(); Assert.assertEquals(1, actualRequests.size()); ListSessionEntityTypesRequest actualRequest = - (ListSessionEntityTypesRequest) actualRequests.get(0); + ((ListSessionEntityTypesRequest) actualRequests.get(0)); - Assert.assertEquals(parent, SessionName.parse(actualRequest.getParent())); + Assert.assertEquals(parent.toString(), actualRequest.getParent()); Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), @@ -147,31 +115,76 @@ public void listSessionEntityTypesTest() { } @Test - @SuppressWarnings("all") public void listSessionEntityTypesExceptionTest() throws Exception { - StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockSessionEntityTypes.addException(exception); try { SessionName parent = SessionName.ofProjectLocationAgentSessionName( "[PROJECT]", "[LOCATION]", "[AGENT]", "[SESSION]"); + client.listSessionEntityTypes(parent); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void listSessionEntityTypesTest2() throws Exception { + SessionEntityType responsesElement = SessionEntityType.newBuilder().build(); + ListSessionEntityTypesResponse expectedResponse = + ListSessionEntityTypesResponse.newBuilder() + .setNextPageToken("") + .addAllSessionEntityTypes(Arrays.asList(responsesElement)) + .build(); + mockSessionEntityTypes.addResponse(expectedResponse); + + String parent = "parent-995424086"; + + ListSessionEntityTypesPagedResponse pagedListResponse = client.listSessionEntityTypes(parent); + + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getSessionEntityTypesList().get(0), resources.get(0)); + + List actualRequests = mockSessionEntityTypes.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + ListSessionEntityTypesRequest actualRequest = + ((ListSessionEntityTypesRequest) actualRequests.get(0)); + + Assert.assertEquals(parent, actualRequest.getParent()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void listSessionEntityTypesExceptionTest2() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockSessionEntityTypes.addException(exception); + try { + String parent = "parent-995424086"; client.listSessionEntityTypes(parent); Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { - // Expected exception + // Expected exception. } } @Test - @SuppressWarnings("all") - public void getSessionEntityTypeTest() { - SessionEntityTypeName name2 = - SessionEntityTypeName.ofProjectLocationAgentSessionEntityTypeName( - "[PROJECT]", "[LOCATION]", "[AGENT]", "[SESSION]", "[ENTITY_TYPE]"); + public void getSessionEntityTypeTest() throws Exception { SessionEntityType expectedResponse = - SessionEntityType.newBuilder().setName(name2.toString()).build(); + SessionEntityType.newBuilder() + .setName( + SessionEntityTypeName.ofProjectLocationAgentSessionEntityTypeName( + "[PROJECT]", "[LOCATION]", "[AGENT]", "[SESSION]", "[ENTITY_TYPE]") + .toString()) + .addAllEntities(new ArrayList()) + .build(); mockSessionEntityTypes.addResponse(expectedResponse); SessionEntityTypeName name = @@ -183,9 +196,10 @@ public void getSessionEntityTypeTest() { List actualRequests = mockSessionEntityTypes.getRequests(); Assert.assertEquals(1, actualRequests.size()); - GetSessionEntityTypeRequest actualRequest = (GetSessionEntityTypeRequest) actualRequests.get(0); + GetSessionEntityTypeRequest actualRequest = + ((GetSessionEntityTypeRequest) actualRequests.get(0)); - Assert.assertEquals(name, SessionEntityTypeName.parse(actualRequest.getName())); + Assert.assertEquals(name.toString(), actualRequest.getName()); Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), @@ -193,31 +207,74 @@ public void getSessionEntityTypeTest() { } @Test - @SuppressWarnings("all") public void getSessionEntityTypeExceptionTest() throws Exception { - StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockSessionEntityTypes.addException(exception); try { SessionEntityTypeName name = SessionEntityTypeName.ofProjectLocationAgentSessionEntityTypeName( "[PROJECT]", "[LOCATION]", "[AGENT]", "[SESSION]", "[ENTITY_TYPE]"); + client.getSessionEntityType(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void getSessionEntityTypeTest2() throws Exception { + SessionEntityType expectedResponse = + SessionEntityType.newBuilder() + .setName( + SessionEntityTypeName.ofProjectLocationAgentSessionEntityTypeName( + "[PROJECT]", "[LOCATION]", "[AGENT]", "[SESSION]", "[ENTITY_TYPE]") + .toString()) + .addAllEntities(new ArrayList()) + .build(); + mockSessionEntityTypes.addResponse(expectedResponse); + String name = "name3373707"; + + SessionEntityType actualResponse = client.getSessionEntityType(name); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockSessionEntityTypes.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + GetSessionEntityTypeRequest actualRequest = + ((GetSessionEntityTypeRequest) actualRequests.get(0)); + + Assert.assertEquals(name, actualRequest.getName()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void getSessionEntityTypeExceptionTest2() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockSessionEntityTypes.addException(exception); + + try { + String name = "name3373707"; client.getSessionEntityType(name); Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { - // Expected exception + // Expected exception. } } @Test - @SuppressWarnings("all") - public void createSessionEntityTypeTest() { - SessionEntityTypeName name = - SessionEntityTypeName.ofProjectLocationAgentSessionEntityTypeName( - "[PROJECT]", "[LOCATION]", "[AGENT]", "[SESSION]", "[ENTITY_TYPE]"); + public void createSessionEntityTypeTest() throws Exception { SessionEntityType expectedResponse = - SessionEntityType.newBuilder().setName(name.toString()).build(); + SessionEntityType.newBuilder() + .setName( + SessionEntityTypeName.ofProjectLocationAgentSessionEntityTypeName( + "[PROJECT]", "[LOCATION]", "[AGENT]", "[SESSION]", "[ENTITY_TYPE]") + .toString()) + .addAllEntities(new ArrayList()) + .build(); mockSessionEntityTypes.addResponse(expectedResponse); SessionName parent = @@ -231,9 +288,9 @@ public void createSessionEntityTypeTest() { List actualRequests = mockSessionEntityTypes.getRequests(); Assert.assertEquals(1, actualRequests.size()); CreateSessionEntityTypeRequest actualRequest = - (CreateSessionEntityTypeRequest) actualRequests.get(0); + ((CreateSessionEntityTypeRequest) actualRequests.get(0)); - Assert.assertEquals(parent, SessionName.parse(actualRequest.getParent())); + Assert.assertEquals(parent.toString(), actualRequest.getParent()); Assert.assertEquals(sessionEntityType, actualRequest.getSessionEntityType()); Assert.assertTrue( channelProvider.isHeaderSent( @@ -242,9 +299,8 @@ public void createSessionEntityTypeTest() { } @Test - @SuppressWarnings("all") public void createSessionEntityTypeExceptionTest() throws Exception { - StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockSessionEntityTypes.addException(exception); try { @@ -252,22 +308,69 @@ public void createSessionEntityTypeExceptionTest() throws Exception { SessionName.ofProjectLocationAgentSessionName( "[PROJECT]", "[LOCATION]", "[AGENT]", "[SESSION]"); SessionEntityType sessionEntityType = SessionEntityType.newBuilder().build(); + client.createSessionEntityType(parent, sessionEntityType); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + @Test + public void createSessionEntityTypeTest2() throws Exception { + SessionEntityType expectedResponse = + SessionEntityType.newBuilder() + .setName( + SessionEntityTypeName.ofProjectLocationAgentSessionEntityTypeName( + "[PROJECT]", "[LOCATION]", "[AGENT]", "[SESSION]", "[ENTITY_TYPE]") + .toString()) + .addAllEntities(new ArrayList()) + .build(); + mockSessionEntityTypes.addResponse(expectedResponse); + + String parent = "parent-995424086"; + SessionEntityType sessionEntityType = SessionEntityType.newBuilder().build(); + + SessionEntityType actualResponse = client.createSessionEntityType(parent, sessionEntityType); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockSessionEntityTypes.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + CreateSessionEntityTypeRequest actualRequest = + ((CreateSessionEntityTypeRequest) actualRequests.get(0)); + + Assert.assertEquals(parent, actualRequest.getParent()); + Assert.assertEquals(sessionEntityType, actualRequest.getSessionEntityType()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void createSessionEntityTypeExceptionTest2() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockSessionEntityTypes.addException(exception); + + try { + String parent = "parent-995424086"; + SessionEntityType sessionEntityType = SessionEntityType.newBuilder().build(); client.createSessionEntityType(parent, sessionEntityType); Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { - // Expected exception + // Expected exception. } } @Test - @SuppressWarnings("all") - public void updateSessionEntityTypeTest() { - SessionEntityTypeName name = - SessionEntityTypeName.ofProjectLocationAgentSessionEntityTypeName( - "[PROJECT]", "[LOCATION]", "[AGENT]", "[SESSION]", "[ENTITY_TYPE]"); + public void updateSessionEntityTypeTest() throws Exception { SessionEntityType expectedResponse = - SessionEntityType.newBuilder().setName(name.toString()).build(); + SessionEntityType.newBuilder() + .setName( + SessionEntityTypeName.ofProjectLocationAgentSessionEntityTypeName( + "[PROJECT]", "[LOCATION]", "[AGENT]", "[SESSION]", "[ENTITY_TYPE]") + .toString()) + .addAllEntities(new ArrayList()) + .build(); mockSessionEntityTypes.addResponse(expectedResponse); SessionEntityType sessionEntityType = SessionEntityType.newBuilder().build(); @@ -280,7 +383,7 @@ public void updateSessionEntityTypeTest() { List actualRequests = mockSessionEntityTypes.getRequests(); Assert.assertEquals(1, actualRequests.size()); UpdateSessionEntityTypeRequest actualRequest = - (UpdateSessionEntityTypeRequest) actualRequests.get(0); + ((UpdateSessionEntityTypeRequest) actualRequests.get(0)); Assert.assertEquals(sessionEntityType, actualRequest.getSessionEntityType()); Assert.assertEquals(updateMask, actualRequest.getUpdateMask()); @@ -291,25 +394,22 @@ public void updateSessionEntityTypeTest() { } @Test - @SuppressWarnings("all") public void updateSessionEntityTypeExceptionTest() throws Exception { - StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockSessionEntityTypes.addException(exception); try { SessionEntityType sessionEntityType = SessionEntityType.newBuilder().build(); FieldMask updateMask = FieldMask.newBuilder().build(); - client.updateSessionEntityType(sessionEntityType, updateMask); Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { - // Expected exception + // Expected exception. } } @Test - @SuppressWarnings("all") - public void deleteSessionEntityTypeTest() { + public void deleteSessionEntityTypeTest() throws Exception { Empty expectedResponse = Empty.newBuilder().build(); mockSessionEntityTypes.addResponse(expectedResponse); @@ -322,9 +422,9 @@ public void deleteSessionEntityTypeTest() { List actualRequests = mockSessionEntityTypes.getRequests(); Assert.assertEquals(1, actualRequests.size()); DeleteSessionEntityTypeRequest actualRequest = - (DeleteSessionEntityTypeRequest) actualRequests.get(0); + ((DeleteSessionEntityTypeRequest) actualRequests.get(0)); - Assert.assertEquals(name, SessionEntityTypeName.parse(actualRequest.getName())); + Assert.assertEquals(name.toString(), actualRequest.getName()); Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), @@ -332,20 +432,53 @@ public void deleteSessionEntityTypeTest() { } @Test - @SuppressWarnings("all") public void deleteSessionEntityTypeExceptionTest() throws Exception { - StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockSessionEntityTypes.addException(exception); try { SessionEntityTypeName name = SessionEntityTypeName.ofProjectLocationAgentSessionEntityTypeName( "[PROJECT]", "[LOCATION]", "[AGENT]", "[SESSION]", "[ENTITY_TYPE]"); + client.deleteSessionEntityType(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void deleteSessionEntityTypeTest2() throws Exception { + Empty expectedResponse = Empty.newBuilder().build(); + mockSessionEntityTypes.addResponse(expectedResponse); + + String name = "name3373707"; + client.deleteSessionEntityType(name); + + List actualRequests = mockSessionEntityTypes.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + DeleteSessionEntityTypeRequest actualRequest = + ((DeleteSessionEntityTypeRequest) actualRequests.get(0)); + + Assert.assertEquals(name, actualRequest.getName()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void deleteSessionEntityTypeExceptionTest2() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockSessionEntityTypes.addException(exception); + + try { + String name = "name3373707"; client.deleteSessionEntityType(name); Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { - // Expected exception + // Expected exception. } } } diff --git a/google-cloud-dialogflow-cx/src/test/java/com/google/cloud/dialogflow/cx/v3beta1/SessionsClientTest.java b/google-cloud-dialogflow-cx/src/test/java/com/google/cloud/dialogflow/cx/v3beta1/SessionsClientTest.java index b50df1371..94621025a 100644 --- a/google-cloud-dialogflow-cx/src/test/java/com/google/cloud/dialogflow/cx/v3beta1/SessionsClientTest.java +++ b/google-cloud-dialogflow-cx/src/test/java/com/google/cloud/dialogflow/cx/v3beta1/SessionsClientTest.java @@ -5,7 +5,7 @@ * 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 + * 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, @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.google.cloud.dialogflow.cx.v3beta1; import com.google.api.gax.core.NoCredentialsProvider; @@ -28,13 +29,14 @@ import com.google.api.gax.rpc.StatusCode; import com.google.protobuf.AbstractMessage; import com.google.protobuf.ByteString; -import io.grpc.Status; import io.grpc.StatusRuntimeException; import java.io.IOException; +import java.util.ArrayList; import java.util.Arrays; import java.util.List; import java.util.UUID; import java.util.concurrent.ExecutionException; +import javax.annotation.Generated; import org.junit.After; import org.junit.AfterClass; import org.junit.Assert; @@ -42,63 +44,31 @@ import org.junit.BeforeClass; import org.junit.Test; -@javax.annotation.Generated("by GAPIC") +@Generated("by gapic-generator-java") public class SessionsClientTest { - private static MockPages mockPages; - private static MockFlows mockFlows; - private static MockAgents mockAgents; - private static MockEntityTypes mockEntityTypes; - private static MockEnvironments mockEnvironments; - private static MockIntents mockIntents; - private static MockSessionEntityTypes mockSessionEntityTypes; - private static MockSessions mockSessions; - private static MockTransitionRouteGroups mockTransitionRouteGroups; - private static MockVersions mockVersions; - private static MockWebhooks mockWebhooks; - private static MockServiceHelper serviceHelper; + private static MockServiceHelper mockServiceHelper; private SessionsClient client; private LocalChannelProvider channelProvider; + private static MockSessions mockSessions; @BeforeClass public static void startStaticServer() { - mockPages = new MockPages(); - mockFlows = new MockFlows(); - mockAgents = new MockAgents(); - mockEntityTypes = new MockEntityTypes(); - mockEnvironments = new MockEnvironments(); - mockIntents = new MockIntents(); - mockSessionEntityTypes = new MockSessionEntityTypes(); mockSessions = new MockSessions(); - mockTransitionRouteGroups = new MockTransitionRouteGroups(); - mockVersions = new MockVersions(); - mockWebhooks = new MockWebhooks(); - serviceHelper = + mockServiceHelper = new MockServiceHelper( - UUID.randomUUID().toString(), - Arrays.asList( - mockPages, - mockFlows, - mockAgents, - mockEntityTypes, - mockEnvironments, - mockIntents, - mockSessionEntityTypes, - mockSessions, - mockTransitionRouteGroups, - mockVersions, - mockWebhooks)); - serviceHelper.start(); + UUID.randomUUID().toString(), Arrays.asList(mockSessions)); + mockServiceHelper.start(); } @AfterClass public static void stopServer() { - serviceHelper.stop(); + mockServiceHelper.stop(); } @Before public void setUp() throws IOException { - serviceHelper.reset(); - channelProvider = serviceHelper.createChannelProvider(); + mockServiceHelper.reset(); + channelProvider = mockServiceHelper.createChannelProvider(); SessionsSettings settings = SessionsSettings.newBuilder() .setTransportChannelProvider(channelProvider) @@ -113,25 +83,25 @@ public void tearDown() throws Exception { } @Test - @SuppressWarnings("all") - public void detectIntentTest() { - String responseId = "responseId1847552473"; - ByteString outputAudio = ByteString.copyFromUtf8("24"); + public void detectIntentTest() throws Exception { DetectIntentResponse expectedResponse = DetectIntentResponse.newBuilder() - .setResponseId(responseId) - .setOutputAudio(outputAudio) + .setResponseId("responseId-633138884") + .setQueryResult(QueryResult.newBuilder().build()) + .setOutputAudio(ByteString.EMPTY) + .setOutputAudioConfig(OutputAudioConfig.newBuilder().build()) .build(); mockSessions.addResponse(expectedResponse); - SessionName session = - SessionName.ofProjectLocationAgentSessionName( - "[PROJECT]", "[LOCATION]", "[AGENT]", "[SESSION]"); - QueryInput queryInput = QueryInput.newBuilder().build(); DetectIntentRequest request = DetectIntentRequest.newBuilder() - .setSession(session.toString()) - .setQueryInput(queryInput) + .setSession( + SessionName.ofProjectLocationAgentSessionName( + "[PROJECT]", "[LOCATION]", "[AGENT]", "[SESSION]") + .toString()) + .setQueryParams(QueryParameters.newBuilder().build()) + .setQueryInput(QueryInput.newBuilder().build()) + .setOutputAudioConfig(OutputAudioConfig.newBuilder().build()) .build(); DetectIntentResponse actualResponse = client.detectIntent(request); @@ -139,10 +109,12 @@ public void detectIntentTest() { List actualRequests = mockSessions.getRequests(); Assert.assertEquals(1, actualRequests.size()); - DetectIntentRequest actualRequest = (DetectIntentRequest) actualRequests.get(0); + DetectIntentRequest actualRequest = ((DetectIntentRequest) actualRequests.get(0)); - Assert.assertEquals(session, SessionName.parse(actualRequest.getSession())); - Assert.assertEquals(queryInput, actualRequest.getQueryInput()); + Assert.assertEquals(request.getSession(), actualRequest.getSession()); + Assert.assertEquals(request.getQueryParams(), actualRequest.getQueryParams()); + Assert.assertEquals(request.getQueryInput(), actualRequest.getQueryInput()); + Assert.assertEquals(request.getOutputAudioConfig(), actualRequest.getOutputAudioConfig()); Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), @@ -150,38 +122,43 @@ public void detectIntentTest() { } @Test - @SuppressWarnings("all") public void detectIntentExceptionTest() throws Exception { - StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockSessions.addException(exception); try { - SessionName session = - SessionName.ofProjectLocationAgentSessionName( - "[PROJECT]", "[LOCATION]", "[AGENT]", "[SESSION]"); - QueryInput queryInput = QueryInput.newBuilder().build(); DetectIntentRequest request = DetectIntentRequest.newBuilder() - .setSession(session.toString()) - .setQueryInput(queryInput) + .setSession( + SessionName.ofProjectLocationAgentSessionName( + "[PROJECT]", "[LOCATION]", "[AGENT]", "[SESSION]") + .toString()) + .setQueryParams(QueryParameters.newBuilder().build()) + .setQueryInput(QueryInput.newBuilder().build()) + .setOutputAudioConfig(OutputAudioConfig.newBuilder().build()) .build(); - client.detectIntent(request); Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { - // Expected exception + // Expected exception. } } @Test - @SuppressWarnings("all") public void streamingDetectIntentTest() throws Exception { StreamingDetectIntentResponse expectedResponse = StreamingDetectIntentResponse.newBuilder().build(); mockSessions.addResponse(expectedResponse); - QueryInput queryInput = QueryInput.newBuilder().build(); StreamingDetectIntentRequest request = - StreamingDetectIntentRequest.newBuilder().setQueryInput(queryInput).build(); + StreamingDetectIntentRequest.newBuilder() + .setSession( + SessionName.ofProjectLocationAgentSessionName( + "[PROJECT]", "[LOCATION]", "[AGENT]", "[SESSION]") + .toString()) + .setQueryParams(QueryParameters.newBuilder().build()) + .setQueryInput(QueryInput.newBuilder().build()) + .setOutputAudioConfig(OutputAudioConfig.newBuilder().build()) + .build(); MockStreamObserver responseObserver = new MockStreamObserver<>(); @@ -199,13 +176,19 @@ public void streamingDetectIntentTest() throws Exception { } @Test - @SuppressWarnings("all") public void streamingDetectIntentExceptionTest() throws Exception { - StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockSessions.addException(exception); - QueryInput queryInput = QueryInput.newBuilder().build(); StreamingDetectIntentRequest request = - StreamingDetectIntentRequest.newBuilder().setQueryInput(queryInput).build(); + StreamingDetectIntentRequest.newBuilder() + .setSession( + SessionName.ofProjectLocationAgentSessionName( + "[PROJECT]", "[LOCATION]", "[AGENT]", "[SESSION]") + .toString()) + .setQueryParams(QueryParameters.newBuilder().build()) + .setQueryInput(QueryInput.newBuilder().build()) + .setOutputAudioConfig(OutputAudioConfig.newBuilder().build()) + .build(); MockStreamObserver responseObserver = new MockStreamObserver<>(); @@ -221,26 +204,28 @@ public void streamingDetectIntentExceptionTest() throws Exception { Assert.fail("No exception thrown"); } catch (ExecutionException e) { Assert.assertTrue(e.getCause() instanceof InvalidArgumentException); - InvalidArgumentException apiException = (InvalidArgumentException) e.getCause(); + InvalidArgumentException apiException = ((InvalidArgumentException) e.getCause()); Assert.assertEquals(StatusCode.Code.INVALID_ARGUMENT, apiException.getStatusCode().getCode()); } } @Test - @SuppressWarnings("all") - public void matchIntentTest() { - String text = "text3556653"; - MatchIntentResponse expectedResponse = MatchIntentResponse.newBuilder().setText(text).build(); + public void matchIntentTest() throws Exception { + MatchIntentResponse expectedResponse = + MatchIntentResponse.newBuilder() + .addAllMatches(new ArrayList()) + .setCurrentPage(Page.newBuilder().build()) + .build(); mockSessions.addResponse(expectedResponse); - SessionName session = - SessionName.ofProjectLocationAgentSessionName( - "[PROJECT]", "[LOCATION]", "[AGENT]", "[SESSION]"); - QueryInput queryInput = QueryInput.newBuilder().build(); MatchIntentRequest request = MatchIntentRequest.newBuilder() - .setSession(session.toString()) - .setQueryInput(queryInput) + .setSession( + SessionName.ofProjectLocationAgentSessionName( + "[PROJECT]", "[LOCATION]", "[AGENT]", "[SESSION]") + .toString()) + .setQueryParams(QueryParameters.newBuilder().build()) + .setQueryInput(QueryInput.newBuilder().build()) .build(); MatchIntentResponse actualResponse = client.matchIntent(request); @@ -248,10 +233,11 @@ public void matchIntentTest() { List actualRequests = mockSessions.getRequests(); Assert.assertEquals(1, actualRequests.size()); - MatchIntentRequest actualRequest = (MatchIntentRequest) actualRequests.get(0); + MatchIntentRequest actualRequest = ((MatchIntentRequest) actualRequests.get(0)); - Assert.assertEquals(session, SessionName.parse(actualRequest.getSession())); - Assert.assertEquals(queryInput, actualRequest.getQueryInput()); + Assert.assertEquals(request.getSession(), actualRequest.getSession()); + Assert.assertEquals(request.getQueryParams(), actualRequest.getQueryParams()); + Assert.assertEquals(request.getQueryInput(), actualRequest.getQueryInput()); Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), @@ -259,50 +245,55 @@ public void matchIntentTest() { } @Test - @SuppressWarnings("all") public void matchIntentExceptionTest() throws Exception { - StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockSessions.addException(exception); try { - SessionName session = - SessionName.ofProjectLocationAgentSessionName( - "[PROJECT]", "[LOCATION]", "[AGENT]", "[SESSION]"); - QueryInput queryInput = QueryInput.newBuilder().build(); MatchIntentRequest request = MatchIntentRequest.newBuilder() - .setSession(session.toString()) - .setQueryInput(queryInput) + .setSession( + SessionName.ofProjectLocationAgentSessionName( + "[PROJECT]", "[LOCATION]", "[AGENT]", "[SESSION]") + .toString()) + .setQueryParams(QueryParameters.newBuilder().build()) + .setQueryInput(QueryInput.newBuilder().build()) .build(); - client.matchIntent(request); Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { - // Expected exception + // Expected exception. } } @Test - @SuppressWarnings("all") - public void fulfillIntentTest() { - String responseId = "responseId1847552473"; - ByteString outputAudio = ByteString.copyFromUtf8("24"); + public void fulfillIntentTest() throws Exception { FulfillIntentResponse expectedResponse = FulfillIntentResponse.newBuilder() - .setResponseId(responseId) - .setOutputAudio(outputAudio) + .setResponseId("responseId-633138884") + .setQueryResult(QueryResult.newBuilder().build()) + .setOutputAudio(ByteString.EMPTY) + .setOutputAudioConfig(OutputAudioConfig.newBuilder().build()) .build(); mockSessions.addResponse(expectedResponse); - FulfillIntentRequest request = FulfillIntentRequest.newBuilder().build(); + FulfillIntentRequest request = + FulfillIntentRequest.newBuilder() + .setMatchIntentRequest(MatchIntentRequest.newBuilder().build()) + .setMatch(Match.newBuilder().build()) + .setOutputAudioConfig(OutputAudioConfig.newBuilder().build()) + .build(); FulfillIntentResponse actualResponse = client.fulfillIntent(request); Assert.assertEquals(expectedResponse, actualResponse); List actualRequests = mockSessions.getRequests(); Assert.assertEquals(1, actualRequests.size()); - FulfillIntentRequest actualRequest = (FulfillIntentRequest) actualRequests.get(0); + FulfillIntentRequest actualRequest = ((FulfillIntentRequest) actualRequests.get(0)); + Assert.assertEquals(request.getMatchIntentRequest(), actualRequest.getMatchIntentRequest()); + Assert.assertEquals(request.getMatch(), actualRequest.getMatch()); + Assert.assertEquals(request.getOutputAudioConfig(), actualRequest.getOutputAudioConfig()); Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), @@ -310,18 +301,21 @@ public void fulfillIntentTest() { } @Test - @SuppressWarnings("all") public void fulfillIntentExceptionTest() throws Exception { - StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockSessions.addException(exception); try { - FulfillIntentRequest request = FulfillIntentRequest.newBuilder().build(); - + FulfillIntentRequest request = + FulfillIntentRequest.newBuilder() + .setMatchIntentRequest(MatchIntentRequest.newBuilder().build()) + .setMatch(Match.newBuilder().build()) + .setOutputAudioConfig(OutputAudioConfig.newBuilder().build()) + .build(); client.fulfillIntent(request); Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { - // Expected exception + // Expected exception. } } } diff --git a/google-cloud-dialogflow-cx/src/test/java/com/google/cloud/dialogflow/cx/v3beta1/TransitionRouteGroupsClientTest.java b/google-cloud-dialogflow-cx/src/test/java/com/google/cloud/dialogflow/cx/v3beta1/TransitionRouteGroupsClientTest.java index ae3224fde..aa6487fa3 100644 --- a/google-cloud-dialogflow-cx/src/test/java/com/google/cloud/dialogflow/cx/v3beta1/TransitionRouteGroupsClientTest.java +++ b/google-cloud-dialogflow-cx/src/test/java/com/google/cloud/dialogflow/cx/v3beta1/TransitionRouteGroupsClientTest.java @@ -5,7 +5,7 @@ * 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 + * 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, @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.google.cloud.dialogflow.cx.v3beta1; import static com.google.cloud.dialogflow.cx.v3beta1.TransitionRouteGroupsClient.ListTransitionRouteGroupsPagedResponse; @@ -28,12 +29,13 @@ import com.google.protobuf.AbstractMessage; import com.google.protobuf.Empty; import com.google.protobuf.FieldMask; -import io.grpc.Status; import io.grpc.StatusRuntimeException; import java.io.IOException; +import java.util.ArrayList; import java.util.Arrays; import java.util.List; import java.util.UUID; +import javax.annotation.Generated; import org.junit.After; import org.junit.AfterClass; import org.junit.Assert; @@ -41,63 +43,32 @@ import org.junit.BeforeClass; import org.junit.Test; -@javax.annotation.Generated("by GAPIC") +@Generated("by gapic-generator-java") public class TransitionRouteGroupsClientTest { - private static MockPages mockPages; - private static MockFlows mockFlows; - private static MockAgents mockAgents; - private static MockEntityTypes mockEntityTypes; - private static MockEnvironments mockEnvironments; - private static MockIntents mockIntents; - private static MockSessionEntityTypes mockSessionEntityTypes; - private static MockSessions mockSessions; private static MockTransitionRouteGroups mockTransitionRouteGroups; - private static MockVersions mockVersions; - private static MockWebhooks mockWebhooks; - private static MockServiceHelper serviceHelper; + private static MockServiceHelper mockServiceHelper; private TransitionRouteGroupsClient client; private LocalChannelProvider channelProvider; @BeforeClass public static void startStaticServer() { - mockPages = new MockPages(); - mockFlows = new MockFlows(); - mockAgents = new MockAgents(); - mockEntityTypes = new MockEntityTypes(); - mockEnvironments = new MockEnvironments(); - mockIntents = new MockIntents(); - mockSessionEntityTypes = new MockSessionEntityTypes(); - mockSessions = new MockSessions(); mockTransitionRouteGroups = new MockTransitionRouteGroups(); - mockVersions = new MockVersions(); - mockWebhooks = new MockWebhooks(); - serviceHelper = + mockServiceHelper = new MockServiceHelper( UUID.randomUUID().toString(), - Arrays.asList( - mockPages, - mockFlows, - mockAgents, - mockEntityTypes, - mockEnvironments, - mockIntents, - mockSessionEntityTypes, - mockSessions, - mockTransitionRouteGroups, - mockVersions, - mockWebhooks)); - serviceHelper.start(); + Arrays.asList(mockTransitionRouteGroups)); + mockServiceHelper.start(); } @AfterClass public static void stopServer() { - serviceHelper.stop(); + mockServiceHelper.stop(); } @Before public void setUp() throws IOException { - serviceHelper.reset(); - channelProvider = serviceHelper.createChannelProvider(); + mockServiceHelper.reset(); + channelProvider = mockServiceHelper.createChannelProvider(); TransitionRouteGroupsSettings settings = TransitionRouteGroupsSettings.newBuilder() .setTransportChannelProvider(channelProvider) @@ -112,15 +83,12 @@ public void tearDown() throws Exception { } @Test - @SuppressWarnings("all") - public void listTransitionRouteGroupsTest() { - String nextPageToken = ""; - TransitionRouteGroup transitionRouteGroupsElement = TransitionRouteGroup.newBuilder().build(); - List transitionRouteGroups = Arrays.asList(transitionRouteGroupsElement); + public void listTransitionRouteGroupsTest() throws Exception { + TransitionRouteGroup responsesElement = TransitionRouteGroup.newBuilder().build(); ListTransitionRouteGroupsResponse expectedResponse = ListTransitionRouteGroupsResponse.newBuilder() - .setNextPageToken(nextPageToken) - .addAllTransitionRouteGroups(transitionRouteGroups) + .setNextPageToken("") + .addAllTransitionRouteGroups(Arrays.asList(responsesElement)) .build(); mockTransitionRouteGroups.addResponse(expectedResponse); @@ -130,15 +98,16 @@ public void listTransitionRouteGroupsTest() { client.listTransitionRouteGroups(parent); List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + Assert.assertEquals(1, resources.size()); Assert.assertEquals(expectedResponse.getTransitionRouteGroupsList().get(0), resources.get(0)); List actualRequests = mockTransitionRouteGroups.getRequests(); Assert.assertEquals(1, actualRequests.size()); ListTransitionRouteGroupsRequest actualRequest = - (ListTransitionRouteGroupsRequest) actualRequests.get(0); + ((ListTransitionRouteGroupsRequest) actualRequests.get(0)); - Assert.assertEquals(parent, FlowName.parse(actualRequest.getParent())); + Assert.assertEquals(parent.toString(), actualRequest.getParent()); Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), @@ -146,32 +115,75 @@ public void listTransitionRouteGroupsTest() { } @Test - @SuppressWarnings("all") public void listTransitionRouteGroupsExceptionTest() throws Exception { - StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockTransitionRouteGroups.addException(exception); try { FlowName parent = FlowName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]"); + client.listTransitionRouteGroups(parent); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void listTransitionRouteGroupsTest2() throws Exception { + TransitionRouteGroup responsesElement = TransitionRouteGroup.newBuilder().build(); + ListTransitionRouteGroupsResponse expectedResponse = + ListTransitionRouteGroupsResponse.newBuilder() + .setNextPageToken("") + .addAllTransitionRouteGroups(Arrays.asList(responsesElement)) + .build(); + mockTransitionRouteGroups.addResponse(expectedResponse); + + String parent = "parent-995424086"; + + ListTransitionRouteGroupsPagedResponse pagedListResponse = + client.listTransitionRouteGroups(parent); + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getTransitionRouteGroupsList().get(0), resources.get(0)); + + List actualRequests = mockTransitionRouteGroups.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + ListTransitionRouteGroupsRequest actualRequest = + ((ListTransitionRouteGroupsRequest) actualRequests.get(0)); + + Assert.assertEquals(parent, actualRequest.getParent()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void listTransitionRouteGroupsExceptionTest2() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockTransitionRouteGroups.addException(exception); + + try { + String parent = "parent-995424086"; client.listTransitionRouteGroups(parent); Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { - // Expected exception + // Expected exception. } } @Test - @SuppressWarnings("all") - public void getTransitionRouteGroupTest() { - TransitionRouteGroupName name2 = - TransitionRouteGroupName.of( - "[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]", "[TRANSITION_ROUTE_GROUP]"); - String displayName = "displayName1615086568"; + public void getTransitionRouteGroupTest() throws Exception { TransitionRouteGroup expectedResponse = TransitionRouteGroup.newBuilder() - .setName(name2.toString()) - .setDisplayName(displayName) + .setName( + TransitionRouteGroupName.of( + "[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]", "[TRANSITION_ROUTE_GROUP]") + .toString()) + .setDisplayName("displayName1714148973") + .addAllTransitionRoutes(new ArrayList()) .build(); mockTransitionRouteGroups.addResponse(expectedResponse); @@ -185,9 +197,9 @@ public void getTransitionRouteGroupTest() { List actualRequests = mockTransitionRouteGroups.getRequests(); Assert.assertEquals(1, actualRequests.size()); GetTransitionRouteGroupRequest actualRequest = - (GetTransitionRouteGroupRequest) actualRequests.get(0); + ((GetTransitionRouteGroupRequest) actualRequests.get(0)); - Assert.assertEquals(name, TransitionRouteGroupName.parse(actualRequest.getName())); + Assert.assertEquals(name.toString(), actualRequest.getName()); Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), @@ -195,34 +207,75 @@ public void getTransitionRouteGroupTest() { } @Test - @SuppressWarnings("all") public void getTransitionRouteGroupExceptionTest() throws Exception { - StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockTransitionRouteGroups.addException(exception); try { TransitionRouteGroupName name = TransitionRouteGroupName.of( "[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]", "[TRANSITION_ROUTE_GROUP]"); + client.getTransitionRouteGroup(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + @Test + public void getTransitionRouteGroupTest2() throws Exception { + TransitionRouteGroup expectedResponse = + TransitionRouteGroup.newBuilder() + .setName( + TransitionRouteGroupName.of( + "[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]", "[TRANSITION_ROUTE_GROUP]") + .toString()) + .setDisplayName("displayName1714148973") + .addAllTransitionRoutes(new ArrayList()) + .build(); + mockTransitionRouteGroups.addResponse(expectedResponse); + + String name = "name3373707"; + + TransitionRouteGroup actualResponse = client.getTransitionRouteGroup(name); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockTransitionRouteGroups.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + GetTransitionRouteGroupRequest actualRequest = + ((GetTransitionRouteGroupRequest) actualRequests.get(0)); + + Assert.assertEquals(name, actualRequest.getName()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void getTransitionRouteGroupExceptionTest2() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockTransitionRouteGroups.addException(exception); + + try { + String name = "name3373707"; client.getTransitionRouteGroup(name); Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { - // Expected exception + // Expected exception. } } @Test - @SuppressWarnings("all") - public void createTransitionRouteGroupTest() { - TransitionRouteGroupName name = - TransitionRouteGroupName.of( - "[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]", "[TRANSITION_ROUTE_GROUP]"); - String displayName = "displayName1615086568"; + public void createTransitionRouteGroupTest() throws Exception { TransitionRouteGroup expectedResponse = TransitionRouteGroup.newBuilder() - .setName(name.toString()) - .setDisplayName(displayName) + .setName( + TransitionRouteGroupName.of( + "[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]", "[TRANSITION_ROUTE_GROUP]") + .toString()) + .setDisplayName("displayName1714148973") + .addAllTransitionRoutes(new ArrayList()) .build(); mockTransitionRouteGroups.addResponse(expectedResponse); @@ -236,9 +289,9 @@ public void createTransitionRouteGroupTest() { List actualRequests = mockTransitionRouteGroups.getRequests(); Assert.assertEquals(1, actualRequests.size()); CreateTransitionRouteGroupRequest actualRequest = - (CreateTransitionRouteGroupRequest) actualRequests.get(0); + ((CreateTransitionRouteGroupRequest) actualRequests.get(0)); - Assert.assertEquals(parent, FlowName.parse(actualRequest.getParent())); + Assert.assertEquals(parent.toString(), actualRequest.getParent()); Assert.assertEquals(transitionRouteGroup, actualRequest.getTransitionRouteGroup()); Assert.assertTrue( channelProvider.isHeaderSent( @@ -247,33 +300,78 @@ public void createTransitionRouteGroupTest() { } @Test - @SuppressWarnings("all") public void createTransitionRouteGroupExceptionTest() throws Exception { - StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockTransitionRouteGroups.addException(exception); try { FlowName parent = FlowName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]"); TransitionRouteGroup transitionRouteGroup = TransitionRouteGroup.newBuilder().build(); + client.createTransitionRouteGroup(parent, transitionRouteGroup); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void createTransitionRouteGroupTest2() throws Exception { + TransitionRouteGroup expectedResponse = + TransitionRouteGroup.newBuilder() + .setName( + TransitionRouteGroupName.of( + "[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]", "[TRANSITION_ROUTE_GROUP]") + .toString()) + .setDisplayName("displayName1714148973") + .addAllTransitionRoutes(new ArrayList()) + .build(); + mockTransitionRouteGroups.addResponse(expectedResponse); + + String parent = "parent-995424086"; + TransitionRouteGroup transitionRouteGroup = TransitionRouteGroup.newBuilder().build(); + + TransitionRouteGroup actualResponse = + client.createTransitionRouteGroup(parent, transitionRouteGroup); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockTransitionRouteGroups.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + CreateTransitionRouteGroupRequest actualRequest = + ((CreateTransitionRouteGroupRequest) actualRequests.get(0)); + + Assert.assertEquals(parent, actualRequest.getParent()); + Assert.assertEquals(transitionRouteGroup, actualRequest.getTransitionRouteGroup()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void createTransitionRouteGroupExceptionTest2() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockTransitionRouteGroups.addException(exception); + try { + String parent = "parent-995424086"; + TransitionRouteGroup transitionRouteGroup = TransitionRouteGroup.newBuilder().build(); client.createTransitionRouteGroup(parent, transitionRouteGroup); Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { - // Expected exception + // Expected exception. } } @Test - @SuppressWarnings("all") - public void updateTransitionRouteGroupTest() { - TransitionRouteGroupName name = - TransitionRouteGroupName.of( - "[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]", "[TRANSITION_ROUTE_GROUP]"); - String displayName = "displayName1615086568"; + public void updateTransitionRouteGroupTest() throws Exception { TransitionRouteGroup expectedResponse = TransitionRouteGroup.newBuilder() - .setName(name.toString()) - .setDisplayName(displayName) + .setName( + TransitionRouteGroupName.of( + "[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]", "[TRANSITION_ROUTE_GROUP]") + .toString()) + .setDisplayName("displayName1714148973") + .addAllTransitionRoutes(new ArrayList()) .build(); mockTransitionRouteGroups.addResponse(expectedResponse); @@ -287,7 +385,7 @@ public void updateTransitionRouteGroupTest() { List actualRequests = mockTransitionRouteGroups.getRequests(); Assert.assertEquals(1, actualRequests.size()); UpdateTransitionRouteGroupRequest actualRequest = - (UpdateTransitionRouteGroupRequest) actualRequests.get(0); + ((UpdateTransitionRouteGroupRequest) actualRequests.get(0)); Assert.assertEquals(transitionRouteGroup, actualRequest.getTransitionRouteGroup()); Assert.assertEquals(updateMask, actualRequest.getUpdateMask()); @@ -298,25 +396,22 @@ public void updateTransitionRouteGroupTest() { } @Test - @SuppressWarnings("all") public void updateTransitionRouteGroupExceptionTest() throws Exception { - StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockTransitionRouteGroups.addException(exception); try { TransitionRouteGroup transitionRouteGroup = TransitionRouteGroup.newBuilder().build(); FieldMask updateMask = FieldMask.newBuilder().build(); - client.updateTransitionRouteGroup(transitionRouteGroup, updateMask); Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { - // Expected exception + // Expected exception. } } @Test - @SuppressWarnings("all") - public void deleteTransitionRouteGroupTest() { + public void deleteTransitionRouteGroupTest() throws Exception { Empty expectedResponse = Empty.newBuilder().build(); mockTransitionRouteGroups.addResponse(expectedResponse); @@ -329,9 +424,9 @@ public void deleteTransitionRouteGroupTest() { List actualRequests = mockTransitionRouteGroups.getRequests(); Assert.assertEquals(1, actualRequests.size()); DeleteTransitionRouteGroupRequest actualRequest = - (DeleteTransitionRouteGroupRequest) actualRequests.get(0); + ((DeleteTransitionRouteGroupRequest) actualRequests.get(0)); - Assert.assertEquals(name, TransitionRouteGroupName.parse(actualRequest.getName())); + Assert.assertEquals(name.toString(), actualRequest.getName()); Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), @@ -339,20 +434,53 @@ public void deleteTransitionRouteGroupTest() { } @Test - @SuppressWarnings("all") public void deleteTransitionRouteGroupExceptionTest() throws Exception { - StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockTransitionRouteGroups.addException(exception); try { TransitionRouteGroupName name = TransitionRouteGroupName.of( "[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]", "[TRANSITION_ROUTE_GROUP]"); + client.deleteTransitionRouteGroup(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void deleteTransitionRouteGroupTest2() throws Exception { + Empty expectedResponse = Empty.newBuilder().build(); + mockTransitionRouteGroups.addResponse(expectedResponse); + + String name = "name3373707"; + client.deleteTransitionRouteGroup(name); + + List actualRequests = mockTransitionRouteGroups.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + DeleteTransitionRouteGroupRequest actualRequest = + ((DeleteTransitionRouteGroupRequest) actualRequests.get(0)); + + Assert.assertEquals(name, actualRequest.getName()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void deleteTransitionRouteGroupExceptionTest2() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockTransitionRouteGroups.addException(exception); + + try { + String name = "name3373707"; client.deleteTransitionRouteGroup(name); Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { - // Expected exception + // Expected exception. } } } diff --git a/google-cloud-dialogflow-cx/src/test/java/com/google/cloud/dialogflow/cx/v3beta1/VersionsClientTest.java b/google-cloud-dialogflow-cx/src/test/java/com/google/cloud/dialogflow/cx/v3beta1/VersionsClientTest.java index 46f74f9cc..4811a4ea6 100644 --- a/google-cloud-dialogflow-cx/src/test/java/com/google/cloud/dialogflow/cx/v3beta1/VersionsClientTest.java +++ b/google-cloud-dialogflow-cx/src/test/java/com/google/cloud/dialogflow/cx/v3beta1/VersionsClientTest.java @@ -5,7 +5,7 @@ * 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 + * 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, @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.google.cloud.dialogflow.cx.v3beta1; import static com.google.cloud.dialogflow.cx.v3beta1.VersionsClient.ListVersionsPagedResponse; @@ -31,13 +32,14 @@ import com.google.protobuf.Any; import com.google.protobuf.Empty; import com.google.protobuf.FieldMask; -import io.grpc.Status; +import com.google.protobuf.Timestamp; import io.grpc.StatusRuntimeException; import java.io.IOException; import java.util.Arrays; import java.util.List; import java.util.UUID; import java.util.concurrent.ExecutionException; +import javax.annotation.Generated; import org.junit.After; import org.junit.AfterClass; import org.junit.Assert; @@ -45,63 +47,31 @@ import org.junit.BeforeClass; import org.junit.Test; -@javax.annotation.Generated("by GAPIC") +@Generated("by gapic-generator-java") public class VersionsClientTest { - private static MockPages mockPages; - private static MockFlows mockFlows; - private static MockAgents mockAgents; - private static MockEntityTypes mockEntityTypes; - private static MockEnvironments mockEnvironments; - private static MockIntents mockIntents; - private static MockSessionEntityTypes mockSessionEntityTypes; - private static MockSessions mockSessions; - private static MockTransitionRouteGroups mockTransitionRouteGroups; private static MockVersions mockVersions; - private static MockWebhooks mockWebhooks; - private static MockServiceHelper serviceHelper; + private static MockServiceHelper mockServiceHelper; private VersionsClient client; private LocalChannelProvider channelProvider; @BeforeClass public static void startStaticServer() { - mockPages = new MockPages(); - mockFlows = new MockFlows(); - mockAgents = new MockAgents(); - mockEntityTypes = new MockEntityTypes(); - mockEnvironments = new MockEnvironments(); - mockIntents = new MockIntents(); - mockSessionEntityTypes = new MockSessionEntityTypes(); - mockSessions = new MockSessions(); - mockTransitionRouteGroups = new MockTransitionRouteGroups(); mockVersions = new MockVersions(); - mockWebhooks = new MockWebhooks(); - serviceHelper = + mockServiceHelper = new MockServiceHelper( - UUID.randomUUID().toString(), - Arrays.asList( - mockPages, - mockFlows, - mockAgents, - mockEntityTypes, - mockEnvironments, - mockIntents, - mockSessionEntityTypes, - mockSessions, - mockTransitionRouteGroups, - mockVersions, - mockWebhooks)); - serviceHelper.start(); + UUID.randomUUID().toString(), Arrays.asList(mockVersions)); + mockServiceHelper.start(); } @AfterClass public static void stopServer() { - serviceHelper.stop(); + mockServiceHelper.stop(); } @Before public void setUp() throws IOException { - serviceHelper.reset(); - channelProvider = serviceHelper.createChannelProvider(); + mockServiceHelper.reset(); + channelProvider = mockServiceHelper.createChannelProvider(); VersionsSettings settings = VersionsSettings.newBuilder() .setTransportChannelProvider(channelProvider) @@ -116,15 +86,12 @@ public void tearDown() throws Exception { } @Test - @SuppressWarnings("all") - public void listVersionsTest() { - String nextPageToken = ""; - Version versionsElement = Version.newBuilder().build(); - List versions = Arrays.asList(versionsElement); + public void listVersionsTest() throws Exception { + Version responsesElement = Version.newBuilder().build(); ListVersionsResponse expectedResponse = ListVersionsResponse.newBuilder() - .setNextPageToken(nextPageToken) - .addAllVersions(versions) + .setNextPageToken("") + .addAllVersions(Arrays.asList(responsesElement)) .build(); mockVersions.addResponse(expectedResponse); @@ -133,14 +100,15 @@ public void listVersionsTest() { ListVersionsPagedResponse pagedListResponse = client.listVersions(parent); List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + Assert.assertEquals(1, resources.size()); Assert.assertEquals(expectedResponse.getVersionsList().get(0), resources.get(0)); List actualRequests = mockVersions.getRequests(); Assert.assertEquals(1, actualRequests.size()); - ListVersionsRequest actualRequest = (ListVersionsRequest) actualRequests.get(0); + ListVersionsRequest actualRequest = ((ListVersionsRequest) actualRequests.get(0)); - Assert.assertEquals(parent, FlowName.parse(actualRequest.getParent())); + Assert.assertEquals(parent.toString(), actualRequest.getParent()); Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), @@ -148,32 +116,74 @@ public void listVersionsTest() { } @Test - @SuppressWarnings("all") public void listVersionsExceptionTest() throws Exception { - StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockVersions.addException(exception); try { FlowName parent = FlowName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]"); + client.listVersions(parent); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void listVersionsTest2() throws Exception { + Version responsesElement = Version.newBuilder().build(); + ListVersionsResponse expectedResponse = + ListVersionsResponse.newBuilder() + .setNextPageToken("") + .addAllVersions(Arrays.asList(responsesElement)) + .build(); + mockVersions.addResponse(expectedResponse); + + String parent = "parent-995424086"; + + ListVersionsPagedResponse pagedListResponse = client.listVersions(parent); + + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getVersionsList().get(0), resources.get(0)); + List actualRequests = mockVersions.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + ListVersionsRequest actualRequest = ((ListVersionsRequest) actualRequests.get(0)); + + Assert.assertEquals(parent, actualRequest.getParent()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void listVersionsExceptionTest2() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockVersions.addException(exception); + + try { + String parent = "parent-995424086"; client.listVersions(parent); Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { - // Expected exception + // Expected exception. } } @Test - @SuppressWarnings("all") - public void getVersionTest() { - VersionName name2 = VersionName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]", "[VERSION]"); - String displayName = "displayName1615086568"; - String description = "description-1724546052"; + public void getVersionTest() throws Exception { Version expectedResponse = Version.newBuilder() - .setName(name2.toString()) - .setDisplayName(displayName) - .setDescription(description) + .setName( + VersionName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]", "[VERSION]") + .toString()) + .setDisplayName("displayName1714148973") + .setDescription("description-1724546052") + .setNluSettings(NluSettings.newBuilder().build()) + .setCreateTime(Timestamp.newBuilder().build()) .build(); mockVersions.addResponse(expectedResponse); @@ -184,9 +194,9 @@ public void getVersionTest() { List actualRequests = mockVersions.getRequests(); Assert.assertEquals(1, actualRequests.size()); - GetVersionRequest actualRequest = (GetVersionRequest) actualRequests.get(0); + GetVersionRequest actualRequest = ((GetVersionRequest) actualRequests.get(0)); - Assert.assertEquals(name, VersionName.parse(actualRequest.getName())); + Assert.assertEquals(name.toString(), actualRequest.getName()); Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), @@ -194,33 +204,75 @@ public void getVersionTest() { } @Test - @SuppressWarnings("all") public void getVersionExceptionTest() throws Exception { - StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockVersions.addException(exception); try { VersionName name = VersionName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]", "[VERSION]"); + client.getVersion(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + @Test + public void getVersionTest2() throws Exception { + Version expectedResponse = + Version.newBuilder() + .setName( + VersionName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]", "[VERSION]") + .toString()) + .setDisplayName("displayName1714148973") + .setDescription("description-1724546052") + .setNluSettings(NluSettings.newBuilder().build()) + .setCreateTime(Timestamp.newBuilder().build()) + .build(); + mockVersions.addResponse(expectedResponse); + + String name = "name3373707"; + + Version actualResponse = client.getVersion(name); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockVersions.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + GetVersionRequest actualRequest = ((GetVersionRequest) actualRequests.get(0)); + + Assert.assertEquals(name, actualRequest.getName()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void getVersionExceptionTest2() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockVersions.addException(exception); + + try { + String name = "name3373707"; client.getVersion(name); Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { - // Expected exception + // Expected exception. } } @Test - @SuppressWarnings("all") public void createVersionTest() throws Exception { - VersionName name = VersionName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]", "[VERSION]"); - String displayName = "displayName1615086568"; - String description = "description-1724546052"; Version expectedResponse = Version.newBuilder() - .setName(name.toString()) - .setDisplayName(displayName) - .setDescription(description) + .setName( + VersionName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]", "[VERSION]") + .toString()) + .setDisplayName("displayName1714148973") + .setDescription("description-1724546052") + .setNluSettings(NluSettings.newBuilder().build()) + .setCreateTime(Timestamp.newBuilder().build()) .build(); Operation resultOperation = Operation.newBuilder() @@ -238,9 +290,9 @@ public void createVersionTest() throws Exception { List actualRequests = mockVersions.getRequests(); Assert.assertEquals(1, actualRequests.size()); - CreateVersionRequest actualRequest = (CreateVersionRequest) actualRequests.get(0); + CreateVersionRequest actualRequest = ((CreateVersionRequest) actualRequests.get(0)); - Assert.assertEquals(parent, FlowName.parse(actualRequest.getParent())); + Assert.assertEquals(parent.toString(), actualRequest.getParent()); Assert.assertEquals(version, actualRequest.getVersion()); Assert.assertTrue( channelProvider.isHeaderSent( @@ -249,35 +301,88 @@ public void createVersionTest() throws Exception { } @Test - @SuppressWarnings("all") public void createVersionExceptionTest() throws Exception { - StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockVersions.addException(exception); try { FlowName parent = FlowName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]"); Version version = Version.newBuilder().build(); + client.createVersionAsync(parent, version).get(); + Assert.fail("No exception raised"); + } catch (ExecutionException e) { + Assert.assertEquals(InvalidArgumentException.class, e.getCause().getClass()); + InvalidArgumentException apiException = ((InvalidArgumentException) e.getCause()); + Assert.assertEquals(StatusCode.Code.INVALID_ARGUMENT, apiException.getStatusCode().getCode()); + } + } + + @Test + public void createVersionTest2() throws Exception { + Version expectedResponse = + Version.newBuilder() + .setName( + VersionName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]", "[VERSION]") + .toString()) + .setDisplayName("displayName1714148973") + .setDescription("description-1724546052") + .setNluSettings(NluSettings.newBuilder().build()) + .setCreateTime(Timestamp.newBuilder().build()) + .build(); + Operation resultOperation = + Operation.newBuilder() + .setName("createVersionTest") + .setDone(true) + .setResponse(Any.pack(expectedResponse)) + .build(); + mockVersions.addResponse(resultOperation); + + String parent = "parent-995424086"; + Version version = Version.newBuilder().build(); + + Version actualResponse = client.createVersionAsync(parent, version).get(); + Assert.assertEquals(expectedResponse, actualResponse); + List actualRequests = mockVersions.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + CreateVersionRequest actualRequest = ((CreateVersionRequest) actualRequests.get(0)); + + Assert.assertEquals(parent, actualRequest.getParent()); + Assert.assertEquals(version, actualRequest.getVersion()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void createVersionExceptionTest2() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockVersions.addException(exception); + + try { + String parent = "parent-995424086"; + Version version = Version.newBuilder().build(); client.createVersionAsync(parent, version).get(); Assert.fail("No exception raised"); } catch (ExecutionException e) { Assert.assertEquals(InvalidArgumentException.class, e.getCause().getClass()); - InvalidArgumentException apiException = (InvalidArgumentException) e.getCause(); + InvalidArgumentException apiException = ((InvalidArgumentException) e.getCause()); Assert.assertEquals(StatusCode.Code.INVALID_ARGUMENT, apiException.getStatusCode().getCode()); } } @Test - @SuppressWarnings("all") - public void updateVersionTest() { - VersionName name = VersionName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]", "[VERSION]"); - String displayName = "displayName1615086568"; - String description = "description-1724546052"; + public void updateVersionTest() throws Exception { Version expectedResponse = Version.newBuilder() - .setName(name.toString()) - .setDisplayName(displayName) - .setDescription(description) + .setName( + VersionName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]", "[VERSION]") + .toString()) + .setDisplayName("displayName1714148973") + .setDescription("description-1724546052") + .setNluSettings(NluSettings.newBuilder().build()) + .setCreateTime(Timestamp.newBuilder().build()) .build(); mockVersions.addResponse(expectedResponse); @@ -289,7 +394,7 @@ public void updateVersionTest() { List actualRequests = mockVersions.getRequests(); Assert.assertEquals(1, actualRequests.size()); - UpdateVersionRequest actualRequest = (UpdateVersionRequest) actualRequests.get(0); + UpdateVersionRequest actualRequest = ((UpdateVersionRequest) actualRequests.get(0)); Assert.assertEquals(version, actualRequest.getVersion()); Assert.assertEquals(updateMask, actualRequest.getUpdateMask()); @@ -300,25 +405,22 @@ public void updateVersionTest() { } @Test - @SuppressWarnings("all") public void updateVersionExceptionTest() throws Exception { - StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockVersions.addException(exception); try { Version version = Version.newBuilder().build(); FieldMask updateMask = FieldMask.newBuilder().build(); - client.updateVersion(version, updateMask); Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { - // Expected exception + // Expected exception. } } @Test - @SuppressWarnings("all") - public void deleteVersionTest() { + public void deleteVersionTest() throws Exception { Empty expectedResponse = Empty.newBuilder().build(); mockVersions.addResponse(expectedResponse); @@ -328,9 +430,9 @@ public void deleteVersionTest() { List actualRequests = mockVersions.getRequests(); Assert.assertEquals(1, actualRequests.size()); - DeleteVersionRequest actualRequest = (DeleteVersionRequest) actualRequests.get(0); + DeleteVersionRequest actualRequest = ((DeleteVersionRequest) actualRequests.get(0)); - Assert.assertEquals(name, VersionName.parse(actualRequest.getName())); + Assert.assertEquals(name.toString(), actualRequest.getName()); Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), @@ -338,24 +440,55 @@ public void deleteVersionTest() { } @Test - @SuppressWarnings("all") public void deleteVersionExceptionTest() throws Exception { - StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockVersions.addException(exception); try { VersionName name = VersionName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]", "[VERSION]"); + client.deleteVersion(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void deleteVersionTest2() throws Exception { + Empty expectedResponse = Empty.newBuilder().build(); + mockVersions.addResponse(expectedResponse); + + String name = "name3373707"; + + client.deleteVersion(name); + + List actualRequests = mockVersions.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + DeleteVersionRequest actualRequest = ((DeleteVersionRequest) actualRequests.get(0)); + Assert.assertEquals(name, actualRequest.getName()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void deleteVersionExceptionTest2() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockVersions.addException(exception); + + try { + String name = "name3373707"; client.deleteVersion(name); Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { - // Expected exception + // Expected exception. } } @Test - @SuppressWarnings("all") public void loadVersionTest() throws Exception { Empty expectedResponse = Empty.newBuilder().build(); Operation resultOperation = @@ -368,14 +501,13 @@ public void loadVersionTest() throws Exception { VersionName name = VersionName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]", "[VERSION]"); - Empty actualResponse = client.loadVersionAsync(name).get(); - Assert.assertEquals(expectedResponse, actualResponse); + client.loadVersionAsync(name).get(); List actualRequests = mockVersions.getRequests(); Assert.assertEquals(1, actualRequests.size()); - LoadVersionRequest actualRequest = (LoadVersionRequest) actualRequests.get(0); + LoadVersionRequest actualRequest = ((LoadVersionRequest) actualRequests.get(0)); - Assert.assertEquals(name, VersionName.parse(actualRequest.getName())); + Assert.assertEquals(name.toString(), actualRequest.getName()); Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), @@ -383,20 +515,60 @@ public void loadVersionTest() throws Exception { } @Test - @SuppressWarnings("all") public void loadVersionExceptionTest() throws Exception { - StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockVersions.addException(exception); try { VersionName name = VersionName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]", "[VERSION]"); + client.loadVersionAsync(name).get(); + Assert.fail("No exception raised"); + } catch (ExecutionException e) { + Assert.assertEquals(InvalidArgumentException.class, e.getCause().getClass()); + InvalidArgumentException apiException = ((InvalidArgumentException) e.getCause()); + Assert.assertEquals(StatusCode.Code.INVALID_ARGUMENT, apiException.getStatusCode().getCode()); + } + } + + @Test + public void loadVersionTest2() throws Exception { + Empty expectedResponse = Empty.newBuilder().build(); + Operation resultOperation = + Operation.newBuilder() + .setName("loadVersionTest") + .setDone(true) + .setResponse(Any.pack(expectedResponse)) + .build(); + mockVersions.addResponse(resultOperation); + + String name = "name3373707"; + + client.loadVersionAsync(name).get(); + + List actualRequests = mockVersions.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + LoadVersionRequest actualRequest = ((LoadVersionRequest) actualRequests.get(0)); + Assert.assertEquals(name, actualRequest.getName()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void loadVersionExceptionTest2() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockVersions.addException(exception); + + try { + String name = "name3373707"; client.loadVersionAsync(name).get(); Assert.fail("No exception raised"); } catch (ExecutionException e) { Assert.assertEquals(InvalidArgumentException.class, e.getCause().getClass()); - InvalidArgumentException apiException = (InvalidArgumentException) e.getCause(); + InvalidArgumentException apiException = ((InvalidArgumentException) e.getCause()); Assert.assertEquals(StatusCode.Code.INVALID_ARGUMENT, apiException.getStatusCode().getCode()); } } diff --git a/google-cloud-dialogflow-cx/src/test/java/com/google/cloud/dialogflow/cx/v3beta1/WebhooksClientTest.java b/google-cloud-dialogflow-cx/src/test/java/com/google/cloud/dialogflow/cx/v3beta1/WebhooksClientTest.java index 23110d933..772973a7f 100644 --- a/google-cloud-dialogflow-cx/src/test/java/com/google/cloud/dialogflow/cx/v3beta1/WebhooksClientTest.java +++ b/google-cloud-dialogflow-cx/src/test/java/com/google/cloud/dialogflow/cx/v3beta1/WebhooksClientTest.java @@ -5,7 +5,7 @@ * 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 + * 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, @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.google.cloud.dialogflow.cx.v3beta1; import static com.google.cloud.dialogflow.cx.v3beta1.WebhooksClient.ListWebhooksPagedResponse; @@ -26,14 +27,15 @@ import com.google.api.gax.rpc.InvalidArgumentException; import com.google.common.collect.Lists; import com.google.protobuf.AbstractMessage; +import com.google.protobuf.Duration; import com.google.protobuf.Empty; import com.google.protobuf.FieldMask; -import io.grpc.Status; import io.grpc.StatusRuntimeException; import java.io.IOException; import java.util.Arrays; import java.util.List; import java.util.UUID; +import javax.annotation.Generated; import org.junit.After; import org.junit.AfterClass; import org.junit.Assert; @@ -41,63 +43,31 @@ import org.junit.BeforeClass; import org.junit.Test; -@javax.annotation.Generated("by GAPIC") +@Generated("by gapic-generator-java") public class WebhooksClientTest { - private static MockPages mockPages; - private static MockFlows mockFlows; - private static MockAgents mockAgents; - private static MockEntityTypes mockEntityTypes; - private static MockEnvironments mockEnvironments; - private static MockIntents mockIntents; - private static MockSessionEntityTypes mockSessionEntityTypes; - private static MockSessions mockSessions; - private static MockTransitionRouteGroups mockTransitionRouteGroups; - private static MockVersions mockVersions; private static MockWebhooks mockWebhooks; - private static MockServiceHelper serviceHelper; + private static MockServiceHelper mockServiceHelper; private WebhooksClient client; private LocalChannelProvider channelProvider; @BeforeClass public static void startStaticServer() { - mockPages = new MockPages(); - mockFlows = new MockFlows(); - mockAgents = new MockAgents(); - mockEntityTypes = new MockEntityTypes(); - mockEnvironments = new MockEnvironments(); - mockIntents = new MockIntents(); - mockSessionEntityTypes = new MockSessionEntityTypes(); - mockSessions = new MockSessions(); - mockTransitionRouteGroups = new MockTransitionRouteGroups(); - mockVersions = new MockVersions(); mockWebhooks = new MockWebhooks(); - serviceHelper = + mockServiceHelper = new MockServiceHelper( - UUID.randomUUID().toString(), - Arrays.asList( - mockPages, - mockFlows, - mockAgents, - mockEntityTypes, - mockEnvironments, - mockIntents, - mockSessionEntityTypes, - mockSessions, - mockTransitionRouteGroups, - mockVersions, - mockWebhooks)); - serviceHelper.start(); + UUID.randomUUID().toString(), Arrays.asList(mockWebhooks)); + mockServiceHelper.start(); } @AfterClass public static void stopServer() { - serviceHelper.stop(); + mockServiceHelper.stop(); } @Before public void setUp() throws IOException { - serviceHelper.reset(); - channelProvider = serviceHelper.createChannelProvider(); + mockServiceHelper.reset(); + channelProvider = mockServiceHelper.createChannelProvider(); WebhooksSettings settings = WebhooksSettings.newBuilder() .setTransportChannelProvider(channelProvider) @@ -112,15 +82,12 @@ public void tearDown() throws Exception { } @Test - @SuppressWarnings("all") - public void listWebhooksTest() { - String nextPageToken = ""; - Webhook webhooksElement = Webhook.newBuilder().build(); - List webhooks = Arrays.asList(webhooksElement); + public void listWebhooksTest() throws Exception { + Webhook responsesElement = Webhook.newBuilder().build(); ListWebhooksResponse expectedResponse = ListWebhooksResponse.newBuilder() - .setNextPageToken(nextPageToken) - .addAllWebhooks(webhooks) + .setNextPageToken("") + .addAllWebhooks(Arrays.asList(responsesElement)) .build(); mockWebhooks.addResponse(expectedResponse); @@ -129,14 +96,15 @@ public void listWebhooksTest() { ListWebhooksPagedResponse pagedListResponse = client.listWebhooks(parent); List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + Assert.assertEquals(1, resources.size()); Assert.assertEquals(expectedResponse.getWebhooksList().get(0), resources.get(0)); List actualRequests = mockWebhooks.getRequests(); Assert.assertEquals(1, actualRequests.size()); - ListWebhooksRequest actualRequest = (ListWebhooksRequest) actualRequests.get(0); + ListWebhooksRequest actualRequest = ((ListWebhooksRequest) actualRequests.get(0)); - Assert.assertEquals(parent, AgentName.parse(actualRequest.getParent())); + Assert.assertEquals(parent.toString(), actualRequest.getParent()); Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), @@ -144,32 +112,71 @@ public void listWebhooksTest() { } @Test - @SuppressWarnings("all") public void listWebhooksExceptionTest() throws Exception { - StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockWebhooks.addException(exception); try { AgentName parent = AgentName.of("[PROJECT]", "[LOCATION]", "[AGENT]"); + client.listWebhooks(parent); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void listWebhooksTest2() throws Exception { + Webhook responsesElement = Webhook.newBuilder().build(); + ListWebhooksResponse expectedResponse = + ListWebhooksResponse.newBuilder() + .setNextPageToken("") + .addAllWebhooks(Arrays.asList(responsesElement)) + .build(); + mockWebhooks.addResponse(expectedResponse); + + String parent = "parent-995424086"; + + ListWebhooksPagedResponse pagedListResponse = client.listWebhooks(parent); + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getWebhooksList().get(0), resources.get(0)); + + List actualRequests = mockWebhooks.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + ListWebhooksRequest actualRequest = ((ListWebhooksRequest) actualRequests.get(0)); + + Assert.assertEquals(parent, actualRequest.getParent()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void listWebhooksExceptionTest2() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockWebhooks.addException(exception); + + try { + String parent = "parent-995424086"; client.listWebhooks(parent); Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { - // Expected exception + // Expected exception. } } @Test - @SuppressWarnings("all") - public void getWebhookTest() { - WebhookName name2 = WebhookName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[WEBHOOK]"); - String displayName = "displayName1615086568"; - boolean disabled = true; + public void getWebhookTest() throws Exception { Webhook expectedResponse = Webhook.newBuilder() - .setName(name2.toString()) - .setDisplayName(displayName) - .setDisabled(disabled) + .setName(WebhookName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[WEBHOOK]").toString()) + .setDisplayName("displayName1714148973") + .setTimeout(Duration.newBuilder().build()) + .setDisabled(true) .build(); mockWebhooks.addResponse(expectedResponse); @@ -180,9 +187,9 @@ public void getWebhookTest() { List actualRequests = mockWebhooks.getRequests(); Assert.assertEquals(1, actualRequests.size()); - GetWebhookRequest actualRequest = (GetWebhookRequest) actualRequests.get(0); + GetWebhookRequest actualRequest = ((GetWebhookRequest) actualRequests.get(0)); - Assert.assertEquals(name, WebhookName.parse(actualRequest.getName())); + Assert.assertEquals(name.toString(), actualRequest.getName()); Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), @@ -190,32 +197,68 @@ public void getWebhookTest() { } @Test - @SuppressWarnings("all") public void getWebhookExceptionTest() throws Exception { - StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockWebhooks.addException(exception); try { WebhookName name = WebhookName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[WEBHOOK]"); + client.getWebhook(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void getWebhookTest2() throws Exception { + Webhook expectedResponse = + Webhook.newBuilder() + .setName(WebhookName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[WEBHOOK]").toString()) + .setDisplayName("displayName1714148973") + .setTimeout(Duration.newBuilder().build()) + .setDisabled(true) + .build(); + mockWebhooks.addResponse(expectedResponse); + + String name = "name3373707"; + + Webhook actualResponse = client.getWebhook(name); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockWebhooks.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + GetWebhookRequest actualRequest = ((GetWebhookRequest) actualRequests.get(0)); + + Assert.assertEquals(name, actualRequest.getName()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void getWebhookExceptionTest2() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockWebhooks.addException(exception); + try { + String name = "name3373707"; client.getWebhook(name); Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { - // Expected exception + // Expected exception. } } @Test - @SuppressWarnings("all") - public void createWebhookTest() { - WebhookName name = WebhookName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[WEBHOOK]"); - String displayName = "displayName1615086568"; - boolean disabled = true; + public void createWebhookTest() throws Exception { Webhook expectedResponse = Webhook.newBuilder() - .setName(name.toString()) - .setDisplayName(displayName) - .setDisabled(disabled) + .setName(WebhookName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[WEBHOOK]").toString()) + .setDisplayName("displayName1714148973") + .setTimeout(Duration.newBuilder().build()) + .setDisabled(true) .build(); mockWebhooks.addResponse(expectedResponse); @@ -227,9 +270,9 @@ public void createWebhookTest() { List actualRequests = mockWebhooks.getRequests(); Assert.assertEquals(1, actualRequests.size()); - CreateWebhookRequest actualRequest = (CreateWebhookRequest) actualRequests.get(0); + CreateWebhookRequest actualRequest = ((CreateWebhookRequest) actualRequests.get(0)); - Assert.assertEquals(parent, AgentName.parse(actualRequest.getParent())); + Assert.assertEquals(parent.toString(), actualRequest.getParent()); Assert.assertEquals(webhook, actualRequest.getWebhook()); Assert.assertTrue( channelProvider.isHeaderSent( @@ -238,33 +281,72 @@ public void createWebhookTest() { } @Test - @SuppressWarnings("all") public void createWebhookExceptionTest() throws Exception { - StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockWebhooks.addException(exception); try { AgentName parent = AgentName.of("[PROJECT]", "[LOCATION]", "[AGENT]"); Webhook webhook = Webhook.newBuilder().build(); + client.createWebhook(parent, webhook); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void createWebhookTest2() throws Exception { + Webhook expectedResponse = + Webhook.newBuilder() + .setName(WebhookName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[WEBHOOK]").toString()) + .setDisplayName("displayName1714148973") + .setTimeout(Duration.newBuilder().build()) + .setDisabled(true) + .build(); + mockWebhooks.addResponse(expectedResponse); + + String parent = "parent-995424086"; + Webhook webhook = Webhook.newBuilder().build(); + + Webhook actualResponse = client.createWebhook(parent, webhook); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockWebhooks.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + CreateWebhookRequest actualRequest = ((CreateWebhookRequest) actualRequests.get(0)); + + Assert.assertEquals(parent, actualRequest.getParent()); + Assert.assertEquals(webhook, actualRequest.getWebhook()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void createWebhookExceptionTest2() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockWebhooks.addException(exception); + try { + String parent = "parent-995424086"; + Webhook webhook = Webhook.newBuilder().build(); client.createWebhook(parent, webhook); Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { - // Expected exception + // Expected exception. } } @Test - @SuppressWarnings("all") - public void updateWebhookTest() { - WebhookName name = WebhookName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[WEBHOOK]"); - String displayName = "displayName1615086568"; - boolean disabled = true; + public void updateWebhookTest() throws Exception { Webhook expectedResponse = Webhook.newBuilder() - .setName(name.toString()) - .setDisplayName(displayName) - .setDisabled(disabled) + .setName(WebhookName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[WEBHOOK]").toString()) + .setDisplayName("displayName1714148973") + .setTimeout(Duration.newBuilder().build()) + .setDisabled(true) .build(); mockWebhooks.addResponse(expectedResponse); @@ -276,7 +358,7 @@ public void updateWebhookTest() { List actualRequests = mockWebhooks.getRequests(); Assert.assertEquals(1, actualRequests.size()); - UpdateWebhookRequest actualRequest = (UpdateWebhookRequest) actualRequests.get(0); + UpdateWebhookRequest actualRequest = ((UpdateWebhookRequest) actualRequests.get(0)); Assert.assertEquals(webhook, actualRequest.getWebhook()); Assert.assertEquals(updateMask, actualRequest.getUpdateMask()); @@ -287,25 +369,22 @@ public void updateWebhookTest() { } @Test - @SuppressWarnings("all") public void updateWebhookExceptionTest() throws Exception { - StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockWebhooks.addException(exception); try { Webhook webhook = Webhook.newBuilder().build(); FieldMask updateMask = FieldMask.newBuilder().build(); - client.updateWebhook(webhook, updateMask); Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { - // Expected exception + // Expected exception. } } @Test - @SuppressWarnings("all") - public void deleteWebhookTest() { + public void deleteWebhookTest() throws Exception { Empty expectedResponse = Empty.newBuilder().build(); mockWebhooks.addResponse(expectedResponse); @@ -315,9 +394,9 @@ public void deleteWebhookTest() { List actualRequests = mockWebhooks.getRequests(); Assert.assertEquals(1, actualRequests.size()); - DeleteWebhookRequest actualRequest = (DeleteWebhookRequest) actualRequests.get(0); + DeleteWebhookRequest actualRequest = ((DeleteWebhookRequest) actualRequests.get(0)); - Assert.assertEquals(name, WebhookName.parse(actualRequest.getName())); + Assert.assertEquals(name.toString(), actualRequest.getName()); Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), @@ -325,18 +404,50 @@ public void deleteWebhookTest() { } @Test - @SuppressWarnings("all") public void deleteWebhookExceptionTest() throws Exception { - StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockWebhooks.addException(exception); try { WebhookName name = WebhookName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[WEBHOOK]"); + client.deleteWebhook(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void deleteWebhookTest2() throws Exception { + Empty expectedResponse = Empty.newBuilder().build(); + mockWebhooks.addResponse(expectedResponse); + + String name = "name3373707"; + client.deleteWebhook(name); + + List actualRequests = mockWebhooks.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + DeleteWebhookRequest actualRequest = ((DeleteWebhookRequest) actualRequests.get(0)); + + Assert.assertEquals(name, actualRequest.getName()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void deleteWebhookExceptionTest2() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockWebhooks.addException(exception); + + try { + String name = "name3373707"; client.deleteWebhook(name); Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { - // Expected exception + // Expected exception. } } } diff --git a/grpc-google-cloud-dialogflow-cx-v3beta1/src/main/java/com/google/cloud/dialogflow/cx/v3beta1/SessionsGrpc.java b/grpc-google-cloud-dialogflow-cx-v3beta1/src/main/java/com/google/cloud/dialogflow/cx/v3beta1/SessionsGrpc.java index ad3ac2aac..0fcea04c1 100644 --- a/grpc-google-cloud-dialogflow-cx-v3beta1/src/main/java/com/google/cloud/dialogflow/cx/v3beta1/SessionsGrpc.java +++ b/grpc-google-cloud-dialogflow-cx-v3beta1/src/main/java/com/google/cloud/dialogflow/cx/v3beta1/SessionsGrpc.java @@ -290,6 +290,9 @@ public abstract static class SessionsImplBase implements io.grpc.BindableService * as a result. This method is not idempotent, because it may cause session * entity types to be updated, which in turn might affect results of future * queries. + * Note: Always use agent versions for production traffic. + * See [Versions and + * environments](https://cloud.google.com/dialogflow/cx/docs/concept/version). * */ public void detectIntent( @@ -306,6 +309,9 @@ public void detectIntent( * Processes a natural language query in audio format in a streaming fashion * and returns structured, actionable data as a result. This method is only * available via the gRPC API (not REST). + * Note: Always use agent versions for production traffic. + * See [Versions and + * environments](https://cloud.google.com/dialogflow/cx/docs/concept/version). * */ public io.grpc.stub.StreamObserver< @@ -410,6 +416,9 @@ protected SessionsStub build(io.grpc.Channel channel, io.grpc.CallOptions callOp * as a result. This method is not idempotent, because it may cause session * entity types to be updated, which in turn might affect results of future * queries. + * Note: Always use agent versions for production traffic. + * See [Versions and + * environments](https://cloud.google.com/dialogflow/cx/docs/concept/version). * */ public void detectIntent( @@ -429,6 +438,9 @@ public void detectIntent( * Processes a natural language query in audio format in a streaming fashion * and returns structured, actionable data as a result. This method is only * available via the gRPC API (not REST). + * Note: Always use agent versions for production traffic. + * See [Versions and + * environments](https://cloud.google.com/dialogflow/cx/docs/concept/version). * */ public io.grpc.stub.StreamObserver< @@ -508,6 +520,9 @@ protected SessionsBlockingStub build(io.grpc.Channel channel, io.grpc.CallOption * as a result. This method is not idempotent, because it may cause session * entity types to be updated, which in turn might affect results of future * queries. + * Note: Always use agent versions for production traffic. + * See [Versions and + * environments](https://cloud.google.com/dialogflow/cx/docs/concept/version). * */ public com.google.cloud.dialogflow.cx.v3beta1.DetectIntentResponse detectIntent( @@ -571,6 +586,9 @@ protected SessionsFutureStub build(io.grpc.Channel channel, io.grpc.CallOptions * as a result. This method is not idempotent, because it may cause session * entity types to be updated, which in turn might affect results of future * queries. + * Note: Always use agent versions for production traffic. + * See [Versions and + * environments](https://cloud.google.com/dialogflow/cx/docs/concept/version). * */ public com.google.common.util.concurrent.ListenableFuture< diff --git a/proto-google-cloud-dialogflow-cx-v3/src/main/java/com/google/cloud/dialogflow/cx/v3/AgentName.java b/proto-google-cloud-dialogflow-cx-v3/src/main/java/com/google/cloud/dialogflow/cx/v3/AgentName.java index 14d26b7ea..989ecb038 100644 --- a/proto-google-cloud-dialogflow-cx-v3/src/main/java/com/google/cloud/dialogflow/cx/v3/AgentName.java +++ b/proto-google-cloud-dialogflow-cx-v3/src/main/java/com/google/cloud/dialogflow/cx/v3/AgentName.java @@ -5,7 +5,7 @@ * 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 + * 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, @@ -23,21 +23,33 @@ import java.util.ArrayList; import java.util.List; import java.util.Map; +import java.util.Objects; +import javax.annotation.Generated; -/** AUTO-GENERATED DOCUMENTATION AND CLASS */ -@javax.annotation.Generated("by GAPIC protoc plugin") +// AUTO-GENERATED DOCUMENTATION AND CLASS. +@Generated("by gapic-generator-java") public class AgentName implements ResourceName { - - private static final PathTemplate PATH_TEMPLATE = + private static final PathTemplate PROJECT_LOCATION_AGENT = PathTemplate.createWithoutUrlEncoding( "projects/{project}/locations/{location}/agents/{agent}"); - private volatile Map fieldValuesMap; - private final String project; private final String location; private final String agent; + @Deprecated + protected AgentName() { + project = null; + location = null; + agent = null; + } + + private AgentName(Builder builder) { + project = Preconditions.checkNotNull(builder.getProject()); + location = Preconditions.checkNotNull(builder.getLocation()); + agent = Preconditions.checkNotNull(builder.getAgent()); + } + public String getProject() { return project; } @@ -58,12 +70,6 @@ public Builder toBuilder() { return new Builder(this); } - private AgentName(Builder builder) { - project = Preconditions.checkNotNull(builder.getProject()); - location = Preconditions.checkNotNull(builder.getLocation()); - agent = Preconditions.checkNotNull(builder.getAgent()); - } - public static AgentName of(String project, String location, String agent) { return newBuilder().setProject(project).setLocation(location).setAgent(agent).build(); } @@ -82,7 +88,7 @@ public static AgentName parse(String formattedString) { return null; } Map matchMap = - PATH_TEMPLATE.validatedMatch( + PROJECT_LOCATION_AGENT.validatedMatch( formattedString, "AgentName.parse: formattedString not in valid format"); return of(matchMap.get("project"), matchMap.get("location"), matchMap.get("agent")); } @@ -96,7 +102,7 @@ public static List parseList(List formattedStrings) { } public static List toStringList(List values) { - List list = new ArrayList(values.size()); + List list = new ArrayList<>(values.size()); for (AgentName value : values) { if (value == null) { list.add(""); @@ -108,17 +114,24 @@ public static List toStringList(List values) { } public static boolean isParsableFrom(String formattedString) { - return PATH_TEMPLATE.matches(formattedString); + return PROJECT_LOCATION_AGENT.matches(formattedString); } + @Override public Map getFieldValuesMap() { if (fieldValuesMap == null) { synchronized (this) { if (fieldValuesMap == null) { ImmutableMap.Builder fieldMapBuilder = ImmutableMap.builder(); - fieldMapBuilder.put("project", project); - fieldMapBuilder.put("location", location); - fieldMapBuilder.put("agent", agent); + if (project != null) { + fieldMapBuilder.put("project", project); + } + if (location != null) { + fieldMapBuilder.put("location", location); + } + if (agent != null) { + fieldMapBuilder.put("agent", agent); + } fieldValuesMap = fieldMapBuilder.build(); } } @@ -132,16 +145,44 @@ public String getFieldValue(String fieldName) { @Override public String toString() { - return PATH_TEMPLATE.instantiate("project", project, "location", location, "agent", agent); + return PROJECT_LOCATION_AGENT.instantiate( + "project", project, "location", location, "agent", agent); } - /** Builder for AgentName. */ - public static class Builder { + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o != null || getClass() == o.getClass()) { + AgentName that = ((AgentName) o); + return Objects.equals(this.project, that.project) + && Objects.equals(this.location, that.location) + && Objects.equals(this.agent, that.agent); + } + return false; + } + @Override + public int hashCode() { + int h = 1; + h *= 1000003; + h ^= Objects.hashCode(project); + h *= 1000003; + h ^= Objects.hashCode(location); + h *= 1000003; + h ^= Objects.hashCode(agent); + return h; + } + + /** Builder for projects/{project}/locations/{location}/agents/{agent}. */ + public static class Builder { private String project; private String location; private String agent; + protected Builder() {} + public String getProject() { return project; } @@ -169,8 +210,6 @@ public Builder setAgent(String agent) { return this; } - private Builder() {} - private Builder(AgentName agentName) { project = agentName.project; location = agentName.location; @@ -181,30 +220,4 @@ public AgentName build() { return new AgentName(this); } } - - @Override - public boolean equals(Object o) { - if (o == this) { - return true; - } - if (o instanceof AgentName) { - AgentName that = (AgentName) o; - return (this.project.equals(that.project)) - && (this.location.equals(that.location)) - && (this.agent.equals(that.agent)); - } - return false; - } - - @Override - public int hashCode() { - int h = 1; - h *= 1000003; - h ^= project.hashCode(); - h *= 1000003; - h ^= location.hashCode(); - h *= 1000003; - h ^= agent.hashCode(); - return h; - } } diff --git a/proto-google-cloud-dialogflow-cx-v3/src/main/java/com/google/cloud/dialogflow/cx/v3/EntityTypeName.java b/proto-google-cloud-dialogflow-cx-v3/src/main/java/com/google/cloud/dialogflow/cx/v3/EntityTypeName.java index d332c07c3..5171a11fb 100644 --- a/proto-google-cloud-dialogflow-cx-v3/src/main/java/com/google/cloud/dialogflow/cx/v3/EntityTypeName.java +++ b/proto-google-cloud-dialogflow-cx-v3/src/main/java/com/google/cloud/dialogflow/cx/v3/EntityTypeName.java @@ -5,7 +5,7 @@ * 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 + * 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, @@ -23,22 +23,36 @@ import java.util.ArrayList; import java.util.List; import java.util.Map; +import java.util.Objects; +import javax.annotation.Generated; -/** AUTO-GENERATED DOCUMENTATION AND CLASS */ -@javax.annotation.Generated("by GAPIC protoc plugin") +// AUTO-GENERATED DOCUMENTATION AND CLASS. +@Generated("by gapic-generator-java") public class EntityTypeName implements ResourceName { - - private static final PathTemplate PATH_TEMPLATE = + private static final PathTemplate PROJECT_LOCATION_AGENT_ENTITY_TYPE = PathTemplate.createWithoutUrlEncoding( "projects/{project}/locations/{location}/agents/{agent}/entityTypes/{entity_type}"); - private volatile Map fieldValuesMap; - private final String project; private final String location; private final String agent; private final String entityType; + @Deprecated + protected EntityTypeName() { + project = null; + location = null; + agent = null; + entityType = null; + } + + private EntityTypeName(Builder builder) { + project = Preconditions.checkNotNull(builder.getProject()); + location = Preconditions.checkNotNull(builder.getLocation()); + agent = Preconditions.checkNotNull(builder.getAgent()); + entityType = Preconditions.checkNotNull(builder.getEntityType()); + } + public String getProject() { return project; } @@ -63,13 +77,6 @@ public Builder toBuilder() { return new Builder(this); } - private EntityTypeName(Builder builder) { - project = Preconditions.checkNotNull(builder.getProject()); - location = Preconditions.checkNotNull(builder.getLocation()); - agent = Preconditions.checkNotNull(builder.getAgent()); - entityType = Preconditions.checkNotNull(builder.getEntityType()); - } - public static EntityTypeName of( String project, String location, String agent, String entityType) { return newBuilder() @@ -95,7 +102,7 @@ public static EntityTypeName parse(String formattedString) { return null; } Map matchMap = - PATH_TEMPLATE.validatedMatch( + PROJECT_LOCATION_AGENT_ENTITY_TYPE.validatedMatch( formattedString, "EntityTypeName.parse: formattedString not in valid format"); return of( matchMap.get("project"), @@ -113,7 +120,7 @@ public static List parseList(List formattedStrings) { } public static List toStringList(List values) { - List list = new ArrayList(values.size()); + List list = new ArrayList<>(values.size()); for (EntityTypeName value : values) { if (value == null) { list.add(""); @@ -125,18 +132,27 @@ public static List toStringList(List values) { } public static boolean isParsableFrom(String formattedString) { - return PATH_TEMPLATE.matches(formattedString); + return PROJECT_LOCATION_AGENT_ENTITY_TYPE.matches(formattedString); } + @Override public Map getFieldValuesMap() { if (fieldValuesMap == null) { synchronized (this) { if (fieldValuesMap == null) { ImmutableMap.Builder fieldMapBuilder = ImmutableMap.builder(); - fieldMapBuilder.put("project", project); - fieldMapBuilder.put("location", location); - fieldMapBuilder.put("agent", agent); - fieldMapBuilder.put("entityType", entityType); + if (project != null) { + fieldMapBuilder.put("project", project); + } + if (location != null) { + fieldMapBuilder.put("location", location); + } + if (agent != null) { + fieldMapBuilder.put("agent", agent); + } + if (entityType != null) { + fieldMapBuilder.put("entity_type", entityType); + } fieldValuesMap = fieldMapBuilder.build(); } } @@ -150,18 +166,50 @@ public String getFieldValue(String fieldName) { @Override public String toString() { - return PATH_TEMPLATE.instantiate( + return PROJECT_LOCATION_AGENT_ENTITY_TYPE.instantiate( "project", project, "location", location, "agent", agent, "entity_type", entityType); } - /** Builder for EntityTypeName. */ - public static class Builder { + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o != null || getClass() == o.getClass()) { + EntityTypeName that = ((EntityTypeName) o); + return Objects.equals(this.project, that.project) + && Objects.equals(this.location, that.location) + && Objects.equals(this.agent, that.agent) + && Objects.equals(this.entityType, that.entityType); + } + return false; + } + @Override + public int hashCode() { + int h = 1; + h *= 1000003; + h ^= Objects.hashCode(project); + h *= 1000003; + h ^= Objects.hashCode(location); + h *= 1000003; + h ^= Objects.hashCode(agent); + h *= 1000003; + h ^= Objects.hashCode(entityType); + return h; + } + + /** + * Builder for projects/{project}/locations/{location}/agents/{agent}/entityTypes/{entity_type}. + */ + public static class Builder { private String project; private String location; private String agent; private String entityType; + protected Builder() {} + public String getProject() { return project; } @@ -198,8 +246,6 @@ public Builder setEntityType(String entityType) { return this; } - private Builder() {} - private Builder(EntityTypeName entityTypeName) { project = entityTypeName.project; location = entityTypeName.location; @@ -211,33 +257,4 @@ public EntityTypeName build() { return new EntityTypeName(this); } } - - @Override - public boolean equals(Object o) { - if (o == this) { - return true; - } - if (o instanceof EntityTypeName) { - EntityTypeName that = (EntityTypeName) o; - return (this.project.equals(that.project)) - && (this.location.equals(that.location)) - && (this.agent.equals(that.agent)) - && (this.entityType.equals(that.entityType)); - } - return false; - } - - @Override - public int hashCode() { - int h = 1; - h *= 1000003; - h ^= project.hashCode(); - h *= 1000003; - h ^= location.hashCode(); - h *= 1000003; - h ^= agent.hashCode(); - h *= 1000003; - h ^= entityType.hashCode(); - return h; - } } diff --git a/proto-google-cloud-dialogflow-cx-v3/src/main/java/com/google/cloud/dialogflow/cx/v3/EnvironmentName.java b/proto-google-cloud-dialogflow-cx-v3/src/main/java/com/google/cloud/dialogflow/cx/v3/EnvironmentName.java index 69c1a1956..f1ce80ed6 100644 --- a/proto-google-cloud-dialogflow-cx-v3/src/main/java/com/google/cloud/dialogflow/cx/v3/EnvironmentName.java +++ b/proto-google-cloud-dialogflow-cx-v3/src/main/java/com/google/cloud/dialogflow/cx/v3/EnvironmentName.java @@ -5,7 +5,7 @@ * 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 + * 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, @@ -23,22 +23,36 @@ import java.util.ArrayList; import java.util.List; import java.util.Map; +import java.util.Objects; +import javax.annotation.Generated; -/** AUTO-GENERATED DOCUMENTATION AND CLASS */ -@javax.annotation.Generated("by GAPIC protoc plugin") +// AUTO-GENERATED DOCUMENTATION AND CLASS. +@Generated("by gapic-generator-java") public class EnvironmentName implements ResourceName { - - private static final PathTemplate PATH_TEMPLATE = + private static final PathTemplate PROJECT_LOCATION_AGENT_ENVIRONMENT = PathTemplate.createWithoutUrlEncoding( "projects/{project}/locations/{location}/agents/{agent}/environments/{environment}"); - private volatile Map fieldValuesMap; - private final String project; private final String location; private final String agent; private final String environment; + @Deprecated + protected EnvironmentName() { + project = null; + location = null; + agent = null; + environment = null; + } + + private EnvironmentName(Builder builder) { + project = Preconditions.checkNotNull(builder.getProject()); + location = Preconditions.checkNotNull(builder.getLocation()); + agent = Preconditions.checkNotNull(builder.getAgent()); + environment = Preconditions.checkNotNull(builder.getEnvironment()); + } + public String getProject() { return project; } @@ -63,13 +77,6 @@ public Builder toBuilder() { return new Builder(this); } - private EnvironmentName(Builder builder) { - project = Preconditions.checkNotNull(builder.getProject()); - location = Preconditions.checkNotNull(builder.getLocation()); - agent = Preconditions.checkNotNull(builder.getAgent()); - environment = Preconditions.checkNotNull(builder.getEnvironment()); - } - public static EnvironmentName of( String project, String location, String agent, String environment) { return newBuilder() @@ -95,7 +102,7 @@ public static EnvironmentName parse(String formattedString) { return null; } Map matchMap = - PATH_TEMPLATE.validatedMatch( + PROJECT_LOCATION_AGENT_ENVIRONMENT.validatedMatch( formattedString, "EnvironmentName.parse: formattedString not in valid format"); return of( matchMap.get("project"), @@ -113,7 +120,7 @@ public static List parseList(List formattedStrings) { } public static List toStringList(List values) { - List list = new ArrayList(values.size()); + List list = new ArrayList<>(values.size()); for (EnvironmentName value : values) { if (value == null) { list.add(""); @@ -125,18 +132,27 @@ public static List toStringList(List values) { } public static boolean isParsableFrom(String formattedString) { - return PATH_TEMPLATE.matches(formattedString); + return PROJECT_LOCATION_AGENT_ENVIRONMENT.matches(formattedString); } + @Override public Map getFieldValuesMap() { if (fieldValuesMap == null) { synchronized (this) { if (fieldValuesMap == null) { ImmutableMap.Builder fieldMapBuilder = ImmutableMap.builder(); - fieldMapBuilder.put("project", project); - fieldMapBuilder.put("location", location); - fieldMapBuilder.put("agent", agent); - fieldMapBuilder.put("environment", environment); + if (project != null) { + fieldMapBuilder.put("project", project); + } + if (location != null) { + fieldMapBuilder.put("location", location); + } + if (agent != null) { + fieldMapBuilder.put("agent", agent); + } + if (environment != null) { + fieldMapBuilder.put("environment", environment); + } fieldValuesMap = fieldMapBuilder.build(); } } @@ -150,18 +166,50 @@ public String getFieldValue(String fieldName) { @Override public String toString() { - return PATH_TEMPLATE.instantiate( + return PROJECT_LOCATION_AGENT_ENVIRONMENT.instantiate( "project", project, "location", location, "agent", agent, "environment", environment); } - /** Builder for EnvironmentName. */ - public static class Builder { + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o != null || getClass() == o.getClass()) { + EnvironmentName that = ((EnvironmentName) o); + return Objects.equals(this.project, that.project) + && Objects.equals(this.location, that.location) + && Objects.equals(this.agent, that.agent) + && Objects.equals(this.environment, that.environment); + } + return false; + } + @Override + public int hashCode() { + int h = 1; + h *= 1000003; + h ^= Objects.hashCode(project); + h *= 1000003; + h ^= Objects.hashCode(location); + h *= 1000003; + h ^= Objects.hashCode(agent); + h *= 1000003; + h ^= Objects.hashCode(environment); + return h; + } + + /** + * Builder for projects/{project}/locations/{location}/agents/{agent}/environments/{environment}. + */ + public static class Builder { private String project; private String location; private String agent; private String environment; + protected Builder() {} + public String getProject() { return project; } @@ -198,8 +246,6 @@ public Builder setEnvironment(String environment) { return this; } - private Builder() {} - private Builder(EnvironmentName environmentName) { project = environmentName.project; location = environmentName.location; @@ -211,33 +257,4 @@ public EnvironmentName build() { return new EnvironmentName(this); } } - - @Override - public boolean equals(Object o) { - if (o == this) { - return true; - } - if (o instanceof EnvironmentName) { - EnvironmentName that = (EnvironmentName) o; - return (this.project.equals(that.project)) - && (this.location.equals(that.location)) - && (this.agent.equals(that.agent)) - && (this.environment.equals(that.environment)); - } - return false; - } - - @Override - public int hashCode() { - int h = 1; - h *= 1000003; - h ^= project.hashCode(); - h *= 1000003; - h ^= location.hashCode(); - h *= 1000003; - h ^= agent.hashCode(); - h *= 1000003; - h ^= environment.hashCode(); - return h; - } } diff --git a/proto-google-cloud-dialogflow-cx-v3/src/main/java/com/google/cloud/dialogflow/cx/v3/FlowName.java b/proto-google-cloud-dialogflow-cx-v3/src/main/java/com/google/cloud/dialogflow/cx/v3/FlowName.java index ef86b686a..ed82fedc7 100644 --- a/proto-google-cloud-dialogflow-cx-v3/src/main/java/com/google/cloud/dialogflow/cx/v3/FlowName.java +++ b/proto-google-cloud-dialogflow-cx-v3/src/main/java/com/google/cloud/dialogflow/cx/v3/FlowName.java @@ -5,7 +5,7 @@ * 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 + * 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, @@ -23,22 +23,36 @@ import java.util.ArrayList; import java.util.List; import java.util.Map; +import java.util.Objects; +import javax.annotation.Generated; -/** AUTO-GENERATED DOCUMENTATION AND CLASS */ -@javax.annotation.Generated("by GAPIC protoc plugin") +// AUTO-GENERATED DOCUMENTATION AND CLASS. +@Generated("by gapic-generator-java") public class FlowName implements ResourceName { - - private static final PathTemplate PATH_TEMPLATE = + private static final PathTemplate PROJECT_LOCATION_AGENT_FLOW = PathTemplate.createWithoutUrlEncoding( "projects/{project}/locations/{location}/agents/{agent}/flows/{flow}"); - private volatile Map fieldValuesMap; - private final String project; private final String location; private final String agent; private final String flow; + @Deprecated + protected FlowName() { + project = null; + location = null; + agent = null; + flow = null; + } + + private FlowName(Builder builder) { + project = Preconditions.checkNotNull(builder.getProject()); + location = Preconditions.checkNotNull(builder.getLocation()); + agent = Preconditions.checkNotNull(builder.getAgent()); + flow = Preconditions.checkNotNull(builder.getFlow()); + } + public String getProject() { return project; } @@ -63,13 +77,6 @@ public Builder toBuilder() { return new Builder(this); } - private FlowName(Builder builder) { - project = Preconditions.checkNotNull(builder.getProject()); - location = Preconditions.checkNotNull(builder.getLocation()); - agent = Preconditions.checkNotNull(builder.getAgent()); - flow = Preconditions.checkNotNull(builder.getFlow()); - } - public static FlowName of(String project, String location, String agent, String flow) { return newBuilder() .setProject(project) @@ -94,7 +101,7 @@ public static FlowName parse(String formattedString) { return null; } Map matchMap = - PATH_TEMPLATE.validatedMatch( + PROJECT_LOCATION_AGENT_FLOW.validatedMatch( formattedString, "FlowName.parse: formattedString not in valid format"); return of( matchMap.get("project"), @@ -112,7 +119,7 @@ public static List parseList(List formattedStrings) { } public static List toStringList(List values) { - List list = new ArrayList(values.size()); + List list = new ArrayList<>(values.size()); for (FlowName value : values) { if (value == null) { list.add(""); @@ -124,18 +131,27 @@ public static List toStringList(List values) { } public static boolean isParsableFrom(String formattedString) { - return PATH_TEMPLATE.matches(formattedString); + return PROJECT_LOCATION_AGENT_FLOW.matches(formattedString); } + @Override public Map getFieldValuesMap() { if (fieldValuesMap == null) { synchronized (this) { if (fieldValuesMap == null) { ImmutableMap.Builder fieldMapBuilder = ImmutableMap.builder(); - fieldMapBuilder.put("project", project); - fieldMapBuilder.put("location", location); - fieldMapBuilder.put("agent", agent); - fieldMapBuilder.put("flow", flow); + if (project != null) { + fieldMapBuilder.put("project", project); + } + if (location != null) { + fieldMapBuilder.put("location", location); + } + if (agent != null) { + fieldMapBuilder.put("agent", agent); + } + if (flow != null) { + fieldMapBuilder.put("flow", flow); + } fieldValuesMap = fieldMapBuilder.build(); } } @@ -149,18 +165,48 @@ public String getFieldValue(String fieldName) { @Override public String toString() { - return PATH_TEMPLATE.instantiate( + return PROJECT_LOCATION_AGENT_FLOW.instantiate( "project", project, "location", location, "agent", agent, "flow", flow); } - /** Builder for FlowName. */ - public static class Builder { + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o != null || getClass() == o.getClass()) { + FlowName that = ((FlowName) o); + return Objects.equals(this.project, that.project) + && Objects.equals(this.location, that.location) + && Objects.equals(this.agent, that.agent) + && Objects.equals(this.flow, that.flow); + } + return false; + } + @Override + public int hashCode() { + int h = 1; + h *= 1000003; + h ^= Objects.hashCode(project); + h *= 1000003; + h ^= Objects.hashCode(location); + h *= 1000003; + h ^= Objects.hashCode(agent); + h *= 1000003; + h ^= Objects.hashCode(flow); + return h; + } + + /** Builder for projects/{project}/locations/{location}/agents/{agent}/flows/{flow}. */ + public static class Builder { private String project; private String location; private String agent; private String flow; + protected Builder() {} + public String getProject() { return project; } @@ -197,8 +243,6 @@ public Builder setFlow(String flow) { return this; } - private Builder() {} - private Builder(FlowName flowName) { project = flowName.project; location = flowName.location; @@ -210,33 +254,4 @@ public FlowName build() { return new FlowName(this); } } - - @Override - public boolean equals(Object o) { - if (o == this) { - return true; - } - if (o instanceof FlowName) { - FlowName that = (FlowName) o; - return (this.project.equals(that.project)) - && (this.location.equals(that.location)) - && (this.agent.equals(that.agent)) - && (this.flow.equals(that.flow)); - } - return false; - } - - @Override - public int hashCode() { - int h = 1; - h *= 1000003; - h ^= project.hashCode(); - h *= 1000003; - h ^= location.hashCode(); - h *= 1000003; - h ^= agent.hashCode(); - h *= 1000003; - h ^= flow.hashCode(); - return h; - } } diff --git a/proto-google-cloud-dialogflow-cx-v3/src/main/java/com/google/cloud/dialogflow/cx/v3/IntentName.java b/proto-google-cloud-dialogflow-cx-v3/src/main/java/com/google/cloud/dialogflow/cx/v3/IntentName.java index e2bf942de..e23481cd9 100644 --- a/proto-google-cloud-dialogflow-cx-v3/src/main/java/com/google/cloud/dialogflow/cx/v3/IntentName.java +++ b/proto-google-cloud-dialogflow-cx-v3/src/main/java/com/google/cloud/dialogflow/cx/v3/IntentName.java @@ -5,7 +5,7 @@ * 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 + * 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, @@ -23,22 +23,36 @@ import java.util.ArrayList; import java.util.List; import java.util.Map; +import java.util.Objects; +import javax.annotation.Generated; -/** AUTO-GENERATED DOCUMENTATION AND CLASS */ -@javax.annotation.Generated("by GAPIC protoc plugin") +// AUTO-GENERATED DOCUMENTATION AND CLASS. +@Generated("by gapic-generator-java") public class IntentName implements ResourceName { - - private static final PathTemplate PATH_TEMPLATE = + private static final PathTemplate PROJECT_LOCATION_AGENT_INTENT = PathTemplate.createWithoutUrlEncoding( "projects/{project}/locations/{location}/agents/{agent}/intents/{intent}"); - private volatile Map fieldValuesMap; - private final String project; private final String location; private final String agent; private final String intent; + @Deprecated + protected IntentName() { + project = null; + location = null; + agent = null; + intent = null; + } + + private IntentName(Builder builder) { + project = Preconditions.checkNotNull(builder.getProject()); + location = Preconditions.checkNotNull(builder.getLocation()); + agent = Preconditions.checkNotNull(builder.getAgent()); + intent = Preconditions.checkNotNull(builder.getIntent()); + } + public String getProject() { return project; } @@ -63,13 +77,6 @@ public Builder toBuilder() { return new Builder(this); } - private IntentName(Builder builder) { - project = Preconditions.checkNotNull(builder.getProject()); - location = Preconditions.checkNotNull(builder.getLocation()); - agent = Preconditions.checkNotNull(builder.getAgent()); - intent = Preconditions.checkNotNull(builder.getIntent()); - } - public static IntentName of(String project, String location, String agent, String intent) { return newBuilder() .setProject(project) @@ -94,7 +101,7 @@ public static IntentName parse(String formattedString) { return null; } Map matchMap = - PATH_TEMPLATE.validatedMatch( + PROJECT_LOCATION_AGENT_INTENT.validatedMatch( formattedString, "IntentName.parse: formattedString not in valid format"); return of( matchMap.get("project"), @@ -112,7 +119,7 @@ public static List parseList(List formattedStrings) { } public static List toStringList(List values) { - List list = new ArrayList(values.size()); + List list = new ArrayList<>(values.size()); for (IntentName value : values) { if (value == null) { list.add(""); @@ -124,18 +131,27 @@ public static List toStringList(List values) { } public static boolean isParsableFrom(String formattedString) { - return PATH_TEMPLATE.matches(formattedString); + return PROJECT_LOCATION_AGENT_INTENT.matches(formattedString); } + @Override public Map getFieldValuesMap() { if (fieldValuesMap == null) { synchronized (this) { if (fieldValuesMap == null) { ImmutableMap.Builder fieldMapBuilder = ImmutableMap.builder(); - fieldMapBuilder.put("project", project); - fieldMapBuilder.put("location", location); - fieldMapBuilder.put("agent", agent); - fieldMapBuilder.put("intent", intent); + if (project != null) { + fieldMapBuilder.put("project", project); + } + if (location != null) { + fieldMapBuilder.put("location", location); + } + if (agent != null) { + fieldMapBuilder.put("agent", agent); + } + if (intent != null) { + fieldMapBuilder.put("intent", intent); + } fieldValuesMap = fieldMapBuilder.build(); } } @@ -149,18 +165,48 @@ public String getFieldValue(String fieldName) { @Override public String toString() { - return PATH_TEMPLATE.instantiate( + return PROJECT_LOCATION_AGENT_INTENT.instantiate( "project", project, "location", location, "agent", agent, "intent", intent); } - /** Builder for IntentName. */ - public static class Builder { + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o != null || getClass() == o.getClass()) { + IntentName that = ((IntentName) o); + return Objects.equals(this.project, that.project) + && Objects.equals(this.location, that.location) + && Objects.equals(this.agent, that.agent) + && Objects.equals(this.intent, that.intent); + } + return false; + } + @Override + public int hashCode() { + int h = 1; + h *= 1000003; + h ^= Objects.hashCode(project); + h *= 1000003; + h ^= Objects.hashCode(location); + h *= 1000003; + h ^= Objects.hashCode(agent); + h *= 1000003; + h ^= Objects.hashCode(intent); + return h; + } + + /** Builder for projects/{project}/locations/{location}/agents/{agent}/intents/{intent}. */ + public static class Builder { private String project; private String location; private String agent; private String intent; + protected Builder() {} + public String getProject() { return project; } @@ -197,8 +243,6 @@ public Builder setIntent(String intent) { return this; } - private Builder() {} - private Builder(IntentName intentName) { project = intentName.project; location = intentName.location; @@ -210,33 +254,4 @@ public IntentName build() { return new IntentName(this); } } - - @Override - public boolean equals(Object o) { - if (o == this) { - return true; - } - if (o instanceof IntentName) { - IntentName that = (IntentName) o; - return (this.project.equals(that.project)) - && (this.location.equals(that.location)) - && (this.agent.equals(that.agent)) - && (this.intent.equals(that.intent)); - } - return false; - } - - @Override - public int hashCode() { - int h = 1; - h *= 1000003; - h ^= project.hashCode(); - h *= 1000003; - h ^= location.hashCode(); - h *= 1000003; - h ^= agent.hashCode(); - h *= 1000003; - h ^= intent.hashCode(); - return h; - } } diff --git a/proto-google-cloud-dialogflow-cx-v3/src/main/java/com/google/cloud/dialogflow/cx/v3/LocationName.java b/proto-google-cloud-dialogflow-cx-v3/src/main/java/com/google/cloud/dialogflow/cx/v3/LocationName.java index 04f928dcb..0a36f1f10 100644 --- a/proto-google-cloud-dialogflow-cx-v3/src/main/java/com/google/cloud/dialogflow/cx/v3/LocationName.java +++ b/proto-google-cloud-dialogflow-cx-v3/src/main/java/com/google/cloud/dialogflow/cx/v3/LocationName.java @@ -5,7 +5,7 @@ * 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 + * 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, @@ -23,19 +23,29 @@ import java.util.ArrayList; import java.util.List; import java.util.Map; +import java.util.Objects; +import javax.annotation.Generated; -/** AUTO-GENERATED DOCUMENTATION AND CLASS */ -@javax.annotation.Generated("by GAPIC protoc plugin") +// AUTO-GENERATED DOCUMENTATION AND CLASS. +@Generated("by gapic-generator-java") public class LocationName implements ResourceName { - - private static final PathTemplate PATH_TEMPLATE = + private static final PathTemplate PROJECT_LOCATION = PathTemplate.createWithoutUrlEncoding("projects/{project}/locations/{location}"); - private volatile Map fieldValuesMap; - private final String project; private final String location; + @Deprecated + protected LocationName() { + project = null; + location = null; + } + + private LocationName(Builder builder) { + project = Preconditions.checkNotNull(builder.getProject()); + location = Preconditions.checkNotNull(builder.getLocation()); + } + public String getProject() { return project; } @@ -52,11 +62,6 @@ public Builder toBuilder() { return new Builder(this); } - private LocationName(Builder builder) { - project = Preconditions.checkNotNull(builder.getProject()); - location = Preconditions.checkNotNull(builder.getLocation()); - } - public static LocationName of(String project, String location) { return newBuilder().setProject(project).setLocation(location).build(); } @@ -70,7 +75,7 @@ public static LocationName parse(String formattedString) { return null; } Map matchMap = - PATH_TEMPLATE.validatedMatch( + PROJECT_LOCATION.validatedMatch( formattedString, "LocationName.parse: formattedString not in valid format"); return of(matchMap.get("project"), matchMap.get("location")); } @@ -84,7 +89,7 @@ public static List parseList(List formattedStrings) { } public static List toStringList(List values) { - List list = new ArrayList(values.size()); + List list = new ArrayList<>(values.size()); for (LocationName value : values) { if (value == null) { list.add(""); @@ -96,16 +101,21 @@ public static List toStringList(List values) { } public static boolean isParsableFrom(String formattedString) { - return PATH_TEMPLATE.matches(formattedString); + return PROJECT_LOCATION.matches(formattedString); } + @Override public Map getFieldValuesMap() { if (fieldValuesMap == null) { synchronized (this) { if (fieldValuesMap == null) { ImmutableMap.Builder fieldMapBuilder = ImmutableMap.builder(); - fieldMapBuilder.put("project", project); - fieldMapBuilder.put("location", location); + if (project != null) { + fieldMapBuilder.put("project", project); + } + if (location != null) { + fieldMapBuilder.put("location", location); + } fieldValuesMap = fieldMapBuilder.build(); } } @@ -119,15 +129,39 @@ public String getFieldValue(String fieldName) { @Override public String toString() { - return PATH_TEMPLATE.instantiate("project", project, "location", location); + return PROJECT_LOCATION.instantiate("project", project, "location", location); } - /** Builder for LocationName. */ - public static class Builder { + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o != null || getClass() == o.getClass()) { + LocationName that = ((LocationName) o); + return Objects.equals(this.project, that.project) + && Objects.equals(this.location, that.location); + } + return false; + } + @Override + public int hashCode() { + int h = 1; + h *= 1000003; + h ^= Objects.hashCode(project); + h *= 1000003; + h ^= Objects.hashCode(location); + return h; + } + + /** Builder for projects/{project}/locations/{location}. */ + public static class Builder { private String project; private String location; + protected Builder() {} + public String getProject() { return project; } @@ -146,8 +180,6 @@ public Builder setLocation(String location) { return this; } - private Builder() {} - private Builder(LocationName locationName) { project = locationName.project; location = locationName.location; @@ -157,26 +189,4 @@ public LocationName build() { return new LocationName(this); } } - - @Override - public boolean equals(Object o) { - if (o == this) { - return true; - } - if (o instanceof LocationName) { - LocationName that = (LocationName) o; - return (this.project.equals(that.project)) && (this.location.equals(that.location)); - } - return false; - } - - @Override - public int hashCode() { - int h = 1; - h *= 1000003; - h ^= project.hashCode(); - h *= 1000003; - h ^= location.hashCode(); - return h; - } } diff --git a/proto-google-cloud-dialogflow-cx-v3/src/main/java/com/google/cloud/dialogflow/cx/v3/PageName.java b/proto-google-cloud-dialogflow-cx-v3/src/main/java/com/google/cloud/dialogflow/cx/v3/PageName.java index 21b182be3..fb8f17c14 100644 --- a/proto-google-cloud-dialogflow-cx-v3/src/main/java/com/google/cloud/dialogflow/cx/v3/PageName.java +++ b/proto-google-cloud-dialogflow-cx-v3/src/main/java/com/google/cloud/dialogflow/cx/v3/PageName.java @@ -5,7 +5,7 @@ * 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 + * 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, @@ -23,23 +23,39 @@ import java.util.ArrayList; import java.util.List; import java.util.Map; +import java.util.Objects; +import javax.annotation.Generated; -/** AUTO-GENERATED DOCUMENTATION AND CLASS */ -@javax.annotation.Generated("by GAPIC protoc plugin") +// AUTO-GENERATED DOCUMENTATION AND CLASS. +@Generated("by gapic-generator-java") public class PageName implements ResourceName { - - private static final PathTemplate PATH_TEMPLATE = + private static final PathTemplate PROJECT_LOCATION_AGENT_FLOW_PAGE = PathTemplate.createWithoutUrlEncoding( "projects/{project}/locations/{location}/agents/{agent}/flows/{flow}/pages/{page}"); - private volatile Map fieldValuesMap; - private final String project; private final String location; private final String agent; private final String flow; private final String page; + @Deprecated + protected PageName() { + project = null; + location = null; + agent = null; + flow = null; + page = null; + } + + private PageName(Builder builder) { + project = Preconditions.checkNotNull(builder.getProject()); + location = Preconditions.checkNotNull(builder.getLocation()); + agent = Preconditions.checkNotNull(builder.getAgent()); + flow = Preconditions.checkNotNull(builder.getFlow()); + page = Preconditions.checkNotNull(builder.getPage()); + } + public String getProject() { return project; } @@ -68,14 +84,6 @@ public Builder toBuilder() { return new Builder(this); } - private PageName(Builder builder) { - project = Preconditions.checkNotNull(builder.getProject()); - location = Preconditions.checkNotNull(builder.getLocation()); - agent = Preconditions.checkNotNull(builder.getAgent()); - flow = Preconditions.checkNotNull(builder.getFlow()); - page = Preconditions.checkNotNull(builder.getPage()); - } - public static PageName of( String project, String location, String agent, String flow, String page) { return newBuilder() @@ -104,7 +112,7 @@ public static PageName parse(String formattedString) { return null; } Map matchMap = - PATH_TEMPLATE.validatedMatch( + PROJECT_LOCATION_AGENT_FLOW_PAGE.validatedMatch( formattedString, "PageName.parse: formattedString not in valid format"); return of( matchMap.get("project"), @@ -123,7 +131,7 @@ public static List parseList(List formattedStrings) { } public static List toStringList(List values) { - List list = new ArrayList(values.size()); + List list = new ArrayList<>(values.size()); for (PageName value : values) { if (value == null) { list.add(""); @@ -135,19 +143,30 @@ public static List toStringList(List values) { } public static boolean isParsableFrom(String formattedString) { - return PATH_TEMPLATE.matches(formattedString); + return PROJECT_LOCATION_AGENT_FLOW_PAGE.matches(formattedString); } + @Override public Map getFieldValuesMap() { if (fieldValuesMap == null) { synchronized (this) { if (fieldValuesMap == null) { ImmutableMap.Builder fieldMapBuilder = ImmutableMap.builder(); - fieldMapBuilder.put("project", project); - fieldMapBuilder.put("location", location); - fieldMapBuilder.put("agent", agent); - fieldMapBuilder.put("flow", flow); - fieldMapBuilder.put("page", page); + if (project != null) { + fieldMapBuilder.put("project", project); + } + if (location != null) { + fieldMapBuilder.put("location", location); + } + if (agent != null) { + fieldMapBuilder.put("agent", agent); + } + if (flow != null) { + fieldMapBuilder.put("flow", flow); + } + if (page != null) { + fieldMapBuilder.put("page", page); + } fieldValuesMap = fieldMapBuilder.build(); } } @@ -161,19 +180,54 @@ public String getFieldValue(String fieldName) { @Override public String toString() { - return PATH_TEMPLATE.instantiate( + return PROJECT_LOCATION_AGENT_FLOW_PAGE.instantiate( "project", project, "location", location, "agent", agent, "flow", flow, "page", page); } - /** Builder for PageName. */ - public static class Builder { + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o != null || getClass() == o.getClass()) { + PageName that = ((PageName) o); + return Objects.equals(this.project, that.project) + && Objects.equals(this.location, that.location) + && Objects.equals(this.agent, that.agent) + && Objects.equals(this.flow, that.flow) + && Objects.equals(this.page, that.page); + } + return false; + } + @Override + public int hashCode() { + int h = 1; + h *= 1000003; + h ^= Objects.hashCode(project); + h *= 1000003; + h ^= Objects.hashCode(location); + h *= 1000003; + h ^= Objects.hashCode(agent); + h *= 1000003; + h ^= Objects.hashCode(flow); + h *= 1000003; + h ^= Objects.hashCode(page); + return h; + } + + /** + * Builder for projects/{project}/locations/{location}/agents/{agent}/flows/{flow}/pages/{page}. + */ + public static class Builder { private String project; private String location; private String agent; private String flow; private String page; + protected Builder() {} + public String getProject() { return project; } @@ -219,8 +273,6 @@ public Builder setPage(String page) { return this; } - private Builder() {} - private Builder(PageName pageName) { project = pageName.project; location = pageName.location; @@ -233,36 +285,4 @@ public PageName build() { return new PageName(this); } } - - @Override - public boolean equals(Object o) { - if (o == this) { - return true; - } - if (o instanceof PageName) { - PageName that = (PageName) o; - return (this.project.equals(that.project)) - && (this.location.equals(that.location)) - && (this.agent.equals(that.agent)) - && (this.flow.equals(that.flow)) - && (this.page.equals(that.page)); - } - return false; - } - - @Override - public int hashCode() { - int h = 1; - h *= 1000003; - h ^= project.hashCode(); - h *= 1000003; - h ^= location.hashCode(); - h *= 1000003; - h ^= agent.hashCode(); - h *= 1000003; - h ^= flow.hashCode(); - h *= 1000003; - h ^= page.hashCode(); - return h; - } } diff --git a/proto-google-cloud-dialogflow-cx-v3/src/main/java/com/google/cloud/dialogflow/cx/v3/SecuritySettingsName.java b/proto-google-cloud-dialogflow-cx-v3/src/main/java/com/google/cloud/dialogflow/cx/v3/SecuritySettingsName.java index 9303a6eaa..0e7a849bc 100644 --- a/proto-google-cloud-dialogflow-cx-v3/src/main/java/com/google/cloud/dialogflow/cx/v3/SecuritySettingsName.java +++ b/proto-google-cloud-dialogflow-cx-v3/src/main/java/com/google/cloud/dialogflow/cx/v3/SecuritySettingsName.java @@ -5,7 +5,7 @@ * 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 + * 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, @@ -23,21 +23,33 @@ import java.util.ArrayList; import java.util.List; import java.util.Map; +import java.util.Objects; +import javax.annotation.Generated; -/** AUTO-GENERATED DOCUMENTATION AND CLASS */ -@javax.annotation.Generated("by GAPIC protoc plugin") +// AUTO-GENERATED DOCUMENTATION AND CLASS. +@Generated("by gapic-generator-java") public class SecuritySettingsName implements ResourceName { - - private static final PathTemplate PATH_TEMPLATE = + private static final PathTemplate PROJECT_LOCATION_SECURITY_SETTINGS = PathTemplate.createWithoutUrlEncoding( "projects/{project}/locations/{location}/securitySettings/{security_settings}"); - private volatile Map fieldValuesMap; - private final String project; private final String location; private final String securitySettings; + @Deprecated + protected SecuritySettingsName() { + project = null; + location = null; + securitySettings = null; + } + + private SecuritySettingsName(Builder builder) { + project = Preconditions.checkNotNull(builder.getProject()); + location = Preconditions.checkNotNull(builder.getLocation()); + securitySettings = Preconditions.checkNotNull(builder.getSecuritySettings()); + } + public String getProject() { return project; } @@ -58,12 +70,6 @@ public Builder toBuilder() { return new Builder(this); } - private SecuritySettingsName(Builder builder) { - project = Preconditions.checkNotNull(builder.getProject()); - location = Preconditions.checkNotNull(builder.getLocation()); - securitySettings = Preconditions.checkNotNull(builder.getSecuritySettings()); - } - public static SecuritySettingsName of(String project, String location, String securitySettings) { return newBuilder() .setProject(project) @@ -86,7 +92,7 @@ public static SecuritySettingsName parse(String formattedString) { return null; } Map matchMap = - PATH_TEMPLATE.validatedMatch( + PROJECT_LOCATION_SECURITY_SETTINGS.validatedMatch( formattedString, "SecuritySettingsName.parse: formattedString not in valid format"); return of(matchMap.get("project"), matchMap.get("location"), matchMap.get("security_settings")); } @@ -100,7 +106,7 @@ public static List parseList(List formattedStrings } public static List toStringList(List values) { - List list = new ArrayList(values.size()); + List list = new ArrayList<>(values.size()); for (SecuritySettingsName value : values) { if (value == null) { list.add(""); @@ -112,17 +118,24 @@ public static List toStringList(List values) { } public static boolean isParsableFrom(String formattedString) { - return PATH_TEMPLATE.matches(formattedString); + return PROJECT_LOCATION_SECURITY_SETTINGS.matches(formattedString); } + @Override public Map getFieldValuesMap() { if (fieldValuesMap == null) { synchronized (this) { if (fieldValuesMap == null) { ImmutableMap.Builder fieldMapBuilder = ImmutableMap.builder(); - fieldMapBuilder.put("project", project); - fieldMapBuilder.put("location", location); - fieldMapBuilder.put("securitySettings", securitySettings); + if (project != null) { + fieldMapBuilder.put("project", project); + } + if (location != null) { + fieldMapBuilder.put("location", location); + } + if (securitySettings != null) { + fieldMapBuilder.put("security_settings", securitySettings); + } fieldValuesMap = fieldMapBuilder.build(); } } @@ -136,17 +149,44 @@ public String getFieldValue(String fieldName) { @Override public String toString() { - return PATH_TEMPLATE.instantiate( + return PROJECT_LOCATION_SECURITY_SETTINGS.instantiate( "project", project, "location", location, "security_settings", securitySettings); } - /** Builder for SecuritySettingsName. */ - public static class Builder { + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o != null || getClass() == o.getClass()) { + SecuritySettingsName that = ((SecuritySettingsName) o); + return Objects.equals(this.project, that.project) + && Objects.equals(this.location, that.location) + && Objects.equals(this.securitySettings, that.securitySettings); + } + return false; + } + @Override + public int hashCode() { + int h = 1; + h *= 1000003; + h ^= Objects.hashCode(project); + h *= 1000003; + h ^= Objects.hashCode(location); + h *= 1000003; + h ^= Objects.hashCode(securitySettings); + return h; + } + + /** Builder for projects/{project}/locations/{location}/securitySettings/{security_settings}. */ + public static class Builder { private String project; private String location; private String securitySettings; + protected Builder() {} + public String getProject() { return project; } @@ -174,8 +214,6 @@ public Builder setSecuritySettings(String securitySettings) { return this; } - private Builder() {} - private Builder(SecuritySettingsName securitySettingsName) { project = securitySettingsName.project; location = securitySettingsName.location; @@ -186,30 +224,4 @@ public SecuritySettingsName build() { return new SecuritySettingsName(this); } } - - @Override - public boolean equals(Object o) { - if (o == this) { - return true; - } - if (o instanceof SecuritySettingsName) { - SecuritySettingsName that = (SecuritySettingsName) o; - return (this.project.equals(that.project)) - && (this.location.equals(that.location)) - && (this.securitySettings.equals(that.securitySettings)); - } - return false; - } - - @Override - public int hashCode() { - int h = 1; - h *= 1000003; - h ^= project.hashCode(); - h *= 1000003; - h ^= location.hashCode(); - h *= 1000003; - h ^= securitySettings.hashCode(); - return h; - } } diff --git a/proto-google-cloud-dialogflow-cx-v3/src/main/java/com/google/cloud/dialogflow/cx/v3/SessionEntityTypeName.java b/proto-google-cloud-dialogflow-cx-v3/src/main/java/com/google/cloud/dialogflow/cx/v3/SessionEntityTypeName.java index 18dec2e6a..14428ef1e 100644 --- a/proto-google-cloud-dialogflow-cx-v3/src/main/java/com/google/cloud/dialogflow/cx/v3/SessionEntityTypeName.java +++ b/proto-google-cloud-dialogflow-cx-v3/src/main/java/com/google/cloud/dialogflow/cx/v3/SessionEntityTypeName.java @@ -5,7 +5,7 @@ * 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 + * 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, @@ -26,32 +26,56 @@ import java.util.List; import java.util.Map; import java.util.Objects; +import javax.annotation.Generated; -/** AUTO-GENERATED DOCUMENTATION AND CLASS */ -@javax.annotation.Generated("by GAPIC protoc plugin") +// AUTO-GENERATED DOCUMENTATION AND CLASS. +@Generated("by gapic-generator-java") public class SessionEntityTypeName implements ResourceName { - - @Deprecated - protected SessionEntityTypeName() {} - - private static final PathTemplate PROJECT_LOCATION_AGENT_SESSION_ENTITY_TYPE_PATH_TEMPLATE = + private static final PathTemplate PROJECT_LOCATION_AGENT_SESSION_ENTITY_TYPE = PathTemplate.createWithoutUrlEncoding( "projects/{project}/locations/{location}/agents/{agent}/sessions/{session}/entityTypes/{entity_type}"); - private static final PathTemplate - PROJECT_LOCATION_AGENT_ENVIRONMENT_SESSION_ENTITY_TYPE_PATH_TEMPLATE = - PathTemplate.createWithoutUrlEncoding( - "projects/{project}/locations/{location}/agents/{agent}/environments/{environment}/sessions/{session}/entityTypes/{entity_type}"); - + private static final PathTemplate PROJECT_LOCATION_AGENT_ENVIRONMENT_SESSION_ENTITY_TYPE = + PathTemplate.createWithoutUrlEncoding( + "projects/{project}/locations/{location}/agents/{agent}/environments/{environment}/sessions/{session}/entityTypes/{entity_type}"); private volatile Map fieldValuesMap; private PathTemplate pathTemplate; private String fixedValue; + private final String project; + private final String location; + private final String agent; + private final String session; + private final String entityType; + private final String environment; - private String project; - private String location; - private String agent; - private String session; - private String entityType; - private String environment; + @Deprecated + protected SessionEntityTypeName() { + project = null; + location = null; + agent = null; + session = null; + entityType = null; + environment = null; + } + + private SessionEntityTypeName(Builder builder) { + project = Preconditions.checkNotNull(builder.getProject()); + location = Preconditions.checkNotNull(builder.getLocation()); + agent = Preconditions.checkNotNull(builder.getAgent()); + session = Preconditions.checkNotNull(builder.getSession()); + entityType = Preconditions.checkNotNull(builder.getEntityType()); + environment = null; + pathTemplate = PROJECT_LOCATION_AGENT_SESSION_ENTITY_TYPE; + } + + private SessionEntityTypeName(ProjectLocationAgentEnvironmentSessionEntityTypeBuilder builder) { + project = Preconditions.checkNotNull(builder.getProject()); + location = Preconditions.checkNotNull(builder.getLocation()); + agent = Preconditions.checkNotNull(builder.getAgent()); + environment = Preconditions.checkNotNull(builder.getEnvironment()); + session = Preconditions.checkNotNull(builder.getSession()); + entityType = Preconditions.checkNotNull(builder.getEntityType()); + pathTemplate = PROJECT_LOCATION_AGENT_ENVIRONMENT_SESSION_ENTITY_TYPE; + } public String getProject() { return project; @@ -77,25 +101,6 @@ public String getEnvironment() { return environment; } - private SessionEntityTypeName(Builder builder) { - project = Preconditions.checkNotNull(builder.getProject()); - location = Preconditions.checkNotNull(builder.getLocation()); - agent = Preconditions.checkNotNull(builder.getAgent()); - session = Preconditions.checkNotNull(builder.getSession()); - entityType = Preconditions.checkNotNull(builder.getEntityType()); - pathTemplate = PROJECT_LOCATION_AGENT_SESSION_ENTITY_TYPE_PATH_TEMPLATE; - } - - private SessionEntityTypeName(ProjectLocationAgentEnvironmentSessionEntityTypeBuilder builder) { - project = Preconditions.checkNotNull(builder.getProject()); - location = Preconditions.checkNotNull(builder.getLocation()); - agent = Preconditions.checkNotNull(builder.getAgent()); - environment = Preconditions.checkNotNull(builder.getEnvironment()); - session = Preconditions.checkNotNull(builder.getSession()); - entityType = Preconditions.checkNotNull(builder.getEntityType()); - pathTemplate = PROJECT_LOCATION_AGENT_ENVIRONMENT_SESSION_ENTITY_TYPE_PATH_TEMPLATE; - } - public static Builder newBuilder() { return new Builder(); } @@ -117,7 +122,7 @@ public Builder toBuilder() { public static SessionEntityTypeName of( String project, String location, String agent, String session, String entityType) { - return newProjectLocationAgentSessionEntityTypeBuilder() + return newBuilder() .setProject(project) .setLocation(location) .setAgent(agent) @@ -129,7 +134,7 @@ public static SessionEntityTypeName of( @BetaApi("The static create methods are not stable yet and may be changed in the future.") public static SessionEntityTypeName ofProjectLocationAgentSessionEntityTypeName( String project, String location, String agent, String session, String entityType) { - return newProjectLocationAgentSessionEntityTypeBuilder() + return newBuilder() .setProject(project) .setLocation(location) .setAgent(agent) @@ -204,20 +209,18 @@ public static SessionEntityTypeName parse(String formattedString) { if (formattedString.isEmpty()) { return null; } - if (PROJECT_LOCATION_AGENT_SESSION_ENTITY_TYPE_PATH_TEMPLATE.matches(formattedString)) { + if (PROJECT_LOCATION_AGENT_SESSION_ENTITY_TYPE.matches(formattedString)) { Map matchMap = - PROJECT_LOCATION_AGENT_SESSION_ENTITY_TYPE_PATH_TEMPLATE.match(formattedString); + PROJECT_LOCATION_AGENT_SESSION_ENTITY_TYPE.match(formattedString); return ofProjectLocationAgentSessionEntityTypeName( matchMap.get("project"), matchMap.get("location"), matchMap.get("agent"), matchMap.get("session"), matchMap.get("entity_type")); - } else if (PROJECT_LOCATION_AGENT_ENVIRONMENT_SESSION_ENTITY_TYPE_PATH_TEMPLATE.matches( - formattedString)) { + } else if (PROJECT_LOCATION_AGENT_ENVIRONMENT_SESSION_ENTITY_TYPE.matches(formattedString)) { Map matchMap = - PROJECT_LOCATION_AGENT_ENVIRONMENT_SESSION_ENTITY_TYPE_PATH_TEMPLATE.match( - formattedString); + PROJECT_LOCATION_AGENT_ENVIRONMENT_SESSION_ENTITY_TYPE.match(formattedString); return ofProjectLocationAgentEnvironmentSessionEntityTypeName( matchMap.get("project"), matchMap.get("location"), @@ -226,7 +229,8 @@ public static SessionEntityTypeName parse(String formattedString) { matchMap.get("session"), matchMap.get("entity_type")); } - throw new ValidationException("JobName.parse: formattedString not in valid format"); + throw new ValidationException( + "SessionEntityTypeName.parse: formattedString not in valid format"); } public static List parseList(List formattedStrings) { @@ -250,9 +254,8 @@ public static List toStringList(List values) { } public static boolean isParsableFrom(String formattedString) { - return PROJECT_LOCATION_AGENT_SESSION_ENTITY_TYPE_PATH_TEMPLATE.matches(formattedString) - || PROJECT_LOCATION_AGENT_ENVIRONMENT_SESSION_ENTITY_TYPE_PATH_TEMPLATE.matches( - formattedString); + return PROJECT_LOCATION_AGENT_SESSION_ENTITY_TYPE.matches(formattedString) + || PROJECT_LOCATION_AGENT_ENVIRONMENT_SESSION_ENTITY_TYPE.matches(formattedString); } @Override @@ -295,12 +298,48 @@ public String toString() { return fixedValue != null ? fixedValue : pathTemplate.instantiate(getFieldValuesMap()); } + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o != null || getClass() == o.getClass()) { + SessionEntityTypeName that = ((SessionEntityTypeName) o); + return Objects.equals(this.project, that.project) + && Objects.equals(this.location, that.location) + && Objects.equals(this.agent, that.agent) + && Objects.equals(this.session, that.session) + && Objects.equals(this.entityType, that.entityType) + && Objects.equals(this.environment, that.environment); + } + return false; + } + + @Override + public int hashCode() { + int h = 1; + h *= 1000003; + h ^= Objects.hashCode(fixedValue); + h *= 1000003; + h ^= Objects.hashCode(project); + h *= 1000003; + h ^= Objects.hashCode(location); + h *= 1000003; + h ^= Objects.hashCode(agent); + h *= 1000003; + h ^= Objects.hashCode(session); + h *= 1000003; + h ^= Objects.hashCode(entityType); + h *= 1000003; + h ^= Objects.hashCode(environment); + return h; + } + /** * Builder for * projects/{project}/locations/{location}/agents/{agent}/sessions/{session}/entityTypes/{entity_type}. */ public static class Builder { - private String project; private String location; private String agent; @@ -356,10 +395,9 @@ public Builder setEntityType(String entityType) { private Builder(SessionEntityTypeName sessionEntityTypeName) { Preconditions.checkArgument( - sessionEntityTypeName.pathTemplate - == PROJECT_LOCATION_AGENT_SESSION_ENTITY_TYPE_PATH_TEMPLATE, - "toBuilder is only supported when SessionEntityTypeName has the pattern of " - + "projects/{project}/locations/{location}/agents/{agent}/sessions/{session}/entityTypes/{entity_type}."); + Objects.equals( + sessionEntityTypeName.pathTemplate, PROJECT_LOCATION_AGENT_SESSION_ENTITY_TYPE), + "toBuilder is only supported when SessionEntityTypeName has the pattern of projects/{project}/locations/{location}/agents/{agent}/sessions/{session}/entityTypes/{entity_type}"); project = sessionEntityTypeName.project; location = sessionEntityTypeName.location; agent = sessionEntityTypeName.agent; @@ -378,7 +416,6 @@ public SessionEntityTypeName build() { */ @BetaApi("The per-pattern Builders are not stable yet and may be changed in the future.") public static class ProjectLocationAgentEnvironmentSessionEntityTypeBuilder { - private String project; private String location; private String agent; @@ -386,7 +423,7 @@ public static class ProjectLocationAgentEnvironmentSessionEntityTypeBuilder { private String session; private String entityType; - private ProjectLocationAgentEnvironmentSessionEntityTypeBuilder() {} + protected ProjectLocationAgentEnvironmentSessionEntityTypeBuilder() {} public String getProject() { return project; @@ -448,41 +485,4 @@ public SessionEntityTypeName build() { return new SessionEntityTypeName(this); } } - - @Override - public boolean equals(Object o) { - if (o == this) { - return true; - } - if (o != null || getClass() == o.getClass()) { - SessionEntityTypeName that = (SessionEntityTypeName) o; - return (Objects.equals(this.project, that.project)) - && (Objects.equals(this.location, that.location)) - && (Objects.equals(this.agent, that.agent)) - && (Objects.equals(this.session, that.session)) - && (Objects.equals(this.entityType, that.entityType)) - && (Objects.equals(this.environment, that.environment)); - } - return false; - } - - @Override - public int hashCode() { - int h = 1; - h *= 1000003; - h ^= Objects.hashCode(fixedValue); - h *= 1000003; - h ^= Objects.hashCode(project); - h *= 1000003; - h ^= Objects.hashCode(location); - h *= 1000003; - h ^= Objects.hashCode(agent); - h *= 1000003; - h ^= Objects.hashCode(session); - h *= 1000003; - h ^= Objects.hashCode(entityType); - h *= 1000003; - h ^= Objects.hashCode(environment); - return h; - } } diff --git a/proto-google-cloud-dialogflow-cx-v3/src/main/java/com/google/cloud/dialogflow/cx/v3/SessionName.java b/proto-google-cloud-dialogflow-cx-v3/src/main/java/com/google/cloud/dialogflow/cx/v3/SessionName.java index 8b50bac38..d583bbcb2 100644 --- a/proto-google-cloud-dialogflow-cx-v3/src/main/java/com/google/cloud/dialogflow/cx/v3/SessionName.java +++ b/proto-google-cloud-dialogflow-cx-v3/src/main/java/com/google/cloud/dialogflow/cx/v3/SessionName.java @@ -5,7 +5,7 @@ * 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 + * 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, @@ -26,30 +26,52 @@ import java.util.List; import java.util.Map; import java.util.Objects; +import javax.annotation.Generated; -/** AUTO-GENERATED DOCUMENTATION AND CLASS */ -@javax.annotation.Generated("by GAPIC protoc plugin") +// AUTO-GENERATED DOCUMENTATION AND CLASS. +@Generated("by gapic-generator-java") public class SessionName implements ResourceName { - - @Deprecated - protected SessionName() {} - - private static final PathTemplate PROJECT_LOCATION_AGENT_SESSION_PATH_TEMPLATE = + private static final PathTemplate PROJECT_LOCATION_AGENT_SESSION = PathTemplate.createWithoutUrlEncoding( "projects/{project}/locations/{location}/agents/{agent}/sessions/{session}"); - private static final PathTemplate PROJECT_LOCATION_AGENT_ENVIRONMENT_SESSION_PATH_TEMPLATE = + private static final PathTemplate PROJECT_LOCATION_AGENT_ENVIRONMENT_SESSION = PathTemplate.createWithoutUrlEncoding( "projects/{project}/locations/{location}/agents/{agent}/environments/{environment}/sessions/{session}"); - private volatile Map fieldValuesMap; private PathTemplate pathTemplate; private String fixedValue; + private final String project; + private final String location; + private final String agent; + private final String session; + private final String environment; + + @Deprecated + protected SessionName() { + project = null; + location = null; + agent = null; + session = null; + environment = null; + } - private String project; - private String location; - private String agent; - private String session; - private String environment; + private SessionName(Builder builder) { + project = Preconditions.checkNotNull(builder.getProject()); + location = Preconditions.checkNotNull(builder.getLocation()); + agent = Preconditions.checkNotNull(builder.getAgent()); + session = Preconditions.checkNotNull(builder.getSession()); + environment = null; + pathTemplate = PROJECT_LOCATION_AGENT_SESSION; + } + + private SessionName(ProjectLocationAgentEnvironmentSessionBuilder builder) { + project = Preconditions.checkNotNull(builder.getProject()); + location = Preconditions.checkNotNull(builder.getLocation()); + agent = Preconditions.checkNotNull(builder.getAgent()); + environment = Preconditions.checkNotNull(builder.getEnvironment()); + session = Preconditions.checkNotNull(builder.getSession()); + pathTemplate = PROJECT_LOCATION_AGENT_ENVIRONMENT_SESSION; + } public String getProject() { return project; @@ -71,23 +93,6 @@ public String getEnvironment() { return environment; } - private SessionName(Builder builder) { - project = Preconditions.checkNotNull(builder.getProject()); - location = Preconditions.checkNotNull(builder.getLocation()); - agent = Preconditions.checkNotNull(builder.getAgent()); - session = Preconditions.checkNotNull(builder.getSession()); - pathTemplate = PROJECT_LOCATION_AGENT_SESSION_PATH_TEMPLATE; - } - - private SessionName(ProjectLocationAgentEnvironmentSessionBuilder builder) { - project = Preconditions.checkNotNull(builder.getProject()); - location = Preconditions.checkNotNull(builder.getLocation()); - agent = Preconditions.checkNotNull(builder.getAgent()); - environment = Preconditions.checkNotNull(builder.getEnvironment()); - session = Preconditions.checkNotNull(builder.getSession()); - pathTemplate = PROJECT_LOCATION_AGENT_ENVIRONMENT_SESSION_PATH_TEMPLATE; - } - public static Builder newBuilder() { return new Builder(); } @@ -108,7 +113,7 @@ public Builder toBuilder() { } public static SessionName of(String project, String location, String agent, String session) { - return newProjectLocationAgentSessionBuilder() + return newBuilder() .setProject(project) .setLocation(location) .setAgent(agent) @@ -119,7 +124,7 @@ public static SessionName of(String project, String location, String agent, Stri @BetaApi("The static create methods are not stable yet and may be changed in the future.") public static SessionName ofProjectLocationAgentSessionName( String project, String location, String agent, String session) { - return newProjectLocationAgentSessionBuilder() + return newBuilder() .setProject(project) .setLocation(location) .setAgent(agent) @@ -178,17 +183,16 @@ public static SessionName parse(String formattedString) { if (formattedString.isEmpty()) { return null; } - if (PROJECT_LOCATION_AGENT_SESSION_PATH_TEMPLATE.matches(formattedString)) { - Map matchMap = - PROJECT_LOCATION_AGENT_SESSION_PATH_TEMPLATE.match(formattedString); + if (PROJECT_LOCATION_AGENT_SESSION.matches(formattedString)) { + Map matchMap = PROJECT_LOCATION_AGENT_SESSION.match(formattedString); return ofProjectLocationAgentSessionName( matchMap.get("project"), matchMap.get("location"), matchMap.get("agent"), matchMap.get("session")); - } else if (PROJECT_LOCATION_AGENT_ENVIRONMENT_SESSION_PATH_TEMPLATE.matches(formattedString)) { + } else if (PROJECT_LOCATION_AGENT_ENVIRONMENT_SESSION.matches(formattedString)) { Map matchMap = - PROJECT_LOCATION_AGENT_ENVIRONMENT_SESSION_PATH_TEMPLATE.match(formattedString); + PROJECT_LOCATION_AGENT_ENVIRONMENT_SESSION.match(formattedString); return ofProjectLocationAgentEnvironmentSessionName( matchMap.get("project"), matchMap.get("location"), @@ -196,7 +200,7 @@ public static SessionName parse(String formattedString) { matchMap.get("environment"), matchMap.get("session")); } - throw new ValidationException("JobName.parse: formattedString not in valid format"); + throw new ValidationException("SessionName.parse: formattedString not in valid format"); } public static List parseList(List formattedStrings) { @@ -220,8 +224,8 @@ public static List toStringList(List values) { } public static boolean isParsableFrom(String formattedString) { - return PROJECT_LOCATION_AGENT_SESSION_PATH_TEMPLATE.matches(formattedString) - || PROJECT_LOCATION_AGENT_ENVIRONMENT_SESSION_PATH_TEMPLATE.matches(formattedString); + return PROJECT_LOCATION_AGENT_SESSION.matches(formattedString) + || PROJECT_LOCATION_AGENT_ENVIRONMENT_SESSION.matches(formattedString); } @Override @@ -261,9 +265,42 @@ public String toString() { return fixedValue != null ? fixedValue : pathTemplate.instantiate(getFieldValuesMap()); } + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o != null || getClass() == o.getClass()) { + SessionName that = ((SessionName) o); + return Objects.equals(this.project, that.project) + && Objects.equals(this.location, that.location) + && Objects.equals(this.agent, that.agent) + && Objects.equals(this.session, that.session) + && Objects.equals(this.environment, that.environment); + } + return false; + } + + @Override + public int hashCode() { + int h = 1; + h *= 1000003; + h ^= Objects.hashCode(fixedValue); + h *= 1000003; + h ^= Objects.hashCode(project); + h *= 1000003; + h ^= Objects.hashCode(location); + h *= 1000003; + h ^= Objects.hashCode(agent); + h *= 1000003; + h ^= Objects.hashCode(session); + h *= 1000003; + h ^= Objects.hashCode(environment); + return h; + } + /** Builder for projects/{project}/locations/{location}/agents/{agent}/sessions/{session}. */ public static class Builder { - private String project; private String location; private String agent; @@ -309,9 +346,8 @@ public Builder setSession(String session) { private Builder(SessionName sessionName) { Preconditions.checkArgument( - sessionName.pathTemplate == PROJECT_LOCATION_AGENT_SESSION_PATH_TEMPLATE, - "toBuilder is only supported when SessionName has the pattern of " - + "projects/{project}/locations/{location}/agents/{agent}/sessions/{session}."); + Objects.equals(sessionName.pathTemplate, PROJECT_LOCATION_AGENT_SESSION), + "toBuilder is only supported when SessionName has the pattern of projects/{project}/locations/{location}/agents/{agent}/sessions/{session}"); project = sessionName.project; location = sessionName.location; agent = sessionName.agent; @@ -329,14 +365,13 @@ public SessionName build() { */ @BetaApi("The per-pattern Builders are not stable yet and may be changed in the future.") public static class ProjectLocationAgentEnvironmentSessionBuilder { - private String project; private String location; private String agent; private String environment; private String session; - private ProjectLocationAgentEnvironmentSessionBuilder() {} + protected ProjectLocationAgentEnvironmentSessionBuilder() {} public String getProject() { return project; @@ -387,38 +422,4 @@ public SessionName build() { return new SessionName(this); } } - - @Override - public boolean equals(Object o) { - if (o == this) { - return true; - } - if (o != null || getClass() == o.getClass()) { - SessionName that = (SessionName) o; - return (Objects.equals(this.project, that.project)) - && (Objects.equals(this.location, that.location)) - && (Objects.equals(this.agent, that.agent)) - && (Objects.equals(this.session, that.session)) - && (Objects.equals(this.environment, that.environment)); - } - return false; - } - - @Override - public int hashCode() { - int h = 1; - h *= 1000003; - h ^= Objects.hashCode(fixedValue); - h *= 1000003; - h ^= Objects.hashCode(project); - h *= 1000003; - h ^= Objects.hashCode(location); - h *= 1000003; - h ^= Objects.hashCode(agent); - h *= 1000003; - h ^= Objects.hashCode(session); - h *= 1000003; - h ^= Objects.hashCode(environment); - return h; - } } diff --git a/proto-google-cloud-dialogflow-cx-v3/src/main/java/com/google/cloud/dialogflow/cx/v3/TransitionRouteGroupName.java b/proto-google-cloud-dialogflow-cx-v3/src/main/java/com/google/cloud/dialogflow/cx/v3/TransitionRouteGroupName.java index bb03b136d..7f4c1d6f8 100644 --- a/proto-google-cloud-dialogflow-cx-v3/src/main/java/com/google/cloud/dialogflow/cx/v3/TransitionRouteGroupName.java +++ b/proto-google-cloud-dialogflow-cx-v3/src/main/java/com/google/cloud/dialogflow/cx/v3/TransitionRouteGroupName.java @@ -5,7 +5,7 @@ * 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 + * 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, @@ -23,23 +23,39 @@ import java.util.ArrayList; import java.util.List; import java.util.Map; +import java.util.Objects; +import javax.annotation.Generated; -/** AUTO-GENERATED DOCUMENTATION AND CLASS */ -@javax.annotation.Generated("by GAPIC protoc plugin") +// AUTO-GENERATED DOCUMENTATION AND CLASS. +@Generated("by gapic-generator-java") public class TransitionRouteGroupName implements ResourceName { - - private static final PathTemplate PATH_TEMPLATE = + private static final PathTemplate PROJECT_LOCATION_AGENT_FLOW_TRANSITION_ROUTE_GROUP = PathTemplate.createWithoutUrlEncoding( "projects/{project}/locations/{location}/agents/{agent}/flows/{flow}/transitionRouteGroups/{transition_route_group}"); - private volatile Map fieldValuesMap; - private final String project; private final String location; private final String agent; private final String flow; private final String transitionRouteGroup; + @Deprecated + protected TransitionRouteGroupName() { + project = null; + location = null; + agent = null; + flow = null; + transitionRouteGroup = null; + } + + private TransitionRouteGroupName(Builder builder) { + project = Preconditions.checkNotNull(builder.getProject()); + location = Preconditions.checkNotNull(builder.getLocation()); + agent = Preconditions.checkNotNull(builder.getAgent()); + flow = Preconditions.checkNotNull(builder.getFlow()); + transitionRouteGroup = Preconditions.checkNotNull(builder.getTransitionRouteGroup()); + } + public String getProject() { return project; } @@ -68,14 +84,6 @@ public Builder toBuilder() { return new Builder(this); } - private TransitionRouteGroupName(Builder builder) { - project = Preconditions.checkNotNull(builder.getProject()); - location = Preconditions.checkNotNull(builder.getLocation()); - agent = Preconditions.checkNotNull(builder.getAgent()); - flow = Preconditions.checkNotNull(builder.getFlow()); - transitionRouteGroup = Preconditions.checkNotNull(builder.getTransitionRouteGroup()); - } - public static TransitionRouteGroupName of( String project, String location, String agent, String flow, String transitionRouteGroup) { return newBuilder() @@ -104,7 +112,7 @@ public static TransitionRouteGroupName parse(String formattedString) { return null; } Map matchMap = - PATH_TEMPLATE.validatedMatch( + PROJECT_LOCATION_AGENT_FLOW_TRANSITION_ROUTE_GROUP.validatedMatch( formattedString, "TransitionRouteGroupName.parse: formattedString not in valid format"); return of( matchMap.get("project"), @@ -123,7 +131,7 @@ public static List parseList(List formattedStr } public static List toStringList(List values) { - List list = new ArrayList(values.size()); + List list = new ArrayList<>(values.size()); for (TransitionRouteGroupName value : values) { if (value == null) { list.add(""); @@ -135,19 +143,30 @@ public static List toStringList(List values) { } public static boolean isParsableFrom(String formattedString) { - return PATH_TEMPLATE.matches(formattedString); + return PROJECT_LOCATION_AGENT_FLOW_TRANSITION_ROUTE_GROUP.matches(formattedString); } + @Override public Map getFieldValuesMap() { if (fieldValuesMap == null) { synchronized (this) { if (fieldValuesMap == null) { ImmutableMap.Builder fieldMapBuilder = ImmutableMap.builder(); - fieldMapBuilder.put("project", project); - fieldMapBuilder.put("location", location); - fieldMapBuilder.put("agent", agent); - fieldMapBuilder.put("flow", flow); - fieldMapBuilder.put("transitionRouteGroup", transitionRouteGroup); + if (project != null) { + fieldMapBuilder.put("project", project); + } + if (location != null) { + fieldMapBuilder.put("location", location); + } + if (agent != null) { + fieldMapBuilder.put("agent", agent); + } + if (flow != null) { + fieldMapBuilder.put("flow", flow); + } + if (transitionRouteGroup != null) { + fieldMapBuilder.put("transition_route_group", transitionRouteGroup); + } fieldValuesMap = fieldMapBuilder.build(); } } @@ -161,7 +180,7 @@ public String getFieldValue(String fieldName) { @Override public String toString() { - return PATH_TEMPLATE.instantiate( + return PROJECT_LOCATION_AGENT_FLOW_TRANSITION_ROUTE_GROUP.instantiate( "project", project, "location", @@ -174,15 +193,51 @@ public String toString() { transitionRouteGroup); } - /** Builder for TransitionRouteGroupName. */ - public static class Builder { + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o != null || getClass() == o.getClass()) { + TransitionRouteGroupName that = ((TransitionRouteGroupName) o); + return Objects.equals(this.project, that.project) + && Objects.equals(this.location, that.location) + && Objects.equals(this.agent, that.agent) + && Objects.equals(this.flow, that.flow) + && Objects.equals(this.transitionRouteGroup, that.transitionRouteGroup); + } + return false; + } + @Override + public int hashCode() { + int h = 1; + h *= 1000003; + h ^= Objects.hashCode(project); + h *= 1000003; + h ^= Objects.hashCode(location); + h *= 1000003; + h ^= Objects.hashCode(agent); + h *= 1000003; + h ^= Objects.hashCode(flow); + h *= 1000003; + h ^= Objects.hashCode(transitionRouteGroup); + return h; + } + + /** + * Builder for + * projects/{project}/locations/{location}/agents/{agent}/flows/{flow}/transitionRouteGroups/{transition_route_group}. + */ + public static class Builder { private String project; private String location; private String agent; private String flow; private String transitionRouteGroup; + protected Builder() {} + public String getProject() { return project; } @@ -228,8 +283,6 @@ public Builder setTransitionRouteGroup(String transitionRouteGroup) { return this; } - private Builder() {} - private Builder(TransitionRouteGroupName transitionRouteGroupName) { project = transitionRouteGroupName.project; location = transitionRouteGroupName.location; @@ -242,36 +295,4 @@ public TransitionRouteGroupName build() { return new TransitionRouteGroupName(this); } } - - @Override - public boolean equals(Object o) { - if (o == this) { - return true; - } - if (o instanceof TransitionRouteGroupName) { - TransitionRouteGroupName that = (TransitionRouteGroupName) o; - return (this.project.equals(that.project)) - && (this.location.equals(that.location)) - && (this.agent.equals(that.agent)) - && (this.flow.equals(that.flow)) - && (this.transitionRouteGroup.equals(that.transitionRouteGroup)); - } - return false; - } - - @Override - public int hashCode() { - int h = 1; - h *= 1000003; - h ^= project.hashCode(); - h *= 1000003; - h ^= location.hashCode(); - h *= 1000003; - h ^= agent.hashCode(); - h *= 1000003; - h ^= flow.hashCode(); - h *= 1000003; - h ^= transitionRouteGroup.hashCode(); - return h; - } } diff --git a/proto-google-cloud-dialogflow-cx-v3/src/main/java/com/google/cloud/dialogflow/cx/v3/VersionName.java b/proto-google-cloud-dialogflow-cx-v3/src/main/java/com/google/cloud/dialogflow/cx/v3/VersionName.java index 28f7a0cc9..3e4937e96 100644 --- a/proto-google-cloud-dialogflow-cx-v3/src/main/java/com/google/cloud/dialogflow/cx/v3/VersionName.java +++ b/proto-google-cloud-dialogflow-cx-v3/src/main/java/com/google/cloud/dialogflow/cx/v3/VersionName.java @@ -5,7 +5,7 @@ * 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 + * 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, @@ -23,23 +23,39 @@ import java.util.ArrayList; import java.util.List; import java.util.Map; +import java.util.Objects; +import javax.annotation.Generated; -/** AUTO-GENERATED DOCUMENTATION AND CLASS */ -@javax.annotation.Generated("by GAPIC protoc plugin") +// AUTO-GENERATED DOCUMENTATION AND CLASS. +@Generated("by gapic-generator-java") public class VersionName implements ResourceName { - - private static final PathTemplate PATH_TEMPLATE = + private static final PathTemplate PROJECT_LOCATION_AGENT_FLOW_VERSION = PathTemplate.createWithoutUrlEncoding( "projects/{project}/locations/{location}/agents/{agent}/flows/{flow}/versions/{version}"); - private volatile Map fieldValuesMap; - private final String project; private final String location; private final String agent; private final String flow; private final String version; + @Deprecated + protected VersionName() { + project = null; + location = null; + agent = null; + flow = null; + version = null; + } + + private VersionName(Builder builder) { + project = Preconditions.checkNotNull(builder.getProject()); + location = Preconditions.checkNotNull(builder.getLocation()); + agent = Preconditions.checkNotNull(builder.getAgent()); + flow = Preconditions.checkNotNull(builder.getFlow()); + version = Preconditions.checkNotNull(builder.getVersion()); + } + public String getProject() { return project; } @@ -68,14 +84,6 @@ public Builder toBuilder() { return new Builder(this); } - private VersionName(Builder builder) { - project = Preconditions.checkNotNull(builder.getProject()); - location = Preconditions.checkNotNull(builder.getLocation()); - agent = Preconditions.checkNotNull(builder.getAgent()); - flow = Preconditions.checkNotNull(builder.getFlow()); - version = Preconditions.checkNotNull(builder.getVersion()); - } - public static VersionName of( String project, String location, String agent, String flow, String version) { return newBuilder() @@ -104,7 +112,7 @@ public static VersionName parse(String formattedString) { return null; } Map matchMap = - PATH_TEMPLATE.validatedMatch( + PROJECT_LOCATION_AGENT_FLOW_VERSION.validatedMatch( formattedString, "VersionName.parse: formattedString not in valid format"); return of( matchMap.get("project"), @@ -123,7 +131,7 @@ public static List parseList(List formattedStrings) { } public static List toStringList(List values) { - List list = new ArrayList(values.size()); + List list = new ArrayList<>(values.size()); for (VersionName value : values) { if (value == null) { list.add(""); @@ -135,19 +143,30 @@ public static List toStringList(List values) { } public static boolean isParsableFrom(String formattedString) { - return PATH_TEMPLATE.matches(formattedString); + return PROJECT_LOCATION_AGENT_FLOW_VERSION.matches(formattedString); } + @Override public Map getFieldValuesMap() { if (fieldValuesMap == null) { synchronized (this) { if (fieldValuesMap == null) { ImmutableMap.Builder fieldMapBuilder = ImmutableMap.builder(); - fieldMapBuilder.put("project", project); - fieldMapBuilder.put("location", location); - fieldMapBuilder.put("agent", agent); - fieldMapBuilder.put("flow", flow); - fieldMapBuilder.put("version", version); + if (project != null) { + fieldMapBuilder.put("project", project); + } + if (location != null) { + fieldMapBuilder.put("location", location); + } + if (agent != null) { + fieldMapBuilder.put("agent", agent); + } + if (flow != null) { + fieldMapBuilder.put("flow", flow); + } + if (version != null) { + fieldMapBuilder.put("version", version); + } fieldValuesMap = fieldMapBuilder.build(); } } @@ -161,19 +180,55 @@ public String getFieldValue(String fieldName) { @Override public String toString() { - return PATH_TEMPLATE.instantiate( + return PROJECT_LOCATION_AGENT_FLOW_VERSION.instantiate( "project", project, "location", location, "agent", agent, "flow", flow, "version", version); } - /** Builder for VersionName. */ - public static class Builder { + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o != null || getClass() == o.getClass()) { + VersionName that = ((VersionName) o); + return Objects.equals(this.project, that.project) + && Objects.equals(this.location, that.location) + && Objects.equals(this.agent, that.agent) + && Objects.equals(this.flow, that.flow) + && Objects.equals(this.version, that.version); + } + return false; + } + @Override + public int hashCode() { + int h = 1; + h *= 1000003; + h ^= Objects.hashCode(project); + h *= 1000003; + h ^= Objects.hashCode(location); + h *= 1000003; + h ^= Objects.hashCode(agent); + h *= 1000003; + h ^= Objects.hashCode(flow); + h *= 1000003; + h ^= Objects.hashCode(version); + return h; + } + + /** + * Builder for + * projects/{project}/locations/{location}/agents/{agent}/flows/{flow}/versions/{version}. + */ + public static class Builder { private String project; private String location; private String agent; private String flow; private String version; + protected Builder() {} + public String getProject() { return project; } @@ -219,8 +274,6 @@ public Builder setVersion(String version) { return this; } - private Builder() {} - private Builder(VersionName versionName) { project = versionName.project; location = versionName.location; @@ -233,36 +286,4 @@ public VersionName build() { return new VersionName(this); } } - - @Override - public boolean equals(Object o) { - if (o == this) { - return true; - } - if (o instanceof VersionName) { - VersionName that = (VersionName) o; - return (this.project.equals(that.project)) - && (this.location.equals(that.location)) - && (this.agent.equals(that.agent)) - && (this.flow.equals(that.flow)) - && (this.version.equals(that.version)); - } - return false; - } - - @Override - public int hashCode() { - int h = 1; - h *= 1000003; - h ^= project.hashCode(); - h *= 1000003; - h ^= location.hashCode(); - h *= 1000003; - h ^= agent.hashCode(); - h *= 1000003; - h ^= flow.hashCode(); - h *= 1000003; - h ^= version.hashCode(); - return h; - } } diff --git a/proto-google-cloud-dialogflow-cx-v3/src/main/java/com/google/cloud/dialogflow/cx/v3/WebhookName.java b/proto-google-cloud-dialogflow-cx-v3/src/main/java/com/google/cloud/dialogflow/cx/v3/WebhookName.java index c3b20602b..57c0abd47 100644 --- a/proto-google-cloud-dialogflow-cx-v3/src/main/java/com/google/cloud/dialogflow/cx/v3/WebhookName.java +++ b/proto-google-cloud-dialogflow-cx-v3/src/main/java/com/google/cloud/dialogflow/cx/v3/WebhookName.java @@ -5,7 +5,7 @@ * 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 + * 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, @@ -23,22 +23,36 @@ import java.util.ArrayList; import java.util.List; import java.util.Map; +import java.util.Objects; +import javax.annotation.Generated; -/** AUTO-GENERATED DOCUMENTATION AND CLASS */ -@javax.annotation.Generated("by GAPIC protoc plugin") +// AUTO-GENERATED DOCUMENTATION AND CLASS. +@Generated("by gapic-generator-java") public class WebhookName implements ResourceName { - - private static final PathTemplate PATH_TEMPLATE = + private static final PathTemplate PROJECT_LOCATION_AGENT_WEBHOOK = PathTemplate.createWithoutUrlEncoding( "projects/{project}/locations/{location}/agents/{agent}/webhooks/{webhook}"); - private volatile Map fieldValuesMap; - private final String project; private final String location; private final String agent; private final String webhook; + @Deprecated + protected WebhookName() { + project = null; + location = null; + agent = null; + webhook = null; + } + + private WebhookName(Builder builder) { + project = Preconditions.checkNotNull(builder.getProject()); + location = Preconditions.checkNotNull(builder.getLocation()); + agent = Preconditions.checkNotNull(builder.getAgent()); + webhook = Preconditions.checkNotNull(builder.getWebhook()); + } + public String getProject() { return project; } @@ -63,13 +77,6 @@ public Builder toBuilder() { return new Builder(this); } - private WebhookName(Builder builder) { - project = Preconditions.checkNotNull(builder.getProject()); - location = Preconditions.checkNotNull(builder.getLocation()); - agent = Preconditions.checkNotNull(builder.getAgent()); - webhook = Preconditions.checkNotNull(builder.getWebhook()); - } - public static WebhookName of(String project, String location, String agent, String webhook) { return newBuilder() .setProject(project) @@ -94,7 +101,7 @@ public static WebhookName parse(String formattedString) { return null; } Map matchMap = - PATH_TEMPLATE.validatedMatch( + PROJECT_LOCATION_AGENT_WEBHOOK.validatedMatch( formattedString, "WebhookName.parse: formattedString not in valid format"); return of( matchMap.get("project"), @@ -112,7 +119,7 @@ public static List parseList(List formattedStrings) { } public static List toStringList(List values) { - List list = new ArrayList(values.size()); + List list = new ArrayList<>(values.size()); for (WebhookName value : values) { if (value == null) { list.add(""); @@ -124,18 +131,27 @@ public static List toStringList(List values) { } public static boolean isParsableFrom(String formattedString) { - return PATH_TEMPLATE.matches(formattedString); + return PROJECT_LOCATION_AGENT_WEBHOOK.matches(formattedString); } + @Override public Map getFieldValuesMap() { if (fieldValuesMap == null) { synchronized (this) { if (fieldValuesMap == null) { ImmutableMap.Builder fieldMapBuilder = ImmutableMap.builder(); - fieldMapBuilder.put("project", project); - fieldMapBuilder.put("location", location); - fieldMapBuilder.put("agent", agent); - fieldMapBuilder.put("webhook", webhook); + if (project != null) { + fieldMapBuilder.put("project", project); + } + if (location != null) { + fieldMapBuilder.put("location", location); + } + if (agent != null) { + fieldMapBuilder.put("agent", agent); + } + if (webhook != null) { + fieldMapBuilder.put("webhook", webhook); + } fieldValuesMap = fieldMapBuilder.build(); } } @@ -149,18 +165,48 @@ public String getFieldValue(String fieldName) { @Override public String toString() { - return PATH_TEMPLATE.instantiate( + return PROJECT_LOCATION_AGENT_WEBHOOK.instantiate( "project", project, "location", location, "agent", agent, "webhook", webhook); } - /** Builder for WebhookName. */ - public static class Builder { + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o != null || getClass() == o.getClass()) { + WebhookName that = ((WebhookName) o); + return Objects.equals(this.project, that.project) + && Objects.equals(this.location, that.location) + && Objects.equals(this.agent, that.agent) + && Objects.equals(this.webhook, that.webhook); + } + return false; + } + @Override + public int hashCode() { + int h = 1; + h *= 1000003; + h ^= Objects.hashCode(project); + h *= 1000003; + h ^= Objects.hashCode(location); + h *= 1000003; + h ^= Objects.hashCode(agent); + h *= 1000003; + h ^= Objects.hashCode(webhook); + return h; + } + + /** Builder for projects/{project}/locations/{location}/agents/{agent}/webhooks/{webhook}. */ + public static class Builder { private String project; private String location; private String agent; private String webhook; + protected Builder() {} + public String getProject() { return project; } @@ -197,8 +243,6 @@ public Builder setWebhook(String webhook) { return this; } - private Builder() {} - private Builder(WebhookName webhookName) { project = webhookName.project; location = webhookName.location; @@ -210,33 +254,4 @@ public WebhookName build() { return new WebhookName(this); } } - - @Override - public boolean equals(Object o) { - if (o == this) { - return true; - } - if (o instanceof WebhookName) { - WebhookName that = (WebhookName) o; - return (this.project.equals(that.project)) - && (this.location.equals(that.location)) - && (this.agent.equals(that.agent)) - && (this.webhook.equals(that.webhook)); - } - return false; - } - - @Override - public int hashCode() { - int h = 1; - h *= 1000003; - h ^= project.hashCode(); - h *= 1000003; - h ^= location.hashCode(); - h *= 1000003; - h ^= agent.hashCode(); - h *= 1000003; - h ^= webhook.hashCode(); - return h; - } } diff --git a/proto-google-cloud-dialogflow-cx-v3beta1/src/main/java/com/google/cloud/dialogflow/cx/v3beta1/AgentName.java b/proto-google-cloud-dialogflow-cx-v3beta1/src/main/java/com/google/cloud/dialogflow/cx/v3beta1/AgentName.java index 679030d83..c917368e7 100644 --- a/proto-google-cloud-dialogflow-cx-v3beta1/src/main/java/com/google/cloud/dialogflow/cx/v3beta1/AgentName.java +++ b/proto-google-cloud-dialogflow-cx-v3beta1/src/main/java/com/google/cloud/dialogflow/cx/v3beta1/AgentName.java @@ -5,7 +5,7 @@ * 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 + * 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, @@ -23,21 +23,33 @@ import java.util.ArrayList; import java.util.List; import java.util.Map; +import java.util.Objects; +import javax.annotation.Generated; -/** AUTO-GENERATED DOCUMENTATION AND CLASS */ -@javax.annotation.Generated("by GAPIC protoc plugin") +// AUTO-GENERATED DOCUMENTATION AND CLASS. +@Generated("by gapic-generator-java") public class AgentName implements ResourceName { - - private static final PathTemplate PATH_TEMPLATE = + private static final PathTemplate PROJECT_LOCATION_AGENT = PathTemplate.createWithoutUrlEncoding( "projects/{project}/locations/{location}/agents/{agent}"); - private volatile Map fieldValuesMap; - private final String project; private final String location; private final String agent; + @Deprecated + protected AgentName() { + project = null; + location = null; + agent = null; + } + + private AgentName(Builder builder) { + project = Preconditions.checkNotNull(builder.getProject()); + location = Preconditions.checkNotNull(builder.getLocation()); + agent = Preconditions.checkNotNull(builder.getAgent()); + } + public String getProject() { return project; } @@ -58,12 +70,6 @@ public Builder toBuilder() { return new Builder(this); } - private AgentName(Builder builder) { - project = Preconditions.checkNotNull(builder.getProject()); - location = Preconditions.checkNotNull(builder.getLocation()); - agent = Preconditions.checkNotNull(builder.getAgent()); - } - public static AgentName of(String project, String location, String agent) { return newBuilder().setProject(project).setLocation(location).setAgent(agent).build(); } @@ -82,7 +88,7 @@ public static AgentName parse(String formattedString) { return null; } Map matchMap = - PATH_TEMPLATE.validatedMatch( + PROJECT_LOCATION_AGENT.validatedMatch( formattedString, "AgentName.parse: formattedString not in valid format"); return of(matchMap.get("project"), matchMap.get("location"), matchMap.get("agent")); } @@ -96,7 +102,7 @@ public static List parseList(List formattedStrings) { } public static List toStringList(List values) { - List list = new ArrayList(values.size()); + List list = new ArrayList<>(values.size()); for (AgentName value : values) { if (value == null) { list.add(""); @@ -108,17 +114,24 @@ public static List toStringList(List values) { } public static boolean isParsableFrom(String formattedString) { - return PATH_TEMPLATE.matches(formattedString); + return PROJECT_LOCATION_AGENT.matches(formattedString); } + @Override public Map getFieldValuesMap() { if (fieldValuesMap == null) { synchronized (this) { if (fieldValuesMap == null) { ImmutableMap.Builder fieldMapBuilder = ImmutableMap.builder(); - fieldMapBuilder.put("project", project); - fieldMapBuilder.put("location", location); - fieldMapBuilder.put("agent", agent); + if (project != null) { + fieldMapBuilder.put("project", project); + } + if (location != null) { + fieldMapBuilder.put("location", location); + } + if (agent != null) { + fieldMapBuilder.put("agent", agent); + } fieldValuesMap = fieldMapBuilder.build(); } } @@ -132,16 +145,44 @@ public String getFieldValue(String fieldName) { @Override public String toString() { - return PATH_TEMPLATE.instantiate("project", project, "location", location, "agent", agent); + return PROJECT_LOCATION_AGENT.instantiate( + "project", project, "location", location, "agent", agent); } - /** Builder for AgentName. */ - public static class Builder { + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o != null || getClass() == o.getClass()) { + AgentName that = ((AgentName) o); + return Objects.equals(this.project, that.project) + && Objects.equals(this.location, that.location) + && Objects.equals(this.agent, that.agent); + } + return false; + } + @Override + public int hashCode() { + int h = 1; + h *= 1000003; + h ^= Objects.hashCode(project); + h *= 1000003; + h ^= Objects.hashCode(location); + h *= 1000003; + h ^= Objects.hashCode(agent); + return h; + } + + /** Builder for projects/{project}/locations/{location}/agents/{agent}. */ + public static class Builder { private String project; private String location; private String agent; + protected Builder() {} + public String getProject() { return project; } @@ -169,8 +210,6 @@ public Builder setAgent(String agent) { return this; } - private Builder() {} - private Builder(AgentName agentName) { project = agentName.project; location = agentName.location; @@ -181,30 +220,4 @@ public AgentName build() { return new AgentName(this); } } - - @Override - public boolean equals(Object o) { - if (o == this) { - return true; - } - if (o instanceof AgentName) { - AgentName that = (AgentName) o; - return (this.project.equals(that.project)) - && (this.location.equals(that.location)) - && (this.agent.equals(that.agent)); - } - return false; - } - - @Override - public int hashCode() { - int h = 1; - h *= 1000003; - h ^= project.hashCode(); - h *= 1000003; - h ^= location.hashCode(); - h *= 1000003; - h ^= agent.hashCode(); - return h; - } } diff --git a/proto-google-cloud-dialogflow-cx-v3beta1/src/main/java/com/google/cloud/dialogflow/cx/v3beta1/DetectIntentRequest.java b/proto-google-cloud-dialogflow-cx-v3beta1/src/main/java/com/google/cloud/dialogflow/cx/v3beta1/DetectIntentRequest.java index ae90df790..bd285892d 100644 --- a/proto-google-cloud-dialogflow-cx-v3beta1/src/main/java/com/google/cloud/dialogflow/cx/v3beta1/DetectIntentRequest.java +++ b/proto-google-cloud-dialogflow-cx-v3beta1/src/main/java/com/google/cloud/dialogflow/cx/v3beta1/DetectIntentRequest.java @@ -179,6 +179,9 @@ public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { * The length of the `Session ID` must not exceed 36 characters. * For more information, see the [sessions * guide](https://cloud.google.com/dialogflow/cx/docs/concept/session). + * Note: Always use agent versions for production traffic. + * See [Versions and + * environments](https://cloud.google.com/dialogflow/cx/docs/concept/version). * * * @@ -214,6 +217,9 @@ public java.lang.String getSession() { * The length of the `Session ID` must not exceed 36 characters. * For more information, see the [sessions * guide](https://cloud.google.com/dialogflow/cx/docs/concept/session). + * Note: Always use agent versions for production traffic. + * See [Versions and + * environments](https://cloud.google.com/dialogflow/cx/docs/concept/version). * * * @@ -805,6 +811,9 @@ public Builder mergeFrom( * The length of the `Session ID` must not exceed 36 characters. * For more information, see the [sessions * guide](https://cloud.google.com/dialogflow/cx/docs/concept/session). + * Note: Always use agent versions for production traffic. + * See [Versions and + * environments](https://cloud.google.com/dialogflow/cx/docs/concept/version). * * * @@ -839,6 +848,9 @@ public java.lang.String getSession() { * The length of the `Session ID` must not exceed 36 characters. * For more information, see the [sessions * guide](https://cloud.google.com/dialogflow/cx/docs/concept/session). + * Note: Always use agent versions for production traffic. + * See [Versions and + * environments](https://cloud.google.com/dialogflow/cx/docs/concept/version). * * * @@ -873,6 +885,9 @@ public com.google.protobuf.ByteString getSessionBytes() { * The length of the `Session ID` must not exceed 36 characters. * For more information, see the [sessions * guide](https://cloud.google.com/dialogflow/cx/docs/concept/session). + * Note: Always use agent versions for production traffic. + * See [Versions and + * environments](https://cloud.google.com/dialogflow/cx/docs/concept/version). * * * @@ -906,6 +921,9 @@ public Builder setSession(java.lang.String value) { * The length of the `Session ID` must not exceed 36 characters. * For more information, see the [sessions * guide](https://cloud.google.com/dialogflow/cx/docs/concept/session). + * Note: Always use agent versions for production traffic. + * See [Versions and + * environments](https://cloud.google.com/dialogflow/cx/docs/concept/version). * * * @@ -935,6 +953,9 @@ public Builder clearSession() { * The length of the `Session ID` must not exceed 36 characters. * For more information, see the [sessions * guide](https://cloud.google.com/dialogflow/cx/docs/concept/session). + * Note: Always use agent versions for production traffic. + * See [Versions and + * environments](https://cloud.google.com/dialogflow/cx/docs/concept/version). * * * diff --git a/proto-google-cloud-dialogflow-cx-v3beta1/src/main/java/com/google/cloud/dialogflow/cx/v3beta1/DetectIntentRequestOrBuilder.java b/proto-google-cloud-dialogflow-cx-v3beta1/src/main/java/com/google/cloud/dialogflow/cx/v3beta1/DetectIntentRequestOrBuilder.java index 777218531..6c5a1da3d 100644 --- a/proto-google-cloud-dialogflow-cx-v3beta1/src/main/java/com/google/cloud/dialogflow/cx/v3beta1/DetectIntentRequestOrBuilder.java +++ b/proto-google-cloud-dialogflow-cx-v3beta1/src/main/java/com/google/cloud/dialogflow/cx/v3beta1/DetectIntentRequestOrBuilder.java @@ -38,6 +38,9 @@ public interface DetectIntentRequestOrBuilder * The length of the `Session ID` must not exceed 36 characters. * For more information, see the [sessions * guide](https://cloud.google.com/dialogflow/cx/docs/concept/session). + * Note: Always use agent versions for production traffic. + * See [Versions and + * environments](https://cloud.google.com/dialogflow/cx/docs/concept/version). * * * @@ -62,6 +65,9 @@ public interface DetectIntentRequestOrBuilder * The length of the `Session ID` must not exceed 36 characters. * For more information, see the [sessions * guide](https://cloud.google.com/dialogflow/cx/docs/concept/session). + * Note: Always use agent versions for production traffic. + * See [Versions and + * environments](https://cloud.google.com/dialogflow/cx/docs/concept/version). * * * diff --git a/proto-google-cloud-dialogflow-cx-v3beta1/src/main/java/com/google/cloud/dialogflow/cx/v3beta1/EntityTypeName.java b/proto-google-cloud-dialogflow-cx-v3beta1/src/main/java/com/google/cloud/dialogflow/cx/v3beta1/EntityTypeName.java index 22cc944ab..e7c815495 100644 --- a/proto-google-cloud-dialogflow-cx-v3beta1/src/main/java/com/google/cloud/dialogflow/cx/v3beta1/EntityTypeName.java +++ b/proto-google-cloud-dialogflow-cx-v3beta1/src/main/java/com/google/cloud/dialogflow/cx/v3beta1/EntityTypeName.java @@ -5,7 +5,7 @@ * 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 + * 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, @@ -23,22 +23,36 @@ import java.util.ArrayList; import java.util.List; import java.util.Map; +import java.util.Objects; +import javax.annotation.Generated; -/** AUTO-GENERATED DOCUMENTATION AND CLASS */ -@javax.annotation.Generated("by GAPIC protoc plugin") +// AUTO-GENERATED DOCUMENTATION AND CLASS. +@Generated("by gapic-generator-java") public class EntityTypeName implements ResourceName { - - private static final PathTemplate PATH_TEMPLATE = + private static final PathTemplate PROJECT_LOCATION_AGENT_ENTITY_TYPE = PathTemplate.createWithoutUrlEncoding( "projects/{project}/locations/{location}/agents/{agent}/entityTypes/{entity_type}"); - private volatile Map fieldValuesMap; - private final String project; private final String location; private final String agent; private final String entityType; + @Deprecated + protected EntityTypeName() { + project = null; + location = null; + agent = null; + entityType = null; + } + + private EntityTypeName(Builder builder) { + project = Preconditions.checkNotNull(builder.getProject()); + location = Preconditions.checkNotNull(builder.getLocation()); + agent = Preconditions.checkNotNull(builder.getAgent()); + entityType = Preconditions.checkNotNull(builder.getEntityType()); + } + public String getProject() { return project; } @@ -63,13 +77,6 @@ public Builder toBuilder() { return new Builder(this); } - private EntityTypeName(Builder builder) { - project = Preconditions.checkNotNull(builder.getProject()); - location = Preconditions.checkNotNull(builder.getLocation()); - agent = Preconditions.checkNotNull(builder.getAgent()); - entityType = Preconditions.checkNotNull(builder.getEntityType()); - } - public static EntityTypeName of( String project, String location, String agent, String entityType) { return newBuilder() @@ -95,7 +102,7 @@ public static EntityTypeName parse(String formattedString) { return null; } Map matchMap = - PATH_TEMPLATE.validatedMatch( + PROJECT_LOCATION_AGENT_ENTITY_TYPE.validatedMatch( formattedString, "EntityTypeName.parse: formattedString not in valid format"); return of( matchMap.get("project"), @@ -113,7 +120,7 @@ public static List parseList(List formattedStrings) { } public static List toStringList(List values) { - List list = new ArrayList(values.size()); + List list = new ArrayList<>(values.size()); for (EntityTypeName value : values) { if (value == null) { list.add(""); @@ -125,18 +132,27 @@ public static List toStringList(List values) { } public static boolean isParsableFrom(String formattedString) { - return PATH_TEMPLATE.matches(formattedString); + return PROJECT_LOCATION_AGENT_ENTITY_TYPE.matches(formattedString); } + @Override public Map getFieldValuesMap() { if (fieldValuesMap == null) { synchronized (this) { if (fieldValuesMap == null) { ImmutableMap.Builder fieldMapBuilder = ImmutableMap.builder(); - fieldMapBuilder.put("project", project); - fieldMapBuilder.put("location", location); - fieldMapBuilder.put("agent", agent); - fieldMapBuilder.put("entityType", entityType); + if (project != null) { + fieldMapBuilder.put("project", project); + } + if (location != null) { + fieldMapBuilder.put("location", location); + } + if (agent != null) { + fieldMapBuilder.put("agent", agent); + } + if (entityType != null) { + fieldMapBuilder.put("entity_type", entityType); + } fieldValuesMap = fieldMapBuilder.build(); } } @@ -150,18 +166,50 @@ public String getFieldValue(String fieldName) { @Override public String toString() { - return PATH_TEMPLATE.instantiate( + return PROJECT_LOCATION_AGENT_ENTITY_TYPE.instantiate( "project", project, "location", location, "agent", agent, "entity_type", entityType); } - /** Builder for EntityTypeName. */ - public static class Builder { + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o != null || getClass() == o.getClass()) { + EntityTypeName that = ((EntityTypeName) o); + return Objects.equals(this.project, that.project) + && Objects.equals(this.location, that.location) + && Objects.equals(this.agent, that.agent) + && Objects.equals(this.entityType, that.entityType); + } + return false; + } + @Override + public int hashCode() { + int h = 1; + h *= 1000003; + h ^= Objects.hashCode(project); + h *= 1000003; + h ^= Objects.hashCode(location); + h *= 1000003; + h ^= Objects.hashCode(agent); + h *= 1000003; + h ^= Objects.hashCode(entityType); + return h; + } + + /** + * Builder for projects/{project}/locations/{location}/agents/{agent}/entityTypes/{entity_type}. + */ + public static class Builder { private String project; private String location; private String agent; private String entityType; + protected Builder() {} + public String getProject() { return project; } @@ -198,8 +246,6 @@ public Builder setEntityType(String entityType) { return this; } - private Builder() {} - private Builder(EntityTypeName entityTypeName) { project = entityTypeName.project; location = entityTypeName.location; @@ -211,33 +257,4 @@ public EntityTypeName build() { return new EntityTypeName(this); } } - - @Override - public boolean equals(Object o) { - if (o == this) { - return true; - } - if (o instanceof EntityTypeName) { - EntityTypeName that = (EntityTypeName) o; - return (this.project.equals(that.project)) - && (this.location.equals(that.location)) - && (this.agent.equals(that.agent)) - && (this.entityType.equals(that.entityType)); - } - return false; - } - - @Override - public int hashCode() { - int h = 1; - h *= 1000003; - h ^= project.hashCode(); - h *= 1000003; - h ^= location.hashCode(); - h *= 1000003; - h ^= agent.hashCode(); - h *= 1000003; - h ^= entityType.hashCode(); - return h; - } } diff --git a/proto-google-cloud-dialogflow-cx-v3beta1/src/main/java/com/google/cloud/dialogflow/cx/v3beta1/EnvironmentName.java b/proto-google-cloud-dialogflow-cx-v3beta1/src/main/java/com/google/cloud/dialogflow/cx/v3beta1/EnvironmentName.java index 33cfca470..21f3ad2c0 100644 --- a/proto-google-cloud-dialogflow-cx-v3beta1/src/main/java/com/google/cloud/dialogflow/cx/v3beta1/EnvironmentName.java +++ b/proto-google-cloud-dialogflow-cx-v3beta1/src/main/java/com/google/cloud/dialogflow/cx/v3beta1/EnvironmentName.java @@ -5,7 +5,7 @@ * 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 + * 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, @@ -23,22 +23,36 @@ import java.util.ArrayList; import java.util.List; import java.util.Map; +import java.util.Objects; +import javax.annotation.Generated; -/** AUTO-GENERATED DOCUMENTATION AND CLASS */ -@javax.annotation.Generated("by GAPIC protoc plugin") +// AUTO-GENERATED DOCUMENTATION AND CLASS. +@Generated("by gapic-generator-java") public class EnvironmentName implements ResourceName { - - private static final PathTemplate PATH_TEMPLATE = + private static final PathTemplate PROJECT_LOCATION_AGENT_ENVIRONMENT = PathTemplate.createWithoutUrlEncoding( "projects/{project}/locations/{location}/agents/{agent}/environments/{environment}"); - private volatile Map fieldValuesMap; - private final String project; private final String location; private final String agent; private final String environment; + @Deprecated + protected EnvironmentName() { + project = null; + location = null; + agent = null; + environment = null; + } + + private EnvironmentName(Builder builder) { + project = Preconditions.checkNotNull(builder.getProject()); + location = Preconditions.checkNotNull(builder.getLocation()); + agent = Preconditions.checkNotNull(builder.getAgent()); + environment = Preconditions.checkNotNull(builder.getEnvironment()); + } + public String getProject() { return project; } @@ -63,13 +77,6 @@ public Builder toBuilder() { return new Builder(this); } - private EnvironmentName(Builder builder) { - project = Preconditions.checkNotNull(builder.getProject()); - location = Preconditions.checkNotNull(builder.getLocation()); - agent = Preconditions.checkNotNull(builder.getAgent()); - environment = Preconditions.checkNotNull(builder.getEnvironment()); - } - public static EnvironmentName of( String project, String location, String agent, String environment) { return newBuilder() @@ -95,7 +102,7 @@ public static EnvironmentName parse(String formattedString) { return null; } Map matchMap = - PATH_TEMPLATE.validatedMatch( + PROJECT_LOCATION_AGENT_ENVIRONMENT.validatedMatch( formattedString, "EnvironmentName.parse: formattedString not in valid format"); return of( matchMap.get("project"), @@ -113,7 +120,7 @@ public static List parseList(List formattedStrings) { } public static List toStringList(List values) { - List list = new ArrayList(values.size()); + List list = new ArrayList<>(values.size()); for (EnvironmentName value : values) { if (value == null) { list.add(""); @@ -125,18 +132,27 @@ public static List toStringList(List values) { } public static boolean isParsableFrom(String formattedString) { - return PATH_TEMPLATE.matches(formattedString); + return PROJECT_LOCATION_AGENT_ENVIRONMENT.matches(formattedString); } + @Override public Map getFieldValuesMap() { if (fieldValuesMap == null) { synchronized (this) { if (fieldValuesMap == null) { ImmutableMap.Builder fieldMapBuilder = ImmutableMap.builder(); - fieldMapBuilder.put("project", project); - fieldMapBuilder.put("location", location); - fieldMapBuilder.put("agent", agent); - fieldMapBuilder.put("environment", environment); + if (project != null) { + fieldMapBuilder.put("project", project); + } + if (location != null) { + fieldMapBuilder.put("location", location); + } + if (agent != null) { + fieldMapBuilder.put("agent", agent); + } + if (environment != null) { + fieldMapBuilder.put("environment", environment); + } fieldValuesMap = fieldMapBuilder.build(); } } @@ -150,18 +166,50 @@ public String getFieldValue(String fieldName) { @Override public String toString() { - return PATH_TEMPLATE.instantiate( + return PROJECT_LOCATION_AGENT_ENVIRONMENT.instantiate( "project", project, "location", location, "agent", agent, "environment", environment); } - /** Builder for EnvironmentName. */ - public static class Builder { + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o != null || getClass() == o.getClass()) { + EnvironmentName that = ((EnvironmentName) o); + return Objects.equals(this.project, that.project) + && Objects.equals(this.location, that.location) + && Objects.equals(this.agent, that.agent) + && Objects.equals(this.environment, that.environment); + } + return false; + } + @Override + public int hashCode() { + int h = 1; + h *= 1000003; + h ^= Objects.hashCode(project); + h *= 1000003; + h ^= Objects.hashCode(location); + h *= 1000003; + h ^= Objects.hashCode(agent); + h *= 1000003; + h ^= Objects.hashCode(environment); + return h; + } + + /** + * Builder for projects/{project}/locations/{location}/agents/{agent}/environments/{environment}. + */ + public static class Builder { private String project; private String location; private String agent; private String environment; + protected Builder() {} + public String getProject() { return project; } @@ -198,8 +246,6 @@ public Builder setEnvironment(String environment) { return this; } - private Builder() {} - private Builder(EnvironmentName environmentName) { project = environmentName.project; location = environmentName.location; @@ -211,33 +257,4 @@ public EnvironmentName build() { return new EnvironmentName(this); } } - - @Override - public boolean equals(Object o) { - if (o == this) { - return true; - } - if (o instanceof EnvironmentName) { - EnvironmentName that = (EnvironmentName) o; - return (this.project.equals(that.project)) - && (this.location.equals(that.location)) - && (this.agent.equals(that.agent)) - && (this.environment.equals(that.environment)); - } - return false; - } - - @Override - public int hashCode() { - int h = 1; - h *= 1000003; - h ^= project.hashCode(); - h *= 1000003; - h ^= location.hashCode(); - h *= 1000003; - h ^= agent.hashCode(); - h *= 1000003; - h ^= environment.hashCode(); - return h; - } } diff --git a/proto-google-cloud-dialogflow-cx-v3beta1/src/main/java/com/google/cloud/dialogflow/cx/v3beta1/FlowName.java b/proto-google-cloud-dialogflow-cx-v3beta1/src/main/java/com/google/cloud/dialogflow/cx/v3beta1/FlowName.java index 12cb0199a..bdf8742b1 100644 --- a/proto-google-cloud-dialogflow-cx-v3beta1/src/main/java/com/google/cloud/dialogflow/cx/v3beta1/FlowName.java +++ b/proto-google-cloud-dialogflow-cx-v3beta1/src/main/java/com/google/cloud/dialogflow/cx/v3beta1/FlowName.java @@ -5,7 +5,7 @@ * 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 + * 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, @@ -23,22 +23,36 @@ import java.util.ArrayList; import java.util.List; import java.util.Map; +import java.util.Objects; +import javax.annotation.Generated; -/** AUTO-GENERATED DOCUMENTATION AND CLASS */ -@javax.annotation.Generated("by GAPIC protoc plugin") +// AUTO-GENERATED DOCUMENTATION AND CLASS. +@Generated("by gapic-generator-java") public class FlowName implements ResourceName { - - private static final PathTemplate PATH_TEMPLATE = + private static final PathTemplate PROJECT_LOCATION_AGENT_FLOW = PathTemplate.createWithoutUrlEncoding( "projects/{project}/locations/{location}/agents/{agent}/flows/{flow}"); - private volatile Map fieldValuesMap; - private final String project; private final String location; private final String agent; private final String flow; + @Deprecated + protected FlowName() { + project = null; + location = null; + agent = null; + flow = null; + } + + private FlowName(Builder builder) { + project = Preconditions.checkNotNull(builder.getProject()); + location = Preconditions.checkNotNull(builder.getLocation()); + agent = Preconditions.checkNotNull(builder.getAgent()); + flow = Preconditions.checkNotNull(builder.getFlow()); + } + public String getProject() { return project; } @@ -63,13 +77,6 @@ public Builder toBuilder() { return new Builder(this); } - private FlowName(Builder builder) { - project = Preconditions.checkNotNull(builder.getProject()); - location = Preconditions.checkNotNull(builder.getLocation()); - agent = Preconditions.checkNotNull(builder.getAgent()); - flow = Preconditions.checkNotNull(builder.getFlow()); - } - public static FlowName of(String project, String location, String agent, String flow) { return newBuilder() .setProject(project) @@ -94,7 +101,7 @@ public static FlowName parse(String formattedString) { return null; } Map matchMap = - PATH_TEMPLATE.validatedMatch( + PROJECT_LOCATION_AGENT_FLOW.validatedMatch( formattedString, "FlowName.parse: formattedString not in valid format"); return of( matchMap.get("project"), @@ -112,7 +119,7 @@ public static List parseList(List formattedStrings) { } public static List toStringList(List values) { - List list = new ArrayList(values.size()); + List list = new ArrayList<>(values.size()); for (FlowName value : values) { if (value == null) { list.add(""); @@ -124,18 +131,27 @@ public static List toStringList(List values) { } public static boolean isParsableFrom(String formattedString) { - return PATH_TEMPLATE.matches(formattedString); + return PROJECT_LOCATION_AGENT_FLOW.matches(formattedString); } + @Override public Map getFieldValuesMap() { if (fieldValuesMap == null) { synchronized (this) { if (fieldValuesMap == null) { ImmutableMap.Builder fieldMapBuilder = ImmutableMap.builder(); - fieldMapBuilder.put("project", project); - fieldMapBuilder.put("location", location); - fieldMapBuilder.put("agent", agent); - fieldMapBuilder.put("flow", flow); + if (project != null) { + fieldMapBuilder.put("project", project); + } + if (location != null) { + fieldMapBuilder.put("location", location); + } + if (agent != null) { + fieldMapBuilder.put("agent", agent); + } + if (flow != null) { + fieldMapBuilder.put("flow", flow); + } fieldValuesMap = fieldMapBuilder.build(); } } @@ -149,18 +165,48 @@ public String getFieldValue(String fieldName) { @Override public String toString() { - return PATH_TEMPLATE.instantiate( + return PROJECT_LOCATION_AGENT_FLOW.instantiate( "project", project, "location", location, "agent", agent, "flow", flow); } - /** Builder for FlowName. */ - public static class Builder { + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o != null || getClass() == o.getClass()) { + FlowName that = ((FlowName) o); + return Objects.equals(this.project, that.project) + && Objects.equals(this.location, that.location) + && Objects.equals(this.agent, that.agent) + && Objects.equals(this.flow, that.flow); + } + return false; + } + @Override + public int hashCode() { + int h = 1; + h *= 1000003; + h ^= Objects.hashCode(project); + h *= 1000003; + h ^= Objects.hashCode(location); + h *= 1000003; + h ^= Objects.hashCode(agent); + h *= 1000003; + h ^= Objects.hashCode(flow); + return h; + } + + /** Builder for projects/{project}/locations/{location}/agents/{agent}/flows/{flow}. */ + public static class Builder { private String project; private String location; private String agent; private String flow; + protected Builder() {} + public String getProject() { return project; } @@ -197,8 +243,6 @@ public Builder setFlow(String flow) { return this; } - private Builder() {} - private Builder(FlowName flowName) { project = flowName.project; location = flowName.location; @@ -210,33 +254,4 @@ public FlowName build() { return new FlowName(this); } } - - @Override - public boolean equals(Object o) { - if (o == this) { - return true; - } - if (o instanceof FlowName) { - FlowName that = (FlowName) o; - return (this.project.equals(that.project)) - && (this.location.equals(that.location)) - && (this.agent.equals(that.agent)) - && (this.flow.equals(that.flow)); - } - return false; - } - - @Override - public int hashCode() { - int h = 1; - h *= 1000003; - h ^= project.hashCode(); - h *= 1000003; - h ^= location.hashCode(); - h *= 1000003; - h ^= agent.hashCode(); - h *= 1000003; - h ^= flow.hashCode(); - return h; - } } diff --git a/proto-google-cloud-dialogflow-cx-v3beta1/src/main/java/com/google/cloud/dialogflow/cx/v3beta1/IntentName.java b/proto-google-cloud-dialogflow-cx-v3beta1/src/main/java/com/google/cloud/dialogflow/cx/v3beta1/IntentName.java index 5fe2d5727..d1f44f085 100644 --- a/proto-google-cloud-dialogflow-cx-v3beta1/src/main/java/com/google/cloud/dialogflow/cx/v3beta1/IntentName.java +++ b/proto-google-cloud-dialogflow-cx-v3beta1/src/main/java/com/google/cloud/dialogflow/cx/v3beta1/IntentName.java @@ -5,7 +5,7 @@ * 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 + * 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, @@ -23,22 +23,36 @@ import java.util.ArrayList; import java.util.List; import java.util.Map; +import java.util.Objects; +import javax.annotation.Generated; -/** AUTO-GENERATED DOCUMENTATION AND CLASS */ -@javax.annotation.Generated("by GAPIC protoc plugin") +// AUTO-GENERATED DOCUMENTATION AND CLASS. +@Generated("by gapic-generator-java") public class IntentName implements ResourceName { - - private static final PathTemplate PATH_TEMPLATE = + private static final PathTemplate PROJECT_LOCATION_AGENT_INTENT = PathTemplate.createWithoutUrlEncoding( "projects/{project}/locations/{location}/agents/{agent}/intents/{intent}"); - private volatile Map fieldValuesMap; - private final String project; private final String location; private final String agent; private final String intent; + @Deprecated + protected IntentName() { + project = null; + location = null; + agent = null; + intent = null; + } + + private IntentName(Builder builder) { + project = Preconditions.checkNotNull(builder.getProject()); + location = Preconditions.checkNotNull(builder.getLocation()); + agent = Preconditions.checkNotNull(builder.getAgent()); + intent = Preconditions.checkNotNull(builder.getIntent()); + } + public String getProject() { return project; } @@ -63,13 +77,6 @@ public Builder toBuilder() { return new Builder(this); } - private IntentName(Builder builder) { - project = Preconditions.checkNotNull(builder.getProject()); - location = Preconditions.checkNotNull(builder.getLocation()); - agent = Preconditions.checkNotNull(builder.getAgent()); - intent = Preconditions.checkNotNull(builder.getIntent()); - } - public static IntentName of(String project, String location, String agent, String intent) { return newBuilder() .setProject(project) @@ -94,7 +101,7 @@ public static IntentName parse(String formattedString) { return null; } Map matchMap = - PATH_TEMPLATE.validatedMatch( + PROJECT_LOCATION_AGENT_INTENT.validatedMatch( formattedString, "IntentName.parse: formattedString not in valid format"); return of( matchMap.get("project"), @@ -112,7 +119,7 @@ public static List parseList(List formattedStrings) { } public static List toStringList(List values) { - List list = new ArrayList(values.size()); + List list = new ArrayList<>(values.size()); for (IntentName value : values) { if (value == null) { list.add(""); @@ -124,18 +131,27 @@ public static List toStringList(List values) { } public static boolean isParsableFrom(String formattedString) { - return PATH_TEMPLATE.matches(formattedString); + return PROJECT_LOCATION_AGENT_INTENT.matches(formattedString); } + @Override public Map getFieldValuesMap() { if (fieldValuesMap == null) { synchronized (this) { if (fieldValuesMap == null) { ImmutableMap.Builder fieldMapBuilder = ImmutableMap.builder(); - fieldMapBuilder.put("project", project); - fieldMapBuilder.put("location", location); - fieldMapBuilder.put("agent", agent); - fieldMapBuilder.put("intent", intent); + if (project != null) { + fieldMapBuilder.put("project", project); + } + if (location != null) { + fieldMapBuilder.put("location", location); + } + if (agent != null) { + fieldMapBuilder.put("agent", agent); + } + if (intent != null) { + fieldMapBuilder.put("intent", intent); + } fieldValuesMap = fieldMapBuilder.build(); } } @@ -149,18 +165,48 @@ public String getFieldValue(String fieldName) { @Override public String toString() { - return PATH_TEMPLATE.instantiate( + return PROJECT_LOCATION_AGENT_INTENT.instantiate( "project", project, "location", location, "agent", agent, "intent", intent); } - /** Builder for IntentName. */ - public static class Builder { + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o != null || getClass() == o.getClass()) { + IntentName that = ((IntentName) o); + return Objects.equals(this.project, that.project) + && Objects.equals(this.location, that.location) + && Objects.equals(this.agent, that.agent) + && Objects.equals(this.intent, that.intent); + } + return false; + } + @Override + public int hashCode() { + int h = 1; + h *= 1000003; + h ^= Objects.hashCode(project); + h *= 1000003; + h ^= Objects.hashCode(location); + h *= 1000003; + h ^= Objects.hashCode(agent); + h *= 1000003; + h ^= Objects.hashCode(intent); + return h; + } + + /** Builder for projects/{project}/locations/{location}/agents/{agent}/intents/{intent}. */ + public static class Builder { private String project; private String location; private String agent; private String intent; + protected Builder() {} + public String getProject() { return project; } @@ -197,8 +243,6 @@ public Builder setIntent(String intent) { return this; } - private Builder() {} - private Builder(IntentName intentName) { project = intentName.project; location = intentName.location; @@ -210,33 +254,4 @@ public IntentName build() { return new IntentName(this); } } - - @Override - public boolean equals(Object o) { - if (o == this) { - return true; - } - if (o instanceof IntentName) { - IntentName that = (IntentName) o; - return (this.project.equals(that.project)) - && (this.location.equals(that.location)) - && (this.agent.equals(that.agent)) - && (this.intent.equals(that.intent)); - } - return false; - } - - @Override - public int hashCode() { - int h = 1; - h *= 1000003; - h ^= project.hashCode(); - h *= 1000003; - h ^= location.hashCode(); - h *= 1000003; - h ^= agent.hashCode(); - h *= 1000003; - h ^= intent.hashCode(); - return h; - } } diff --git a/proto-google-cloud-dialogflow-cx-v3beta1/src/main/java/com/google/cloud/dialogflow/cx/v3beta1/LocationName.java b/proto-google-cloud-dialogflow-cx-v3beta1/src/main/java/com/google/cloud/dialogflow/cx/v3beta1/LocationName.java index 7f792bb28..260decf0e 100644 --- a/proto-google-cloud-dialogflow-cx-v3beta1/src/main/java/com/google/cloud/dialogflow/cx/v3beta1/LocationName.java +++ b/proto-google-cloud-dialogflow-cx-v3beta1/src/main/java/com/google/cloud/dialogflow/cx/v3beta1/LocationName.java @@ -5,7 +5,7 @@ * 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 + * 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, @@ -23,19 +23,29 @@ import java.util.ArrayList; import java.util.List; import java.util.Map; +import java.util.Objects; +import javax.annotation.Generated; -/** AUTO-GENERATED DOCUMENTATION AND CLASS */ -@javax.annotation.Generated("by GAPIC protoc plugin") +// AUTO-GENERATED DOCUMENTATION AND CLASS. +@Generated("by gapic-generator-java") public class LocationName implements ResourceName { - - private static final PathTemplate PATH_TEMPLATE = + private static final PathTemplate PROJECT_LOCATION = PathTemplate.createWithoutUrlEncoding("projects/{project}/locations/{location}"); - private volatile Map fieldValuesMap; - private final String project; private final String location; + @Deprecated + protected LocationName() { + project = null; + location = null; + } + + private LocationName(Builder builder) { + project = Preconditions.checkNotNull(builder.getProject()); + location = Preconditions.checkNotNull(builder.getLocation()); + } + public String getProject() { return project; } @@ -52,11 +62,6 @@ public Builder toBuilder() { return new Builder(this); } - private LocationName(Builder builder) { - project = Preconditions.checkNotNull(builder.getProject()); - location = Preconditions.checkNotNull(builder.getLocation()); - } - public static LocationName of(String project, String location) { return newBuilder().setProject(project).setLocation(location).build(); } @@ -70,7 +75,7 @@ public static LocationName parse(String formattedString) { return null; } Map matchMap = - PATH_TEMPLATE.validatedMatch( + PROJECT_LOCATION.validatedMatch( formattedString, "LocationName.parse: formattedString not in valid format"); return of(matchMap.get("project"), matchMap.get("location")); } @@ -84,7 +89,7 @@ public static List parseList(List formattedStrings) { } public static List toStringList(List values) { - List list = new ArrayList(values.size()); + List list = new ArrayList<>(values.size()); for (LocationName value : values) { if (value == null) { list.add(""); @@ -96,16 +101,21 @@ public static List toStringList(List values) { } public static boolean isParsableFrom(String formattedString) { - return PATH_TEMPLATE.matches(formattedString); + return PROJECT_LOCATION.matches(formattedString); } + @Override public Map getFieldValuesMap() { if (fieldValuesMap == null) { synchronized (this) { if (fieldValuesMap == null) { ImmutableMap.Builder fieldMapBuilder = ImmutableMap.builder(); - fieldMapBuilder.put("project", project); - fieldMapBuilder.put("location", location); + if (project != null) { + fieldMapBuilder.put("project", project); + } + if (location != null) { + fieldMapBuilder.put("location", location); + } fieldValuesMap = fieldMapBuilder.build(); } } @@ -119,15 +129,39 @@ public String getFieldValue(String fieldName) { @Override public String toString() { - return PATH_TEMPLATE.instantiate("project", project, "location", location); + return PROJECT_LOCATION.instantiate("project", project, "location", location); } - /** Builder for LocationName. */ - public static class Builder { + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o != null || getClass() == o.getClass()) { + LocationName that = ((LocationName) o); + return Objects.equals(this.project, that.project) + && Objects.equals(this.location, that.location); + } + return false; + } + @Override + public int hashCode() { + int h = 1; + h *= 1000003; + h ^= Objects.hashCode(project); + h *= 1000003; + h ^= Objects.hashCode(location); + return h; + } + + /** Builder for projects/{project}/locations/{location}. */ + public static class Builder { private String project; private String location; + protected Builder() {} + public String getProject() { return project; } @@ -146,8 +180,6 @@ public Builder setLocation(String location) { return this; } - private Builder() {} - private Builder(LocationName locationName) { project = locationName.project; location = locationName.location; @@ -157,26 +189,4 @@ public LocationName build() { return new LocationName(this); } } - - @Override - public boolean equals(Object o) { - if (o == this) { - return true; - } - if (o instanceof LocationName) { - LocationName that = (LocationName) o; - return (this.project.equals(that.project)) && (this.location.equals(that.location)); - } - return false; - } - - @Override - public int hashCode() { - int h = 1; - h *= 1000003; - h ^= project.hashCode(); - h *= 1000003; - h ^= location.hashCode(); - return h; - } } diff --git a/proto-google-cloud-dialogflow-cx-v3beta1/src/main/java/com/google/cloud/dialogflow/cx/v3beta1/PageName.java b/proto-google-cloud-dialogflow-cx-v3beta1/src/main/java/com/google/cloud/dialogflow/cx/v3beta1/PageName.java index 1bcd0c9ad..4a06c7142 100644 --- a/proto-google-cloud-dialogflow-cx-v3beta1/src/main/java/com/google/cloud/dialogflow/cx/v3beta1/PageName.java +++ b/proto-google-cloud-dialogflow-cx-v3beta1/src/main/java/com/google/cloud/dialogflow/cx/v3beta1/PageName.java @@ -5,7 +5,7 @@ * 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 + * 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, @@ -23,23 +23,39 @@ import java.util.ArrayList; import java.util.List; import java.util.Map; +import java.util.Objects; +import javax.annotation.Generated; -/** AUTO-GENERATED DOCUMENTATION AND CLASS */ -@javax.annotation.Generated("by GAPIC protoc plugin") +// AUTO-GENERATED DOCUMENTATION AND CLASS. +@Generated("by gapic-generator-java") public class PageName implements ResourceName { - - private static final PathTemplate PATH_TEMPLATE = + private static final PathTemplate PROJECT_LOCATION_AGENT_FLOW_PAGE = PathTemplate.createWithoutUrlEncoding( "projects/{project}/locations/{location}/agents/{agent}/flows/{flow}/pages/{page}"); - private volatile Map fieldValuesMap; - private final String project; private final String location; private final String agent; private final String flow; private final String page; + @Deprecated + protected PageName() { + project = null; + location = null; + agent = null; + flow = null; + page = null; + } + + private PageName(Builder builder) { + project = Preconditions.checkNotNull(builder.getProject()); + location = Preconditions.checkNotNull(builder.getLocation()); + agent = Preconditions.checkNotNull(builder.getAgent()); + flow = Preconditions.checkNotNull(builder.getFlow()); + page = Preconditions.checkNotNull(builder.getPage()); + } + public String getProject() { return project; } @@ -68,14 +84,6 @@ public Builder toBuilder() { return new Builder(this); } - private PageName(Builder builder) { - project = Preconditions.checkNotNull(builder.getProject()); - location = Preconditions.checkNotNull(builder.getLocation()); - agent = Preconditions.checkNotNull(builder.getAgent()); - flow = Preconditions.checkNotNull(builder.getFlow()); - page = Preconditions.checkNotNull(builder.getPage()); - } - public static PageName of( String project, String location, String agent, String flow, String page) { return newBuilder() @@ -104,7 +112,7 @@ public static PageName parse(String formattedString) { return null; } Map matchMap = - PATH_TEMPLATE.validatedMatch( + PROJECT_LOCATION_AGENT_FLOW_PAGE.validatedMatch( formattedString, "PageName.parse: formattedString not in valid format"); return of( matchMap.get("project"), @@ -123,7 +131,7 @@ public static List parseList(List formattedStrings) { } public static List toStringList(List values) { - List list = new ArrayList(values.size()); + List list = new ArrayList<>(values.size()); for (PageName value : values) { if (value == null) { list.add(""); @@ -135,19 +143,30 @@ public static List toStringList(List values) { } public static boolean isParsableFrom(String formattedString) { - return PATH_TEMPLATE.matches(formattedString); + return PROJECT_LOCATION_AGENT_FLOW_PAGE.matches(formattedString); } + @Override public Map getFieldValuesMap() { if (fieldValuesMap == null) { synchronized (this) { if (fieldValuesMap == null) { ImmutableMap.Builder fieldMapBuilder = ImmutableMap.builder(); - fieldMapBuilder.put("project", project); - fieldMapBuilder.put("location", location); - fieldMapBuilder.put("agent", agent); - fieldMapBuilder.put("flow", flow); - fieldMapBuilder.put("page", page); + if (project != null) { + fieldMapBuilder.put("project", project); + } + if (location != null) { + fieldMapBuilder.put("location", location); + } + if (agent != null) { + fieldMapBuilder.put("agent", agent); + } + if (flow != null) { + fieldMapBuilder.put("flow", flow); + } + if (page != null) { + fieldMapBuilder.put("page", page); + } fieldValuesMap = fieldMapBuilder.build(); } } @@ -161,19 +180,54 @@ public String getFieldValue(String fieldName) { @Override public String toString() { - return PATH_TEMPLATE.instantiate( + return PROJECT_LOCATION_AGENT_FLOW_PAGE.instantiate( "project", project, "location", location, "agent", agent, "flow", flow, "page", page); } - /** Builder for PageName. */ - public static class Builder { + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o != null || getClass() == o.getClass()) { + PageName that = ((PageName) o); + return Objects.equals(this.project, that.project) + && Objects.equals(this.location, that.location) + && Objects.equals(this.agent, that.agent) + && Objects.equals(this.flow, that.flow) + && Objects.equals(this.page, that.page); + } + return false; + } + @Override + public int hashCode() { + int h = 1; + h *= 1000003; + h ^= Objects.hashCode(project); + h *= 1000003; + h ^= Objects.hashCode(location); + h *= 1000003; + h ^= Objects.hashCode(agent); + h *= 1000003; + h ^= Objects.hashCode(flow); + h *= 1000003; + h ^= Objects.hashCode(page); + return h; + } + + /** + * Builder for projects/{project}/locations/{location}/agents/{agent}/flows/{flow}/pages/{page}. + */ + public static class Builder { private String project; private String location; private String agent; private String flow; private String page; + protected Builder() {} + public String getProject() { return project; } @@ -219,8 +273,6 @@ public Builder setPage(String page) { return this; } - private Builder() {} - private Builder(PageName pageName) { project = pageName.project; location = pageName.location; @@ -233,36 +285,4 @@ public PageName build() { return new PageName(this); } } - - @Override - public boolean equals(Object o) { - if (o == this) { - return true; - } - if (o instanceof PageName) { - PageName that = (PageName) o; - return (this.project.equals(that.project)) - && (this.location.equals(that.location)) - && (this.agent.equals(that.agent)) - && (this.flow.equals(that.flow)) - && (this.page.equals(that.page)); - } - return false; - } - - @Override - public int hashCode() { - int h = 1; - h *= 1000003; - h ^= project.hashCode(); - h *= 1000003; - h ^= location.hashCode(); - h *= 1000003; - h ^= agent.hashCode(); - h *= 1000003; - h ^= flow.hashCode(); - h *= 1000003; - h ^= page.hashCode(); - return h; - } } diff --git a/proto-google-cloud-dialogflow-cx-v3beta1/src/main/java/com/google/cloud/dialogflow/cx/v3beta1/QueryParameters.java b/proto-google-cloud-dialogflow-cx-v3beta1/src/main/java/com/google/cloud/dialogflow/cx/v3beta1/QueryParameters.java index 1b53c5605..4bacb3ae3 100644 --- a/proto-google-cloud-dialogflow-cx-v3beta1/src/main/java/com/google/cloud/dialogflow/cx/v3beta1/QueryParameters.java +++ b/proto-google-cloud-dialogflow-cx-v3beta1/src/main/java/com/google/cloud/dialogflow/cx/v3beta1/QueryParameters.java @@ -141,6 +141,23 @@ private QueryParameters( analyzeQueryTextSentiment_ = input.readBool(); break; } + case 82: + { + if (!((mutable_bitField0_ & 0x00000002) != 0)) { + webhookHeaders_ = + com.google.protobuf.MapField.newMapField( + WebhookHeadersDefaultEntryHolder.defaultEntry); + mutable_bitField0_ |= 0x00000002; + } + com.google.protobuf.MapEntry webhookHeaders__ = + input.readMessage( + WebhookHeadersDefaultEntryHolder.defaultEntry.getParserForType(), + extensionRegistry); + webhookHeaders_ + .getMutableMap() + .put(webhookHeaders__.getKey(), webhookHeaders__.getValue()); + break; + } default: { if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { @@ -168,6 +185,17 @@ public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { .internal_static_google_cloud_dialogflow_cx_v3beta1_QueryParameters_descriptor; } + @SuppressWarnings({"rawtypes"}) + @java.lang.Override + protected com.google.protobuf.MapField internalGetMapField(int number) { + switch (number) { + case 10: + return internalGetWebhookHeaders(); + default: + throw new RuntimeException("Invalid map field number: " + number); + } + } + @java.lang.Override protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internalGetFieldAccessorTable() { @@ -525,6 +553,135 @@ public boolean getAnalyzeQueryTextSentiment() { return analyzeQueryTextSentiment_; } + public static final int WEBHOOK_HEADERS_FIELD_NUMBER = 10; + + private static final class WebhookHeadersDefaultEntryHolder { + static final com.google.protobuf.MapEntry defaultEntry = + com.google.protobuf.MapEntry.newDefaultInstance( + com.google.cloud.dialogflow.cx.v3beta1.SessionProto + .internal_static_google_cloud_dialogflow_cx_v3beta1_QueryParameters_WebhookHeadersEntry_descriptor, + com.google.protobuf.WireFormat.FieldType.STRING, + "", + com.google.protobuf.WireFormat.FieldType.STRING, + ""); + } + + private com.google.protobuf.MapField webhookHeaders_; + + private com.google.protobuf.MapField + internalGetWebhookHeaders() { + if (webhookHeaders_ == null) { + return com.google.protobuf.MapField.emptyMapField( + WebhookHeadersDefaultEntryHolder.defaultEntry); + } + return webhookHeaders_; + } + + public int getWebhookHeadersCount() { + return internalGetWebhookHeaders().getMap().size(); + } + /** + * + * + *
+   * This field can be used to pass HTTP headers for a webhook
+   * call. These headers will be sent to webhook along with the headers that
+   * have been configured through Dialogflow web console. The headers defined
+   * within this field will overwrite the headers configured through Dialogflow
+   * console if there is a conflict. Header names are case-insensitive.
+   * Google's specified headers are not allowed. Including: "Host",
+   * "Content-Length", "Connection", "From", "User-Agent", "Accept-Encoding",
+   * "If-Modified-Since", "If-None-Match", "X-Forwarded-For", etc.
+   * 
+ * + * map<string, string> webhook_headers = 10; + */ + @java.lang.Override + public boolean containsWebhookHeaders(java.lang.String key) { + if (key == null) { + throw new java.lang.NullPointerException(); + } + return internalGetWebhookHeaders().getMap().containsKey(key); + } + /** Use {@link #getWebhookHeadersMap()} instead. */ + @java.lang.Override + @java.lang.Deprecated + public java.util.Map getWebhookHeaders() { + return getWebhookHeadersMap(); + } + /** + * + * + *
+   * This field can be used to pass HTTP headers for a webhook
+   * call. These headers will be sent to webhook along with the headers that
+   * have been configured through Dialogflow web console. The headers defined
+   * within this field will overwrite the headers configured through Dialogflow
+   * console if there is a conflict. Header names are case-insensitive.
+   * Google's specified headers are not allowed. Including: "Host",
+   * "Content-Length", "Connection", "From", "User-Agent", "Accept-Encoding",
+   * "If-Modified-Since", "If-None-Match", "X-Forwarded-For", etc.
+   * 
+ * + * map<string, string> webhook_headers = 10; + */ + @java.lang.Override + public java.util.Map getWebhookHeadersMap() { + return internalGetWebhookHeaders().getMap(); + } + /** + * + * + *
+   * This field can be used to pass HTTP headers for a webhook
+   * call. These headers will be sent to webhook along with the headers that
+   * have been configured through Dialogflow web console. The headers defined
+   * within this field will overwrite the headers configured through Dialogflow
+   * console if there is a conflict. Header names are case-insensitive.
+   * Google's specified headers are not allowed. Including: "Host",
+   * "Content-Length", "Connection", "From", "User-Agent", "Accept-Encoding",
+   * "If-Modified-Since", "If-None-Match", "X-Forwarded-For", etc.
+   * 
+ * + * map<string, string> webhook_headers = 10; + */ + @java.lang.Override + public java.lang.String getWebhookHeadersOrDefault( + java.lang.String key, java.lang.String defaultValue) { + if (key == null) { + throw new java.lang.NullPointerException(); + } + java.util.Map map = internalGetWebhookHeaders().getMap(); + return map.containsKey(key) ? map.get(key) : defaultValue; + } + /** + * + * + *
+   * This field can be used to pass HTTP headers for a webhook
+   * call. These headers will be sent to webhook along with the headers that
+   * have been configured through Dialogflow web console. The headers defined
+   * within this field will overwrite the headers configured through Dialogflow
+   * console if there is a conflict. Header names are case-insensitive.
+   * Google's specified headers are not allowed. Including: "Host",
+   * "Content-Length", "Connection", "From", "User-Agent", "Accept-Encoding",
+   * "If-Modified-Since", "If-None-Match", "X-Forwarded-For", etc.
+   * 
+ * + * map<string, string> webhook_headers = 10; + */ + @java.lang.Override + public java.lang.String getWebhookHeadersOrThrow(java.lang.String key) { + if (key == null) { + throw new java.lang.NullPointerException(); + } + java.util.Map map = internalGetWebhookHeaders().getMap(); + if (!map.containsKey(key)) { + throw new java.lang.IllegalArgumentException(); + } + return map.get(key); + } + private byte memoizedIsInitialized = -1; @java.lang.Override @@ -557,6 +714,8 @@ public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io if (analyzeQueryTextSentiment_ != false) { output.writeBool(8, analyzeQueryTextSentiment_); } + com.google.protobuf.GeneratedMessageV3.serializeStringMapTo( + output, internalGetWebhookHeaders(), WebhookHeadersDefaultEntryHolder.defaultEntry, 10); unknownFields.writeTo(output); } @@ -585,6 +744,16 @@ public int getSerializedSize() { if (analyzeQueryTextSentiment_ != false) { size += com.google.protobuf.CodedOutputStream.computeBoolSize(8, analyzeQueryTextSentiment_); } + for (java.util.Map.Entry entry : + internalGetWebhookHeaders().getMap().entrySet()) { + com.google.protobuf.MapEntry webhookHeaders__ = + WebhookHeadersDefaultEntryHolder.defaultEntry + .newBuilderForType() + .setKey(entry.getKey()) + .setValue(entry.getValue()) + .build(); + size += com.google.protobuf.CodedOutputStream.computeMessageSize(10, webhookHeaders__); + } size += unknownFields.getSerializedSize(); memoizedSize = size; return size; @@ -616,6 +785,7 @@ public boolean equals(final java.lang.Object obj) { if (!getParameters().equals(other.getParameters())) return false; } if (getAnalyzeQueryTextSentiment() != other.getAnalyzeQueryTextSentiment()) return false; + if (!internalGetWebhookHeaders().equals(other.internalGetWebhookHeaders())) return false; if (!unknownFields.equals(other.unknownFields)) return false; return true; } @@ -647,6 +817,10 @@ public int hashCode() { } hash = (37 * hash) + ANALYZE_QUERY_TEXT_SENTIMENT_FIELD_NUMBER; hash = (53 * hash) + com.google.protobuf.Internal.hashBoolean(getAnalyzeQueryTextSentiment()); + if (!internalGetWebhookHeaders().getMap().isEmpty()) { + hash = (37 * hash) + WEBHOOK_HEADERS_FIELD_NUMBER; + hash = (53 * hash) + internalGetWebhookHeaders().hashCode(); + } hash = (29 * hash) + unknownFields.hashCode(); memoizedHashCode = hash; return hash; @@ -766,6 +940,26 @@ public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { .internal_static_google_cloud_dialogflow_cx_v3beta1_QueryParameters_descriptor; } + @SuppressWarnings({"rawtypes"}) + protected com.google.protobuf.MapField internalGetMapField(int number) { + switch (number) { + case 10: + return internalGetWebhookHeaders(); + default: + throw new RuntimeException("Invalid map field number: " + number); + } + } + + @SuppressWarnings({"rawtypes"}) + protected com.google.protobuf.MapField internalGetMutableMapField(int number) { + switch (number) { + case 10: + return internalGetMutableWebhookHeaders(); + default: + throw new RuntimeException("Invalid map field number: " + number); + } + } + @java.lang.Override protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internalGetFieldAccessorTable() { @@ -823,6 +1017,7 @@ public Builder clear() { } analyzeQueryTextSentiment_ = false; + internalGetMutableWebhookHeaders().clear(); return this; } @@ -877,6 +1072,8 @@ public com.google.cloud.dialogflow.cx.v3beta1.QueryParameters buildPartial() { result.parameters_ = parametersBuilder_.build(); } result.analyzeQueryTextSentiment_ = analyzeQueryTextSentiment_; + result.webhookHeaders_ = internalGetWebhookHeaders(); + result.webhookHeaders_.makeImmutable(); onBuilt(); return result; } @@ -970,6 +1167,7 @@ public Builder mergeFrom(com.google.cloud.dialogflow.cx.v3beta1.QueryParameters if (other.getAnalyzeQueryTextSentiment() != false) { setAnalyzeQueryTextSentiment(other.getAnalyzeQueryTextSentiment()); } + internalGetMutableWebhookHeaders().mergeFrom(other.internalGetWebhookHeaders()); this.mergeUnknownFields(other.unknownFields); onChanged(); return this; @@ -2297,6 +2495,215 @@ public Builder clearAnalyzeQueryTextSentiment() { return this; } + private com.google.protobuf.MapField webhookHeaders_; + + private com.google.protobuf.MapField + internalGetWebhookHeaders() { + if (webhookHeaders_ == null) { + return com.google.protobuf.MapField.emptyMapField( + WebhookHeadersDefaultEntryHolder.defaultEntry); + } + return webhookHeaders_; + } + + private com.google.protobuf.MapField + internalGetMutableWebhookHeaders() { + onChanged(); + ; + if (webhookHeaders_ == null) { + webhookHeaders_ = + com.google.protobuf.MapField.newMapField(WebhookHeadersDefaultEntryHolder.defaultEntry); + } + if (!webhookHeaders_.isMutable()) { + webhookHeaders_ = webhookHeaders_.copy(); + } + return webhookHeaders_; + } + + public int getWebhookHeadersCount() { + return internalGetWebhookHeaders().getMap().size(); + } + /** + * + * + *
+     * This field can be used to pass HTTP headers for a webhook
+     * call. These headers will be sent to webhook along with the headers that
+     * have been configured through Dialogflow web console. The headers defined
+     * within this field will overwrite the headers configured through Dialogflow
+     * console if there is a conflict. Header names are case-insensitive.
+     * Google's specified headers are not allowed. Including: "Host",
+     * "Content-Length", "Connection", "From", "User-Agent", "Accept-Encoding",
+     * "If-Modified-Since", "If-None-Match", "X-Forwarded-For", etc.
+     * 
+ * + * map<string, string> webhook_headers = 10; + */ + @java.lang.Override + public boolean containsWebhookHeaders(java.lang.String key) { + if (key == null) { + throw new java.lang.NullPointerException(); + } + return internalGetWebhookHeaders().getMap().containsKey(key); + } + /** Use {@link #getWebhookHeadersMap()} instead. */ + @java.lang.Override + @java.lang.Deprecated + public java.util.Map getWebhookHeaders() { + return getWebhookHeadersMap(); + } + /** + * + * + *
+     * This field can be used to pass HTTP headers for a webhook
+     * call. These headers will be sent to webhook along with the headers that
+     * have been configured through Dialogflow web console. The headers defined
+     * within this field will overwrite the headers configured through Dialogflow
+     * console if there is a conflict. Header names are case-insensitive.
+     * Google's specified headers are not allowed. Including: "Host",
+     * "Content-Length", "Connection", "From", "User-Agent", "Accept-Encoding",
+     * "If-Modified-Since", "If-None-Match", "X-Forwarded-For", etc.
+     * 
+ * + * map<string, string> webhook_headers = 10; + */ + @java.lang.Override + public java.util.Map getWebhookHeadersMap() { + return internalGetWebhookHeaders().getMap(); + } + /** + * + * + *
+     * This field can be used to pass HTTP headers for a webhook
+     * call. These headers will be sent to webhook along with the headers that
+     * have been configured through Dialogflow web console. The headers defined
+     * within this field will overwrite the headers configured through Dialogflow
+     * console if there is a conflict. Header names are case-insensitive.
+     * Google's specified headers are not allowed. Including: "Host",
+     * "Content-Length", "Connection", "From", "User-Agent", "Accept-Encoding",
+     * "If-Modified-Since", "If-None-Match", "X-Forwarded-For", etc.
+     * 
+ * + * map<string, string> webhook_headers = 10; + */ + @java.lang.Override + public java.lang.String getWebhookHeadersOrDefault( + java.lang.String key, java.lang.String defaultValue) { + if (key == null) { + throw new java.lang.NullPointerException(); + } + java.util.Map map = internalGetWebhookHeaders().getMap(); + return map.containsKey(key) ? map.get(key) : defaultValue; + } + /** + * + * + *
+     * This field can be used to pass HTTP headers for a webhook
+     * call. These headers will be sent to webhook along with the headers that
+     * have been configured through Dialogflow web console. The headers defined
+     * within this field will overwrite the headers configured through Dialogflow
+     * console if there is a conflict. Header names are case-insensitive.
+     * Google's specified headers are not allowed. Including: "Host",
+     * "Content-Length", "Connection", "From", "User-Agent", "Accept-Encoding",
+     * "If-Modified-Since", "If-None-Match", "X-Forwarded-For", etc.
+     * 
+ * + * map<string, string> webhook_headers = 10; + */ + @java.lang.Override + public java.lang.String getWebhookHeadersOrThrow(java.lang.String key) { + if (key == null) { + throw new java.lang.NullPointerException(); + } + java.util.Map map = internalGetWebhookHeaders().getMap(); + if (!map.containsKey(key)) { + throw new java.lang.IllegalArgumentException(); + } + return map.get(key); + } + + public Builder clearWebhookHeaders() { + internalGetMutableWebhookHeaders().getMutableMap().clear(); + return this; + } + /** + * + * + *
+     * This field can be used to pass HTTP headers for a webhook
+     * call. These headers will be sent to webhook along with the headers that
+     * have been configured through Dialogflow web console. The headers defined
+     * within this field will overwrite the headers configured through Dialogflow
+     * console if there is a conflict. Header names are case-insensitive.
+     * Google's specified headers are not allowed. Including: "Host",
+     * "Content-Length", "Connection", "From", "User-Agent", "Accept-Encoding",
+     * "If-Modified-Since", "If-None-Match", "X-Forwarded-For", etc.
+     * 
+ * + * map<string, string> webhook_headers = 10; + */ + public Builder removeWebhookHeaders(java.lang.String key) { + if (key == null) { + throw new java.lang.NullPointerException(); + } + internalGetMutableWebhookHeaders().getMutableMap().remove(key); + return this; + } + /** Use alternate mutation accessors instead. */ + @java.lang.Deprecated + public java.util.Map getMutableWebhookHeaders() { + return internalGetMutableWebhookHeaders().getMutableMap(); + } + /** + * + * + *
+     * This field can be used to pass HTTP headers for a webhook
+     * call. These headers will be sent to webhook along with the headers that
+     * have been configured through Dialogflow web console. The headers defined
+     * within this field will overwrite the headers configured through Dialogflow
+     * console if there is a conflict. Header names are case-insensitive.
+     * Google's specified headers are not allowed. Including: "Host",
+     * "Content-Length", "Connection", "From", "User-Agent", "Accept-Encoding",
+     * "If-Modified-Since", "If-None-Match", "X-Forwarded-For", etc.
+     * 
+ * + * map<string, string> webhook_headers = 10; + */ + public Builder putWebhookHeaders(java.lang.String key, java.lang.String value) { + if (key == null) { + throw new java.lang.NullPointerException(); + } + if (value == null) { + throw new java.lang.NullPointerException(); + } + internalGetMutableWebhookHeaders().getMutableMap().put(key, value); + return this; + } + /** + * + * + *
+     * This field can be used to pass HTTP headers for a webhook
+     * call. These headers will be sent to webhook along with the headers that
+     * have been configured through Dialogflow web console. The headers defined
+     * within this field will overwrite the headers configured through Dialogflow
+     * console if there is a conflict. Header names are case-insensitive.
+     * Google's specified headers are not allowed. Including: "Host",
+     * "Content-Length", "Connection", "From", "User-Agent", "Accept-Encoding",
+     * "If-Modified-Since", "If-None-Match", "X-Forwarded-For", etc.
+     * 
+ * + * map<string, string> webhook_headers = 10; + */ + public Builder putAllWebhookHeaders(java.util.Map values) { + internalGetMutableWebhookHeaders().getMutableMap().putAll(values); + return this; + } + @java.lang.Override public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { return super.setUnknownFields(unknownFields); diff --git a/proto-google-cloud-dialogflow-cx-v3beta1/src/main/java/com/google/cloud/dialogflow/cx/v3beta1/QueryParametersOrBuilder.java b/proto-google-cloud-dialogflow-cx-v3beta1/src/main/java/com/google/cloud/dialogflow/cx/v3beta1/QueryParametersOrBuilder.java index bf4c5c493..25f0f3901 100644 --- a/proto-google-cloud-dialogflow-cx-v3beta1/src/main/java/com/google/cloud/dialogflow/cx/v3beta1/QueryParametersOrBuilder.java +++ b/proto-google-cloud-dialogflow-cx-v3beta1/src/main/java/com/google/cloud/dialogflow/cx/v3beta1/QueryParametersOrBuilder.java @@ -289,4 +289,93 @@ com.google.cloud.dialogflow.cx.v3beta1.SessionEntityTypeOrBuilder getSessionEnti * @return The analyzeQueryTextSentiment. */ boolean getAnalyzeQueryTextSentiment(); + + /** + * + * + *
+   * This field can be used to pass HTTP headers for a webhook
+   * call. These headers will be sent to webhook along with the headers that
+   * have been configured through Dialogflow web console. The headers defined
+   * within this field will overwrite the headers configured through Dialogflow
+   * console if there is a conflict. Header names are case-insensitive.
+   * Google's specified headers are not allowed. Including: "Host",
+   * "Content-Length", "Connection", "From", "User-Agent", "Accept-Encoding",
+   * "If-Modified-Since", "If-None-Match", "X-Forwarded-For", etc.
+   * 
+ * + * map<string, string> webhook_headers = 10; + */ + int getWebhookHeadersCount(); + /** + * + * + *
+   * This field can be used to pass HTTP headers for a webhook
+   * call. These headers will be sent to webhook along with the headers that
+   * have been configured through Dialogflow web console. The headers defined
+   * within this field will overwrite the headers configured through Dialogflow
+   * console if there is a conflict. Header names are case-insensitive.
+   * Google's specified headers are not allowed. Including: "Host",
+   * "Content-Length", "Connection", "From", "User-Agent", "Accept-Encoding",
+   * "If-Modified-Since", "If-None-Match", "X-Forwarded-For", etc.
+   * 
+ * + * map<string, string> webhook_headers = 10; + */ + boolean containsWebhookHeaders(java.lang.String key); + /** Use {@link #getWebhookHeadersMap()} instead. */ + @java.lang.Deprecated + java.util.Map getWebhookHeaders(); + /** + * + * + *
+   * This field can be used to pass HTTP headers for a webhook
+   * call. These headers will be sent to webhook along with the headers that
+   * have been configured through Dialogflow web console. The headers defined
+   * within this field will overwrite the headers configured through Dialogflow
+   * console if there is a conflict. Header names are case-insensitive.
+   * Google's specified headers are not allowed. Including: "Host",
+   * "Content-Length", "Connection", "From", "User-Agent", "Accept-Encoding",
+   * "If-Modified-Since", "If-None-Match", "X-Forwarded-For", etc.
+   * 
+ * + * map<string, string> webhook_headers = 10; + */ + java.util.Map getWebhookHeadersMap(); + /** + * + * + *
+   * This field can be used to pass HTTP headers for a webhook
+   * call. These headers will be sent to webhook along with the headers that
+   * have been configured through Dialogflow web console. The headers defined
+   * within this field will overwrite the headers configured through Dialogflow
+   * console if there is a conflict. Header names are case-insensitive.
+   * Google's specified headers are not allowed. Including: "Host",
+   * "Content-Length", "Connection", "From", "User-Agent", "Accept-Encoding",
+   * "If-Modified-Since", "If-None-Match", "X-Forwarded-For", etc.
+   * 
+ * + * map<string, string> webhook_headers = 10; + */ + java.lang.String getWebhookHeadersOrDefault(java.lang.String key, java.lang.String defaultValue); + /** + * + * + *
+   * This field can be used to pass HTTP headers for a webhook
+   * call. These headers will be sent to webhook along with the headers that
+   * have been configured through Dialogflow web console. The headers defined
+   * within this field will overwrite the headers configured through Dialogflow
+   * console if there is a conflict. Header names are case-insensitive.
+   * Google's specified headers are not allowed. Including: "Host",
+   * "Content-Length", "Connection", "From", "User-Agent", "Accept-Encoding",
+   * "If-Modified-Since", "If-None-Match", "X-Forwarded-For", etc.
+   * 
+ * + * map<string, string> webhook_headers = 10; + */ + java.lang.String getWebhookHeadersOrThrow(java.lang.String key); } diff --git a/proto-google-cloud-dialogflow-cx-v3beta1/src/main/java/com/google/cloud/dialogflow/cx/v3beta1/ResponseMessage.java b/proto-google-cloud-dialogflow-cx-v3beta1/src/main/java/com/google/cloud/dialogflow/cx/v3beta1/ResponseMessage.java index c48702eea..c37b6cd79 100644 --- a/proto-google-cloud-dialogflow-cx-v3beta1/src/main/java/com/google/cloud/dialogflow/cx/v3beta1/ResponseMessage.java +++ b/proto-google-cloud-dialogflow-cx-v3beta1/src/main/java/com/google/cloud/dialogflow/cx/v3beta1/ResponseMessage.java @@ -3926,111 +3926,81 @@ public com.google.protobuf.Parser getParserForType() { } } - public interface MixedAudioOrBuilder + public interface PlayAudioOrBuilder extends - // @@protoc_insertion_point(interface_extends:google.cloud.dialogflow.cx.v3beta1.ResponseMessage.MixedAudio) + // @@protoc_insertion_point(interface_extends:google.cloud.dialogflow.cx.v3beta1.ResponseMessage.PlayAudio) com.google.protobuf.MessageOrBuilder { /** * * *
-     * Segments this audio response is composed of.
+     * Required. URI of the audio clip. Dialogflow does not impose any validation on this
+     * value. It is specific to the client that reads it.
      * 
* - * - * repeated .google.cloud.dialogflow.cx.v3beta1.ResponseMessage.MixedAudio.Segment segments = 1; - * - */ - java.util.List - getSegmentsList(); - /** - * - * - *
-     * Segments this audio response is composed of.
-     * 
+ * string audio_uri = 1 [(.google.api.field_behavior) = REQUIRED]; * - * - * repeated .google.cloud.dialogflow.cx.v3beta1.ResponseMessage.MixedAudio.Segment segments = 1; - * + * @return The audioUri. */ - com.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.MixedAudio.Segment getSegments( - int index); + java.lang.String getAudioUri(); /** * * *
-     * Segments this audio response is composed of.
+     * Required. URI of the audio clip. Dialogflow does not impose any validation on this
+     * value. It is specific to the client that reads it.
      * 
* - * - * repeated .google.cloud.dialogflow.cx.v3beta1.ResponseMessage.MixedAudio.Segment segments = 1; - * - */ - int getSegmentsCount(); - /** - * - * - *
-     * Segments this audio response is composed of.
-     * 
+ * string audio_uri = 1 [(.google.api.field_behavior) = REQUIRED]; * - * - * repeated .google.cloud.dialogflow.cx.v3beta1.ResponseMessage.MixedAudio.Segment segments = 1; - * + * @return The bytes for audioUri. */ - java.util.List< - ? extends - com.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.MixedAudio.SegmentOrBuilder> - getSegmentsOrBuilderList(); + com.google.protobuf.ByteString getAudioUriBytes(); + /** * * *
-     * Segments this audio response is composed of.
+     * Output only. Whether the playback of this message can be interrupted by the end
+     * user's speech and the client can then starts the next Dialogflow
+     * request.
      * 
* - * - * repeated .google.cloud.dialogflow.cx.v3beta1.ResponseMessage.MixedAudio.Segment segments = 1; + * bool allow_playback_interruption = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; * + * + * @return The allowPlaybackInterruption. */ - com.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.MixedAudio.SegmentOrBuilder - getSegmentsOrBuilder(int index); + boolean getAllowPlaybackInterruption(); } /** * * *
-   * Represents an audio message that is composed of both segments
-   * synthesized from the Dialogflow agent prompts and ones hosted externally
-   * at the specified URIs.
-   * The external URIs are specified via
-   * [play_audio][google.cloud.dialogflow.cx.v3beta1.ResponseMessage.play_audio].
-   * This message is generated by Dialogflow only and not supposed to be
-   * defined by the user.
+   * Specifies an audio clip to be played by the client as part of the response.
    * 
* - * Protobuf type {@code google.cloud.dialogflow.cx.v3beta1.ResponseMessage.MixedAudio} + * Protobuf type {@code google.cloud.dialogflow.cx.v3beta1.ResponseMessage.PlayAudio} */ - public static final class MixedAudio extends com.google.protobuf.GeneratedMessageV3 + public static final class PlayAudio extends com.google.protobuf.GeneratedMessageV3 implements - // @@protoc_insertion_point(message_implements:google.cloud.dialogflow.cx.v3beta1.ResponseMessage.MixedAudio) - MixedAudioOrBuilder { + // @@protoc_insertion_point(message_implements:google.cloud.dialogflow.cx.v3beta1.ResponseMessage.PlayAudio) + PlayAudioOrBuilder { private static final long serialVersionUID = 0L; - // Use MixedAudio.newBuilder() to construct. - private MixedAudio(com.google.protobuf.GeneratedMessageV3.Builder builder) { + // Use PlayAudio.newBuilder() to construct. + private PlayAudio(com.google.protobuf.GeneratedMessageV3.Builder builder) { super(builder); } - private MixedAudio() { - segments_ = java.util.Collections.emptyList(); + private PlayAudio() { + audioUri_ = ""; } @java.lang.Override @SuppressWarnings({"unused"}) protected java.lang.Object newInstance(UnusedPrivateParameter unused) { - return new MixedAudio(); + return new PlayAudio(); } @java.lang.Override @@ -4038,7 +4008,7 @@ public final com.google.protobuf.UnknownFieldSet getUnknownFields() { return this.unknownFields; } - private MixedAudio( + private PlayAudio( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { @@ -4046,7 +4016,6 @@ private MixedAudio( if (extensionRegistry == null) { throw new java.lang.NullPointerException(); } - int mutable_bitField0_ = 0; com.google.protobuf.UnknownFieldSet.Builder unknownFields = com.google.protobuf.UnknownFieldSet.newBuilder(); try { @@ -4059,18 +4028,14 @@ private MixedAudio( break; case 10: { - if (!((mutable_bitField0_ & 0x00000001) != 0)) { - segments_ = - new java.util.ArrayList< - com.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.MixedAudio - .Segment>(); - mutable_bitField0_ |= 0x00000001; - } - segments_.add( - input.readMessage( - com.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.MixedAudio.Segment - .parser(), - extensionRegistry)); + java.lang.String s = input.readStringRequireUtf8(); + + audioUri_ = s; + break; + } + case 16: + { + allowPlaybackInterruption_ = input.readBool(); break; } default: @@ -4087,9 +4052,6 @@ private MixedAudio( } catch (java.io.IOException e) { throw new com.google.protobuf.InvalidProtocolBufferException(e).setUnfinishedMessage(this); } finally { - if (((mutable_bitField0_ & 0x00000001) != 0)) { - segments_ = java.util.Collections.unmodifiableList(segments_); - } this.unknownFields = unknownFields.build(); makeExtensionsImmutable(); } @@ -4097,1279 +4059,876 @@ private MixedAudio( public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { return com.google.cloud.dialogflow.cx.v3beta1.ResponseMessageProto - .internal_static_google_cloud_dialogflow_cx_v3beta1_ResponseMessage_MixedAudio_descriptor; + .internal_static_google_cloud_dialogflow_cx_v3beta1_ResponseMessage_PlayAudio_descriptor; } @java.lang.Override protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internalGetFieldAccessorTable() { return com.google.cloud.dialogflow.cx.v3beta1.ResponseMessageProto - .internal_static_google_cloud_dialogflow_cx_v3beta1_ResponseMessage_MixedAudio_fieldAccessorTable + .internal_static_google_cloud_dialogflow_cx_v3beta1_ResponseMessage_PlayAudio_fieldAccessorTable .ensureFieldAccessorsInitialized( - com.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.MixedAudio.class, - com.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.MixedAudio.Builder.class); + com.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.PlayAudio.class, + com.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.PlayAudio.Builder.class); } - public interface SegmentOrBuilder - extends - // @@protoc_insertion_point(interface_extends:google.cloud.dialogflow.cx.v3beta1.ResponseMessage.MixedAudio.Segment) - com.google.protobuf.MessageOrBuilder { - - /** - * - * - *
-       * Raw audio synthesized from the Dialogflow agent's response using
-       * the output config specified in the request.
-       * 
- * - * bytes audio = 1; - * - * @return The audio. - */ - com.google.protobuf.ByteString getAudio(); - - /** - * - * - *
-       * Client-specific URI that points to an audio clip accessible to the
-       * client. Dialogflow does not impose any validation on it.
-       * 
- * - * string uri = 2; - * - * @return The uri. - */ - java.lang.String getUri(); - /** - * - * - *
-       * Client-specific URI that points to an audio clip accessible to the
-       * client. Dialogflow does not impose any validation on it.
-       * 
- * - * string uri = 2; - * - * @return The bytes for uri. - */ - com.google.protobuf.ByteString getUriBytes(); - - /** - * - * - *
-       * Output only. Whether the playback of this segment can be interrupted by the end
-       * user's speech and the client should then start the next Dialogflow
-       * request.
-       * 
- * - * bool allow_playback_interruption = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; - * - * - * @return The allowPlaybackInterruption. - */ - boolean getAllowPlaybackInterruption(); - - public com.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.MixedAudio.Segment.ContentCase - getContentCase(); - } + public static final int AUDIO_URI_FIELD_NUMBER = 1; + private volatile java.lang.Object audioUri_; /** * * *
-     * Represents one segment of audio.
+     * Required. URI of the audio clip. Dialogflow does not impose any validation on this
+     * value. It is specific to the client that reads it.
      * 
* - * Protobuf type {@code google.cloud.dialogflow.cx.v3beta1.ResponseMessage.MixedAudio.Segment} + * string audio_uri = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The audioUri. */ - public static final class Segment extends com.google.protobuf.GeneratedMessageV3 - implements - // @@protoc_insertion_point(message_implements:google.cloud.dialogflow.cx.v3beta1.ResponseMessage.MixedAudio.Segment) - SegmentOrBuilder { - private static final long serialVersionUID = 0L; - // Use Segment.newBuilder() to construct. - private Segment(com.google.protobuf.GeneratedMessageV3.Builder builder) { - super(builder); - } - - private Segment() {} - - @java.lang.Override - @SuppressWarnings({"unused"}) - protected java.lang.Object newInstance(UnusedPrivateParameter unused) { - return new Segment(); + @java.lang.Override + public java.lang.String getAudioUri() { + java.lang.Object ref = audioUri_; + 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(); + audioUri_ = s; + return s; } - - @java.lang.Override - public final com.google.protobuf.UnknownFieldSet getUnknownFields() { - return this.unknownFields; + } + /** + * + * + *
+     * Required. URI of the audio clip. Dialogflow does not impose any validation on this
+     * value. It is specific to the client that reads it.
+     * 
+ * + * string audio_uri = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The bytes for audioUri. + */ + @java.lang.Override + public com.google.protobuf.ByteString getAudioUriBytes() { + java.lang.Object ref = audioUri_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + audioUri_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; } + } - private Segment( - 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: - { - contentCase_ = 1; - content_ = input.readBytes(); - break; - } - case 18: - { - java.lang.String s = input.readStringRequireUtf8(); - contentCase_ = 2; - content_ = s; - break; - } - case 24: - { - allowPlaybackInterruption_ = input.readBool(); - break; - } - default: - { - if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { - done = true; - } - break; - } - } - } - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - throw e.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 int ALLOW_PLAYBACK_INTERRUPTION_FIELD_NUMBER = 2; + private boolean allowPlaybackInterruption_; + /** + * + * + *
+     * Output only. Whether the playback of this message can be interrupted by the end
+     * user's speech and the client can then starts the next Dialogflow
+     * request.
+     * 
+ * + * bool allow_playback_interruption = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return The allowPlaybackInterruption. + */ + @java.lang.Override + public boolean getAllowPlaybackInterruption() { + return allowPlaybackInterruption_; + } + + 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 (!getAudioUriBytes().isEmpty()) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 1, audioUri_); + } + if (allowPlaybackInterruption_ != false) { + output.writeBool(2, allowPlaybackInterruption_); } + unknownFields.writeTo(output); + } - public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { - return com.google.cloud.dialogflow.cx.v3beta1.ResponseMessageProto - .internal_static_google_cloud_dialogflow_cx_v3beta1_ResponseMessage_MixedAudio_Segment_descriptor; + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (!getAudioUriBytes().isEmpty()) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, audioUri_); + } + if (allowPlaybackInterruption_ != false) { + size += + com.google.protobuf.CodedOutputStream.computeBoolSize(2, allowPlaybackInterruption_); } + size += unknownFields.getSerializedSize(); + memoizedSize = size; + return size; + } - @java.lang.Override - protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable - internalGetFieldAccessorTable() { - return com.google.cloud.dialogflow.cx.v3beta1.ResponseMessageProto - .internal_static_google_cloud_dialogflow_cx_v3beta1_ResponseMessage_MixedAudio_Segment_fieldAccessorTable - .ensureFieldAccessorsInitialized( - com.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.MixedAudio.Segment.class, - com.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.MixedAudio.Segment.Builder - .class); + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; } + if (!(obj instanceof com.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.PlayAudio)) { + return super.equals(obj); + } + com.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.PlayAudio other = + (com.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.PlayAudio) obj; - private int contentCase_ = 0; - private java.lang.Object content_; + if (!getAudioUri().equals(other.getAudioUri())) return false; + if (getAllowPlaybackInterruption() != other.getAllowPlaybackInterruption()) return false; + if (!unknownFields.equals(other.unknownFields)) return false; + return true; + } - public enum ContentCase - implements - com.google.protobuf.Internal.EnumLite, - com.google.protobuf.AbstractMessage.InternalOneOfEnum { - AUDIO(1), - URI(2), - CONTENT_NOT_SET(0); - private final int value; + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (37 * hash) + AUDIO_URI_FIELD_NUMBER; + hash = (53 * hash) + getAudioUri().hashCode(); + hash = (37 * hash) + ALLOW_PLAYBACK_INTERRUPTION_FIELD_NUMBER; + hash = (53 * hash) + com.google.protobuf.Internal.hashBoolean(getAllowPlaybackInterruption()); + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } - private ContentCase(int value) { - this.value = value; - } - /** - * @param value The number of the enum to look for. - * @return The enum associated with the given number. - * @deprecated Use {@link #forNumber(int)} instead. - */ - @java.lang.Deprecated - public static ContentCase valueOf(int value) { - return forNumber(value); - } + public static com.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.PlayAudio parseFrom( + java.nio.ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } - public static ContentCase forNumber(int value) { - switch (value) { - case 1: - return AUDIO; - case 2: - return URI; - case 0: - return CONTENT_NOT_SET; - default: - return null; - } - } + public static com.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.PlayAudio parseFrom( + java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } - public int getNumber() { - return this.value; - } - }; + public static com.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.PlayAudio parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } - public ContentCase getContentCase() { - return ContentCase.forNumber(contentCase_); - } + public static com.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.PlayAudio parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } - public static final int AUDIO_FIELD_NUMBER = 1; - /** - * - * - *
-       * Raw audio synthesized from the Dialogflow agent's response using
-       * the output config specified in the request.
-       * 
- * - * bytes audio = 1; - * - * @return The audio. - */ - @java.lang.Override - public com.google.protobuf.ByteString getAudio() { - if (contentCase_ == 1) { - return (com.google.protobuf.ByteString) content_; - } - return com.google.protobuf.ByteString.EMPTY; - } + public static com.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.PlayAudio parseFrom( + byte[] data) throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } - public static final int URI_FIELD_NUMBER = 2; - /** - * - * - *
-       * Client-specific URI that points to an audio clip accessible to the
-       * client. Dialogflow does not impose any validation on it.
-       * 
- * - * string uri = 2; - * - * @return The uri. - */ - public java.lang.String getUri() { - java.lang.Object ref = ""; - if (contentCase_ == 2) { - ref = content_; - } - 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(); - if (contentCase_ == 2) { - content_ = s; - } - return s; - } - } - /** - * - * - *
-       * Client-specific URI that points to an audio clip accessible to the
-       * client. Dialogflow does not impose any validation on it.
-       * 
- * - * string uri = 2; - * - * @return The bytes for uri. - */ - public com.google.protobuf.ByteString getUriBytes() { - java.lang.Object ref = ""; - if (contentCase_ == 2) { - ref = content_; - } - if (ref instanceof java.lang.String) { - com.google.protobuf.ByteString b = - com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); - if (contentCase_ == 2) { - content_ = b; - } - return b; - } else { - return (com.google.protobuf.ByteString) ref; - } + public static com.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.PlayAudio parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.PlayAudio parseFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.PlayAudio 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.cx.v3beta1.ResponseMessage.PlayAudio + parseDelimitedFrom(java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.PlayAudio + 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.cx.v3beta1.ResponseMessage.PlayAudio parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.PlayAudio 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.cx.v3beta1.ResponseMessage.PlayAudio 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; + } + /** + * + * + *
+     * Specifies an audio clip to be played by the client as part of the response.
+     * 
+ * + * Protobuf type {@code google.cloud.dialogflow.cx.v3beta1.ResponseMessage.PlayAudio} + */ + public static final class Builder + extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.cloud.dialogflow.cx.v3beta1.ResponseMessage.PlayAudio) + com.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.PlayAudioOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.dialogflow.cx.v3beta1.ResponseMessageProto + .internal_static_google_cloud_dialogflow_cx_v3beta1_ResponseMessage_PlayAudio_descriptor; } - public static final int ALLOW_PLAYBACK_INTERRUPTION_FIELD_NUMBER = 3; - private boolean allowPlaybackInterruption_; - /** - * - * - *
-       * Output only. Whether the playback of this segment can be interrupted by the end
-       * user's speech and the client should then start the next Dialogflow
-       * request.
-       * 
- * - * bool allow_playback_interruption = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; - * - * - * @return The allowPlaybackInterruption. - */ @java.lang.Override - public boolean getAllowPlaybackInterruption() { - return allowPlaybackInterruption_; + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.dialogflow.cx.v3beta1.ResponseMessageProto + .internal_static_google_cloud_dialogflow_cx_v3beta1_ResponseMessage_PlayAudio_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.PlayAudio.class, + com.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.PlayAudio.Builder.class); } - private byte memoizedIsInitialized = -1; + // Construct using + // com.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.PlayAudio.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 final boolean isInitialized() { - byte isInitialized = memoizedIsInitialized; - if (isInitialized == 1) return true; - if (isInitialized == 0) return false; + public Builder clear() { + super.clear(); + audioUri_ = ""; - memoizedIsInitialized = 1; - return true; + allowPlaybackInterruption_ = false; + + return this; } @java.lang.Override - public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { - if (contentCase_ == 1) { - output.writeBytes(1, (com.google.protobuf.ByteString) content_); - } - if (contentCase_ == 2) { - com.google.protobuf.GeneratedMessageV3.writeString(output, 2, content_); - } - if (allowPlaybackInterruption_ != false) { - output.writeBool(3, allowPlaybackInterruption_); - } - unknownFields.writeTo(output); + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.cloud.dialogflow.cx.v3beta1.ResponseMessageProto + .internal_static_google_cloud_dialogflow_cx_v3beta1_ResponseMessage_PlayAudio_descriptor; } @java.lang.Override - public int getSerializedSize() { - int size = memoizedSize; - if (size != -1) return size; + public com.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.PlayAudio + getDefaultInstanceForType() { + return com.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.PlayAudio + .getDefaultInstance(); + } - size = 0; - if (contentCase_ == 1) { - size += - com.google.protobuf.CodedOutputStream.computeBytesSize( - 1, (com.google.protobuf.ByteString) content_); - } - if (contentCase_ == 2) { - size += com.google.protobuf.GeneratedMessageV3.computeStringSize(2, content_); - } - if (allowPlaybackInterruption_ != false) { - size += - com.google.protobuf.CodedOutputStream.computeBoolSize(3, allowPlaybackInterruption_); + @java.lang.Override + public com.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.PlayAudio build() { + com.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.PlayAudio result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); } - size += unknownFields.getSerializedSize(); - memoizedSize = size; - return size; + return result; } @java.lang.Override - public boolean equals(final java.lang.Object obj) { - if (obj == this) { - return true; - } - if (!(obj - instanceof com.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.MixedAudio.Segment)) { - return super.equals(obj); - } - com.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.MixedAudio.Segment other = - (com.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.MixedAudio.Segment) obj; + public com.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.PlayAudio buildPartial() { + com.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.PlayAudio result = + new com.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.PlayAudio(this); + result.audioUri_ = audioUri_; + result.allowPlaybackInterruption_ = allowPlaybackInterruption_; + onBuilt(); + return result; + } - if (getAllowPlaybackInterruption() != other.getAllowPlaybackInterruption()) return false; - if (!getContentCase().equals(other.getContentCase())) return false; - switch (contentCase_) { - case 1: - if (!getAudio().equals(other.getAudio())) return false; - break; - case 2: - if (!getUri().equals(other.getUri())) return false; - break; - case 0: - default: - } - if (!unknownFields.equals(other.unknownFields)) return false; - return true; + @java.lang.Override + public Builder clone() { + return super.clone(); } @java.lang.Override - public int hashCode() { - if (memoizedHashCode != 0) { - return memoizedHashCode; - } - int hash = 41; - hash = (19 * hash) + getDescriptor().hashCode(); - hash = (37 * hash) + ALLOW_PLAYBACK_INTERRUPTION_FIELD_NUMBER; - hash = - (53 * hash) + com.google.protobuf.Internal.hashBoolean(getAllowPlaybackInterruption()); - switch (contentCase_) { - case 1: - hash = (37 * hash) + AUDIO_FIELD_NUMBER; - hash = (53 * hash) + getAudio().hashCode(); - break; - case 2: - hash = (37 * hash) + URI_FIELD_NUMBER; - hash = (53 * hash) + getUri().hashCode(); - break; - case 0: - default: - } - hash = (29 * hash) + unknownFields.hashCode(); - memoizedHashCode = hash; - return hash; - } - - public static com.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.MixedAudio.Segment - parseFrom(java.nio.ByteBuffer data) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - - public static com.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.MixedAudio.Segment - 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.cx.v3beta1.ResponseMessage.MixedAudio.Segment - parseFrom(com.google.protobuf.ByteString data) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - - public static com.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.MixedAudio.Segment - 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.cx.v3beta1.ResponseMessage.MixedAudio.Segment - parseFrom(byte[] data) throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.setField(field, value); } - public static com.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.MixedAudio.Segment - parseFrom(byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data, extensionRegistry); + @java.lang.Override + public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { + return super.clearField(field); } - public static com.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.MixedAudio.Segment - parseFrom(java.io.InputStream input) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + @java.lang.Override + public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return super.clearOneof(oneof); } - public static com.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.MixedAudio.Segment - parseFrom( - java.io.InputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseWithIOException( - PARSER, input, extensionRegistry); + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, + int index, + java.lang.Object value) { + return super.setRepeatedField(field, index, value); } - public static com.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.MixedAudio.Segment - parseDelimitedFrom(java.io.InputStream input) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.addRepeatedField(field, value); } - public static com.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.MixedAudio.Segment - parseDelimitedFrom( - java.io.InputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( - PARSER, input, extensionRegistry); + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.PlayAudio) { + return mergeFrom( + (com.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.PlayAudio) other); + } else { + super.mergeFrom(other); + return this; + } } - public static com.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.MixedAudio.Segment - parseFrom(com.google.protobuf.CodedInputStream input) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + public Builder mergeFrom( + com.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.PlayAudio other) { + if (other + == com.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.PlayAudio + .getDefaultInstance()) return this; + if (!other.getAudioUri().isEmpty()) { + audioUri_ = other.audioUri_; + onChanged(); + } + if (other.getAllowPlaybackInterruption() != false) { + setAllowPlaybackInterruption(other.getAllowPlaybackInterruption()); + } + this.mergeUnknownFields(other.unknownFields); + onChanged(); + return this; } - public static com.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.MixedAudio.Segment - 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 final boolean isInitialized() { + return true; } @java.lang.Override - public Builder newBuilderForType() { - return newBuilder(); + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.PlayAudio parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = + (com.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.PlayAudio) + e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; } - public static Builder newBuilder() { - return DEFAULT_INSTANCE.toBuilder(); + private java.lang.Object audioUri_ = ""; + /** + * + * + *
+       * Required. URI of the audio clip. Dialogflow does not impose any validation on this
+       * value. It is specific to the client that reads it.
+       * 
+ * + * string audio_uri = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The audioUri. + */ + public java.lang.String getAudioUri() { + java.lang.Object ref = audioUri_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + audioUri_ = s; + return s; + } else { + return (java.lang.String) ref; + } } - - public static Builder newBuilder( - com.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.MixedAudio.Segment prototype) { - return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + /** + * + * + *
+       * Required. URI of the audio clip. Dialogflow does not impose any validation on this
+       * value. It is specific to the client that reads it.
+       * 
+ * + * string audio_uri = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The bytes for audioUri. + */ + public com.google.protobuf.ByteString getAudioUriBytes() { + java.lang.Object ref = audioUri_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + audioUri_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } } + /** + * + * + *
+       * Required. URI of the audio clip. Dialogflow does not impose any validation on this
+       * value. It is specific to the client that reads it.
+       * 
+ * + * string audio_uri = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * @param value The audioUri to set. + * @return This builder for chaining. + */ + public Builder setAudioUri(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } - @java.lang.Override - public Builder toBuilder() { - return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + audioUri_ = value; + onChanged(); + return this; } + /** + * + * + *
+       * Required. URI of the audio clip. Dialogflow does not impose any validation on this
+       * value. It is specific to the client that reads it.
+       * 
+ * + * string audio_uri = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * @return This builder for chaining. + */ + public Builder clearAudioUri() { - @java.lang.Override - protected Builder newBuilderForType( - com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { - Builder builder = new Builder(parent); - return builder; + audioUri_ = getDefaultInstance().getAudioUri(); + onChanged(); + return this; } /** * * *
-       * Represents one segment of audio.
+       * Required. URI of the audio clip. Dialogflow does not impose any validation on this
+       * value. It is specific to the client that reads it.
        * 
* - * Protobuf type {@code google.cloud.dialogflow.cx.v3beta1.ResponseMessage.MixedAudio.Segment} + * string audio_uri = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * @param value The bytes for audioUri to set. + * @return This builder for chaining. */ - public static final class Builder - extends com.google.protobuf.GeneratedMessageV3.Builder - implements - // @@protoc_insertion_point(builder_implements:google.cloud.dialogflow.cx.v3beta1.ResponseMessage.MixedAudio.Segment) - com.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.MixedAudio.SegmentOrBuilder { - public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { - return com.google.cloud.dialogflow.cx.v3beta1.ResponseMessageProto - .internal_static_google_cloud_dialogflow_cx_v3beta1_ResponseMessage_MixedAudio_Segment_descriptor; + public Builder setAudioUriBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); } + checkByteStringIsUtf8(value); - @java.lang.Override - protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable - internalGetFieldAccessorTable() { - return com.google.cloud.dialogflow.cx.v3beta1.ResponseMessageProto - .internal_static_google_cloud_dialogflow_cx_v3beta1_ResponseMessage_MixedAudio_Segment_fieldAccessorTable - .ensureFieldAccessorsInitialized( - com.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.MixedAudio.Segment.class, - com.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.MixedAudio.Segment.Builder - .class); - } + audioUri_ = value; + onChanged(); + return this; + } - // Construct using - // com.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.MixedAudio.Segment.newBuilder() - private Builder() { - maybeForceBuilderInitialization(); - } + private boolean allowPlaybackInterruption_; + /** + * + * + *
+       * Output only. Whether the playback of this message can be interrupted by the end
+       * user's speech and the client can then starts the next Dialogflow
+       * request.
+       * 
+ * + * bool allow_playback_interruption = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return The allowPlaybackInterruption. + */ + @java.lang.Override + public boolean getAllowPlaybackInterruption() { + return allowPlaybackInterruption_; + } + /** + * + * + *
+       * Output only. Whether the playback of this message can be interrupted by the end
+       * user's speech and the client can then starts the next Dialogflow
+       * request.
+       * 
+ * + * bool allow_playback_interruption = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @param value The allowPlaybackInterruption to set. + * @return This builder for chaining. + */ + public Builder setAllowPlaybackInterruption(boolean value) { - private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { - super(parent); - maybeForceBuilderInitialization(); - } + allowPlaybackInterruption_ = value; + onChanged(); + return this; + } + /** + * + * + *
+       * Output only. Whether the playback of this message can be interrupted by the end
+       * user's speech and the client can then starts the next Dialogflow
+       * request.
+       * 
+ * + * bool allow_playback_interruption = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return This builder for chaining. + */ + public Builder clearAllowPlaybackInterruption() { - private void maybeForceBuilderInitialization() { - if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) {} - } + allowPlaybackInterruption_ = false; + onChanged(); + return this; + } - @java.lang.Override - public Builder clear() { - super.clear(); - allowPlaybackInterruption_ = false; + @java.lang.Override + public final Builder setUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } - contentCase_ = 0; - content_ = null; - return this; - } + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } - @java.lang.Override - public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { - return com.google.cloud.dialogflow.cx.v3beta1.ResponseMessageProto - .internal_static_google_cloud_dialogflow_cx_v3beta1_ResponseMessage_MixedAudio_Segment_descriptor; - } + // @@protoc_insertion_point(builder_scope:google.cloud.dialogflow.cx.v3beta1.ResponseMessage.PlayAudio) + } - @java.lang.Override - public com.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.MixedAudio.Segment - getDefaultInstanceForType() { - return com.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.MixedAudio.Segment - .getDefaultInstance(); - } + // @@protoc_insertion_point(class_scope:google.cloud.dialogflow.cx.v3beta1.ResponseMessage.PlayAudio) + private static final com.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.PlayAudio + DEFAULT_INSTANCE; - @java.lang.Override - public com.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.MixedAudio.Segment build() { - com.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.MixedAudio.Segment result = - buildPartial(); - if (!result.isInitialized()) { - throw newUninitializedMessageException(result); - } - return result; - } + static { + DEFAULT_INSTANCE = new com.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.PlayAudio(); + } - @java.lang.Override - public com.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.MixedAudio.Segment - buildPartial() { - com.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.MixedAudio.Segment result = - new com.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.MixedAudio.Segment(this); - if (contentCase_ == 1) { - result.content_ = content_; - } - if (contentCase_ == 2) { - result.content_ = content_; + public static com.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.PlayAudio + getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public PlayAudio parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new PlayAudio(input, extensionRegistry); } - result.allowPlaybackInterruption_ = allowPlaybackInterruption_; - result.contentCase_ = contentCase_; - onBuilt(); - return result; - } + }; - @java.lang.Override - public Builder clone() { - return super.clone(); - } + public static com.google.protobuf.Parser parser() { + return PARSER; + } - @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 com.google.protobuf.Parser getParserForType() { + return PARSER; + } - @java.lang.Override - public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { - return super.clearField(field); - } + @java.lang.Override + public com.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.PlayAudio + getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } + } - @java.lang.Override - public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { - return super.clearOneof(oneof); - } + public interface EndInteractionOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.cloud.dialogflow.cx.v3beta1.ResponseMessage.EndInteraction) + com.google.protobuf.MessageOrBuilder {} + /** + * + * + *
+   * Indicates that interaction with the Dialogflow agent has ended.
+   * This message is generated by Dialogflow only and not supposed to be
+   * defined by the user.
+   * 
+ * + * Protobuf type {@code google.cloud.dialogflow.cx.v3beta1.ResponseMessage.EndInteraction} + */ + public static final class EndInteraction extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.cloud.dialogflow.cx.v3beta1.ResponseMessage.EndInteraction) + EndInteractionOrBuilder { + private static final long serialVersionUID = 0L; + // Use EndInteraction.newBuilder() to construct. + private EndInteraction(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } - @java.lang.Override - public Builder setRepeatedField( - com.google.protobuf.Descriptors.FieldDescriptor field, - int index, - java.lang.Object value) { - return super.setRepeatedField(field, index, value); - } + private EndInteraction() {} - @java.lang.Override - public Builder addRepeatedField( - com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { - return super.addRepeatedField(field, value); - } + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance(UnusedPrivateParameter unused) { + return new EndInteraction(); + } - @java.lang.Override - public Builder mergeFrom(com.google.protobuf.Message other) { - if (other - instanceof - com.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.MixedAudio.Segment) { - return mergeFrom( - (com.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.MixedAudio.Segment) other); - } else { - super.mergeFrom(other); - return this; - } - } + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet getUnknownFields() { + return this.unknownFields; + } - public Builder mergeFrom( - com.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.MixedAudio.Segment other) { - if (other - == com.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.MixedAudio.Segment - .getDefaultInstance()) return this; - if (other.getAllowPlaybackInterruption() != false) { - setAllowPlaybackInterruption(other.getAllowPlaybackInterruption()); - } - switch (other.getContentCase()) { - case AUDIO: - { - setAudio(other.getAudio()); - break; - } - case URI: - { - contentCase_ = 2; - content_ = other.content_; - onChanged(); - break; - } - case CONTENT_NOT_SET: + private EndInteraction( + 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; + default: { + if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { + done = true; + } break; } } - this.mergeUnknownFields(other.unknownFields); - onChanged(); - return this; } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e).setUnfinishedMessage(this); + } finally { + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } - @java.lang.Override - public final boolean isInitialized() { - return true; - } + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.dialogflow.cx.v3beta1.ResponseMessageProto + .internal_static_google_cloud_dialogflow_cx_v3beta1_ResponseMessage_EndInteraction_descriptor; + } - @java.lang.Override - public Builder mergeFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - com.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.MixedAudio.Segment parsedMessage = - null; - try { - parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - parsedMessage = - (com.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.MixedAudio.Segment) - e.getUnfinishedMessage(); - throw e.unwrapIOException(); - } finally { - if (parsedMessage != null) { - mergeFrom(parsedMessage); - } - } - return this; - } + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.dialogflow.cx.v3beta1.ResponseMessageProto + .internal_static_google_cloud_dialogflow_cx_v3beta1_ResponseMessage_EndInteraction_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.EndInteraction.class, + com.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.EndInteraction.Builder.class); + } - private int contentCase_ = 0; - private java.lang.Object content_; + private byte memoizedIsInitialized = -1; - public ContentCase getContentCase() { - return ContentCase.forNumber(contentCase_); - } + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; - public Builder clearContent() { - contentCase_ = 0; - content_ = null; - onChanged(); - return this; - } + memoizedIsInitialized = 1; + return true; + } - /** - * - * - *
-         * Raw audio synthesized from the Dialogflow agent's response using
-         * the output config specified in the request.
-         * 
- * - * bytes audio = 1; - * - * @return The audio. - */ - public com.google.protobuf.ByteString getAudio() { - if (contentCase_ == 1) { - return (com.google.protobuf.ByteString) content_; - } - return com.google.protobuf.ByteString.EMPTY; - } - /** - * - * - *
-         * Raw audio synthesized from the Dialogflow agent's response using
-         * the output config specified in the request.
-         * 
- * - * bytes audio = 1; - * - * @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(); - } - contentCase_ = 1; - content_ = value; - onChanged(); - return this; - } - /** - * - * - *
-         * Raw audio synthesized from the Dialogflow agent's response using
-         * the output config specified in the request.
-         * 
- * - * bytes audio = 1; - * - * @return This builder for chaining. - */ - public Builder clearAudio() { - if (contentCase_ == 1) { - contentCase_ = 0; - content_ = null; - onChanged(); - } - return this; - } + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { + unknownFields.writeTo(output); + } - /** - * - * - *
-         * Client-specific URI that points to an audio clip accessible to the
-         * client. Dialogflow does not impose any validation on it.
-         * 
- * - * string uri = 2; - * - * @return The uri. - */ - @java.lang.Override - public java.lang.String getUri() { - java.lang.Object ref = ""; - if (contentCase_ == 2) { - ref = content_; - } - if (!(ref instanceof java.lang.String)) { - com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; - java.lang.String s = bs.toStringUtf8(); - if (contentCase_ == 2) { - content_ = s; - } - return s; - } else { - return (java.lang.String) ref; - } - } - /** - * - * - *
-         * Client-specific URI that points to an audio clip accessible to the
-         * client. Dialogflow does not impose any validation on it.
-         * 
- * - * string uri = 2; - * - * @return The bytes for uri. - */ - @java.lang.Override - public com.google.protobuf.ByteString getUriBytes() { - java.lang.Object ref = ""; - if (contentCase_ == 2) { - ref = content_; - } - if (ref instanceof String) { - com.google.protobuf.ByteString b = - com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); - if (contentCase_ == 2) { - content_ = b; - } - return b; - } else { - return (com.google.protobuf.ByteString) ref; - } - } - /** - * - * - *
-         * Client-specific URI that points to an audio clip accessible to the
-         * client. Dialogflow does not impose any validation on it.
-         * 
- * - * string uri = 2; - * - * @param value The uri to set. - * @return This builder for chaining. - */ - public Builder setUri(java.lang.String value) { - if (value == null) { - throw new NullPointerException(); - } - contentCase_ = 2; - content_ = value; - onChanged(); - return this; - } - /** - * - * - *
-         * Client-specific URI that points to an audio clip accessible to the
-         * client. Dialogflow does not impose any validation on it.
-         * 
- * - * string uri = 2; - * - * @return This builder for chaining. - */ - public Builder clearUri() { - if (contentCase_ == 2) { - contentCase_ = 0; - content_ = null; - onChanged(); - } - return this; - } - /** - * - * - *
-         * Client-specific URI that points to an audio clip accessible to the
-         * client. Dialogflow does not impose any validation on it.
-         * 
- * - * string uri = 2; - * - * @param value The bytes for uri to set. - * @return This builder for chaining. - */ - public Builder setUriBytes(com.google.protobuf.ByteString value) { - if (value == null) { - throw new NullPointerException(); - } - checkByteStringIsUtf8(value); - contentCase_ = 2; - content_ = value; - onChanged(); - return this; - } + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; - private boolean allowPlaybackInterruption_; - /** - * - * - *
-         * Output only. Whether the playback of this segment can be interrupted by the end
-         * user's speech and the client should then start the next Dialogflow
-         * request.
-         * 
- * - * bool allow_playback_interruption = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; - * - * - * @return The allowPlaybackInterruption. - */ - @java.lang.Override - public boolean getAllowPlaybackInterruption() { - return allowPlaybackInterruption_; - } - /** - * - * - *
-         * Output only. Whether the playback of this segment can be interrupted by the end
-         * user's speech and the client should then start the next Dialogflow
-         * request.
-         * 
- * - * bool allow_playback_interruption = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; - * - * - * @param value The allowPlaybackInterruption to set. - * @return This builder for chaining. - */ - public Builder setAllowPlaybackInterruption(boolean value) { + size = 0; + size += unknownFields.getSerializedSize(); + memoizedSize = size; + return size; + } - allowPlaybackInterruption_ = value; - onChanged(); - return this; - } - /** - * - * - *
-         * Output only. Whether the playback of this segment can be interrupted by the end
-         * user's speech and the client should then start the next Dialogflow
-         * request.
-         * 
- * - * bool allow_playback_interruption = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; - * - * - * @return This builder for chaining. - */ - public Builder clearAllowPlaybackInterruption() { + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.EndInteraction)) { + return super.equals(obj); + } + com.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.EndInteraction other = + (com.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.EndInteraction) obj; - allowPlaybackInterruption_ = false; - onChanged(); - return this; - } + if (!unknownFields.equals(other.unknownFields)) return false; + return true; + } - @java.lang.Override - public final Builder setUnknownFields( - final com.google.protobuf.UnknownFieldSet unknownFields) { - return super.setUnknownFields(unknownFields); - } + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } - @java.lang.Override - public final Builder mergeUnknownFields( - final com.google.protobuf.UnknownFieldSet unknownFields) { - return super.mergeUnknownFields(unknownFields); - } + public static com.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.EndInteraction parseFrom( + java.nio.ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } - // @@protoc_insertion_point(builder_scope:google.cloud.dialogflow.cx.v3beta1.ResponseMessage.MixedAudio.Segment) - } + public static com.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.EndInteraction parseFrom( + java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } - // @@protoc_insertion_point(class_scope:google.cloud.dialogflow.cx.v3beta1.ResponseMessage.MixedAudio.Segment) - private static final com.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.MixedAudio.Segment - DEFAULT_INSTANCE; + public static com.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.EndInteraction parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } - static { - DEFAULT_INSTANCE = - new com.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.MixedAudio.Segment(); - } + public static com.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.EndInteraction 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.cx.v3beta1.ResponseMessage.MixedAudio.Segment - getDefaultInstance() { - return DEFAULT_INSTANCE; - } + public static com.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.EndInteraction parseFrom( + byte[] data) throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } - private static final com.google.protobuf.Parser PARSER = - new com.google.protobuf.AbstractParser() { - @java.lang.Override - public Segment parsePartialFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return new Segment(input, extensionRegistry); - } - }; + public static com.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.EndInteraction parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } - public static com.google.protobuf.Parser parser() { - return PARSER; - } + public static com.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.EndInteraction parseFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } - @java.lang.Override - public com.google.protobuf.Parser getParserForType() { - return PARSER; - } + public static com.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.EndInteraction parseFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } - @java.lang.Override - public com.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.MixedAudio.Segment - getDefaultInstanceForType() { - return DEFAULT_INSTANCE; - } + public static com.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.EndInteraction + parseDelimitedFrom(java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); } - public static final int SEGMENTS_FIELD_NUMBER = 1; - private java.util.List< - com.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.MixedAudio.Segment> - segments_; - /** - * - * - *
-     * Segments this audio response is composed of.
-     * 
- * - * - * repeated .google.cloud.dialogflow.cx.v3beta1.ResponseMessage.MixedAudio.Segment segments = 1; - * - */ - @java.lang.Override - public java.util.List - getSegmentsList() { - return segments_; - } - /** - * - * - *
-     * Segments this audio response is composed of.
-     * 
- * - * - * repeated .google.cloud.dialogflow.cx.v3beta1.ResponseMessage.MixedAudio.Segment segments = 1; - * - */ - @java.lang.Override - public java.util.List< - ? extends - com.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.MixedAudio.SegmentOrBuilder> - getSegmentsOrBuilderList() { - return segments_; - } - /** - * - * - *
-     * Segments this audio response is composed of.
-     * 
- * - * - * repeated .google.cloud.dialogflow.cx.v3beta1.ResponseMessage.MixedAudio.Segment segments = 1; - * - */ - @java.lang.Override - public int getSegmentsCount() { - return segments_.size(); - } - /** - * - * - *
-     * Segments this audio response is composed of.
-     * 
- * - * - * repeated .google.cloud.dialogflow.cx.v3beta1.ResponseMessage.MixedAudio.Segment segments = 1; - * - */ - @java.lang.Override - public com.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.MixedAudio.Segment getSegments( - int index) { - return segments_.get(index); - } - /** - * - * - *
-     * Segments this audio response is composed of.
-     * 
- * - * - * repeated .google.cloud.dialogflow.cx.v3beta1.ResponseMessage.MixedAudio.Segment segments = 1; - * - */ - @java.lang.Override - public com.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.MixedAudio.SegmentOrBuilder - getSegmentsOrBuilder(int index) { - return segments_.get(index); - } - - 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 { - for (int i = 0; i < segments_.size(); i++) { - output.writeMessage(1, segments_.get(i)); - } - unknownFields.writeTo(output); - } - - @java.lang.Override - public int getSerializedSize() { - int size = memoizedSize; - if (size != -1) return size; - - size = 0; - for (int i = 0; i < segments_.size(); i++) { - size += com.google.protobuf.CodedOutputStream.computeMessageSize(1, segments_.get(i)); - } - 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.cx.v3beta1.ResponseMessage.MixedAudio)) { - return super.equals(obj); - } - com.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.MixedAudio other = - (com.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.MixedAudio) obj; - - if (!getSegmentsList().equals(other.getSegmentsList())) 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 (getSegmentsCount() > 0) { - hash = (37 * hash) + SEGMENTS_FIELD_NUMBER; - hash = (53 * hash) + getSegmentsList().hashCode(); - } - hash = (29 * hash) + unknownFields.hashCode(); - memoizedHashCode = hash; - return hash; - } - - public static com.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.MixedAudio parseFrom( - java.nio.ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); + public static com.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.EndInteraction + 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.cx.v3beta1.ResponseMessage.MixedAudio 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.cx.v3beta1.ResponseMessage.MixedAudio parseFrom( - com.google.protobuf.ByteString data) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - - public static com.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.MixedAudio 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.cx.v3beta1.ResponseMessage.MixedAudio parseFrom( - byte[] data) throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - - public static com.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.MixedAudio parseFrom( - byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data, extensionRegistry); - } - - public static com.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.MixedAudio parseFrom( - java.io.InputStream input) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); - } - - public static com.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.MixedAudio 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.cx.v3beta1.ResponseMessage.MixedAudio - parseDelimitedFrom(java.io.InputStream input) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); - } - - public static com.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.MixedAudio - 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.cx.v3beta1.ResponseMessage.MixedAudio parseFrom( + public static com.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.EndInteraction parseFrom( com.google.protobuf.CodedInputStream input) throws java.io.IOException { return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); } - public static com.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.MixedAudio parseFrom( + public static com.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.EndInteraction parseFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { @@ -5387,7 +4946,7 @@ public static Builder newBuilder() { } public static Builder newBuilder( - com.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.MixedAudio prototype) { + com.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.EndInteraction prototype) { return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); } @@ -5406,39 +4965,36 @@ protected Builder newBuilderForType( * * *
-     * Represents an audio message that is composed of both segments
-     * synthesized from the Dialogflow agent prompts and ones hosted externally
-     * at the specified URIs.
-     * The external URIs are specified via
-     * [play_audio][google.cloud.dialogflow.cx.v3beta1.ResponseMessage.play_audio].
+     * Indicates that interaction with the Dialogflow agent has ended.
      * This message is generated by Dialogflow only and not supposed to be
      * defined by the user.
      * 
* - * Protobuf type {@code google.cloud.dialogflow.cx.v3beta1.ResponseMessage.MixedAudio} + * Protobuf type {@code google.cloud.dialogflow.cx.v3beta1.ResponseMessage.EndInteraction} */ public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder implements - // @@protoc_insertion_point(builder_implements:google.cloud.dialogflow.cx.v3beta1.ResponseMessage.MixedAudio) - com.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.MixedAudioOrBuilder { + // @@protoc_insertion_point(builder_implements:google.cloud.dialogflow.cx.v3beta1.ResponseMessage.EndInteraction) + com.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.EndInteractionOrBuilder { public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { return com.google.cloud.dialogflow.cx.v3beta1.ResponseMessageProto - .internal_static_google_cloud_dialogflow_cx_v3beta1_ResponseMessage_MixedAudio_descriptor; + .internal_static_google_cloud_dialogflow_cx_v3beta1_ResponseMessage_EndInteraction_descriptor; } @java.lang.Override protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internalGetFieldAccessorTable() { return com.google.cloud.dialogflow.cx.v3beta1.ResponseMessageProto - .internal_static_google_cloud_dialogflow_cx_v3beta1_ResponseMessage_MixedAudio_fieldAccessorTable + .internal_static_google_cloud_dialogflow_cx_v3beta1_ResponseMessage_EndInteraction_fieldAccessorTable .ensureFieldAccessorsInitialized( - com.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.MixedAudio.class, - com.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.MixedAudio.Builder.class); + com.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.EndInteraction.class, + com.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.EndInteraction.Builder + .class); } // Construct using - // com.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.MixedAudio.newBuilder() + // com.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.EndInteraction.newBuilder() private Builder() { maybeForceBuilderInitialization(); } @@ -5449,39 +5005,32 @@ private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { } private void maybeForceBuilderInitialization() { - if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) { - getSegmentsFieldBuilder(); - } + if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) {} } @java.lang.Override public Builder clear() { super.clear(); - if (segmentsBuilder_ == null) { - segments_ = java.util.Collections.emptyList(); - bitField0_ = (bitField0_ & ~0x00000001); - } else { - segmentsBuilder_.clear(); - } return this; } @java.lang.Override public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { return com.google.cloud.dialogflow.cx.v3beta1.ResponseMessageProto - .internal_static_google_cloud_dialogflow_cx_v3beta1_ResponseMessage_MixedAudio_descriptor; + .internal_static_google_cloud_dialogflow_cx_v3beta1_ResponseMessage_EndInteraction_descriptor; } @java.lang.Override - public com.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.MixedAudio + public com.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.EndInteraction getDefaultInstanceForType() { - return com.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.MixedAudio + return com.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.EndInteraction .getDefaultInstance(); } @java.lang.Override - public com.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.MixedAudio build() { - com.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.MixedAudio result = buildPartial(); + public com.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.EndInteraction build() { + com.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.EndInteraction result = + buildPartial(); if (!result.isInitialized()) { throw newUninitializedMessageException(result); } @@ -5489,19 +5038,9 @@ public com.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.MixedAudio build() } @java.lang.Override - public com.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.MixedAudio buildPartial() { - com.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.MixedAudio result = - new com.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.MixedAudio(this); - int from_bitField0_ = bitField0_; - if (segmentsBuilder_ == null) { - if (((bitField0_ & 0x00000001) != 0)) { - segments_ = java.util.Collections.unmodifiableList(segments_); - bitField0_ = (bitField0_ & ~0x00000001); - } - result.segments_ = segments_; - } else { - result.segments_ = segmentsBuilder_.build(); - } + public com.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.EndInteraction buildPartial() { + com.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.EndInteraction result = + new com.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.EndInteraction(this); onBuilt(); return result; } @@ -5543,9 +5082,10 @@ public Builder addRepeatedField( @java.lang.Override public Builder mergeFrom(com.google.protobuf.Message other) { - if (other instanceof com.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.MixedAudio) { + if (other + instanceof com.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.EndInteraction) { return mergeFrom( - (com.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.MixedAudio) other); + (com.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.EndInteraction) other); } else { super.mergeFrom(other); return this; @@ -5553,37 +5093,10 @@ public Builder mergeFrom(com.google.protobuf.Message other) { } public Builder mergeFrom( - com.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.MixedAudio other) { + com.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.EndInteraction other) { if (other - == com.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.MixedAudio + == com.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.EndInteraction .getDefaultInstance()) return this; - if (segmentsBuilder_ == null) { - if (!other.segments_.isEmpty()) { - if (segments_.isEmpty()) { - segments_ = other.segments_; - bitField0_ = (bitField0_ & ~0x00000001); - } else { - ensureSegmentsIsMutable(); - segments_.addAll(other.segments_); - } - onChanged(); - } - } else { - if (!other.segments_.isEmpty()) { - if (segmentsBuilder_.isEmpty()) { - segmentsBuilder_.dispose(); - segmentsBuilder_ = null; - segments_ = other.segments_; - bitField0_ = (bitField0_ & ~0x00000001); - segmentsBuilder_ = - com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders - ? getSegmentsFieldBuilder() - : null; - } else { - segmentsBuilder_.addAllMessages(other.segments_); - } - } - } this.mergeUnknownFields(other.unknownFields); onChanged(); return this; @@ -5599,12 +5112,12 @@ public Builder mergeFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { - com.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.MixedAudio parsedMessage = null; + com.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.EndInteraction parsedMessage = null; try { parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); } catch (com.google.protobuf.InvalidProtocolBufferException e) { parsedMessage = - (com.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.MixedAudio) + (com.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.EndInteraction) e.getUnfinishedMessage(); throw e.unwrapIOException(); } finally { @@ -5615,1165 +5128,1372 @@ public Builder mergeFrom( return this; } - private int bitField0_; - - private java.util.List< - com.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.MixedAudio.Segment> - segments_ = java.util.Collections.emptyList(); + @java.lang.Override + public final Builder setUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } - private void ensureSegmentsIsMutable() { - if (!((bitField0_ & 0x00000001) != 0)) { - segments_ = - new java.util.ArrayList< - com.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.MixedAudio.Segment>( - segments_); - bitField0_ |= 0x00000001; - } + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); } - private com.google.protobuf.RepeatedFieldBuilderV3< - com.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.MixedAudio.Segment, - com.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.MixedAudio.Segment.Builder, - com.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.MixedAudio.SegmentOrBuilder> - segmentsBuilder_; + // @@protoc_insertion_point(builder_scope:google.cloud.dialogflow.cx.v3beta1.ResponseMessage.EndInteraction) + } - /** - * - * - *
-       * Segments this audio response is composed of.
-       * 
- * - * - * repeated .google.cloud.dialogflow.cx.v3beta1.ResponseMessage.MixedAudio.Segment segments = 1; - * - */ - public java.util.List< - com.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.MixedAudio.Segment> - getSegmentsList() { - if (segmentsBuilder_ == null) { - return java.util.Collections.unmodifiableList(segments_); - } else { - return segmentsBuilder_.getMessageList(); - } - } - /** - * - * - *
-       * Segments this audio response is composed of.
-       * 
- * - * - * repeated .google.cloud.dialogflow.cx.v3beta1.ResponseMessage.MixedAudio.Segment segments = 1; - * - */ - public int getSegmentsCount() { - if (segmentsBuilder_ == null) { - return segments_.size(); - } else { - return segmentsBuilder_.getCount(); - } - } - /** - * - * - *
-       * Segments this audio response is composed of.
-       * 
- * - * - * repeated .google.cloud.dialogflow.cx.v3beta1.ResponseMessage.MixedAudio.Segment segments = 1; - * - */ - public com.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.MixedAudio.Segment getSegments( - int index) { - if (segmentsBuilder_ == null) { - return segments_.get(index); - } else { - return segmentsBuilder_.getMessage(index); - } - } - /** - * - * - *
-       * Segments this audio response is composed of.
-       * 
- * - * - * repeated .google.cloud.dialogflow.cx.v3beta1.ResponseMessage.MixedAudio.Segment segments = 1; - * - */ - public Builder setSegments( - int index, - com.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.MixedAudio.Segment value) { - if (segmentsBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - ensureSegmentsIsMutable(); - segments_.set(index, value); - onChanged(); - } else { - segmentsBuilder_.setMessage(index, value); - } - return this; - } - /** - * - * - *
-       * Segments this audio response is composed of.
-       * 
- * - * - * repeated .google.cloud.dialogflow.cx.v3beta1.ResponseMessage.MixedAudio.Segment segments = 1; - * - */ - public Builder setSegments( - int index, - com.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.MixedAudio.Segment.Builder - builderForValue) { - if (segmentsBuilder_ == null) { - ensureSegmentsIsMutable(); - segments_.set(index, builderForValue.build()); - onChanged(); - } else { - segmentsBuilder_.setMessage(index, builderForValue.build()); - } - return this; - } - /** - * - * - *
-       * Segments this audio response is composed of.
-       * 
- * - * - * repeated .google.cloud.dialogflow.cx.v3beta1.ResponseMessage.MixedAudio.Segment segments = 1; - * - */ - public Builder addSegments( - com.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.MixedAudio.Segment value) { - if (segmentsBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - ensureSegmentsIsMutable(); - segments_.add(value); - onChanged(); - } else { - segmentsBuilder_.addMessage(value); - } - return this; - } - /** - * - * - *
-       * Segments this audio response is composed of.
-       * 
- * - * - * repeated .google.cloud.dialogflow.cx.v3beta1.ResponseMessage.MixedAudio.Segment segments = 1; - * - */ - public Builder addSegments( - int index, - com.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.MixedAudio.Segment value) { - if (segmentsBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); + // @@protoc_insertion_point(class_scope:google.cloud.dialogflow.cx.v3beta1.ResponseMessage.EndInteraction) + private static final com.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.EndInteraction + DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = + new com.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.EndInteraction(); + } + + public static com.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.EndInteraction + getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public EndInteraction parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new EndInteraction(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.cx.v3beta1.ResponseMessage.EndInteraction + getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } + } + + public interface MixedAudioOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.cloud.dialogflow.cx.v3beta1.ResponseMessage.MixedAudio) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+     * Segments this audio response is composed of.
+     * 
+ * + * + * repeated .google.cloud.dialogflow.cx.v3beta1.ResponseMessage.MixedAudio.Segment segments = 1; + * + */ + java.util.List + getSegmentsList(); + /** + * + * + *
+     * Segments this audio response is composed of.
+     * 
+ * + * + * repeated .google.cloud.dialogflow.cx.v3beta1.ResponseMessage.MixedAudio.Segment segments = 1; + * + */ + com.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.MixedAudio.Segment getSegments( + int index); + /** + * + * + *
+     * Segments this audio response is composed of.
+     * 
+ * + * + * repeated .google.cloud.dialogflow.cx.v3beta1.ResponseMessage.MixedAudio.Segment segments = 1; + * + */ + int getSegmentsCount(); + /** + * + * + *
+     * Segments this audio response is composed of.
+     * 
+ * + * + * repeated .google.cloud.dialogflow.cx.v3beta1.ResponseMessage.MixedAudio.Segment segments = 1; + * + */ + java.util.List< + ? extends + com.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.MixedAudio.SegmentOrBuilder> + getSegmentsOrBuilderList(); + /** + * + * + *
+     * Segments this audio response is composed of.
+     * 
+ * + * + * repeated .google.cloud.dialogflow.cx.v3beta1.ResponseMessage.MixedAudio.Segment segments = 1; + * + */ + com.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.MixedAudio.SegmentOrBuilder + getSegmentsOrBuilder(int index); + } + /** + * + * + *
+   * Represents an audio message that is composed of both segments
+   * synthesized from the Dialogflow agent prompts and ones hosted externally
+   * at the specified URIs.
+   * The external URIs are specified via
+   * [play_audio][google.cloud.dialogflow.cx.v3beta1.ResponseMessage.play_audio].
+   * This message is generated by Dialogflow only and not supposed to be
+   * defined by the user.
+   * 
+ * + * Protobuf type {@code google.cloud.dialogflow.cx.v3beta1.ResponseMessage.MixedAudio} + */ + public static final class MixedAudio extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.cloud.dialogflow.cx.v3beta1.ResponseMessage.MixedAudio) + MixedAudioOrBuilder { + private static final long serialVersionUID = 0L; + // Use MixedAudio.newBuilder() to construct. + private MixedAudio(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private MixedAudio() { + segments_ = java.util.Collections.emptyList(); + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance(UnusedPrivateParameter unused) { + return new MixedAudio(); + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet getUnknownFields() { + return this.unknownFields; + } + + private MixedAudio( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + this(); + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + int mutable_bitField0_ = 0; + 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: + { + if (!((mutable_bitField0_ & 0x00000001) != 0)) { + segments_ = + new java.util.ArrayList< + com.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.MixedAudio + .Segment>(); + mutable_bitField0_ |= 0x00000001; + } + segments_.add( + input.readMessage( + com.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.MixedAudio.Segment + .parser(), + extensionRegistry)); + break; + } + default: + { + if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { + done = true; + } + break; + } } - ensureSegmentsIsMutable(); - segments_.add(index, value); - onChanged(); - } else { - segmentsBuilder_.addMessage(index, value); - } - return this; - } - /** - * - * - *
-       * Segments this audio response is composed of.
-       * 
- * - * - * repeated .google.cloud.dialogflow.cx.v3beta1.ResponseMessage.MixedAudio.Segment segments = 1; - * - */ - public Builder addSegments( - com.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.MixedAudio.Segment.Builder - builderForValue) { - if (segmentsBuilder_ == null) { - ensureSegmentsIsMutable(); - segments_.add(builderForValue.build()); - onChanged(); - } else { - segmentsBuilder_.addMessage(builderForValue.build()); } - return this; + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e).setUnfinishedMessage(this); + } finally { + if (((mutable_bitField0_ & 0x00000001) != 0)) { + segments_ = java.util.Collections.unmodifiableList(segments_); + } + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); } + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.dialogflow.cx.v3beta1.ResponseMessageProto + .internal_static_google_cloud_dialogflow_cx_v3beta1_ResponseMessage_MixedAudio_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.dialogflow.cx.v3beta1.ResponseMessageProto + .internal_static_google_cloud_dialogflow_cx_v3beta1_ResponseMessage_MixedAudio_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.MixedAudio.class, + com.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.MixedAudio.Builder.class); + } + + public interface SegmentOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.cloud.dialogflow.cx.v3beta1.ResponseMessage.MixedAudio.Segment) + com.google.protobuf.MessageOrBuilder { + /** * * *
-       * Segments this audio response is composed of.
+       * Raw audio synthesized from the Dialogflow agent's response using
+       * the output config specified in the request.
        * 
* - * - * repeated .google.cloud.dialogflow.cx.v3beta1.ResponseMessage.MixedAudio.Segment segments = 1; - * + * bytes audio = 1; + * + * @return The audio. */ - public Builder addSegments( - int index, - com.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.MixedAudio.Segment.Builder - builderForValue) { - if (segmentsBuilder_ == null) { - ensureSegmentsIsMutable(); - segments_.add(index, builderForValue.build()); - onChanged(); - } else { - segmentsBuilder_.addMessage(index, builderForValue.build()); - } - return this; - } + com.google.protobuf.ByteString getAudio(); + /** * * *
-       * Segments this audio response is composed of.
+       * Client-specific URI that points to an audio clip accessible to the
+       * client. Dialogflow does not impose any validation on it.
        * 
* - * - * repeated .google.cloud.dialogflow.cx.v3beta1.ResponseMessage.MixedAudio.Segment segments = 1; - * + * string uri = 2; + * + * @return The uri. */ - public Builder addAllSegments( - java.lang.Iterable< - ? extends - com.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.MixedAudio.Segment> - values) { - if (segmentsBuilder_ == null) { - ensureSegmentsIsMutable(); - com.google.protobuf.AbstractMessageLite.Builder.addAll(values, segments_); - onChanged(); - } else { - segmentsBuilder_.addAllMessages(values); - } - return this; - } + java.lang.String getUri(); /** * * *
-       * Segments this audio response is composed of.
+       * Client-specific URI that points to an audio clip accessible to the
+       * client. Dialogflow does not impose any validation on it.
        * 
* - * - * repeated .google.cloud.dialogflow.cx.v3beta1.ResponseMessage.MixedAudio.Segment segments = 1; - * + * string uri = 2; + * + * @return The bytes for uri. */ - public Builder clearSegments() { - if (segmentsBuilder_ == null) { - segments_ = java.util.Collections.emptyList(); - bitField0_ = (bitField0_ & ~0x00000001); - onChanged(); - } else { - segmentsBuilder_.clear(); - } - return this; - } + com.google.protobuf.ByteString getUriBytes(); + /** * * *
-       * Segments this audio response is composed of.
+       * Output only. Whether the playback of this segment can be interrupted by the end
+       * user's speech and the client should then start the next Dialogflow
+       * request.
        * 
* - * - * repeated .google.cloud.dialogflow.cx.v3beta1.ResponseMessage.MixedAudio.Segment segments = 1; + * bool allow_playback_interruption = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; * + * + * @return The allowPlaybackInterruption. */ - public Builder removeSegments(int index) { - if (segmentsBuilder_ == null) { - ensureSegmentsIsMutable(); - segments_.remove(index); - onChanged(); - } else { - segmentsBuilder_.remove(index); + boolean getAllowPlaybackInterruption(); + + public com.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.MixedAudio.Segment.ContentCase + getContentCase(); + } + /** + * + * + *
+     * Represents one segment of audio.
+     * 
+ * + * Protobuf type {@code google.cloud.dialogflow.cx.v3beta1.ResponseMessage.MixedAudio.Segment} + */ + public static final class Segment extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.cloud.dialogflow.cx.v3beta1.ResponseMessage.MixedAudio.Segment) + SegmentOrBuilder { + private static final long serialVersionUID = 0L; + // Use Segment.newBuilder() to construct. + private Segment(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private Segment() {} + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance(UnusedPrivateParameter unused) { + return new Segment(); + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet getUnknownFields() { + return this.unknownFields; + } + + private Segment( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + this(); + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); } - return this; + 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: + { + contentCase_ = 1; + content_ = input.readBytes(); + break; + } + case 18: + { + java.lang.String s = input.readStringRequireUtf8(); + contentCase_ = 2; + content_ = s; + break; + } + case 24: + { + allowPlaybackInterruption_ = input.readBool(); + break; + } + default: + { + if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { + done = true; + } + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.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.cx.v3beta1.ResponseMessageProto + .internal_static_google_cloud_dialogflow_cx_v3beta1_ResponseMessage_MixedAudio_Segment_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.dialogflow.cx.v3beta1.ResponseMessageProto + .internal_static_google_cloud_dialogflow_cx_v3beta1_ResponseMessage_MixedAudio_Segment_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.MixedAudio.Segment.class, + com.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.MixedAudio.Segment.Builder + .class); + } + + private int contentCase_ = 0; + private java.lang.Object content_; + + public enum ContentCase + implements + com.google.protobuf.Internal.EnumLite, + com.google.protobuf.AbstractMessage.InternalOneOfEnum { + AUDIO(1), + URI(2), + CONTENT_NOT_SET(0); + private final int value; + + private ContentCase(int value) { + this.value = value; + } + /** + * @param value The number of the enum to look for. + * @return The enum associated with the given number. + * @deprecated Use {@link #forNumber(int)} instead. + */ + @java.lang.Deprecated + public static ContentCase valueOf(int value) { + return forNumber(value); + } + + public static ContentCase forNumber(int value) { + switch (value) { + case 1: + return AUDIO; + case 2: + return URI; + case 0: + return CONTENT_NOT_SET; + default: + return null; + } + } + + public int getNumber() { + return this.value; + } + }; + + public ContentCase getContentCase() { + return ContentCase.forNumber(contentCase_); } + + public static final int AUDIO_FIELD_NUMBER = 1; /** * * *
-       * Segments this audio response is composed of.
+       * Raw audio synthesized from the Dialogflow agent's response using
+       * the output config specified in the request.
        * 
* - * - * repeated .google.cloud.dialogflow.cx.v3beta1.ResponseMessage.MixedAudio.Segment segments = 1; - * + * bytes audio = 1; + * + * @return The audio. */ - public com.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.MixedAudio.Segment.Builder - getSegmentsBuilder(int index) { - return getSegmentsFieldBuilder().getBuilder(index); + @java.lang.Override + public com.google.protobuf.ByteString getAudio() { + if (contentCase_ == 1) { + return (com.google.protobuf.ByteString) content_; + } + return com.google.protobuf.ByteString.EMPTY; } + + public static final int URI_FIELD_NUMBER = 2; /** * * *
-       * Segments this audio response is composed of.
+       * Client-specific URI that points to an audio clip accessible to the
+       * client. Dialogflow does not impose any validation on it.
        * 
* - * - * repeated .google.cloud.dialogflow.cx.v3beta1.ResponseMessage.MixedAudio.Segment segments = 1; - * + * string uri = 2; + * + * @return The uri. */ - public com.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.MixedAudio.SegmentOrBuilder - getSegmentsOrBuilder(int index) { - if (segmentsBuilder_ == null) { - return segments_.get(index); + public java.lang.String getUri() { + java.lang.Object ref = ""; + if (contentCase_ == 2) { + ref = content_; + } + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; } else { - return segmentsBuilder_.getMessageOrBuilder(index); + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + if (contentCase_ == 2) { + content_ = s; + } + return s; } } /** * * *
-       * Segments this audio response is composed of.
+       * Client-specific URI that points to an audio clip accessible to the
+       * client. Dialogflow does not impose any validation on it.
        * 
* - * - * repeated .google.cloud.dialogflow.cx.v3beta1.ResponseMessage.MixedAudio.Segment segments = 1; - * + * string uri = 2; + * + * @return The bytes for uri. */ - public java.util.List< - ? extends - com.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.MixedAudio - .SegmentOrBuilder> - getSegmentsOrBuilderList() { - if (segmentsBuilder_ != null) { - return segmentsBuilder_.getMessageOrBuilderList(); + public com.google.protobuf.ByteString getUriBytes() { + java.lang.Object ref = ""; + if (contentCase_ == 2) { + ref = content_; + } + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + if (contentCase_ == 2) { + content_ = b; + } + return b; } else { - return java.util.Collections.unmodifiableList(segments_); + return (com.google.protobuf.ByteString) ref; } } + + public static final int ALLOW_PLAYBACK_INTERRUPTION_FIELD_NUMBER = 3; + private boolean allowPlaybackInterruption_; /** * * *
-       * Segments this audio response is composed of.
+       * Output only. Whether the playback of this segment can be interrupted by the end
+       * user's speech and the client should then start the next Dialogflow
+       * request.
        * 
* - * - * repeated .google.cloud.dialogflow.cx.v3beta1.ResponseMessage.MixedAudio.Segment segments = 1; + * bool allow_playback_interruption = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; * - */ - public com.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.MixedAudio.Segment.Builder - addSegmentsBuilder() { - return getSegmentsFieldBuilder() - .addBuilder( - com.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.MixedAudio.Segment - .getDefaultInstance()); - } - /** - * - * - *
-       * Segments this audio response is composed of.
-       * 
* - * - * repeated .google.cloud.dialogflow.cx.v3beta1.ResponseMessage.MixedAudio.Segment segments = 1; - * + * @return The allowPlaybackInterruption. */ - public com.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.MixedAudio.Segment.Builder - addSegmentsBuilder(int index) { - return getSegmentsFieldBuilder() - .addBuilder( - index, - com.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.MixedAudio.Segment - .getDefaultInstance()); + @java.lang.Override + public boolean getAllowPlaybackInterruption() { + return allowPlaybackInterruption_; } - /** - * - * - *
-       * Segments this audio response is composed of.
-       * 
- * - * - * repeated .google.cloud.dialogflow.cx.v3beta1.ResponseMessage.MixedAudio.Segment segments = 1; - * - */ - public java.util.List< - com.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.MixedAudio.Segment.Builder> - getSegmentsBuilderList() { - return getSegmentsFieldBuilder().getBuilderList(); + + 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; } - private com.google.protobuf.RepeatedFieldBuilderV3< - com.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.MixedAudio.Segment, - com.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.MixedAudio.Segment.Builder, - com.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.MixedAudio.SegmentOrBuilder> - getSegmentsFieldBuilder() { - if (segmentsBuilder_ == null) { - segmentsBuilder_ = - new com.google.protobuf.RepeatedFieldBuilderV3< - com.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.MixedAudio.Segment, - com.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.MixedAudio.Segment.Builder, - com.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.MixedAudio - .SegmentOrBuilder>( - segments_, ((bitField0_ & 0x00000001) != 0), getParentForChildren(), isClean()); - segments_ = null; + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { + if (contentCase_ == 1) { + output.writeBytes(1, (com.google.protobuf.ByteString) content_); } - return segmentsBuilder_; + if (contentCase_ == 2) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 2, content_); + } + if (allowPlaybackInterruption_ != false) { + output.writeBool(3, allowPlaybackInterruption_); + } + unknownFields.writeTo(output); } @java.lang.Override - public final Builder setUnknownFields( - final com.google.protobuf.UnknownFieldSet unknownFields) { - return super.setUnknownFields(unknownFields); + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (contentCase_ == 1) { + size += + com.google.protobuf.CodedOutputStream.computeBytesSize( + 1, (com.google.protobuf.ByteString) content_); + } + if (contentCase_ == 2) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(2, content_); + } + if (allowPlaybackInterruption_ != false) { + size += + com.google.protobuf.CodedOutputStream.computeBoolSize(3, allowPlaybackInterruption_); + } + size += unknownFields.getSerializedSize(); + memoizedSize = size; + return size; } @java.lang.Override - public final Builder mergeUnknownFields( - final com.google.protobuf.UnknownFieldSet unknownFields) { - return super.mergeUnknownFields(unknownFields); + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj + instanceof com.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.MixedAudio.Segment)) { + return super.equals(obj); + } + com.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.MixedAudio.Segment other = + (com.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.MixedAudio.Segment) obj; + + if (getAllowPlaybackInterruption() != other.getAllowPlaybackInterruption()) return false; + if (!getContentCase().equals(other.getContentCase())) return false; + switch (contentCase_) { + case 1: + if (!getAudio().equals(other.getAudio())) return false; + break; + case 2: + if (!getUri().equals(other.getUri())) return false; + break; + case 0: + default: + } + if (!unknownFields.equals(other.unknownFields)) return false; + return true; } - // @@protoc_insertion_point(builder_scope:google.cloud.dialogflow.cx.v3beta1.ResponseMessage.MixedAudio) - } + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (37 * hash) + ALLOW_PLAYBACK_INTERRUPTION_FIELD_NUMBER; + hash = + (53 * hash) + com.google.protobuf.Internal.hashBoolean(getAllowPlaybackInterruption()); + switch (contentCase_) { + case 1: + hash = (37 * hash) + AUDIO_FIELD_NUMBER; + hash = (53 * hash) + getAudio().hashCode(); + break; + case 2: + hash = (37 * hash) + URI_FIELD_NUMBER; + hash = (53 * hash) + getUri().hashCode(); + break; + case 0: + default: + } + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } - // @@protoc_insertion_point(class_scope:google.cloud.dialogflow.cx.v3beta1.ResponseMessage.MixedAudio) - private static final com.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.MixedAudio - DEFAULT_INSTANCE; + public static com.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.MixedAudio.Segment + parseFrom(java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } - static { - DEFAULT_INSTANCE = new com.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.MixedAudio(); - } + public static com.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.MixedAudio.Segment + 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.cx.v3beta1.ResponseMessage.MixedAudio - getDefaultInstance() { - return DEFAULT_INSTANCE; - } + public static com.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.MixedAudio.Segment + parseFrom(com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } - private static final com.google.protobuf.Parser PARSER = - new com.google.protobuf.AbstractParser() { - @java.lang.Override - public MixedAudio parsePartialFrom( - com.google.protobuf.CodedInputStream input, + public static com.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.MixedAudio.Segment + parseFrom( + com.google.protobuf.ByteString data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { - return new MixedAudio(input, extensionRegistry); - } - }; + return PARSER.parseFrom(data, extensionRegistry); + } - public static com.google.protobuf.Parser parser() { - return PARSER; - } + public static com.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.MixedAudio.Segment + parseFrom(byte[] data) throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } - @java.lang.Override - public com.google.protobuf.Parser getParserForType() { - return PARSER; - } + public static com.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.MixedAudio.Segment + parseFrom(byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } - @java.lang.Override - public com.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.MixedAudio - getDefaultInstanceForType() { - return DEFAULT_INSTANCE; - } - } + public static com.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.MixedAudio.Segment + parseFrom(java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } - public interface EndInteractionOrBuilder - extends - // @@protoc_insertion_point(interface_extends:google.cloud.dialogflow.cx.v3beta1.ResponseMessage.EndInteraction) - com.google.protobuf.MessageOrBuilder {} - /** - * - * - *
-   * Indicates that interaction with the Dialogflow agent has ended.
-   * This message is generated by Dialogflow only and not supposed to be
-   * defined by the user.
-   * 
- * - * Protobuf type {@code google.cloud.dialogflow.cx.v3beta1.ResponseMessage.EndInteraction} - */ - public static final class EndInteraction extends com.google.protobuf.GeneratedMessageV3 - implements - // @@protoc_insertion_point(message_implements:google.cloud.dialogflow.cx.v3beta1.ResponseMessage.EndInteraction) - EndInteractionOrBuilder { - private static final long serialVersionUID = 0L; - // Use EndInteraction.newBuilder() to construct. - private EndInteraction(com.google.protobuf.GeneratedMessageV3.Builder builder) { - super(builder); - } + public static com.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.MixedAudio.Segment + parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } - private EndInteraction() {} + public static com.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.MixedAudio.Segment + parseDelimitedFrom(java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } - @java.lang.Override - @SuppressWarnings({"unused"}) - protected java.lang.Object newInstance(UnusedPrivateParameter unused) { - return new EndInteraction(); - } + public static com.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.MixedAudio.Segment + parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( + PARSER, input, extensionRegistry); + } - @java.lang.Override - public final com.google.protobuf.UnknownFieldSet getUnknownFields() { - return this.unknownFields; - } + public static com.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.MixedAudio.Segment + parseFrom(com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } - private EndInteraction( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - this(); - if (extensionRegistry == null) { - throw new java.lang.NullPointerException(); + public static com.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.MixedAudio.Segment + parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); } - 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; - default: - { - if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { - done = true; - } - break; - } - } - } - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - throw e.setUnfinishedMessage(this); - } catch (java.io.IOException e) { - throw new com.google.protobuf.InvalidProtocolBufferException(e).setUnfinishedMessage(this); - } finally { - this.unknownFields = unknownFields.build(); - makeExtensionsImmutable(); + + @java.lang.Override + public Builder newBuilderForType() { + return newBuilder(); } - } - public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { - return com.google.cloud.dialogflow.cx.v3beta1.ResponseMessageProto - .internal_static_google_cloud_dialogflow_cx_v3beta1_ResponseMessage_EndInteraction_descriptor; - } + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } - @java.lang.Override - protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable - internalGetFieldAccessorTable() { - return com.google.cloud.dialogflow.cx.v3beta1.ResponseMessageProto - .internal_static_google_cloud_dialogflow_cx_v3beta1_ResponseMessage_EndInteraction_fieldAccessorTable - .ensureFieldAccessorsInitialized( - com.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.EndInteraction.class, - com.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.EndInteraction.Builder.class); - } + public static Builder newBuilder( + com.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.MixedAudio.Segment prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } - private byte memoizedIsInitialized = -1; + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } - @java.lang.Override - public final boolean isInitialized() { - byte isInitialized = memoizedIsInitialized; - if (isInitialized == 1) return true; - if (isInitialized == 0) return false; + @java.lang.Override + protected Builder newBuilderForType( + com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * + * + *
+       * Represents one segment of audio.
+       * 
+ * + * Protobuf type {@code google.cloud.dialogflow.cx.v3beta1.ResponseMessage.MixedAudio.Segment} + */ + public static final class Builder + extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.cloud.dialogflow.cx.v3beta1.ResponseMessage.MixedAudio.Segment) + com.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.MixedAudio.SegmentOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.dialogflow.cx.v3beta1.ResponseMessageProto + .internal_static_google_cloud_dialogflow_cx_v3beta1_ResponseMessage_MixedAudio_Segment_descriptor; + } - memoizedIsInitialized = 1; - return true; - } + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.dialogflow.cx.v3beta1.ResponseMessageProto + .internal_static_google_cloud_dialogflow_cx_v3beta1_ResponseMessage_MixedAudio_Segment_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.MixedAudio.Segment.class, + com.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.MixedAudio.Segment.Builder + .class); + } - @java.lang.Override - public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { - unknownFields.writeTo(output); - } + // Construct using + // com.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.MixedAudio.Segment.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } - @java.lang.Override - public int getSerializedSize() { - int size = memoizedSize; - if (size != -1) return size; + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } - size = 0; - size += unknownFields.getSerializedSize(); - memoizedSize = size; - return size; - } + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) {} + } - @java.lang.Override - public boolean equals(final java.lang.Object obj) { - if (obj == this) { - return true; - } - if (!(obj instanceof com.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.EndInteraction)) { - return super.equals(obj); - } - com.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.EndInteraction other = - (com.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.EndInteraction) obj; + @java.lang.Override + public Builder clear() { + super.clear(); + allowPlaybackInterruption_ = false; - if (!unknownFields.equals(other.unknownFields)) return false; - return true; - } + contentCase_ = 0; + content_ = null; + return this; + } - @java.lang.Override - public int hashCode() { - if (memoizedHashCode != 0) { - return memoizedHashCode; - } - int hash = 41; - hash = (19 * hash) + getDescriptor().hashCode(); - hash = (29 * hash) + unknownFields.hashCode(); - memoizedHashCode = hash; - return hash; - } + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.cloud.dialogflow.cx.v3beta1.ResponseMessageProto + .internal_static_google_cloud_dialogflow_cx_v3beta1_ResponseMessage_MixedAudio_Segment_descriptor; + } - public static com.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.EndInteraction parseFrom( - java.nio.ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } + @java.lang.Override + public com.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.MixedAudio.Segment + getDefaultInstanceForType() { + return com.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.MixedAudio.Segment + .getDefaultInstance(); + } - public static com.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.EndInteraction parseFrom( - java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data, extensionRegistry); - } + @java.lang.Override + public com.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.MixedAudio.Segment build() { + com.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.MixedAudio.Segment result = + buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } - public static com.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.EndInteraction parseFrom( - com.google.protobuf.ByteString data) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - - public static com.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.EndInteraction 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.cx.v3beta1.ResponseMessage.EndInteraction parseFrom( - byte[] data) throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - - public static com.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.EndInteraction parseFrom( - byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data, extensionRegistry); - } - - public static com.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.EndInteraction parseFrom( - java.io.InputStream input) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); - } - - public static com.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.EndInteraction 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.cx.v3beta1.ResponseMessage.EndInteraction - parseDelimitedFrom(java.io.InputStream input) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); - } - - public static com.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.EndInteraction - parseDelimitedFrom( - java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( - PARSER, input, extensionRegistry); - } + @java.lang.Override + public com.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.MixedAudio.Segment + buildPartial() { + com.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.MixedAudio.Segment result = + new com.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.MixedAudio.Segment(this); + if (contentCase_ == 1) { + result.content_ = content_; + } + if (contentCase_ == 2) { + result.content_ = content_; + } + result.allowPlaybackInterruption_ = allowPlaybackInterruption_; + result.contentCase_ = contentCase_; + onBuilt(); + return result; + } - public static com.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.EndInteraction parseFrom( - com.google.protobuf.CodedInputStream input) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); - } + @java.lang.Override + public Builder clone() { + return super.clone(); + } - public static com.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.EndInteraction 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 setField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.setField(field, value); + } - @java.lang.Override - public Builder newBuilderForType() { - return newBuilder(); - } + @java.lang.Override + public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { + return super.clearField(field); + } - public static Builder newBuilder() { - return DEFAULT_INSTANCE.toBuilder(); - } + @java.lang.Override + public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return super.clearOneof(oneof); + } - public static Builder newBuilder( - com.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.EndInteraction prototype) { - return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); - } + @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 toBuilder() { - return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); - } + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.addRepeatedField(field, value); + } - @java.lang.Override - protected Builder newBuilderForType( - com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { - Builder builder = new Builder(parent); - return builder; - } - /** - * - * - *
-     * Indicates that interaction with the Dialogflow agent has ended.
-     * This message is generated by Dialogflow only and not supposed to be
-     * defined by the user.
-     * 
- * - * Protobuf type {@code google.cloud.dialogflow.cx.v3beta1.ResponseMessage.EndInteraction} - */ - public static final class Builder - extends com.google.protobuf.GeneratedMessageV3.Builder - implements - // @@protoc_insertion_point(builder_implements:google.cloud.dialogflow.cx.v3beta1.ResponseMessage.EndInteraction) - com.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.EndInteractionOrBuilder { - public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { - return com.google.cloud.dialogflow.cx.v3beta1.ResponseMessageProto - .internal_static_google_cloud_dialogflow_cx_v3beta1_ResponseMessage_EndInteraction_descriptor; - } + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other + instanceof + com.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.MixedAudio.Segment) { + return mergeFrom( + (com.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.MixedAudio.Segment) other); + } else { + super.mergeFrom(other); + return this; + } + } - @java.lang.Override - protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable - internalGetFieldAccessorTable() { - return com.google.cloud.dialogflow.cx.v3beta1.ResponseMessageProto - .internal_static_google_cloud_dialogflow_cx_v3beta1_ResponseMessage_EndInteraction_fieldAccessorTable - .ensureFieldAccessorsInitialized( - com.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.EndInteraction.class, - com.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.EndInteraction.Builder - .class); - } + public Builder mergeFrom( + com.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.MixedAudio.Segment other) { + if (other + == com.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.MixedAudio.Segment + .getDefaultInstance()) return this; + if (other.getAllowPlaybackInterruption() != false) { + setAllowPlaybackInterruption(other.getAllowPlaybackInterruption()); + } + switch (other.getContentCase()) { + case AUDIO: + { + setAudio(other.getAudio()); + break; + } + case URI: + { + contentCase_ = 2; + content_ = other.content_; + onChanged(); + break; + } + case CONTENT_NOT_SET: + { + break; + } + } + this.mergeUnknownFields(other.unknownFields); + onChanged(); + return this; + } - // Construct using - // com.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.EndInteraction.newBuilder() - private Builder() { - maybeForceBuilderInitialization(); - } + @java.lang.Override + public final boolean isInitialized() { + return true; + } - private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { - super(parent); - maybeForceBuilderInitialization(); - } + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.MixedAudio.Segment parsedMessage = + null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = + (com.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.MixedAudio.Segment) + e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } - private void maybeForceBuilderInitialization() { - if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) {} - } + private int contentCase_ = 0; + private java.lang.Object content_; - @java.lang.Override - public Builder clear() { - super.clear(); - return this; - } + public ContentCase getContentCase() { + return ContentCase.forNumber(contentCase_); + } - @java.lang.Override - public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { - return com.google.cloud.dialogflow.cx.v3beta1.ResponseMessageProto - .internal_static_google_cloud_dialogflow_cx_v3beta1_ResponseMessage_EndInteraction_descriptor; - } + public Builder clearContent() { + contentCase_ = 0; + content_ = null; + onChanged(); + return this; + } - @java.lang.Override - public com.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.EndInteraction - getDefaultInstanceForType() { - return com.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.EndInteraction - .getDefaultInstance(); - } - - @java.lang.Override - public com.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.EndInteraction build() { - com.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.EndInteraction result = - buildPartial(); - if (!result.isInitialized()) { - throw newUninitializedMessageException(result); + /** + * + * + *
+         * Raw audio synthesized from the Dialogflow agent's response using
+         * the output config specified in the request.
+         * 
+ * + * bytes audio = 1; + * + * @return The audio. + */ + public com.google.protobuf.ByteString getAudio() { + if (contentCase_ == 1) { + return (com.google.protobuf.ByteString) content_; + } + return com.google.protobuf.ByteString.EMPTY; + } + /** + * + * + *
+         * Raw audio synthesized from the Dialogflow agent's response using
+         * the output config specified in the request.
+         * 
+ * + * bytes audio = 1; + * + * @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(); + } + contentCase_ = 1; + content_ = value; + onChanged(); + return this; + } + /** + * + * + *
+         * Raw audio synthesized from the Dialogflow agent's response using
+         * the output config specified in the request.
+         * 
+ * + * bytes audio = 1; + * + * @return This builder for chaining. + */ + public Builder clearAudio() { + if (contentCase_ == 1) { + contentCase_ = 0; + content_ = null; + onChanged(); + } + return this; } - return result; - } - - @java.lang.Override - public com.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.EndInteraction buildPartial() { - com.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.EndInteraction result = - new com.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.EndInteraction(this); - 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); - } + /** + * + * + *
+         * Client-specific URI that points to an audio clip accessible to the
+         * client. Dialogflow does not impose any validation on it.
+         * 
+ * + * string uri = 2; + * + * @return The uri. + */ + @java.lang.Override + public java.lang.String getUri() { + java.lang.Object ref = ""; + if (contentCase_ == 2) { + ref = content_; + } + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + if (contentCase_ == 2) { + content_ = s; + } + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+         * Client-specific URI that points to an audio clip accessible to the
+         * client. Dialogflow does not impose any validation on it.
+         * 
+ * + * string uri = 2; + * + * @return The bytes for uri. + */ + @java.lang.Override + public com.google.protobuf.ByteString getUriBytes() { + java.lang.Object ref = ""; + if (contentCase_ == 2) { + ref = content_; + } + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + if (contentCase_ == 2) { + content_ = b; + } + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+         * Client-specific URI that points to an audio clip accessible to the
+         * client. Dialogflow does not impose any validation on it.
+         * 
+ * + * string uri = 2; + * + * @param value The uri to set. + * @return This builder for chaining. + */ + public Builder setUri(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + contentCase_ = 2; + content_ = value; + onChanged(); + return this; + } + /** + * + * + *
+         * Client-specific URI that points to an audio clip accessible to the
+         * client. Dialogflow does not impose any validation on it.
+         * 
+ * + * string uri = 2; + * + * @return This builder for chaining. + */ + public Builder clearUri() { + if (contentCase_ == 2) { + contentCase_ = 0; + content_ = null; + onChanged(); + } + return this; + } + /** + * + * + *
+         * Client-specific URI that points to an audio clip accessible to the
+         * client. Dialogflow does not impose any validation on it.
+         * 
+ * + * string uri = 2; + * + * @param value The bytes for uri to set. + * @return This builder for chaining. + */ + public Builder setUriBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + contentCase_ = 2; + content_ = value; + onChanged(); + return this; + } - @java.lang.Override - public Builder mergeFrom(com.google.protobuf.Message other) { - if (other - instanceof com.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.EndInteraction) { - return mergeFrom( - (com.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.EndInteraction) other); - } else { - super.mergeFrom(other); + private boolean allowPlaybackInterruption_; + /** + * + * + *
+         * Output only. Whether the playback of this segment can be interrupted by the end
+         * user's speech and the client should then start the next Dialogflow
+         * request.
+         * 
+ * + * bool allow_playback_interruption = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return The allowPlaybackInterruption. + */ + @java.lang.Override + public boolean getAllowPlaybackInterruption() { + return allowPlaybackInterruption_; + } + /** + * + * + *
+         * Output only. Whether the playback of this segment can be interrupted by the end
+         * user's speech and the client should then start the next Dialogflow
+         * request.
+         * 
+ * + * bool allow_playback_interruption = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @param value The allowPlaybackInterruption to set. + * @return This builder for chaining. + */ + public Builder setAllowPlaybackInterruption(boolean value) { + + allowPlaybackInterruption_ = value; + onChanged(); return this; } - } - - public Builder mergeFrom( - com.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.EndInteraction other) { - if (other - == com.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.EndInteraction - .getDefaultInstance()) return this; - this.mergeUnknownFields(other.unknownFields); - onChanged(); - return this; - } + /** + * + * + *
+         * Output only. Whether the playback of this segment can be interrupted by the end
+         * user's speech and the client should then start the next Dialogflow
+         * request.
+         * 
+ * + * bool allow_playback_interruption = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return This builder for chaining. + */ + public Builder clearAllowPlaybackInterruption() { - @java.lang.Override - public final boolean isInitialized() { - return true; - } + allowPlaybackInterruption_ = false; + onChanged(); + return this; + } - @java.lang.Override - public Builder mergeFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - com.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.EndInteraction parsedMessage = null; - try { - parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - parsedMessage = - (com.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.EndInteraction) - e.getUnfinishedMessage(); - throw e.unwrapIOException(); - } finally { - if (parsedMessage != null) { - mergeFrom(parsedMessage); - } + @java.lang.Override + public final Builder setUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); } - 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); + } - @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.cx.v3beta1.ResponseMessage.MixedAudio.Segment) } - // @@protoc_insertion_point(builder_scope:google.cloud.dialogflow.cx.v3beta1.ResponseMessage.EndInteraction) - } - - // @@protoc_insertion_point(class_scope:google.cloud.dialogflow.cx.v3beta1.ResponseMessage.EndInteraction) - private static final com.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.EndInteraction - DEFAULT_INSTANCE; - - static { - DEFAULT_INSTANCE = - new com.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.EndInteraction(); - } - - public static com.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.EndInteraction - getDefaultInstance() { - return DEFAULT_INSTANCE; - } - - private static final com.google.protobuf.Parser PARSER = - new com.google.protobuf.AbstractParser() { - @java.lang.Override - public EndInteraction parsePartialFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return new EndInteraction(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.cx.v3beta1.ResponseMessage.EndInteraction - getDefaultInstanceForType() { - return DEFAULT_INSTANCE; - } - } - - public interface PlayAudioOrBuilder - extends - // @@protoc_insertion_point(interface_extends:google.cloud.dialogflow.cx.v3beta1.ResponseMessage.PlayAudio) - com.google.protobuf.MessageOrBuilder { - - /** - * - * - *
-     * Required. URI of the audio clip. Dialogflow does not impose any validation on this
-     * value. It is specific to the client that reads it.
-     * 
- * - * string audio_uri = 1 [(.google.api.field_behavior) = REQUIRED]; - * - * @return The audioUri. - */ - java.lang.String getAudioUri(); - /** - * - * - *
-     * Required. URI of the audio clip. Dialogflow does not impose any validation on this
-     * value. It is specific to the client that reads it.
-     * 
- * - * string audio_uri = 1 [(.google.api.field_behavior) = REQUIRED]; - * - * @return The bytes for audioUri. - */ - com.google.protobuf.ByteString getAudioUriBytes(); - - /** - * - * - *
-     * Output only. Whether the playback of this message can be interrupted by the end
-     * user's speech and the client can then starts the next Dialogflow
-     * request.
-     * 
- * - * bool allow_playback_interruption = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; - * - * - * @return The allowPlaybackInterruption. - */ - boolean getAllowPlaybackInterruption(); - } - /** - * - * - *
-   * Specifies an audio clip to be played by the client as part of the response.
-   * 
- * - * Protobuf type {@code google.cloud.dialogflow.cx.v3beta1.ResponseMessage.PlayAudio} - */ - public static final class PlayAudio extends com.google.protobuf.GeneratedMessageV3 - implements - // @@protoc_insertion_point(message_implements:google.cloud.dialogflow.cx.v3beta1.ResponseMessage.PlayAudio) - PlayAudioOrBuilder { - private static final long serialVersionUID = 0L; - // Use PlayAudio.newBuilder() to construct. - private PlayAudio(com.google.protobuf.GeneratedMessageV3.Builder builder) { - super(builder); - } - - private PlayAudio() { - audioUri_ = ""; - } - - @java.lang.Override - @SuppressWarnings({"unused"}) - protected java.lang.Object newInstance(UnusedPrivateParameter unused) { - return new PlayAudio(); - } - - @java.lang.Override - public final com.google.protobuf.UnknownFieldSet getUnknownFields() { - return this.unknownFields; - } + // @@protoc_insertion_point(class_scope:google.cloud.dialogflow.cx.v3beta1.ResponseMessage.MixedAudio.Segment) + private static final com.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.MixedAudio.Segment + DEFAULT_INSTANCE; - private PlayAudio( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - this(); - if (extensionRegistry == null) { - throw new java.lang.NullPointerException(); + static { + DEFAULT_INSTANCE = + new com.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.MixedAudio.Segment(); } - 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: - { - java.lang.String s = input.readStringRequireUtf8(); - audioUri_ = s; - break; - } - case 16: - { - allowPlaybackInterruption_ = input.readBool(); - break; - } - default: - { - if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { - done = true; - } - break; - } - } - } - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - throw e.setUnfinishedMessage(this); - } catch (java.io.IOException e) { - throw new com.google.protobuf.InvalidProtocolBufferException(e).setUnfinishedMessage(this); - } finally { - this.unknownFields = unknownFields.build(); - makeExtensionsImmutable(); + public static com.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.MixedAudio.Segment + getDefaultInstance() { + return DEFAULT_INSTANCE; } - } - public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { - return com.google.cloud.dialogflow.cx.v3beta1.ResponseMessageProto - .internal_static_google_cloud_dialogflow_cx_v3beta1_ResponseMessage_PlayAudio_descriptor; - } + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public Segment parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new Segment(input, extensionRegistry); + } + }; - @java.lang.Override - protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable - internalGetFieldAccessorTable() { - return com.google.cloud.dialogflow.cx.v3beta1.ResponseMessageProto - .internal_static_google_cloud_dialogflow_cx_v3beta1_ResponseMessage_PlayAudio_fieldAccessorTable - .ensureFieldAccessorsInitialized( - com.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.PlayAudio.class, - com.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.PlayAudio.Builder.class); + 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.cx.v3beta1.ResponseMessage.MixedAudio.Segment + getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } } - public static final int AUDIO_URI_FIELD_NUMBER = 1; - private volatile java.lang.Object audioUri_; + public static final int SEGMENTS_FIELD_NUMBER = 1; + private java.util.List< + com.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.MixedAudio.Segment> + segments_; /** * * *
-     * Required. URI of the audio clip. Dialogflow does not impose any validation on this
-     * value. It is specific to the client that reads it.
+     * Segments this audio response is composed of.
      * 
* - * string audio_uri = 1 [(.google.api.field_behavior) = REQUIRED]; - * - * @return The audioUri. + * + * repeated .google.cloud.dialogflow.cx.v3beta1.ResponseMessage.MixedAudio.Segment segments = 1; + * */ @java.lang.Override - public java.lang.String getAudioUri() { - java.lang.Object ref = audioUri_; - 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(); - audioUri_ = s; - return s; - } + public java.util.List + getSegmentsList() { + return segments_; } /** * * *
-     * Required. URI of the audio clip. Dialogflow does not impose any validation on this
-     * value. It is specific to the client that reads it.
+     * Segments this audio response is composed of.
      * 
* - * string audio_uri = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * repeated .google.cloud.dialogflow.cx.v3beta1.ResponseMessage.MixedAudio.Segment segments = 1; + * + */ + @java.lang.Override + public java.util.List< + ? extends + com.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.MixedAudio.SegmentOrBuilder> + getSegmentsOrBuilderList() { + return segments_; + } + /** * - * @return The bytes for audioUri. + * + *
+     * Segments this audio response is composed of.
+     * 
+ * + * + * repeated .google.cloud.dialogflow.cx.v3beta1.ResponseMessage.MixedAudio.Segment segments = 1; + * */ @java.lang.Override - public com.google.protobuf.ByteString getAudioUriBytes() { - java.lang.Object ref = audioUri_; - if (ref instanceof java.lang.String) { - com.google.protobuf.ByteString b = - com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); - audioUri_ = b; - return b; - } else { - return (com.google.protobuf.ByteString) ref; - } + public int getSegmentsCount() { + return segments_.size(); } - - public static final int ALLOW_PLAYBACK_INTERRUPTION_FIELD_NUMBER = 2; - private boolean allowPlaybackInterruption_; /** * * *
-     * Output only. Whether the playback of this message can be interrupted by the end
-     * user's speech and the client can then starts the next Dialogflow
-     * request.
+     * Segments this audio response is composed of.
      * 
* - * bool allow_playback_interruption = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * repeated .google.cloud.dialogflow.cx.v3beta1.ResponseMessage.MixedAudio.Segment segments = 1; * + */ + @java.lang.Override + public com.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.MixedAudio.Segment getSegments( + int index) { + return segments_.get(index); + } + /** * - * @return The allowPlaybackInterruption. + * + *
+     * Segments this audio response is composed of.
+     * 
+ * + * + * repeated .google.cloud.dialogflow.cx.v3beta1.ResponseMessage.MixedAudio.Segment segments = 1; + * */ @java.lang.Override - public boolean getAllowPlaybackInterruption() { - return allowPlaybackInterruption_; + public com.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.MixedAudio.SegmentOrBuilder + getSegmentsOrBuilder(int index) { + return segments_.get(index); } private byte memoizedIsInitialized = -1; @@ -6790,11 +6510,8 @@ public final boolean isInitialized() { @java.lang.Override public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { - if (!getAudioUriBytes().isEmpty()) { - com.google.protobuf.GeneratedMessageV3.writeString(output, 1, audioUri_); - } - if (allowPlaybackInterruption_ != false) { - output.writeBool(2, allowPlaybackInterruption_); + for (int i = 0; i < segments_.size(); i++) { + output.writeMessage(1, segments_.get(i)); } unknownFields.writeTo(output); } @@ -6805,12 +6522,8 @@ public int getSerializedSize() { if (size != -1) return size; size = 0; - if (!getAudioUriBytes().isEmpty()) { - size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, audioUri_); - } - if (allowPlaybackInterruption_ != false) { - size += - com.google.protobuf.CodedOutputStream.computeBoolSize(2, allowPlaybackInterruption_); + for (int i = 0; i < segments_.size(); i++) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(1, segments_.get(i)); } size += unknownFields.getSerializedSize(); memoizedSize = size; @@ -6822,14 +6535,13 @@ public boolean equals(final java.lang.Object obj) { if (obj == this) { return true; } - if (!(obj instanceof com.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.PlayAudio)) { + if (!(obj instanceof com.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.MixedAudio)) { return super.equals(obj); } - com.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.PlayAudio other = - (com.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.PlayAudio) obj; + com.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.MixedAudio other = + (com.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.MixedAudio) obj; - if (!getAudioUri().equals(other.getAudioUri())) return false; - if (getAllowPlaybackInterruption() != other.getAllowPlaybackInterruption()) return false; + if (!getSegmentsList().equals(other.getSegmentsList())) return false; if (!unknownFields.equals(other.unknownFields)) return false; return true; } @@ -6841,68 +6553,68 @@ public int hashCode() { } int hash = 41; hash = (19 * hash) + getDescriptor().hashCode(); - hash = (37 * hash) + AUDIO_URI_FIELD_NUMBER; - hash = (53 * hash) + getAudioUri().hashCode(); - hash = (37 * hash) + ALLOW_PLAYBACK_INTERRUPTION_FIELD_NUMBER; - hash = (53 * hash) + com.google.protobuf.Internal.hashBoolean(getAllowPlaybackInterruption()); + if (getSegmentsCount() > 0) { + hash = (37 * hash) + SEGMENTS_FIELD_NUMBER; + hash = (53 * hash) + getSegmentsList().hashCode(); + } hash = (29 * hash) + unknownFields.hashCode(); memoizedHashCode = hash; return hash; } - public static com.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.PlayAudio parseFrom( + public static com.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.MixedAudio parseFrom( java.nio.ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data); } - public static com.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.PlayAudio parseFrom( + public static com.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.MixedAudio 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.cx.v3beta1.ResponseMessage.PlayAudio parseFrom( + public static com.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.MixedAudio parseFrom( com.google.protobuf.ByteString data) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data); } - public static com.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.PlayAudio parseFrom( + public static com.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.MixedAudio 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.cx.v3beta1.ResponseMessage.PlayAudio parseFrom( + public static com.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.MixedAudio parseFrom( byte[] data) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data); } - public static com.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.PlayAudio parseFrom( + public static com.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.MixedAudio parseFrom( byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data, extensionRegistry); } - public static com.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.PlayAudio parseFrom( + public static com.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.MixedAudio parseFrom( java.io.InputStream input) throws java.io.IOException { return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); } - public static com.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.PlayAudio parseFrom( + public static com.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.MixedAudio 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.cx.v3beta1.ResponseMessage.PlayAudio + public static com.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.MixedAudio parseDelimitedFrom(java.io.InputStream input) throws java.io.IOException { return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); } - public static com.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.PlayAudio + public static com.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.MixedAudio parseDelimitedFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { @@ -6910,12 +6622,12 @@ public static com.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.PlayAudio p PARSER, input, extensionRegistry); } - public static com.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.PlayAudio parseFrom( + public static com.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.MixedAudio parseFrom( com.google.protobuf.CodedInputStream input) throws java.io.IOException { return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); } - public static com.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.PlayAudio parseFrom( + public static com.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.MixedAudio parseFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { @@ -6933,7 +6645,7 @@ public static Builder newBuilder() { } public static Builder newBuilder( - com.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.PlayAudio prototype) { + com.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.MixedAudio prototype) { return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); } @@ -6952,33 +6664,39 @@ protected Builder newBuilderForType( * * *
-     * Specifies an audio clip to be played by the client as part of the response.
+     * Represents an audio message that is composed of both segments
+     * synthesized from the Dialogflow agent prompts and ones hosted externally
+     * at the specified URIs.
+     * The external URIs are specified via
+     * [play_audio][google.cloud.dialogflow.cx.v3beta1.ResponseMessage.play_audio].
+     * This message is generated by Dialogflow only and not supposed to be
+     * defined by the user.
      * 
* - * Protobuf type {@code google.cloud.dialogflow.cx.v3beta1.ResponseMessage.PlayAudio} + * Protobuf type {@code google.cloud.dialogflow.cx.v3beta1.ResponseMessage.MixedAudio} */ public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder implements - // @@protoc_insertion_point(builder_implements:google.cloud.dialogflow.cx.v3beta1.ResponseMessage.PlayAudio) - com.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.PlayAudioOrBuilder { + // @@protoc_insertion_point(builder_implements:google.cloud.dialogflow.cx.v3beta1.ResponseMessage.MixedAudio) + com.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.MixedAudioOrBuilder { public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { return com.google.cloud.dialogflow.cx.v3beta1.ResponseMessageProto - .internal_static_google_cloud_dialogflow_cx_v3beta1_ResponseMessage_PlayAudio_descriptor; + .internal_static_google_cloud_dialogflow_cx_v3beta1_ResponseMessage_MixedAudio_descriptor; } @java.lang.Override protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internalGetFieldAccessorTable() { return com.google.cloud.dialogflow.cx.v3beta1.ResponseMessageProto - .internal_static_google_cloud_dialogflow_cx_v3beta1_ResponseMessage_PlayAudio_fieldAccessorTable + .internal_static_google_cloud_dialogflow_cx_v3beta1_ResponseMessage_MixedAudio_fieldAccessorTable .ensureFieldAccessorsInitialized( - com.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.PlayAudio.class, - com.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.PlayAudio.Builder.class); + com.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.MixedAudio.class, + com.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.MixedAudio.Builder.class); } // Construct using - // com.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.PlayAudio.newBuilder() + // com.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.MixedAudio.newBuilder() private Builder() { maybeForceBuilderInitialization(); } @@ -6989,35 +6707,39 @@ private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { } private void maybeForceBuilderInitialization() { - if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) {} + if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) { + getSegmentsFieldBuilder(); + } } @java.lang.Override public Builder clear() { super.clear(); - audioUri_ = ""; - - allowPlaybackInterruption_ = false; - + if (segmentsBuilder_ == null) { + segments_ = java.util.Collections.emptyList(); + bitField0_ = (bitField0_ & ~0x00000001); + } else { + segmentsBuilder_.clear(); + } return this; } @java.lang.Override public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { return com.google.cloud.dialogflow.cx.v3beta1.ResponseMessageProto - .internal_static_google_cloud_dialogflow_cx_v3beta1_ResponseMessage_PlayAudio_descriptor; + .internal_static_google_cloud_dialogflow_cx_v3beta1_ResponseMessage_MixedAudio_descriptor; } @java.lang.Override - public com.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.PlayAudio + public com.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.MixedAudio getDefaultInstanceForType() { - return com.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.PlayAudio + return com.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.MixedAudio .getDefaultInstance(); } @java.lang.Override - public com.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.PlayAudio build() { - com.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.PlayAudio result = buildPartial(); + public com.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.MixedAudio build() { + com.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.MixedAudio result = buildPartial(); if (!result.isInitialized()) { throw newUninitializedMessageException(result); } @@ -7025,11 +6747,19 @@ public com.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.PlayAudio build() } @java.lang.Override - public com.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.PlayAudio buildPartial() { - com.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.PlayAudio result = - new com.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.PlayAudio(this); - result.audioUri_ = audioUri_; - result.allowPlaybackInterruption_ = allowPlaybackInterruption_; + public com.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.MixedAudio buildPartial() { + com.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.MixedAudio result = + new com.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.MixedAudio(this); + int from_bitField0_ = bitField0_; + if (segmentsBuilder_ == null) { + if (((bitField0_ & 0x00000001) != 0)) { + segments_ = java.util.Collections.unmodifiableList(segments_); + bitField0_ = (bitField0_ & ~0x00000001); + } + result.segments_ = segments_; + } else { + result.segments_ = segmentsBuilder_.build(); + } onBuilt(); return result; } @@ -7071,9 +6801,9 @@ public Builder addRepeatedField( @java.lang.Override public Builder mergeFrom(com.google.protobuf.Message other) { - if (other instanceof com.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.PlayAudio) { + if (other instanceof com.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.MixedAudio) { return mergeFrom( - (com.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.PlayAudio) other); + (com.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.MixedAudio) other); } else { super.mergeFrom(other); return this; @@ -7081,16 +6811,36 @@ public Builder mergeFrom(com.google.protobuf.Message other) { } public Builder mergeFrom( - com.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.PlayAudio other) { + com.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.MixedAudio other) { if (other - == com.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.PlayAudio + == com.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.MixedAudio .getDefaultInstance()) return this; - if (!other.getAudioUri().isEmpty()) { - audioUri_ = other.audioUri_; - onChanged(); - } - if (other.getAllowPlaybackInterruption() != false) { - setAllowPlaybackInterruption(other.getAllowPlaybackInterruption()); + if (segmentsBuilder_ == null) { + if (!other.segments_.isEmpty()) { + if (segments_.isEmpty()) { + segments_ = other.segments_; + bitField0_ = (bitField0_ & ~0x00000001); + } else { + ensureSegmentsIsMutable(); + segments_.addAll(other.segments_); + } + onChanged(); + } + } else { + if (!other.segments_.isEmpty()) { + if (segmentsBuilder_.isEmpty()) { + segmentsBuilder_.dispose(); + segmentsBuilder_ = null; + segments_ = other.segments_; + bitField0_ = (bitField0_ & ~0x00000001); + segmentsBuilder_ = + com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders + ? getSegmentsFieldBuilder() + : null; + } else { + segmentsBuilder_.addAllMessages(other.segments_); + } + } } this.mergeUnknownFields(other.unknownFields); onChanged(); @@ -7107,12 +6857,12 @@ public Builder mergeFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { - com.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.PlayAudio parsedMessage = null; + com.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.MixedAudio parsedMessage = null; try { parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); } catch (com.google.protobuf.InvalidProtocolBufferException e) { parsedMessage = - (com.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.PlayAudio) + (com.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.MixedAudio) e.getUnfinishedMessage(); throw e.unwrapIOException(); } finally { @@ -7122,177 +6872,427 @@ public Builder mergeFrom( } return this; } - - private java.lang.Object audioUri_ = ""; + + private int bitField0_; + + private java.util.List< + com.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.MixedAudio.Segment> + segments_ = java.util.Collections.emptyList(); + + private void ensureSegmentsIsMutable() { + if (!((bitField0_ & 0x00000001) != 0)) { + segments_ = + new java.util.ArrayList< + com.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.MixedAudio.Segment>( + segments_); + bitField0_ |= 0x00000001; + } + } + + private com.google.protobuf.RepeatedFieldBuilderV3< + com.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.MixedAudio.Segment, + com.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.MixedAudio.Segment.Builder, + com.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.MixedAudio.SegmentOrBuilder> + segmentsBuilder_; + + /** + * + * + *
+       * Segments this audio response is composed of.
+       * 
+ * + * + * repeated .google.cloud.dialogflow.cx.v3beta1.ResponseMessage.MixedAudio.Segment segments = 1; + * + */ + public java.util.List< + com.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.MixedAudio.Segment> + getSegmentsList() { + if (segmentsBuilder_ == null) { + return java.util.Collections.unmodifiableList(segments_); + } else { + return segmentsBuilder_.getMessageList(); + } + } + /** + * + * + *
+       * Segments this audio response is composed of.
+       * 
+ * + * + * repeated .google.cloud.dialogflow.cx.v3beta1.ResponseMessage.MixedAudio.Segment segments = 1; + * + */ + public int getSegmentsCount() { + if (segmentsBuilder_ == null) { + return segments_.size(); + } else { + return segmentsBuilder_.getCount(); + } + } + /** + * + * + *
+       * Segments this audio response is composed of.
+       * 
+ * + * + * repeated .google.cloud.dialogflow.cx.v3beta1.ResponseMessage.MixedAudio.Segment segments = 1; + * + */ + public com.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.MixedAudio.Segment getSegments( + int index) { + if (segmentsBuilder_ == null) { + return segments_.get(index); + } else { + return segmentsBuilder_.getMessage(index); + } + } + /** + * + * + *
+       * Segments this audio response is composed of.
+       * 
+ * + * + * repeated .google.cloud.dialogflow.cx.v3beta1.ResponseMessage.MixedAudio.Segment segments = 1; + * + */ + public Builder setSegments( + int index, + com.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.MixedAudio.Segment value) { + if (segmentsBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureSegmentsIsMutable(); + segments_.set(index, value); + onChanged(); + } else { + segmentsBuilder_.setMessage(index, value); + } + return this; + } + /** + * + * + *
+       * Segments this audio response is composed of.
+       * 
+ * + * + * repeated .google.cloud.dialogflow.cx.v3beta1.ResponseMessage.MixedAudio.Segment segments = 1; + * + */ + public Builder setSegments( + int index, + com.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.MixedAudio.Segment.Builder + builderForValue) { + if (segmentsBuilder_ == null) { + ensureSegmentsIsMutable(); + segments_.set(index, builderForValue.build()); + onChanged(); + } else { + segmentsBuilder_.setMessage(index, builderForValue.build()); + } + return this; + } + /** + * + * + *
+       * Segments this audio response is composed of.
+       * 
+ * + * + * repeated .google.cloud.dialogflow.cx.v3beta1.ResponseMessage.MixedAudio.Segment segments = 1; + * + */ + public Builder addSegments( + com.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.MixedAudio.Segment value) { + if (segmentsBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureSegmentsIsMutable(); + segments_.add(value); + onChanged(); + } else { + segmentsBuilder_.addMessage(value); + } + return this; + } + /** + * + * + *
+       * Segments this audio response is composed of.
+       * 
+ * + * + * repeated .google.cloud.dialogflow.cx.v3beta1.ResponseMessage.MixedAudio.Segment segments = 1; + * + */ + public Builder addSegments( + int index, + com.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.MixedAudio.Segment value) { + if (segmentsBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureSegmentsIsMutable(); + segments_.add(index, value); + onChanged(); + } else { + segmentsBuilder_.addMessage(index, value); + } + return this; + } + /** + * + * + *
+       * Segments this audio response is composed of.
+       * 
+ * + * + * repeated .google.cloud.dialogflow.cx.v3beta1.ResponseMessage.MixedAudio.Segment segments = 1; + * + */ + public Builder addSegments( + com.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.MixedAudio.Segment.Builder + builderForValue) { + if (segmentsBuilder_ == null) { + ensureSegmentsIsMutable(); + segments_.add(builderForValue.build()); + onChanged(); + } else { + segmentsBuilder_.addMessage(builderForValue.build()); + } + return this; + } + /** + * + * + *
+       * Segments this audio response is composed of.
+       * 
+ * + * + * repeated .google.cloud.dialogflow.cx.v3beta1.ResponseMessage.MixedAudio.Segment segments = 1; + * + */ + public Builder addSegments( + int index, + com.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.MixedAudio.Segment.Builder + builderForValue) { + if (segmentsBuilder_ == null) { + ensureSegmentsIsMutable(); + segments_.add(index, builderForValue.build()); + onChanged(); + } else { + segmentsBuilder_.addMessage(index, builderForValue.build()); + } + return this; + } /** * * *
-       * Required. URI of the audio clip. Dialogflow does not impose any validation on this
-       * value. It is specific to the client that reads it.
+       * Segments this audio response is composed of.
        * 
* - * string audio_uri = 1 [(.google.api.field_behavior) = REQUIRED]; - * - * @return The audioUri. + * + * repeated .google.cloud.dialogflow.cx.v3beta1.ResponseMessage.MixedAudio.Segment segments = 1; + * */ - public java.lang.String getAudioUri() { - java.lang.Object ref = audioUri_; - if (!(ref instanceof java.lang.String)) { - com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; - java.lang.String s = bs.toStringUtf8(); - audioUri_ = s; - return s; + public Builder addAllSegments( + java.lang.Iterable< + ? extends + com.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.MixedAudio.Segment> + values) { + if (segmentsBuilder_ == null) { + ensureSegmentsIsMutable(); + com.google.protobuf.AbstractMessageLite.Builder.addAll(values, segments_); + onChanged(); } else { - return (java.lang.String) ref; + segmentsBuilder_.addAllMessages(values); } + return this; } /** * * *
-       * Required. URI of the audio clip. Dialogflow does not impose any validation on this
-       * value. It is specific to the client that reads it.
+       * Segments this audio response is composed of.
        * 
* - * string audio_uri = 1 [(.google.api.field_behavior) = REQUIRED]; - * - * @return The bytes for audioUri. + * + * repeated .google.cloud.dialogflow.cx.v3beta1.ResponseMessage.MixedAudio.Segment segments = 1; + * */ - public com.google.protobuf.ByteString getAudioUriBytes() { - java.lang.Object ref = audioUri_; - if (ref instanceof String) { - com.google.protobuf.ByteString b = - com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); - audioUri_ = b; - return b; + public Builder clearSegments() { + if (segmentsBuilder_ == null) { + segments_ = java.util.Collections.emptyList(); + bitField0_ = (bitField0_ & ~0x00000001); + onChanged(); } else { - return (com.google.protobuf.ByteString) ref; + segmentsBuilder_.clear(); } + return this; } /** * * *
-       * Required. URI of the audio clip. Dialogflow does not impose any validation on this
-       * value. It is specific to the client that reads it.
+       * Segments this audio response is composed of.
        * 
* - * string audio_uri = 1 [(.google.api.field_behavior) = REQUIRED]; - * - * @param value The audioUri to set. - * @return This builder for chaining. + * + * repeated .google.cloud.dialogflow.cx.v3beta1.ResponseMessage.MixedAudio.Segment segments = 1; + * */ - public Builder setAudioUri(java.lang.String value) { - if (value == null) { - throw new NullPointerException(); + public Builder removeSegments(int index) { + if (segmentsBuilder_ == null) { + ensureSegmentsIsMutable(); + segments_.remove(index); + onChanged(); + } else { + segmentsBuilder_.remove(index); } - - audioUri_ = value; - onChanged(); return this; } /** * * *
-       * Required. URI of the audio clip. Dialogflow does not impose any validation on this
-       * value. It is specific to the client that reads it.
+       * Segments this audio response is composed of.
        * 
* - * string audio_uri = 1 [(.google.api.field_behavior) = REQUIRED]; - * - * @return This builder for chaining. + * + * repeated .google.cloud.dialogflow.cx.v3beta1.ResponseMessage.MixedAudio.Segment segments = 1; + * */ - public Builder clearAudioUri() { - - audioUri_ = getDefaultInstance().getAudioUri(); - onChanged(); - return this; + public com.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.MixedAudio.Segment.Builder + getSegmentsBuilder(int index) { + return getSegmentsFieldBuilder().getBuilder(index); } /** * * *
-       * Required. URI of the audio clip. Dialogflow does not impose any validation on this
-       * value. It is specific to the client that reads it.
+       * Segments this audio response is composed of.
        * 
* - * string audio_uri = 1 [(.google.api.field_behavior) = REQUIRED]; - * - * @param value The bytes for audioUri to set. - * @return This builder for chaining. + * + * repeated .google.cloud.dialogflow.cx.v3beta1.ResponseMessage.MixedAudio.Segment segments = 1; + * */ - public Builder setAudioUriBytes(com.google.protobuf.ByteString value) { - if (value == null) { - throw new NullPointerException(); + public com.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.MixedAudio.SegmentOrBuilder + getSegmentsOrBuilder(int index) { + if (segmentsBuilder_ == null) { + return segments_.get(index); + } else { + return segmentsBuilder_.getMessageOrBuilder(index); } - checkByteStringIsUtf8(value); - - audioUri_ = value; - onChanged(); - return this; } - - private boolean allowPlaybackInterruption_; /** * * *
-       * Output only. Whether the playback of this message can be interrupted by the end
-       * user's speech and the client can then starts the next Dialogflow
-       * request.
+       * Segments this audio response is composed of.
        * 
* - * bool allow_playback_interruption = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * repeated .google.cloud.dialogflow.cx.v3beta1.ResponseMessage.MixedAudio.Segment segments = 1; * - * - * @return The allowPlaybackInterruption. */ - @java.lang.Override - public boolean getAllowPlaybackInterruption() { - return allowPlaybackInterruption_; + public java.util.List< + ? extends + com.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.MixedAudio + .SegmentOrBuilder> + getSegmentsOrBuilderList() { + if (segmentsBuilder_ != null) { + return segmentsBuilder_.getMessageOrBuilderList(); + } else { + return java.util.Collections.unmodifiableList(segments_); + } } /** * * *
-       * Output only. Whether the playback of this message can be interrupted by the end
-       * user's speech and the client can then starts the next Dialogflow
-       * request.
+       * Segments this audio response is composed of.
        * 
* - * bool allow_playback_interruption = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * repeated .google.cloud.dialogflow.cx.v3beta1.ResponseMessage.MixedAudio.Segment segments = 1; * - * - * @param value The allowPlaybackInterruption to set. - * @return This builder for chaining. */ - public Builder setAllowPlaybackInterruption(boolean value) { - - allowPlaybackInterruption_ = value; - onChanged(); - return this; + public com.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.MixedAudio.Segment.Builder + addSegmentsBuilder() { + return getSegmentsFieldBuilder() + .addBuilder( + com.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.MixedAudio.Segment + .getDefaultInstance()); } /** * * *
-       * Output only. Whether the playback of this message can be interrupted by the end
-       * user's speech and the client can then starts the next Dialogflow
-       * request.
+       * Segments this audio response is composed of.
        * 
* - * bool allow_playback_interruption = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * repeated .google.cloud.dialogflow.cx.v3beta1.ResponseMessage.MixedAudio.Segment segments = 1; * + */ + public com.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.MixedAudio.Segment.Builder + addSegmentsBuilder(int index) { + return getSegmentsFieldBuilder() + .addBuilder( + index, + com.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.MixedAudio.Segment + .getDefaultInstance()); + } + /** * - * @return This builder for chaining. + * + *
+       * Segments this audio response is composed of.
+       * 
+ * + * + * repeated .google.cloud.dialogflow.cx.v3beta1.ResponseMessage.MixedAudio.Segment segments = 1; + * */ - public Builder clearAllowPlaybackInterruption() { + public java.util.List< + com.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.MixedAudio.Segment.Builder> + getSegmentsBuilderList() { + return getSegmentsFieldBuilder().getBuilderList(); + } - allowPlaybackInterruption_ = false; - onChanged(); - return this; + private com.google.protobuf.RepeatedFieldBuilderV3< + com.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.MixedAudio.Segment, + com.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.MixedAudio.Segment.Builder, + com.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.MixedAudio.SegmentOrBuilder> + getSegmentsFieldBuilder() { + if (segmentsBuilder_ == null) { + segmentsBuilder_ = + new com.google.protobuf.RepeatedFieldBuilderV3< + com.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.MixedAudio.Segment, + com.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.MixedAudio.Segment.Builder, + com.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.MixedAudio + .SegmentOrBuilder>( + segments_, ((bitField0_ & 0x00000001) != 0), getParentForChildren(), isClean()); + segments_ = null; + } + return segmentsBuilder_; } @java.lang.Override @@ -7307,44 +7307,44 @@ public final Builder mergeUnknownFields( return super.mergeUnknownFields(unknownFields); } - // @@protoc_insertion_point(builder_scope:google.cloud.dialogflow.cx.v3beta1.ResponseMessage.PlayAudio) + // @@protoc_insertion_point(builder_scope:google.cloud.dialogflow.cx.v3beta1.ResponseMessage.MixedAudio) } - // @@protoc_insertion_point(class_scope:google.cloud.dialogflow.cx.v3beta1.ResponseMessage.PlayAudio) - private static final com.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.PlayAudio + // @@protoc_insertion_point(class_scope:google.cloud.dialogflow.cx.v3beta1.ResponseMessage.MixedAudio) + private static final com.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.MixedAudio DEFAULT_INSTANCE; static { - DEFAULT_INSTANCE = new com.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.PlayAudio(); + DEFAULT_INSTANCE = new com.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.MixedAudio(); } - public static com.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.PlayAudio + public static com.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.MixedAudio getDefaultInstance() { return DEFAULT_INSTANCE; } - private static final com.google.protobuf.Parser PARSER = - new com.google.protobuf.AbstractParser() { + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { @java.lang.Override - public PlayAudio parsePartialFrom( + public MixedAudio parsePartialFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { - return new PlayAudio(input, extensionRegistry); + return new MixedAudio(input, extensionRegistry); } }; - public static com.google.protobuf.Parser parser() { + public static com.google.protobuf.Parser parser() { return PARSER; } @java.lang.Override - public com.google.protobuf.Parser getParserForType() { + public com.google.protobuf.Parser getParserForType() { return PARSER; } @java.lang.Override - public com.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.PlayAudio + public com.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.MixedAudio getDefaultInstanceForType() { return DEFAULT_INSTANCE; } diff --git a/proto-google-cloud-dialogflow-cx-v3beta1/src/main/java/com/google/cloud/dialogflow/cx/v3beta1/ResponseMessageProto.java b/proto-google-cloud-dialogflow-cx-v3beta1/src/main/java/com/google/cloud/dialogflow/cx/v3beta1/ResponseMessageProto.java index c7d6ed8c8..81a007d29 100644 --- a/proto-google-cloud-dialogflow-cx-v3beta1/src/main/java/com/google/cloud/dialogflow/cx/v3beta1/ResponseMessageProto.java +++ b/proto-google-cloud-dialogflow-cx-v3beta1/src/main/java/com/google/cloud/dialogflow/cx/v3beta1/ResponseMessageProto.java @@ -48,21 +48,21 @@ public static void registerAllExtensions(com.google.protobuf.ExtensionRegistry r static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internal_static_google_cloud_dialogflow_cx_v3beta1_ResponseMessage_OutputAudioText_fieldAccessorTable; static final com.google.protobuf.Descriptors.Descriptor - internal_static_google_cloud_dialogflow_cx_v3beta1_ResponseMessage_MixedAudio_descriptor; - static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable - internal_static_google_cloud_dialogflow_cx_v3beta1_ResponseMessage_MixedAudio_fieldAccessorTable; - static final com.google.protobuf.Descriptors.Descriptor - internal_static_google_cloud_dialogflow_cx_v3beta1_ResponseMessage_MixedAudio_Segment_descriptor; + internal_static_google_cloud_dialogflow_cx_v3beta1_ResponseMessage_PlayAudio_descriptor; static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable - internal_static_google_cloud_dialogflow_cx_v3beta1_ResponseMessage_MixedAudio_Segment_fieldAccessorTable; + internal_static_google_cloud_dialogflow_cx_v3beta1_ResponseMessage_PlayAudio_fieldAccessorTable; static final com.google.protobuf.Descriptors.Descriptor internal_static_google_cloud_dialogflow_cx_v3beta1_ResponseMessage_EndInteraction_descriptor; static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internal_static_google_cloud_dialogflow_cx_v3beta1_ResponseMessage_EndInteraction_fieldAccessorTable; static final com.google.protobuf.Descriptors.Descriptor - internal_static_google_cloud_dialogflow_cx_v3beta1_ResponseMessage_PlayAudio_descriptor; + internal_static_google_cloud_dialogflow_cx_v3beta1_ResponseMessage_MixedAudio_descriptor; static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable - internal_static_google_cloud_dialogflow_cx_v3beta1_ResponseMessage_PlayAudio_fieldAccessorTable; + internal_static_google_cloud_dialogflow_cx_v3beta1_ResponseMessage_MixedAudio_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_cloud_dialogflow_cx_v3beta1_ResponseMessage_MixedAudio_Segment_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_cloud_dialogflow_cx_v3beta1_ResponseMessage_MixedAudio_Segment_fieldAccessorTable; public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { return descriptor; @@ -102,14 +102,14 @@ public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { + "\027.google.protobuf.Struct\032e\n\017OutputAudioT" + "ext\022\016\n\004text\030\001 \001(\tH\000\022\016\n\004ssml\030\002 \001(\tH\000\022(\n\033a" + "llow_playback_interruption\030\003 \001(\010B\003\340A\003B\010\n" - + "\006source\032\306\001\n\nMixedAudio\022X\n\010segments\030\001 \003(\013" - + "2F.google.cloud.dialogflow.cx.v3beta1.Re" - + "sponseMessage.MixedAudio.Segment\032^\n\007Segm" - + "ent\022\017\n\005audio\030\001 \001(\014H\000\022\r\n\003uri\030\002 \001(\tH\000\022(\n\033a" - + "llow_playback_interruption\030\003 \001(\010B\003\340A\003B\t\n" - + "\007content\032\020\n\016EndInteraction\032M\n\tPlayAudio\022" - + "\026\n\taudio_uri\030\001 \001(\tB\003\340A\002\022(\n\033allow_playbac" - + "k_interruption\030\002 \001(\010B\003\340A\003B\t\n\007messageB\263\001\n" + + "\006source\032M\n\tPlayAudio\022\026\n\taudio_uri\030\001 \001(\tB" + + "\003\340A\002\022(\n\033allow_playback_interruption\030\002 \001(" + + "\010B\003\340A\003\032\020\n\016EndInteraction\032\306\001\n\nMixedAudio\022" + + "X\n\010segments\030\001 \003(\0132F.google.cloud.dialogf" + + "low.cx.v3beta1.ResponseMessage.MixedAudi" + + "o.Segment\032^\n\007Segment\022\017\n\005audio\030\001 \001(\014H\000\022\r\n" + + "\003uri\030\002 \001(\tH\000\022(\n\033allow_playback_interrupt" + + "ion\030\003 \001(\010B\003\340A\003B\t\n\007contentB\t\n\007messageB\263\001\n" + "&com.google.cloud.dialogflow.cx.v3beta1B" + "\024ResponseMessageProtoP\001ZDgoogle.golang.o" + "rg/genproto/googleapis/cloud/dialogflow/" @@ -180,25 +180,15 @@ public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { new java.lang.String[] { "Text", "Ssml", "AllowPlaybackInterruption", "Source", }); - internal_static_google_cloud_dialogflow_cx_v3beta1_ResponseMessage_MixedAudio_descriptor = + internal_static_google_cloud_dialogflow_cx_v3beta1_ResponseMessage_PlayAudio_descriptor = internal_static_google_cloud_dialogflow_cx_v3beta1_ResponseMessage_descriptor .getNestedTypes() .get(4); - internal_static_google_cloud_dialogflow_cx_v3beta1_ResponseMessage_MixedAudio_fieldAccessorTable = - new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( - internal_static_google_cloud_dialogflow_cx_v3beta1_ResponseMessage_MixedAudio_descriptor, - new java.lang.String[] { - "Segments", - }); - internal_static_google_cloud_dialogflow_cx_v3beta1_ResponseMessage_MixedAudio_Segment_descriptor = - internal_static_google_cloud_dialogflow_cx_v3beta1_ResponseMessage_MixedAudio_descriptor - .getNestedTypes() - .get(0); - internal_static_google_cloud_dialogflow_cx_v3beta1_ResponseMessage_MixedAudio_Segment_fieldAccessorTable = + internal_static_google_cloud_dialogflow_cx_v3beta1_ResponseMessage_PlayAudio_fieldAccessorTable = new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( - internal_static_google_cloud_dialogflow_cx_v3beta1_ResponseMessage_MixedAudio_Segment_descriptor, + internal_static_google_cloud_dialogflow_cx_v3beta1_ResponseMessage_PlayAudio_descriptor, new java.lang.String[] { - "Audio", "Uri", "AllowPlaybackInterruption", "Content", + "AudioUri", "AllowPlaybackInterruption", }); internal_static_google_cloud_dialogflow_cx_v3beta1_ResponseMessage_EndInteraction_descriptor = internal_static_google_cloud_dialogflow_cx_v3beta1_ResponseMessage_descriptor @@ -208,15 +198,25 @@ public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( internal_static_google_cloud_dialogflow_cx_v3beta1_ResponseMessage_EndInteraction_descriptor, new java.lang.String[] {}); - internal_static_google_cloud_dialogflow_cx_v3beta1_ResponseMessage_PlayAudio_descriptor = + internal_static_google_cloud_dialogflow_cx_v3beta1_ResponseMessage_MixedAudio_descriptor = internal_static_google_cloud_dialogflow_cx_v3beta1_ResponseMessage_descriptor .getNestedTypes() .get(6); - internal_static_google_cloud_dialogflow_cx_v3beta1_ResponseMessage_PlayAudio_fieldAccessorTable = + internal_static_google_cloud_dialogflow_cx_v3beta1_ResponseMessage_MixedAudio_fieldAccessorTable = new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( - internal_static_google_cloud_dialogflow_cx_v3beta1_ResponseMessage_PlayAudio_descriptor, + internal_static_google_cloud_dialogflow_cx_v3beta1_ResponseMessage_MixedAudio_descriptor, new java.lang.String[] { - "AudioUri", "AllowPlaybackInterruption", + "Segments", + }); + internal_static_google_cloud_dialogflow_cx_v3beta1_ResponseMessage_MixedAudio_Segment_descriptor = + internal_static_google_cloud_dialogflow_cx_v3beta1_ResponseMessage_MixedAudio_descriptor + .getNestedTypes() + .get(0); + internal_static_google_cloud_dialogflow_cx_v3beta1_ResponseMessage_MixedAudio_Segment_fieldAccessorTable = + new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_google_cloud_dialogflow_cx_v3beta1_ResponseMessage_MixedAudio_Segment_descriptor, + new java.lang.String[] { + "Audio", "Uri", "AllowPlaybackInterruption", "Content", }); com.google.protobuf.ExtensionRegistry registry = com.google.protobuf.ExtensionRegistry.newInstance(); diff --git a/proto-google-cloud-dialogflow-cx-v3beta1/src/main/java/com/google/cloud/dialogflow/cx/v3beta1/SessionEntityTypeName.java b/proto-google-cloud-dialogflow-cx-v3beta1/src/main/java/com/google/cloud/dialogflow/cx/v3beta1/SessionEntityTypeName.java index 85ff5e53e..fdce63a97 100644 --- a/proto-google-cloud-dialogflow-cx-v3beta1/src/main/java/com/google/cloud/dialogflow/cx/v3beta1/SessionEntityTypeName.java +++ b/proto-google-cloud-dialogflow-cx-v3beta1/src/main/java/com/google/cloud/dialogflow/cx/v3beta1/SessionEntityTypeName.java @@ -5,7 +5,7 @@ * 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 + * 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, @@ -26,32 +26,56 @@ import java.util.List; import java.util.Map; import java.util.Objects; +import javax.annotation.Generated; -/** AUTO-GENERATED DOCUMENTATION AND CLASS */ -@javax.annotation.Generated("by GAPIC protoc plugin") +// AUTO-GENERATED DOCUMENTATION AND CLASS. +@Generated("by gapic-generator-java") public class SessionEntityTypeName implements ResourceName { - - @Deprecated - protected SessionEntityTypeName() {} - - private static final PathTemplate PROJECT_LOCATION_AGENT_SESSION_ENTITY_TYPE_PATH_TEMPLATE = + private static final PathTemplate PROJECT_LOCATION_AGENT_SESSION_ENTITY_TYPE = PathTemplate.createWithoutUrlEncoding( "projects/{project}/locations/{location}/agents/{agent}/sessions/{session}/entityTypes/{entity_type}"); - private static final PathTemplate - PROJECT_LOCATION_AGENT_ENVIRONMENT_SESSION_ENTITY_TYPE_PATH_TEMPLATE = - PathTemplate.createWithoutUrlEncoding( - "projects/{project}/locations/{location}/agents/{agent}/environments/{environment}/sessions/{session}/entityTypes/{entity_type}"); - + private static final PathTemplate PROJECT_LOCATION_AGENT_ENVIRONMENT_SESSION_ENTITY_TYPE = + PathTemplate.createWithoutUrlEncoding( + "projects/{project}/locations/{location}/agents/{agent}/environments/{environment}/sessions/{session}/entityTypes/{entity_type}"); private volatile Map fieldValuesMap; private PathTemplate pathTemplate; private String fixedValue; + private final String project; + private final String location; + private final String agent; + private final String session; + private final String entityType; + private final String environment; - private String project; - private String location; - private String agent; - private String session; - private String entityType; - private String environment; + @Deprecated + protected SessionEntityTypeName() { + project = null; + location = null; + agent = null; + session = null; + entityType = null; + environment = null; + } + + private SessionEntityTypeName(Builder builder) { + project = Preconditions.checkNotNull(builder.getProject()); + location = Preconditions.checkNotNull(builder.getLocation()); + agent = Preconditions.checkNotNull(builder.getAgent()); + session = Preconditions.checkNotNull(builder.getSession()); + entityType = Preconditions.checkNotNull(builder.getEntityType()); + environment = null; + pathTemplate = PROJECT_LOCATION_AGENT_SESSION_ENTITY_TYPE; + } + + private SessionEntityTypeName(ProjectLocationAgentEnvironmentSessionEntityTypeBuilder builder) { + project = Preconditions.checkNotNull(builder.getProject()); + location = Preconditions.checkNotNull(builder.getLocation()); + agent = Preconditions.checkNotNull(builder.getAgent()); + environment = Preconditions.checkNotNull(builder.getEnvironment()); + session = Preconditions.checkNotNull(builder.getSession()); + entityType = Preconditions.checkNotNull(builder.getEntityType()); + pathTemplate = PROJECT_LOCATION_AGENT_ENVIRONMENT_SESSION_ENTITY_TYPE; + } public String getProject() { return project; @@ -77,25 +101,6 @@ public String getEnvironment() { return environment; } - private SessionEntityTypeName(Builder builder) { - project = Preconditions.checkNotNull(builder.getProject()); - location = Preconditions.checkNotNull(builder.getLocation()); - agent = Preconditions.checkNotNull(builder.getAgent()); - session = Preconditions.checkNotNull(builder.getSession()); - entityType = Preconditions.checkNotNull(builder.getEntityType()); - pathTemplate = PROJECT_LOCATION_AGENT_SESSION_ENTITY_TYPE_PATH_TEMPLATE; - } - - private SessionEntityTypeName(ProjectLocationAgentEnvironmentSessionEntityTypeBuilder builder) { - project = Preconditions.checkNotNull(builder.getProject()); - location = Preconditions.checkNotNull(builder.getLocation()); - agent = Preconditions.checkNotNull(builder.getAgent()); - environment = Preconditions.checkNotNull(builder.getEnvironment()); - session = Preconditions.checkNotNull(builder.getSession()); - entityType = Preconditions.checkNotNull(builder.getEntityType()); - pathTemplate = PROJECT_LOCATION_AGENT_ENVIRONMENT_SESSION_ENTITY_TYPE_PATH_TEMPLATE; - } - public static Builder newBuilder() { return new Builder(); } @@ -117,7 +122,7 @@ public Builder toBuilder() { public static SessionEntityTypeName of( String project, String location, String agent, String session, String entityType) { - return newProjectLocationAgentSessionEntityTypeBuilder() + return newBuilder() .setProject(project) .setLocation(location) .setAgent(agent) @@ -129,7 +134,7 @@ public static SessionEntityTypeName of( @BetaApi("The static create methods are not stable yet and may be changed in the future.") public static SessionEntityTypeName ofProjectLocationAgentSessionEntityTypeName( String project, String location, String agent, String session, String entityType) { - return newProjectLocationAgentSessionEntityTypeBuilder() + return newBuilder() .setProject(project) .setLocation(location) .setAgent(agent) @@ -204,20 +209,18 @@ public static SessionEntityTypeName parse(String formattedString) { if (formattedString.isEmpty()) { return null; } - if (PROJECT_LOCATION_AGENT_SESSION_ENTITY_TYPE_PATH_TEMPLATE.matches(formattedString)) { + if (PROJECT_LOCATION_AGENT_SESSION_ENTITY_TYPE.matches(formattedString)) { Map matchMap = - PROJECT_LOCATION_AGENT_SESSION_ENTITY_TYPE_PATH_TEMPLATE.match(formattedString); + PROJECT_LOCATION_AGENT_SESSION_ENTITY_TYPE.match(formattedString); return ofProjectLocationAgentSessionEntityTypeName( matchMap.get("project"), matchMap.get("location"), matchMap.get("agent"), matchMap.get("session"), matchMap.get("entity_type")); - } else if (PROJECT_LOCATION_AGENT_ENVIRONMENT_SESSION_ENTITY_TYPE_PATH_TEMPLATE.matches( - formattedString)) { + } else if (PROJECT_LOCATION_AGENT_ENVIRONMENT_SESSION_ENTITY_TYPE.matches(formattedString)) { Map matchMap = - PROJECT_LOCATION_AGENT_ENVIRONMENT_SESSION_ENTITY_TYPE_PATH_TEMPLATE.match( - formattedString); + PROJECT_LOCATION_AGENT_ENVIRONMENT_SESSION_ENTITY_TYPE.match(formattedString); return ofProjectLocationAgentEnvironmentSessionEntityTypeName( matchMap.get("project"), matchMap.get("location"), @@ -226,7 +229,8 @@ public static SessionEntityTypeName parse(String formattedString) { matchMap.get("session"), matchMap.get("entity_type")); } - throw new ValidationException("JobName.parse: formattedString not in valid format"); + throw new ValidationException( + "SessionEntityTypeName.parse: formattedString not in valid format"); } public static List parseList(List formattedStrings) { @@ -250,9 +254,8 @@ public static List toStringList(List values) { } public static boolean isParsableFrom(String formattedString) { - return PROJECT_LOCATION_AGENT_SESSION_ENTITY_TYPE_PATH_TEMPLATE.matches(formattedString) - || PROJECT_LOCATION_AGENT_ENVIRONMENT_SESSION_ENTITY_TYPE_PATH_TEMPLATE.matches( - formattedString); + return PROJECT_LOCATION_AGENT_SESSION_ENTITY_TYPE.matches(formattedString) + || PROJECT_LOCATION_AGENT_ENVIRONMENT_SESSION_ENTITY_TYPE.matches(formattedString); } @Override @@ -295,12 +298,48 @@ public String toString() { return fixedValue != null ? fixedValue : pathTemplate.instantiate(getFieldValuesMap()); } + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o != null || getClass() == o.getClass()) { + SessionEntityTypeName that = ((SessionEntityTypeName) o); + return Objects.equals(this.project, that.project) + && Objects.equals(this.location, that.location) + && Objects.equals(this.agent, that.agent) + && Objects.equals(this.session, that.session) + && Objects.equals(this.entityType, that.entityType) + && Objects.equals(this.environment, that.environment); + } + return false; + } + + @Override + public int hashCode() { + int h = 1; + h *= 1000003; + h ^= Objects.hashCode(fixedValue); + h *= 1000003; + h ^= Objects.hashCode(project); + h *= 1000003; + h ^= Objects.hashCode(location); + h *= 1000003; + h ^= Objects.hashCode(agent); + h *= 1000003; + h ^= Objects.hashCode(session); + h *= 1000003; + h ^= Objects.hashCode(entityType); + h *= 1000003; + h ^= Objects.hashCode(environment); + return h; + } + /** * Builder for * projects/{project}/locations/{location}/agents/{agent}/sessions/{session}/entityTypes/{entity_type}. */ public static class Builder { - private String project; private String location; private String agent; @@ -356,10 +395,9 @@ public Builder setEntityType(String entityType) { private Builder(SessionEntityTypeName sessionEntityTypeName) { Preconditions.checkArgument( - sessionEntityTypeName.pathTemplate - == PROJECT_LOCATION_AGENT_SESSION_ENTITY_TYPE_PATH_TEMPLATE, - "toBuilder is only supported when SessionEntityTypeName has the pattern of " - + "projects/{project}/locations/{location}/agents/{agent}/sessions/{session}/entityTypes/{entity_type}."); + Objects.equals( + sessionEntityTypeName.pathTemplate, PROJECT_LOCATION_AGENT_SESSION_ENTITY_TYPE), + "toBuilder is only supported when SessionEntityTypeName has the pattern of projects/{project}/locations/{location}/agents/{agent}/sessions/{session}/entityTypes/{entity_type}"); project = sessionEntityTypeName.project; location = sessionEntityTypeName.location; agent = sessionEntityTypeName.agent; @@ -378,7 +416,6 @@ public SessionEntityTypeName build() { */ @BetaApi("The per-pattern Builders are not stable yet and may be changed in the future.") public static class ProjectLocationAgentEnvironmentSessionEntityTypeBuilder { - private String project; private String location; private String agent; @@ -386,7 +423,7 @@ public static class ProjectLocationAgentEnvironmentSessionEntityTypeBuilder { private String session; private String entityType; - private ProjectLocationAgentEnvironmentSessionEntityTypeBuilder() {} + protected ProjectLocationAgentEnvironmentSessionEntityTypeBuilder() {} public String getProject() { return project; @@ -448,41 +485,4 @@ public SessionEntityTypeName build() { return new SessionEntityTypeName(this); } } - - @Override - public boolean equals(Object o) { - if (o == this) { - return true; - } - if (o != null || getClass() == o.getClass()) { - SessionEntityTypeName that = (SessionEntityTypeName) o; - return (Objects.equals(this.project, that.project)) - && (Objects.equals(this.location, that.location)) - && (Objects.equals(this.agent, that.agent)) - && (Objects.equals(this.session, that.session)) - && (Objects.equals(this.entityType, that.entityType)) - && (Objects.equals(this.environment, that.environment)); - } - return false; - } - - @Override - public int hashCode() { - int h = 1; - h *= 1000003; - h ^= Objects.hashCode(fixedValue); - h *= 1000003; - h ^= Objects.hashCode(project); - h *= 1000003; - h ^= Objects.hashCode(location); - h *= 1000003; - h ^= Objects.hashCode(agent); - h *= 1000003; - h ^= Objects.hashCode(session); - h *= 1000003; - h ^= Objects.hashCode(entityType); - h *= 1000003; - h ^= Objects.hashCode(environment); - return h; - } } diff --git a/proto-google-cloud-dialogflow-cx-v3beta1/src/main/java/com/google/cloud/dialogflow/cx/v3beta1/SessionName.java b/proto-google-cloud-dialogflow-cx-v3beta1/src/main/java/com/google/cloud/dialogflow/cx/v3beta1/SessionName.java index f97656188..6fe145f31 100644 --- a/proto-google-cloud-dialogflow-cx-v3beta1/src/main/java/com/google/cloud/dialogflow/cx/v3beta1/SessionName.java +++ b/proto-google-cloud-dialogflow-cx-v3beta1/src/main/java/com/google/cloud/dialogflow/cx/v3beta1/SessionName.java @@ -5,7 +5,7 @@ * 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 + * 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, @@ -26,30 +26,52 @@ import java.util.List; import java.util.Map; import java.util.Objects; +import javax.annotation.Generated; -/** AUTO-GENERATED DOCUMENTATION AND CLASS */ -@javax.annotation.Generated("by GAPIC protoc plugin") +// AUTO-GENERATED DOCUMENTATION AND CLASS. +@Generated("by gapic-generator-java") public class SessionName implements ResourceName { - - @Deprecated - protected SessionName() {} - - private static final PathTemplate PROJECT_LOCATION_AGENT_SESSION_PATH_TEMPLATE = + private static final PathTemplate PROJECT_LOCATION_AGENT_SESSION = PathTemplate.createWithoutUrlEncoding( "projects/{project}/locations/{location}/agents/{agent}/sessions/{session}"); - private static final PathTemplate PROJECT_LOCATION_AGENT_ENVIRONMENT_SESSION_PATH_TEMPLATE = + private static final PathTemplate PROJECT_LOCATION_AGENT_ENVIRONMENT_SESSION = PathTemplate.createWithoutUrlEncoding( "projects/{project}/locations/{location}/agents/{agent}/environments/{environment}/sessions/{session}"); - private volatile Map fieldValuesMap; private PathTemplate pathTemplate; private String fixedValue; + private final String project; + private final String location; + private final String agent; + private final String session; + private final String environment; + + @Deprecated + protected SessionName() { + project = null; + location = null; + agent = null; + session = null; + environment = null; + } - private String project; - private String location; - private String agent; - private String session; - private String environment; + private SessionName(Builder builder) { + project = Preconditions.checkNotNull(builder.getProject()); + location = Preconditions.checkNotNull(builder.getLocation()); + agent = Preconditions.checkNotNull(builder.getAgent()); + session = Preconditions.checkNotNull(builder.getSession()); + environment = null; + pathTemplate = PROJECT_LOCATION_AGENT_SESSION; + } + + private SessionName(ProjectLocationAgentEnvironmentSessionBuilder builder) { + project = Preconditions.checkNotNull(builder.getProject()); + location = Preconditions.checkNotNull(builder.getLocation()); + agent = Preconditions.checkNotNull(builder.getAgent()); + environment = Preconditions.checkNotNull(builder.getEnvironment()); + session = Preconditions.checkNotNull(builder.getSession()); + pathTemplate = PROJECT_LOCATION_AGENT_ENVIRONMENT_SESSION; + } public String getProject() { return project; @@ -71,23 +93,6 @@ public String getEnvironment() { return environment; } - private SessionName(Builder builder) { - project = Preconditions.checkNotNull(builder.getProject()); - location = Preconditions.checkNotNull(builder.getLocation()); - agent = Preconditions.checkNotNull(builder.getAgent()); - session = Preconditions.checkNotNull(builder.getSession()); - pathTemplate = PROJECT_LOCATION_AGENT_SESSION_PATH_TEMPLATE; - } - - private SessionName(ProjectLocationAgentEnvironmentSessionBuilder builder) { - project = Preconditions.checkNotNull(builder.getProject()); - location = Preconditions.checkNotNull(builder.getLocation()); - agent = Preconditions.checkNotNull(builder.getAgent()); - environment = Preconditions.checkNotNull(builder.getEnvironment()); - session = Preconditions.checkNotNull(builder.getSession()); - pathTemplate = PROJECT_LOCATION_AGENT_ENVIRONMENT_SESSION_PATH_TEMPLATE; - } - public static Builder newBuilder() { return new Builder(); } @@ -108,7 +113,7 @@ public Builder toBuilder() { } public static SessionName of(String project, String location, String agent, String session) { - return newProjectLocationAgentSessionBuilder() + return newBuilder() .setProject(project) .setLocation(location) .setAgent(agent) @@ -119,7 +124,7 @@ public static SessionName of(String project, String location, String agent, Stri @BetaApi("The static create methods are not stable yet and may be changed in the future.") public static SessionName ofProjectLocationAgentSessionName( String project, String location, String agent, String session) { - return newProjectLocationAgentSessionBuilder() + return newBuilder() .setProject(project) .setLocation(location) .setAgent(agent) @@ -178,17 +183,16 @@ public static SessionName parse(String formattedString) { if (formattedString.isEmpty()) { return null; } - if (PROJECT_LOCATION_AGENT_SESSION_PATH_TEMPLATE.matches(formattedString)) { - Map matchMap = - PROJECT_LOCATION_AGENT_SESSION_PATH_TEMPLATE.match(formattedString); + if (PROJECT_LOCATION_AGENT_SESSION.matches(formattedString)) { + Map matchMap = PROJECT_LOCATION_AGENT_SESSION.match(formattedString); return ofProjectLocationAgentSessionName( matchMap.get("project"), matchMap.get("location"), matchMap.get("agent"), matchMap.get("session")); - } else if (PROJECT_LOCATION_AGENT_ENVIRONMENT_SESSION_PATH_TEMPLATE.matches(formattedString)) { + } else if (PROJECT_LOCATION_AGENT_ENVIRONMENT_SESSION.matches(formattedString)) { Map matchMap = - PROJECT_LOCATION_AGENT_ENVIRONMENT_SESSION_PATH_TEMPLATE.match(formattedString); + PROJECT_LOCATION_AGENT_ENVIRONMENT_SESSION.match(formattedString); return ofProjectLocationAgentEnvironmentSessionName( matchMap.get("project"), matchMap.get("location"), @@ -196,7 +200,7 @@ public static SessionName parse(String formattedString) { matchMap.get("environment"), matchMap.get("session")); } - throw new ValidationException("JobName.parse: formattedString not in valid format"); + throw new ValidationException("SessionName.parse: formattedString not in valid format"); } public static List parseList(List formattedStrings) { @@ -220,8 +224,8 @@ public static List toStringList(List values) { } public static boolean isParsableFrom(String formattedString) { - return PROJECT_LOCATION_AGENT_SESSION_PATH_TEMPLATE.matches(formattedString) - || PROJECT_LOCATION_AGENT_ENVIRONMENT_SESSION_PATH_TEMPLATE.matches(formattedString); + return PROJECT_LOCATION_AGENT_SESSION.matches(formattedString) + || PROJECT_LOCATION_AGENT_ENVIRONMENT_SESSION.matches(formattedString); } @Override @@ -261,9 +265,42 @@ public String toString() { return fixedValue != null ? fixedValue : pathTemplate.instantiate(getFieldValuesMap()); } + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o != null || getClass() == o.getClass()) { + SessionName that = ((SessionName) o); + return Objects.equals(this.project, that.project) + && Objects.equals(this.location, that.location) + && Objects.equals(this.agent, that.agent) + && Objects.equals(this.session, that.session) + && Objects.equals(this.environment, that.environment); + } + return false; + } + + @Override + public int hashCode() { + int h = 1; + h *= 1000003; + h ^= Objects.hashCode(fixedValue); + h *= 1000003; + h ^= Objects.hashCode(project); + h *= 1000003; + h ^= Objects.hashCode(location); + h *= 1000003; + h ^= Objects.hashCode(agent); + h *= 1000003; + h ^= Objects.hashCode(session); + h *= 1000003; + h ^= Objects.hashCode(environment); + return h; + } + /** Builder for projects/{project}/locations/{location}/agents/{agent}/sessions/{session}. */ public static class Builder { - private String project; private String location; private String agent; @@ -309,9 +346,8 @@ public Builder setSession(String session) { private Builder(SessionName sessionName) { Preconditions.checkArgument( - sessionName.pathTemplate == PROJECT_LOCATION_AGENT_SESSION_PATH_TEMPLATE, - "toBuilder is only supported when SessionName has the pattern of " - + "projects/{project}/locations/{location}/agents/{agent}/sessions/{session}."); + Objects.equals(sessionName.pathTemplate, PROJECT_LOCATION_AGENT_SESSION), + "toBuilder is only supported when SessionName has the pattern of projects/{project}/locations/{location}/agents/{agent}/sessions/{session}"); project = sessionName.project; location = sessionName.location; agent = sessionName.agent; @@ -329,14 +365,13 @@ public SessionName build() { */ @BetaApi("The per-pattern Builders are not stable yet and may be changed in the future.") public static class ProjectLocationAgentEnvironmentSessionBuilder { - private String project; private String location; private String agent; private String environment; private String session; - private ProjectLocationAgentEnvironmentSessionBuilder() {} + protected ProjectLocationAgentEnvironmentSessionBuilder() {} public String getProject() { return project; @@ -387,38 +422,4 @@ public SessionName build() { return new SessionName(this); } } - - @Override - public boolean equals(Object o) { - if (o == this) { - return true; - } - if (o != null || getClass() == o.getClass()) { - SessionName that = (SessionName) o; - return (Objects.equals(this.project, that.project)) - && (Objects.equals(this.location, that.location)) - && (Objects.equals(this.agent, that.agent)) - && (Objects.equals(this.session, that.session)) - && (Objects.equals(this.environment, that.environment)); - } - return false; - } - - @Override - public int hashCode() { - int h = 1; - h *= 1000003; - h ^= Objects.hashCode(fixedValue); - h *= 1000003; - h ^= Objects.hashCode(project); - h *= 1000003; - h ^= Objects.hashCode(location); - h *= 1000003; - h ^= Objects.hashCode(agent); - h *= 1000003; - h ^= Objects.hashCode(session); - h *= 1000003; - h ^= Objects.hashCode(environment); - return h; - } } diff --git a/proto-google-cloud-dialogflow-cx-v3beta1/src/main/java/com/google/cloud/dialogflow/cx/v3beta1/SessionProto.java b/proto-google-cloud-dialogflow-cx-v3beta1/src/main/java/com/google/cloud/dialogflow/cx/v3beta1/SessionProto.java index f76943b5f..9439aee95 100644 --- a/proto-google-cloud-dialogflow-cx-v3beta1/src/main/java/com/google/cloud/dialogflow/cx/v3beta1/SessionProto.java +++ b/proto-google-cloud-dialogflow-cx-v3beta1/src/main/java/com/google/cloud/dialogflow/cx/v3beta1/SessionProto.java @@ -51,6 +51,10 @@ public static void registerAllExtensions(com.google.protobuf.ExtensionRegistry r internal_static_google_cloud_dialogflow_cx_v3beta1_QueryParameters_descriptor; static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internal_static_google_cloud_dialogflow_cx_v3beta1_QueryParameters_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_cloud_dialogflow_cx_v3beta1_QueryParameters_WebhookHeadersEntry_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_cloud_dialogflow_cx_v3beta1_QueryParameters_WebhookHeadersEntry_fieldAccessorTable; static final com.google.protobuf.Descriptors.Descriptor internal_static_google_cloud_dialogflow_cx_v3beta1_QueryInput_descriptor; static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable @@ -165,7 +169,7 @@ public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { + "eechWordInfo\0224\n\021speech_end_offset\030\010 \001(\0132" + "\031.google.protobuf.Duration\"X\n\013MessageTyp" + "e\022\034\n\030MESSAGE_TYPE_UNSPECIFIED\020\000\022\016\n\nTRANS" - + "CRIPT\020\001\022\033\n\027END_OF_SINGLE_UTTERANCE\020\002\"\241\002\n" + + "CRIPT\020\001\022\033\n\027END_OF_SINGLE_UTTERANCE\020\002\"\272\003\n" + "\017QueryParameters\022\021\n\ttime_zone\030\001 \001(\t\022)\n\014g" + "eo_location\030\002 \001(\0132\023.google.type.LatLng\022S" + "\n\024session_entity_types\030\003 \003(\01325.google.cl" @@ -173,119 +177,123 @@ public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { + "ype\022(\n\007payload\030\004 \001(\0132\027.google.protobuf.S" + "truct\022+\n\nparameters\030\005 \001(\0132\027.google.proto" + "buf.Struct\022$\n\034analyze_query_text_sentime" - + "nt\030\010 \001(\010\"\364\002\n\nQueryInput\022=\n\004text\030\002 \001(\0132-." - + "google.cloud.dialogflow.cx.v3beta1.TextI" - + "nputH\000\022A\n\006intent\030\003 \001(\0132/.google.cloud.di" - + "alogflow.cx.v3beta1.IntentInputH\000\022?\n\005aud" - + "io\030\005 \001(\0132..google.cloud.dialogflow.cx.v3" - + "beta1.AudioInputH\000\022?\n\005event\030\006 \001(\0132..goog" - + "le.cloud.dialogflow.cx.v3beta1.EventInpu" - + "tH\000\022=\n\004dtmf\030\007 \001(\0132-.google.cloud.dialogf" - + "low.cx.v3beta1.DtmfInputH\000\022\032\n\rlanguage_c" - + "ode\030\004 \001(\tB\003\340A\002B\007\n\005input\"\331\005\n\013QueryResult\022" - + "\016\n\004text\030\001 \001(\tH\000\022\030\n\016trigger_intent\030\013 \001(\tH" - + "\000\022\024\n\ntranscript\030\014 \001(\tH\000\022\027\n\rtrigger_event" - + "\030\016 \001(\tH\000\022\025\n\rlanguage_code\030\002 \001(\t\022+\n\nparam" - + "eters\030\003 \001(\0132\027.google.protobuf.Struct\022N\n\021" - + "response_messages\030\004 \003(\01323.google.cloud.d" - + "ialogflow.cx.v3beta1.ResponseMessage\022,\n\020" - + "webhook_statuses\030\r \003(\0132\022.google.rpc.Stat" - + "us\0221\n\020webhook_payloads\030\006 \003(\0132\027.google.pr" - + "otobuf.Struct\022>\n\014current_page\030\007 \001(\0132(.go" - + "ogle.cloud.dialogflow.cx.v3beta1.Page\022>\n" - + "\006intent\030\010 \001(\0132*.google.cloud.dialogflow." - + "cx.v3beta1.IntentB\002\030\001\022\'\n\033intent_detectio" - + "n_confidence\030\t \001(\002B\002\030\001\0228\n\005match\030\017 \001(\0132)." - + "google.cloud.dialogflow.cx.v3beta1.Match" - + "\0220\n\017diagnostic_info\030\n \001(\0132\027.google.proto" - + "buf.Struct\022^\n\031sentiment_analysis_result\030" - + "\021 \001(\0132;.google.cloud.dialogflow.cx.v3bet" - + "a1.SentimentAnalysisResultB\007\n\005query\"\036\n\tT" - + "extInput\022\021\n\004text\030\001 \001(\tB\003\340A\002\"G\n\013IntentInp" - + "ut\0228\n\006intent\030\001 \001(\tB(\340A\002\372A\"\n dialogflow.g" - + "oogleapis.com/Intent\"f\n\nAudioInput\022I\n\006co" - + "nfig\030\001 \001(\01324.google.cloud.dialogflow.cx." - + "v3beta1.InputAudioConfigB\003\340A\002\022\r\n\005audio\030\002" - + " \001(\014\"\033\n\nEventInput\022\r\n\005event\030\001 \001(\t\"1\n\tDtm" - + "fInput\022\016\n\006digits\030\001 \001(\t\022\024\n\014finish_digit\030\002" - + " \001(\t\"\373\002\n\005Match\022:\n\006intent\030\001 \001(\0132*.google." - + "cloud.dialogflow.cx.v3beta1.Intent\022\r\n\005ev" - + "ent\030\006 \001(\t\022+\n\nparameters\030\002 \001(\0132\027.google.p" - + "rotobuf.Struct\022\026\n\016resolved_input\030\003 \001(\t\022G" - + "\n\nmatch_type\030\004 \001(\01623.google.cloud.dialog" - + "flow.cx.v3beta1.Match.MatchType\022\022\n\nconfi" - + "dence\030\005 \001(\002\"\204\001\n\tMatchType\022\032\n\026MATCH_TYPE_" - + "UNSPECIFIED\020\000\022\n\n\006INTENT\020\001\022\021\n\rDIRECT_INTE" - + "NT\020\002\022\025\n\021PARAMETER_FILLING\020\003\022\014\n\010NO_MATCH\020" - + "\004\022\014\n\010NO_INPUT\020\005\022\t\n\005EVENT\020\006\"\345\001\n\022MatchInte" - + "ntRequest\022:\n\007session\030\001 \001(\tB)\340A\002\372A#\n!dial" - + "ogflow.googleapis.com/Session\022I\n\014query_p" - + "arams\030\002 \001(\01323.google.cloud.dialogflow.cx" - + ".v3beta1.QueryParameters\022H\n\013query_input\030" - + "\003 \001(\0132..google.cloud.dialogflow.cx.v3bet" - + "a1.QueryInputB\003\340A\002\"\363\001\n\023MatchIntentRespon" - + "se\022\016\n\004text\030\001 \001(\tH\000\022\030\n\016trigger_intent\030\002 \001" - + "(\tH\000\022\024\n\ntranscript\030\003 \001(\tH\000\022\027\n\rtrigger_ev" - + "ent\030\006 \001(\tH\000\022:\n\007matches\030\004 \003(\0132).google.cl" - + "oud.dialogflow.cx.v3beta1.Match\022>\n\014curre" - + "nt_page\030\005 \001(\0132(.google.cloud.dialogflow." - + "cx.v3beta1.PageB\007\n\005query\"\372\001\n\024FulfillInte" - + "ntRequest\022T\n\024match_intent_request\030\001 \001(\0132" - + "6.google.cloud.dialogflow.cx.v3beta1.Mat" - + "chIntentRequest\0228\n\005match\030\002 \001(\0132).google." - + "cloud.dialogflow.cx.v3beta1.Match\022R\n\023out" - + "put_audio_config\030\003 \001(\01325.google.cloud.di" - + "alogflow.cx.v3beta1.OutputAudioConfig\"\335\001" - + "\n\025FulfillIntentResponse\022\023\n\013response_id\030\001" - + " \001(\t\022E\n\014query_result\030\002 \001(\0132/.google.clou" - + "d.dialogflow.cx.v3beta1.QueryResult\022\024\n\014o" - + "utput_audio\030\003 \001(\014\022R\n\023output_audio_config" - + "\030\004 \001(\01325.google.cloud.dialogflow.cx.v3be" - + "ta1.OutputAudioConfig\";\n\027SentimentAnalys" - + "isResult\022\r\n\005score\030\001 \001(\002\022\021\n\tmagnitude\030\002 \001" - + "(\0022\212\n\n\010Sessions\022\272\002\n\014DetectIntent\0227.googl" - + "e.cloud.dialogflow.cx.v3beta1.DetectInte" - + "ntRequest\0328.google.cloud.dialogflow.cx.v" - + "3beta1.DetectIntentResponse\"\266\001\202\323\344\223\002\257\001\"J/" - + "v3beta1/{session=projects/*/locations/*/" - + "agents/*/sessions/*}:detectIntent:\001*Z^\"Y" - + "/v3beta1/{session=projects/*/locations/*" - + "/agents/*/environments/*/sessions/*}:det" - + "ectIntent:\001*\022\242\001\n\025StreamingDetectIntent\022@" - + ".google.cloud.dialogflow.cx.v3beta1.Stre" - + "amingDetectIntentRequest\032A.google.cloud." - + "dialogflow.cx.v3beta1.StreamingDetectInt" - + "entResponse\"\000(\0010\001\022\265\002\n\013MatchIntent\0226.goog" - + "le.cloud.dialogflow.cx.v3beta1.MatchInte" - + "ntRequest\0327.google.cloud.dialogflow.cx.v" - + "3beta1.MatchIntentResponse\"\264\001\202\323\344\223\002\255\001\"I/v" - + "3beta1/{session=projects/*/locations/*/a" - + "gents/*/sessions/*}:matchIntent:\001*Z]\"X/v" - + "3beta1/{session=projects/*/locations/*/a" - + "gents/*/environments/*/sessions/*}:match" - + "Intent:\001*\022\351\002\n\rFulfillIntent\0228.google.clo" - + "ud.dialogflow.cx.v3beta1.FulfillIntentRe" - + "quest\0329.google.cloud.dialogflow.cx.v3bet" - + "a1.FulfillIntentResponse\"\342\001\202\323\344\223\002\333\001\"`/v3b" - + "eta1/{match_intent_request.session=proje" - + "cts/*/locations/*/agents/*/sessions/*}:f" - + "ulfillIntent:\001*Zt\"o/v3beta1/{match_inten" - + "t_request.session=projects/*/locations/*" - + "/agents/*/environments/*/sessions/*}:ful" - + "fillIntent:\001*\032x\312A\031dialogflow.googleapis." - + "com\322AYhttps://www.googleapis.com/auth/cl" - + "oud-platform,https://www.googleapis.com/" - + "auth/dialogflowB\203\003\n&com.google.cloud.dia" - + "logflow.cx.v3beta1B\014SessionProtoP\001ZDgoog" - + "le.golang.org/genproto/googleapis/cloud/" - + "dialogflow/cx/v3beta1;cx\370\001\001\242\002\002DF\252\002\"Googl" - + "e.Cloud.Dialogflow.Cx.V3Beta1\352A\324\001\n!dialo" - + "gflow.googleapis.com/Session\022Iprojects/{" - + "project}/locations/{location}/agents/{ag" - + "ent}/sessions/{session}\022dprojects/{proje" - + "ct}/locations/{location}/agents/{agent}/" - + "environments/{environment}/sessions/{ses" - + "sion}b\006proto3" + + "nt\030\010 \001(\010\022`\n\017webhook_headers\030\n \003(\0132G.goog" + + "le.cloud.dialogflow.cx.v3beta1.QueryPara" + + "meters.WebhookHeadersEntry\0325\n\023WebhookHea" + + "dersEntry\022\013\n\003key\030\001 \001(\t\022\r\n\005value\030\002 \001(\t:\0028" + + "\001\"\364\002\n\nQueryInput\022=\n\004text\030\002 \001(\0132-.google." + + "cloud.dialogflow.cx.v3beta1.TextInputH\000\022" + + "A\n\006intent\030\003 \001(\0132/.google.cloud.dialogflo" + + "w.cx.v3beta1.IntentInputH\000\022?\n\005audio\030\005 \001(" + + "\0132..google.cloud.dialogflow.cx.v3beta1.A" + + "udioInputH\000\022?\n\005event\030\006 \001(\0132..google.clou" + + "d.dialogflow.cx.v3beta1.EventInputH\000\022=\n\004" + + "dtmf\030\007 \001(\0132-.google.cloud.dialogflow.cx." + + "v3beta1.DtmfInputH\000\022\032\n\rlanguage_code\030\004 \001" + + "(\tB\003\340A\002B\007\n\005input\"\331\005\n\013QueryResult\022\016\n\004text" + + "\030\001 \001(\tH\000\022\030\n\016trigger_intent\030\013 \001(\tH\000\022\024\n\ntr" + + "anscript\030\014 \001(\tH\000\022\027\n\rtrigger_event\030\016 \001(\tH" + + "\000\022\025\n\rlanguage_code\030\002 \001(\t\022+\n\nparameters\030\003" + + " \001(\0132\027.google.protobuf.Struct\022N\n\021respons" + + "e_messages\030\004 \003(\01323.google.cloud.dialogfl" + + "ow.cx.v3beta1.ResponseMessage\022,\n\020webhook" + + "_statuses\030\r \003(\0132\022.google.rpc.Status\0221\n\020w" + + "ebhook_payloads\030\006 \003(\0132\027.google.protobuf." + + "Struct\022>\n\014current_page\030\007 \001(\0132(.google.cl" + + "oud.dialogflow.cx.v3beta1.Page\022>\n\006intent" + + "\030\010 \001(\0132*.google.cloud.dialogflow.cx.v3be" + + "ta1.IntentB\002\030\001\022\'\n\033intent_detection_confi" + + "dence\030\t \001(\002B\002\030\001\0228\n\005match\030\017 \001(\0132).google." + + "cloud.dialogflow.cx.v3beta1.Match\0220\n\017dia" + + "gnostic_info\030\n \001(\0132\027.google.protobuf.Str" + + "uct\022^\n\031sentiment_analysis_result\030\021 \001(\0132;" + + ".google.cloud.dialogflow.cx.v3beta1.Sent" + + "imentAnalysisResultB\007\n\005query\"\036\n\tTextInpu" + + "t\022\021\n\004text\030\001 \001(\tB\003\340A\002\"G\n\013IntentInput\0228\n\006i" + + "ntent\030\001 \001(\tB(\340A\002\372A\"\n dialogflow.googleap" + + "is.com/Intent\"f\n\nAudioInput\022I\n\006config\030\001 " + + "\001(\01324.google.cloud.dialogflow.cx.v3beta1" + + ".InputAudioConfigB\003\340A\002\022\r\n\005audio\030\002 \001(\014\"\033\n" + + "\nEventInput\022\r\n\005event\030\001 \001(\t\"1\n\tDtmfInput\022" + + "\016\n\006digits\030\001 \001(\t\022\024\n\014finish_digit\030\002 \001(\t\"\373\002" + + "\n\005Match\022:\n\006intent\030\001 \001(\0132*.google.cloud.d" + + "ialogflow.cx.v3beta1.Intent\022\r\n\005event\030\006 \001" + + "(\t\022+\n\nparameters\030\002 \001(\0132\027.google.protobuf" + + ".Struct\022\026\n\016resolved_input\030\003 \001(\t\022G\n\nmatch" + + "_type\030\004 \001(\01623.google.cloud.dialogflow.cx" + + ".v3beta1.Match.MatchType\022\022\n\nconfidence\030\005" + + " \001(\002\"\204\001\n\tMatchType\022\032\n\026MATCH_TYPE_UNSPECI" + + "FIED\020\000\022\n\n\006INTENT\020\001\022\021\n\rDIRECT_INTENT\020\002\022\025\n" + + "\021PARAMETER_FILLING\020\003\022\014\n\010NO_MATCH\020\004\022\014\n\010NO" + + "_INPUT\020\005\022\t\n\005EVENT\020\006\"\345\001\n\022MatchIntentReque" + + "st\022:\n\007session\030\001 \001(\tB)\340A\002\372A#\n!dialogflow." + + "googleapis.com/Session\022I\n\014query_params\030\002" + + " \001(\01323.google.cloud.dialogflow.cx.v3beta" + + "1.QueryParameters\022H\n\013query_input\030\003 \001(\0132." + + ".google.cloud.dialogflow.cx.v3beta1.Quer" + + "yInputB\003\340A\002\"\363\001\n\023MatchIntentResponse\022\016\n\004t" + + "ext\030\001 \001(\tH\000\022\030\n\016trigger_intent\030\002 \001(\tH\000\022\024\n" + + "\ntranscript\030\003 \001(\tH\000\022\027\n\rtrigger_event\030\006 \001" + + "(\tH\000\022:\n\007matches\030\004 \003(\0132).google.cloud.dia" + + "logflow.cx.v3beta1.Match\022>\n\014current_page" + + "\030\005 \001(\0132(.google.cloud.dialogflow.cx.v3be" + + "ta1.PageB\007\n\005query\"\372\001\n\024FulfillIntentReque" + + "st\022T\n\024match_intent_request\030\001 \001(\01326.googl" + + "e.cloud.dialogflow.cx.v3beta1.MatchInten" + + "tRequest\0228\n\005match\030\002 \001(\0132).google.cloud.d" + + "ialogflow.cx.v3beta1.Match\022R\n\023output_aud" + + "io_config\030\003 \001(\01325.google.cloud.dialogflo" + + "w.cx.v3beta1.OutputAudioConfig\"\335\001\n\025Fulfi" + + "llIntentResponse\022\023\n\013response_id\030\001 \001(\t\022E\n" + + "\014query_result\030\002 \001(\0132/.google.cloud.dialo" + + "gflow.cx.v3beta1.QueryResult\022\024\n\014output_a" + + "udio\030\003 \001(\014\022R\n\023output_audio_config\030\004 \001(\0132" + + "5.google.cloud.dialogflow.cx.v3beta1.Out" + + "putAudioConfig\";\n\027SentimentAnalysisResul" + + "t\022\r\n\005score\030\001 \001(\002\022\021\n\tmagnitude\030\002 \001(\0022\212\n\n\010" + + "Sessions\022\272\002\n\014DetectIntent\0227.google.cloud" + + ".dialogflow.cx.v3beta1.DetectIntentReque" + + "st\0328.google.cloud.dialogflow.cx.v3beta1." + + "DetectIntentResponse\"\266\001\202\323\344\223\002\257\001\"J/v3beta1" + + "/{session=projects/*/locations/*/agents/" + + "*/sessions/*}:detectIntent:\001*Z^\"Y/v3beta" + + "1/{session=projects/*/locations/*/agents" + + "/*/environments/*/sessions/*}:detectInte" + + "nt:\001*\022\242\001\n\025StreamingDetectIntent\022@.google" + + ".cloud.dialogflow.cx.v3beta1.StreamingDe" + + "tectIntentRequest\032A.google.cloud.dialogf" + + "low.cx.v3beta1.StreamingDetectIntentResp" + + "onse\"\000(\0010\001\022\265\002\n\013MatchIntent\0226.google.clou" + + "d.dialogflow.cx.v3beta1.MatchIntentReque" + + "st\0327.google.cloud.dialogflow.cx.v3beta1." + + "MatchIntentResponse\"\264\001\202\323\344\223\002\255\001\"I/v3beta1/" + + "{session=projects/*/locations/*/agents/*" + + "/sessions/*}:matchIntent:\001*Z]\"X/v3beta1/" + + "{session=projects/*/locations/*/agents/*" + + "/environments/*/sessions/*}:matchIntent:" + + "\001*\022\351\002\n\rFulfillIntent\0228.google.cloud.dial" + + "ogflow.cx.v3beta1.FulfillIntentRequest\0329" + + ".google.cloud.dialogflow.cx.v3beta1.Fulf" + + "illIntentResponse\"\342\001\202\323\344\223\002\333\001\"`/v3beta1/{m" + + "atch_intent_request.session=projects/*/l" + + "ocations/*/agents/*/sessions/*}:fulfillI" + + "ntent:\001*Zt\"o/v3beta1/{match_intent_reque" + + "st.session=projects/*/locations/*/agents" + + "/*/environments/*/sessions/*}:fulfillInt" + + "ent:\001*\032x\312A\031dialogflow.googleapis.com\322AYh" + + "ttps://www.googleapis.com/auth/cloud-pla" + + "tform,https://www.googleapis.com/auth/di" + + "alogflowB\203\003\n&com.google.cloud.dialogflow" + + ".cx.v3beta1B\014SessionProtoP\001ZDgoogle.gola" + + "ng.org/genproto/googleapis/cloud/dialogf" + + "low/cx/v3beta1;cx\370\001\001\242\002\002DF\252\002\"Google.Cloud" + + ".Dialogflow.Cx.V3Beta1\352A\324\001\n!dialogflow.g" + + "oogleapis.com/Session\022Iprojects/{project" + + "}/locations/{location}/agents/{agent}/se" + + "ssions/{session}\022dprojects/{project}/loc" + + "ations/{location}/agents/{agent}/environ" + + "ments/{environment}/sessions/{session}b\006" + + "proto3" }; descriptor = com.google.protobuf.Descriptors.FileDescriptor.internalBuildGeneratedFileFrom( @@ -364,6 +372,17 @@ public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { "Payload", "Parameters", "AnalyzeQueryTextSentiment", + "WebhookHeaders", + }); + internal_static_google_cloud_dialogflow_cx_v3beta1_QueryParameters_WebhookHeadersEntry_descriptor = + internal_static_google_cloud_dialogflow_cx_v3beta1_QueryParameters_descriptor + .getNestedTypes() + .get(0); + internal_static_google_cloud_dialogflow_cx_v3beta1_QueryParameters_WebhookHeadersEntry_fieldAccessorTable = + new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_google_cloud_dialogflow_cx_v3beta1_QueryParameters_WebhookHeadersEntry_descriptor, + new java.lang.String[] { + "Key", "Value", }); internal_static_google_cloud_dialogflow_cx_v3beta1_QueryInput_descriptor = getDescriptor().getMessageTypes().get(6); diff --git a/proto-google-cloud-dialogflow-cx-v3beta1/src/main/java/com/google/cloud/dialogflow/cx/v3beta1/StreamingDetectIntentRequest.java b/proto-google-cloud-dialogflow-cx-v3beta1/src/main/java/com/google/cloud/dialogflow/cx/v3beta1/StreamingDetectIntentRequest.java index 81cec9313..d75112211 100644 --- a/proto-google-cloud-dialogflow-cx-v3beta1/src/main/java/com/google/cloud/dialogflow/cx/v3beta1/StreamingDetectIntentRequest.java +++ b/proto-google-cloud-dialogflow-cx-v3beta1/src/main/java/com/google/cloud/dialogflow/cx/v3beta1/StreamingDetectIntentRequest.java @@ -201,6 +201,9 @@ public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { * Note: session must be set in the first request. * For more information, see the [sessions * guide](https://cloud.google.com/dialogflow/cx/docs/concept/session). + * Note: Always use agent versions for production traffic. + * See [Versions and + * environments](https://cloud.google.com/dialogflow/cx/docs/concept/version). * * * string session = 1 [(.google.api.resource_reference) = { ... } @@ -235,6 +238,9 @@ public java.lang.String getSession() { * Note: session must be set in the first request. * For more information, see the [sessions * guide](https://cloud.google.com/dialogflow/cx/docs/concept/session). + * Note: Always use agent versions for production traffic. + * See [Versions and + * environments](https://cloud.google.com/dialogflow/cx/docs/concept/version). * * * string session = 1 [(.google.api.resource_reference) = { ... } @@ -854,6 +860,9 @@ public Builder mergeFrom( * Note: session must be set in the first request. * For more information, see the [sessions * guide](https://cloud.google.com/dialogflow/cx/docs/concept/session). + * Note: Always use agent versions for production traffic. + * See [Versions and + * environments](https://cloud.google.com/dialogflow/cx/docs/concept/version). * * * string session = 1 [(.google.api.resource_reference) = { ... } @@ -887,6 +896,9 @@ public java.lang.String getSession() { * Note: session must be set in the first request. * For more information, see the [sessions * guide](https://cloud.google.com/dialogflow/cx/docs/concept/session). + * Note: Always use agent versions for production traffic. + * See [Versions and + * environments](https://cloud.google.com/dialogflow/cx/docs/concept/version). * * * string session = 1 [(.google.api.resource_reference) = { ... } @@ -920,6 +932,9 @@ public com.google.protobuf.ByteString getSessionBytes() { * Note: session must be set in the first request. * For more information, see the [sessions * guide](https://cloud.google.com/dialogflow/cx/docs/concept/session). + * Note: Always use agent versions for production traffic. + * See [Versions and + * environments](https://cloud.google.com/dialogflow/cx/docs/concept/version). * * * string session = 1 [(.google.api.resource_reference) = { ... } @@ -952,6 +967,9 @@ public Builder setSession(java.lang.String value) { * Note: session must be set in the first request. * For more information, see the [sessions * guide](https://cloud.google.com/dialogflow/cx/docs/concept/session). + * Note: Always use agent versions for production traffic. + * See [Versions and + * environments](https://cloud.google.com/dialogflow/cx/docs/concept/version). * * * string session = 1 [(.google.api.resource_reference) = { ... } @@ -980,6 +998,9 @@ public Builder clearSession() { * Note: session must be set in the first request. * For more information, see the [sessions * guide](https://cloud.google.com/dialogflow/cx/docs/concept/session). + * Note: Always use agent versions for production traffic. + * See [Versions and + * environments](https://cloud.google.com/dialogflow/cx/docs/concept/version). * * * string session = 1 [(.google.api.resource_reference) = { ... } diff --git a/proto-google-cloud-dialogflow-cx-v3beta1/src/main/java/com/google/cloud/dialogflow/cx/v3beta1/StreamingDetectIntentRequestOrBuilder.java b/proto-google-cloud-dialogflow-cx-v3beta1/src/main/java/com/google/cloud/dialogflow/cx/v3beta1/StreamingDetectIntentRequestOrBuilder.java index 2392d7a58..e9bed50d9 100644 --- a/proto-google-cloud-dialogflow-cx-v3beta1/src/main/java/com/google/cloud/dialogflow/cx/v3beta1/StreamingDetectIntentRequestOrBuilder.java +++ b/proto-google-cloud-dialogflow-cx-v3beta1/src/main/java/com/google/cloud/dialogflow/cx/v3beta1/StreamingDetectIntentRequestOrBuilder.java @@ -39,6 +39,9 @@ public interface StreamingDetectIntentRequestOrBuilder * Note: session must be set in the first request. * For more information, see the [sessions * guide](https://cloud.google.com/dialogflow/cx/docs/concept/session). + * Note: Always use agent versions for production traffic. + * See [Versions and + * environments](https://cloud.google.com/dialogflow/cx/docs/concept/version). * * * string session = 1 [(.google.api.resource_reference) = { ... } @@ -62,6 +65,9 @@ public interface StreamingDetectIntentRequestOrBuilder * Note: session must be set in the first request. * For more information, see the [sessions * guide](https://cloud.google.com/dialogflow/cx/docs/concept/session). + * Note: Always use agent versions for production traffic. + * See [Versions and + * environments](https://cloud.google.com/dialogflow/cx/docs/concept/version). * * * string session = 1 [(.google.api.resource_reference) = { ... } diff --git a/proto-google-cloud-dialogflow-cx-v3beta1/src/main/java/com/google/cloud/dialogflow/cx/v3beta1/TransitionRouteGroupName.java b/proto-google-cloud-dialogflow-cx-v3beta1/src/main/java/com/google/cloud/dialogflow/cx/v3beta1/TransitionRouteGroupName.java index cabac6911..05f5ec73c 100644 --- a/proto-google-cloud-dialogflow-cx-v3beta1/src/main/java/com/google/cloud/dialogflow/cx/v3beta1/TransitionRouteGroupName.java +++ b/proto-google-cloud-dialogflow-cx-v3beta1/src/main/java/com/google/cloud/dialogflow/cx/v3beta1/TransitionRouteGroupName.java @@ -5,7 +5,7 @@ * 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 + * 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, @@ -23,23 +23,39 @@ import java.util.ArrayList; import java.util.List; import java.util.Map; +import java.util.Objects; +import javax.annotation.Generated; -/** AUTO-GENERATED DOCUMENTATION AND CLASS */ -@javax.annotation.Generated("by GAPIC protoc plugin") +// AUTO-GENERATED DOCUMENTATION AND CLASS. +@Generated("by gapic-generator-java") public class TransitionRouteGroupName implements ResourceName { - - private static final PathTemplate PATH_TEMPLATE = + private static final PathTemplate PROJECT_LOCATION_AGENT_FLOW_TRANSITION_ROUTE_GROUP = PathTemplate.createWithoutUrlEncoding( "projects/{project}/locations/{location}/agents/{agent}/flows/{flow}/transitionRouteGroups/{transition_route_group}"); - private volatile Map fieldValuesMap; - private final String project; private final String location; private final String agent; private final String flow; private final String transitionRouteGroup; + @Deprecated + protected TransitionRouteGroupName() { + project = null; + location = null; + agent = null; + flow = null; + transitionRouteGroup = null; + } + + private TransitionRouteGroupName(Builder builder) { + project = Preconditions.checkNotNull(builder.getProject()); + location = Preconditions.checkNotNull(builder.getLocation()); + agent = Preconditions.checkNotNull(builder.getAgent()); + flow = Preconditions.checkNotNull(builder.getFlow()); + transitionRouteGroup = Preconditions.checkNotNull(builder.getTransitionRouteGroup()); + } + public String getProject() { return project; } @@ -68,14 +84,6 @@ public Builder toBuilder() { return new Builder(this); } - private TransitionRouteGroupName(Builder builder) { - project = Preconditions.checkNotNull(builder.getProject()); - location = Preconditions.checkNotNull(builder.getLocation()); - agent = Preconditions.checkNotNull(builder.getAgent()); - flow = Preconditions.checkNotNull(builder.getFlow()); - transitionRouteGroup = Preconditions.checkNotNull(builder.getTransitionRouteGroup()); - } - public static TransitionRouteGroupName of( String project, String location, String agent, String flow, String transitionRouteGroup) { return newBuilder() @@ -104,7 +112,7 @@ public static TransitionRouteGroupName parse(String formattedString) { return null; } Map matchMap = - PATH_TEMPLATE.validatedMatch( + PROJECT_LOCATION_AGENT_FLOW_TRANSITION_ROUTE_GROUP.validatedMatch( formattedString, "TransitionRouteGroupName.parse: formattedString not in valid format"); return of( matchMap.get("project"), @@ -123,7 +131,7 @@ public static List parseList(List formattedStr } public static List toStringList(List values) { - List list = new ArrayList(values.size()); + List list = new ArrayList<>(values.size()); for (TransitionRouteGroupName value : values) { if (value == null) { list.add(""); @@ -135,19 +143,30 @@ public static List toStringList(List values) { } public static boolean isParsableFrom(String formattedString) { - return PATH_TEMPLATE.matches(formattedString); + return PROJECT_LOCATION_AGENT_FLOW_TRANSITION_ROUTE_GROUP.matches(formattedString); } + @Override public Map getFieldValuesMap() { if (fieldValuesMap == null) { synchronized (this) { if (fieldValuesMap == null) { ImmutableMap.Builder fieldMapBuilder = ImmutableMap.builder(); - fieldMapBuilder.put("project", project); - fieldMapBuilder.put("location", location); - fieldMapBuilder.put("agent", agent); - fieldMapBuilder.put("flow", flow); - fieldMapBuilder.put("transitionRouteGroup", transitionRouteGroup); + if (project != null) { + fieldMapBuilder.put("project", project); + } + if (location != null) { + fieldMapBuilder.put("location", location); + } + if (agent != null) { + fieldMapBuilder.put("agent", agent); + } + if (flow != null) { + fieldMapBuilder.put("flow", flow); + } + if (transitionRouteGroup != null) { + fieldMapBuilder.put("transition_route_group", transitionRouteGroup); + } fieldValuesMap = fieldMapBuilder.build(); } } @@ -161,7 +180,7 @@ public String getFieldValue(String fieldName) { @Override public String toString() { - return PATH_TEMPLATE.instantiate( + return PROJECT_LOCATION_AGENT_FLOW_TRANSITION_ROUTE_GROUP.instantiate( "project", project, "location", @@ -174,15 +193,51 @@ public String toString() { transitionRouteGroup); } - /** Builder for TransitionRouteGroupName. */ - public static class Builder { + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o != null || getClass() == o.getClass()) { + TransitionRouteGroupName that = ((TransitionRouteGroupName) o); + return Objects.equals(this.project, that.project) + && Objects.equals(this.location, that.location) + && Objects.equals(this.agent, that.agent) + && Objects.equals(this.flow, that.flow) + && Objects.equals(this.transitionRouteGroup, that.transitionRouteGroup); + } + return false; + } + @Override + public int hashCode() { + int h = 1; + h *= 1000003; + h ^= Objects.hashCode(project); + h *= 1000003; + h ^= Objects.hashCode(location); + h *= 1000003; + h ^= Objects.hashCode(agent); + h *= 1000003; + h ^= Objects.hashCode(flow); + h *= 1000003; + h ^= Objects.hashCode(transitionRouteGroup); + return h; + } + + /** + * Builder for + * projects/{project}/locations/{location}/agents/{agent}/flows/{flow}/transitionRouteGroups/{transition_route_group}. + */ + public static class Builder { private String project; private String location; private String agent; private String flow; private String transitionRouteGroup; + protected Builder() {} + public String getProject() { return project; } @@ -228,8 +283,6 @@ public Builder setTransitionRouteGroup(String transitionRouteGroup) { return this; } - private Builder() {} - private Builder(TransitionRouteGroupName transitionRouteGroupName) { project = transitionRouteGroupName.project; location = transitionRouteGroupName.location; @@ -242,36 +295,4 @@ public TransitionRouteGroupName build() { return new TransitionRouteGroupName(this); } } - - @Override - public boolean equals(Object o) { - if (o == this) { - return true; - } - if (o instanceof TransitionRouteGroupName) { - TransitionRouteGroupName that = (TransitionRouteGroupName) o; - return (this.project.equals(that.project)) - && (this.location.equals(that.location)) - && (this.agent.equals(that.agent)) - && (this.flow.equals(that.flow)) - && (this.transitionRouteGroup.equals(that.transitionRouteGroup)); - } - return false; - } - - @Override - public int hashCode() { - int h = 1; - h *= 1000003; - h ^= project.hashCode(); - h *= 1000003; - h ^= location.hashCode(); - h *= 1000003; - h ^= agent.hashCode(); - h *= 1000003; - h ^= flow.hashCode(); - h *= 1000003; - h ^= transitionRouteGroup.hashCode(); - return h; - } } diff --git a/proto-google-cloud-dialogflow-cx-v3beta1/src/main/java/com/google/cloud/dialogflow/cx/v3beta1/VersionName.java b/proto-google-cloud-dialogflow-cx-v3beta1/src/main/java/com/google/cloud/dialogflow/cx/v3beta1/VersionName.java index 1a80539be..120e80ac6 100644 --- a/proto-google-cloud-dialogflow-cx-v3beta1/src/main/java/com/google/cloud/dialogflow/cx/v3beta1/VersionName.java +++ b/proto-google-cloud-dialogflow-cx-v3beta1/src/main/java/com/google/cloud/dialogflow/cx/v3beta1/VersionName.java @@ -5,7 +5,7 @@ * 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 + * 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, @@ -23,23 +23,39 @@ import java.util.ArrayList; import java.util.List; import java.util.Map; +import java.util.Objects; +import javax.annotation.Generated; -/** AUTO-GENERATED DOCUMENTATION AND CLASS */ -@javax.annotation.Generated("by GAPIC protoc plugin") +// AUTO-GENERATED DOCUMENTATION AND CLASS. +@Generated("by gapic-generator-java") public class VersionName implements ResourceName { - - private static final PathTemplate PATH_TEMPLATE = + private static final PathTemplate PROJECT_LOCATION_AGENT_FLOW_VERSION = PathTemplate.createWithoutUrlEncoding( "projects/{project}/locations/{location}/agents/{agent}/flows/{flow}/versions/{version}"); - private volatile Map fieldValuesMap; - private final String project; private final String location; private final String agent; private final String flow; private final String version; + @Deprecated + protected VersionName() { + project = null; + location = null; + agent = null; + flow = null; + version = null; + } + + private VersionName(Builder builder) { + project = Preconditions.checkNotNull(builder.getProject()); + location = Preconditions.checkNotNull(builder.getLocation()); + agent = Preconditions.checkNotNull(builder.getAgent()); + flow = Preconditions.checkNotNull(builder.getFlow()); + version = Preconditions.checkNotNull(builder.getVersion()); + } + public String getProject() { return project; } @@ -68,14 +84,6 @@ public Builder toBuilder() { return new Builder(this); } - private VersionName(Builder builder) { - project = Preconditions.checkNotNull(builder.getProject()); - location = Preconditions.checkNotNull(builder.getLocation()); - agent = Preconditions.checkNotNull(builder.getAgent()); - flow = Preconditions.checkNotNull(builder.getFlow()); - version = Preconditions.checkNotNull(builder.getVersion()); - } - public static VersionName of( String project, String location, String agent, String flow, String version) { return newBuilder() @@ -104,7 +112,7 @@ public static VersionName parse(String formattedString) { return null; } Map matchMap = - PATH_TEMPLATE.validatedMatch( + PROJECT_LOCATION_AGENT_FLOW_VERSION.validatedMatch( formattedString, "VersionName.parse: formattedString not in valid format"); return of( matchMap.get("project"), @@ -123,7 +131,7 @@ public static List parseList(List formattedStrings) { } public static List toStringList(List values) { - List list = new ArrayList(values.size()); + List list = new ArrayList<>(values.size()); for (VersionName value : values) { if (value == null) { list.add(""); @@ -135,19 +143,30 @@ public static List toStringList(List values) { } public static boolean isParsableFrom(String formattedString) { - return PATH_TEMPLATE.matches(formattedString); + return PROJECT_LOCATION_AGENT_FLOW_VERSION.matches(formattedString); } + @Override public Map getFieldValuesMap() { if (fieldValuesMap == null) { synchronized (this) { if (fieldValuesMap == null) { ImmutableMap.Builder fieldMapBuilder = ImmutableMap.builder(); - fieldMapBuilder.put("project", project); - fieldMapBuilder.put("location", location); - fieldMapBuilder.put("agent", agent); - fieldMapBuilder.put("flow", flow); - fieldMapBuilder.put("version", version); + if (project != null) { + fieldMapBuilder.put("project", project); + } + if (location != null) { + fieldMapBuilder.put("location", location); + } + if (agent != null) { + fieldMapBuilder.put("agent", agent); + } + if (flow != null) { + fieldMapBuilder.put("flow", flow); + } + if (version != null) { + fieldMapBuilder.put("version", version); + } fieldValuesMap = fieldMapBuilder.build(); } } @@ -161,19 +180,55 @@ public String getFieldValue(String fieldName) { @Override public String toString() { - return PATH_TEMPLATE.instantiate( + return PROJECT_LOCATION_AGENT_FLOW_VERSION.instantiate( "project", project, "location", location, "agent", agent, "flow", flow, "version", version); } - /** Builder for VersionName. */ - public static class Builder { + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o != null || getClass() == o.getClass()) { + VersionName that = ((VersionName) o); + return Objects.equals(this.project, that.project) + && Objects.equals(this.location, that.location) + && Objects.equals(this.agent, that.agent) + && Objects.equals(this.flow, that.flow) + && Objects.equals(this.version, that.version); + } + return false; + } + @Override + public int hashCode() { + int h = 1; + h *= 1000003; + h ^= Objects.hashCode(project); + h *= 1000003; + h ^= Objects.hashCode(location); + h *= 1000003; + h ^= Objects.hashCode(agent); + h *= 1000003; + h ^= Objects.hashCode(flow); + h *= 1000003; + h ^= Objects.hashCode(version); + return h; + } + + /** + * Builder for + * projects/{project}/locations/{location}/agents/{agent}/flows/{flow}/versions/{version}. + */ + public static class Builder { private String project; private String location; private String agent; private String flow; private String version; + protected Builder() {} + public String getProject() { return project; } @@ -219,8 +274,6 @@ public Builder setVersion(String version) { return this; } - private Builder() {} - private Builder(VersionName versionName) { project = versionName.project; location = versionName.location; @@ -233,36 +286,4 @@ public VersionName build() { return new VersionName(this); } } - - @Override - public boolean equals(Object o) { - if (o == this) { - return true; - } - if (o instanceof VersionName) { - VersionName that = (VersionName) o; - return (this.project.equals(that.project)) - && (this.location.equals(that.location)) - && (this.agent.equals(that.agent)) - && (this.flow.equals(that.flow)) - && (this.version.equals(that.version)); - } - return false; - } - - @Override - public int hashCode() { - int h = 1; - h *= 1000003; - h ^= project.hashCode(); - h *= 1000003; - h ^= location.hashCode(); - h *= 1000003; - h ^= agent.hashCode(); - h *= 1000003; - h ^= flow.hashCode(); - h *= 1000003; - h ^= version.hashCode(); - return h; - } } diff --git a/proto-google-cloud-dialogflow-cx-v3beta1/src/main/java/com/google/cloud/dialogflow/cx/v3beta1/WebhookName.java b/proto-google-cloud-dialogflow-cx-v3beta1/src/main/java/com/google/cloud/dialogflow/cx/v3beta1/WebhookName.java index 980ad9e20..100f6c5ef 100644 --- a/proto-google-cloud-dialogflow-cx-v3beta1/src/main/java/com/google/cloud/dialogflow/cx/v3beta1/WebhookName.java +++ b/proto-google-cloud-dialogflow-cx-v3beta1/src/main/java/com/google/cloud/dialogflow/cx/v3beta1/WebhookName.java @@ -5,7 +5,7 @@ * 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 + * 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, @@ -23,22 +23,36 @@ import java.util.ArrayList; import java.util.List; import java.util.Map; +import java.util.Objects; +import javax.annotation.Generated; -/** AUTO-GENERATED DOCUMENTATION AND CLASS */ -@javax.annotation.Generated("by GAPIC protoc plugin") +// AUTO-GENERATED DOCUMENTATION AND CLASS. +@Generated("by gapic-generator-java") public class WebhookName implements ResourceName { - - private static final PathTemplate PATH_TEMPLATE = + private static final PathTemplate PROJECT_LOCATION_AGENT_WEBHOOK = PathTemplate.createWithoutUrlEncoding( "projects/{project}/locations/{location}/agents/{agent}/webhooks/{webhook}"); - private volatile Map fieldValuesMap; - private final String project; private final String location; private final String agent; private final String webhook; + @Deprecated + protected WebhookName() { + project = null; + location = null; + agent = null; + webhook = null; + } + + private WebhookName(Builder builder) { + project = Preconditions.checkNotNull(builder.getProject()); + location = Preconditions.checkNotNull(builder.getLocation()); + agent = Preconditions.checkNotNull(builder.getAgent()); + webhook = Preconditions.checkNotNull(builder.getWebhook()); + } + public String getProject() { return project; } @@ -63,13 +77,6 @@ public Builder toBuilder() { return new Builder(this); } - private WebhookName(Builder builder) { - project = Preconditions.checkNotNull(builder.getProject()); - location = Preconditions.checkNotNull(builder.getLocation()); - agent = Preconditions.checkNotNull(builder.getAgent()); - webhook = Preconditions.checkNotNull(builder.getWebhook()); - } - public static WebhookName of(String project, String location, String agent, String webhook) { return newBuilder() .setProject(project) @@ -94,7 +101,7 @@ public static WebhookName parse(String formattedString) { return null; } Map matchMap = - PATH_TEMPLATE.validatedMatch( + PROJECT_LOCATION_AGENT_WEBHOOK.validatedMatch( formattedString, "WebhookName.parse: formattedString not in valid format"); return of( matchMap.get("project"), @@ -112,7 +119,7 @@ public static List parseList(List formattedStrings) { } public static List toStringList(List values) { - List list = new ArrayList(values.size()); + List list = new ArrayList<>(values.size()); for (WebhookName value : values) { if (value == null) { list.add(""); @@ -124,18 +131,27 @@ public static List toStringList(List values) { } public static boolean isParsableFrom(String formattedString) { - return PATH_TEMPLATE.matches(formattedString); + return PROJECT_LOCATION_AGENT_WEBHOOK.matches(formattedString); } + @Override public Map getFieldValuesMap() { if (fieldValuesMap == null) { synchronized (this) { if (fieldValuesMap == null) { ImmutableMap.Builder fieldMapBuilder = ImmutableMap.builder(); - fieldMapBuilder.put("project", project); - fieldMapBuilder.put("location", location); - fieldMapBuilder.put("agent", agent); - fieldMapBuilder.put("webhook", webhook); + if (project != null) { + fieldMapBuilder.put("project", project); + } + if (location != null) { + fieldMapBuilder.put("location", location); + } + if (agent != null) { + fieldMapBuilder.put("agent", agent); + } + if (webhook != null) { + fieldMapBuilder.put("webhook", webhook); + } fieldValuesMap = fieldMapBuilder.build(); } } @@ -149,18 +165,48 @@ public String getFieldValue(String fieldName) { @Override public String toString() { - return PATH_TEMPLATE.instantiate( + return PROJECT_LOCATION_AGENT_WEBHOOK.instantiate( "project", project, "location", location, "agent", agent, "webhook", webhook); } - /** Builder for WebhookName. */ - public static class Builder { + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o != null || getClass() == o.getClass()) { + WebhookName that = ((WebhookName) o); + return Objects.equals(this.project, that.project) + && Objects.equals(this.location, that.location) + && Objects.equals(this.agent, that.agent) + && Objects.equals(this.webhook, that.webhook); + } + return false; + } + @Override + public int hashCode() { + int h = 1; + h *= 1000003; + h ^= Objects.hashCode(project); + h *= 1000003; + h ^= Objects.hashCode(location); + h *= 1000003; + h ^= Objects.hashCode(agent); + h *= 1000003; + h ^= Objects.hashCode(webhook); + return h; + } + + /** Builder for projects/{project}/locations/{location}/agents/{agent}/webhooks/{webhook}. */ + public static class Builder { private String project; private String location; private String agent; private String webhook; + protected Builder() {} + public String getProject() { return project; } @@ -197,8 +243,6 @@ public Builder setWebhook(String webhook) { return this; } - private Builder() {} - private Builder(WebhookName webhookName) { project = webhookName.project; location = webhookName.location; @@ -210,33 +254,4 @@ public WebhookName build() { return new WebhookName(this); } } - - @Override - public boolean equals(Object o) { - if (o == this) { - return true; - } - if (o instanceof WebhookName) { - WebhookName that = (WebhookName) o; - return (this.project.equals(that.project)) - && (this.location.equals(that.location)) - && (this.agent.equals(that.agent)) - && (this.webhook.equals(that.webhook)); - } - return false; - } - - @Override - public int hashCode() { - int h = 1; - h *= 1000003; - h ^= project.hashCode(); - h *= 1000003; - h ^= location.hashCode(); - h *= 1000003; - h ^= agent.hashCode(); - h *= 1000003; - h ^= webhook.hashCode(); - return h; - } } diff --git a/proto-google-cloud-dialogflow-cx-v3beta1/src/main/proto/google/cloud/dialogflow/cx/v3beta1/response_message.proto b/proto-google-cloud-dialogflow-cx-v3beta1/src/main/proto/google/cloud/dialogflow/cx/v3beta1/response_message.proto index 7a9f96500..ac3b61cd0 100644 --- a/proto-google-cloud-dialogflow-cx-v3beta1/src/main/proto/google/cloud/dialogflow/cx/v3beta1/response_message.proto +++ b/proto-google-cloud-dialogflow-cx-v3beta1/src/main/proto/google/cloud/dialogflow/cx/v3beta1/response_message.proto @@ -113,6 +113,25 @@ message ResponseMessage { bool allow_playback_interruption = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; } + // Specifies an audio clip to be played by the client as part of the response. + message PlayAudio { + // Required. URI of the audio clip. Dialogflow does not impose any validation on this + // value. It is specific to the client that reads it. + string audio_uri = 1 [(google.api.field_behavior) = REQUIRED]; + + // Output only. Whether the playback of this message can be interrupted by the end + // user's speech and the client can then starts the next Dialogflow + // request. + bool allow_playback_interruption = 2 [(google.api.field_behavior) = OUTPUT_ONLY]; + } + + // Indicates that interaction with the Dialogflow agent has ended. + // This message is generated by Dialogflow only and not supposed to be + // defined by the user. + message EndInteraction { + + } + // Represents an audio message that is composed of both segments // synthesized from the Dialogflow agent prompts and ones hosted externally // at the specified URIs. @@ -144,25 +163,6 @@ message ResponseMessage { repeated Segment segments = 1; } - // Indicates that interaction with the Dialogflow agent has ended. - // This message is generated by Dialogflow only and not supposed to be - // defined by the user. - message EndInteraction { - - } - - // Specifies an audio clip to be played by the client as part of the response. - message PlayAudio { - // Required. URI of the audio clip. Dialogflow does not impose any validation on this - // value. It is specific to the client that reads it. - string audio_uri = 1 [(google.api.field_behavior) = REQUIRED]; - - // Output only. Whether the playback of this message can be interrupted by the end - // user's speech and the client can then starts the next Dialogflow - // request. - bool allow_playback_interruption = 2 [(google.api.field_behavior) = OUTPUT_ONLY]; - } - // Required. The rich response message. oneof message { // Returns a text response. diff --git a/proto-google-cloud-dialogflow-cx-v3beta1/src/main/proto/google/cloud/dialogflow/cx/v3beta1/session.proto b/proto-google-cloud-dialogflow-cx-v3beta1/src/main/proto/google/cloud/dialogflow/cx/v3beta1/session.proto index 9b94a19db..8b4040815 100644 --- a/proto-google-cloud-dialogflow-cx-v3beta1/src/main/proto/google/cloud/dialogflow/cx/v3beta1/session.proto +++ b/proto-google-cloud-dialogflow-cx-v3beta1/src/main/proto/google/cloud/dialogflow/cx/v3beta1/session.proto @@ -57,6 +57,10 @@ service Sessions { // as a result. This method is not idempotent, because it may cause session // entity types to be updated, which in turn might affect results of future // queries. + // + // Note: Always use agent versions for production traffic. + // See [Versions and + // environments](https://cloud.google.com/dialogflow/cx/docs/concept/version). rpc DetectIntent(DetectIntentRequest) returns (DetectIntentResponse) { option (google.api.http) = { post: "/v3beta1/{session=projects/*/locations/*/agents/*/sessions/*}:detectIntent" @@ -71,6 +75,10 @@ service Sessions { // Processes a natural language query in audio format in a streaming fashion // and returns structured, actionable data as a result. This method is only // available via the gRPC API (not REST). + // + // Note: Always use agent versions for production traffic. + // See [Versions and + // environments](https://cloud.google.com/dialogflow/cx/docs/concept/version). rpc StreamingDetectIntent(stream StreamingDetectIntentRequest) returns (stream StreamingDetectIntentResponse) { } @@ -116,6 +124,10 @@ message DetectIntentRequest { // // For more information, see the [sessions // guide](https://cloud.google.com/dialogflow/cx/docs/concept/session). + // + // Note: Always use agent versions for production traffic. + // See [Versions and + // environments](https://cloud.google.com/dialogflow/cx/docs/concept/version). string session = 1 [ (google.api.field_behavior) = REQUIRED, (google.api.resource_reference) = { @@ -201,6 +213,10 @@ message StreamingDetectIntentRequest { // // For more information, see the [sessions // guide](https://cloud.google.com/dialogflow/cx/docs/concept/session). + // + // Note: Always use agent versions for production traffic. + // See [Versions and + // environments](https://cloud.google.com/dialogflow/cx/docs/concept/version). string session = 1 [(google.api.resource_reference) = { type: "dialogflow.googleapis.com/Session" }]; @@ -374,6 +390,16 @@ message QueryParameters { // Configures whether sentiment analysis should be performed. If not // provided, sentiment analysis is not performed. bool analyze_query_text_sentiment = 8; + + // This field can be used to pass HTTP headers for a webhook + // call. These headers will be sent to webhook along with the headers that + // have been configured through Dialogflow web console. The headers defined + // within this field will overwrite the headers configured through Dialogflow + // console if there is a conflict. Header names are case-insensitive. + // Google's specified headers are not allowed. Including: "Host", + // "Content-Length", "Connection", "From", "User-Agent", "Accept-Encoding", + // "If-Modified-Since", "If-None-Match", "X-Forwarded-For", etc. + map webhook_headers = 10; } // Represents the query input. It can contain one of: diff --git a/synth.metadata b/synth.metadata index 321ec7622..fcdbe2cdb 100644 --- a/synth.metadata +++ b/synth.metadata @@ -4,15 +4,23 @@ "git": { "name": ".", "remote": "https://github.com/googleapis/java-dialogflow-cx.git", - "sha": "522605306b3de5af16aec2d786a4b8048cccda11" + "sha": "d5edca3dfa256fabcb10d86bb46ed7ca61ff0872" } }, { "git": { "name": "googleapis", "remote": "https://github.com/googleapis/googleapis.git", - "sha": "6c0f55f33f882cf97fd3135e93b144ad9c94ebab", - "internalRef": "341478628" + "sha": "e4d01555afeb93d2f3b467056ea884b092567d1b", + "internalRef": "346434847" + } + }, + { + "git": { + "name": "googleapis", + "remote": "https://github.com/googleapis/googleapis.git", + "sha": "e4d01555afeb93d2f3b467056ea884b092567d1b", + "internalRef": "346434847" } }, {