2020import com .google .api .core .ApiFutures ;
2121import com .google .api .core .BetaApi ;
2222import com .google .api .gax .core .BackgroundResource ;
23+ import com .google .api .gax .httpjson .longrunning .OperationsClient ;
24+ import com .google .api .gax .longrunning .OperationFuture ;
2325import com .google .api .gax .paging .AbstractFixedSizeCollection ;
2426import com .google .api .gax .paging .AbstractPage ;
2527import com .google .api .gax .paging .AbstractPagedListResponse ;
28+ import com .google .api .gax .rpc .OperationCallable ;
2629import com .google .api .gax .rpc .PageContext ;
2730import com .google .api .gax .rpc .UnaryCallable ;
2831import com .google .cloud .dialogflow .cx .v3beta1 .stub .IntentsStub ;
3235import com .google .cloud .location .ListLocationsResponse ;
3336import com .google .cloud .location .Location ;
3437import com .google .common .util .concurrent .MoreExecutors ;
38+ import com .google .longrunning .Operation ;
3539import com .google .protobuf .Empty ;
3640import com .google .protobuf .FieldMask ;
3741import java .io .IOException ;
131135public class IntentsClient implements BackgroundResource {
132136 private final IntentsSettings settings ;
133137 private final IntentsStub stub ;
138+ private final OperationsClient httpJsonOperationsClient ;
139+ private final com .google .longrunning .OperationsClient operationsClient ;
134140
135141 /** Constructs an instance of IntentsClient with default settings. */
136142 public static final IntentsClient create () throws IOException {
@@ -160,11 +166,17 @@ public static final IntentsClient create(IntentsStub stub) {
160166 protected IntentsClient (IntentsSettings settings ) throws IOException {
161167 this .settings = settings ;
162168 this .stub = ((IntentsStubSettings ) settings .getStubSettings ()).createStub ();
169+ this .operationsClient =
170+ com .google .longrunning .OperationsClient .create (this .stub .getOperationsStub ());
171+ this .httpJsonOperationsClient = OperationsClient .create (this .stub .getHttpJsonOperationsStub ());
163172 }
164173
165174 protected IntentsClient (IntentsStub stub ) {
166175 this .settings = null ;
167176 this .stub = stub ;
177+ this .operationsClient =
178+ com .google .longrunning .OperationsClient .create (this .stub .getOperationsStub ());
179+ this .httpJsonOperationsClient = OperationsClient .create (this .stub .getHttpJsonOperationsStub ());
168180 }
169181
170182 public final IntentsSettings getSettings () {
@@ -175,6 +187,23 @@ public IntentsStub getStub() {
175187 return stub ;
176188 }
177189
190+ /**
191+ * Returns the OperationsClient that can be used to query the status of a long-running operation
192+ * returned by another API method call.
193+ */
194+ public final com .google .longrunning .OperationsClient getOperationsClient () {
195+ return operationsClient ;
196+ }
197+
198+ /**
199+ * Returns the OperationsClient that can be used to query the status of a long-running operation
200+ * returned by another API method call.
201+ */
202+ @ BetaApi
203+ public final OperationsClient getHttpJsonOperationsClient () {
204+ return httpJsonOperationsClient ;
205+ }
206+
178207 // AUTO-GENERATED DOCUMENTATION AND METHOD.
179208 /**
180209 * Returns the list of all intents in the specified agent.
@@ -810,6 +839,227 @@ public final UnaryCallable<DeleteIntentRequest, Empty> deleteIntentCallable() {
810839 return stub .deleteIntentCallable ();
811840 }
812841
842+ // AUTO-GENERATED DOCUMENTATION AND METHOD.
843+ /**
844+ * Imports the specified intents into the agent.
845+ *
846+ * <p>This method is a [long-running
847+ * operation](https://cloud.google.com/dialogflow/cx/docs/how/long-running-operation). The
848+ * returned `Operation` type has the following method-specific fields:
849+ *
850+ * <p>- `metadata`:
851+ * [ImportIntentsMetadata][google.cloud.dialogflow.cx.v3beta1.ImportIntentsMetadata] - `response`:
852+ * [ImportIntentsResponse][google.cloud.dialogflow.cx.v3beta1.ImportIntentsResponse]
853+ *
854+ * <p>Sample code:
855+ *
856+ * <pre>{@code
857+ * // This snippet has been automatically generated and should be regarded as a code template only.
858+ * // It will require modifications to work:
859+ * // - It may require correct/in-range values for request initialization.
860+ * // - It may require specifying regional endpoints when creating the service client as shown in
861+ * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
862+ * try (IntentsClient intentsClient = IntentsClient.create()) {
863+ * ImportIntentsRequest request =
864+ * ImportIntentsRequest.newBuilder()
865+ * .setParent(AgentName.of("[PROJECT]", "[LOCATION]", "[AGENT]").toString())
866+ * .build();
867+ * ImportIntentsResponse response = intentsClient.importIntentsAsync(request).get();
868+ * }
869+ * }</pre>
870+ *
871+ * @param request The request object containing all of the parameters for the API call.
872+ * @throws com.google.api.gax.rpc.ApiException if the remote call fails
873+ */
874+ public final OperationFuture <ImportIntentsResponse , ImportIntentsMetadata > importIntentsAsync (
875+ ImportIntentsRequest request ) {
876+ return importIntentsOperationCallable ().futureCall (request );
877+ }
878+
879+ // AUTO-GENERATED DOCUMENTATION AND METHOD.
880+ /**
881+ * Imports the specified intents into the agent.
882+ *
883+ * <p>This method is a [long-running
884+ * operation](https://cloud.google.com/dialogflow/cx/docs/how/long-running-operation). The
885+ * returned `Operation` type has the following method-specific fields:
886+ *
887+ * <p>- `metadata`:
888+ * [ImportIntentsMetadata][google.cloud.dialogflow.cx.v3beta1.ImportIntentsMetadata] - `response`:
889+ * [ImportIntentsResponse][google.cloud.dialogflow.cx.v3beta1.ImportIntentsResponse]
890+ *
891+ * <p>Sample code:
892+ *
893+ * <pre>{@code
894+ * // This snippet has been automatically generated and should be regarded as a code template only.
895+ * // It will require modifications to work:
896+ * // - It may require correct/in-range values for request initialization.
897+ * // - It may require specifying regional endpoints when creating the service client as shown in
898+ * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
899+ * try (IntentsClient intentsClient = IntentsClient.create()) {
900+ * ImportIntentsRequest request =
901+ * ImportIntentsRequest.newBuilder()
902+ * .setParent(AgentName.of("[PROJECT]", "[LOCATION]", "[AGENT]").toString())
903+ * .build();
904+ * OperationFuture<ImportIntentsResponse, ImportIntentsMetadata> future =
905+ * intentsClient.importIntentsOperationCallable().futureCall(request);
906+ * // Do something.
907+ * ImportIntentsResponse response = future.get();
908+ * }
909+ * }</pre>
910+ */
911+ public final OperationCallable <ImportIntentsRequest , ImportIntentsResponse , ImportIntentsMetadata >
912+ importIntentsOperationCallable () {
913+ return stub .importIntentsOperationCallable ();
914+ }
915+
916+ // AUTO-GENERATED DOCUMENTATION AND METHOD.
917+ /**
918+ * Imports the specified intents into the agent.
919+ *
920+ * <p>This method is a [long-running
921+ * operation](https://cloud.google.com/dialogflow/cx/docs/how/long-running-operation). The
922+ * returned `Operation` type has the following method-specific fields:
923+ *
924+ * <p>- `metadata`:
925+ * [ImportIntentsMetadata][google.cloud.dialogflow.cx.v3beta1.ImportIntentsMetadata] - `response`:
926+ * [ImportIntentsResponse][google.cloud.dialogflow.cx.v3beta1.ImportIntentsResponse]
927+ *
928+ * <p>Sample code:
929+ *
930+ * <pre>{@code
931+ * // This snippet has been automatically generated and should be regarded as a code template only.
932+ * // It will require modifications to work:
933+ * // - It may require correct/in-range values for request initialization.
934+ * // - It may require specifying regional endpoints when creating the service client as shown in
935+ * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
936+ * try (IntentsClient intentsClient = IntentsClient.create()) {
937+ * ImportIntentsRequest request =
938+ * ImportIntentsRequest.newBuilder()
939+ * .setParent(AgentName.of("[PROJECT]", "[LOCATION]", "[AGENT]").toString())
940+ * .build();
941+ * ApiFuture<Operation> future = intentsClient.importIntentsCallable().futureCall(request);
942+ * // Do something.
943+ * Operation response = future.get();
944+ * }
945+ * }</pre>
946+ */
947+ public final UnaryCallable <ImportIntentsRequest , Operation > importIntentsCallable () {
948+ return stub .importIntentsCallable ();
949+ }
950+
951+ // AUTO-GENERATED DOCUMENTATION AND METHOD.
952+ /**
953+ * Exports the selected intents.
954+ *
955+ * <p>This method is a [long-running
956+ * operation](https://cloud.google.com/dialogflow/cx/docs/how/long-running-operation). The
957+ * returned `Operation` type has the following method-specific fields:
958+ *
959+ * <p>- `metadata`:
960+ * [ExportIntentsMetadata][google.cloud.dialogflow.cx.v3beta1.ExportIntentsMetadata] - `response`:
961+ * [ExportIntentsResponse][google.cloud.dialogflow.cx.v3beta1.ExportIntentsResponse]
962+ *
963+ * <p>Sample code:
964+ *
965+ * <pre>{@code
966+ * // This snippet has been automatically generated and should be regarded as a code template only.
967+ * // It will require modifications to work:
968+ * // - It may require correct/in-range values for request initialization.
969+ * // - It may require specifying regional endpoints when creating the service client as shown in
970+ * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
971+ * try (IntentsClient intentsClient = IntentsClient.create()) {
972+ * ExportIntentsRequest request =
973+ * ExportIntentsRequest.newBuilder()
974+ * .setParent(AgentName.of("[PROJECT]", "[LOCATION]", "[AGENT]").toString())
975+ * .addAllIntents(new ArrayList<String>())
976+ * .build();
977+ * ExportIntentsResponse response = intentsClient.exportIntentsAsync(request).get();
978+ * }
979+ * }</pre>
980+ *
981+ * @param request The request object containing all of the parameters for the API call.
982+ * @throws com.google.api.gax.rpc.ApiException if the remote call fails
983+ */
984+ public final OperationFuture <ExportIntentsResponse , ExportIntentsMetadata > exportIntentsAsync (
985+ ExportIntentsRequest request ) {
986+ return exportIntentsOperationCallable ().futureCall (request );
987+ }
988+
989+ // AUTO-GENERATED DOCUMENTATION AND METHOD.
990+ /**
991+ * Exports the selected intents.
992+ *
993+ * <p>This method is a [long-running
994+ * operation](https://cloud.google.com/dialogflow/cx/docs/how/long-running-operation). The
995+ * returned `Operation` type has the following method-specific fields:
996+ *
997+ * <p>- `metadata`:
998+ * [ExportIntentsMetadata][google.cloud.dialogflow.cx.v3beta1.ExportIntentsMetadata] - `response`:
999+ * [ExportIntentsResponse][google.cloud.dialogflow.cx.v3beta1.ExportIntentsResponse]
1000+ *
1001+ * <p>Sample code:
1002+ *
1003+ * <pre>{@code
1004+ * // This snippet has been automatically generated and should be regarded as a code template only.
1005+ * // It will require modifications to work:
1006+ * // - It may require correct/in-range values for request initialization.
1007+ * // - It may require specifying regional endpoints when creating the service client as shown in
1008+ * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
1009+ * try (IntentsClient intentsClient = IntentsClient.create()) {
1010+ * ExportIntentsRequest request =
1011+ * ExportIntentsRequest.newBuilder()
1012+ * .setParent(AgentName.of("[PROJECT]", "[LOCATION]", "[AGENT]").toString())
1013+ * .addAllIntents(new ArrayList<String>())
1014+ * .build();
1015+ * OperationFuture<ExportIntentsResponse, ExportIntentsMetadata> future =
1016+ * intentsClient.exportIntentsOperationCallable().futureCall(request);
1017+ * // Do something.
1018+ * ExportIntentsResponse response = future.get();
1019+ * }
1020+ * }</pre>
1021+ */
1022+ public final OperationCallable <ExportIntentsRequest , ExportIntentsResponse , ExportIntentsMetadata >
1023+ exportIntentsOperationCallable () {
1024+ return stub .exportIntentsOperationCallable ();
1025+ }
1026+
1027+ // AUTO-GENERATED DOCUMENTATION AND METHOD.
1028+ /**
1029+ * Exports the selected intents.
1030+ *
1031+ * <p>This method is a [long-running
1032+ * operation](https://cloud.google.com/dialogflow/cx/docs/how/long-running-operation). The
1033+ * returned `Operation` type has the following method-specific fields:
1034+ *
1035+ * <p>- `metadata`:
1036+ * [ExportIntentsMetadata][google.cloud.dialogflow.cx.v3beta1.ExportIntentsMetadata] - `response`:
1037+ * [ExportIntentsResponse][google.cloud.dialogflow.cx.v3beta1.ExportIntentsResponse]
1038+ *
1039+ * <p>Sample code:
1040+ *
1041+ * <pre>{@code
1042+ * // This snippet has been automatically generated and should be regarded as a code template only.
1043+ * // It will require modifications to work:
1044+ * // - It may require correct/in-range values for request initialization.
1045+ * // - It may require specifying regional endpoints when creating the service client as shown in
1046+ * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
1047+ * try (IntentsClient intentsClient = IntentsClient.create()) {
1048+ * ExportIntentsRequest request =
1049+ * ExportIntentsRequest.newBuilder()
1050+ * .setParent(AgentName.of("[PROJECT]", "[LOCATION]", "[AGENT]").toString())
1051+ * .addAllIntents(new ArrayList<String>())
1052+ * .build();
1053+ * ApiFuture<Operation> future = intentsClient.exportIntentsCallable().futureCall(request);
1054+ * // Do something.
1055+ * Operation response = future.get();
1056+ * }
1057+ * }</pre>
1058+ */
1059+ public final UnaryCallable <ExportIntentsRequest , Operation > exportIntentsCallable () {
1060+ return stub .exportIntentsCallable ();
1061+ }
1062+
8131063 // AUTO-GENERATED DOCUMENTATION AND METHOD.
8141064 /**
8151065 * Lists information about the supported locations for this service.
0 commit comments