Skip to content

Commit d9f40be

Browse files
feat: Enable REST transport for most of Java and Go clients (googleapis#488)
- [ ] Regenerate this pull request now. PiperOrigin-RevId: 456641589 Source-Link: googleapis/googleapis@8a251f5 Source-Link: https://github.com/googleapis/googleapis-gen/commit/4ca52a529cf01308d9714950edffbea3560cfbdb Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiNGNhNTJhNTI5Y2YwMTMwOGQ5NzE0OTUwZWRmZmJlYTM1NjBjZmJkYiJ9 feat: added webhook_config The webhook_config field was added to the Environment resource to support environment-level webhook overrides as a preview feature. Support for the Google Cloud Locations API has also been added. PiperOrigin-RevId: 454733966 Source-Link: googleapis/googleapis@d5d0f8d Source-Link: https://github.com/googleapis/googleapis-gen/commit/e5a3716cdc1c858af2cecb9c83b93accd8ea5f82 Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiZTVhMzcxNmNkYzFjODU4YWYyY2VjYjljODNiOTNhY2NkOGVhNWY4MiJ9 feat: added webhook_config The webhook_config field was added to the Environment resource to support environment-level webhook overrides as a preview feature. Support for the Google Cloud Locations API has also been added. PiperOrigin-RevId: 454731805 Source-Link: googleapis/googleapis@585fa8c Source-Link: https://github.com/googleapis/googleapis-gen/commit/e8aee07fd3945431d5ac4dd2bd4b4e8dfa6e2c2d Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiZThhZWUwN2ZkMzk0NTQzMWQ1YWM0ZGQyYmQ0YjRlOGRmYTZlMmMyZCJ9 chore: Integrate new gapic-generator-java and rules_gapic PiperOrigin-RevId: 454027580 Source-Link: googleapis/googleapis@1b22277 Source-Link: https://github.com/googleapis/googleapis-gen/commit/e04cea20d0d12eb5c3bdb360a9e72b654edcb638 Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiZTA0Y2VhMjBkMGQxMmViNWMzYmRiMzYwYTllNzJiNjU0ZWRjYjYzOCJ9
1 parent a266375 commit d9f40be

File tree

308 files changed

+71757
-838
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

308 files changed

+71757
-838
lines changed

java-dialogflow-cx/README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,20 +22,20 @@ If you are using Maven, add this to your pom.xml file:
2222
<dependency>
2323
<groupId>com.google.cloud</groupId>
2424
<artifactId>google-cloud-dialogflow-cx</artifactId>
25-
<version>0.13.0</version>
25+
<version>0.13.1</version>
2626
</dependency>
2727
```
2828

2929
If you are using Gradle without BOM, add this to your dependencies
3030

3131
```Groovy
32-
implementation 'com.google.cloud:google-cloud-dialogflow-cx:0.13.0'
32+
implementation 'com.google.cloud:google-cloud-dialogflow-cx:0.13.1'
3333
```
3434

3535
If you are using SBT, add this to your dependencies
3636

3737
```Scala
38-
libraryDependencies += "com.google.cloud" % "google-cloud-dialogflow-cx" % "0.13.0"
38+
libraryDependencies += "com.google.cloud" % "google-cloud-dialogflow-cx" % "0.13.1"
3939
```
4040

4141
## Authentication

java-dialogflow-cx/google-cloud-dialogflow-cx/pom.xml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,10 @@
4141
<groupId>com.google.api.grpc</groupId>
4242
<artifactId>proto-google-common-protos</artifactId>
4343
</dependency>
44+
<dependency>
45+
<groupId>com.google.api.grpc</groupId>
46+
<artifactId>grpc-google-common-protos</artifactId>
47+
</dependency>
4448

4549
<dependency>
4650
<groupId>com.google.api.grpc</groupId>
@@ -62,6 +66,10 @@
6266
<groupId>com.google.api</groupId>
6367
<artifactId>gax-grpc</artifactId>
6468
</dependency>
69+
<dependency>
70+
<groupId>com.google.api</groupId>
71+
<artifactId>gax-httpjson</artifactId>
72+
</dependency>
6573
<dependency>
6674
<groupId>org.threeten</groupId>
6775
<artifactId>threetenbp</artifactId>
@@ -91,12 +99,24 @@
9199
<scope>test</scope>
92100
</dependency>
93101
<!-- Need testing utility classes for generated gRPC clients tests -->
102+
<dependency>
103+
<groupId>com.google.api</groupId>
104+
<artifactId>gax</artifactId>
105+
<classifier>testlib</classifier>
106+
<scope>test</scope>
107+
</dependency>
94108
<dependency>
95109
<groupId>com.google.api</groupId>
96110
<artifactId>gax-grpc</artifactId>
97111
<classifier>testlib</classifier>
98112
<scope>test</scope>
99113
</dependency>
114+
<dependency>
115+
<groupId>com.google.api</groupId>
116+
<artifactId>gax-httpjson</artifactId>
117+
<classifier>testlib</classifier>
118+
<scope>test</scope>
119+
</dependency>
100120
</dependencies>
101121

102122
<profiles>

java-dialogflow-cx/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3/AgentsClient.java

Lines changed: 252 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
import com.google.api.core.ApiFuture;
2020
import com.google.api.core.ApiFutures;
2121
import com.google.api.gax.core.BackgroundResource;
22+
import com.google.api.gax.httpjson.longrunning.OperationsClient;
2223
import com.google.api.gax.longrunning.OperationFuture;
2324
import com.google.api.gax.paging.AbstractFixedSizeCollection;
2425
import com.google.api.gax.paging.AbstractPage;
@@ -28,9 +29,12 @@
2829
import com.google.api.gax.rpc.UnaryCallable;
2930
import com.google.cloud.dialogflow.cx.v3.stub.AgentsStub;
3031
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;
3136
import com.google.common.util.concurrent.MoreExecutors;
3237
import com.google.longrunning.Operation;
33-
import com.google.longrunning.OperationsClient;
3438
import com.google.protobuf.Empty;
3539
import com.google.protobuf.FieldMask;
3640
import com.google.protobuf.Struct;
@@ -102,13 +106,28 @@
102106
* AgentsClient agentsClient = AgentsClient.create(agentsSettings);
103107
* }</pre>
104108
*
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+
*
105123
* <p>Please refer to the GitHub repository's samples for more quickstart code snippets.
106124
*/
107125
@Generated("by gapic-generator-java")
108126
public class AgentsClient implements BackgroundResource {
109127
private final AgentsSettings settings;
110128
private final AgentsStub stub;
111-
private final OperationsClient operationsClient;
129+
private final OperationsClient httpJsonOperationsClient;
130+
private final com.google.longrunning.OperationsClient operationsClient;
112131

113132
/** Constructs an instance of AgentsClient with default settings. */
114133
public static final AgentsClient create() throws IOException {
@@ -138,13 +157,17 @@ public static final AgentsClient create(AgentsStub stub) {
138157
protected AgentsClient(AgentsSettings settings) throws IOException {
139158
this.settings = settings;
140159
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());
142163
}
143164

144165
protected AgentsClient(AgentsStub stub) {
145166
this.settings = null;
146167
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());
148171
}
149172

150173
public final AgentsSettings getSettings() {
@@ -159,10 +182,18 @@ public AgentsStub getStub() {
159182
* Returns the OperationsClient that can be used to query the status of a long-running operation
160183
* returned by another API method call.
161184
*/
162-
public final OperationsClient getOperationsClient() {
185+
public final com.google.longrunning.OperationsClient getOperationsClient() {
163186
return operationsClient;
164187
}
165188

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+
166197
// AUTO-GENERATED DOCUMENTATION AND METHOD.
167198
/**
168199
* Returns the list of all agents in the specified location.
@@ -291,7 +322,7 @@ public final UnaryCallable<ListAgentsRequest, ListAgentsPagedResponse> listAgent
291322
* .build();
292323
* while (true) {
293324
* ListAgentsResponse response = agentsClient.listAgentsCallable().call(request);
294-
* for (Agent element : response.getResponsesList()) {
325+
* for (Agent element : response.getAgentsList()) {
295326
* // doThingsWith(element);
296327
* }
297328
* String nextPageToken = response.getNextPageToken();
@@ -1112,6 +1143,145 @@ public final AgentValidationResult getAgentValidationResult(
11121143
return stub.getAgentValidationResultCallable();
11131144
}
11141145

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+
11151285
@Override
11161286
public final void close() {
11171287
stub.close();
@@ -1214,4 +1384,80 @@ protected ListAgentsFixedSizeCollection createCollection(
12141384
return new ListAgentsFixedSizeCollection(pages, collectionSize);
12151385
}
12161386
}
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+
}
12171463
}

0 commit comments

Comments
 (0)