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

Commit 0fd2554

Browse files
feat(v1p1beta1): add support for Model Adaptation (#433)
This PR was generated using Autosynth. 🌈 Synth log will be available here: https://source.cloud.google.com/results/invocations/8440e2da-528d-412a-bf89-385b5618d6dd/targets - [ ] To automatically regenerate this PR, check this box. PiperOrigin-RevId: 358182033 Source-Link: googleapis/googleapis@56c65ed
1 parent 7b4771d commit 0fd2554

File tree

51 files changed

+19351
-95
lines changed

Some content is hidden

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

51 files changed

+19351
-95
lines changed

google-cloud-speech/src/main/java/com/google/cloud/speech/v1p1beta1/AdaptationClient.java

Lines changed: 1312 additions & 0 deletions
Large diffs are not rendered by default.
Lines changed: 285 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,285 @@
1+
/*
2+
* Copyright 2020 Google LLC
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* https://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
package com.google.cloud.speech.v1p1beta1;
18+
19+
import static com.google.cloud.speech.v1p1beta1.AdaptationClient.ListCustomClassesPagedResponse;
20+
import static com.google.cloud.speech.v1p1beta1.AdaptationClient.ListPhraseSetPagedResponse;
21+
22+
import com.google.api.core.ApiFunction;
23+
import com.google.api.core.BetaApi;
24+
import com.google.api.gax.core.GoogleCredentialsProvider;
25+
import com.google.api.gax.core.InstantiatingExecutorProvider;
26+
import com.google.api.gax.grpc.InstantiatingGrpcChannelProvider;
27+
import com.google.api.gax.rpc.ApiClientHeaderProvider;
28+
import com.google.api.gax.rpc.ClientContext;
29+
import com.google.api.gax.rpc.ClientSettings;
30+
import com.google.api.gax.rpc.PagedCallSettings;
31+
import com.google.api.gax.rpc.TransportChannelProvider;
32+
import com.google.api.gax.rpc.UnaryCallSettings;
33+
import com.google.cloud.speech.v1p1beta1.stub.AdaptationStubSettings;
34+
import com.google.protobuf.Empty;
35+
import java.io.IOException;
36+
import java.util.List;
37+
import javax.annotation.Generated;
38+
39+
// AUTO-GENERATED DOCUMENTATION AND CLASS.
40+
/**
41+
* Settings class to configure an instance of {@link AdaptationClient}.
42+
*
43+
* <p>The default instance has everything set to sensible defaults:
44+
*
45+
* <ul>
46+
* <li>The default service address (speech.googleapis.com) and default port (443) are used.
47+
* <li>Credentials are acquired automatically through Application Default Credentials.
48+
* <li>Retries are configured for idempotent methods but not for non-idempotent methods.
49+
* </ul>
50+
*
51+
* <p>The builder of this class is recursive, so contained classes are themselves builders. When
52+
* build() is called, the tree of builders is called to create the complete settings object.
53+
*
54+
* <p>For example, to set the total timeout of createPhraseSet to 30 seconds:
55+
*
56+
* <pre>{@code
57+
* AdaptationSettings.Builder adaptationSettingsBuilder = AdaptationSettings.newBuilder();
58+
* adaptationSettingsBuilder
59+
* .createPhraseSetSettings()
60+
* .setRetrySettings(
61+
* adaptationSettingsBuilder
62+
* .createPhraseSetSettings()
63+
* .getRetrySettings()
64+
* .toBuilder()
65+
* .setTotalTimeout(Duration.ofSeconds(30))
66+
* .build());
67+
* AdaptationSettings adaptationSettings = adaptationSettingsBuilder.build();
68+
* }</pre>
69+
*/
70+
@BetaApi
71+
@Generated("by gapic-generator-java")
72+
public class AdaptationSettings extends ClientSettings<AdaptationSettings> {
73+
74+
/** Returns the object with the settings used for calls to createPhraseSet. */
75+
public UnaryCallSettings<CreatePhraseSetRequest, PhraseSet> createPhraseSetSettings() {
76+
return ((AdaptationStubSettings) getStubSettings()).createPhraseSetSettings();
77+
}
78+
79+
/** Returns the object with the settings used for calls to getPhraseSet. */
80+
public UnaryCallSettings<GetPhraseSetRequest, PhraseSet> getPhraseSetSettings() {
81+
return ((AdaptationStubSettings) getStubSettings()).getPhraseSetSettings();
82+
}
83+
84+
/** Returns the object with the settings used for calls to listPhraseSet. */
85+
public PagedCallSettings<ListPhraseSetRequest, ListPhraseSetResponse, ListPhraseSetPagedResponse>
86+
listPhraseSetSettings() {
87+
return ((AdaptationStubSettings) getStubSettings()).listPhraseSetSettings();
88+
}
89+
90+
/** Returns the object with the settings used for calls to updatePhraseSet. */
91+
public UnaryCallSettings<UpdatePhraseSetRequest, PhraseSet> updatePhraseSetSettings() {
92+
return ((AdaptationStubSettings) getStubSettings()).updatePhraseSetSettings();
93+
}
94+
95+
/** Returns the object with the settings used for calls to deletePhraseSet. */
96+
public UnaryCallSettings<DeletePhraseSetRequest, Empty> deletePhraseSetSettings() {
97+
return ((AdaptationStubSettings) getStubSettings()).deletePhraseSetSettings();
98+
}
99+
100+
/** Returns the object with the settings used for calls to createCustomClass. */
101+
public UnaryCallSettings<CreateCustomClassRequest, CustomClass> createCustomClassSettings() {
102+
return ((AdaptationStubSettings) getStubSettings()).createCustomClassSettings();
103+
}
104+
105+
/** Returns the object with the settings used for calls to getCustomClass. */
106+
public UnaryCallSettings<GetCustomClassRequest, CustomClass> getCustomClassSettings() {
107+
return ((AdaptationStubSettings) getStubSettings()).getCustomClassSettings();
108+
}
109+
110+
/** Returns the object with the settings used for calls to listCustomClasses. */
111+
public PagedCallSettings<
112+
ListCustomClassesRequest, ListCustomClassesResponse, ListCustomClassesPagedResponse>
113+
listCustomClassesSettings() {
114+
return ((AdaptationStubSettings) getStubSettings()).listCustomClassesSettings();
115+
}
116+
117+
/** Returns the object with the settings used for calls to updateCustomClass. */
118+
public UnaryCallSettings<UpdateCustomClassRequest, CustomClass> updateCustomClassSettings() {
119+
return ((AdaptationStubSettings) getStubSettings()).updateCustomClassSettings();
120+
}
121+
122+
/** Returns the object with the settings used for calls to deleteCustomClass. */
123+
public UnaryCallSettings<DeleteCustomClassRequest, Empty> deleteCustomClassSettings() {
124+
return ((AdaptationStubSettings) getStubSettings()).deleteCustomClassSettings();
125+
}
126+
127+
public static final AdaptationSettings create(AdaptationStubSettings stub) throws IOException {
128+
return new AdaptationSettings.Builder(stub.toBuilder()).build();
129+
}
130+
131+
/** Returns a builder for the default ExecutorProvider for this service. */
132+
public static InstantiatingExecutorProvider.Builder defaultExecutorProviderBuilder() {
133+
return AdaptationStubSettings.defaultExecutorProviderBuilder();
134+
}
135+
136+
/** Returns the default service endpoint. */
137+
public static String getDefaultEndpoint() {
138+
return AdaptationStubSettings.getDefaultEndpoint();
139+
}
140+
141+
/** Returns the default service scopes. */
142+
public static List<String> getDefaultServiceScopes() {
143+
return AdaptationStubSettings.getDefaultServiceScopes();
144+
}
145+
146+
/** Returns a builder for the default credentials for this service. */
147+
public static GoogleCredentialsProvider.Builder defaultCredentialsProviderBuilder() {
148+
return AdaptationStubSettings.defaultCredentialsProviderBuilder();
149+
}
150+
151+
/** Returns a builder for the default ChannelProvider for this service. */
152+
public static InstantiatingGrpcChannelProvider.Builder defaultGrpcTransportProviderBuilder() {
153+
return AdaptationStubSettings.defaultGrpcTransportProviderBuilder();
154+
}
155+
156+
public static TransportChannelProvider defaultTransportChannelProvider() {
157+
return AdaptationStubSettings.defaultTransportChannelProvider();
158+
}
159+
160+
@BetaApi("The surface for customizing headers is not stable yet and may change in the future.")
161+
public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuilder() {
162+
return AdaptationStubSettings.defaultApiClientHeaderProviderBuilder();
163+
}
164+
165+
/** Returns a new builder for this class. */
166+
public static Builder newBuilder() {
167+
return Builder.createDefault();
168+
}
169+
170+
/** Returns a new builder for this class. */
171+
public static Builder newBuilder(ClientContext clientContext) {
172+
return new Builder(clientContext);
173+
}
174+
175+
/** Returns a builder containing all the values of this settings class. */
176+
public Builder toBuilder() {
177+
return new Builder(this);
178+
}
179+
180+
protected AdaptationSettings(Builder settingsBuilder) throws IOException {
181+
super(settingsBuilder);
182+
}
183+
184+
/** Builder for AdaptationSettings. */
185+
public static class Builder extends ClientSettings.Builder<AdaptationSettings, Builder> {
186+
187+
protected Builder() throws IOException {
188+
this(((ClientContext) null));
189+
}
190+
191+
protected Builder(ClientContext clientContext) {
192+
super(AdaptationStubSettings.newBuilder(clientContext));
193+
}
194+
195+
protected Builder(AdaptationSettings settings) {
196+
super(settings.getStubSettings().toBuilder());
197+
}
198+
199+
protected Builder(AdaptationStubSettings.Builder stubSettings) {
200+
super(stubSettings);
201+
}
202+
203+
private static Builder createDefault() {
204+
return new Builder(AdaptationStubSettings.newBuilder());
205+
}
206+
207+
public AdaptationStubSettings.Builder getStubSettingsBuilder() {
208+
return ((AdaptationStubSettings.Builder) getStubSettings());
209+
}
210+
211+
// NEXT_MAJOR_VER: remove 'throws Exception'.
212+
/**
213+
* Applies the given settings updater function to all of the unary API methods in this service.
214+
*
215+
* <p>Note: This method does not support applying settings to streaming methods.
216+
*/
217+
public Builder applyToAllUnaryMethods(
218+
ApiFunction<UnaryCallSettings.Builder<?, ?>, Void> settingsUpdater) throws Exception {
219+
super.applyToAllUnaryMethods(
220+
getStubSettingsBuilder().unaryMethodSettingsBuilders(), settingsUpdater);
221+
return this;
222+
}
223+
224+
/** Returns the builder for the settings used for calls to createPhraseSet. */
225+
public UnaryCallSettings.Builder<CreatePhraseSetRequest, PhraseSet> createPhraseSetSettings() {
226+
return getStubSettingsBuilder().createPhraseSetSettings();
227+
}
228+
229+
/** Returns the builder for the settings used for calls to getPhraseSet. */
230+
public UnaryCallSettings.Builder<GetPhraseSetRequest, PhraseSet> getPhraseSetSettings() {
231+
return getStubSettingsBuilder().getPhraseSetSettings();
232+
}
233+
234+
/** Returns the builder for the settings used for calls to listPhraseSet. */
235+
public PagedCallSettings.Builder<
236+
ListPhraseSetRequest, ListPhraseSetResponse, ListPhraseSetPagedResponse>
237+
listPhraseSetSettings() {
238+
return getStubSettingsBuilder().listPhraseSetSettings();
239+
}
240+
241+
/** Returns the builder for the settings used for calls to updatePhraseSet. */
242+
public UnaryCallSettings.Builder<UpdatePhraseSetRequest, PhraseSet> updatePhraseSetSettings() {
243+
return getStubSettingsBuilder().updatePhraseSetSettings();
244+
}
245+
246+
/** Returns the builder for the settings used for calls to deletePhraseSet. */
247+
public UnaryCallSettings.Builder<DeletePhraseSetRequest, Empty> deletePhraseSetSettings() {
248+
return getStubSettingsBuilder().deletePhraseSetSettings();
249+
}
250+
251+
/** Returns the builder for the settings used for calls to createCustomClass. */
252+
public UnaryCallSettings.Builder<CreateCustomClassRequest, CustomClass>
253+
createCustomClassSettings() {
254+
return getStubSettingsBuilder().createCustomClassSettings();
255+
}
256+
257+
/** Returns the builder for the settings used for calls to getCustomClass. */
258+
public UnaryCallSettings.Builder<GetCustomClassRequest, CustomClass> getCustomClassSettings() {
259+
return getStubSettingsBuilder().getCustomClassSettings();
260+
}
261+
262+
/** Returns the builder for the settings used for calls to listCustomClasses. */
263+
public PagedCallSettings.Builder<
264+
ListCustomClassesRequest, ListCustomClassesResponse, ListCustomClassesPagedResponse>
265+
listCustomClassesSettings() {
266+
return getStubSettingsBuilder().listCustomClassesSettings();
267+
}
268+
269+
/** Returns the builder for the settings used for calls to updateCustomClass. */
270+
public UnaryCallSettings.Builder<UpdateCustomClassRequest, CustomClass>
271+
updateCustomClassSettings() {
272+
return getStubSettingsBuilder().updateCustomClassSettings();
273+
}
274+
275+
/** Returns the builder for the settings used for calls to deleteCustomClass. */
276+
public UnaryCallSettings.Builder<DeleteCustomClassRequest, Empty> deleteCustomClassSettings() {
277+
return getStubSettingsBuilder().deleteCustomClassSettings();
278+
}
279+
280+
@Override
281+
public AdaptationSettings build() throws IOException {
282+
return new AdaptationSettings(this);
283+
}
284+
}
285+
}

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

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,21 @@
3030
* RecognizeResponse response = speechClient.recognize(config, audio);
3131
* }
3232
* }</pre>
33+
*
34+
* <p>======================= AdaptationClient =======================
35+
*
36+
* <p>Service Description: Service that implements Google Cloud Speech Adaptation API.
37+
*
38+
* <p>Sample for AdaptationClient:
39+
*
40+
* <pre>{@code
41+
* try (AdaptationClient adaptationClient = AdaptationClient.create()) {
42+
* LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
43+
* PhraseSet phraseSet = PhraseSet.newBuilder().build();
44+
* String phraseSetId = "phraseSetId959902180";
45+
* PhraseSet response = adaptationClient.createPhraseSet(parent, phraseSet, phraseSetId);
46+
* }
47+
* }</pre>
3348
*/
3449
@Generated("by gapic-generator-java")
3550
package com.google.cloud.speech.v1p1beta1;

0 commit comments

Comments
 (0)