Skip to content

Commit

Permalink
fix: [texttospeech] correct long audio synthesis HTTP binding (#10185)
Browse files Browse the repository at this point in the history
* fix: correct long audio synthesis HTTP binding
docs: Deprecate the custom voice usage field

PiperOrigin-RevId: 595119987

Source-Link: googleapis/googleapis@c22f408

Source-Link: googleapis/googleapis-gen@4e9ca63
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>
  • Loading branch information
gcf-owl-bot[bot] and gcf-owl-bot[bot] committed Jan 2, 2024
1 parent e25f733 commit cb5168c
Show file tree
Hide file tree
Showing 26 changed files with 455 additions and 297 deletions.
2 changes: 1 addition & 1 deletion java-texttospeech/README.md
Expand Up @@ -195,7 +195,7 @@ Java is a registered trademark of Oracle and/or its affiliates.
[kokoro-badge-link-5]: http://storage.googleapis.com/cloud-devrel-public/java/badges/google-cloud-java/java11.html
[stability-image]: https://img.shields.io/badge/stability-stable-green
[maven-version-image]: https://img.shields.io/maven-central/v/com.google.cloud/google-cloud-texttospeech.svg
[maven-version-link]: https://central.sonatype.com/artifact/com.google.cloud/google-cloud-texttospeech/2.31.0
[maven-version-link]: https://central.sonatype.com/artifact/com.google.cloud/google-cloud-texttospeech/2.33.0
[authentication]: https://github.com/googleapis/google-cloud-java#authentication
[auth-scopes]: https://developers.google.com/identity/protocols/oauth2/scopes
[predefined-iam-roles]: https://cloud.google.com/iam/docs/understanding-roles#predefined_roles
Expand Down
Expand Up @@ -16,6 +16,7 @@

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

import com.google.api.HttpRule;
import com.google.api.core.BetaApi;
import com.google.api.core.InternalApi;
import com.google.api.gax.core.BackgroundResource;
Expand All @@ -35,6 +36,7 @@
import com.google.cloud.texttospeech.v1.SynthesizeLongAudioMetadata;
import com.google.cloud.texttospeech.v1.SynthesizeLongAudioRequest;
import com.google.cloud.texttospeech.v1.SynthesizeLongAudioResponse;
import com.google.common.collect.ImmutableMap;
import com.google.longrunning.Operation;
import com.google.protobuf.TypeRegistry;
import java.io.IOException;
Expand Down Expand Up @@ -71,7 +73,7 @@ public class HttpJsonTextToSpeechLongAudioSynthesizeStub
.setRequestFormatter(
ProtoMessageRequestFormatter.<SynthesizeLongAudioRequest>newBuilder()
.setPath(
"/v1/{parent=projects/*/locations/*/voices/*}:SynthesizeLongAudio",
"/v1/{parent=projects/*/locations/*}:synthesizeLongAudio",
request -> {
Map<String, String> fields = new HashMap<>();
ProtoRestSerializer<SynthesizeLongAudioRequest> serializer =
Expand Down Expand Up @@ -154,7 +156,22 @@ protected HttpJsonTextToSpeechLongAudioSynthesizeStub(
throws IOException {
this.callableFactory = callableFactory;
this.httpJsonOperationsStub =
HttpJsonOperationsStub.create(clientContext, callableFactory, typeRegistry);
HttpJsonOperationsStub.create(
clientContext,
callableFactory,
typeRegistry,
ImmutableMap.<String, HttpRule>builder()
.put(
"google.longrunning.Operations.GetOperation",
HttpRule.newBuilder()
.setGet("/v1/{name=projects/*/locations/*/operations/*}")
.build())
.put(
"google.longrunning.Operations.ListOperations",
HttpRule.newBuilder()
.setGet("/v1/{name=projects/*/locations/*}/operations")
.build())
.build());

HttpJsonCallSettings<SynthesizeLongAudioRequest, Operation>
synthesizeLongAudioTransportSettings =
Expand Down
Expand Up @@ -16,6 +16,7 @@

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

import com.google.api.HttpRule;
import com.google.api.core.BetaApi;
import com.google.api.core.InternalApi;
import com.google.api.gax.core.BackgroundResource;
Expand All @@ -35,6 +36,7 @@
import com.google.cloud.texttospeech.v1beta1.SynthesizeLongAudioMetadata;
import com.google.cloud.texttospeech.v1beta1.SynthesizeLongAudioRequest;
import com.google.cloud.texttospeech.v1beta1.SynthesizeLongAudioResponse;
import com.google.common.collect.ImmutableMap;
import com.google.longrunning.Operation;
import com.google.protobuf.TypeRegistry;
import java.io.IOException;
Expand Down Expand Up @@ -71,7 +73,7 @@ public class HttpJsonTextToSpeechLongAudioSynthesizeStub
.setRequestFormatter(
ProtoMessageRequestFormatter.<SynthesizeLongAudioRequest>newBuilder()
.setPath(
"/v1beta1/{parent=projects/*/locations/*/voices/*}:SynthesizeLongAudio",
"/v1beta1/{parent=projects/*/locations/*}:synthesizeLongAudio",
request -> {
Map<String, String> fields = new HashMap<>();
ProtoRestSerializer<SynthesizeLongAudioRequest> serializer =
Expand Down Expand Up @@ -154,7 +156,22 @@ protected HttpJsonTextToSpeechLongAudioSynthesizeStub(
throws IOException {
this.callableFactory = callableFactory;
this.httpJsonOperationsStub =
HttpJsonOperationsStub.create(clientContext, callableFactory, typeRegistry);
HttpJsonOperationsStub.create(
clientContext,
callableFactory,
typeRegistry,
ImmutableMap.<String, HttpRule>builder()
.put(
"google.longrunning.Operations.GetOperation",
HttpRule.newBuilder()
.setGet("/v1beta1/{name=projects/*/locations/*/operations/*}")
.build())
.put(
"google.longrunning.Operations.ListOperations",
HttpRule.newBuilder()
.setGet("/v1beta1/{name=projects/*/locations/*}/operations")
.build())
.build());

HttpJsonCallSettings<SynthesizeLongAudioRequest, Operation>
synthesizeLongAudioTransportSettings =
Expand Down
Expand Up @@ -86,7 +86,7 @@ public void synthesizeLongAudioTest() throws Exception {

SynthesizeLongAudioRequest request =
SynthesizeLongAudioRequest.newBuilder()
.setParent("projects/project-5698/locations/location-5698/voices/voice-5698")
.setParent("projects/project-5833/locations/location-5833")
.setInput(SynthesisInput.newBuilder().build())
.setAudioConfig(AudioConfig.newBuilder().build())
.setOutputGcsUri("outputGcsUri-489598154")
Expand Down Expand Up @@ -121,7 +121,7 @@ public void synthesizeLongAudioExceptionTest() throws Exception {
try {
SynthesizeLongAudioRequest request =
SynthesizeLongAudioRequest.newBuilder()
.setParent("projects/project-5698/locations/location-5698/voices/voice-5698")
.setParent("projects/project-5833/locations/location-5833")
.setInput(SynthesisInput.newBuilder().build())
.setAudioConfig(AudioConfig.newBuilder().build())
.setOutputGcsUri("outputGcsUri-489598154")
Expand Down
Expand Up @@ -86,7 +86,7 @@ public void synthesizeLongAudioTest() throws Exception {

SynthesizeLongAudioRequest request =
SynthesizeLongAudioRequest.newBuilder()
.setParent("projects/project-5698/locations/location-5698/voices/voice-5698")
.setParent("projects/project-5833/locations/location-5833")
.setInput(SynthesisInput.newBuilder().build())
.setAudioConfig(AudioConfig.newBuilder().build())
.setOutputGcsUri("outputGcsUri-489598154")
Expand Down Expand Up @@ -121,7 +121,7 @@ public void synthesizeLongAudioExceptionTest() throws Exception {
try {
SynthesizeLongAudioRequest request =
SynthesizeLongAudioRequest.newBuilder()
.setParent("projects/project-5698/locations/location-5698/voices/voice-5698")
.setParent("projects/project-5833/locations/location-5833")
.setInput(SynthesisInput.newBuilder().build())
.setAudioConfig(AudioConfig.newBuilder().build())
.setOutputGcsUri("outputGcsUri-489598154")
Expand Down
Expand Up @@ -67,9 +67,8 @@ public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() {
*
*
* <pre>
* The usage of the synthesized audio. You must report your honest and
* correct usage of the service as it's regulated by contract and will cause
* significant difference in billing.
* Deprecated. The usage of the synthesized audio. Usage does not affect
* billing.
* </pre>
*
* Protobuf enum {@code google.cloud.texttospeech.v1.CustomVoiceParams.ReportedUsage}
Expand Down Expand Up @@ -291,33 +290,39 @@ public com.google.protobuf.ByteString getModelBytes() {
*
*
* <pre>
* Optional. The usage of the synthesized audio to be reported.
* Optional. Deprecated. The usage of the synthesized audio to be reported.
* </pre>
*
* <code>
* .google.cloud.texttospeech.v1.CustomVoiceParams.ReportedUsage reported_usage = 3 [(.google.api.field_behavior) = OPTIONAL];
* .google.cloud.texttospeech.v1.CustomVoiceParams.ReportedUsage reported_usage = 3 [deprecated = true, (.google.api.field_behavior) = OPTIONAL];
* </code>
*
* @deprecated google.cloud.texttospeech.v1.CustomVoiceParams.reported_usage is deprecated. See
* google/cloud/texttospeech/v1/cloud_tts.proto;l=291
* @return The enum numeric value on the wire for reportedUsage.
*/
@java.lang.Override
@java.lang.Deprecated
public int getReportedUsageValue() {
return reportedUsage_;
}
/**
*
*
* <pre>
* Optional. The usage of the synthesized audio to be reported.
* Optional. Deprecated. The usage of the synthesized audio to be reported.
* </pre>
*
* <code>
* .google.cloud.texttospeech.v1.CustomVoiceParams.ReportedUsage reported_usage = 3 [(.google.api.field_behavior) = OPTIONAL];
* .google.cloud.texttospeech.v1.CustomVoiceParams.ReportedUsage reported_usage = 3 [deprecated = true, (.google.api.field_behavior) = OPTIONAL];
* </code>
*
* @deprecated google.cloud.texttospeech.v1.CustomVoiceParams.reported_usage is deprecated. See
* google/cloud/texttospeech/v1/cloud_tts.proto;l=291
* @return The reportedUsage.
*/
@java.lang.Override
@java.lang.Deprecated
public com.google.cloud.texttospeech.v1.CustomVoiceParams.ReportedUsage getReportedUsage() {
com.google.cloud.texttospeech.v1.CustomVoiceParams.ReportedUsage result =
com.google.cloud.texttospeech.v1.CustomVoiceParams.ReportedUsage.forNumber(reportedUsage_);
Expand Down Expand Up @@ -817,33 +822,39 @@ public Builder setModelBytes(com.google.protobuf.ByteString value) {
*
*
* <pre>
* Optional. The usage of the synthesized audio to be reported.
* Optional. Deprecated. The usage of the synthesized audio to be reported.
* </pre>
*
* <code>
* .google.cloud.texttospeech.v1.CustomVoiceParams.ReportedUsage reported_usage = 3 [(.google.api.field_behavior) = OPTIONAL];
* .google.cloud.texttospeech.v1.CustomVoiceParams.ReportedUsage reported_usage = 3 [deprecated = true, (.google.api.field_behavior) = OPTIONAL];
* </code>
*
* @deprecated google.cloud.texttospeech.v1.CustomVoiceParams.reported_usage is deprecated. See
* google/cloud/texttospeech/v1/cloud_tts.proto;l=291
* @return The enum numeric value on the wire for reportedUsage.
*/
@java.lang.Override
@java.lang.Deprecated
public int getReportedUsageValue() {
return reportedUsage_;
}
/**
*
*
* <pre>
* Optional. The usage of the synthesized audio to be reported.
* Optional. Deprecated. The usage of the synthesized audio to be reported.
* </pre>
*
* <code>
* .google.cloud.texttospeech.v1.CustomVoiceParams.ReportedUsage reported_usage = 3 [(.google.api.field_behavior) = OPTIONAL];
* .google.cloud.texttospeech.v1.CustomVoiceParams.ReportedUsage reported_usage = 3 [deprecated = true, (.google.api.field_behavior) = OPTIONAL];
* </code>
*
* @deprecated google.cloud.texttospeech.v1.CustomVoiceParams.reported_usage is deprecated. See
* google/cloud/texttospeech/v1/cloud_tts.proto;l=291
* @param value The enum numeric value on the wire for reportedUsage to set.
* @return This builder for chaining.
*/
@java.lang.Deprecated
public Builder setReportedUsageValue(int value) {
reportedUsage_ = value;
bitField0_ |= 0x00000002;
Expand All @@ -854,16 +865,19 @@ public Builder setReportedUsageValue(int value) {
*
*
* <pre>
* Optional. The usage of the synthesized audio to be reported.
* Optional. Deprecated. The usage of the synthesized audio to be reported.
* </pre>
*
* <code>
* .google.cloud.texttospeech.v1.CustomVoiceParams.ReportedUsage reported_usage = 3 [(.google.api.field_behavior) = OPTIONAL];
* .google.cloud.texttospeech.v1.CustomVoiceParams.ReportedUsage reported_usage = 3 [deprecated = true, (.google.api.field_behavior) = OPTIONAL];
* </code>
*
* @deprecated google.cloud.texttospeech.v1.CustomVoiceParams.reported_usage is deprecated. See
* google/cloud/texttospeech/v1/cloud_tts.proto;l=291
* @return The reportedUsage.
*/
@java.lang.Override
@java.lang.Deprecated
public com.google.cloud.texttospeech.v1.CustomVoiceParams.ReportedUsage getReportedUsage() {
com.google.cloud.texttospeech.v1.CustomVoiceParams.ReportedUsage result =
com.google.cloud.texttospeech.v1.CustomVoiceParams.ReportedUsage.forNumber(
Expand All @@ -876,16 +890,19 @@ public com.google.cloud.texttospeech.v1.CustomVoiceParams.ReportedUsage getRepor
*
*
* <pre>
* Optional. The usage of the synthesized audio to be reported.
* Optional. Deprecated. The usage of the synthesized audio to be reported.
* </pre>
*
* <code>
* .google.cloud.texttospeech.v1.CustomVoiceParams.ReportedUsage reported_usage = 3 [(.google.api.field_behavior) = OPTIONAL];
* .google.cloud.texttospeech.v1.CustomVoiceParams.ReportedUsage reported_usage = 3 [deprecated = true, (.google.api.field_behavior) = OPTIONAL];
* </code>
*
* @deprecated google.cloud.texttospeech.v1.CustomVoiceParams.reported_usage is deprecated. See
* google/cloud/texttospeech/v1/cloud_tts.proto;l=291
* @param value The reportedUsage to set.
* @return This builder for chaining.
*/
@java.lang.Deprecated
public Builder setReportedUsage(
com.google.cloud.texttospeech.v1.CustomVoiceParams.ReportedUsage value) {
if (value == null) {
Expand All @@ -900,15 +917,18 @@ public Builder setReportedUsage(
*
*
* <pre>
* Optional. The usage of the synthesized audio to be reported.
* Optional. Deprecated. The usage of the synthesized audio to be reported.
* </pre>
*
* <code>
* .google.cloud.texttospeech.v1.CustomVoiceParams.ReportedUsage reported_usage = 3 [(.google.api.field_behavior) = OPTIONAL];
* .google.cloud.texttospeech.v1.CustomVoiceParams.ReportedUsage reported_usage = 3 [deprecated = true, (.google.api.field_behavior) = OPTIONAL];
* </code>
*
* @deprecated google.cloud.texttospeech.v1.CustomVoiceParams.reported_usage is deprecated. See
* google/cloud/texttospeech/v1/cloud_tts.proto;l=291
* @return This builder for chaining.
*/
@java.lang.Deprecated
public Builder clearReportedUsage() {
bitField0_ = (bitField0_ & ~0x00000002);
reportedUsage_ = 0;
Expand Down
Expand Up @@ -56,28 +56,34 @@ public interface CustomVoiceParamsOrBuilder
*
*
* <pre>
* Optional. The usage of the synthesized audio to be reported.
* Optional. Deprecated. The usage of the synthesized audio to be reported.
* </pre>
*
* <code>
* .google.cloud.texttospeech.v1.CustomVoiceParams.ReportedUsage reported_usage = 3 [(.google.api.field_behavior) = OPTIONAL];
* .google.cloud.texttospeech.v1.CustomVoiceParams.ReportedUsage reported_usage = 3 [deprecated = true, (.google.api.field_behavior) = OPTIONAL];
* </code>
*
* @deprecated google.cloud.texttospeech.v1.CustomVoiceParams.reported_usage is deprecated. See
* google/cloud/texttospeech/v1/cloud_tts.proto;l=291
* @return The enum numeric value on the wire for reportedUsage.
*/
@java.lang.Deprecated
int getReportedUsageValue();
/**
*
*
* <pre>
* Optional. The usage of the synthesized audio to be reported.
* Optional. Deprecated. The usage of the synthesized audio to be reported.
* </pre>
*
* <code>
* .google.cloud.texttospeech.v1.CustomVoiceParams.ReportedUsage reported_usage = 3 [(.google.api.field_behavior) = OPTIONAL];
* .google.cloud.texttospeech.v1.CustomVoiceParams.ReportedUsage reported_usage = 3 [deprecated = true, (.google.api.field_behavior) = OPTIONAL];
* </code>
*
* @deprecated google.cloud.texttospeech.v1.CustomVoiceParams.reported_usage is deprecated. See
* google/cloud/texttospeech/v1/cloud_tts.proto;l=291
* @return The reportedUsage.
*/
@java.lang.Deprecated
com.google.cloud.texttospeech.v1.CustomVoiceParams.ReportedUsage getReportedUsage();
}

0 comments on commit cb5168c

Please sign in to comment.