19
19
import com .google .api .core .ApiFuture ;
20
20
import com .google .api .core .ApiFutures ;
21
21
import com .google .api .gax .core .BackgroundResource ;
22
+ import com .google .api .gax .httpjson .longrunning .OperationsClient ;
22
23
import com .google .api .gax .longrunning .OperationFuture ;
23
24
import com .google .api .gax .paging .AbstractFixedSizeCollection ;
24
25
import com .google .api .gax .paging .AbstractPage ;
28
29
import com .google .api .gax .rpc .UnaryCallable ;
29
30
import com .google .cloud .dialogflow .cx .v3 .stub .AgentsStub ;
30
31
import com .google .cloud .dialogflow .cx .v3 .stub .AgentsStubSettings ;
32
+ import com .google .cloud .location .GetLocationRequest ;
33
+ import com .google .cloud .location .ListLocationsRequest ;
34
+ import com .google .cloud .location .ListLocationsResponse ;
35
+ import com .google .cloud .location .Location ;
31
36
import com .google .common .util .concurrent .MoreExecutors ;
32
37
import com .google .longrunning .Operation ;
33
- import com .google .longrunning .OperationsClient ;
34
38
import com .google .protobuf .Empty ;
35
39
import com .google .protobuf .FieldMask ;
36
40
import com .google .protobuf .Struct ;
102
106
* AgentsClient agentsClient = AgentsClient.create(agentsSettings);
103
107
* }</pre>
104
108
*
109
+ * <p>To use REST (HTTP1.1/JSON) transport (instead of gRPC) for sending and receiving requests over
110
+ * the wire:
111
+ *
112
+ * <pre>{@code
113
+ * // This snippet has been automatically generated for illustrative purposes only.
114
+ * // It may require modifications to work in your environment.
115
+ * AgentsSettings agentsSettings =
116
+ * AgentsSettings.newBuilder()
117
+ * .setTransportChannelProvider(
118
+ * AgentsSettings.defaultHttpJsonTransportProviderBuilder().build())
119
+ * .build();
120
+ * AgentsClient agentsClient = AgentsClient.create(agentsSettings);
121
+ * }</pre>
122
+ *
105
123
* <p>Please refer to the GitHub repository's samples for more quickstart code snippets.
106
124
*/
107
125
@ Generated ("by gapic-generator-java" )
108
126
public class AgentsClient implements BackgroundResource {
109
127
private final AgentsSettings settings ;
110
128
private final AgentsStub stub ;
111
- private final OperationsClient operationsClient ;
129
+ private final OperationsClient httpJsonOperationsClient ;
130
+ private final com .google .longrunning .OperationsClient operationsClient ;
112
131
113
132
/** Constructs an instance of AgentsClient with default settings. */
114
133
public static final AgentsClient create () throws IOException {
@@ -138,13 +157,17 @@ public static final AgentsClient create(AgentsStub stub) {
138
157
protected AgentsClient (AgentsSettings settings ) throws IOException {
139
158
this .settings = settings ;
140
159
this .stub = ((AgentsStubSettings ) settings .getStubSettings ()).createStub ();
141
- this .operationsClient = OperationsClient .create (this .stub .getOperationsStub ());
160
+ this .operationsClient =
161
+ com .google .longrunning .OperationsClient .create (this .stub .getOperationsStub ());
162
+ this .httpJsonOperationsClient = OperationsClient .create (this .stub .getHttpJsonOperationsStub ());
142
163
}
143
164
144
165
protected AgentsClient (AgentsStub stub ) {
145
166
this .settings = null ;
146
167
this .stub = stub ;
147
- this .operationsClient = OperationsClient .create (this .stub .getOperationsStub ());
168
+ this .operationsClient =
169
+ com .google .longrunning .OperationsClient .create (this .stub .getOperationsStub ());
170
+ this .httpJsonOperationsClient = OperationsClient .create (this .stub .getHttpJsonOperationsStub ());
148
171
}
149
172
150
173
public final AgentsSettings getSettings () {
@@ -159,10 +182,18 @@ public AgentsStub getStub() {
159
182
* Returns the OperationsClient that can be used to query the status of a long-running operation
160
183
* returned by another API method call.
161
184
*/
162
- public final OperationsClient getOperationsClient () {
185
+ public final com . google . longrunning . OperationsClient getOperationsClient () {
163
186
return operationsClient ;
164
187
}
165
188
189
+ /**
190
+ * Returns the OperationsClient that can be used to query the status of a long-running operation
191
+ * returned by another API method call.
192
+ */
193
+ public final OperationsClient getHttpJsonOperationsClient () {
194
+ return httpJsonOperationsClient ;
195
+ }
196
+
166
197
// AUTO-GENERATED DOCUMENTATION AND METHOD.
167
198
/**
168
199
* Returns the list of all agents in the specified location.
@@ -291,7 +322,7 @@ public final UnaryCallable<ListAgentsRequest, ListAgentsPagedResponse> listAgent
291
322
* .build();
292
323
* while (true) {
293
324
* ListAgentsResponse response = agentsClient.listAgentsCallable().call(request);
294
- * for (Agent element : response.getResponsesList ()) {
325
+ * for (Agent element : response.getAgentsList ()) {
295
326
* // doThingsWith(element);
296
327
* }
297
328
* String nextPageToken = response.getNextPageToken();
@@ -1112,6 +1143,145 @@ public final AgentValidationResult getAgentValidationResult(
1112
1143
return stub .getAgentValidationResultCallable ();
1113
1144
}
1114
1145
1146
+ // AUTO-GENERATED DOCUMENTATION AND METHOD.
1147
+ /**
1148
+ * Lists information about the supported locations for this service.
1149
+ *
1150
+ * <p>Sample code:
1151
+ *
1152
+ * <pre>{@code
1153
+ * // This snippet has been automatically generated for illustrative purposes only.
1154
+ * // It may require modifications to work in your environment.
1155
+ * try (AgentsClient agentsClient = AgentsClient.create()) {
1156
+ * ListLocationsRequest request =
1157
+ * ListLocationsRequest.newBuilder()
1158
+ * .setName("name3373707")
1159
+ * .setFilter("filter-1274492040")
1160
+ * .setPageSize(883849137)
1161
+ * .setPageToken("pageToken873572522")
1162
+ * .build();
1163
+ * for (Location element : agentsClient.listLocations(request).iterateAll()) {
1164
+ * // doThingsWith(element);
1165
+ * }
1166
+ * }
1167
+ * }</pre>
1168
+ *
1169
+ * @param request The request object containing all of the parameters for the API call.
1170
+ * @throws com.google.api.gax.rpc.ApiException if the remote call fails
1171
+ */
1172
+ public final ListLocationsPagedResponse listLocations (ListLocationsRequest request ) {
1173
+ return listLocationsPagedCallable ().call (request );
1174
+ }
1175
+
1176
+ // AUTO-GENERATED DOCUMENTATION AND METHOD.
1177
+ /**
1178
+ * Lists information about the supported locations for this service.
1179
+ *
1180
+ * <p>Sample code:
1181
+ *
1182
+ * <pre>{@code
1183
+ * // This snippet has been automatically generated for illustrative purposes only.
1184
+ * // It may require modifications to work in your environment.
1185
+ * try (AgentsClient agentsClient = AgentsClient.create()) {
1186
+ * ListLocationsRequest request =
1187
+ * ListLocationsRequest.newBuilder()
1188
+ * .setName("name3373707")
1189
+ * .setFilter("filter-1274492040")
1190
+ * .setPageSize(883849137)
1191
+ * .setPageToken("pageToken873572522")
1192
+ * .build();
1193
+ * ApiFuture<Location> future = agentsClient.listLocationsPagedCallable().futureCall(request);
1194
+ * // Do something.
1195
+ * for (Location element : future.get().iterateAll()) {
1196
+ * // doThingsWith(element);
1197
+ * }
1198
+ * }
1199
+ * }</pre>
1200
+ */
1201
+ public final UnaryCallable <ListLocationsRequest , ListLocationsPagedResponse >
1202
+ listLocationsPagedCallable () {
1203
+ return stub .listLocationsPagedCallable ();
1204
+ }
1205
+
1206
+ // AUTO-GENERATED DOCUMENTATION AND METHOD.
1207
+ /**
1208
+ * Lists information about the supported locations for this service.
1209
+ *
1210
+ * <p>Sample code:
1211
+ *
1212
+ * <pre>{@code
1213
+ * // This snippet has been automatically generated for illustrative purposes only.
1214
+ * // It may require modifications to work in your environment.
1215
+ * try (AgentsClient agentsClient = AgentsClient.create()) {
1216
+ * ListLocationsRequest request =
1217
+ * ListLocationsRequest.newBuilder()
1218
+ * .setName("name3373707")
1219
+ * .setFilter("filter-1274492040")
1220
+ * .setPageSize(883849137)
1221
+ * .setPageToken("pageToken873572522")
1222
+ * .build();
1223
+ * while (true) {
1224
+ * ListLocationsResponse response = agentsClient.listLocationsCallable().call(request);
1225
+ * for (Location element : response.getLocationsList()) {
1226
+ * // doThingsWith(element);
1227
+ * }
1228
+ * String nextPageToken = response.getNextPageToken();
1229
+ * if (!Strings.isNullOrEmpty(nextPageToken)) {
1230
+ * request = request.toBuilder().setPageToken(nextPageToken).build();
1231
+ * } else {
1232
+ * break;
1233
+ * }
1234
+ * }
1235
+ * }
1236
+ * }</pre>
1237
+ */
1238
+ public final UnaryCallable <ListLocationsRequest , ListLocationsResponse > listLocationsCallable () {
1239
+ return stub .listLocationsCallable ();
1240
+ }
1241
+
1242
+ // AUTO-GENERATED DOCUMENTATION AND METHOD.
1243
+ /**
1244
+ * Gets information about a location.
1245
+ *
1246
+ * <p>Sample code:
1247
+ *
1248
+ * <pre>{@code
1249
+ * // This snippet has been automatically generated for illustrative purposes only.
1250
+ * // It may require modifications to work in your environment.
1251
+ * try (AgentsClient agentsClient = AgentsClient.create()) {
1252
+ * GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build();
1253
+ * Location response = agentsClient.getLocation(request);
1254
+ * }
1255
+ * }</pre>
1256
+ *
1257
+ * @param request The request object containing all of the parameters for the API call.
1258
+ * @throws com.google.api.gax.rpc.ApiException if the remote call fails
1259
+ */
1260
+ public final Location getLocation (GetLocationRequest request ) {
1261
+ return getLocationCallable ().call (request );
1262
+ }
1263
+
1264
+ // AUTO-GENERATED DOCUMENTATION AND METHOD.
1265
+ /**
1266
+ * Gets information about a location.
1267
+ *
1268
+ * <p>Sample code:
1269
+ *
1270
+ * <pre>{@code
1271
+ * // This snippet has been automatically generated for illustrative purposes only.
1272
+ * // It may require modifications to work in your environment.
1273
+ * try (AgentsClient agentsClient = AgentsClient.create()) {
1274
+ * GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build();
1275
+ * ApiFuture<Location> future = agentsClient.getLocationCallable().futureCall(request);
1276
+ * // Do something.
1277
+ * Location response = future.get();
1278
+ * }
1279
+ * }</pre>
1280
+ */
1281
+ public final UnaryCallable <GetLocationRequest , Location > getLocationCallable () {
1282
+ return stub .getLocationCallable ();
1283
+ }
1284
+
1115
1285
@ Override
1116
1286
public final void close () {
1117
1287
stub .close ();
@@ -1214,4 +1384,80 @@ protected ListAgentsFixedSizeCollection createCollection(
1214
1384
return new ListAgentsFixedSizeCollection (pages , collectionSize );
1215
1385
}
1216
1386
}
1387
+
1388
+ public static class ListLocationsPagedResponse
1389
+ extends AbstractPagedListResponse <
1390
+ ListLocationsRequest ,
1391
+ ListLocationsResponse ,
1392
+ Location ,
1393
+ ListLocationsPage ,
1394
+ ListLocationsFixedSizeCollection > {
1395
+
1396
+ public static ApiFuture <ListLocationsPagedResponse > createAsync (
1397
+ PageContext <ListLocationsRequest , ListLocationsResponse , Location > context ,
1398
+ ApiFuture <ListLocationsResponse > futureResponse ) {
1399
+ ApiFuture <ListLocationsPage > futurePage =
1400
+ ListLocationsPage .createEmptyPage ().createPageAsync (context , futureResponse );
1401
+ return ApiFutures .transform (
1402
+ futurePage ,
1403
+ input -> new ListLocationsPagedResponse (input ),
1404
+ MoreExecutors .directExecutor ());
1405
+ }
1406
+
1407
+ private ListLocationsPagedResponse (ListLocationsPage page ) {
1408
+ super (page , ListLocationsFixedSizeCollection .createEmptyCollection ());
1409
+ }
1410
+ }
1411
+
1412
+ public static class ListLocationsPage
1413
+ extends AbstractPage <
1414
+ ListLocationsRequest , ListLocationsResponse , Location , ListLocationsPage > {
1415
+
1416
+ private ListLocationsPage (
1417
+ PageContext <ListLocationsRequest , ListLocationsResponse , Location > context ,
1418
+ ListLocationsResponse response ) {
1419
+ super (context , response );
1420
+ }
1421
+
1422
+ private static ListLocationsPage createEmptyPage () {
1423
+ return new ListLocationsPage (null , null );
1424
+ }
1425
+
1426
+ @ Override
1427
+ protected ListLocationsPage createPage (
1428
+ PageContext <ListLocationsRequest , ListLocationsResponse , Location > context ,
1429
+ ListLocationsResponse response ) {
1430
+ return new ListLocationsPage (context , response );
1431
+ }
1432
+
1433
+ @ Override
1434
+ public ApiFuture <ListLocationsPage > createPageAsync (
1435
+ PageContext <ListLocationsRequest , ListLocationsResponse , Location > context ,
1436
+ ApiFuture <ListLocationsResponse > futureResponse ) {
1437
+ return super .createPageAsync (context , futureResponse );
1438
+ }
1439
+ }
1440
+
1441
+ public static class ListLocationsFixedSizeCollection
1442
+ extends AbstractFixedSizeCollection <
1443
+ ListLocationsRequest ,
1444
+ ListLocationsResponse ,
1445
+ Location ,
1446
+ ListLocationsPage ,
1447
+ ListLocationsFixedSizeCollection > {
1448
+
1449
+ private ListLocationsFixedSizeCollection (List <ListLocationsPage > pages , int collectionSize ) {
1450
+ super (pages , collectionSize );
1451
+ }
1452
+
1453
+ private static ListLocationsFixedSizeCollection createEmptyCollection () {
1454
+ return new ListLocationsFixedSizeCollection (null , 0 );
1455
+ }
1456
+
1457
+ @ Override
1458
+ protected ListLocationsFixedSizeCollection createCollection (
1459
+ List <ListLocationsPage > pages , int collectionSize ) {
1460
+ return new ListLocationsFixedSizeCollection (pages , collectionSize );
1461
+ }
1462
+ }
1217
1463
}
0 commit comments