Skip to content
This repository was archived by the owner on Dec 15, 2023. It is now read-only.

Commit 8fb0c20

Browse files
chore: migrate to microgenerator (#380)
* chore: Remove spurious build warnings by deleting--include_source_info from .bazelrc Committer: @miraleung PiperOrigin-RevId: 344134135 Source-Author: Google APIs <[email protected]> Source-Date: Tue Nov 24 14:38:21 2020 -0800 Source-Repo: googleapis/googleapis Source-Sha: b11a87f3b54be3a5e42c15020ee1e0781f86da90 Source-Link: googleapis/googleapis@b11a87f * chore: Undo removal of --include_source_info from .bazelrc Committer: @miraleung PiperOrigin-RevId: 345067549 Source-Author: Google APIs <[email protected]> Source-Date: Tue Dec 1 11:49:14 2020 -0800 Source-Repo: googleapis/googleapis Source-Sha: 8cfc6c874574b649b4524a4ef6a0651533325a84 Source-Link: googleapis/googleapis@8cfc6c8 * chore: migrate speech to the Java microgenerator Committer: @miraleung PiperOrigin-RevId: 345300630 Source-Author: Google APIs <[email protected]> Source-Date: Wed Dec 2 13:28:53 2020 -0800 Source-Repo: googleapis/googleapis Source-Sha: 948b4798f4f3957acaea5cbb5134a8a3a3d057e9 Source-Link: googleapis/googleapis@948b479 * chore: update gapic-generator-java to 0.0.9 Committer: @miraleung PiperOrigin-RevId: 346372957 Source-Author: Google APIs <[email protected]> Source-Date: Tue Dec 8 11:37:30 2020 -0800 Source-Repo: googleapis/googleapis Source-Sha: 857f70daef9f4c38f042fb3dfb7b8423ae18fd19 Source-Link: googleapis/googleapis@857f70d * chore: update gapic-generator-java to 0.0.11 Committer: @miraleung PiperOrigin-RevId: 347036369 Source-Author: Google APIs <[email protected]> Source-Date: Fri Dec 11 11:13:47 2020 -0800 Source-Repo: googleapis/googleapis Source-Sha: 6d65640b1fcbdf26ea76cb720de0ac138cae9bed Source-Link: googleapis/googleapis@6d65640 * chore: smoke test is no longer generated so skip synth replacements Co-authored-by: Jeff Ching <[email protected]>
1 parent 6383426 commit 8fb0c20

File tree

24 files changed

+498
-1030
lines changed

24 files changed

+498
-1030
lines changed

google-cloud-speech/src/main/java/com/google/cloud/speech/v1/SpeechClient.java

Lines changed: 24 additions & 228 deletions
Large diffs are not rendered by default.

google-cloud-speech/src/main/java/com/google/cloud/speech/v1/SpeechSettings.java

Lines changed: 19 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,15 @@
55
* you may not use this file except in compliance with the License.
66
* You may obtain a copy of the License at
77
*
8-
* https://www.apache.org/licenses/LICENSE-2.0
8+
* https://www.apache.org/licenses/LICENSE-2.0
99
*
1010
* Unless required by applicable law or agreed to in writing, software
1111
* distributed under the License is distributed on an "AS IS" BASIS,
1212
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1313
* See the License for the specific language governing permissions and
1414
* limitations under the License.
1515
*/
16+
1617
package com.google.cloud.speech.v1;
1718

1819
import com.google.api.core.ApiFunction;
@@ -33,7 +34,7 @@
3334
import java.util.List;
3435
import javax.annotation.Generated;
3536

36-
// AUTO-GENERATED DOCUMENTATION AND CLASS
37+
// AUTO-GENERATED DOCUMENTATION AND CLASS.
3738
/**
3839
* Settings class to configure an instance of {@link SpeechClient}.
3940
*
@@ -50,23 +51,23 @@
5051
*
5152
* <p>For example, to set the total timeout of recognize to 30 seconds:
5253
*
53-
* <pre>
54-
* <code>
55-
* SpeechSettings.Builder speechSettingsBuilder =
56-
* SpeechSettings.newBuilder();
54+
* <pre>{@code
55+
* SpeechSettings.Builder speechSettingsBuilder = SpeechSettings.newBuilder();
5756
* speechSettingsBuilder
5857
* .recognizeSettings()
5958
* .setRetrySettings(
60-
* speechSettingsBuilder.recognizeSettings().getRetrySettings().toBuilder()
59+
* speechSettingsBuilder
60+
* .recognizeSettings()
61+
* .getRetrySettings()
62+
* .toBuilder()
6163
* .setTotalTimeout(Duration.ofSeconds(30))
6264
* .build());
6365
* SpeechSettings speechSettings = speechSettingsBuilder.build();
64-
* </code>
65-
* </pre>
66+
* }</pre>
6667
*/
67-
@Generated("by gapic-generator")
68-
@BetaApi
68+
@Generated("by gapic-generator-java")
6969
public class SpeechSettings extends ClientSettings<SpeechSettings> {
70+
7071
/** Returns the object with the settings used for calls to recognize. */
7172
public UnaryCallSettings<RecognizeRequest, RecognizeResponse> recognizeSettings() {
7273
return ((SpeechStubSettings) getStubSettings()).recognizeSettings();
@@ -78,8 +79,6 @@ public UnaryCallSettings<LongRunningRecognizeRequest, Operation> longRunningReco
7879
}
7980

8081
/** Returns the object with the settings used for calls to longRunningRecognize. */
81-
@BetaApi(
82-
"The surface for long-running operations is not stable yet and may change in the future.")
8382
public OperationCallSettings<
8483
LongRunningRecognizeRequest, LongRunningRecognizeResponse, LongRunningRecognizeMetadata>
8584
longRunningRecognizeOperationSettings() {
@@ -151,18 +150,15 @@ protected SpeechSettings(Builder settingsBuilder) throws IOException {
151150

152151
/** Builder for SpeechSettings. */
153152
public static class Builder extends ClientSettings.Builder<SpeechSettings, Builder> {
153+
154154
protected Builder() throws IOException {
155-
this((ClientContext) null);
155+
this(((ClientContext) null));
156156
}
157157

158158
protected Builder(ClientContext clientContext) {
159159
super(SpeechStubSettings.newBuilder(clientContext));
160160
}
161161

162-
private static Builder createDefault() {
163-
return new Builder(SpeechStubSettings.newBuilder());
164-
}
165-
166162
protected Builder(SpeechSettings settings) {
167163
super(settings.getStubSettings().toBuilder());
168164
}
@@ -171,11 +167,15 @@ protected Builder(SpeechStubSettings.Builder stubSettings) {
171167
super(stubSettings);
172168
}
173169

170+
private static Builder createDefault() {
171+
return new Builder(SpeechStubSettings.newBuilder());
172+
}
173+
174174
public SpeechStubSettings.Builder getStubSettingsBuilder() {
175175
return ((SpeechStubSettings.Builder) getStubSettings());
176176
}
177177

178-
// NEXT_MAJOR_VER: remove 'throws Exception'
178+
// NEXT_MAJOR_VER: remove 'throws Exception'.
179179
/**
180180
* Applies the given settings updater function to all of the unary API methods in this service.
181181
*
@@ -200,8 +200,6 @@ public UnaryCallSettings.Builder<RecognizeRequest, RecognizeResponse> recognizeS
200200
}
201201

202202
/** Returns the builder for the settings used for calls to longRunningRecognize. */
203-
@BetaApi(
204-
"The surface for long-running operations is not stable yet and may change in the future.")
205203
public OperationCallSettings.Builder<
206204
LongRunningRecognizeRequest, LongRunningRecognizeResponse, LongRunningRecognizeMetadata>
207205
longRunningRecognizeOperationSettings() {

google-cloud-speech/src/main/java/com/google/cloud/speech/v1/package-info.java

Lines changed: 4 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
* you may not use this file except in compliance with the License.
66
* You may obtain a copy of the License at
77
*
8-
* https://www.apache.org/licenses/LICENSE-2.0
8+
* https://www.apache.org/licenses/LICENSE-2.0
99
*
1010
* Unless required by applicable law or agreed to in writing, software
1111
* distributed under the License is distributed on an "AS IS" BASIS,
@@ -15,37 +15,15 @@
1515
*/
1616

1717
/**
18-
* A client to Cloud Speech-to-Text API.
18+
* The interfaces provided are listed below, along with usage samples.
1919
*
20-
* <p>The interfaces provided are listed below, along with usage samples.
21-
*
22-
* <p>============ SpeechClient ============
20+
* <p>======================= SpeechClient =======================
2321
*
2422
* <p>Service Description: Service that implements Google Cloud Speech API.
2523
*
2624
* <p>Sample for SpeechClient:
27-
*
28-
* <pre>
29-
* <code>
30-
* try (SpeechClient speechClient = SpeechClient.create()) {
31-
* RecognitionConfig.AudioEncoding encoding = RecognitionConfig.AudioEncoding.FLAC;
32-
* int sampleRateHertz = 44100;
33-
* String languageCode = "en-US";
34-
* RecognitionConfig config = RecognitionConfig.newBuilder()
35-
* .setEncoding(encoding)
36-
* .setSampleRateHertz(sampleRateHertz)
37-
* .setLanguageCode(languageCode)
38-
* .build();
39-
* String uri = "gs://bucket_name/file_name.flac";
40-
* RecognitionAudio audio = RecognitionAudio.newBuilder()
41-
* .setUri(uri)
42-
* .build();
43-
* RecognizeResponse response = speechClient.recognize(config, audio);
44-
* }
45-
* </code>
46-
* </pre>
4725
*/
48-
@Generated("by gapic-generator")
26+
@Generated("by gapic-generator-java")
4927
package com.google.cloud.speech.v1;
5028

5129
import javax.annotation.Generated;

google-cloud-speech/src/main/java/com/google/cloud/speech/v1/stub/GrpcSpeechCallableFactory.java

Lines changed: 19 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,17 @@
55
* you may not use this file except in compliance with the License.
66
* You may obtain a copy of the License at
77
*
8-
* https://www.apache.org/licenses/LICENSE-2.0
8+
* https://www.apache.org/licenses/LICENSE-2.0
99
*
1010
* Unless required by applicable law or agreed to in writing, software
1111
* distributed under the License is distributed on an "AS IS" BASIS,
1212
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1313
* See the License for the specific language governing permissions and
1414
* limitations under the License.
1515
*/
16+
1617
package com.google.cloud.speech.v1.stub;
1718

18-
import com.google.api.core.BetaApi;
1919
import com.google.api.gax.grpc.GrpcCallSettings;
2020
import com.google.api.gax.grpc.GrpcCallableFactory;
2121
import com.google.api.gax.grpc.GrpcStubCallableFactory;
@@ -31,18 +31,19 @@
3131
import com.google.api.gax.rpc.StreamingCallSettings;
3232
import com.google.api.gax.rpc.UnaryCallSettings;
3333
import com.google.api.gax.rpc.UnaryCallable;
34+
import com.google.longrunning.Operation;
3435
import com.google.longrunning.stub.OperationsStub;
3536
import javax.annotation.Generated;
3637

37-
// AUTO-GENERATED DOCUMENTATION AND CLASS
38+
// AUTO-GENERATED DOCUMENTATION AND CLASS.
3839
/**
39-
* gRPC callable factory implementation for Cloud Speech-to-Text API.
40+
* gRPC callable factory implementation for the Speech service API.
4041
*
4142
* <p>This class is for advanced usage.
4243
*/
4344
@Generated("by gapic-generator")
44-
@BetaApi("The surface for use by generated code is not stable yet and may change in the future.")
4545
public class GrpcSpeechCallableFactory implements GrpcStubCallableFactory {
46+
4647
@Override
4748
public <RequestT, ResponseT> UnaryCallable<RequestT, ResponseT> createUnaryCallable(
4849
GrpcCallSettings<RequestT, ResponseT> grpcCallSettings,
@@ -55,61 +56,58 @@ public <RequestT, ResponseT> UnaryCallable<RequestT, ResponseT> createUnaryCalla
5556
public <RequestT, ResponseT, PagedListResponseT>
5657
UnaryCallable<RequestT, PagedListResponseT> createPagedCallable(
5758
GrpcCallSettings<RequestT, ResponseT> grpcCallSettings,
58-
PagedCallSettings<RequestT, ResponseT, PagedListResponseT> pagedCallSettings,
59+
PagedCallSettings<RequestT, ResponseT, PagedListResponseT> callSettings,
5960
ClientContext clientContext) {
60-
return GrpcCallableFactory.createPagedCallable(
61-
grpcCallSettings, pagedCallSettings, clientContext);
61+
return GrpcCallableFactory.createPagedCallable(grpcCallSettings, callSettings, clientContext);
6262
}
6363

6464
@Override
6565
public <RequestT, ResponseT> UnaryCallable<RequestT, ResponseT> createBatchingCallable(
6666
GrpcCallSettings<RequestT, ResponseT> grpcCallSettings,
67-
BatchingCallSettings<RequestT, ResponseT> batchingCallSettings,
67+
BatchingCallSettings<RequestT, ResponseT> callSettings,
6868
ClientContext clientContext) {
6969
return GrpcCallableFactory.createBatchingCallable(
70-
grpcCallSettings, batchingCallSettings, clientContext);
70+
grpcCallSettings, callSettings, clientContext);
7171
}
7272

73-
@BetaApi(
74-
"The surface for long-running operations is not stable yet and may change in the future.")
7573
@Override
7674
public <RequestT, ResponseT, MetadataT>
7775
OperationCallable<RequestT, ResponseT, MetadataT> createOperationCallable(
78-
GrpcCallSettings<RequestT, com.google.longrunning.Operation> grpcCallSettings,
79-
OperationCallSettings<RequestT, ResponseT, MetadataT> operationCallSettings,
76+
GrpcCallSettings<RequestT, Operation> grpcCallSettings,
77+
OperationCallSettings<RequestT, ResponseT, MetadataT> callSettings,
8078
ClientContext clientContext,
8179
OperationsStub operationsStub) {
8280
return GrpcCallableFactory.createOperationCallable(
83-
grpcCallSettings, operationCallSettings, clientContext, operationsStub);
81+
grpcCallSettings, callSettings, clientContext, operationsStub);
8482
}
8583

8684
@Override
8785
public <RequestT, ResponseT>
8886
BidiStreamingCallable<RequestT, ResponseT> createBidiStreamingCallable(
8987
GrpcCallSettings<RequestT, ResponseT> grpcCallSettings,
90-
StreamingCallSettings<RequestT, ResponseT> streamingCallSettings,
88+
StreamingCallSettings<RequestT, ResponseT> callSettings,
9189
ClientContext clientContext) {
9290
return GrpcCallableFactory.createBidiStreamingCallable(
93-
grpcCallSettings, streamingCallSettings, clientContext);
91+
grpcCallSettings, callSettings, clientContext);
9492
}
9593

9694
@Override
9795
public <RequestT, ResponseT>
9896
ServerStreamingCallable<RequestT, ResponseT> createServerStreamingCallable(
9997
GrpcCallSettings<RequestT, ResponseT> grpcCallSettings,
100-
ServerStreamingCallSettings<RequestT, ResponseT> streamingCallSettings,
98+
ServerStreamingCallSettings<RequestT, ResponseT> callSettings,
10199
ClientContext clientContext) {
102100
return GrpcCallableFactory.createServerStreamingCallable(
103-
grpcCallSettings, streamingCallSettings, clientContext);
101+
grpcCallSettings, callSettings, clientContext);
104102
}
105103

106104
@Override
107105
public <RequestT, ResponseT>
108106
ClientStreamingCallable<RequestT, ResponseT> createClientStreamingCallable(
109107
GrpcCallSettings<RequestT, ResponseT> grpcCallSettings,
110-
StreamingCallSettings<RequestT, ResponseT> streamingCallSettings,
108+
StreamingCallSettings<RequestT, ResponseT> callSettings,
111109
ClientContext clientContext) {
112110
return GrpcCallableFactory.createClientStreamingCallable(
113-
grpcCallSettings, streamingCallSettings, clientContext);
111+
grpcCallSettings, callSettings, clientContext);
114112
}
115113
}

0 commit comments

Comments
 (0)