Skip to content

Commit cb5168c

Browse files
fix: [texttospeech] correct long audio synthesis HTTP binding (#10185)
* fix: correct long audio synthesis HTTP binding docs: Deprecate the custom voice usage field PiperOrigin-RevId: 595119987 Source-Link: googleapis/googleapis@c22f408 Source-Link: https://github.com/googleapis/googleapis-gen/commit/4e9ca63d2cc7933eb7c383ce8b794fce152ea2fc Copy-Tag: eyJwIjoiamF2YS10ZXh0dG9zcGVlY2gvLk93bEJvdC55YW1sIiwiaCI6IjRlOWNhNjNkMmNjNzkzM2ViN2MzODNjZThiNzk0ZmNlMTUyZWEyZmMifQ== * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md --------- Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
1 parent e25f733 commit cb5168c

26 files changed

+455
-297
lines changed

java-texttospeech/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@ Java is a registered trademark of Oracle and/or its affiliates.
195195
[kokoro-badge-link-5]: http://storage.googleapis.com/cloud-devrel-public/java/badges/google-cloud-java/java11.html
196196
[stability-image]: https://img.shields.io/badge/stability-stable-green
197197
[maven-version-image]: https://img.shields.io/maven-central/v/com.google.cloud/google-cloud-texttospeech.svg
198-
[maven-version-link]: https://central.sonatype.com/artifact/com.google.cloud/google-cloud-texttospeech/2.31.0
198+
[maven-version-link]: https://central.sonatype.com/artifact/com.google.cloud/google-cloud-texttospeech/2.33.0
199199
[authentication]: https://github.com/googleapis/google-cloud-java#authentication
200200
[auth-scopes]: https://developers.google.com/identity/protocols/oauth2/scopes
201201
[predefined-iam-roles]: https://cloud.google.com/iam/docs/understanding-roles#predefined_roles

java-texttospeech/google-cloud-texttospeech/src/main/java/com/google/cloud/texttospeech/v1/stub/HttpJsonTextToSpeechLongAudioSynthesizeStub.java

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616

1717
package com.google.cloud.texttospeech.v1.stub;
1818

19+
import com.google.api.HttpRule;
1920
import com.google.api.core.BetaApi;
2021
import com.google.api.core.InternalApi;
2122
import com.google.api.gax.core.BackgroundResource;
@@ -35,6 +36,7 @@
3536
import com.google.cloud.texttospeech.v1.SynthesizeLongAudioMetadata;
3637
import com.google.cloud.texttospeech.v1.SynthesizeLongAudioRequest;
3738
import com.google.cloud.texttospeech.v1.SynthesizeLongAudioResponse;
39+
import com.google.common.collect.ImmutableMap;
3840
import com.google.longrunning.Operation;
3941
import com.google.protobuf.TypeRegistry;
4042
import java.io.IOException;
@@ -71,7 +73,7 @@ public class HttpJsonTextToSpeechLongAudioSynthesizeStub
7173
.setRequestFormatter(
7274
ProtoMessageRequestFormatter.<SynthesizeLongAudioRequest>newBuilder()
7375
.setPath(
74-
"/v1/{parent=projects/*/locations/*/voices/*}:SynthesizeLongAudio",
76+
"/v1/{parent=projects/*/locations/*}:synthesizeLongAudio",
7577
request -> {
7678
Map<String, String> fields = new HashMap<>();
7779
ProtoRestSerializer<SynthesizeLongAudioRequest> serializer =
@@ -154,7 +156,22 @@ protected HttpJsonTextToSpeechLongAudioSynthesizeStub(
154156
throws IOException {
155157
this.callableFactory = callableFactory;
156158
this.httpJsonOperationsStub =
157-
HttpJsonOperationsStub.create(clientContext, callableFactory, typeRegistry);
159+
HttpJsonOperationsStub.create(
160+
clientContext,
161+
callableFactory,
162+
typeRegistry,
163+
ImmutableMap.<String, HttpRule>builder()
164+
.put(
165+
"google.longrunning.Operations.GetOperation",
166+
HttpRule.newBuilder()
167+
.setGet("/v1/{name=projects/*/locations/*/operations/*}")
168+
.build())
169+
.put(
170+
"google.longrunning.Operations.ListOperations",
171+
HttpRule.newBuilder()
172+
.setGet("/v1/{name=projects/*/locations/*}/operations")
173+
.build())
174+
.build());
158175

159176
HttpJsonCallSettings<SynthesizeLongAudioRequest, Operation>
160177
synthesizeLongAudioTransportSettings =

java-texttospeech/google-cloud-texttospeech/src/main/java/com/google/cloud/texttospeech/v1beta1/stub/HttpJsonTextToSpeechLongAudioSynthesizeStub.java

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616

1717
package com.google.cloud.texttospeech.v1beta1.stub;
1818

19+
import com.google.api.HttpRule;
1920
import com.google.api.core.BetaApi;
2021
import com.google.api.core.InternalApi;
2122
import com.google.api.gax.core.BackgroundResource;
@@ -35,6 +36,7 @@
3536
import com.google.cloud.texttospeech.v1beta1.SynthesizeLongAudioMetadata;
3637
import com.google.cloud.texttospeech.v1beta1.SynthesizeLongAudioRequest;
3738
import com.google.cloud.texttospeech.v1beta1.SynthesizeLongAudioResponse;
39+
import com.google.common.collect.ImmutableMap;
3840
import com.google.longrunning.Operation;
3941
import com.google.protobuf.TypeRegistry;
4042
import java.io.IOException;
@@ -71,7 +73,7 @@ public class HttpJsonTextToSpeechLongAudioSynthesizeStub
7173
.setRequestFormatter(
7274
ProtoMessageRequestFormatter.<SynthesizeLongAudioRequest>newBuilder()
7375
.setPath(
74-
"/v1beta1/{parent=projects/*/locations/*/voices/*}:SynthesizeLongAudio",
76+
"/v1beta1/{parent=projects/*/locations/*}:synthesizeLongAudio",
7577
request -> {
7678
Map<String, String> fields = new HashMap<>();
7779
ProtoRestSerializer<SynthesizeLongAudioRequest> serializer =
@@ -154,7 +156,22 @@ protected HttpJsonTextToSpeechLongAudioSynthesizeStub(
154156
throws IOException {
155157
this.callableFactory = callableFactory;
156158
this.httpJsonOperationsStub =
157-
HttpJsonOperationsStub.create(clientContext, callableFactory, typeRegistry);
159+
HttpJsonOperationsStub.create(
160+
clientContext,
161+
callableFactory,
162+
typeRegistry,
163+
ImmutableMap.<String, HttpRule>builder()
164+
.put(
165+
"google.longrunning.Operations.GetOperation",
166+
HttpRule.newBuilder()
167+
.setGet("/v1beta1/{name=projects/*/locations/*/operations/*}")
168+
.build())
169+
.put(
170+
"google.longrunning.Operations.ListOperations",
171+
HttpRule.newBuilder()
172+
.setGet("/v1beta1/{name=projects/*/locations/*}/operations")
173+
.build())
174+
.build());
158175

159176
HttpJsonCallSettings<SynthesizeLongAudioRequest, Operation>
160177
synthesizeLongAudioTransportSettings =

java-texttospeech/google-cloud-texttospeech/src/test/java/com/google/cloud/texttospeech/v1/TextToSpeechLongAudioSynthesizeClientHttpJsonTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ public void synthesizeLongAudioTest() throws Exception {
8686

8787
SynthesizeLongAudioRequest request =
8888
SynthesizeLongAudioRequest.newBuilder()
89-
.setParent("projects/project-5698/locations/location-5698/voices/voice-5698")
89+
.setParent("projects/project-5833/locations/location-5833")
9090
.setInput(SynthesisInput.newBuilder().build())
9191
.setAudioConfig(AudioConfig.newBuilder().build())
9292
.setOutputGcsUri("outputGcsUri-489598154")
@@ -121,7 +121,7 @@ public void synthesizeLongAudioExceptionTest() throws Exception {
121121
try {
122122
SynthesizeLongAudioRequest request =
123123
SynthesizeLongAudioRequest.newBuilder()
124-
.setParent("projects/project-5698/locations/location-5698/voices/voice-5698")
124+
.setParent("projects/project-5833/locations/location-5833")
125125
.setInput(SynthesisInput.newBuilder().build())
126126
.setAudioConfig(AudioConfig.newBuilder().build())
127127
.setOutputGcsUri("outputGcsUri-489598154")

java-texttospeech/google-cloud-texttospeech/src/test/java/com/google/cloud/texttospeech/v1beta1/TextToSpeechLongAudioSynthesizeClientHttpJsonTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ public void synthesizeLongAudioTest() throws Exception {
8686

8787
SynthesizeLongAudioRequest request =
8888
SynthesizeLongAudioRequest.newBuilder()
89-
.setParent("projects/project-5698/locations/location-5698/voices/voice-5698")
89+
.setParent("projects/project-5833/locations/location-5833")
9090
.setInput(SynthesisInput.newBuilder().build())
9191
.setAudioConfig(AudioConfig.newBuilder().build())
9292
.setOutputGcsUri("outputGcsUri-489598154")
@@ -121,7 +121,7 @@ public void synthesizeLongAudioExceptionTest() throws Exception {
121121
try {
122122
SynthesizeLongAudioRequest request =
123123
SynthesizeLongAudioRequest.newBuilder()
124-
.setParent("projects/project-5698/locations/location-5698/voices/voice-5698")
124+
.setParent("projects/project-5833/locations/location-5833")
125125
.setInput(SynthesisInput.newBuilder().build())
126126
.setAudioConfig(AudioConfig.newBuilder().build())
127127
.setOutputGcsUri("outputGcsUri-489598154")

java-texttospeech/proto-google-cloud-texttospeech-v1/src/main/java/com/google/cloud/texttospeech/v1/CustomVoiceParams.java

Lines changed: 37 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -67,9 +67,8 @@ public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() {
6767
*
6868
*
6969
* <pre>
70-
* The usage of the synthesized audio. You must report your honest and
71-
* correct usage of the service as it's regulated by contract and will cause
72-
* significant difference in billing.
70+
* Deprecated. The usage of the synthesized audio. Usage does not affect
71+
* billing.
7372
* </pre>
7473
*
7574
* Protobuf enum {@code google.cloud.texttospeech.v1.CustomVoiceParams.ReportedUsage}
@@ -291,33 +290,39 @@ public com.google.protobuf.ByteString getModelBytes() {
291290
*
292291
*
293292
* <pre>
294-
* Optional. The usage of the synthesized audio to be reported.
293+
* Optional. Deprecated. The usage of the synthesized audio to be reported.
295294
* </pre>
296295
*
297296
* <code>
298-
* .google.cloud.texttospeech.v1.CustomVoiceParams.ReportedUsage reported_usage = 3 [(.google.api.field_behavior) = OPTIONAL];
297+
* .google.cloud.texttospeech.v1.CustomVoiceParams.ReportedUsage reported_usage = 3 [deprecated = true, (.google.api.field_behavior) = OPTIONAL];
299298
* </code>
300299
*
300+
* @deprecated google.cloud.texttospeech.v1.CustomVoiceParams.reported_usage is deprecated. See
301+
* google/cloud/texttospeech/v1/cloud_tts.proto;l=291
301302
* @return The enum numeric value on the wire for reportedUsage.
302303
*/
303304
@java.lang.Override
305+
@java.lang.Deprecated
304306
public int getReportedUsageValue() {
305307
return reportedUsage_;
306308
}
307309
/**
308310
*
309311
*
310312
* <pre>
311-
* Optional. The usage of the synthesized audio to be reported.
313+
* Optional. Deprecated. The usage of the synthesized audio to be reported.
312314
* </pre>
313315
*
314316
* <code>
315-
* .google.cloud.texttospeech.v1.CustomVoiceParams.ReportedUsage reported_usage = 3 [(.google.api.field_behavior) = OPTIONAL];
317+
* .google.cloud.texttospeech.v1.CustomVoiceParams.ReportedUsage reported_usage = 3 [deprecated = true, (.google.api.field_behavior) = OPTIONAL];
316318
* </code>
317319
*
320+
* @deprecated google.cloud.texttospeech.v1.CustomVoiceParams.reported_usage is deprecated. See
321+
* google/cloud/texttospeech/v1/cloud_tts.proto;l=291
318322
* @return The reportedUsage.
319323
*/
320324
@java.lang.Override
325+
@java.lang.Deprecated
321326
public com.google.cloud.texttospeech.v1.CustomVoiceParams.ReportedUsage getReportedUsage() {
322327
com.google.cloud.texttospeech.v1.CustomVoiceParams.ReportedUsage result =
323328
com.google.cloud.texttospeech.v1.CustomVoiceParams.ReportedUsage.forNumber(reportedUsage_);
@@ -817,33 +822,39 @@ public Builder setModelBytes(com.google.protobuf.ByteString value) {
817822
*
818823
*
819824
* <pre>
820-
* Optional. The usage of the synthesized audio to be reported.
825+
* Optional. Deprecated. The usage of the synthesized audio to be reported.
821826
* </pre>
822827
*
823828
* <code>
824-
* .google.cloud.texttospeech.v1.CustomVoiceParams.ReportedUsage reported_usage = 3 [(.google.api.field_behavior) = OPTIONAL];
829+
* .google.cloud.texttospeech.v1.CustomVoiceParams.ReportedUsage reported_usage = 3 [deprecated = true, (.google.api.field_behavior) = OPTIONAL];
825830
* </code>
826831
*
832+
* @deprecated google.cloud.texttospeech.v1.CustomVoiceParams.reported_usage is deprecated. See
833+
* google/cloud/texttospeech/v1/cloud_tts.proto;l=291
827834
* @return The enum numeric value on the wire for reportedUsage.
828835
*/
829836
@java.lang.Override
837+
@java.lang.Deprecated
830838
public int getReportedUsageValue() {
831839
return reportedUsage_;
832840
}
833841
/**
834842
*
835843
*
836844
* <pre>
837-
* Optional. The usage of the synthesized audio to be reported.
845+
* Optional. Deprecated. The usage of the synthesized audio to be reported.
838846
* </pre>
839847
*
840848
* <code>
841-
* .google.cloud.texttospeech.v1.CustomVoiceParams.ReportedUsage reported_usage = 3 [(.google.api.field_behavior) = OPTIONAL];
849+
* .google.cloud.texttospeech.v1.CustomVoiceParams.ReportedUsage reported_usage = 3 [deprecated = true, (.google.api.field_behavior) = OPTIONAL];
842850
* </code>
843851
*
852+
* @deprecated google.cloud.texttospeech.v1.CustomVoiceParams.reported_usage is deprecated. See
853+
* google/cloud/texttospeech/v1/cloud_tts.proto;l=291
844854
* @param value The enum numeric value on the wire for reportedUsage to set.
845855
* @return This builder for chaining.
846856
*/
857+
@java.lang.Deprecated
847858
public Builder setReportedUsageValue(int value) {
848859
reportedUsage_ = value;
849860
bitField0_ |= 0x00000002;
@@ -854,16 +865,19 @@ public Builder setReportedUsageValue(int value) {
854865
*
855866
*
856867
* <pre>
857-
* Optional. The usage of the synthesized audio to be reported.
868+
* Optional. Deprecated. The usage of the synthesized audio to be reported.
858869
* </pre>
859870
*
860871
* <code>
861-
* .google.cloud.texttospeech.v1.CustomVoiceParams.ReportedUsage reported_usage = 3 [(.google.api.field_behavior) = OPTIONAL];
872+
* .google.cloud.texttospeech.v1.CustomVoiceParams.ReportedUsage reported_usage = 3 [deprecated = true, (.google.api.field_behavior) = OPTIONAL];
862873
* </code>
863874
*
875+
* @deprecated google.cloud.texttospeech.v1.CustomVoiceParams.reported_usage is deprecated. See
876+
* google/cloud/texttospeech/v1/cloud_tts.proto;l=291
864877
* @return The reportedUsage.
865878
*/
866879
@java.lang.Override
880+
@java.lang.Deprecated
867881
public com.google.cloud.texttospeech.v1.CustomVoiceParams.ReportedUsage getReportedUsage() {
868882
com.google.cloud.texttospeech.v1.CustomVoiceParams.ReportedUsage result =
869883
com.google.cloud.texttospeech.v1.CustomVoiceParams.ReportedUsage.forNumber(
@@ -876,16 +890,19 @@ public com.google.cloud.texttospeech.v1.CustomVoiceParams.ReportedUsage getRepor
876890
*
877891
*
878892
* <pre>
879-
* Optional. The usage of the synthesized audio to be reported.
893+
* Optional. Deprecated. The usage of the synthesized audio to be reported.
880894
* </pre>
881895
*
882896
* <code>
883-
* .google.cloud.texttospeech.v1.CustomVoiceParams.ReportedUsage reported_usage = 3 [(.google.api.field_behavior) = OPTIONAL];
897+
* .google.cloud.texttospeech.v1.CustomVoiceParams.ReportedUsage reported_usage = 3 [deprecated = true, (.google.api.field_behavior) = OPTIONAL];
884898
* </code>
885899
*
900+
* @deprecated google.cloud.texttospeech.v1.CustomVoiceParams.reported_usage is deprecated. See
901+
* google/cloud/texttospeech/v1/cloud_tts.proto;l=291
886902
* @param value The reportedUsage to set.
887903
* @return This builder for chaining.
888904
*/
905+
@java.lang.Deprecated
889906
public Builder setReportedUsage(
890907
com.google.cloud.texttospeech.v1.CustomVoiceParams.ReportedUsage value) {
891908
if (value == null) {
@@ -900,15 +917,18 @@ public Builder setReportedUsage(
900917
*
901918
*
902919
* <pre>
903-
* Optional. The usage of the synthesized audio to be reported.
920+
* Optional. Deprecated. The usage of the synthesized audio to be reported.
904921
* </pre>
905922
*
906923
* <code>
907-
* .google.cloud.texttospeech.v1.CustomVoiceParams.ReportedUsage reported_usage = 3 [(.google.api.field_behavior) = OPTIONAL];
924+
* .google.cloud.texttospeech.v1.CustomVoiceParams.ReportedUsage reported_usage = 3 [deprecated = true, (.google.api.field_behavior) = OPTIONAL];
908925
* </code>
909926
*
927+
* @deprecated google.cloud.texttospeech.v1.CustomVoiceParams.reported_usage is deprecated. See
928+
* google/cloud/texttospeech/v1/cloud_tts.proto;l=291
910929
* @return This builder for chaining.
911930
*/
931+
@java.lang.Deprecated
912932
public Builder clearReportedUsage() {
913933
bitField0_ = (bitField0_ & ~0x00000002);
914934
reportedUsage_ = 0;

java-texttospeech/proto-google-cloud-texttospeech-v1/src/main/java/com/google/cloud/texttospeech/v1/CustomVoiceParamsOrBuilder.java

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -56,28 +56,34 @@ public interface CustomVoiceParamsOrBuilder
5656
*
5757
*
5858
* <pre>
59-
* Optional. The usage of the synthesized audio to be reported.
59+
* Optional. Deprecated. The usage of the synthesized audio to be reported.
6060
* </pre>
6161
*
6262
* <code>
63-
* .google.cloud.texttospeech.v1.CustomVoiceParams.ReportedUsage reported_usage = 3 [(.google.api.field_behavior) = OPTIONAL];
63+
* .google.cloud.texttospeech.v1.CustomVoiceParams.ReportedUsage reported_usage = 3 [deprecated = true, (.google.api.field_behavior) = OPTIONAL];
6464
* </code>
6565
*
66+
* @deprecated google.cloud.texttospeech.v1.CustomVoiceParams.reported_usage is deprecated. See
67+
* google/cloud/texttospeech/v1/cloud_tts.proto;l=291
6668
* @return The enum numeric value on the wire for reportedUsage.
6769
*/
70+
@java.lang.Deprecated
6871
int getReportedUsageValue();
6972
/**
7073
*
7174
*
7275
* <pre>
73-
* Optional. The usage of the synthesized audio to be reported.
76+
* Optional. Deprecated. The usage of the synthesized audio to be reported.
7477
* </pre>
7578
*
7679
* <code>
77-
* .google.cloud.texttospeech.v1.CustomVoiceParams.ReportedUsage reported_usage = 3 [(.google.api.field_behavior) = OPTIONAL];
80+
* .google.cloud.texttospeech.v1.CustomVoiceParams.ReportedUsage reported_usage = 3 [deprecated = true, (.google.api.field_behavior) = OPTIONAL];
7881
* </code>
7982
*
83+
* @deprecated google.cloud.texttospeech.v1.CustomVoiceParams.reported_usage is deprecated. See
84+
* google/cloud/texttospeech/v1/cloud_tts.proto;l=291
8085
* @return The reportedUsage.
8186
*/
87+
@java.lang.Deprecated
8288
com.google.cloud.texttospeech.v1.CustomVoiceParams.ReportedUsage getReportedUsage();
8389
}

0 commit comments

Comments
 (0)