Skip to content

Commit bc869c0

Browse files
fix: update gapic-generator-java with mock service generation fixes (googleapis#904)
- [ ] Regenerate this pull request now. PiperOrigin-RevId: 457524730 Source-Link: googleapis/googleapis@917e7f2 Source-Link: https://github.com/googleapis/googleapis-gen/commit/2497f9a069d3f6b2d6810d5a4e239cda1e7e5a39 Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiMjQ5N2Y5YTA2OWQzZjZiMmQ2ODEwZDVhNGUyMzljZGExZTdlNWEzOSJ9 feat: Enable REST transport for most of Java and Go clients PiperOrigin-RevId: 456641589 Source-Link: googleapis/googleapis@8a251f5 Source-Link: https://github.com/googleapis/googleapis-gen/commit/4ca52a529cf01308d9714950edffbea3560cfbdb Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiNGNhNTJhNTI5Y2YwMTMwOGQ5NzE0OTUwZWRmZmJlYTM1NjBjZmJkYiJ9 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 chore(deps): upgrade gapic-generator-java to 2.8.0 and update gax-java to 2.18.1 PiperOrigin-RevId: 450543911 Source-Link: googleapis/googleapis@5528344 Source-Link: https://github.com/googleapis/googleapis-gen/commit/9f6775cab1958982b88967a43e5e806af0f135db Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiOWY2Nzc1Y2FiMTk1ODk4MmI4ODk2N2E0M2U1ZTgwNmFmMGYxMzVkYiJ9 fix!: BatchAnnotateImagesRequest.requests is required PiperOrigin-RevId: 447013030 Source-Link: googleapis/googleapis@dfc9737 Source-Link: https://github.com/googleapis/googleapis-gen/commit/a904e05a8ec2c45271a0b18b65e5b43108e72fb6 Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiYTkwNGUwNWE4ZWMyYzQ1MjcxYTBiMThiNjVlNWI0MzEwOGU3MmZiNiJ9 fix!: Product search related messages and enums changed in an incompatible way fix!: NormalizedBoundingPoly message removed PiperOrigin-RevId: 446837836 Source-Link: googleapis/googleapis@4c8ac5c Source-Link: https://github.com/googleapis/googleapis-gen/commit/8f7398fbd79a4fb6a4ab1f6a14547852121986fd Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiOGY3Mzk4ZmJkNzlhNGZiNmE0YWIxZjZhMTQ1NDc4NTIxMjE5ODZmZCJ9 fix!: removed fields from SafeSearchAnnotation message PiperOrigin-RevId: 446836546 Source-Link: googleapis/googleapis@ca17771 Source-Link: https://github.com/googleapis/googleapis-gen/commit/2957b3d78fc24354b30896907de135413b8e7a49 Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiMjk1N2IzZDc4ZmMyNDM1NGIzMDg5NjkwN2RlMTM1NDEzYjhlN2E0OSJ9
1 parent cb237e6 commit bc869c0

File tree

418 files changed

+33078
-6091
lines changed

Some content is hidden

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

418 files changed

+33078
-6091
lines changed

java-vision/google-cloud-vision/pom.xml

+16
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,10 @@
7474
<groupId>com.google.api</groupId>
7575
<artifactId>gax-grpc</artifactId>
7676
</dependency>
77+
<dependency>
78+
<groupId>com.google.api</groupId>
79+
<artifactId>gax-httpjson</artifactId>
80+
</dependency>
7781
<dependency>
7882
<groupId>org.threeten</groupId>
7983
<artifactId>threetenbp</artifactId>
@@ -128,12 +132,24 @@
128132
</exclusions>
129133
</dependency>
130134
<!-- Need testing utility classes for generated gRPC clients tests -->
135+
<dependency>
136+
<groupId>com.google.api</groupId>
137+
<artifactId>gax</artifactId>
138+
<classifier>testlib</classifier>
139+
<scope>test</scope>
140+
</dependency>
131141
<dependency>
132142
<groupId>com.google.api</groupId>
133143
<artifactId>gax-grpc</artifactId>
134144
<classifier>testlib</classifier>
135145
<scope>test</scope>
136146
</dependency>
147+
<dependency>
148+
<groupId>com.google.api</groupId>
149+
<artifactId>gax-httpjson</artifactId>
150+
<classifier>testlib</classifier>
151+
<scope>test</scope>
152+
</dependency>
137153
</dependencies>
138154

139155
<profiles>

java-vision/google-cloud-vision/src/main/java/com/google/cloud/vision/v1/ImageAnnotatorClient.java

+33-8
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,13 @@
1818

1919
import com.google.api.core.BetaApi;
2020
import com.google.api.gax.core.BackgroundResource;
21+
import com.google.api.gax.httpjson.longrunning.OperationsClient;
2122
import com.google.api.gax.longrunning.OperationFuture;
2223
import com.google.api.gax.rpc.OperationCallable;
2324
import com.google.api.gax.rpc.UnaryCallable;
2425
import com.google.cloud.vision.v1.stub.ImageAnnotatorStub;
2526
import com.google.cloud.vision.v1.stub.ImageAnnotatorStubSettings;
2627
import com.google.longrunning.Operation;
27-
import com.google.longrunning.OperationsClient;
2828
import java.io.IOException;
2929
import java.util.List;
3030
import java.util.concurrent.TimeUnit;
@@ -96,13 +96,28 @@
9696
* ImageAnnotatorClient imageAnnotatorClient = ImageAnnotatorClient.create(imageAnnotatorSettings);
9797
* }</pre>
9898
*
99+
* <p>To use REST (HTTP1.1/JSON) transport (instead of gRPC) for sending and receiving requests over
100+
* the wire:
101+
*
102+
* <pre>{@code
103+
* // This snippet has been automatically generated for illustrative purposes only.
104+
* // It may require modifications to work in your environment.
105+
* ImageAnnotatorSettings imageAnnotatorSettings =
106+
* ImageAnnotatorSettings.newBuilder()
107+
* .setTransportChannelProvider(
108+
* ImageAnnotatorSettings.defaultHttpJsonTransportProviderBuilder().build())
109+
* .build();
110+
* ImageAnnotatorClient imageAnnotatorClient = ImageAnnotatorClient.create(imageAnnotatorSettings);
111+
* }</pre>
112+
*
99113
* <p>Please refer to the GitHub repository's samples for more quickstart code snippets.
100114
*/
101115
@Generated("by gapic-generator-java")
102116
public class ImageAnnotatorClient implements BackgroundResource {
103117
private final ImageAnnotatorSettings settings;
104118
private final ImageAnnotatorStub stub;
105-
private final OperationsClient operationsClient;
119+
private final OperationsClient httpJsonOperationsClient;
120+
private final com.google.longrunning.OperationsClient operationsClient;
106121

107122
/** Constructs an instance of ImageAnnotatorClient with default settings. */
108123
public static final ImageAnnotatorClient create() throws IOException {
@@ -122,7 +137,6 @@ public static final ImageAnnotatorClient create(ImageAnnotatorSettings settings)
122137
* Constructs an instance of ImageAnnotatorClient, using the given stub for making calls. This is
123138
* for advanced usage - prefer using create(ImageAnnotatorSettings).
124139
*/
125-
@BetaApi("A restructuring of stub classes is planned, so this may break in the future")
126140
public static final ImageAnnotatorClient create(ImageAnnotatorStub stub) {
127141
return new ImageAnnotatorClient(stub);
128142
}
@@ -135,21 +149,23 @@ public static final ImageAnnotatorClient create(ImageAnnotatorStub stub) {
135149
protected ImageAnnotatorClient(ImageAnnotatorSettings settings) throws IOException {
136150
this.settings = settings;
137151
this.stub = ((ImageAnnotatorStubSettings) settings.getStubSettings()).createStub();
138-
this.operationsClient = OperationsClient.create(this.stub.getOperationsStub());
152+
this.operationsClient =
153+
com.google.longrunning.OperationsClient.create(this.stub.getOperationsStub());
154+
this.httpJsonOperationsClient = OperationsClient.create(this.stub.getHttpJsonOperationsStub());
139155
}
140156

141-
@BetaApi("A restructuring of stub classes is planned, so this may break in the future")
142157
protected ImageAnnotatorClient(ImageAnnotatorStub stub) {
143158
this.settings = null;
144159
this.stub = stub;
145-
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());
146163
}
147164

148165
public final ImageAnnotatorSettings getSettings() {
149166
return settings;
150167
}
151168

152-
@BetaApi("A restructuring of stub classes is planned, so this may break in the future")
153169
public ImageAnnotatorStub getStub() {
154170
return stub;
155171
}
@@ -158,10 +174,19 @@ public ImageAnnotatorStub getStub() {
158174
* Returns the OperationsClient that can be used to query the status of a long-running operation
159175
* returned by another API method call.
160176
*/
161-
public final OperationsClient getOperationsClient() {
177+
public final com.google.longrunning.OperationsClient getOperationsClient() {
162178
return operationsClient;
163179
}
164180

181+
/**
182+
* Returns the OperationsClient that can be used to query the status of a long-running operation
183+
* returned by another API method call.
184+
*/
185+
@BetaApi
186+
public final OperationsClient getHttpJsonOperationsClient() {
187+
return httpJsonOperationsClient;
188+
}
189+
165190
// AUTO-GENERATED DOCUMENTATION AND METHOD.
166191
/**
167192
* Run image detection and annotation for a batch of images.

java-vision/google-cloud-vision/src/main/java/com/google/cloud/vision/v1/ImageAnnotatorSettings.java

+21-2
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
import com.google.api.gax.core.GoogleCredentialsProvider;
2222
import com.google.api.gax.core.InstantiatingExecutorProvider;
2323
import com.google.api.gax.grpc.InstantiatingGrpcChannelProvider;
24+
import com.google.api.gax.httpjson.InstantiatingHttpJsonChannelProvider;
2425
import com.google.api.gax.rpc.ApiClientHeaderProvider;
2526
import com.google.api.gax.rpc.ClientContext;
2627
import com.google.api.gax.rpc.ClientSettings;
@@ -135,11 +136,18 @@ public static GoogleCredentialsProvider.Builder defaultCredentialsProviderBuilde
135136
return ImageAnnotatorStubSettings.defaultCredentialsProviderBuilder();
136137
}
137138

138-
/** Returns a builder for the default ChannelProvider for this service. */
139+
/** Returns a builder for the default gRPC ChannelProvider for this service. */
139140
public static InstantiatingGrpcChannelProvider.Builder defaultGrpcTransportProviderBuilder() {
140141
return ImageAnnotatorStubSettings.defaultGrpcTransportProviderBuilder();
141142
}
142143

144+
/** Returns a builder for the default REST ChannelProvider for this service. */
145+
@BetaApi
146+
public static InstantiatingHttpJsonChannelProvider.Builder
147+
defaultHttpJsonTransportProviderBuilder() {
148+
return ImageAnnotatorStubSettings.defaultHttpJsonTransportProviderBuilder();
149+
}
150+
143151
public static TransportChannelProvider defaultTransportChannelProvider() {
144152
return ImageAnnotatorStubSettings.defaultTransportChannelProvider();
145153
}
@@ -149,11 +157,17 @@ public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuil
149157
return ImageAnnotatorStubSettings.defaultApiClientHeaderProviderBuilder();
150158
}
151159

152-
/** Returns a new builder for this class. */
160+
/** Returns a new gRPC builder for this class. */
153161
public static Builder newBuilder() {
154162
return Builder.createDefault();
155163
}
156164

165+
/** Returns a new REST builder for this class. */
166+
@BetaApi
167+
public static Builder newHttpJsonBuilder() {
168+
return Builder.createHttpJsonDefault();
169+
}
170+
157171
/** Returns a new builder for this class. */
158172
public static Builder newBuilder(ClientContext clientContext) {
159173
return new Builder(clientContext);
@@ -191,6 +205,11 @@ private static Builder createDefault() {
191205
return new Builder(ImageAnnotatorStubSettings.newBuilder());
192206
}
193207

208+
@BetaApi
209+
private static Builder createHttpJsonDefault() {
210+
return new Builder(ImageAnnotatorStubSettings.newHttpJsonBuilder());
211+
}
212+
194213
public ImageAnnotatorStubSettings.Builder getStubSettingsBuilder() {
195214
return ((ImageAnnotatorStubSettings.Builder) getStubSettings());
196215
}

0 commit comments

Comments
 (0)