From 035806efe40a4fb37e69c7e9650dfc978729eea8 Mon Sep 17 00:00:00 2001 From: Owl Bot Date: Tue, 22 Oct 2024 14:00:01 +0000 Subject: [PATCH 1/2] feat: add brand voice lite, which lets you clone a voice with just 10 seconds of audio PiperOrigin-RevId: 688491221 Source-Link: https://github.com/googleapis/googleapis/commit/60688dc3302894cb893531383d6a26d9416a1364 Source-Link: https://github.com/googleapis/googleapis-gen/commit/4072c999b36baa21ccb29c5f5d5608962840b31a Copy-Tag: eyJwIjoiVGV4dFRvU3BlZWNoLy5Pd2xCb3QueWFtbCIsImgiOiI0MDcyYzk5OWIzNmJhYTIxY2NiMjljNWY1ZDU2MDg5NjI4NDBiMzFhIn0= --- .../Google/Cloud/Texttospeech/V1/CloudTts.php | Bin 0 -> 4683 bytes .../Cloud/Texttospeech/V1/CloudTtsLrs.php | 49 +++ .../TextToSpeech/V1/AdvancedVoiceOptions.php | 81 ++++ .../Cloud/TextToSpeech/V1/AudioConfig.php | 329 ++++++++++++++ .../Cloud/TextToSpeech/V1/AudioEncoding.php | 90 ++++ .../V1/CustomPronunciationParams.php | 177 ++++++++ .../PhoneticEncoding.php | 66 +++ .../TextToSpeech/V1/CustomPronunciations.php | 67 +++ .../TextToSpeech/V1/CustomVoiceParams.php | 106 +++++ .../V1/CustomVoiceParams/ReportedUsage.php | 68 +++ .../TextToSpeech/V1/ListVoicesRequest.php | 115 +++++ .../TextToSpeech/V1/ListVoicesResponse.php | 67 +++ .../Cloud/TextToSpeech/V1/SsmlVoiceGender.php | 73 ++++ .../V1/StreamingSynthesisInput.php | 84 ++++ .../V1/StreamingSynthesizeConfig.php | 77 ++++ .../V1/StreamingSynthesizeRequest.php | 118 +++++ .../V1/StreamingSynthesizeResponse.php | 73 ++++ .../Cloud/TextToSpeech/V1/SynthesisInput.php | 203 +++++++++ .../V1/SynthesizeLongAudioMetadata.php | 162 +++++++ .../V1/SynthesizeLongAudioRequest.php | 246 +++++++++++ .../V1/SynthesizeLongAudioResponse.php | 33 ++ .../V1/SynthesizeSpeechRequest.php | 226 ++++++++++ .../V1/SynthesizeSpeechResponse.php | 83 ++++ .../Google/Cloud/TextToSpeech/V1/Voice.php | 177 ++++++++ .../TextToSpeech/V1/VoiceCloneParams.php | 67 +++ .../TextToSpeech/V1/VoiceSelectionParams.php | 303 +++++++++++++ .../V1/TextToSpeechClient/list_voices.php | 57 +++ .../streaming_synthesize.php | 64 +++ .../TextToSpeechClient/synthesize_speech.php | 94 ++++ .../synthesize_long_audio.php | 89 ++++ .../v1/src/V1/Client/TextToSpeechClient.php | 292 +++++++++++++ .../TextToSpeechLongAudioSynthesizeClient.php | 274 ++++++++++++ .../src/V1/Gapic/TextToSpeechGapicClient.php | 412 ++++++++++++++++++ ...ToSpeechLongAudioSynthesizeGapicClient.php | 403 +++++++++++++++++ .../v1/src/V1/TextToSpeechClient.php | 34 ++ .../TextToSpeechLongAudioSynthesizeClient.php | 34 ++ .../v1/src/V1/gapic_metadata.json | 47 ++ .../text_to_speech_client_config.json | 58 +++ .../text_to_speech_descriptor_config.php | 46 ++ ...h_long_audio_synthesize_client_config.json | 37 ++ ...ong_audio_synthesize_descriptor_config.php | 50 +++ ...ng_audio_synthesize_rest_client_config.php | 65 +++ .../text_to_speech_rest_client_config.php | 62 +++ .../Unit/V1/Client/TextToSpeechClientTest.php | 325 ++++++++++++++ ...tToSpeechLongAudioSynthesizeClientTest.php | 270 ++++++++++++ .../tests/Unit/V1/TextToSpeechClientTest.php | 291 +++++++++++++ ...tToSpeechLongAudioSynthesizeClientTest.php | 193 ++++++++ 47 files changed, 6337 insertions(+) create mode 100644 owl-bot-staging/TextToSpeech/v1/proto/src/GPBMetadata/Google/Cloud/Texttospeech/V1/CloudTts.php create mode 100644 owl-bot-staging/TextToSpeech/v1/proto/src/GPBMetadata/Google/Cloud/Texttospeech/V1/CloudTtsLrs.php create mode 100644 owl-bot-staging/TextToSpeech/v1/proto/src/Google/Cloud/TextToSpeech/V1/AdvancedVoiceOptions.php create mode 100644 owl-bot-staging/TextToSpeech/v1/proto/src/Google/Cloud/TextToSpeech/V1/AudioConfig.php create mode 100644 owl-bot-staging/TextToSpeech/v1/proto/src/Google/Cloud/TextToSpeech/V1/AudioEncoding.php create mode 100644 owl-bot-staging/TextToSpeech/v1/proto/src/Google/Cloud/TextToSpeech/V1/CustomPronunciationParams.php create mode 100644 owl-bot-staging/TextToSpeech/v1/proto/src/Google/Cloud/TextToSpeech/V1/CustomPronunciationParams/PhoneticEncoding.php create mode 100644 owl-bot-staging/TextToSpeech/v1/proto/src/Google/Cloud/TextToSpeech/V1/CustomPronunciations.php create mode 100644 owl-bot-staging/TextToSpeech/v1/proto/src/Google/Cloud/TextToSpeech/V1/CustomVoiceParams.php create mode 100644 owl-bot-staging/TextToSpeech/v1/proto/src/Google/Cloud/TextToSpeech/V1/CustomVoiceParams/ReportedUsage.php create mode 100644 owl-bot-staging/TextToSpeech/v1/proto/src/Google/Cloud/TextToSpeech/V1/ListVoicesRequest.php create mode 100644 owl-bot-staging/TextToSpeech/v1/proto/src/Google/Cloud/TextToSpeech/V1/ListVoicesResponse.php create mode 100644 owl-bot-staging/TextToSpeech/v1/proto/src/Google/Cloud/TextToSpeech/V1/SsmlVoiceGender.php create mode 100644 owl-bot-staging/TextToSpeech/v1/proto/src/Google/Cloud/TextToSpeech/V1/StreamingSynthesisInput.php create mode 100644 owl-bot-staging/TextToSpeech/v1/proto/src/Google/Cloud/TextToSpeech/V1/StreamingSynthesizeConfig.php create mode 100644 owl-bot-staging/TextToSpeech/v1/proto/src/Google/Cloud/TextToSpeech/V1/StreamingSynthesizeRequest.php create mode 100644 owl-bot-staging/TextToSpeech/v1/proto/src/Google/Cloud/TextToSpeech/V1/StreamingSynthesizeResponse.php create mode 100644 owl-bot-staging/TextToSpeech/v1/proto/src/Google/Cloud/TextToSpeech/V1/SynthesisInput.php create mode 100644 owl-bot-staging/TextToSpeech/v1/proto/src/Google/Cloud/TextToSpeech/V1/SynthesizeLongAudioMetadata.php create mode 100644 owl-bot-staging/TextToSpeech/v1/proto/src/Google/Cloud/TextToSpeech/V1/SynthesizeLongAudioRequest.php create mode 100644 owl-bot-staging/TextToSpeech/v1/proto/src/Google/Cloud/TextToSpeech/V1/SynthesizeLongAudioResponse.php create mode 100644 owl-bot-staging/TextToSpeech/v1/proto/src/Google/Cloud/TextToSpeech/V1/SynthesizeSpeechRequest.php create mode 100644 owl-bot-staging/TextToSpeech/v1/proto/src/Google/Cloud/TextToSpeech/V1/SynthesizeSpeechResponse.php create mode 100644 owl-bot-staging/TextToSpeech/v1/proto/src/Google/Cloud/TextToSpeech/V1/Voice.php create mode 100644 owl-bot-staging/TextToSpeech/v1/proto/src/Google/Cloud/TextToSpeech/V1/VoiceCloneParams.php create mode 100644 owl-bot-staging/TextToSpeech/v1/proto/src/Google/Cloud/TextToSpeech/V1/VoiceSelectionParams.php create mode 100644 owl-bot-staging/TextToSpeech/v1/samples/V1/TextToSpeechClient/list_voices.php create mode 100644 owl-bot-staging/TextToSpeech/v1/samples/V1/TextToSpeechClient/streaming_synthesize.php create mode 100644 owl-bot-staging/TextToSpeech/v1/samples/V1/TextToSpeechClient/synthesize_speech.php create mode 100644 owl-bot-staging/TextToSpeech/v1/samples/V1/TextToSpeechLongAudioSynthesizeClient/synthesize_long_audio.php create mode 100644 owl-bot-staging/TextToSpeech/v1/src/V1/Client/TextToSpeechClient.php create mode 100644 owl-bot-staging/TextToSpeech/v1/src/V1/Client/TextToSpeechLongAudioSynthesizeClient.php create mode 100644 owl-bot-staging/TextToSpeech/v1/src/V1/Gapic/TextToSpeechGapicClient.php create mode 100644 owl-bot-staging/TextToSpeech/v1/src/V1/Gapic/TextToSpeechLongAudioSynthesizeGapicClient.php create mode 100644 owl-bot-staging/TextToSpeech/v1/src/V1/TextToSpeechClient.php create mode 100644 owl-bot-staging/TextToSpeech/v1/src/V1/TextToSpeechLongAudioSynthesizeClient.php create mode 100644 owl-bot-staging/TextToSpeech/v1/src/V1/gapic_metadata.json create mode 100644 owl-bot-staging/TextToSpeech/v1/src/V1/resources/text_to_speech_client_config.json create mode 100644 owl-bot-staging/TextToSpeech/v1/src/V1/resources/text_to_speech_descriptor_config.php create mode 100644 owl-bot-staging/TextToSpeech/v1/src/V1/resources/text_to_speech_long_audio_synthesize_client_config.json create mode 100644 owl-bot-staging/TextToSpeech/v1/src/V1/resources/text_to_speech_long_audio_synthesize_descriptor_config.php create mode 100644 owl-bot-staging/TextToSpeech/v1/src/V1/resources/text_to_speech_long_audio_synthesize_rest_client_config.php create mode 100644 owl-bot-staging/TextToSpeech/v1/src/V1/resources/text_to_speech_rest_client_config.php create mode 100644 owl-bot-staging/TextToSpeech/v1/tests/Unit/V1/Client/TextToSpeechClientTest.php create mode 100644 owl-bot-staging/TextToSpeech/v1/tests/Unit/V1/Client/TextToSpeechLongAudioSynthesizeClientTest.php create mode 100644 owl-bot-staging/TextToSpeech/v1/tests/Unit/V1/TextToSpeechClientTest.php create mode 100644 owl-bot-staging/TextToSpeech/v1/tests/Unit/V1/TextToSpeechLongAudioSynthesizeClientTest.php diff --git a/owl-bot-staging/TextToSpeech/v1/proto/src/GPBMetadata/Google/Cloud/Texttospeech/V1/CloudTts.php b/owl-bot-staging/TextToSpeech/v1/proto/src/GPBMetadata/Google/Cloud/Texttospeech/V1/CloudTts.php new file mode 100644 index 0000000000000000000000000000000000000000..cee048c39aed1706ac68ec1f4ab27f126319418c GIT binary patch literal 4683 zcmcIoL2uj06*gtdv7c;JW|EEUtg~EZfptIA;@)MJ5dfu4KpZ&>tNU=Ka)-U1ZZLr=Z++Ed@mkd|aAaKV(veQjrJzqF*K-2La4hL`*zFQeGMs^HTExppQmG~#)moBT zs(lMTpkg23@zLX3X)Y>&Uyg22x(U;tYm5Z~1eB9-ff zLlWp6JHknqnPo?50M`GFqbzmH5`Gi@_4 zb<2E(;XIeRy5$ozo*vsB+D2eHwnPnTwn26tNF0-n{m6AN{O3~SRGnr7v(c{F0r70z zYL|#_c%~aTULA+#^F0z==8?YHc@R!Z;moeI!+p%>r<{B)1>TU1&n`(G35K5ijQLFg zE-s(iGg79wW?Qjshi1XC{d|5D(+J{ihDFOHcJOXC`zEnE1=82gOvigS(*_ASGt)_y z_eVc7!z?SE&Sg^fk%2pxX`o5@82)+>cHf11;`@Abh7mP0PSniV-qxKEOLt8qElmq& z?A8ZkAG$Pl?KBKN9I!byzzZYfpX4lT9GHG^;+O{U8|2qR;s@dutXsO>8|pox8BT|! z1xeUhEi8Vg2yzv~aRcAQB_-lxSUzJAICOC*k-MLn7fOarC;vf!IC~P`gXF}7K7&~m z*I(9X7YmT^{eh+Rh}|JxdJ$hHbC2fF)I;_vZRje+#C?dL z(e+@NOXPC%5m=Z_ViBe}b=}hkKF2A+nm+894${Exnmv~DMDD?SIE7jinE^+60q^Ny zMm6S^=J1@RS1@JQx;JYzc$zoijy4-veiMVu;?NJA0ji^oa%wX9;lYVFVcG3_x*t-T zp^1IiaQlu;P^>jvVy9!;J(j>^t};L3w@#F)hk$B`R}qjNw7{_0jJ#rbU9H6Mo9sa9 zsu8kwyI!dssjX^JQ;&+ZQuU~;9UnF8YO%UsRZFP_aT9J&52@Cblpt=y=JcmuX-(x2 zKgSBIa6{wCDBJ=OAFrgKkbI7 z0I>o|E+LmCMRhWn`{8_W1`$;amyvB)$8DSb1(qdKZMNh>Vfi~{2|JT`8{)1R7=5NuQjX%!TU6es2xX&~KpAxEzeO@y=>1AwltI^an z<_*rA@to!$KEUp2ajF*XqcHzR*@nCN5LL+v!^dv!XK)LfJ)}d$b{mo&aUBmgyxP#m z4$Q(y=AO?_*VOEpMu>7uK??D-K)d%ZVSVDgcn`K3YQ5HIsU_{Wsg%_#va$v%4OKa4 zRS#8Ek_6nS?e8B{kJMC5&Oz!b0}yUwL?gORUy$=KeA<`fJxE98JZgI39^y8vbE06c z!4}Iad`&iBvl)0qA0XVwmbaHtpQD_*wvjM*XZ1PxDK_J)lg!qeDINH`09#YGuSnF( zn~?G&tUuDlRO0y&NxYbY&Qi~5w zSf9`WN?GN&RIR?U2rzp)&zlUX*?}Z)V6Je|NwQ_gjxW!K|kv4y$ zWcoqi`uS}3<;$1hWYNbg%6XsPB0O^OaL{$ULE)=3ip(m)W&N2D|jIlNp~cbF%k!^tl~g zYp{Ebi2QB5*!WlM0}hbSGlYD893r2`5z6uWhV}%T=I69~W?zR-7g@_O_+3Eub@X_V oWvvoNvHusR%Q!l49)Em!rrzZj5o7ljZ@sf%Bl+FJ1zZ697sBrdIRF3v literal 0 HcmV?d00001 diff --git a/owl-bot-staging/TextToSpeech/v1/proto/src/GPBMetadata/Google/Cloud/Texttospeech/V1/CloudTtsLrs.php b/owl-bot-staging/TextToSpeech/v1/proto/src/GPBMetadata/Google/Cloud/Texttospeech/V1/CloudTtsLrs.php new file mode 100644 index 000000000000..5666b6ff2e0a --- /dev/null +++ b/owl-bot-staging/TextToSpeech/v1/proto/src/GPBMetadata/Google/Cloud/Texttospeech/V1/CloudTtsLrs.php @@ -0,0 +1,49 @@ +internalAddGeneratedFile( + ' +ü + +0google/cloud/texttospeech/v1/cloud_tts_lrs.protogoogle.cloud.texttospeech.v1google/api/client.protogoogle/api/field_behavior.proto,google/cloud/texttospeech/v1/cloud_tts.proto#google/longrunning/operations.protogoogle/protobuf/timestamp.proto"™ +SynthesizeLongAudioRequest +parent ( @ +input ( 2,.google.cloud.texttospeech.v1.SynthesisInputBàAD + audio_config ( 2).google.cloud.texttospeech.v1.AudioConfigBàA +output_gcs_uri ( BàAF +voice ( 22.google.cloud.texttospeech.v1.VoiceSelectionParamsBàA" +SynthesizeLongAudioResponse"¤ +SynthesizeLongAudioMetadata. + +start_time ( 2.google.protobuf.Timestamp8 +last_update_time ( 2.google.protobuf.TimestampB +progress_percentage (2Ÿ +TextToSpeechLongAudioSynthesizeª +SynthesizeLongAudio8.google.cloud.texttospeech.v1.SynthesizeLongAudioRequest.google.longrunning.Operation"¹ÊAt +8google.cloud.texttospeech.v1.SynthesizeLongAudioResponse8google.cloud.texttospeech.v1.SynthesizeLongAudioMetadata‚Óä“<"7/v1/{parent=projects/*/locations/*}:synthesizeLongAudio:*OÊAtexttospeech.googleapis.comÒA.https://www.googleapis.com/auth/cloud-platformBï + com.google.cloud.texttospeech.v1B#TextToSpeechLongAudioSynthesisProtoPZDcloud.google.com/go/texttospeech/apiv1/texttospeechpb;texttospeechpbªGoogle.Cloud.TextToSpeech.V1ÊGoogle\\Cloud\\TextToSpeech\\V1êGoogle::Cloud::TextToSpeech::V1bproto3' + , true); + + static::$is_initialized = true; + } +} + diff --git a/owl-bot-staging/TextToSpeech/v1/proto/src/Google/Cloud/TextToSpeech/V1/AdvancedVoiceOptions.php b/owl-bot-staging/TextToSpeech/v1/proto/src/Google/Cloud/TextToSpeech/V1/AdvancedVoiceOptions.php new file mode 100644 index 000000000000..2222ba2fcb32 --- /dev/null +++ b/owl-bot-staging/TextToSpeech/v1/proto/src/Google/Cloud/TextToSpeech/V1/AdvancedVoiceOptions.php @@ -0,0 +1,81 @@ +google.cloud.texttospeech.v1.AdvancedVoiceOptions + */ +class AdvancedVoiceOptions extends \Google\Protobuf\Internal\Message +{ + /** + * Only for Journey voices. If false, the synthesis will be context aware + * and have higher latency. + * + * Generated from protobuf field optional bool low_latency_journey_synthesis = 1; + */ + protected $low_latency_journey_synthesis = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type bool $low_latency_journey_synthesis + * Only for Journey voices. If false, the synthesis will be context aware + * and have higher latency. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Texttospeech\V1\CloudTts::initOnce(); + parent::__construct($data); + } + + /** + * Only for Journey voices. If false, the synthesis will be context aware + * and have higher latency. + * + * Generated from protobuf field optional bool low_latency_journey_synthesis = 1; + * @return bool + */ + public function getLowLatencyJourneySynthesis() + { + return isset($this->low_latency_journey_synthesis) ? $this->low_latency_journey_synthesis : false; + } + + public function hasLowLatencyJourneySynthesis() + { + return isset($this->low_latency_journey_synthesis); + } + + public function clearLowLatencyJourneySynthesis() + { + unset($this->low_latency_journey_synthesis); + } + + /** + * Only for Journey voices. If false, the synthesis will be context aware + * and have higher latency. + * + * Generated from protobuf field optional bool low_latency_journey_synthesis = 1; + * @param bool $var + * @return $this + */ + public function setLowLatencyJourneySynthesis($var) + { + GPBUtil::checkBool($var); + $this->low_latency_journey_synthesis = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/TextToSpeech/v1/proto/src/Google/Cloud/TextToSpeech/V1/AudioConfig.php b/owl-bot-staging/TextToSpeech/v1/proto/src/Google/Cloud/TextToSpeech/V1/AudioConfig.php new file mode 100644 index 000000000000..7d299d36de5a --- /dev/null +++ b/owl-bot-staging/TextToSpeech/v1/proto/src/Google/Cloud/TextToSpeech/V1/AudioConfig.php @@ -0,0 +1,329 @@ +google.cloud.texttospeech.v1.AudioConfig + */ +class AudioConfig extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The format of the audio byte stream. + * + * Generated from protobuf field .google.cloud.texttospeech.v1.AudioEncoding audio_encoding = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $audio_encoding = 0; + /** + * Optional. Input only. Speaking rate/speed, in the range [0.25, 4.0]. 1.0 is + * the normal native speed supported by the specific voice. 2.0 is twice as + * fast, and 0.5 is half as fast. If unset(0.0), defaults to the native 1.0 + * speed. Any other values < 0.25 or > 4.0 will return an error. + * + * Generated from protobuf field double speaking_rate = 2 [(.google.api.field_behavior) = INPUT_ONLY, (.google.api.field_behavior) = OPTIONAL]; + */ + protected $speaking_rate = 0.0; + /** + * Optional. Input only. Speaking pitch, in the range [-20.0, 20.0]. 20 means + * increase 20 semitones from the original pitch. -20 means decrease 20 + * semitones from the original pitch. + * + * Generated from protobuf field double pitch = 3 [(.google.api.field_behavior) = INPUT_ONLY, (.google.api.field_behavior) = OPTIONAL]; + */ + protected $pitch = 0.0; + /** + * Optional. Input only. Volume gain (in dB) of the normal native volume + * supported by the specific voice, in the range [-96.0, 16.0]. If unset, or + * set to a value of 0.0 (dB), will play at normal native signal amplitude. A + * value of -6.0 (dB) will play at approximately half the amplitude of the + * normal native signal amplitude. A value of +6.0 (dB) will play at + * approximately twice the amplitude of the normal native signal amplitude. + * Strongly recommend not to exceed +10 (dB) as there's usually no effective + * increase in loudness for any value greater than that. + * + * Generated from protobuf field double volume_gain_db = 4 [(.google.api.field_behavior) = INPUT_ONLY, (.google.api.field_behavior) = OPTIONAL]; + */ + protected $volume_gain_db = 0.0; + /** + * Optional. The synthesis sample rate (in hertz) for this audio. When this is + * specified in SynthesizeSpeechRequest, if this is different from the voice's + * natural sample rate, then the synthesizer will honor this request by + * converting to the desired sample rate (which might result in worse audio + * quality), unless the specified sample rate is not supported for the + * encoding chosen, in which case it will fail the request and return + * [google.rpc.Code.INVALID_ARGUMENT][google.rpc.Code.INVALID_ARGUMENT]. + * + * Generated from protobuf field int32 sample_rate_hertz = 5 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $sample_rate_hertz = 0; + /** + * Optional. Input only. An identifier which selects 'audio effects' profiles + * that are applied on (post synthesized) text to speech. Effects are applied + * on top of each other in the order they are given. See + * [audio + * profiles](https://cloud.google.com/text-to-speech/docs/audio-profiles) for + * current supported profile ids. + * + * Generated from protobuf field repeated string effects_profile_id = 6 [(.google.api.field_behavior) = INPUT_ONLY, (.google.api.field_behavior) = OPTIONAL]; + */ + private $effects_profile_id; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type int $audio_encoding + * Required. The format of the audio byte stream. + * @type float $speaking_rate + * Optional. Input only. Speaking rate/speed, in the range [0.25, 4.0]. 1.0 is + * the normal native speed supported by the specific voice. 2.0 is twice as + * fast, and 0.5 is half as fast. If unset(0.0), defaults to the native 1.0 + * speed. Any other values < 0.25 or > 4.0 will return an error. + * @type float $pitch + * Optional. Input only. Speaking pitch, in the range [-20.0, 20.0]. 20 means + * increase 20 semitones from the original pitch. -20 means decrease 20 + * semitones from the original pitch. + * @type float $volume_gain_db + * Optional. Input only. Volume gain (in dB) of the normal native volume + * supported by the specific voice, in the range [-96.0, 16.0]. If unset, or + * set to a value of 0.0 (dB), will play at normal native signal amplitude. A + * value of -6.0 (dB) will play at approximately half the amplitude of the + * normal native signal amplitude. A value of +6.0 (dB) will play at + * approximately twice the amplitude of the normal native signal amplitude. + * Strongly recommend not to exceed +10 (dB) as there's usually no effective + * increase in loudness for any value greater than that. + * @type int $sample_rate_hertz + * Optional. The synthesis sample rate (in hertz) for this audio. When this is + * specified in SynthesizeSpeechRequest, if this is different from the voice's + * natural sample rate, then the synthesizer will honor this request by + * converting to the desired sample rate (which might result in worse audio + * quality), unless the specified sample rate is not supported for the + * encoding chosen, in which case it will fail the request and return + * [google.rpc.Code.INVALID_ARGUMENT][google.rpc.Code.INVALID_ARGUMENT]. + * @type array|\Google\Protobuf\Internal\RepeatedField $effects_profile_id + * Optional. Input only. An identifier which selects 'audio effects' profiles + * that are applied on (post synthesized) text to speech. Effects are applied + * on top of each other in the order they are given. See + * [audio + * profiles](https://cloud.google.com/text-to-speech/docs/audio-profiles) for + * current supported profile ids. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Texttospeech\V1\CloudTts::initOnce(); + parent::__construct($data); + } + + /** + * Required. The format of the audio byte stream. + * + * Generated from protobuf field .google.cloud.texttospeech.v1.AudioEncoding audio_encoding = 1 [(.google.api.field_behavior) = REQUIRED]; + * @return int + */ + public function getAudioEncoding() + { + return $this->audio_encoding; + } + + /** + * Required. The format of the audio byte stream. + * + * Generated from protobuf field .google.cloud.texttospeech.v1.AudioEncoding audio_encoding = 1 [(.google.api.field_behavior) = REQUIRED]; + * @param int $var + * @return $this + */ + public function setAudioEncoding($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\TextToSpeech\V1\AudioEncoding::class); + $this->audio_encoding = $var; + + return $this; + } + + /** + * Optional. Input only. Speaking rate/speed, in the range [0.25, 4.0]. 1.0 is + * the normal native speed supported by the specific voice. 2.0 is twice as + * fast, and 0.5 is half as fast. If unset(0.0), defaults to the native 1.0 + * speed. Any other values < 0.25 or > 4.0 will return an error. + * + * Generated from protobuf field double speaking_rate = 2 [(.google.api.field_behavior) = INPUT_ONLY, (.google.api.field_behavior) = OPTIONAL]; + * @return float + */ + public function getSpeakingRate() + { + return $this->speaking_rate; + } + + /** + * Optional. Input only. Speaking rate/speed, in the range [0.25, 4.0]. 1.0 is + * the normal native speed supported by the specific voice. 2.0 is twice as + * fast, and 0.5 is half as fast. If unset(0.0), defaults to the native 1.0 + * speed. Any other values < 0.25 or > 4.0 will return an error. + * + * Generated from protobuf field double speaking_rate = 2 [(.google.api.field_behavior) = INPUT_ONLY, (.google.api.field_behavior) = OPTIONAL]; + * @param float $var + * @return $this + */ + public function setSpeakingRate($var) + { + GPBUtil::checkDouble($var); + $this->speaking_rate = $var; + + return $this; + } + + /** + * Optional. Input only. Speaking pitch, in the range [-20.0, 20.0]. 20 means + * increase 20 semitones from the original pitch. -20 means decrease 20 + * semitones from the original pitch. + * + * Generated from protobuf field double pitch = 3 [(.google.api.field_behavior) = INPUT_ONLY, (.google.api.field_behavior) = OPTIONAL]; + * @return float + */ + public function getPitch() + { + return $this->pitch; + } + + /** + * Optional. Input only. Speaking pitch, in the range [-20.0, 20.0]. 20 means + * increase 20 semitones from the original pitch. -20 means decrease 20 + * semitones from the original pitch. + * + * Generated from protobuf field double pitch = 3 [(.google.api.field_behavior) = INPUT_ONLY, (.google.api.field_behavior) = OPTIONAL]; + * @param float $var + * @return $this + */ + public function setPitch($var) + { + GPBUtil::checkDouble($var); + $this->pitch = $var; + + return $this; + } + + /** + * Optional. Input only. Volume gain (in dB) of the normal native volume + * supported by the specific voice, in the range [-96.0, 16.0]. If unset, or + * set to a value of 0.0 (dB), will play at normal native signal amplitude. A + * value of -6.0 (dB) will play at approximately half the amplitude of the + * normal native signal amplitude. A value of +6.0 (dB) will play at + * approximately twice the amplitude of the normal native signal amplitude. + * Strongly recommend not to exceed +10 (dB) as there's usually no effective + * increase in loudness for any value greater than that. + * + * Generated from protobuf field double volume_gain_db = 4 [(.google.api.field_behavior) = INPUT_ONLY, (.google.api.field_behavior) = OPTIONAL]; + * @return float + */ + public function getVolumeGainDb() + { + return $this->volume_gain_db; + } + + /** + * Optional. Input only. Volume gain (in dB) of the normal native volume + * supported by the specific voice, in the range [-96.0, 16.0]. If unset, or + * set to a value of 0.0 (dB), will play at normal native signal amplitude. A + * value of -6.0 (dB) will play at approximately half the amplitude of the + * normal native signal amplitude. A value of +6.0 (dB) will play at + * approximately twice the amplitude of the normal native signal amplitude. + * Strongly recommend not to exceed +10 (dB) as there's usually no effective + * increase in loudness for any value greater than that. + * + * Generated from protobuf field double volume_gain_db = 4 [(.google.api.field_behavior) = INPUT_ONLY, (.google.api.field_behavior) = OPTIONAL]; + * @param float $var + * @return $this + */ + public function setVolumeGainDb($var) + { + GPBUtil::checkDouble($var); + $this->volume_gain_db = $var; + + return $this; + } + + /** + * Optional. The synthesis sample rate (in hertz) for this audio. When this is + * specified in SynthesizeSpeechRequest, if this is different from the voice's + * natural sample rate, then the synthesizer will honor this request by + * converting to the desired sample rate (which might result in worse audio + * quality), unless the specified sample rate is not supported for the + * encoding chosen, in which case it will fail the request and return + * [google.rpc.Code.INVALID_ARGUMENT][google.rpc.Code.INVALID_ARGUMENT]. + * + * Generated from protobuf field int32 sample_rate_hertz = 5 [(.google.api.field_behavior) = OPTIONAL]; + * @return int + */ + public function getSampleRateHertz() + { + return $this->sample_rate_hertz; + } + + /** + * Optional. The synthesis sample rate (in hertz) for this audio. When this is + * specified in SynthesizeSpeechRequest, if this is different from the voice's + * natural sample rate, then the synthesizer will honor this request by + * converting to the desired sample rate (which might result in worse audio + * quality), unless the specified sample rate is not supported for the + * encoding chosen, in which case it will fail the request and return + * [google.rpc.Code.INVALID_ARGUMENT][google.rpc.Code.INVALID_ARGUMENT]. + * + * Generated from protobuf field int32 sample_rate_hertz = 5 [(.google.api.field_behavior) = OPTIONAL]; + * @param int $var + * @return $this + */ + public function setSampleRateHertz($var) + { + GPBUtil::checkInt32($var); + $this->sample_rate_hertz = $var; + + return $this; + } + + /** + * Optional. Input only. An identifier which selects 'audio effects' profiles + * that are applied on (post synthesized) text to speech. Effects are applied + * on top of each other in the order they are given. See + * [audio + * profiles](https://cloud.google.com/text-to-speech/docs/audio-profiles) for + * current supported profile ids. + * + * Generated from protobuf field repeated string effects_profile_id = 6 [(.google.api.field_behavior) = INPUT_ONLY, (.google.api.field_behavior) = OPTIONAL]; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getEffectsProfileId() + { + return $this->effects_profile_id; + } + + /** + * Optional. Input only. An identifier which selects 'audio effects' profiles + * that are applied on (post synthesized) text to speech. Effects are applied + * on top of each other in the order they are given. See + * [audio + * profiles](https://cloud.google.com/text-to-speech/docs/audio-profiles) for + * current supported profile ids. + * + * Generated from protobuf field repeated string effects_profile_id = 6 [(.google.api.field_behavior) = INPUT_ONLY, (.google.api.field_behavior) = OPTIONAL]; + * @param array|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setEffectsProfileId($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); + $this->effects_profile_id = $arr; + + return $this; + } + +} + diff --git a/owl-bot-staging/TextToSpeech/v1/proto/src/Google/Cloud/TextToSpeech/V1/AudioEncoding.php b/owl-bot-staging/TextToSpeech/v1/proto/src/Google/Cloud/TextToSpeech/V1/AudioEncoding.php new file mode 100644 index 000000000000..1a3ee8800a95 --- /dev/null +++ b/owl-bot-staging/TextToSpeech/v1/proto/src/Google/Cloud/TextToSpeech/V1/AudioEncoding.php @@ -0,0 +1,90 @@ +google.cloud.texttospeech.v1.AudioEncoding + */ +class AudioEncoding +{ + /** + * Not specified. Will return result + * [google.rpc.Code.INVALID_ARGUMENT][google.rpc.Code.INVALID_ARGUMENT]. + * + * Generated from protobuf enum AUDIO_ENCODING_UNSPECIFIED = 0; + */ + const AUDIO_ENCODING_UNSPECIFIED = 0; + /** + * Uncompressed 16-bit signed little-endian samples (Linear PCM). + * Audio content returned as LINEAR16 also contains a WAV header. + * + * Generated from protobuf enum LINEAR16 = 1; + */ + const LINEAR16 = 1; + /** + * MP3 audio at 32kbps. + * + * Generated from protobuf enum MP3 = 2; + */ + const MP3 = 2; + /** + * Opus encoded audio wrapped in an ogg container. The result will be a + * file which can be played natively on Android, and in browsers (at least + * Chrome and Firefox). The quality of the encoding is considerably higher + * than MP3 while using approximately the same bitrate. + * + * Generated from protobuf enum OGG_OPUS = 3; + */ + const OGG_OPUS = 3; + /** + * 8-bit samples that compand 14-bit audio samples using G.711 PCMU/mu-law. + * Audio content returned as MULAW also contains a WAV header. + * + * Generated from protobuf enum MULAW = 5; + */ + const MULAW = 5; + /** + * 8-bit samples that compand 14-bit audio samples using G.711 PCMU/A-law. + * Audio content returned as ALAW also contains a WAV header. + * + * Generated from protobuf enum ALAW = 6; + */ + const ALAW = 6; + + private static $valueToName = [ + self::AUDIO_ENCODING_UNSPECIFIED => 'AUDIO_ENCODING_UNSPECIFIED', + self::LINEAR16 => 'LINEAR16', + self::MP3 => 'MP3', + self::OGG_OPUS => 'OGG_OPUS', + self::MULAW => 'MULAW', + self::ALAW => 'ALAW', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + diff --git a/owl-bot-staging/TextToSpeech/v1/proto/src/Google/Cloud/TextToSpeech/V1/CustomPronunciationParams.php b/owl-bot-staging/TextToSpeech/v1/proto/src/Google/Cloud/TextToSpeech/V1/CustomPronunciationParams.php new file mode 100644 index 000000000000..2a2283ce0dea --- /dev/null +++ b/owl-bot-staging/TextToSpeech/v1/proto/src/Google/Cloud/TextToSpeech/V1/CustomPronunciationParams.php @@ -0,0 +1,177 @@ +google.cloud.texttospeech.v1.CustomPronunciationParams + */ +class CustomPronunciationParams extends \Google\Protobuf\Internal\Message +{ + /** + * The phrase to which the customization will be applied. + * The phrase can be multiple words (in the case of proper nouns etc), but + * should not span to a whole sentence. + * + * Generated from protobuf field optional string phrase = 1; + */ + protected $phrase = null; + /** + * The phonetic encoding of the phrase. + * + * Generated from protobuf field optional .google.cloud.texttospeech.v1.CustomPronunciationParams.PhoneticEncoding phonetic_encoding = 2; + */ + protected $phonetic_encoding = null; + /** + * The pronunciation of the phrase. This must be in the phonetic encoding + * specified above. + * + * Generated from protobuf field optional string pronunciation = 3; + */ + protected $pronunciation = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $phrase + * The phrase to which the customization will be applied. + * The phrase can be multiple words (in the case of proper nouns etc), but + * should not span to a whole sentence. + * @type int $phonetic_encoding + * The phonetic encoding of the phrase. + * @type string $pronunciation + * The pronunciation of the phrase. This must be in the phonetic encoding + * specified above. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Texttospeech\V1\CloudTts::initOnce(); + parent::__construct($data); + } + + /** + * The phrase to which the customization will be applied. + * The phrase can be multiple words (in the case of proper nouns etc), but + * should not span to a whole sentence. + * + * Generated from protobuf field optional string phrase = 1; + * @return string + */ + public function getPhrase() + { + return isset($this->phrase) ? $this->phrase : ''; + } + + public function hasPhrase() + { + return isset($this->phrase); + } + + public function clearPhrase() + { + unset($this->phrase); + } + + /** + * The phrase to which the customization will be applied. + * The phrase can be multiple words (in the case of proper nouns etc), but + * should not span to a whole sentence. + * + * Generated from protobuf field optional string phrase = 1; + * @param string $var + * @return $this + */ + public function setPhrase($var) + { + GPBUtil::checkString($var, True); + $this->phrase = $var; + + return $this; + } + + /** + * The phonetic encoding of the phrase. + * + * Generated from protobuf field optional .google.cloud.texttospeech.v1.CustomPronunciationParams.PhoneticEncoding phonetic_encoding = 2; + * @return int + */ + public function getPhoneticEncoding() + { + return isset($this->phonetic_encoding) ? $this->phonetic_encoding : 0; + } + + public function hasPhoneticEncoding() + { + return isset($this->phonetic_encoding); + } + + public function clearPhoneticEncoding() + { + unset($this->phonetic_encoding); + } + + /** + * The phonetic encoding of the phrase. + * + * Generated from protobuf field optional .google.cloud.texttospeech.v1.CustomPronunciationParams.PhoneticEncoding phonetic_encoding = 2; + * @param int $var + * @return $this + */ + public function setPhoneticEncoding($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\TextToSpeech\V1\CustomPronunciationParams\PhoneticEncoding::class); + $this->phonetic_encoding = $var; + + return $this; + } + + /** + * The pronunciation of the phrase. This must be in the phonetic encoding + * specified above. + * + * Generated from protobuf field optional string pronunciation = 3; + * @return string + */ + public function getPronunciation() + { + return isset($this->pronunciation) ? $this->pronunciation : ''; + } + + public function hasPronunciation() + { + return isset($this->pronunciation); + } + + public function clearPronunciation() + { + unset($this->pronunciation); + } + + /** + * The pronunciation of the phrase. This must be in the phonetic encoding + * specified above. + * + * Generated from protobuf field optional string pronunciation = 3; + * @param string $var + * @return $this + */ + public function setPronunciation($var) + { + GPBUtil::checkString($var, True); + $this->pronunciation = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/TextToSpeech/v1/proto/src/Google/Cloud/TextToSpeech/V1/CustomPronunciationParams/PhoneticEncoding.php b/owl-bot-staging/TextToSpeech/v1/proto/src/Google/Cloud/TextToSpeech/V1/CustomPronunciationParams/PhoneticEncoding.php new file mode 100644 index 000000000000..d7631a1efee4 --- /dev/null +++ b/owl-bot-staging/TextToSpeech/v1/proto/src/Google/Cloud/TextToSpeech/V1/CustomPronunciationParams/PhoneticEncoding.php @@ -0,0 +1,66 @@ +google.cloud.texttospeech.v1.CustomPronunciationParams.PhoneticEncoding + */ +class PhoneticEncoding +{ + /** + * Not specified. + * + * Generated from protobuf enum PHONETIC_ENCODING_UNSPECIFIED = 0; + */ + const PHONETIC_ENCODING_UNSPECIFIED = 0; + /** + * IPA. (e.g. apple -> ˈæpÉ™l ) + * https://en.wikipedia.org/wiki/International_Phonetic_Alphabet + * + * Generated from protobuf enum PHONETIC_ENCODING_IPA = 1; + */ + const PHONETIC_ENCODING_IPA = 1; + /** + * X-SAMPA (e.g. apple -> "{p@l" ) + * https://en.wikipedia.org/wiki/X-SAMPA + * + * Generated from protobuf enum PHONETIC_ENCODING_X_SAMPA = 2; + */ + const PHONETIC_ENCODING_X_SAMPA = 2; + + private static $valueToName = [ + self::PHONETIC_ENCODING_UNSPECIFIED => 'PHONETIC_ENCODING_UNSPECIFIED', + self::PHONETIC_ENCODING_IPA => 'PHONETIC_ENCODING_IPA', + self::PHONETIC_ENCODING_X_SAMPA => 'PHONETIC_ENCODING_X_SAMPA', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(PhoneticEncoding::class, \Google\Cloud\TextToSpeech\V1\CustomPronunciationParams_PhoneticEncoding::class); + diff --git a/owl-bot-staging/TextToSpeech/v1/proto/src/Google/Cloud/TextToSpeech/V1/CustomPronunciations.php b/owl-bot-staging/TextToSpeech/v1/proto/src/Google/Cloud/TextToSpeech/V1/CustomPronunciations.php new file mode 100644 index 000000000000..fffc75dae4d1 --- /dev/null +++ b/owl-bot-staging/TextToSpeech/v1/proto/src/Google/Cloud/TextToSpeech/V1/CustomPronunciations.php @@ -0,0 +1,67 @@ +google.cloud.texttospeech.v1.CustomPronunciations + */ +class CustomPronunciations extends \Google\Protobuf\Internal\Message +{ + /** + * The pronunciation customizations to be applied. + * + * Generated from protobuf field repeated .google.cloud.texttospeech.v1.CustomPronunciationParams pronunciations = 1; + */ + private $pronunciations; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array<\Google\Cloud\TextToSpeech\V1\CustomPronunciationParams>|\Google\Protobuf\Internal\RepeatedField $pronunciations + * The pronunciation customizations to be applied. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Texttospeech\V1\CloudTts::initOnce(); + parent::__construct($data); + } + + /** + * The pronunciation customizations to be applied. + * + * Generated from protobuf field repeated .google.cloud.texttospeech.v1.CustomPronunciationParams pronunciations = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getPronunciations() + { + return $this->pronunciations; + } + + /** + * The pronunciation customizations to be applied. + * + * Generated from protobuf field repeated .google.cloud.texttospeech.v1.CustomPronunciationParams pronunciations = 1; + * @param array<\Google\Cloud\TextToSpeech\V1\CustomPronunciationParams>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setPronunciations($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\TextToSpeech\V1\CustomPronunciationParams::class); + $this->pronunciations = $arr; + + return $this; + } + +} + diff --git a/owl-bot-staging/TextToSpeech/v1/proto/src/Google/Cloud/TextToSpeech/V1/CustomVoiceParams.php b/owl-bot-staging/TextToSpeech/v1/proto/src/Google/Cloud/TextToSpeech/V1/CustomVoiceParams.php new file mode 100644 index 000000000000..bc208aa890c7 --- /dev/null +++ b/owl-bot-staging/TextToSpeech/v1/proto/src/Google/Cloud/TextToSpeech/V1/CustomVoiceParams.php @@ -0,0 +1,106 @@ +google.cloud.texttospeech.v1.CustomVoiceParams + */ +class CustomVoiceParams extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The name of the AutoML model that synthesizes the custom voice. + * + * Generated from protobuf field string model = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $model = ''; + /** + * Optional. Deprecated. The usage of the synthesized audio to be reported. + * + * Generated from protobuf field .google.cloud.texttospeech.v1.CustomVoiceParams.ReportedUsage reported_usage = 3 [deprecated = true, (.google.api.field_behavior) = OPTIONAL]; + * @deprecated + */ + protected $reported_usage = 0; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $model + * Required. The name of the AutoML model that synthesizes the custom voice. + * @type int $reported_usage + * Optional. Deprecated. The usage of the synthesized audio to be reported. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Texttospeech\V1\CloudTts::initOnce(); + parent::__construct($data); + } + + /** + * Required. The name of the AutoML model that synthesizes the custom voice. + * + * Generated from protobuf field string model = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getModel() + { + return $this->model; + } + + /** + * Required. The name of the AutoML model that synthesizes the custom voice. + * + * Generated from protobuf field string model = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setModel($var) + { + GPBUtil::checkString($var, True); + $this->model = $var; + + return $this; + } + + /** + * Optional. Deprecated. The usage of the synthesized audio to be reported. + * + * Generated from protobuf field .google.cloud.texttospeech.v1.CustomVoiceParams.ReportedUsage reported_usage = 3 [deprecated = true, (.google.api.field_behavior) = OPTIONAL]; + * @return int + * @deprecated + */ + public function getReportedUsage() + { + @trigger_error('reported_usage is deprecated.', E_USER_DEPRECATED); + return $this->reported_usage; + } + + /** + * Optional. Deprecated. The usage of the synthesized audio to be reported. + * + * Generated from protobuf field .google.cloud.texttospeech.v1.CustomVoiceParams.ReportedUsage reported_usage = 3 [deprecated = true, (.google.api.field_behavior) = OPTIONAL]; + * @param int $var + * @return $this + * @deprecated + */ + public function setReportedUsage($var) + { + @trigger_error('reported_usage is deprecated.', E_USER_DEPRECATED); + GPBUtil::checkEnum($var, \Google\Cloud\TextToSpeech\V1\CustomVoiceParams\ReportedUsage::class); + $this->reported_usage = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/TextToSpeech/v1/proto/src/Google/Cloud/TextToSpeech/V1/CustomVoiceParams/ReportedUsage.php b/owl-bot-staging/TextToSpeech/v1/proto/src/Google/Cloud/TextToSpeech/V1/CustomVoiceParams/ReportedUsage.php new file mode 100644 index 000000000000..6e8d93d63f04 --- /dev/null +++ b/owl-bot-staging/TextToSpeech/v1/proto/src/Google/Cloud/TextToSpeech/V1/CustomVoiceParams/ReportedUsage.php @@ -0,0 +1,68 @@ +google.cloud.texttospeech.v1.CustomVoiceParams.ReportedUsage + */ +class ReportedUsage +{ + /** + * Request with reported usage unspecified will be rejected. + * + * Generated from protobuf enum REPORTED_USAGE_UNSPECIFIED = 0; + */ + const REPORTED_USAGE_UNSPECIFIED = 0; + /** + * For scenarios where the synthesized audio is not downloadable and can + * only be used once. For example, real-time request in IVR system. + * + * Generated from protobuf enum REALTIME = 1; + */ + const REALTIME = 1; + /** + * For scenarios where the synthesized audio is downloadable and can be + * reused. For example, the synthesized audio is downloaded, stored in + * customer service system and played repeatedly. + * + * Generated from protobuf enum OFFLINE = 2; + */ + const OFFLINE = 2; + + private static $valueToName = [ + self::REPORTED_USAGE_UNSPECIFIED => 'REPORTED_USAGE_UNSPECIFIED', + self::REALTIME => 'REALTIME', + self::OFFLINE => 'OFFLINE', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(ReportedUsage::class, \Google\Cloud\TextToSpeech\V1\CustomVoiceParams_ReportedUsage::class); + diff --git a/owl-bot-staging/TextToSpeech/v1/proto/src/Google/Cloud/TextToSpeech/V1/ListVoicesRequest.php b/owl-bot-staging/TextToSpeech/v1/proto/src/Google/Cloud/TextToSpeech/V1/ListVoicesRequest.php new file mode 100644 index 000000000000..a1f5971ee7a9 --- /dev/null +++ b/owl-bot-staging/TextToSpeech/v1/proto/src/Google/Cloud/TextToSpeech/V1/ListVoicesRequest.php @@ -0,0 +1,115 @@ +google.cloud.texttospeech.v1.ListVoicesRequest + */ +class ListVoicesRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Optional. Recommended. + * [BCP-47](https://www.rfc-editor.org/rfc/bcp/bcp47.txt) language tag. + * If not specified, the API will return all supported voices. + * If specified, the ListVoices call will only return voices that can be used + * to synthesize this language_code. For example, if you specify `"en-NZ"`, + * all `"en-NZ"` voices will be returned. If you specify `"no"`, both + * `"no-\*"` (Norwegian) and `"nb-\*"` (Norwegian Bokmal) voices will be + * returned. + * + * Generated from protobuf field string language_code = 1 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $language_code = ''; + + /** + * @param string $languageCode Optional. Recommended. + * [BCP-47](https://www.rfc-editor.org/rfc/bcp/bcp47.txt) language tag. + * If not specified, the API will return all supported voices. + * If specified, the ListVoices call will only return voices that can be used + * to synthesize this language_code. For example, if you specify `"en-NZ"`, + * all `"en-NZ"` voices will be returned. If you specify `"no"`, both + * `"no-\*"` (Norwegian) and `"nb-\*"` (Norwegian Bokmal) voices will be + * returned. + * + * @return \Google\Cloud\TextToSpeech\V1\ListVoicesRequest + * + * @experimental + */ + public static function build(string $languageCode): self + { + return (new self()) + ->setLanguageCode($languageCode); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $language_code + * Optional. Recommended. + * [BCP-47](https://www.rfc-editor.org/rfc/bcp/bcp47.txt) language tag. + * If not specified, the API will return all supported voices. + * If specified, the ListVoices call will only return voices that can be used + * to synthesize this language_code. For example, if you specify `"en-NZ"`, + * all `"en-NZ"` voices will be returned. If you specify `"no"`, both + * `"no-\*"` (Norwegian) and `"nb-\*"` (Norwegian Bokmal) voices will be + * returned. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Texttospeech\V1\CloudTts::initOnce(); + parent::__construct($data); + } + + /** + * Optional. Recommended. + * [BCP-47](https://www.rfc-editor.org/rfc/bcp/bcp47.txt) language tag. + * If not specified, the API will return all supported voices. + * If specified, the ListVoices call will only return voices that can be used + * to synthesize this language_code. For example, if you specify `"en-NZ"`, + * all `"en-NZ"` voices will be returned. If you specify `"no"`, both + * `"no-\*"` (Norwegian) and `"nb-\*"` (Norwegian Bokmal) voices will be + * returned. + * + * Generated from protobuf field string language_code = 1 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getLanguageCode() + { + return $this->language_code; + } + + /** + * Optional. Recommended. + * [BCP-47](https://www.rfc-editor.org/rfc/bcp/bcp47.txt) language tag. + * If not specified, the API will return all supported voices. + * If specified, the ListVoices call will only return voices that can be used + * to synthesize this language_code. For example, if you specify `"en-NZ"`, + * all `"en-NZ"` voices will be returned. If you specify `"no"`, both + * `"no-\*"` (Norwegian) and `"nb-\*"` (Norwegian Bokmal) voices will be + * returned. + * + * Generated from protobuf field string language_code = 1 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setLanguageCode($var) + { + GPBUtil::checkString($var, True); + $this->language_code = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/TextToSpeech/v1/proto/src/Google/Cloud/TextToSpeech/V1/ListVoicesResponse.php b/owl-bot-staging/TextToSpeech/v1/proto/src/Google/Cloud/TextToSpeech/V1/ListVoicesResponse.php new file mode 100644 index 000000000000..d28b7ae0e154 --- /dev/null +++ b/owl-bot-staging/TextToSpeech/v1/proto/src/Google/Cloud/TextToSpeech/V1/ListVoicesResponse.php @@ -0,0 +1,67 @@ +google.cloud.texttospeech.v1.ListVoicesResponse + */ +class ListVoicesResponse extends \Google\Protobuf\Internal\Message +{ + /** + * The list of voices. + * + * Generated from protobuf field repeated .google.cloud.texttospeech.v1.Voice voices = 1; + */ + private $voices; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array<\Google\Cloud\TextToSpeech\V1\Voice>|\Google\Protobuf\Internal\RepeatedField $voices + * The list of voices. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Texttospeech\V1\CloudTts::initOnce(); + parent::__construct($data); + } + + /** + * The list of voices. + * + * Generated from protobuf field repeated .google.cloud.texttospeech.v1.Voice voices = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getVoices() + { + return $this->voices; + } + + /** + * The list of voices. + * + * Generated from protobuf field repeated .google.cloud.texttospeech.v1.Voice voices = 1; + * @param array<\Google\Cloud\TextToSpeech\V1\Voice>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setVoices($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\TextToSpeech\V1\Voice::class); + $this->voices = $arr; + + return $this; + } + +} + diff --git a/owl-bot-staging/TextToSpeech/v1/proto/src/Google/Cloud/TextToSpeech/V1/SsmlVoiceGender.php b/owl-bot-staging/TextToSpeech/v1/proto/src/Google/Cloud/TextToSpeech/V1/SsmlVoiceGender.php new file mode 100644 index 000000000000..ca9b5bfd29a5 --- /dev/null +++ b/owl-bot-staging/TextToSpeech/v1/proto/src/Google/Cloud/TextToSpeech/V1/SsmlVoiceGender.php @@ -0,0 +1,73 @@ +google.cloud.texttospeech.v1.SsmlVoiceGender + */ +class SsmlVoiceGender +{ + /** + * An unspecified gender. + * In VoiceSelectionParams, this means that the client doesn't care which + * gender the selected voice will have. In the Voice field of + * ListVoicesResponse, this may mean that the voice doesn't fit any of the + * other categories in this enum, or that the gender of the voice isn't known. + * + * Generated from protobuf enum SSML_VOICE_GENDER_UNSPECIFIED = 0; + */ + const SSML_VOICE_GENDER_UNSPECIFIED = 0; + /** + * A male voice. + * + * Generated from protobuf enum MALE = 1; + */ + const MALE = 1; + /** + * A female voice. + * + * Generated from protobuf enum FEMALE = 2; + */ + const FEMALE = 2; + /** + * A gender-neutral voice. This voice is not yet supported. + * + * Generated from protobuf enum NEUTRAL = 3; + */ + const NEUTRAL = 3; + + private static $valueToName = [ + self::SSML_VOICE_GENDER_UNSPECIFIED => 'SSML_VOICE_GENDER_UNSPECIFIED', + self::MALE => 'MALE', + self::FEMALE => 'FEMALE', + self::NEUTRAL => 'NEUTRAL', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + diff --git a/owl-bot-staging/TextToSpeech/v1/proto/src/Google/Cloud/TextToSpeech/V1/StreamingSynthesisInput.php b/owl-bot-staging/TextToSpeech/v1/proto/src/Google/Cloud/TextToSpeech/V1/StreamingSynthesisInput.php new file mode 100644 index 000000000000..c533cb8c4c2a --- /dev/null +++ b/owl-bot-staging/TextToSpeech/v1/proto/src/Google/Cloud/TextToSpeech/V1/StreamingSynthesisInput.php @@ -0,0 +1,84 @@ +google.cloud.texttospeech.v1.StreamingSynthesisInput + */ +class StreamingSynthesisInput extends \Google\Protobuf\Internal\Message +{ + protected $input_source; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $text + * The raw text to be synthesized. It is recommended that each input + * contains complete, terminating sentences, as this will likely result in + * better prosody in the output audio. That being said, users are free to + * input text however they please. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Texttospeech\V1\CloudTts::initOnce(); + parent::__construct($data); + } + + /** + * The raw text to be synthesized. It is recommended that each input + * contains complete, terminating sentences, as this will likely result in + * better prosody in the output audio. That being said, users are free to + * input text however they please. + * + * Generated from protobuf field string text = 1; + * @return string + */ + public function getText() + { + return $this->readOneof(1); + } + + public function hasText() + { + return $this->hasOneof(1); + } + + /** + * The raw text to be synthesized. It is recommended that each input + * contains complete, terminating sentences, as this will likely result in + * better prosody in the output audio. That being said, users are free to + * input text however they please. + * + * Generated from protobuf field string text = 1; + * @param string $var + * @return $this + */ + public function setText($var) + { + GPBUtil::checkString($var, True); + $this->writeOneof(1, $var); + + return $this; + } + + /** + * @return string + */ + public function getInputSource() + { + return $this->whichOneof("input_source"); + } + +} + diff --git a/owl-bot-staging/TextToSpeech/v1/proto/src/Google/Cloud/TextToSpeech/V1/StreamingSynthesizeConfig.php b/owl-bot-staging/TextToSpeech/v1/proto/src/Google/Cloud/TextToSpeech/V1/StreamingSynthesizeConfig.php new file mode 100644 index 000000000000..85db9a292704 --- /dev/null +++ b/owl-bot-staging/TextToSpeech/v1/proto/src/Google/Cloud/TextToSpeech/V1/StreamingSynthesizeConfig.php @@ -0,0 +1,77 @@ +google.cloud.texttospeech.v1.StreamingSynthesizeConfig + */ +class StreamingSynthesizeConfig extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The desired voice of the synthesized audio. + * + * Generated from protobuf field .google.cloud.texttospeech.v1.VoiceSelectionParams voice = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $voice = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\TextToSpeech\V1\VoiceSelectionParams $voice + * Required. The desired voice of the synthesized audio. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Texttospeech\V1\CloudTts::initOnce(); + parent::__construct($data); + } + + /** + * Required. The desired voice of the synthesized audio. + * + * Generated from protobuf field .google.cloud.texttospeech.v1.VoiceSelectionParams voice = 1 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Cloud\TextToSpeech\V1\VoiceSelectionParams|null + */ + public function getVoice() + { + return $this->voice; + } + + public function hasVoice() + { + return isset($this->voice); + } + + public function clearVoice() + { + unset($this->voice); + } + + /** + * Required. The desired voice of the synthesized audio. + * + * Generated from protobuf field .google.cloud.texttospeech.v1.VoiceSelectionParams voice = 1 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Cloud\TextToSpeech\V1\VoiceSelectionParams $var + * @return $this + */ + public function setVoice($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\TextToSpeech\V1\VoiceSelectionParams::class); + $this->voice = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/TextToSpeech/v1/proto/src/Google/Cloud/TextToSpeech/V1/StreamingSynthesizeRequest.php b/owl-bot-staging/TextToSpeech/v1/proto/src/Google/Cloud/TextToSpeech/V1/StreamingSynthesizeRequest.php new file mode 100644 index 000000000000..a6eed7b698ac --- /dev/null +++ b/owl-bot-staging/TextToSpeech/v1/proto/src/Google/Cloud/TextToSpeech/V1/StreamingSynthesizeRequest.php @@ -0,0 +1,118 @@ +google.cloud.texttospeech.v1.StreamingSynthesizeRequest + */ +class StreamingSynthesizeRequest extends \Google\Protobuf\Internal\Message +{ + protected $streaming_request; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\TextToSpeech\V1\StreamingSynthesizeConfig $streaming_config + * StreamingSynthesizeConfig to be used in this streaming attempt. Only + * specified in the first message sent in a `StreamingSynthesize` call. + * @type \Google\Cloud\TextToSpeech\V1\StreamingSynthesisInput $input + * Input to synthesize. Specified in all messages but the first in a + * `StreamingSynthesize` call. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Texttospeech\V1\CloudTts::initOnce(); + parent::__construct($data); + } + + /** + * StreamingSynthesizeConfig to be used in this streaming attempt. Only + * specified in the first message sent in a `StreamingSynthesize` call. + * + * Generated from protobuf field .google.cloud.texttospeech.v1.StreamingSynthesizeConfig streaming_config = 1; + * @return \Google\Cloud\TextToSpeech\V1\StreamingSynthesizeConfig|null + */ + public function getStreamingConfig() + { + return $this->readOneof(1); + } + + public function hasStreamingConfig() + { + return $this->hasOneof(1); + } + + /** + * StreamingSynthesizeConfig to be used in this streaming attempt. Only + * specified in the first message sent in a `StreamingSynthesize` call. + * + * Generated from protobuf field .google.cloud.texttospeech.v1.StreamingSynthesizeConfig streaming_config = 1; + * @param \Google\Cloud\TextToSpeech\V1\StreamingSynthesizeConfig $var + * @return $this + */ + public function setStreamingConfig($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\TextToSpeech\V1\StreamingSynthesizeConfig::class); + $this->writeOneof(1, $var); + + return $this; + } + + /** + * Input to synthesize. Specified in all messages but the first in a + * `StreamingSynthesize` call. + * + * Generated from protobuf field .google.cloud.texttospeech.v1.StreamingSynthesisInput input = 2; + * @return \Google\Cloud\TextToSpeech\V1\StreamingSynthesisInput|null + */ + public function getInput() + { + return $this->readOneof(2); + } + + public function hasInput() + { + return $this->hasOneof(2); + } + + /** + * Input to synthesize. Specified in all messages but the first in a + * `StreamingSynthesize` call. + * + * Generated from protobuf field .google.cloud.texttospeech.v1.StreamingSynthesisInput input = 2; + * @param \Google\Cloud\TextToSpeech\V1\StreamingSynthesisInput $var + * @return $this + */ + public function setInput($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\TextToSpeech\V1\StreamingSynthesisInput::class); + $this->writeOneof(2, $var); + + return $this; + } + + /** + * @return string + */ + public function getStreamingRequest() + { + return $this->whichOneof("streaming_request"); + } + +} + diff --git a/owl-bot-staging/TextToSpeech/v1/proto/src/Google/Cloud/TextToSpeech/V1/StreamingSynthesizeResponse.php b/owl-bot-staging/TextToSpeech/v1/proto/src/Google/Cloud/TextToSpeech/V1/StreamingSynthesizeResponse.php new file mode 100644 index 000000000000..34eb029802fd --- /dev/null +++ b/owl-bot-staging/TextToSpeech/v1/proto/src/Google/Cloud/TextToSpeech/V1/StreamingSynthesizeResponse.php @@ -0,0 +1,73 @@ +google.cloud.texttospeech.v1.StreamingSynthesizeResponse + */ +class StreamingSynthesizeResponse extends \Google\Protobuf\Internal\Message +{ + /** + * The audio data bytes encoded as specified in the request. This is + * headerless LINEAR16 audio with a sample rate of 24000. + * + * Generated from protobuf field bytes audio_content = 1; + */ + protected $audio_content = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $audio_content + * The audio data bytes encoded as specified in the request. This is + * headerless LINEAR16 audio with a sample rate of 24000. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Texttospeech\V1\CloudTts::initOnce(); + parent::__construct($data); + } + + /** + * The audio data bytes encoded as specified in the request. This is + * headerless LINEAR16 audio with a sample rate of 24000. + * + * Generated from protobuf field bytes audio_content = 1; + * @return string + */ + public function getAudioContent() + { + return $this->audio_content; + } + + /** + * The audio data bytes encoded as specified in the request. This is + * headerless LINEAR16 audio with a sample rate of 24000. + * + * Generated from protobuf field bytes audio_content = 1; + * @param string $var + * @return $this + */ + public function setAudioContent($var) + { + GPBUtil::checkString($var, False); + $this->audio_content = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/TextToSpeech/v1/proto/src/Google/Cloud/TextToSpeech/V1/SynthesisInput.php b/owl-bot-staging/TextToSpeech/v1/proto/src/Google/Cloud/TextToSpeech/V1/SynthesisInput.php new file mode 100644 index 000000000000..08bf3d2edd5a --- /dev/null +++ b/owl-bot-staging/TextToSpeech/v1/proto/src/Google/Cloud/TextToSpeech/V1/SynthesisInput.php @@ -0,0 +1,203 @@ +google.cloud.texttospeech.v1.SynthesisInput + */ +class SynthesisInput extends \Google\Protobuf\Internal\Message +{ + /** + * Optional. The pronunciation customizations to be applied to the input. If + * this is set, the input will be synthesized using the given pronunciation + * customizations. + * The initial support will be for EFIGS (English, French, + * Italian, German, Spanish) languages, as provided in + * VoiceSelectionParams. Journey and Instant Clone voices are + * not supported yet. + * In order to customize the pronunciation of a phrase, there must be an exact + * match of the phrase in the input types. If using SSML, the phrase must not + * be inside a phoneme tag (entirely or partially). + * + * Generated from protobuf field .google.cloud.texttospeech.v1.CustomPronunciations custom_pronunciations = 3 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $custom_pronunciations = null; + protected $input_source; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $text + * The raw text to be synthesized. + * @type string $ssml + * The SSML document to be synthesized. The SSML document must be valid + * and well-formed. Otherwise the RPC will fail and return + * [google.rpc.Code.INVALID_ARGUMENT][google.rpc.Code.INVALID_ARGUMENT]. For + * more information, see + * [SSML](https://cloud.google.com/text-to-speech/docs/ssml). + * @type \Google\Cloud\TextToSpeech\V1\CustomPronunciations $custom_pronunciations + * Optional. The pronunciation customizations to be applied to the input. If + * this is set, the input will be synthesized using the given pronunciation + * customizations. + * The initial support will be for EFIGS (English, French, + * Italian, German, Spanish) languages, as provided in + * VoiceSelectionParams. Journey and Instant Clone voices are + * not supported yet. + * In order to customize the pronunciation of a phrase, there must be an exact + * match of the phrase in the input types. If using SSML, the phrase must not + * be inside a phoneme tag (entirely or partially). + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Texttospeech\V1\CloudTts::initOnce(); + parent::__construct($data); + } + + /** + * The raw text to be synthesized. + * + * Generated from protobuf field string text = 1; + * @return string + */ + public function getText() + { + return $this->readOneof(1); + } + + public function hasText() + { + return $this->hasOneof(1); + } + + /** + * The raw text to be synthesized. + * + * Generated from protobuf field string text = 1; + * @param string $var + * @return $this + */ + public function setText($var) + { + GPBUtil::checkString($var, True); + $this->writeOneof(1, $var); + + return $this; + } + + /** + * The SSML document to be synthesized. The SSML document must be valid + * and well-formed. Otherwise the RPC will fail and return + * [google.rpc.Code.INVALID_ARGUMENT][google.rpc.Code.INVALID_ARGUMENT]. For + * more information, see + * [SSML](https://cloud.google.com/text-to-speech/docs/ssml). + * + * Generated from protobuf field string ssml = 2; + * @return string + */ + public function getSsml() + { + return $this->readOneof(2); + } + + public function hasSsml() + { + return $this->hasOneof(2); + } + + /** + * The SSML document to be synthesized. The SSML document must be valid + * and well-formed. Otherwise the RPC will fail and return + * [google.rpc.Code.INVALID_ARGUMENT][google.rpc.Code.INVALID_ARGUMENT]. For + * more information, see + * [SSML](https://cloud.google.com/text-to-speech/docs/ssml). + * + * Generated from protobuf field string ssml = 2; + * @param string $var + * @return $this + */ + public function setSsml($var) + { + GPBUtil::checkString($var, True); + $this->writeOneof(2, $var); + + return $this; + } + + /** + * Optional. The pronunciation customizations to be applied to the input. If + * this is set, the input will be synthesized using the given pronunciation + * customizations. + * The initial support will be for EFIGS (English, French, + * Italian, German, Spanish) languages, as provided in + * VoiceSelectionParams. Journey and Instant Clone voices are + * not supported yet. + * In order to customize the pronunciation of a phrase, there must be an exact + * match of the phrase in the input types. If using SSML, the phrase must not + * be inside a phoneme tag (entirely or partially). + * + * Generated from protobuf field .google.cloud.texttospeech.v1.CustomPronunciations custom_pronunciations = 3 [(.google.api.field_behavior) = OPTIONAL]; + * @return \Google\Cloud\TextToSpeech\V1\CustomPronunciations|null + */ + public function getCustomPronunciations() + { + return $this->custom_pronunciations; + } + + public function hasCustomPronunciations() + { + return isset($this->custom_pronunciations); + } + + public function clearCustomPronunciations() + { + unset($this->custom_pronunciations); + } + + /** + * Optional. The pronunciation customizations to be applied to the input. If + * this is set, the input will be synthesized using the given pronunciation + * customizations. + * The initial support will be for EFIGS (English, French, + * Italian, German, Spanish) languages, as provided in + * VoiceSelectionParams. Journey and Instant Clone voices are + * not supported yet. + * In order to customize the pronunciation of a phrase, there must be an exact + * match of the phrase in the input types. If using SSML, the phrase must not + * be inside a phoneme tag (entirely or partially). + * + * Generated from protobuf field .google.cloud.texttospeech.v1.CustomPronunciations custom_pronunciations = 3 [(.google.api.field_behavior) = OPTIONAL]; + * @param \Google\Cloud\TextToSpeech\V1\CustomPronunciations $var + * @return $this + */ + public function setCustomPronunciations($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\TextToSpeech\V1\CustomPronunciations::class); + $this->custom_pronunciations = $var; + + return $this; + } + + /** + * @return string + */ + public function getInputSource() + { + return $this->whichOneof("input_source"); + } + +} + diff --git a/owl-bot-staging/TextToSpeech/v1/proto/src/Google/Cloud/TextToSpeech/V1/SynthesizeLongAudioMetadata.php b/owl-bot-staging/TextToSpeech/v1/proto/src/Google/Cloud/TextToSpeech/V1/SynthesizeLongAudioMetadata.php new file mode 100644 index 000000000000..ab9407b4e614 --- /dev/null +++ b/owl-bot-staging/TextToSpeech/v1/proto/src/Google/Cloud/TextToSpeech/V1/SynthesizeLongAudioMetadata.php @@ -0,0 +1,162 @@ +google.cloud.texttospeech.v1.SynthesizeLongAudioMetadata + */ +class SynthesizeLongAudioMetadata extends \Google\Protobuf\Internal\Message +{ + /** + * Time when the request was received. + * + * Generated from protobuf field .google.protobuf.Timestamp start_time = 1; + */ + protected $start_time = null; + /** + * Deprecated. Do not use. + * + * Generated from protobuf field .google.protobuf.Timestamp last_update_time = 2 [deprecated = true]; + * @deprecated + */ + protected $last_update_time = null; + /** + * The progress of the most recent processing update in percentage, ie. 70.0%. + * + * Generated from protobuf field double progress_percentage = 3; + */ + protected $progress_percentage = 0.0; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Protobuf\Timestamp $start_time + * Time when the request was received. + * @type \Google\Protobuf\Timestamp $last_update_time + * Deprecated. Do not use. + * @type float $progress_percentage + * The progress of the most recent processing update in percentage, ie. 70.0%. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Texttospeech\V1\CloudTtsLrs::initOnce(); + parent::__construct($data); + } + + /** + * Time when the request was received. + * + * Generated from protobuf field .google.protobuf.Timestamp start_time = 1; + * @return \Google\Protobuf\Timestamp|null + */ + public function getStartTime() + { + return $this->start_time; + } + + public function hasStartTime() + { + return isset($this->start_time); + } + + public function clearStartTime() + { + unset($this->start_time); + } + + /** + * Time when the request was received. + * + * Generated from protobuf field .google.protobuf.Timestamp start_time = 1; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setStartTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->start_time = $var; + + return $this; + } + + /** + * Deprecated. Do not use. + * + * Generated from protobuf field .google.protobuf.Timestamp last_update_time = 2 [deprecated = true]; + * @return \Google\Protobuf\Timestamp|null + * @deprecated + */ + public function getLastUpdateTime() + { + @trigger_error('last_update_time is deprecated.', E_USER_DEPRECATED); + return $this->last_update_time; + } + + public function hasLastUpdateTime() + { + @trigger_error('last_update_time is deprecated.', E_USER_DEPRECATED); + return isset($this->last_update_time); + } + + public function clearLastUpdateTime() + { + @trigger_error('last_update_time is deprecated.', E_USER_DEPRECATED); + unset($this->last_update_time); + } + + /** + * Deprecated. Do not use. + * + * Generated from protobuf field .google.protobuf.Timestamp last_update_time = 2 [deprecated = true]; + * @param \Google\Protobuf\Timestamp $var + * @return $this + * @deprecated + */ + public function setLastUpdateTime($var) + { + @trigger_error('last_update_time is deprecated.', E_USER_DEPRECATED); + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->last_update_time = $var; + + return $this; + } + + /** + * The progress of the most recent processing update in percentage, ie. 70.0%. + * + * Generated from protobuf field double progress_percentage = 3; + * @return float + */ + public function getProgressPercentage() + { + return $this->progress_percentage; + } + + /** + * The progress of the most recent processing update in percentage, ie. 70.0%. + * + * Generated from protobuf field double progress_percentage = 3; + * @param float $var + * @return $this + */ + public function setProgressPercentage($var) + { + GPBUtil::checkDouble($var); + $this->progress_percentage = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/TextToSpeech/v1/proto/src/Google/Cloud/TextToSpeech/V1/SynthesizeLongAudioRequest.php b/owl-bot-staging/TextToSpeech/v1/proto/src/Google/Cloud/TextToSpeech/V1/SynthesizeLongAudioRequest.php new file mode 100644 index 000000000000..951eaaae4f4d --- /dev/null +++ b/owl-bot-staging/TextToSpeech/v1/proto/src/Google/Cloud/TextToSpeech/V1/SynthesizeLongAudioRequest.php @@ -0,0 +1,246 @@ +google.cloud.texttospeech.v1.SynthesizeLongAudioRequest + */ +class SynthesizeLongAudioRequest extends \Google\Protobuf\Internal\Message +{ + /** + * The resource states of the request in the form of + * `projects/*/locations/*`. + * + * Generated from protobuf field string parent = 1; + */ + protected $parent = ''; + /** + * Required. The Synthesizer requires either plain text or SSML as input. + * + * Generated from protobuf field .google.cloud.texttospeech.v1.SynthesisInput input = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $input = null; + /** + * Required. The configuration of the synthesized audio. + * + * Generated from protobuf field .google.cloud.texttospeech.v1.AudioConfig audio_config = 3 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $audio_config = null; + /** + * Required. Specifies a Cloud Storage URI for the synthesis results. Must be + * specified in the format: `gs://bucket_name/object_name`, and the bucket + * must already exist. + * + * Generated from protobuf field string output_gcs_uri = 4 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $output_gcs_uri = ''; + /** + * Required. The desired voice of the synthesized audio. + * + * Generated from protobuf field .google.cloud.texttospeech.v1.VoiceSelectionParams voice = 5 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $voice = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $parent + * The resource states of the request in the form of + * `projects/*/locations/*`. + * @type \Google\Cloud\TextToSpeech\V1\SynthesisInput $input + * Required. The Synthesizer requires either plain text or SSML as input. + * @type \Google\Cloud\TextToSpeech\V1\AudioConfig $audio_config + * Required. The configuration of the synthesized audio. + * @type string $output_gcs_uri + * Required. Specifies a Cloud Storage URI for the synthesis results. Must be + * specified in the format: `gs://bucket_name/object_name`, and the bucket + * must already exist. + * @type \Google\Cloud\TextToSpeech\V1\VoiceSelectionParams $voice + * Required. The desired voice of the synthesized audio. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Texttospeech\V1\CloudTtsLrs::initOnce(); + parent::__construct($data); + } + + /** + * The resource states of the request in the form of + * `projects/*/locations/*`. + * + * Generated from protobuf field string parent = 1; + * @return string + */ + public function getParent() + { + return $this->parent; + } + + /** + * The resource states of the request in the form of + * `projects/*/locations/*`. + * + * Generated from protobuf field string parent = 1; + * @param string $var + * @return $this + */ + public function setParent($var) + { + GPBUtil::checkString($var, True); + $this->parent = $var; + + return $this; + } + + /** + * Required. The Synthesizer requires either plain text or SSML as input. + * + * Generated from protobuf field .google.cloud.texttospeech.v1.SynthesisInput input = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Cloud\TextToSpeech\V1\SynthesisInput|null + */ + public function getInput() + { + return $this->input; + } + + public function hasInput() + { + return isset($this->input); + } + + public function clearInput() + { + unset($this->input); + } + + /** + * Required. The Synthesizer requires either plain text or SSML as input. + * + * Generated from protobuf field .google.cloud.texttospeech.v1.SynthesisInput input = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Cloud\TextToSpeech\V1\SynthesisInput $var + * @return $this + */ + public function setInput($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\TextToSpeech\V1\SynthesisInput::class); + $this->input = $var; + + return $this; + } + + /** + * Required. The configuration of the synthesized audio. + * + * Generated from protobuf field .google.cloud.texttospeech.v1.AudioConfig audio_config = 3 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Cloud\TextToSpeech\V1\AudioConfig|null + */ + public function getAudioConfig() + { + return $this->audio_config; + } + + public function hasAudioConfig() + { + return isset($this->audio_config); + } + + public function clearAudioConfig() + { + unset($this->audio_config); + } + + /** + * Required. The configuration of the synthesized audio. + * + * Generated from protobuf field .google.cloud.texttospeech.v1.AudioConfig audio_config = 3 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Cloud\TextToSpeech\V1\AudioConfig $var + * @return $this + */ + public function setAudioConfig($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\TextToSpeech\V1\AudioConfig::class); + $this->audio_config = $var; + + return $this; + } + + /** + * Required. Specifies a Cloud Storage URI for the synthesis results. Must be + * specified in the format: `gs://bucket_name/object_name`, and the bucket + * must already exist. + * + * Generated from protobuf field string output_gcs_uri = 4 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getOutputGcsUri() + { + return $this->output_gcs_uri; + } + + /** + * Required. Specifies a Cloud Storage URI for the synthesis results. Must be + * specified in the format: `gs://bucket_name/object_name`, and the bucket + * must already exist. + * + * Generated from protobuf field string output_gcs_uri = 4 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setOutputGcsUri($var) + { + GPBUtil::checkString($var, True); + $this->output_gcs_uri = $var; + + return $this; + } + + /** + * Required. The desired voice of the synthesized audio. + * + * Generated from protobuf field .google.cloud.texttospeech.v1.VoiceSelectionParams voice = 5 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Cloud\TextToSpeech\V1\VoiceSelectionParams|null + */ + public function getVoice() + { + return $this->voice; + } + + public function hasVoice() + { + return isset($this->voice); + } + + public function clearVoice() + { + unset($this->voice); + } + + /** + * Required. The desired voice of the synthesized audio. + * + * Generated from protobuf field .google.cloud.texttospeech.v1.VoiceSelectionParams voice = 5 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Cloud\TextToSpeech\V1\VoiceSelectionParams $var + * @return $this + */ + public function setVoice($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\TextToSpeech\V1\VoiceSelectionParams::class); + $this->voice = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/TextToSpeech/v1/proto/src/Google/Cloud/TextToSpeech/V1/SynthesizeLongAudioResponse.php b/owl-bot-staging/TextToSpeech/v1/proto/src/Google/Cloud/TextToSpeech/V1/SynthesizeLongAudioResponse.php new file mode 100644 index 000000000000..e1a3d25b4131 --- /dev/null +++ b/owl-bot-staging/TextToSpeech/v1/proto/src/Google/Cloud/TextToSpeech/V1/SynthesizeLongAudioResponse.php @@ -0,0 +1,33 @@ +google.cloud.texttospeech.v1.SynthesizeLongAudioResponse + */ +class SynthesizeLongAudioResponse extends \Google\Protobuf\Internal\Message +{ + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Texttospeech\V1\CloudTtsLrs::initOnce(); + parent::__construct($data); + } + +} + diff --git a/owl-bot-staging/TextToSpeech/v1/proto/src/Google/Cloud/TextToSpeech/V1/SynthesizeSpeechRequest.php b/owl-bot-staging/TextToSpeech/v1/proto/src/Google/Cloud/TextToSpeech/V1/SynthesizeSpeechRequest.php new file mode 100644 index 000000000000..ee0e47f31fe5 --- /dev/null +++ b/owl-bot-staging/TextToSpeech/v1/proto/src/Google/Cloud/TextToSpeech/V1/SynthesizeSpeechRequest.php @@ -0,0 +1,226 @@ +google.cloud.texttospeech.v1.SynthesizeSpeechRequest + */ +class SynthesizeSpeechRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The Synthesizer requires either plain text or SSML as input. + * + * Generated from protobuf field .google.cloud.texttospeech.v1.SynthesisInput input = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $input = null; + /** + * Required. The desired voice of the synthesized audio. + * + * Generated from protobuf field .google.cloud.texttospeech.v1.VoiceSelectionParams voice = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $voice = null; + /** + * Required. The configuration of the synthesized audio. + * + * Generated from protobuf field .google.cloud.texttospeech.v1.AudioConfig audio_config = 3 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $audio_config = null; + /** + * Advanced voice options. + * + * Generated from protobuf field optional .google.cloud.texttospeech.v1.AdvancedVoiceOptions advanced_voice_options = 8; + */ + protected $advanced_voice_options = null; + + /** + * @param \Google\Cloud\TextToSpeech\V1\SynthesisInput $input Required. The Synthesizer requires either plain text or SSML as input. + * @param \Google\Cloud\TextToSpeech\V1\VoiceSelectionParams $voice Required. The desired voice of the synthesized audio. + * @param \Google\Cloud\TextToSpeech\V1\AudioConfig $audioConfig Required. The configuration of the synthesized audio. + * + * @return \Google\Cloud\TextToSpeech\V1\SynthesizeSpeechRequest + * + * @experimental + */ + public static function build(\Google\Cloud\TextToSpeech\V1\SynthesisInput $input, \Google\Cloud\TextToSpeech\V1\VoiceSelectionParams $voice, \Google\Cloud\TextToSpeech\V1\AudioConfig $audioConfig): self + { + return (new self()) + ->setInput($input) + ->setVoice($voice) + ->setAudioConfig($audioConfig); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\TextToSpeech\V1\SynthesisInput $input + * Required. The Synthesizer requires either plain text or SSML as input. + * @type \Google\Cloud\TextToSpeech\V1\VoiceSelectionParams $voice + * Required. The desired voice of the synthesized audio. + * @type \Google\Cloud\TextToSpeech\V1\AudioConfig $audio_config + * Required. The configuration of the synthesized audio. + * @type \Google\Cloud\TextToSpeech\V1\AdvancedVoiceOptions $advanced_voice_options + * Advanced voice options. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Texttospeech\V1\CloudTts::initOnce(); + parent::__construct($data); + } + + /** + * Required. The Synthesizer requires either plain text or SSML as input. + * + * Generated from protobuf field .google.cloud.texttospeech.v1.SynthesisInput input = 1 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Cloud\TextToSpeech\V1\SynthesisInput|null + */ + public function getInput() + { + return $this->input; + } + + public function hasInput() + { + return isset($this->input); + } + + public function clearInput() + { + unset($this->input); + } + + /** + * Required. The Synthesizer requires either plain text or SSML as input. + * + * Generated from protobuf field .google.cloud.texttospeech.v1.SynthesisInput input = 1 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Cloud\TextToSpeech\V1\SynthesisInput $var + * @return $this + */ + public function setInput($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\TextToSpeech\V1\SynthesisInput::class); + $this->input = $var; + + return $this; + } + + /** + * Required. The desired voice of the synthesized audio. + * + * Generated from protobuf field .google.cloud.texttospeech.v1.VoiceSelectionParams voice = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Cloud\TextToSpeech\V1\VoiceSelectionParams|null + */ + public function getVoice() + { + return $this->voice; + } + + public function hasVoice() + { + return isset($this->voice); + } + + public function clearVoice() + { + unset($this->voice); + } + + /** + * Required. The desired voice of the synthesized audio. + * + * Generated from protobuf field .google.cloud.texttospeech.v1.VoiceSelectionParams voice = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Cloud\TextToSpeech\V1\VoiceSelectionParams $var + * @return $this + */ + public function setVoice($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\TextToSpeech\V1\VoiceSelectionParams::class); + $this->voice = $var; + + return $this; + } + + /** + * Required. The configuration of the synthesized audio. + * + * Generated from protobuf field .google.cloud.texttospeech.v1.AudioConfig audio_config = 3 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Cloud\TextToSpeech\V1\AudioConfig|null + */ + public function getAudioConfig() + { + return $this->audio_config; + } + + public function hasAudioConfig() + { + return isset($this->audio_config); + } + + public function clearAudioConfig() + { + unset($this->audio_config); + } + + /** + * Required. The configuration of the synthesized audio. + * + * Generated from protobuf field .google.cloud.texttospeech.v1.AudioConfig audio_config = 3 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Cloud\TextToSpeech\V1\AudioConfig $var + * @return $this + */ + public function setAudioConfig($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\TextToSpeech\V1\AudioConfig::class); + $this->audio_config = $var; + + return $this; + } + + /** + * Advanced voice options. + * + * Generated from protobuf field optional .google.cloud.texttospeech.v1.AdvancedVoiceOptions advanced_voice_options = 8; + * @return \Google\Cloud\TextToSpeech\V1\AdvancedVoiceOptions|null + */ + public function getAdvancedVoiceOptions() + { + return $this->advanced_voice_options; + } + + public function hasAdvancedVoiceOptions() + { + return isset($this->advanced_voice_options); + } + + public function clearAdvancedVoiceOptions() + { + unset($this->advanced_voice_options); + } + + /** + * Advanced voice options. + * + * Generated from protobuf field optional .google.cloud.texttospeech.v1.AdvancedVoiceOptions advanced_voice_options = 8; + * @param \Google\Cloud\TextToSpeech\V1\AdvancedVoiceOptions $var + * @return $this + */ + public function setAdvancedVoiceOptions($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\TextToSpeech\V1\AdvancedVoiceOptions::class); + $this->advanced_voice_options = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/TextToSpeech/v1/proto/src/Google/Cloud/TextToSpeech/V1/SynthesizeSpeechResponse.php b/owl-bot-staging/TextToSpeech/v1/proto/src/Google/Cloud/TextToSpeech/V1/SynthesizeSpeechResponse.php new file mode 100644 index 000000000000..bfe3329eb5e2 --- /dev/null +++ b/owl-bot-staging/TextToSpeech/v1/proto/src/Google/Cloud/TextToSpeech/V1/SynthesizeSpeechResponse.php @@ -0,0 +1,83 @@ +google.cloud.texttospeech.v1.SynthesizeSpeechResponse + */ +class SynthesizeSpeechResponse extends \Google\Protobuf\Internal\Message +{ + /** + * The audio data bytes encoded as specified in the request, including the + * header for encodings that are wrapped in containers (e.g. MP3, OGG_OPUS). + * For LINEAR16 audio, we include the WAV header. Note: as + * with all bytes fields, protobuffers use a pure binary representation, + * whereas JSON representations use base64. + * + * Generated from protobuf field bytes audio_content = 1; + */ + protected $audio_content = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $audio_content + * The audio data bytes encoded as specified in the request, including the + * header for encodings that are wrapped in containers (e.g. MP3, OGG_OPUS). + * For LINEAR16 audio, we include the WAV header. Note: as + * with all bytes fields, protobuffers use a pure binary representation, + * whereas JSON representations use base64. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Texttospeech\V1\CloudTts::initOnce(); + parent::__construct($data); + } + + /** + * The audio data bytes encoded as specified in the request, including the + * header for encodings that are wrapped in containers (e.g. MP3, OGG_OPUS). + * For LINEAR16 audio, we include the WAV header. Note: as + * with all bytes fields, protobuffers use a pure binary representation, + * whereas JSON representations use base64. + * + * Generated from protobuf field bytes audio_content = 1; + * @return string + */ + public function getAudioContent() + { + return $this->audio_content; + } + + /** + * The audio data bytes encoded as specified in the request, including the + * header for encodings that are wrapped in containers (e.g. MP3, OGG_OPUS). + * For LINEAR16 audio, we include the WAV header. Note: as + * with all bytes fields, protobuffers use a pure binary representation, + * whereas JSON representations use base64. + * + * Generated from protobuf field bytes audio_content = 1; + * @param string $var + * @return $this + */ + public function setAudioContent($var) + { + GPBUtil::checkString($var, False); + $this->audio_content = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/TextToSpeech/v1/proto/src/Google/Cloud/TextToSpeech/V1/Voice.php b/owl-bot-staging/TextToSpeech/v1/proto/src/Google/Cloud/TextToSpeech/V1/Voice.php new file mode 100644 index 000000000000..f53642965390 --- /dev/null +++ b/owl-bot-staging/TextToSpeech/v1/proto/src/Google/Cloud/TextToSpeech/V1/Voice.php @@ -0,0 +1,177 @@ +google.cloud.texttospeech.v1.Voice + */ +class Voice extends \Google\Protobuf\Internal\Message +{ + /** + * The languages that this voice supports, expressed as + * [BCP-47](https://www.rfc-editor.org/rfc/bcp/bcp47.txt) language tags (e.g. + * "en-US", "es-419", "cmn-tw"). + * + * Generated from protobuf field repeated string language_codes = 1; + */ + private $language_codes; + /** + * The name of this voice. Each distinct voice has a unique name. + * + * Generated from protobuf field string name = 2; + */ + protected $name = ''; + /** + * The gender of this voice. + * + * Generated from protobuf field .google.cloud.texttospeech.v1.SsmlVoiceGender ssml_gender = 3; + */ + protected $ssml_gender = 0; + /** + * The natural sample rate (in hertz) for this voice. + * + * Generated from protobuf field int32 natural_sample_rate_hertz = 4; + */ + protected $natural_sample_rate_hertz = 0; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array|\Google\Protobuf\Internal\RepeatedField $language_codes + * The languages that this voice supports, expressed as + * [BCP-47](https://www.rfc-editor.org/rfc/bcp/bcp47.txt) language tags (e.g. + * "en-US", "es-419", "cmn-tw"). + * @type string $name + * The name of this voice. Each distinct voice has a unique name. + * @type int $ssml_gender + * The gender of this voice. + * @type int $natural_sample_rate_hertz + * The natural sample rate (in hertz) for this voice. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Texttospeech\V1\CloudTts::initOnce(); + parent::__construct($data); + } + + /** + * The languages that this voice supports, expressed as + * [BCP-47](https://www.rfc-editor.org/rfc/bcp/bcp47.txt) language tags (e.g. + * "en-US", "es-419", "cmn-tw"). + * + * Generated from protobuf field repeated string language_codes = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getLanguageCodes() + { + return $this->language_codes; + } + + /** + * The languages that this voice supports, expressed as + * [BCP-47](https://www.rfc-editor.org/rfc/bcp/bcp47.txt) language tags (e.g. + * "en-US", "es-419", "cmn-tw"). + * + * Generated from protobuf field repeated string language_codes = 1; + * @param array|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setLanguageCodes($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); + $this->language_codes = $arr; + + return $this; + } + + /** + * The name of this voice. Each distinct voice has a unique name. + * + * Generated from protobuf field string name = 2; + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * The name of this voice. Each distinct voice has a unique name. + * + * Generated from protobuf field string name = 2; + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * The gender of this voice. + * + * Generated from protobuf field .google.cloud.texttospeech.v1.SsmlVoiceGender ssml_gender = 3; + * @return int + */ + public function getSsmlGender() + { + return $this->ssml_gender; + } + + /** + * The gender of this voice. + * + * Generated from protobuf field .google.cloud.texttospeech.v1.SsmlVoiceGender ssml_gender = 3; + * @param int $var + * @return $this + */ + public function setSsmlGender($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\TextToSpeech\V1\SsmlVoiceGender::class); + $this->ssml_gender = $var; + + return $this; + } + + /** + * The natural sample rate (in hertz) for this voice. + * + * Generated from protobuf field int32 natural_sample_rate_hertz = 4; + * @return int + */ + public function getNaturalSampleRateHertz() + { + return $this->natural_sample_rate_hertz; + } + + /** + * The natural sample rate (in hertz) for this voice. + * + * Generated from protobuf field int32 natural_sample_rate_hertz = 4; + * @param int $var + * @return $this + */ + public function setNaturalSampleRateHertz($var) + { + GPBUtil::checkInt32($var); + $this->natural_sample_rate_hertz = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/TextToSpeech/v1/proto/src/Google/Cloud/TextToSpeech/V1/VoiceCloneParams.php b/owl-bot-staging/TextToSpeech/v1/proto/src/Google/Cloud/TextToSpeech/V1/VoiceCloneParams.php new file mode 100644 index 000000000000..83d52d421f52 --- /dev/null +++ b/owl-bot-staging/TextToSpeech/v1/proto/src/Google/Cloud/TextToSpeech/V1/VoiceCloneParams.php @@ -0,0 +1,67 @@ +google.cloud.texttospeech.v1.VoiceCloneParams + */ +class VoiceCloneParams extends \Google\Protobuf\Internal\Message +{ + /** + * Required. Created by GenerateVoiceCloningKey. + * + * Generated from protobuf field string voice_cloning_key = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $voice_cloning_key = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $voice_cloning_key + * Required. Created by GenerateVoiceCloningKey. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Texttospeech\V1\CloudTts::initOnce(); + parent::__construct($data); + } + + /** + * Required. Created by GenerateVoiceCloningKey. + * + * Generated from protobuf field string voice_cloning_key = 1 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getVoiceCloningKey() + { + return $this->voice_cloning_key; + } + + /** + * Required. Created by GenerateVoiceCloningKey. + * + * Generated from protobuf field string voice_cloning_key = 1 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setVoiceCloningKey($var) + { + GPBUtil::checkString($var, True); + $this->voice_cloning_key = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/TextToSpeech/v1/proto/src/Google/Cloud/TextToSpeech/V1/VoiceSelectionParams.php b/owl-bot-staging/TextToSpeech/v1/proto/src/Google/Cloud/TextToSpeech/V1/VoiceSelectionParams.php new file mode 100644 index 000000000000..5ccf9c11db9b --- /dev/null +++ b/owl-bot-staging/TextToSpeech/v1/proto/src/Google/Cloud/TextToSpeech/V1/VoiceSelectionParams.php @@ -0,0 +1,303 @@ +google.cloud.texttospeech.v1.VoiceSelectionParams + */ +class VoiceSelectionParams extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The language (and potentially also the region) of the voice + * expressed as a [BCP-47](https://www.rfc-editor.org/rfc/bcp/bcp47.txt) + * language tag, e.g. "en-US". This should not include a script tag (e.g. use + * "cmn-cn" rather than "cmn-Hant-cn"), because the script will be inferred + * from the input provided in the SynthesisInput. The TTS service + * will use this parameter to help choose an appropriate voice. Note that + * the TTS service may choose a voice with a slightly different language code + * than the one selected; it may substitute a different region + * (e.g. using en-US rather than en-CA if there isn't a Canadian voice + * available), or even a different language, e.g. using "nb" (Norwegian + * Bokmal) instead of "no" (Norwegian)". + * + * Generated from protobuf field string language_code = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $language_code = ''; + /** + * The name of the voice. If both the name and the gender are not set, + * the service will choose a voice based on the other parameters such as + * language_code. + * + * Generated from protobuf field string name = 2; + */ + protected $name = ''; + /** + * The preferred gender of the voice. If not set, the service will + * choose a voice based on the other parameters such as language_code and + * name. Note that this is only a preference, not requirement; if a + * voice of the appropriate gender is not available, the synthesizer should + * substitute a voice with a different gender rather than failing the request. + * + * Generated from protobuf field .google.cloud.texttospeech.v1.SsmlVoiceGender ssml_gender = 3; + */ + protected $ssml_gender = 0; + /** + * The configuration for a custom voice. If [CustomVoiceParams.model] is set, + * the service will choose the custom voice matching the specified + * configuration. + * + * Generated from protobuf field .google.cloud.texttospeech.v1.CustomVoiceParams custom_voice = 4; + */ + protected $custom_voice = null; + /** + * Optional. The configuration for a voice clone. If + * [VoiceCloneParams.voice_clone_key] is set, the service will choose the + * voice clone matching the specified configuration. + * + * Generated from protobuf field .google.cloud.texttospeech.v1.VoiceCloneParams voice_clone = 5 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $voice_clone = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $language_code + * Required. The language (and potentially also the region) of the voice + * expressed as a [BCP-47](https://www.rfc-editor.org/rfc/bcp/bcp47.txt) + * language tag, e.g. "en-US". This should not include a script tag (e.g. use + * "cmn-cn" rather than "cmn-Hant-cn"), because the script will be inferred + * from the input provided in the SynthesisInput. The TTS service + * will use this parameter to help choose an appropriate voice. Note that + * the TTS service may choose a voice with a slightly different language code + * than the one selected; it may substitute a different region + * (e.g. using en-US rather than en-CA if there isn't a Canadian voice + * available), or even a different language, e.g. using "nb" (Norwegian + * Bokmal) instead of "no" (Norwegian)". + * @type string $name + * The name of the voice. If both the name and the gender are not set, + * the service will choose a voice based on the other parameters such as + * language_code. + * @type int $ssml_gender + * The preferred gender of the voice. If not set, the service will + * choose a voice based on the other parameters such as language_code and + * name. Note that this is only a preference, not requirement; if a + * voice of the appropriate gender is not available, the synthesizer should + * substitute a voice with a different gender rather than failing the request. + * @type \Google\Cloud\TextToSpeech\V1\CustomVoiceParams $custom_voice + * The configuration for a custom voice. If [CustomVoiceParams.model] is set, + * the service will choose the custom voice matching the specified + * configuration. + * @type \Google\Cloud\TextToSpeech\V1\VoiceCloneParams $voice_clone + * Optional. The configuration for a voice clone. If + * [VoiceCloneParams.voice_clone_key] is set, the service will choose the + * voice clone matching the specified configuration. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Texttospeech\V1\CloudTts::initOnce(); + parent::__construct($data); + } + + /** + * Required. The language (and potentially also the region) of the voice + * expressed as a [BCP-47](https://www.rfc-editor.org/rfc/bcp/bcp47.txt) + * language tag, e.g. "en-US". This should not include a script tag (e.g. use + * "cmn-cn" rather than "cmn-Hant-cn"), because the script will be inferred + * from the input provided in the SynthesisInput. The TTS service + * will use this parameter to help choose an appropriate voice. Note that + * the TTS service may choose a voice with a slightly different language code + * than the one selected; it may substitute a different region + * (e.g. using en-US rather than en-CA if there isn't a Canadian voice + * available), or even a different language, e.g. using "nb" (Norwegian + * Bokmal) instead of "no" (Norwegian)". + * + * Generated from protobuf field string language_code = 1 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getLanguageCode() + { + return $this->language_code; + } + + /** + * Required. The language (and potentially also the region) of the voice + * expressed as a [BCP-47](https://www.rfc-editor.org/rfc/bcp/bcp47.txt) + * language tag, e.g. "en-US". This should not include a script tag (e.g. use + * "cmn-cn" rather than "cmn-Hant-cn"), because the script will be inferred + * from the input provided in the SynthesisInput. The TTS service + * will use this parameter to help choose an appropriate voice. Note that + * the TTS service may choose a voice with a slightly different language code + * than the one selected; it may substitute a different region + * (e.g. using en-US rather than en-CA if there isn't a Canadian voice + * available), or even a different language, e.g. using "nb" (Norwegian + * Bokmal) instead of "no" (Norwegian)". + * + * Generated from protobuf field string language_code = 1 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setLanguageCode($var) + { + GPBUtil::checkString($var, True); + $this->language_code = $var; + + return $this; + } + + /** + * The name of the voice. If both the name and the gender are not set, + * the service will choose a voice based on the other parameters such as + * language_code. + * + * Generated from protobuf field string name = 2; + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * The name of the voice. If both the name and the gender are not set, + * the service will choose a voice based on the other parameters such as + * language_code. + * + * Generated from protobuf field string name = 2; + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * The preferred gender of the voice. If not set, the service will + * choose a voice based on the other parameters such as language_code and + * name. Note that this is only a preference, not requirement; if a + * voice of the appropriate gender is not available, the synthesizer should + * substitute a voice with a different gender rather than failing the request. + * + * Generated from protobuf field .google.cloud.texttospeech.v1.SsmlVoiceGender ssml_gender = 3; + * @return int + */ + public function getSsmlGender() + { + return $this->ssml_gender; + } + + /** + * The preferred gender of the voice. If not set, the service will + * choose a voice based on the other parameters such as language_code and + * name. Note that this is only a preference, not requirement; if a + * voice of the appropriate gender is not available, the synthesizer should + * substitute a voice with a different gender rather than failing the request. + * + * Generated from protobuf field .google.cloud.texttospeech.v1.SsmlVoiceGender ssml_gender = 3; + * @param int $var + * @return $this + */ + public function setSsmlGender($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\TextToSpeech\V1\SsmlVoiceGender::class); + $this->ssml_gender = $var; + + return $this; + } + + /** + * The configuration for a custom voice. If [CustomVoiceParams.model] is set, + * the service will choose the custom voice matching the specified + * configuration. + * + * Generated from protobuf field .google.cloud.texttospeech.v1.CustomVoiceParams custom_voice = 4; + * @return \Google\Cloud\TextToSpeech\V1\CustomVoiceParams|null + */ + public function getCustomVoice() + { + return $this->custom_voice; + } + + public function hasCustomVoice() + { + return isset($this->custom_voice); + } + + public function clearCustomVoice() + { + unset($this->custom_voice); + } + + /** + * The configuration for a custom voice. If [CustomVoiceParams.model] is set, + * the service will choose the custom voice matching the specified + * configuration. + * + * Generated from protobuf field .google.cloud.texttospeech.v1.CustomVoiceParams custom_voice = 4; + * @param \Google\Cloud\TextToSpeech\V1\CustomVoiceParams $var + * @return $this + */ + public function setCustomVoice($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\TextToSpeech\V1\CustomVoiceParams::class); + $this->custom_voice = $var; + + return $this; + } + + /** + * Optional. The configuration for a voice clone. If + * [VoiceCloneParams.voice_clone_key] is set, the service will choose the + * voice clone matching the specified configuration. + * + * Generated from protobuf field .google.cloud.texttospeech.v1.VoiceCloneParams voice_clone = 5 [(.google.api.field_behavior) = OPTIONAL]; + * @return \Google\Cloud\TextToSpeech\V1\VoiceCloneParams|null + */ + public function getVoiceClone() + { + return $this->voice_clone; + } + + public function hasVoiceClone() + { + return isset($this->voice_clone); + } + + public function clearVoiceClone() + { + unset($this->voice_clone); + } + + /** + * Optional. The configuration for a voice clone. If + * [VoiceCloneParams.voice_clone_key] is set, the service will choose the + * voice clone matching the specified configuration. + * + * Generated from protobuf field .google.cloud.texttospeech.v1.VoiceCloneParams voice_clone = 5 [(.google.api.field_behavior) = OPTIONAL]; + * @param \Google\Cloud\TextToSpeech\V1\VoiceCloneParams $var + * @return $this + */ + public function setVoiceClone($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\TextToSpeech\V1\VoiceCloneParams::class); + $this->voice_clone = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/TextToSpeech/v1/samples/V1/TextToSpeechClient/list_voices.php b/owl-bot-staging/TextToSpeech/v1/samples/V1/TextToSpeechClient/list_voices.php new file mode 100644 index 000000000000..2a4357540ab2 --- /dev/null +++ b/owl-bot-staging/TextToSpeech/v1/samples/V1/TextToSpeechClient/list_voices.php @@ -0,0 +1,57 @@ +listVoices($request); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} +// [END texttospeech_v1_generated_TextToSpeech_ListVoices_sync] diff --git a/owl-bot-staging/TextToSpeech/v1/samples/V1/TextToSpeechClient/streaming_synthesize.php b/owl-bot-staging/TextToSpeech/v1/samples/V1/TextToSpeechClient/streaming_synthesize.php new file mode 100644 index 000000000000..47a97cf434aa --- /dev/null +++ b/owl-bot-staging/TextToSpeech/v1/samples/V1/TextToSpeechClient/streaming_synthesize.php @@ -0,0 +1,64 @@ +streamingSynthesize(); + $stream->writeAll([$request,]); + + /** @var StreamingSynthesizeResponse $element */ + foreach ($stream->closeWriteAndReadAll() as $element) { + printf('Element data: %s' . PHP_EOL, $element->serializeToJsonString()); + } + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} +// [END texttospeech_v1_generated_TextToSpeech_StreamingSynthesize_sync] diff --git a/owl-bot-staging/TextToSpeech/v1/samples/V1/TextToSpeechClient/synthesize_speech.php b/owl-bot-staging/TextToSpeech/v1/samples/V1/TextToSpeechClient/synthesize_speech.php new file mode 100644 index 000000000000..f6bac9ae2c38 --- /dev/null +++ b/owl-bot-staging/TextToSpeech/v1/samples/V1/TextToSpeechClient/synthesize_speech.php @@ -0,0 +1,94 @@ +setLanguageCode($voiceLanguageCode); + $audioConfig = (new AudioConfig()) + ->setAudioEncoding($audioConfigAudioEncoding); + $request = (new SynthesizeSpeechRequest()) + ->setInput($input) + ->setVoice($voice) + ->setAudioConfig($audioConfig); + + // Call the API and handle any network failures. + try { + /** @var SynthesizeSpeechResponse $response */ + $response = $textToSpeechClient->synthesizeSpeech($request); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $voiceLanguageCode = '[LANGUAGE_CODE]'; + $audioConfigAudioEncoding = AudioEncoding::AUDIO_ENCODING_UNSPECIFIED; + + synthesize_speech_sample($voiceLanguageCode, $audioConfigAudioEncoding); +} +// [END texttospeech_v1_generated_TextToSpeech_SynthesizeSpeech_sync] diff --git a/owl-bot-staging/TextToSpeech/v1/samples/V1/TextToSpeechLongAudioSynthesizeClient/synthesize_long_audio.php b/owl-bot-staging/TextToSpeech/v1/samples/V1/TextToSpeechLongAudioSynthesizeClient/synthesize_long_audio.php new file mode 100644 index 000000000000..cf9eaa3f258c --- /dev/null +++ b/owl-bot-staging/TextToSpeech/v1/samples/V1/TextToSpeechLongAudioSynthesizeClient/synthesize_long_audio.php @@ -0,0 +1,89 @@ +setAudioEncoding($audioConfigAudioEncoding); + $request = (new SynthesizeLongAudioRequest()) + ->setInput($input) + ->setAudioConfig($audioConfig); + + // Call the API and handle any network failures. + try { + /** @var OperationResponse $response */ + $response = $textToSpeechLongAudioSynthesizeClient->synthesizeLongAudio($request); + $response->pollUntilComplete(); + + if ($response->operationSucceeded()) { + /** @var SynthesizeLongAudioResponse $result */ + $result = $response->getResult(); + printf('Operation successful with response data: %s' . PHP_EOL, $result->serializeToJsonString()); + } else { + /** @var Status $error */ + $error = $response->getError(); + printf('Operation failed with error data: %s' . PHP_EOL, $error->serializeToJsonString()); + } + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $audioConfigAudioEncoding = AudioEncoding::AUDIO_ENCODING_UNSPECIFIED; + + synthesize_long_audio_sample($audioConfigAudioEncoding); +} +// [END texttospeech_v1_generated_TextToSpeechLongAudioSynthesize_SynthesizeLongAudio_sync] diff --git a/owl-bot-staging/TextToSpeech/v1/src/V1/Client/TextToSpeechClient.php b/owl-bot-staging/TextToSpeech/v1/src/V1/Client/TextToSpeechClient.php new file mode 100644 index 000000000000..79b66ce70026 --- /dev/null +++ b/owl-bot-staging/TextToSpeech/v1/src/V1/Client/TextToSpeechClient.php @@ -0,0 +1,292 @@ + self::SERVICE_NAME, + 'apiEndpoint' => self::SERVICE_ADDRESS . ':' . self::DEFAULT_SERVICE_PORT, + 'clientConfig' => __DIR__ . '/../resources/text_to_speech_client_config.json', + 'descriptorsConfigPath' => __DIR__ . '/../resources/text_to_speech_descriptor_config.php', + 'gcpApiConfigPath' => __DIR__ . '/../resources/text_to_speech_grpc_config.json', + 'credentialsConfig' => [ + 'defaultScopes' => self::$serviceScopes, + ], + 'transportConfig' => [ + 'rest' => [ + 'restClientConfigPath' => __DIR__ . '/../resources/text_to_speech_rest_client_config.php', + ], + ], + ]; + } + + /** + * Formats a string containing the fully-qualified path to represent a model + * resource. + * + * @param string $project + * @param string $location + * @param string $model + * + * @return string The formatted model resource. + */ + public static function modelName(string $project, string $location, string $model): string + { + return self::getPathTemplate('model')->render([ + 'project' => $project, + 'location' => $location, + 'model' => $model, + ]); + } + + /** + * Parses a formatted name string and returns an associative array of the components in the name. + * The following name formats are supported: + * Template: Pattern + * - model: projects/{project}/locations/{location}/models/{model} + * + * The optional $template argument can be supplied to specify a particular pattern, + * and must match one of the templates listed above. If no $template argument is + * provided, or if the $template argument does not match one of the templates + * listed, then parseName will check each of the supported templates, and return + * the first match. + * + * @param string $formattedName The formatted name string + * @param string $template Optional name of template to match + * + * @return array An associative array from name component IDs to component values. + * + * @throws ValidationException If $formattedName could not be matched. + */ + public static function parseName(string $formattedName, string $template = null): array + { + return self::parseFormattedName($formattedName, $template); + } + + /** + * Constructor. + * + * @param array $options { + * Optional. Options for configuring the service API wrapper. + * + * @type string $apiEndpoint + * The address of the API remote host. May optionally include the port, formatted + * as ":". Default 'texttospeech.googleapis.com:443'. + * @type string|array|FetchAuthTokenInterface|CredentialsWrapper $credentials + * The credentials to be used by the client to authorize API calls. This option + * accepts either a path to a credentials file, or a decoded credentials file as a + * PHP array. + * *Advanced usage*: In addition, this option can also accept a pre-constructed + * {@see \Google\Auth\FetchAuthTokenInterface} object or + * {@see \Google\ApiCore\CredentialsWrapper} object. Note that when one of these + * objects are provided, any settings in $credentialsConfig will be ignored. + * @type array $credentialsConfig + * Options used to configure credentials, including auth token caching, for the + * client. For a full list of supporting configuration options, see + * {@see \Google\ApiCore\CredentialsWrapper::build()} . + * @type bool $disableRetries + * Determines whether or not retries defined by the client configuration should be + * disabled. Defaults to `false`. + * @type string|array $clientConfig + * Client method configuration, including retry settings. This option can be either + * a path to a JSON file, or a PHP array containing the decoded JSON data. By + * default this settings points to the default client config file, which is + * provided in the resources folder. + * @type string|TransportInterface $transport + * The transport used for executing network requests. May be either the string + * `rest` or `grpc`. Defaults to `grpc` if gRPC support is detected on the system. + * *Advanced usage*: Additionally, it is possible to pass in an already + * instantiated {@see \Google\ApiCore\Transport\TransportInterface} object. Note + * that when this object is provided, any settings in $transportConfig, and any + * $apiEndpoint setting, will be ignored. + * @type array $transportConfig + * Configuration options that will be used to construct the transport. Options for + * each supported transport type should be passed in a key for that transport. For + * example: + * $transportConfig = [ + * 'grpc' => [...], + * 'rest' => [...], + * ]; + * See the {@see \Google\ApiCore\Transport\GrpcTransport::build()} and + * {@see \Google\ApiCore\Transport\RestTransport::build()} methods for the + * supported options. + * @type callable $clientCertSource + * A callable which returns the client cert as a string. This can be used to + * provide a certificate and private key to the transport layer for mTLS. + * } + * + * @throws ValidationException + */ + public function __construct(array $options = []) + { + $clientOptions = $this->buildClientOptions($options); + $this->setClientOptions($clientOptions); + } + + /** Handles execution of the async variants for each documented method. */ + public function __call($method, $args) + { + if (substr($method, -5) !== 'Async') { + trigger_error('Call to undefined method ' . __CLASS__ . "::$method()", E_USER_ERROR); + } + + array_unshift($args, substr($method, 0, -5)); + return call_user_func_array([$this, 'startAsyncCall'], $args); + } + + /** + * Returns a list of Voice supported for synthesis. + * + * The async variant is {@see TextToSpeechClient::listVoicesAsync()} . + * + * @example samples/V1/TextToSpeechClient/list_voices.php + * + * @param ListVoicesRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return ListVoicesResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function listVoices(ListVoicesRequest $request, array $callOptions = []): ListVoicesResponse + { + return $this->startApiCall('ListVoices', $request, $callOptions)->wait(); + } + + /** + * Performs bidirectional streaming speech synthesis: receive audio while + * sending text. + * + * @example samples/V1/TextToSpeechClient/streaming_synthesize.php + * + * @param array $callOptions { + * Optional. + * + * @type int $timeoutMillis + * Timeout to use for this call. + * } + * + * @return BidiStream + * + * @throws ApiException Thrown if the API call fails. + */ + public function streamingSynthesize(array $callOptions = []): BidiStream + { + return $this->startApiCall('StreamingSynthesize', null, $callOptions); + } + + /** + * Synthesizes speech synchronously: receive results after all text input + * has been processed. + * + * The async variant is {@see TextToSpeechClient::synthesizeSpeechAsync()} . + * + * @example samples/V1/TextToSpeechClient/synthesize_speech.php + * + * @param SynthesizeSpeechRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return SynthesizeSpeechResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function synthesizeSpeech(SynthesizeSpeechRequest $request, array $callOptions = []): SynthesizeSpeechResponse + { + return $this->startApiCall('SynthesizeSpeech', $request, $callOptions)->wait(); + } +} diff --git a/owl-bot-staging/TextToSpeech/v1/src/V1/Client/TextToSpeechLongAudioSynthesizeClient.php b/owl-bot-staging/TextToSpeech/v1/src/V1/Client/TextToSpeechLongAudioSynthesizeClient.php new file mode 100644 index 000000000000..2e91b8f6acfa --- /dev/null +++ b/owl-bot-staging/TextToSpeech/v1/src/V1/Client/TextToSpeechLongAudioSynthesizeClient.php @@ -0,0 +1,274 @@ + self::SERVICE_NAME, + 'apiEndpoint' => self::SERVICE_ADDRESS . ':' . self::DEFAULT_SERVICE_PORT, + 'clientConfig' => __DIR__ . '/../resources/text_to_speech_long_audio_synthesize_client_config.json', + 'descriptorsConfigPath' => __DIR__ . '/../resources/text_to_speech_long_audio_synthesize_descriptor_config.php', + 'gcpApiConfigPath' => __DIR__ . '/../resources/text_to_speech_long_audio_synthesize_grpc_config.json', + 'credentialsConfig' => [ + 'defaultScopes' => self::$serviceScopes, + ], + 'transportConfig' => [ + 'rest' => [ + 'restClientConfigPath' => __DIR__ . '/../resources/text_to_speech_long_audio_synthesize_rest_client_config.php', + ], + ], + ]; + } + + /** + * Return an OperationsClient object with the same endpoint as $this. + * + * @return OperationsClient + */ + public function getOperationsClient() + { + return $this->operationsClient; + } + + /** + * Resume an existing long running operation that was previously started by a long + * running API method. If $methodName is not provided, or does not match a long + * running API method, then the operation can still be resumed, but the + * OperationResponse object will not deserialize the final response. + * + * @param string $operationName The name of the long running operation + * @param string $methodName The name of the method used to start the operation + * + * @return OperationResponse + */ + public function resumeOperation($operationName, $methodName = null) + { + $options = isset($this->descriptors[$methodName]['longRunning']) ? $this->descriptors[$methodName]['longRunning'] : []; + $operation = new OperationResponse($operationName, $this->getOperationsClient(), $options); + $operation->reload(); + return $operation; + } + + /** + * Formats a string containing the fully-qualified path to represent a model + * resource. + * + * @param string $project + * @param string $location + * @param string $model + * + * @return string The formatted model resource. + */ + public static function modelName(string $project, string $location, string $model): string + { + return self::getPathTemplate('model')->render([ + 'project' => $project, + 'location' => $location, + 'model' => $model, + ]); + } + + /** + * Parses a formatted name string and returns an associative array of the components in the name. + * The following name formats are supported: + * Template: Pattern + * - model: projects/{project}/locations/{location}/models/{model} + * + * The optional $template argument can be supplied to specify a particular pattern, + * and must match one of the templates listed above. If no $template argument is + * provided, or if the $template argument does not match one of the templates + * listed, then parseName will check each of the supported templates, and return + * the first match. + * + * @param string $formattedName The formatted name string + * @param string $template Optional name of template to match + * + * @return array An associative array from name component IDs to component values. + * + * @throws ValidationException If $formattedName could not be matched. + */ + public static function parseName(string $formattedName, string $template = null): array + { + return self::parseFormattedName($formattedName, $template); + } + + /** + * Constructor. + * + * @param array $options { + * Optional. Options for configuring the service API wrapper. + * + * @type string $apiEndpoint + * The address of the API remote host. May optionally include the port, formatted + * as ":". Default 'texttospeech.googleapis.com:443'. + * @type string|array|FetchAuthTokenInterface|CredentialsWrapper $credentials + * The credentials to be used by the client to authorize API calls. This option + * accepts either a path to a credentials file, or a decoded credentials file as a + * PHP array. + * *Advanced usage*: In addition, this option can also accept a pre-constructed + * {@see \Google\Auth\FetchAuthTokenInterface} object or + * {@see \Google\ApiCore\CredentialsWrapper} object. Note that when one of these + * objects are provided, any settings in $credentialsConfig will be ignored. + * @type array $credentialsConfig + * Options used to configure credentials, including auth token caching, for the + * client. For a full list of supporting configuration options, see + * {@see \Google\ApiCore\CredentialsWrapper::build()} . + * @type bool $disableRetries + * Determines whether or not retries defined by the client configuration should be + * disabled. Defaults to `false`. + * @type string|array $clientConfig + * Client method configuration, including retry settings. This option can be either + * a path to a JSON file, or a PHP array containing the decoded JSON data. By + * default this settings points to the default client config file, which is + * provided in the resources folder. + * @type string|TransportInterface $transport + * The transport used for executing network requests. May be either the string + * `rest` or `grpc`. Defaults to `grpc` if gRPC support is detected on the system. + * *Advanced usage*: Additionally, it is possible to pass in an already + * instantiated {@see \Google\ApiCore\Transport\TransportInterface} object. Note + * that when this object is provided, any settings in $transportConfig, and any + * $apiEndpoint setting, will be ignored. + * @type array $transportConfig + * Configuration options that will be used to construct the transport. Options for + * each supported transport type should be passed in a key for that transport. For + * example: + * $transportConfig = [ + * 'grpc' => [...], + * 'rest' => [...], + * ]; + * See the {@see \Google\ApiCore\Transport\GrpcTransport::build()} and + * {@see \Google\ApiCore\Transport\RestTransport::build()} methods for the + * supported options. + * @type callable $clientCertSource + * A callable which returns the client cert as a string. This can be used to + * provide a certificate and private key to the transport layer for mTLS. + * } + * + * @throws ValidationException + */ + public function __construct(array $options = []) + { + $clientOptions = $this->buildClientOptions($options); + $this->setClientOptions($clientOptions); + $this->operationsClient = $this->createOperationsClient($clientOptions); + } + + /** Handles execution of the async variants for each documented method. */ + public function __call($method, $args) + { + if (substr($method, -5) !== 'Async') { + trigger_error('Call to undefined method ' . __CLASS__ . "::$method()", E_USER_ERROR); + } + + array_unshift($args, substr($method, 0, -5)); + return call_user_func_array([$this, 'startAsyncCall'], $args); + } + + /** + * Synthesizes long form text asynchronously. + * + * The async variant is + * {@see TextToSpeechLongAudioSynthesizeClient::synthesizeLongAudioAsync()} . + * + * @example samples/V1/TextToSpeechLongAudioSynthesizeClient/synthesize_long_audio.php + * + * @param SynthesizeLongAudioRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return OperationResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function synthesizeLongAudio(SynthesizeLongAudioRequest $request, array $callOptions = []): OperationResponse + { + return $this->startApiCall('SynthesizeLongAudio', $request, $callOptions)->wait(); + } +} diff --git a/owl-bot-staging/TextToSpeech/v1/src/V1/Gapic/TextToSpeechGapicClient.php b/owl-bot-staging/TextToSpeech/v1/src/V1/Gapic/TextToSpeechGapicClient.php new file mode 100644 index 000000000000..755f6b2fc575 --- /dev/null +++ b/owl-bot-staging/TextToSpeech/v1/src/V1/Gapic/TextToSpeechGapicClient.php @@ -0,0 +1,412 @@ +listVoices(); + * } finally { + * $textToSpeechClient->close(); + * } + * ``` + * + * Many parameters require resource names to be formatted in a particular way. To + * assist with these names, this class includes a format method for each type of + * name, and additionally a parseName method to extract the individual identifiers + * contained within formatted names that are returned by the API. + * + * @deprecated Please use the new service client {@see \Google\Cloud\TextToSpeech\V1\Client\TextToSpeechClient}. + */ +class TextToSpeechGapicClient +{ + use GapicClientTrait; + + /** The name of the service. */ + const SERVICE_NAME = 'google.cloud.texttospeech.v1.TextToSpeech'; + + /** + * The default address of the service. + * + * @deprecated SERVICE_ADDRESS_TEMPLATE should be used instead. + */ + const SERVICE_ADDRESS = 'texttospeech.googleapis.com'; + + /** The address template of the service. */ + private const SERVICE_ADDRESS_TEMPLATE = 'texttospeech.UNIVERSE_DOMAIN'; + + /** The default port of the service. */ + const DEFAULT_SERVICE_PORT = 443; + + /** The name of the code generator, to be included in the agent header. */ + const CODEGEN_NAME = 'gapic'; + + /** The default scopes required by the service. */ + public static $serviceScopes = [ + 'https://www.googleapis.com/auth/cloud-platform', + ]; + + private static $modelNameTemplate; + + private static $pathTemplateMap; + + private static function getClientDefaults() + { + return [ + 'serviceName' => self::SERVICE_NAME, + 'apiEndpoint' => self::SERVICE_ADDRESS . ':' . self::DEFAULT_SERVICE_PORT, + 'clientConfig' => __DIR__ . '/../resources/text_to_speech_client_config.json', + 'descriptorsConfigPath' => __DIR__ . '/../resources/text_to_speech_descriptor_config.php', + 'gcpApiConfigPath' => __DIR__ . '/../resources/text_to_speech_grpc_config.json', + 'credentialsConfig' => [ + 'defaultScopes' => self::$serviceScopes, + ], + 'transportConfig' => [ + 'rest' => [ + 'restClientConfigPath' => __DIR__ . '/../resources/text_to_speech_rest_client_config.php', + ], + ], + ]; + } + + private static function getModelNameTemplate() + { + if (self::$modelNameTemplate == null) { + self::$modelNameTemplate = new PathTemplate('projects/{project}/locations/{location}/models/{model}'); + } + + return self::$modelNameTemplate; + } + + private static function getPathTemplateMap() + { + if (self::$pathTemplateMap == null) { + self::$pathTemplateMap = [ + 'model' => self::getModelNameTemplate(), + ]; + } + + return self::$pathTemplateMap; + } + + /** + * Formats a string containing the fully-qualified path to represent a model + * resource. + * + * @param string $project + * @param string $location + * @param string $model + * + * @return string The formatted model resource. + */ + public static function modelName($project, $location, $model) + { + return self::getModelNameTemplate()->render([ + 'project' => $project, + 'location' => $location, + 'model' => $model, + ]); + } + + /** + * Parses a formatted name string and returns an associative array of the components in the name. + * The following name formats are supported: + * Template: Pattern + * - model: projects/{project}/locations/{location}/models/{model} + * + * The optional $template argument can be supplied to specify a particular pattern, + * and must match one of the templates listed above. If no $template argument is + * provided, or if the $template argument does not match one of the templates + * listed, then parseName will check each of the supported templates, and return + * the first match. + * + * @param string $formattedName The formatted name string + * @param string $template Optional name of template to match + * + * @return array An associative array from name component IDs to component values. + * + * @throws ValidationException If $formattedName could not be matched. + */ + public static function parseName($formattedName, $template = null) + { + $templateMap = self::getPathTemplateMap(); + if ($template) { + if (!isset($templateMap[$template])) { + throw new ValidationException("Template name $template does not exist"); + } + + return $templateMap[$template]->match($formattedName); + } + + foreach ($templateMap as $templateName => $pathTemplate) { + try { + return $pathTemplate->match($formattedName); + } catch (ValidationException $ex) { + // Swallow the exception to continue trying other path templates + } + } + + throw new ValidationException("Input did not match any known format. Input: $formattedName"); + } + + /** + * Constructor. + * + * @param array $options { + * Optional. Options for configuring the service API wrapper. + * + * @type string $apiEndpoint + * The address of the API remote host. May optionally include the port, formatted + * as ":". Default 'texttospeech.googleapis.com:443'. + * @type string|array|FetchAuthTokenInterface|CredentialsWrapper $credentials + * The credentials to be used by the client to authorize API calls. This option + * accepts either a path to a credentials file, or a decoded credentials file as a + * PHP array. + * *Advanced usage*: In addition, this option can also accept a pre-constructed + * {@see \Google\Auth\FetchAuthTokenInterface} object or + * {@see \Google\ApiCore\CredentialsWrapper} object. Note that when one of these + * objects are provided, any settings in $credentialsConfig will be ignored. + * @type array $credentialsConfig + * Options used to configure credentials, including auth token caching, for the + * client. For a full list of supporting configuration options, see + * {@see \Google\ApiCore\CredentialsWrapper::build()} . + * @type bool $disableRetries + * Determines whether or not retries defined by the client configuration should be + * disabled. Defaults to `false`. + * @type string|array $clientConfig + * Client method configuration, including retry settings. This option can be either + * a path to a JSON file, or a PHP array containing the decoded JSON data. By + * default this settings points to the default client config file, which is + * provided in the resources folder. + * @type string|TransportInterface $transport + * The transport used for executing network requests. May be either the string + * `rest` or `grpc`. Defaults to `grpc` if gRPC support is detected on the system. + * *Advanced usage*: Additionally, it is possible to pass in an already + * instantiated {@see \Google\ApiCore\Transport\TransportInterface} object. Note + * that when this object is provided, any settings in $transportConfig, and any + * $apiEndpoint setting, will be ignored. + * @type array $transportConfig + * Configuration options that will be used to construct the transport. Options for + * each supported transport type should be passed in a key for that transport. For + * example: + * $transportConfig = [ + * 'grpc' => [...], + * 'rest' => [...], + * ]; + * See the {@see \Google\ApiCore\Transport\GrpcTransport::build()} and + * {@see \Google\ApiCore\Transport\RestTransport::build()} methods for the + * supported options. + * @type callable $clientCertSource + * A callable which returns the client cert as a string. This can be used to + * provide a certificate and private key to the transport layer for mTLS. + * } + * + * @throws ValidationException + */ + public function __construct(array $options = []) + { + $clientOptions = $this->buildClientOptions($options); + $this->setClientOptions($clientOptions); + } + + /** + * Returns a list of Voice supported for synthesis. + * + * Sample code: + * ``` + * $textToSpeechClient = new TextToSpeechClient(); + * try { + * $response = $textToSpeechClient->listVoices(); + * } finally { + * $textToSpeechClient->close(); + * } + * ``` + * + * @param array $optionalArgs { + * Optional. + * + * @type string $languageCode + * Optional. Recommended. + * [BCP-47](https://www.rfc-editor.org/rfc/bcp/bcp47.txt) language tag. + * If not specified, the API will return all supported voices. + * If specified, the ListVoices call will only return voices that can be used + * to synthesize this language_code. For example, if you specify `"en-NZ"`, + * all `"en-NZ"` voices will be returned. If you specify `"no"`, both + * `"no-\*"` (Norwegian) and `"nb-\*"` (Norwegian Bokmal) voices will be + * returned. + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return \Google\Cloud\TextToSpeech\V1\ListVoicesResponse + * + * @throws ApiException if the remote call fails + */ + public function listVoices(array $optionalArgs = []) + { + $request = new ListVoicesRequest(); + if (isset($optionalArgs['languageCode'])) { + $request->setLanguageCode($optionalArgs['languageCode']); + } + + return $this->startCall('ListVoices', ListVoicesResponse::class, $optionalArgs, $request)->wait(); + } + + /** + * Performs bidirectional streaming speech synthesis: receive audio while + * sending text. + * + * Sample code: + * ``` + * $textToSpeechClient = new TextToSpeechClient(); + * try { + * $request = new StreamingSynthesizeRequest(); + * // Write all requests to the server, then read all responses until the + * // stream is complete + * $requests = [ + * $request, + * ]; + * $stream = $textToSpeechClient->streamingSynthesize(); + * $stream->writeAll($requests); + * foreach ($stream->closeWriteAndReadAll() as $element) { + * // doSomethingWith($element); + * } + * // Alternatively: + * // Write requests individually, making read() calls if + * // required. Call closeWrite() once writes are complete, and read the + * // remaining responses from the server. + * $requests = [ + * $request, + * ]; + * $stream = $textToSpeechClient->streamingSynthesize(); + * foreach ($requests as $request) { + * $stream->write($request); + * // if required, read a single response from the stream + * $element = $stream->read(); + * // doSomethingWith($element) + * } + * $stream->closeWrite(); + * $element = $stream->read(); + * while (!is_null($element)) { + * // doSomethingWith($element) + * $element = $stream->read(); + * } + * } finally { + * $textToSpeechClient->close(); + * } + * ``` + * + * @param array $optionalArgs { + * Optional. + * + * @type int $timeoutMillis + * Timeout to use for this call. + * } + * + * @return \Google\ApiCore\BidiStream + * + * @throws ApiException if the remote call fails + */ + public function streamingSynthesize(array $optionalArgs = []) + { + return $this->startCall('StreamingSynthesize', StreamingSynthesizeResponse::class, $optionalArgs, null, Call::BIDI_STREAMING_CALL); + } + + /** + * Synthesizes speech synchronously: receive results after all text input + * has been processed. + * + * Sample code: + * ``` + * $textToSpeechClient = new TextToSpeechClient(); + * try { + * $input = new SynthesisInput(); + * $voice = new VoiceSelectionParams(); + * $audioConfig = new AudioConfig(); + * $response = $textToSpeechClient->synthesizeSpeech($input, $voice, $audioConfig); + * } finally { + * $textToSpeechClient->close(); + * } + * ``` + * + * @param SynthesisInput $input Required. The Synthesizer requires either plain text or SSML as input. + * @param VoiceSelectionParams $voice Required. The desired voice of the synthesized audio. + * @param AudioConfig $audioConfig Required. The configuration of the synthesized audio. + * @param array $optionalArgs { + * Optional. + * + * @type AdvancedVoiceOptions $advancedVoiceOptions + * Advanced voice options. + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return \Google\Cloud\TextToSpeech\V1\SynthesizeSpeechResponse + * + * @throws ApiException if the remote call fails + */ + public function synthesizeSpeech($input, $voice, $audioConfig, array $optionalArgs = []) + { + $request = new SynthesizeSpeechRequest(); + $request->setInput($input); + $request->setVoice($voice); + $request->setAudioConfig($audioConfig); + if (isset($optionalArgs['advancedVoiceOptions'])) { + $request->setAdvancedVoiceOptions($optionalArgs['advancedVoiceOptions']); + } + + return $this->startCall('SynthesizeSpeech', SynthesizeSpeechResponse::class, $optionalArgs, $request)->wait(); + } +} diff --git a/owl-bot-staging/TextToSpeech/v1/src/V1/Gapic/TextToSpeechLongAudioSynthesizeGapicClient.php b/owl-bot-staging/TextToSpeech/v1/src/V1/Gapic/TextToSpeechLongAudioSynthesizeGapicClient.php new file mode 100644 index 000000000000..17fc72e734fa --- /dev/null +++ b/owl-bot-staging/TextToSpeech/v1/src/V1/Gapic/TextToSpeechLongAudioSynthesizeGapicClient.php @@ -0,0 +1,403 @@ +synthesizeLongAudio($input, $audioConfig); + * $operationResponse->pollUntilComplete(); + * if ($operationResponse->operationSucceeded()) { + * $result = $operationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $operationResponse->getError(); + * // handleError($error) + * } + * // Alternatively: + * // start the operation, keep the operation name, and resume later + * $operationResponse = $textToSpeechLongAudioSynthesizeClient->synthesizeLongAudio($input, $audioConfig); + * $operationName = $operationResponse->getName(); + * // ... do other work + * $newOperationResponse = $textToSpeechLongAudioSynthesizeClient->resumeOperation($operationName, 'synthesizeLongAudio'); + * while (!$newOperationResponse->isDone()) { + * // ... do other work + * $newOperationResponse->reload(); + * } + * if ($newOperationResponse->operationSucceeded()) { + * $result = $newOperationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $newOperationResponse->getError(); + * // handleError($error) + * } + * } finally { + * $textToSpeechLongAudioSynthesizeClient->close(); + * } + * ``` + * + * Many parameters require resource names to be formatted in a particular way. To + * assist with these names, this class includes a format method for each type of + * name, and additionally a parseName method to extract the individual identifiers + * contained within formatted names that are returned by the API. + * + * @deprecated Please use the new service client {@see \Google\Cloud\TextToSpeech\V1\Client\TextToSpeechLongAudioSynthesizeClient}. + */ +class TextToSpeechLongAudioSynthesizeGapicClient +{ + use GapicClientTrait; + + /** The name of the service. */ + const SERVICE_NAME = 'google.cloud.texttospeech.v1.TextToSpeechLongAudioSynthesize'; + + /** + * The default address of the service. + * + * @deprecated SERVICE_ADDRESS_TEMPLATE should be used instead. + */ + const SERVICE_ADDRESS = 'texttospeech.googleapis.com'; + + /** The address template of the service. */ + private const SERVICE_ADDRESS_TEMPLATE = 'texttospeech.UNIVERSE_DOMAIN'; + + /** The default port of the service. */ + const DEFAULT_SERVICE_PORT = 443; + + /** The name of the code generator, to be included in the agent header. */ + const CODEGEN_NAME = 'gapic'; + + /** The default scopes required by the service. */ + public static $serviceScopes = [ + 'https://www.googleapis.com/auth/cloud-platform', + ]; + + private static $modelNameTemplate; + + private static $pathTemplateMap; + + private $operationsClient; + + private static function getClientDefaults() + { + return [ + 'serviceName' => self::SERVICE_NAME, + 'apiEndpoint' => self::SERVICE_ADDRESS . ':' . self::DEFAULT_SERVICE_PORT, + 'clientConfig' => __DIR__ . '/../resources/text_to_speech_long_audio_synthesize_client_config.json', + 'descriptorsConfigPath' => __DIR__ . '/../resources/text_to_speech_long_audio_synthesize_descriptor_config.php', + 'gcpApiConfigPath' => __DIR__ . '/../resources/text_to_speech_long_audio_synthesize_grpc_config.json', + 'credentialsConfig' => [ + 'defaultScopes' => self::$serviceScopes, + ], + 'transportConfig' => [ + 'rest' => [ + 'restClientConfigPath' => __DIR__ . '/../resources/text_to_speech_long_audio_synthesize_rest_client_config.php', + ], + ], + ]; + } + + private static function getModelNameTemplate() + { + if (self::$modelNameTemplate == null) { + self::$modelNameTemplate = new PathTemplate('projects/{project}/locations/{location}/models/{model}'); + } + + return self::$modelNameTemplate; + } + + private static function getPathTemplateMap() + { + if (self::$pathTemplateMap == null) { + self::$pathTemplateMap = [ + 'model' => self::getModelNameTemplate(), + ]; + } + + return self::$pathTemplateMap; + } + + /** + * Formats a string containing the fully-qualified path to represent a model + * resource. + * + * @param string $project + * @param string $location + * @param string $model + * + * @return string The formatted model resource. + */ + public static function modelName($project, $location, $model) + { + return self::getModelNameTemplate()->render([ + 'project' => $project, + 'location' => $location, + 'model' => $model, + ]); + } + + /** + * Parses a formatted name string and returns an associative array of the components in the name. + * The following name formats are supported: + * Template: Pattern + * - model: projects/{project}/locations/{location}/models/{model} + * + * The optional $template argument can be supplied to specify a particular pattern, + * and must match one of the templates listed above. If no $template argument is + * provided, or if the $template argument does not match one of the templates + * listed, then parseName will check each of the supported templates, and return + * the first match. + * + * @param string $formattedName The formatted name string + * @param string $template Optional name of template to match + * + * @return array An associative array from name component IDs to component values. + * + * @throws ValidationException If $formattedName could not be matched. + */ + public static function parseName($formattedName, $template = null) + { + $templateMap = self::getPathTemplateMap(); + if ($template) { + if (!isset($templateMap[$template])) { + throw new ValidationException("Template name $template does not exist"); + } + + return $templateMap[$template]->match($formattedName); + } + + foreach ($templateMap as $templateName => $pathTemplate) { + try { + return $pathTemplate->match($formattedName); + } catch (ValidationException $ex) { + // Swallow the exception to continue trying other path templates + } + } + + throw new ValidationException("Input did not match any known format. Input: $formattedName"); + } + + /** + * Return an OperationsClient object with the same endpoint as $this. + * + * @return OperationsClient + */ + public function getOperationsClient() + { + return $this->operationsClient; + } + + /** + * Resume an existing long running operation that was previously started by a long + * running API method. If $methodName is not provided, or does not match a long + * running API method, then the operation can still be resumed, but the + * OperationResponse object will not deserialize the final response. + * + * @param string $operationName The name of the long running operation + * @param string $methodName The name of the method used to start the operation + * + * @return OperationResponse + */ + public function resumeOperation($operationName, $methodName = null) + { + $options = isset($this->descriptors[$methodName]['longRunning']) ? $this->descriptors[$methodName]['longRunning'] : []; + $operation = new OperationResponse($operationName, $this->getOperationsClient(), $options); + $operation->reload(); + return $operation; + } + + /** + * Constructor. + * + * @param array $options { + * Optional. Options for configuring the service API wrapper. + * + * @type string $apiEndpoint + * The address of the API remote host. May optionally include the port, formatted + * as ":". Default 'texttospeech.googleapis.com:443'. + * @type string|array|FetchAuthTokenInterface|CredentialsWrapper $credentials + * The credentials to be used by the client to authorize API calls. This option + * accepts either a path to a credentials file, or a decoded credentials file as a + * PHP array. + * *Advanced usage*: In addition, this option can also accept a pre-constructed + * {@see \Google\Auth\FetchAuthTokenInterface} object or + * {@see \Google\ApiCore\CredentialsWrapper} object. Note that when one of these + * objects are provided, any settings in $credentialsConfig will be ignored. + * @type array $credentialsConfig + * Options used to configure credentials, including auth token caching, for the + * client. For a full list of supporting configuration options, see + * {@see \Google\ApiCore\CredentialsWrapper::build()} . + * @type bool $disableRetries + * Determines whether or not retries defined by the client configuration should be + * disabled. Defaults to `false`. + * @type string|array $clientConfig + * Client method configuration, including retry settings. This option can be either + * a path to a JSON file, or a PHP array containing the decoded JSON data. By + * default this settings points to the default client config file, which is + * provided in the resources folder. + * @type string|TransportInterface $transport + * The transport used for executing network requests. May be either the string + * `rest` or `grpc`. Defaults to `grpc` if gRPC support is detected on the system. + * *Advanced usage*: Additionally, it is possible to pass in an already + * instantiated {@see \Google\ApiCore\Transport\TransportInterface} object. Note + * that when this object is provided, any settings in $transportConfig, and any + * $apiEndpoint setting, will be ignored. + * @type array $transportConfig + * Configuration options that will be used to construct the transport. Options for + * each supported transport type should be passed in a key for that transport. For + * example: + * $transportConfig = [ + * 'grpc' => [...], + * 'rest' => [...], + * ]; + * See the {@see \Google\ApiCore\Transport\GrpcTransport::build()} and + * {@see \Google\ApiCore\Transport\RestTransport::build()} methods for the + * supported options. + * @type callable $clientCertSource + * A callable which returns the client cert as a string. This can be used to + * provide a certificate and private key to the transport layer for mTLS. + * } + * + * @throws ValidationException + */ + public function __construct(array $options = []) + { + $clientOptions = $this->buildClientOptions($options); + $this->setClientOptions($clientOptions); + $this->operationsClient = $this->createOperationsClient($clientOptions); + } + + /** + * Synthesizes long form text asynchronously. + * + * Sample code: + * ``` + * $textToSpeechLongAudioSynthesizeClient = new TextToSpeechLongAudioSynthesizeClient(); + * try { + * $input = new SynthesisInput(); + * $audioConfig = new AudioConfig(); + * $operationResponse = $textToSpeechLongAudioSynthesizeClient->synthesizeLongAudio($input, $audioConfig); + * $operationResponse->pollUntilComplete(); + * if ($operationResponse->operationSucceeded()) { + * $result = $operationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $operationResponse->getError(); + * // handleError($error) + * } + * // Alternatively: + * // start the operation, keep the operation name, and resume later + * $operationResponse = $textToSpeechLongAudioSynthesizeClient->synthesizeLongAudio($input, $audioConfig); + * $operationName = $operationResponse->getName(); + * // ... do other work + * $newOperationResponse = $textToSpeechLongAudioSynthesizeClient->resumeOperation($operationName, 'synthesizeLongAudio'); + * while (!$newOperationResponse->isDone()) { + * // ... do other work + * $newOperationResponse->reload(); + * } + * if ($newOperationResponse->operationSucceeded()) { + * $result = $newOperationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $newOperationResponse->getError(); + * // handleError($error) + * } + * } finally { + * $textToSpeechLongAudioSynthesizeClient->close(); + * } + * ``` + * + * @param SynthesisInput $input Required. The Synthesizer requires either plain text or SSML as input. + * @param AudioConfig $audioConfig Required. The configuration of the synthesized audio. + * @param array $optionalArgs { + * Optional. + * + * @type string $parent + * The resource states of the request in the form of + * `projects/*/locations/*`. + * @type string $outputGcsUri + * Required. Specifies a Cloud Storage URI for the synthesis results. Must be + * specified in the format: `gs://bucket_name/object_name`, and the bucket + * must already exist. + * @type VoiceSelectionParams $voice + * Required. The desired voice of the synthesized audio. + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return \Google\ApiCore\OperationResponse + * + * @throws ApiException if the remote call fails + */ + public function synthesizeLongAudio($input, $audioConfig, array $optionalArgs = []) + { + $request = new SynthesizeLongAudioRequest(); + $requestParamHeaders = []; + $request->setInput($input); + $request->setAudioConfig($audioConfig); + if (isset($optionalArgs['parent'])) { + $request->setParent($optionalArgs['parent']); + $requestParamHeaders['parent'] = $optionalArgs['parent']; + } + + if (isset($optionalArgs['outputGcsUri'])) { + $request->setOutputGcsUri($optionalArgs['outputGcsUri']); + } + + if (isset($optionalArgs['voice'])) { + $request->setVoice($optionalArgs['voice']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startOperationsCall('SynthesizeLongAudio', $optionalArgs, $request, $this->getOperationsClient())->wait(); + } +} diff --git a/owl-bot-staging/TextToSpeech/v1/src/V1/TextToSpeechClient.php b/owl-bot-staging/TextToSpeech/v1/src/V1/TextToSpeechClient.php new file mode 100644 index 000000000000..0942280d0856 --- /dev/null +++ b/owl-bot-staging/TextToSpeech/v1/src/V1/TextToSpeechClient.php @@ -0,0 +1,34 @@ + [ + 'google.cloud.texttospeech.v1.TextToSpeech' => [ + 'ListVoices' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Cloud\TextToSpeech\V1\ListVoicesResponse', + ], + 'StreamingSynthesize' => [ + 'grpcStreaming' => [ + 'grpcStreamingType' => 'BidiStreaming', + ], + 'callType' => \Google\ApiCore\Call::BIDI_STREAMING_CALL, + 'responseType' => 'Google\Cloud\TextToSpeech\V1\StreamingSynthesizeResponse', + ], + 'SynthesizeSpeech' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Cloud\TextToSpeech\V1\SynthesizeSpeechResponse', + ], + 'templateMap' => [ + 'model' => 'projects/{project}/locations/{location}/models/{model}', + ], + ], + ], +]; diff --git a/owl-bot-staging/TextToSpeech/v1/src/V1/resources/text_to_speech_long_audio_synthesize_client_config.json b/owl-bot-staging/TextToSpeech/v1/src/V1/resources/text_to_speech_long_audio_synthesize_client_config.json new file mode 100644 index 000000000000..1f2cda4e7cf5 --- /dev/null +++ b/owl-bot-staging/TextToSpeech/v1/src/V1/resources/text_to_speech_long_audio_synthesize_client_config.json @@ -0,0 +1,37 @@ +{ + "interfaces": { + "google.cloud.texttospeech.v1.TextToSpeechLongAudioSynthesize": { + "retry_codes": { + "no_retry_codes": [], + "no_retry_1_codes": [] + }, + "retry_params": { + "no_retry_params": { + "initial_retry_delay_millis": 0, + "retry_delay_multiplier": 0.0, + "max_retry_delay_millis": 0, + "initial_rpc_timeout_millis": 0, + "rpc_timeout_multiplier": 1.0, + "max_rpc_timeout_millis": 0, + "total_timeout_millis": 0 + }, + "no_retry_1_params": { + "initial_retry_delay_millis": 0, + "retry_delay_multiplier": 0.0, + "max_retry_delay_millis": 0, + "initial_rpc_timeout_millis": 5000000, + "rpc_timeout_multiplier": 1.0, + "max_rpc_timeout_millis": 5000000, + "total_timeout_millis": 5000000 + } + }, + "methods": { + "SynthesizeLongAudio": { + "timeout_millis": 5000000, + "retry_codes_name": "no_retry_1_codes", + "retry_params_name": "no_retry_1_params" + } + } + } + } +} diff --git a/owl-bot-staging/TextToSpeech/v1/src/V1/resources/text_to_speech_long_audio_synthesize_descriptor_config.php b/owl-bot-staging/TextToSpeech/v1/src/V1/resources/text_to_speech_long_audio_synthesize_descriptor_config.php new file mode 100644 index 000000000000..63aa9b8d0232 --- /dev/null +++ b/owl-bot-staging/TextToSpeech/v1/src/V1/resources/text_to_speech_long_audio_synthesize_descriptor_config.php @@ -0,0 +1,50 @@ + [ + 'google.cloud.texttospeech.v1.TextToSpeechLongAudioSynthesize' => [ + 'SynthesizeLongAudio' => [ + 'longRunning' => [ + 'operationReturnType' => '\Google\Cloud\TextToSpeech\V1\SynthesizeLongAudioResponse', + 'metadataReturnType' => '\Google\Cloud\TextToSpeech\V1\SynthesizeLongAudioMetadata', + 'initialPollDelayMillis' => '500', + 'pollDelayMultiplier' => '1.5', + 'maxPollDelayMillis' => '5000', + 'totalPollTimeoutMillis' => '300000', + ], + 'callType' => \Google\ApiCore\Call::LONGRUNNING_CALL, + 'headerParams' => [ + [ + 'keyName' => 'parent', + 'fieldAccessors' => [ + 'getParent', + ], + ], + ], + ], + 'templateMap' => [ + 'model' => 'projects/{project}/locations/{location}/models/{model}', + ], + ], + ], +]; diff --git a/owl-bot-staging/TextToSpeech/v1/src/V1/resources/text_to_speech_long_audio_synthesize_rest_client_config.php b/owl-bot-staging/TextToSpeech/v1/src/V1/resources/text_to_speech_long_audio_synthesize_rest_client_config.php new file mode 100644 index 000000000000..690fa540c6d7 --- /dev/null +++ b/owl-bot-staging/TextToSpeech/v1/src/V1/resources/text_to_speech_long_audio_synthesize_rest_client_config.php @@ -0,0 +1,65 @@ + [ + 'google.cloud.texttospeech.v1.TextToSpeechLongAudioSynthesize' => [ + 'SynthesizeLongAudio' => [ + 'method' => 'post', + 'uriTemplate' => '/v1/{parent=projects/*/locations/*}:synthesizeLongAudio', + 'body' => '*', + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + ], + ], + 'google.longrunning.Operations' => [ + 'GetOperation' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/operations/*}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'ListOperations' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=projects/*/locations/*}/operations', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + ], + ], + 'numericEnums' => true, +]; diff --git a/owl-bot-staging/TextToSpeech/v1/src/V1/resources/text_to_speech_rest_client_config.php b/owl-bot-staging/TextToSpeech/v1/src/V1/resources/text_to_speech_rest_client_config.php new file mode 100644 index 000000000000..7014d6557556 --- /dev/null +++ b/owl-bot-staging/TextToSpeech/v1/src/V1/resources/text_to_speech_rest_client_config.php @@ -0,0 +1,62 @@ + [ + 'google.cloud.texttospeech.v1.TextToSpeech' => [ + 'ListVoices' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/voices', + ], + 'SynthesizeSpeech' => [ + 'method' => 'post', + 'uriTemplate' => '/v1/text:synthesize', + 'body' => '*', + ], + ], + 'google.longrunning.Operations' => [ + 'GetOperation' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/operations/*}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'ListOperations' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=projects/*/locations/*}/operations', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + ], + ], + 'numericEnums' => true, +]; diff --git a/owl-bot-staging/TextToSpeech/v1/tests/Unit/V1/Client/TextToSpeechClientTest.php b/owl-bot-staging/TextToSpeech/v1/tests/Unit/V1/Client/TextToSpeechClientTest.php new file mode 100644 index 000000000000..f2e456c2a51a --- /dev/null +++ b/owl-bot-staging/TextToSpeech/v1/tests/Unit/V1/Client/TextToSpeechClientTest.php @@ -0,0 +1,325 @@ +getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); + } + + /** @return TextToSpeechClient */ + private function createClient(array $options = []) + { + $options += [ + 'credentials' => $this->createCredentials(), + ]; + return new TextToSpeechClient($options); + } + + /** @test */ + public function listVoicesTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $expectedResponse = new ListVoicesResponse(); + $transport->addResponse($expectedResponse); + $request = new ListVoicesRequest(); + $response = $gapicClient->listVoices($request); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.texttospeech.v1.TextToSpeech/ListVoices', $actualFuncCall); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listVoicesExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + $request = new ListVoicesRequest(); + try { + $gapicClient->listVoices($request); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function streamingSynthesizeTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $audioContent = '16'; + $expectedResponse = new StreamingSynthesizeResponse(); + $expectedResponse->setAudioContent($audioContent); + $transport->addResponse($expectedResponse); + $audioContent2 = '-61'; + $expectedResponse2 = new StreamingSynthesizeResponse(); + $expectedResponse2->setAudioContent($audioContent2); + $transport->addResponse($expectedResponse2); + $audioContent3 = '-60'; + $expectedResponse3 = new StreamingSynthesizeResponse(); + $expectedResponse3->setAudioContent($audioContent3); + $transport->addResponse($expectedResponse3); + // Mock request + $request = new StreamingSynthesizeRequest(); + $request2 = new StreamingSynthesizeRequest(); + $request3 = new StreamingSynthesizeRequest(); + $bidi = $gapicClient->streamingSynthesize(); + $this->assertInstanceOf(BidiStream::class, $bidi); + $bidi->write($request); + $responses = []; + $responses[] = $bidi->read(); + $bidi->writeAll([ + $request2, + $request3, + ]); + foreach ($bidi->closeWriteAndReadAll() as $response) { + $responses[] = $response; + } + + $expectedResponses = []; + $expectedResponses[] = $expectedResponse; + $expectedResponses[] = $expectedResponse2; + $expectedResponses[] = $expectedResponse3; + $this->assertEquals($expectedResponses, $responses); + $createStreamRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($createStreamRequests)); + $streamFuncCall = $createStreamRequests[0]->getFuncCall(); + $streamRequestObject = $createStreamRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.texttospeech.v1.TextToSpeech/StreamingSynthesize', $streamFuncCall); + $this->assertNull($streamRequestObject); + $callObjects = $transport->popCallObjects(); + $this->assertSame(1, count($callObjects)); + $bidiCall = $callObjects[0]; + $writeRequests = $bidiCall->popReceivedCalls(); + $expectedRequests = []; + $expectedRequests[] = $request; + $expectedRequests[] = $request2; + $expectedRequests[] = $request3; + $this->assertEquals($expectedRequests, $writeRequests); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function streamingSynthesizeExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->setStreamingStatus($status); + $this->assertTrue($transport->isExhausted()); + $bidi = $gapicClient->streamingSynthesize(); + $results = $bidi->closeWriteAndReadAll(); + try { + iterator_to_array($results); + // If the close stream method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function synthesizeSpeechTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $audioContent = '16'; + $expectedResponse = new SynthesizeSpeechResponse(); + $expectedResponse->setAudioContent($audioContent); + $transport->addResponse($expectedResponse); + // Mock request + $input = new SynthesisInput(); + $voice = new VoiceSelectionParams(); + $voiceLanguageCode = 'voiceLanguageCode-686472265'; + $voice->setLanguageCode($voiceLanguageCode); + $audioConfig = new AudioConfig(); + $audioConfigAudioEncoding = AudioEncoding::AUDIO_ENCODING_UNSPECIFIED; + $audioConfig->setAudioEncoding($audioConfigAudioEncoding); + $request = (new SynthesizeSpeechRequest()) + ->setInput($input) + ->setVoice($voice) + ->setAudioConfig($audioConfig); + $response = $gapicClient->synthesizeSpeech($request); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.texttospeech.v1.TextToSpeech/SynthesizeSpeech', $actualFuncCall); + $actualValue = $actualRequestObject->getInput(); + $this->assertProtobufEquals($input, $actualValue); + $actualValue = $actualRequestObject->getVoice(); + $this->assertProtobufEquals($voice, $actualValue); + $actualValue = $actualRequestObject->getAudioConfig(); + $this->assertProtobufEquals($audioConfig, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function synthesizeSpeechExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + // Mock request + $input = new SynthesisInput(); + $voice = new VoiceSelectionParams(); + $voiceLanguageCode = 'voiceLanguageCode-686472265'; + $voice->setLanguageCode($voiceLanguageCode); + $audioConfig = new AudioConfig(); + $audioConfigAudioEncoding = AudioEncoding::AUDIO_ENCODING_UNSPECIFIED; + $audioConfig->setAudioEncoding($audioConfigAudioEncoding); + $request = (new SynthesizeSpeechRequest()) + ->setInput($input) + ->setVoice($voice) + ->setAudioConfig($audioConfig); + try { + $gapicClient->synthesizeSpeech($request); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listVoicesAsyncTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $expectedResponse = new ListVoicesResponse(); + $transport->addResponse($expectedResponse); + $request = new ListVoicesRequest(); + $response = $gapicClient->listVoicesAsync($request)->wait(); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.texttospeech.v1.TextToSpeech/ListVoices', $actualFuncCall); + $this->assertTrue($transport->isExhausted()); + } +} diff --git a/owl-bot-staging/TextToSpeech/v1/tests/Unit/V1/Client/TextToSpeechLongAudioSynthesizeClientTest.php b/owl-bot-staging/TextToSpeech/v1/tests/Unit/V1/Client/TextToSpeechLongAudioSynthesizeClientTest.php new file mode 100644 index 000000000000..ca56e0e2c179 --- /dev/null +++ b/owl-bot-staging/TextToSpeech/v1/tests/Unit/V1/Client/TextToSpeechLongAudioSynthesizeClientTest.php @@ -0,0 +1,270 @@ +getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); + } + + /** @return TextToSpeechLongAudioSynthesizeClient */ + private function createClient(array $options = []) + { + $options += [ + 'credentials' => $this->createCredentials(), + ]; + return new TextToSpeechLongAudioSynthesizeClient($options); + } + + /** @test */ + public function synthesizeLongAudioTest() + { + $operationsTransport = $this->createTransport(); + $operationsClient = new OperationsClient([ + 'apiEndpoint' => '', + 'transport' => $operationsTransport, + 'credentials' => $this->createCredentials(), + ]); + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + 'operationsClient' => $operationsClient, + ]); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + // Mock response + $incompleteOperation = new Operation(); + $incompleteOperation->setName('operations/synthesizeLongAudioTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $expectedResponse = new SynthesizeLongAudioResponse(); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/synthesizeLongAudioTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $input = new SynthesisInput(); + $audioConfig = new AudioConfig(); + $audioConfigAudioEncoding = AudioEncoding::AUDIO_ENCODING_UNSPECIFIED; + $audioConfig->setAudioEncoding($audioConfigAudioEncoding); + $request = (new SynthesizeLongAudioRequest()) + ->setInput($input) + ->setAudioConfig($audioConfig); + $response = $gapicClient->synthesizeLongAudio($request); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $apiRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($apiRequests)); + $operationsRequestsEmpty = $operationsTransport->popReceivedCalls(); + $this->assertSame(0, count($operationsRequestsEmpty)); + $actualApiFuncCall = $apiRequests[0]->getFuncCall(); + $actualApiRequestObject = $apiRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.texttospeech.v1.TextToSpeechLongAudioSynthesize/SynthesizeLongAudio', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getInput(); + $this->assertProtobufEquals($input, $actualValue); + $actualValue = $actualApiRequestObject->getAudioConfig(); + $this->assertProtobufEquals($audioConfig, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/synthesizeLongAudioTest'); + $response->pollUntilComplete([ + 'initialPollDelayMillis' => 1, + ]); + $this->assertTrue($response->isDone()); + $this->assertEquals($expectedResponse, $response->getResult()); + $apiRequestsEmpty = $transport->popReceivedCalls(); + $this->assertSame(0, count($apiRequestsEmpty)); + $operationsRequests = $operationsTransport->popReceivedCalls(); + $this->assertSame(1, count($operationsRequests)); + $actualOperationsFuncCall = $operationsRequests[0]->getFuncCall(); + $actualOperationsRequestObject = $operationsRequests[0]->getRequestObject(); + $this->assertSame('/google.longrunning.Operations/GetOperation', $actualOperationsFuncCall); + $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + } + + /** @test */ + public function synthesizeLongAudioExceptionTest() + { + $operationsTransport = $this->createTransport(); + $operationsClient = new OperationsClient([ + 'apiEndpoint' => '', + 'transport' => $operationsTransport, + 'credentials' => $this->createCredentials(), + ]); + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + 'operationsClient' => $operationsClient, + ]); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + // Mock response + $incompleteOperation = new Operation(); + $incompleteOperation->setName('operations/synthesizeLongAudioTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $operationsTransport->addResponse(null, $status); + // Mock request + $input = new SynthesisInput(); + $audioConfig = new AudioConfig(); + $audioConfigAudioEncoding = AudioEncoding::AUDIO_ENCODING_UNSPECIFIED; + $audioConfig->setAudioEncoding($audioConfigAudioEncoding); + $request = (new SynthesizeLongAudioRequest()) + ->setInput($input) + ->setAudioConfig($audioConfig); + $response = $gapicClient->synthesizeLongAudio($request); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/synthesizeLongAudioTest'); + try { + $response->pollUntilComplete([ + 'initialPollDelayMillis' => 1, + ]); + // If the pollUntilComplete() method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stubs are exhausted + $transport->popReceivedCalls(); + $operationsTransport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + } + + /** @test */ + public function synthesizeLongAudioAsyncTest() + { + $operationsTransport = $this->createTransport(); + $operationsClient = new OperationsClient([ + 'apiEndpoint' => '', + 'transport' => $operationsTransport, + 'credentials' => $this->createCredentials(), + ]); + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + 'operationsClient' => $operationsClient, + ]); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + // Mock response + $incompleteOperation = new Operation(); + $incompleteOperation->setName('operations/synthesizeLongAudioTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $expectedResponse = new SynthesizeLongAudioResponse(); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/synthesizeLongAudioTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $input = new SynthesisInput(); + $audioConfig = new AudioConfig(); + $audioConfigAudioEncoding = AudioEncoding::AUDIO_ENCODING_UNSPECIFIED; + $audioConfig->setAudioEncoding($audioConfigAudioEncoding); + $request = (new SynthesizeLongAudioRequest()) + ->setInput($input) + ->setAudioConfig($audioConfig); + $response = $gapicClient->synthesizeLongAudioAsync($request)->wait(); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $apiRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($apiRequests)); + $operationsRequestsEmpty = $operationsTransport->popReceivedCalls(); + $this->assertSame(0, count($operationsRequestsEmpty)); + $actualApiFuncCall = $apiRequests[0]->getFuncCall(); + $actualApiRequestObject = $apiRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.texttospeech.v1.TextToSpeechLongAudioSynthesize/SynthesizeLongAudio', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getInput(); + $this->assertProtobufEquals($input, $actualValue); + $actualValue = $actualApiRequestObject->getAudioConfig(); + $this->assertProtobufEquals($audioConfig, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/synthesizeLongAudioTest'); + $response->pollUntilComplete([ + 'initialPollDelayMillis' => 1, + ]); + $this->assertTrue($response->isDone()); + $this->assertEquals($expectedResponse, $response->getResult()); + $apiRequestsEmpty = $transport->popReceivedCalls(); + $this->assertSame(0, count($apiRequestsEmpty)); + $operationsRequests = $operationsTransport->popReceivedCalls(); + $this->assertSame(1, count($operationsRequests)); + $actualOperationsFuncCall = $operationsRequests[0]->getFuncCall(); + $actualOperationsRequestObject = $operationsRequests[0]->getRequestObject(); + $this->assertSame('/google.longrunning.Operations/GetOperation', $actualOperationsFuncCall); + $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + } +} diff --git a/owl-bot-staging/TextToSpeech/v1/tests/Unit/V1/TextToSpeechClientTest.php b/owl-bot-staging/TextToSpeech/v1/tests/Unit/V1/TextToSpeechClientTest.php new file mode 100644 index 000000000000..5692c96e6075 --- /dev/null +++ b/owl-bot-staging/TextToSpeech/v1/tests/Unit/V1/TextToSpeechClientTest.php @@ -0,0 +1,291 @@ +getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); + } + + /** @return TextToSpeechClient */ + private function createClient(array $options = []) + { + $options += [ + 'credentials' => $this->createCredentials(), + ]; + return new TextToSpeechClient($options); + } + + /** @test */ + public function listVoicesTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $expectedResponse = new ListVoicesResponse(); + $transport->addResponse($expectedResponse); + $response = $gapicClient->listVoices(); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.texttospeech.v1.TextToSpeech/ListVoices', $actualFuncCall); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listVoicesExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + try { + $gapicClient->listVoices(); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function streamingSynthesizeTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $audioContent = '16'; + $expectedResponse = new StreamingSynthesizeResponse(); + $expectedResponse->setAudioContent($audioContent); + $transport->addResponse($expectedResponse); + $audioContent2 = '-61'; + $expectedResponse2 = new StreamingSynthesizeResponse(); + $expectedResponse2->setAudioContent($audioContent2); + $transport->addResponse($expectedResponse2); + $audioContent3 = '-60'; + $expectedResponse3 = new StreamingSynthesizeResponse(); + $expectedResponse3->setAudioContent($audioContent3); + $transport->addResponse($expectedResponse3); + // Mock request + $request = new StreamingSynthesizeRequest(); + $request2 = new StreamingSynthesizeRequest(); + $request3 = new StreamingSynthesizeRequest(); + $bidi = $gapicClient->streamingSynthesize(); + $this->assertInstanceOf(BidiStream::class, $bidi); + $bidi->write($request); + $responses = []; + $responses[] = $bidi->read(); + $bidi->writeAll([ + $request2, + $request3, + ]); + foreach ($bidi->closeWriteAndReadAll() as $response) { + $responses[] = $response; + } + + $expectedResponses = []; + $expectedResponses[] = $expectedResponse; + $expectedResponses[] = $expectedResponse2; + $expectedResponses[] = $expectedResponse3; + $this->assertEquals($expectedResponses, $responses); + $createStreamRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($createStreamRequests)); + $streamFuncCall = $createStreamRequests[0]->getFuncCall(); + $streamRequestObject = $createStreamRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.texttospeech.v1.TextToSpeech/StreamingSynthesize', $streamFuncCall); + $this->assertNull($streamRequestObject); + $callObjects = $transport->popCallObjects(); + $this->assertSame(1, count($callObjects)); + $bidiCall = $callObjects[0]; + $writeRequests = $bidiCall->popReceivedCalls(); + $expectedRequests = []; + $expectedRequests[] = $request; + $expectedRequests[] = $request2; + $expectedRequests[] = $request3; + $this->assertEquals($expectedRequests, $writeRequests); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function streamingSynthesizeExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->setStreamingStatus($status); + $this->assertTrue($transport->isExhausted()); + $bidi = $gapicClient->streamingSynthesize(); + $results = $bidi->closeWriteAndReadAll(); + try { + iterator_to_array($results); + // If the close stream method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function synthesizeSpeechTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $audioContent = '16'; + $expectedResponse = new SynthesizeSpeechResponse(); + $expectedResponse->setAudioContent($audioContent); + $transport->addResponse($expectedResponse); + // Mock request + $input = new SynthesisInput(); + $voice = new VoiceSelectionParams(); + $voiceLanguageCode = 'voiceLanguageCode-686472265'; + $voice->setLanguageCode($voiceLanguageCode); + $audioConfig = new AudioConfig(); + $audioConfigAudioEncoding = AudioEncoding::AUDIO_ENCODING_UNSPECIFIED; + $audioConfig->setAudioEncoding($audioConfigAudioEncoding); + $response = $gapicClient->synthesizeSpeech($input, $voice, $audioConfig); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.texttospeech.v1.TextToSpeech/SynthesizeSpeech', $actualFuncCall); + $actualValue = $actualRequestObject->getInput(); + $this->assertProtobufEquals($input, $actualValue); + $actualValue = $actualRequestObject->getVoice(); + $this->assertProtobufEquals($voice, $actualValue); + $actualValue = $actualRequestObject->getAudioConfig(); + $this->assertProtobufEquals($audioConfig, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function synthesizeSpeechExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + // Mock request + $input = new SynthesisInput(); + $voice = new VoiceSelectionParams(); + $voiceLanguageCode = 'voiceLanguageCode-686472265'; + $voice->setLanguageCode($voiceLanguageCode); + $audioConfig = new AudioConfig(); + $audioConfigAudioEncoding = AudioEncoding::AUDIO_ENCODING_UNSPECIFIED; + $audioConfig->setAudioEncoding($audioConfigAudioEncoding); + try { + $gapicClient->synthesizeSpeech($input, $voice, $audioConfig); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } +} diff --git a/owl-bot-staging/TextToSpeech/v1/tests/Unit/V1/TextToSpeechLongAudioSynthesizeClientTest.php b/owl-bot-staging/TextToSpeech/v1/tests/Unit/V1/TextToSpeechLongAudioSynthesizeClientTest.php new file mode 100644 index 000000000000..0b386e4c2de0 --- /dev/null +++ b/owl-bot-staging/TextToSpeech/v1/tests/Unit/V1/TextToSpeechLongAudioSynthesizeClientTest.php @@ -0,0 +1,193 @@ +getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); + } + + /** @return TextToSpeechLongAudioSynthesizeClient */ + private function createClient(array $options = []) + { + $options += [ + 'credentials' => $this->createCredentials(), + ]; + return new TextToSpeechLongAudioSynthesizeClient($options); + } + + /** @test */ + public function synthesizeLongAudioTest() + { + $operationsTransport = $this->createTransport(); + $operationsClient = new OperationsClient([ + 'apiEndpoint' => '', + 'transport' => $operationsTransport, + 'credentials' => $this->createCredentials(), + ]); + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + 'operationsClient' => $operationsClient, + ]); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + // Mock response + $incompleteOperation = new Operation(); + $incompleteOperation->setName('operations/synthesizeLongAudioTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $expectedResponse = new SynthesizeLongAudioResponse(); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/synthesizeLongAudioTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $input = new SynthesisInput(); + $audioConfig = new AudioConfig(); + $audioConfigAudioEncoding = AudioEncoding::AUDIO_ENCODING_UNSPECIFIED; + $audioConfig->setAudioEncoding($audioConfigAudioEncoding); + $response = $gapicClient->synthesizeLongAudio($input, $audioConfig); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $apiRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($apiRequests)); + $operationsRequestsEmpty = $operationsTransport->popReceivedCalls(); + $this->assertSame(0, count($operationsRequestsEmpty)); + $actualApiFuncCall = $apiRequests[0]->getFuncCall(); + $actualApiRequestObject = $apiRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.texttospeech.v1.TextToSpeechLongAudioSynthesize/SynthesizeLongAudio', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getInput(); + $this->assertProtobufEquals($input, $actualValue); + $actualValue = $actualApiRequestObject->getAudioConfig(); + $this->assertProtobufEquals($audioConfig, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/synthesizeLongAudioTest'); + $response->pollUntilComplete([ + 'initialPollDelayMillis' => 1, + ]); + $this->assertTrue($response->isDone()); + $this->assertEquals($expectedResponse, $response->getResult()); + $apiRequestsEmpty = $transport->popReceivedCalls(); + $this->assertSame(0, count($apiRequestsEmpty)); + $operationsRequests = $operationsTransport->popReceivedCalls(); + $this->assertSame(1, count($operationsRequests)); + $actualOperationsFuncCall = $operationsRequests[0]->getFuncCall(); + $actualOperationsRequestObject = $operationsRequests[0]->getRequestObject(); + $this->assertSame('/google.longrunning.Operations/GetOperation', $actualOperationsFuncCall); + $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + } + + /** @test */ + public function synthesizeLongAudioExceptionTest() + { + $operationsTransport = $this->createTransport(); + $operationsClient = new OperationsClient([ + 'apiEndpoint' => '', + 'transport' => $operationsTransport, + 'credentials' => $this->createCredentials(), + ]); + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + 'operationsClient' => $operationsClient, + ]); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + // Mock response + $incompleteOperation = new Operation(); + $incompleteOperation->setName('operations/synthesizeLongAudioTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $operationsTransport->addResponse(null, $status); + // Mock request + $input = new SynthesisInput(); + $audioConfig = new AudioConfig(); + $audioConfigAudioEncoding = AudioEncoding::AUDIO_ENCODING_UNSPECIFIED; + $audioConfig->setAudioEncoding($audioConfigAudioEncoding); + $response = $gapicClient->synthesizeLongAudio($input, $audioConfig); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/synthesizeLongAudioTest'); + try { + $response->pollUntilComplete([ + 'initialPollDelayMillis' => 1, + ]); + // If the pollUntilComplete() method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stubs are exhausted + $transport->popReceivedCalls(); + $operationsTransport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + } +} From 1a016b3d9ae91e926ec288b5dbb2f8192310a984 Mon Sep 17 00:00:00 2001 From: Owl Bot Date: Tue, 22 Oct 2024 14:03:26 +0000 Subject: [PATCH 2/2] =?UTF-8?q?=F0=9F=A6=89=20Updates=20from=20OwlBot=20po?= =?UTF-8?q?st-processor?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md --- TextToSpeech/metadata/V1/CloudTts.php | Bin 4560 -> 4683 bytes TextToSpeech/metadata/V1/CloudTtsLrs.php | 6 +- .../src}/V1/VoiceCloneParams.php | 2 +- TextToSpeech/src/V1/VoiceSelectionParams.php | 52 +++ .../Google/Cloud/Texttospeech/V1/CloudTts.php | Bin 4683 -> 0 bytes .../Cloud/Texttospeech/V1/CloudTtsLrs.php | 49 --- .../TextToSpeech/V1/AdvancedVoiceOptions.php | 81 ---- .../Cloud/TextToSpeech/V1/AudioConfig.php | 329 -------------- .../Cloud/TextToSpeech/V1/AudioEncoding.php | 90 ---- .../V1/CustomPronunciationParams.php | 177 -------- .../PhoneticEncoding.php | 66 --- .../TextToSpeech/V1/CustomPronunciations.php | 67 --- .../TextToSpeech/V1/CustomVoiceParams.php | 106 ----- .../V1/CustomVoiceParams/ReportedUsage.php | 68 --- .../TextToSpeech/V1/ListVoicesRequest.php | 115 ----- .../TextToSpeech/V1/ListVoicesResponse.php | 67 --- .../Cloud/TextToSpeech/V1/SsmlVoiceGender.php | 73 ---- .../V1/StreamingSynthesisInput.php | 84 ---- .../V1/StreamingSynthesizeConfig.php | 77 ---- .../V1/StreamingSynthesizeRequest.php | 118 ----- .../V1/StreamingSynthesizeResponse.php | 73 ---- .../Cloud/TextToSpeech/V1/SynthesisInput.php | 203 --------- .../V1/SynthesizeLongAudioMetadata.php | 162 ------- .../V1/SynthesizeLongAudioRequest.php | 246 ----------- .../V1/SynthesizeLongAudioResponse.php | 33 -- .../V1/SynthesizeSpeechRequest.php | 226 ---------- .../V1/SynthesizeSpeechResponse.php | 83 ---- .../Google/Cloud/TextToSpeech/V1/Voice.php | 177 -------- .../TextToSpeech/V1/VoiceSelectionParams.php | 303 ------------- .../V1/TextToSpeechClient/list_voices.php | 57 --- .../streaming_synthesize.php | 64 --- .../TextToSpeechClient/synthesize_speech.php | 94 ---- .../synthesize_long_audio.php | 89 ---- .../v1/src/V1/Client/TextToSpeechClient.php | 292 ------------- .../TextToSpeechLongAudioSynthesizeClient.php | 274 ------------ .../src/V1/Gapic/TextToSpeechGapicClient.php | 412 ------------------ ...ToSpeechLongAudioSynthesizeGapicClient.php | 403 ----------------- .../v1/src/V1/TextToSpeechClient.php | 34 -- .../TextToSpeechLongAudioSynthesizeClient.php | 34 -- .../v1/src/V1/gapic_metadata.json | 47 -- .../text_to_speech_client_config.json | 58 --- .../text_to_speech_descriptor_config.php | 46 -- ...h_long_audio_synthesize_client_config.json | 37 -- ...ong_audio_synthesize_descriptor_config.php | 50 --- ...ng_audio_synthesize_rest_client_config.php | 65 --- .../text_to_speech_rest_client_config.php | 62 --- .../Unit/V1/Client/TextToSpeechClientTest.php | 325 -------------- ...tToSpeechLongAudioSynthesizeClientTest.php | 270 ------------ .../tests/Unit/V1/TextToSpeechClientTest.php | 291 ------------- ...tToSpeechLongAudioSynthesizeClientTest.php | 193 -------- 50 files changed, 56 insertions(+), 6274 deletions(-) rename {owl-bot-staging/TextToSpeech/v1/proto/src/Google/Cloud/TextToSpeech => TextToSpeech/src}/V1/VoiceCloneParams.php (97%) delete mode 100644 owl-bot-staging/TextToSpeech/v1/proto/src/GPBMetadata/Google/Cloud/Texttospeech/V1/CloudTts.php delete mode 100644 owl-bot-staging/TextToSpeech/v1/proto/src/GPBMetadata/Google/Cloud/Texttospeech/V1/CloudTtsLrs.php delete mode 100644 owl-bot-staging/TextToSpeech/v1/proto/src/Google/Cloud/TextToSpeech/V1/AdvancedVoiceOptions.php delete mode 100644 owl-bot-staging/TextToSpeech/v1/proto/src/Google/Cloud/TextToSpeech/V1/AudioConfig.php delete mode 100644 owl-bot-staging/TextToSpeech/v1/proto/src/Google/Cloud/TextToSpeech/V1/AudioEncoding.php delete mode 100644 owl-bot-staging/TextToSpeech/v1/proto/src/Google/Cloud/TextToSpeech/V1/CustomPronunciationParams.php delete mode 100644 owl-bot-staging/TextToSpeech/v1/proto/src/Google/Cloud/TextToSpeech/V1/CustomPronunciationParams/PhoneticEncoding.php delete mode 100644 owl-bot-staging/TextToSpeech/v1/proto/src/Google/Cloud/TextToSpeech/V1/CustomPronunciations.php delete mode 100644 owl-bot-staging/TextToSpeech/v1/proto/src/Google/Cloud/TextToSpeech/V1/CustomVoiceParams.php delete mode 100644 owl-bot-staging/TextToSpeech/v1/proto/src/Google/Cloud/TextToSpeech/V1/CustomVoiceParams/ReportedUsage.php delete mode 100644 owl-bot-staging/TextToSpeech/v1/proto/src/Google/Cloud/TextToSpeech/V1/ListVoicesRequest.php delete mode 100644 owl-bot-staging/TextToSpeech/v1/proto/src/Google/Cloud/TextToSpeech/V1/ListVoicesResponse.php delete mode 100644 owl-bot-staging/TextToSpeech/v1/proto/src/Google/Cloud/TextToSpeech/V1/SsmlVoiceGender.php delete mode 100644 owl-bot-staging/TextToSpeech/v1/proto/src/Google/Cloud/TextToSpeech/V1/StreamingSynthesisInput.php delete mode 100644 owl-bot-staging/TextToSpeech/v1/proto/src/Google/Cloud/TextToSpeech/V1/StreamingSynthesizeConfig.php delete mode 100644 owl-bot-staging/TextToSpeech/v1/proto/src/Google/Cloud/TextToSpeech/V1/StreamingSynthesizeRequest.php delete mode 100644 owl-bot-staging/TextToSpeech/v1/proto/src/Google/Cloud/TextToSpeech/V1/StreamingSynthesizeResponse.php delete mode 100644 owl-bot-staging/TextToSpeech/v1/proto/src/Google/Cloud/TextToSpeech/V1/SynthesisInput.php delete mode 100644 owl-bot-staging/TextToSpeech/v1/proto/src/Google/Cloud/TextToSpeech/V1/SynthesizeLongAudioMetadata.php delete mode 100644 owl-bot-staging/TextToSpeech/v1/proto/src/Google/Cloud/TextToSpeech/V1/SynthesizeLongAudioRequest.php delete mode 100644 owl-bot-staging/TextToSpeech/v1/proto/src/Google/Cloud/TextToSpeech/V1/SynthesizeLongAudioResponse.php delete mode 100644 owl-bot-staging/TextToSpeech/v1/proto/src/Google/Cloud/TextToSpeech/V1/SynthesizeSpeechRequest.php delete mode 100644 owl-bot-staging/TextToSpeech/v1/proto/src/Google/Cloud/TextToSpeech/V1/SynthesizeSpeechResponse.php delete mode 100644 owl-bot-staging/TextToSpeech/v1/proto/src/Google/Cloud/TextToSpeech/V1/Voice.php delete mode 100644 owl-bot-staging/TextToSpeech/v1/proto/src/Google/Cloud/TextToSpeech/V1/VoiceSelectionParams.php delete mode 100644 owl-bot-staging/TextToSpeech/v1/samples/V1/TextToSpeechClient/list_voices.php delete mode 100644 owl-bot-staging/TextToSpeech/v1/samples/V1/TextToSpeechClient/streaming_synthesize.php delete mode 100644 owl-bot-staging/TextToSpeech/v1/samples/V1/TextToSpeechClient/synthesize_speech.php delete mode 100644 owl-bot-staging/TextToSpeech/v1/samples/V1/TextToSpeechLongAudioSynthesizeClient/synthesize_long_audio.php delete mode 100644 owl-bot-staging/TextToSpeech/v1/src/V1/Client/TextToSpeechClient.php delete mode 100644 owl-bot-staging/TextToSpeech/v1/src/V1/Client/TextToSpeechLongAudioSynthesizeClient.php delete mode 100644 owl-bot-staging/TextToSpeech/v1/src/V1/Gapic/TextToSpeechGapicClient.php delete mode 100644 owl-bot-staging/TextToSpeech/v1/src/V1/Gapic/TextToSpeechLongAudioSynthesizeGapicClient.php delete mode 100644 owl-bot-staging/TextToSpeech/v1/src/V1/TextToSpeechClient.php delete mode 100644 owl-bot-staging/TextToSpeech/v1/src/V1/TextToSpeechLongAudioSynthesizeClient.php delete mode 100644 owl-bot-staging/TextToSpeech/v1/src/V1/gapic_metadata.json delete mode 100644 owl-bot-staging/TextToSpeech/v1/src/V1/resources/text_to_speech_client_config.json delete mode 100644 owl-bot-staging/TextToSpeech/v1/src/V1/resources/text_to_speech_descriptor_config.php delete mode 100644 owl-bot-staging/TextToSpeech/v1/src/V1/resources/text_to_speech_long_audio_synthesize_client_config.json delete mode 100644 owl-bot-staging/TextToSpeech/v1/src/V1/resources/text_to_speech_long_audio_synthesize_descriptor_config.php delete mode 100644 owl-bot-staging/TextToSpeech/v1/src/V1/resources/text_to_speech_long_audio_synthesize_rest_client_config.php delete mode 100644 owl-bot-staging/TextToSpeech/v1/src/V1/resources/text_to_speech_rest_client_config.php delete mode 100644 owl-bot-staging/TextToSpeech/v1/tests/Unit/V1/Client/TextToSpeechClientTest.php delete mode 100644 owl-bot-staging/TextToSpeech/v1/tests/Unit/V1/Client/TextToSpeechLongAudioSynthesizeClientTest.php delete mode 100644 owl-bot-staging/TextToSpeech/v1/tests/Unit/V1/TextToSpeechClientTest.php delete mode 100644 owl-bot-staging/TextToSpeech/v1/tests/Unit/V1/TextToSpeechLongAudioSynthesizeClientTest.php diff --git a/TextToSpeech/metadata/V1/CloudTts.php b/TextToSpeech/metadata/V1/CloudTts.php index 3125c7df3ed56a36b203843004a7237903f7e3ab..cee048c39aed1706ac68ec1f4ab27f126319418c 100644 GIT binary patch delta 144 zcmcbhd|GA0Atsi6a$GtSy>&K!Vp_+_G?i)cB97DILLOY)W%-%Osqx7<`FW`ltO|@8 z+(vqn_c1FAIDinternalAddGeneratedFile( ' -ÿ +ü 0google/cloud/texttospeech/v1/cloud_tts_lrs.protogoogle.cloud.texttospeech.v1google/api/client.protogoogle/api/field_behavior.proto,google/cloud/texttospeech/v1/cloud_tts.proto#google/longrunning/operations.protogoogle/protobuf/timestamp.proto"™ SynthesizeLongAudioRequest @@ -39,8 +39,8 @@ public static function initOnce() { progress_percentage (2Ÿ TextToSpeechLongAudioSynthesizeª SynthesizeLongAudio8.google.cloud.texttospeech.v1.SynthesizeLongAudioRequest.google.longrunning.Operation"¹ÊAt -8google.cloud.texttospeech.v1.SynthesizeLongAudioResponse8google.cloud.texttospeech.v1.SynthesizeLongAudioMetadata‚Óä“<"7/v1/{parent=projects/*/locations/*}:synthesizeLongAudio:*OÊAtexttospeech.googleapis.comÒA.https://www.googleapis.com/auth/cloud-platformBò - com.google.cloud.texttospeech.v1B#TextToSpeechLongAudioSynthesisProtoPZDcloud.google.com/go/texttospeech/apiv1/texttospeechpb;texttospeechpbøªGoogle.Cloud.TextToSpeech.V1ÊGoogle\\Cloud\\TextToSpeech\\V1êGoogle::Cloud::TextToSpeech::V1bproto3' +8google.cloud.texttospeech.v1.SynthesizeLongAudioResponse8google.cloud.texttospeech.v1.SynthesizeLongAudioMetadata‚Óä“<"7/v1/{parent=projects/*/locations/*}:synthesizeLongAudio:*OÊAtexttospeech.googleapis.comÒA.https://www.googleapis.com/auth/cloud-platformBï + com.google.cloud.texttospeech.v1B#TextToSpeechLongAudioSynthesisProtoPZDcloud.google.com/go/texttospeech/apiv1/texttospeechpb;texttospeechpbªGoogle.Cloud.TextToSpeech.V1ÊGoogle\\Cloud\\TextToSpeech\\V1êGoogle::Cloud::TextToSpeech::V1bproto3' , true); static::$is_initialized = true; diff --git a/owl-bot-staging/TextToSpeech/v1/proto/src/Google/Cloud/TextToSpeech/V1/VoiceCloneParams.php b/TextToSpeech/src/V1/VoiceCloneParams.php similarity index 97% rename from owl-bot-staging/TextToSpeech/v1/proto/src/Google/Cloud/TextToSpeech/V1/VoiceCloneParams.php rename to TextToSpeech/src/V1/VoiceCloneParams.php index 83d52d421f52..dcdf28485990 100644 --- a/owl-bot-staging/TextToSpeech/v1/proto/src/Google/Cloud/TextToSpeech/V1/VoiceCloneParams.php +++ b/TextToSpeech/src/V1/VoiceCloneParams.php @@ -20,7 +20,7 @@ class VoiceCloneParams extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string voice_cloning_key = 1 [(.google.api.field_behavior) = REQUIRED]; */ - protected $voice_cloning_key = ''; + private $voice_cloning_key = ''; /** * Constructor. diff --git a/TextToSpeech/src/V1/VoiceSelectionParams.php b/TextToSpeech/src/V1/VoiceSelectionParams.php index 9dcb6cf601d0..2075fbe1535a 100644 --- a/TextToSpeech/src/V1/VoiceSelectionParams.php +++ b/TextToSpeech/src/V1/VoiceSelectionParams.php @@ -57,6 +57,14 @@ class VoiceSelectionParams extends \Google\Protobuf\Internal\Message * Generated from protobuf field .google.cloud.texttospeech.v1.CustomVoiceParams custom_voice = 4; */ private $custom_voice = null; + /** + * Optional. The configuration for a voice clone. If + * [VoiceCloneParams.voice_clone_key] is set, the service will choose the + * voice clone matching the specified configuration. + * + * Generated from protobuf field .google.cloud.texttospeech.v1.VoiceCloneParams voice_clone = 5 [(.google.api.field_behavior) = OPTIONAL]; + */ + private $voice_clone = null; /** * Constructor. @@ -90,6 +98,10 @@ class VoiceSelectionParams extends \Google\Protobuf\Internal\Message * The configuration for a custom voice. If [CustomVoiceParams.model] is set, * the service will choose the custom voice matching the specified * configuration. + * @type \Google\Cloud\TextToSpeech\V1\VoiceCloneParams $voice_clone + * Optional. The configuration for a voice clone. If + * [VoiceCloneParams.voice_clone_key] is set, the service will choose the + * voice clone matching the specified configuration. * } */ public function __construct($data = NULL) { @@ -247,5 +259,45 @@ public function setCustomVoice($var) return $this; } + /** + * Optional. The configuration for a voice clone. If + * [VoiceCloneParams.voice_clone_key] is set, the service will choose the + * voice clone matching the specified configuration. + * + * Generated from protobuf field .google.cloud.texttospeech.v1.VoiceCloneParams voice_clone = 5 [(.google.api.field_behavior) = OPTIONAL]; + * @return \Google\Cloud\TextToSpeech\V1\VoiceCloneParams|null + */ + public function getVoiceClone() + { + return $this->voice_clone; + } + + public function hasVoiceClone() + { + return isset($this->voice_clone); + } + + public function clearVoiceClone() + { + unset($this->voice_clone); + } + + /** + * Optional. The configuration for a voice clone. If + * [VoiceCloneParams.voice_clone_key] is set, the service will choose the + * voice clone matching the specified configuration. + * + * Generated from protobuf field .google.cloud.texttospeech.v1.VoiceCloneParams voice_clone = 5 [(.google.api.field_behavior) = OPTIONAL]; + * @param \Google\Cloud\TextToSpeech\V1\VoiceCloneParams $var + * @return $this + */ + public function setVoiceClone($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\TextToSpeech\V1\VoiceCloneParams::class); + $this->voice_clone = $var; + + return $this; + } + } diff --git a/owl-bot-staging/TextToSpeech/v1/proto/src/GPBMetadata/Google/Cloud/Texttospeech/V1/CloudTts.php b/owl-bot-staging/TextToSpeech/v1/proto/src/GPBMetadata/Google/Cloud/Texttospeech/V1/CloudTts.php deleted file mode 100644 index cee048c39aed1706ac68ec1f4ab27f126319418c..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 4683 zcmcIoL2uj06*gtdv7c;JW|EEUtg~EZfptIA;@)MJ5dfu4KpZ&>tNU=Ka)-U1ZZLr=Z++Ed@mkd|aAaKV(veQjrJzqF*K-2La4hL`*zFQeGMs^HTExppQmG~#)moBT zs(lMTpkg23@zLX3X)Y>&Uyg22x(U;tYm5Z~1eB9-ff zLlWp6JHknqnPo?50M`GFqbzmH5`Gi@_4 zb<2E(;XIeRy5$ozo*vsB+D2eHwnPnTwn26tNF0-n{m6AN{O3~SRGnr7v(c{F0r70z zYL|#_c%~aTULA+#^F0z==8?YHc@R!Z;moeI!+p%>r<{B)1>TU1&n`(G35K5ijQLFg zE-s(iGg79wW?Qjshi1XC{d|5D(+J{ihDFOHcJOXC`zEnE1=82gOvigS(*_ASGt)_y z_eVc7!z?SE&Sg^fk%2pxX`o5@82)+>cHf11;`@Abh7mP0PSniV-qxKEOLt8qElmq& z?A8ZkAG$Pl?KBKN9I!byzzZYfpX4lT9GHG^;+O{U8|2qR;s@dutXsO>8|pox8BT|! z1xeUhEi8Vg2yzv~aRcAQB_-lxSUzJAICOC*k-MLn7fOarC;vf!IC~P`gXF}7K7&~m z*I(9X7YmT^{eh+Rh}|JxdJ$hHbC2fF)I;_vZRje+#C?dL z(e+@NOXPC%5m=Z_ViBe}b=}hkKF2A+nm+894${Exnmv~DMDD?SIE7jinE^+60q^Ny zMm6S^=J1@RS1@JQx;JYzc$zoijy4-veiMVu;?NJA0ji^oa%wX9;lYVFVcG3_x*t-T zp^1IiaQlu;P^>jvVy9!;J(j>^t};L3w@#F)hk$B`R}qjNw7{_0jJ#rbU9H6Mo9sa9 zsu8kwyI!dssjX^JQ;&+ZQuU~;9UnF8YO%UsRZFP_aT9J&52@Cblpt=y=JcmuX-(x2 zKgSBIa6{wCDBJ=OAFrgKkbI7 z0I>o|E+LmCMRhWn`{8_W1`$;amyvB)$8DSb1(qdKZMNh>Vfi~{2|JT`8{)1R7=5NuQjX%!TU6es2xX&~KpAxEzeO@y=>1AwltI^an z<_*rA@to!$KEUp2ajF*XqcHzR*@nCN5LL+v!^dv!XK)LfJ)}d$b{mo&aUBmgyxP#m z4$Q(y=AO?_*VOEpMu>7uK??D-K)d%ZVSVDgcn`K3YQ5HIsU_{Wsg%_#va$v%4OKa4 zRS#8Ek_6nS?e8B{kJMC5&Oz!b0}yUwL?gORUy$=KeA<`fJxE98JZgI39^y8vbE06c z!4}Iad`&iBvl)0qA0XVwmbaHtpQD_*wvjM*XZ1PxDK_J)lg!qeDINH`09#YGuSnF( zn~?G&tUuDlRO0y&NxYbY&Qi~5w zSf9`WN?GN&RIR?U2rzp)&zlUX*?}Z)V6Je|NwQ_gjxW!K|kv4y$ zWcoqi`uS}3<;$1hWYNbg%6XsPB0O^OaL{$ULE)=3ip(m)W&N2D|jIlNp~cbF%k!^tl~g zYp{Ebi2QB5*!WlM0}hbSGlYD893r2`5z6uWhV}%T=I69~W?zR-7g@_O_+3Eub@X_V oWvvoNvHusR%Q!l49)Em!rrzZj5o7ljZ@sf%Bl+FJ1zZ697sBrdIRF3v diff --git a/owl-bot-staging/TextToSpeech/v1/proto/src/GPBMetadata/Google/Cloud/Texttospeech/V1/CloudTtsLrs.php b/owl-bot-staging/TextToSpeech/v1/proto/src/GPBMetadata/Google/Cloud/Texttospeech/V1/CloudTtsLrs.php deleted file mode 100644 index 5666b6ff2e0a..000000000000 --- a/owl-bot-staging/TextToSpeech/v1/proto/src/GPBMetadata/Google/Cloud/Texttospeech/V1/CloudTtsLrs.php +++ /dev/null @@ -1,49 +0,0 @@ -internalAddGeneratedFile( - ' -ü - -0google/cloud/texttospeech/v1/cloud_tts_lrs.protogoogle.cloud.texttospeech.v1google/api/client.protogoogle/api/field_behavior.proto,google/cloud/texttospeech/v1/cloud_tts.proto#google/longrunning/operations.protogoogle/protobuf/timestamp.proto"™ -SynthesizeLongAudioRequest -parent ( @ -input ( 2,.google.cloud.texttospeech.v1.SynthesisInputBàAD - audio_config ( 2).google.cloud.texttospeech.v1.AudioConfigBàA -output_gcs_uri ( BàAF -voice ( 22.google.cloud.texttospeech.v1.VoiceSelectionParamsBàA" -SynthesizeLongAudioResponse"¤ -SynthesizeLongAudioMetadata. - -start_time ( 2.google.protobuf.Timestamp8 -last_update_time ( 2.google.protobuf.TimestampB -progress_percentage (2Ÿ -TextToSpeechLongAudioSynthesizeª -SynthesizeLongAudio8.google.cloud.texttospeech.v1.SynthesizeLongAudioRequest.google.longrunning.Operation"¹ÊAt -8google.cloud.texttospeech.v1.SynthesizeLongAudioResponse8google.cloud.texttospeech.v1.SynthesizeLongAudioMetadata‚Óä“<"7/v1/{parent=projects/*/locations/*}:synthesizeLongAudio:*OÊAtexttospeech.googleapis.comÒA.https://www.googleapis.com/auth/cloud-platformBï - com.google.cloud.texttospeech.v1B#TextToSpeechLongAudioSynthesisProtoPZDcloud.google.com/go/texttospeech/apiv1/texttospeechpb;texttospeechpbªGoogle.Cloud.TextToSpeech.V1ÊGoogle\\Cloud\\TextToSpeech\\V1êGoogle::Cloud::TextToSpeech::V1bproto3' - , true); - - static::$is_initialized = true; - } -} - diff --git a/owl-bot-staging/TextToSpeech/v1/proto/src/Google/Cloud/TextToSpeech/V1/AdvancedVoiceOptions.php b/owl-bot-staging/TextToSpeech/v1/proto/src/Google/Cloud/TextToSpeech/V1/AdvancedVoiceOptions.php deleted file mode 100644 index 2222ba2fcb32..000000000000 --- a/owl-bot-staging/TextToSpeech/v1/proto/src/Google/Cloud/TextToSpeech/V1/AdvancedVoiceOptions.php +++ /dev/null @@ -1,81 +0,0 @@ -google.cloud.texttospeech.v1.AdvancedVoiceOptions - */ -class AdvancedVoiceOptions extends \Google\Protobuf\Internal\Message -{ - /** - * Only for Journey voices. If false, the synthesis will be context aware - * and have higher latency. - * - * Generated from protobuf field optional bool low_latency_journey_synthesis = 1; - */ - protected $low_latency_journey_synthesis = null; - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type bool $low_latency_journey_synthesis - * Only for Journey voices. If false, the synthesis will be context aware - * and have higher latency. - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Cloud\Texttospeech\V1\CloudTts::initOnce(); - parent::__construct($data); - } - - /** - * Only for Journey voices. If false, the synthesis will be context aware - * and have higher latency. - * - * Generated from protobuf field optional bool low_latency_journey_synthesis = 1; - * @return bool - */ - public function getLowLatencyJourneySynthesis() - { - return isset($this->low_latency_journey_synthesis) ? $this->low_latency_journey_synthesis : false; - } - - public function hasLowLatencyJourneySynthesis() - { - return isset($this->low_latency_journey_synthesis); - } - - public function clearLowLatencyJourneySynthesis() - { - unset($this->low_latency_journey_synthesis); - } - - /** - * Only for Journey voices. If false, the synthesis will be context aware - * and have higher latency. - * - * Generated from protobuf field optional bool low_latency_journey_synthesis = 1; - * @param bool $var - * @return $this - */ - public function setLowLatencyJourneySynthesis($var) - { - GPBUtil::checkBool($var); - $this->low_latency_journey_synthesis = $var; - - return $this; - } - -} - diff --git a/owl-bot-staging/TextToSpeech/v1/proto/src/Google/Cloud/TextToSpeech/V1/AudioConfig.php b/owl-bot-staging/TextToSpeech/v1/proto/src/Google/Cloud/TextToSpeech/V1/AudioConfig.php deleted file mode 100644 index 7d299d36de5a..000000000000 --- a/owl-bot-staging/TextToSpeech/v1/proto/src/Google/Cloud/TextToSpeech/V1/AudioConfig.php +++ /dev/null @@ -1,329 +0,0 @@ -google.cloud.texttospeech.v1.AudioConfig - */ -class AudioConfig extends \Google\Protobuf\Internal\Message -{ - /** - * Required. The format of the audio byte stream. - * - * Generated from protobuf field .google.cloud.texttospeech.v1.AudioEncoding audio_encoding = 1 [(.google.api.field_behavior) = REQUIRED]; - */ - protected $audio_encoding = 0; - /** - * Optional. Input only. Speaking rate/speed, in the range [0.25, 4.0]. 1.0 is - * the normal native speed supported by the specific voice. 2.0 is twice as - * fast, and 0.5 is half as fast. If unset(0.0), defaults to the native 1.0 - * speed. Any other values < 0.25 or > 4.0 will return an error. - * - * Generated from protobuf field double speaking_rate = 2 [(.google.api.field_behavior) = INPUT_ONLY, (.google.api.field_behavior) = OPTIONAL]; - */ - protected $speaking_rate = 0.0; - /** - * Optional. Input only. Speaking pitch, in the range [-20.0, 20.0]. 20 means - * increase 20 semitones from the original pitch. -20 means decrease 20 - * semitones from the original pitch. - * - * Generated from protobuf field double pitch = 3 [(.google.api.field_behavior) = INPUT_ONLY, (.google.api.field_behavior) = OPTIONAL]; - */ - protected $pitch = 0.0; - /** - * Optional. Input only. Volume gain (in dB) of the normal native volume - * supported by the specific voice, in the range [-96.0, 16.0]. If unset, or - * set to a value of 0.0 (dB), will play at normal native signal amplitude. A - * value of -6.0 (dB) will play at approximately half the amplitude of the - * normal native signal amplitude. A value of +6.0 (dB) will play at - * approximately twice the amplitude of the normal native signal amplitude. - * Strongly recommend not to exceed +10 (dB) as there's usually no effective - * increase in loudness for any value greater than that. - * - * Generated from protobuf field double volume_gain_db = 4 [(.google.api.field_behavior) = INPUT_ONLY, (.google.api.field_behavior) = OPTIONAL]; - */ - protected $volume_gain_db = 0.0; - /** - * Optional. The synthesis sample rate (in hertz) for this audio. When this is - * specified in SynthesizeSpeechRequest, if this is different from the voice's - * natural sample rate, then the synthesizer will honor this request by - * converting to the desired sample rate (which might result in worse audio - * quality), unless the specified sample rate is not supported for the - * encoding chosen, in which case it will fail the request and return - * [google.rpc.Code.INVALID_ARGUMENT][google.rpc.Code.INVALID_ARGUMENT]. - * - * Generated from protobuf field int32 sample_rate_hertz = 5 [(.google.api.field_behavior) = OPTIONAL]; - */ - protected $sample_rate_hertz = 0; - /** - * Optional. Input only. An identifier which selects 'audio effects' profiles - * that are applied on (post synthesized) text to speech. Effects are applied - * on top of each other in the order they are given. See - * [audio - * profiles](https://cloud.google.com/text-to-speech/docs/audio-profiles) for - * current supported profile ids. - * - * Generated from protobuf field repeated string effects_profile_id = 6 [(.google.api.field_behavior) = INPUT_ONLY, (.google.api.field_behavior) = OPTIONAL]; - */ - private $effects_profile_id; - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type int $audio_encoding - * Required. The format of the audio byte stream. - * @type float $speaking_rate - * Optional. Input only. Speaking rate/speed, in the range [0.25, 4.0]. 1.0 is - * the normal native speed supported by the specific voice. 2.0 is twice as - * fast, and 0.5 is half as fast. If unset(0.0), defaults to the native 1.0 - * speed. Any other values < 0.25 or > 4.0 will return an error. - * @type float $pitch - * Optional. Input only. Speaking pitch, in the range [-20.0, 20.0]. 20 means - * increase 20 semitones from the original pitch. -20 means decrease 20 - * semitones from the original pitch. - * @type float $volume_gain_db - * Optional. Input only. Volume gain (in dB) of the normal native volume - * supported by the specific voice, in the range [-96.0, 16.0]. If unset, or - * set to a value of 0.0 (dB), will play at normal native signal amplitude. A - * value of -6.0 (dB) will play at approximately half the amplitude of the - * normal native signal amplitude. A value of +6.0 (dB) will play at - * approximately twice the amplitude of the normal native signal amplitude. - * Strongly recommend not to exceed +10 (dB) as there's usually no effective - * increase in loudness for any value greater than that. - * @type int $sample_rate_hertz - * Optional. The synthesis sample rate (in hertz) for this audio. When this is - * specified in SynthesizeSpeechRequest, if this is different from the voice's - * natural sample rate, then the synthesizer will honor this request by - * converting to the desired sample rate (which might result in worse audio - * quality), unless the specified sample rate is not supported for the - * encoding chosen, in which case it will fail the request and return - * [google.rpc.Code.INVALID_ARGUMENT][google.rpc.Code.INVALID_ARGUMENT]. - * @type array|\Google\Protobuf\Internal\RepeatedField $effects_profile_id - * Optional. Input only. An identifier which selects 'audio effects' profiles - * that are applied on (post synthesized) text to speech. Effects are applied - * on top of each other in the order they are given. See - * [audio - * profiles](https://cloud.google.com/text-to-speech/docs/audio-profiles) for - * current supported profile ids. - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Cloud\Texttospeech\V1\CloudTts::initOnce(); - parent::__construct($data); - } - - /** - * Required. The format of the audio byte stream. - * - * Generated from protobuf field .google.cloud.texttospeech.v1.AudioEncoding audio_encoding = 1 [(.google.api.field_behavior) = REQUIRED]; - * @return int - */ - public function getAudioEncoding() - { - return $this->audio_encoding; - } - - /** - * Required. The format of the audio byte stream. - * - * Generated from protobuf field .google.cloud.texttospeech.v1.AudioEncoding audio_encoding = 1 [(.google.api.field_behavior) = REQUIRED]; - * @param int $var - * @return $this - */ - public function setAudioEncoding($var) - { - GPBUtil::checkEnum($var, \Google\Cloud\TextToSpeech\V1\AudioEncoding::class); - $this->audio_encoding = $var; - - return $this; - } - - /** - * Optional. Input only. Speaking rate/speed, in the range [0.25, 4.0]. 1.0 is - * the normal native speed supported by the specific voice. 2.0 is twice as - * fast, and 0.5 is half as fast. If unset(0.0), defaults to the native 1.0 - * speed. Any other values < 0.25 or > 4.0 will return an error. - * - * Generated from protobuf field double speaking_rate = 2 [(.google.api.field_behavior) = INPUT_ONLY, (.google.api.field_behavior) = OPTIONAL]; - * @return float - */ - public function getSpeakingRate() - { - return $this->speaking_rate; - } - - /** - * Optional. Input only. Speaking rate/speed, in the range [0.25, 4.0]. 1.0 is - * the normal native speed supported by the specific voice. 2.0 is twice as - * fast, and 0.5 is half as fast. If unset(0.0), defaults to the native 1.0 - * speed. Any other values < 0.25 or > 4.0 will return an error. - * - * Generated from protobuf field double speaking_rate = 2 [(.google.api.field_behavior) = INPUT_ONLY, (.google.api.field_behavior) = OPTIONAL]; - * @param float $var - * @return $this - */ - public function setSpeakingRate($var) - { - GPBUtil::checkDouble($var); - $this->speaking_rate = $var; - - return $this; - } - - /** - * Optional. Input only. Speaking pitch, in the range [-20.0, 20.0]. 20 means - * increase 20 semitones from the original pitch. -20 means decrease 20 - * semitones from the original pitch. - * - * Generated from protobuf field double pitch = 3 [(.google.api.field_behavior) = INPUT_ONLY, (.google.api.field_behavior) = OPTIONAL]; - * @return float - */ - public function getPitch() - { - return $this->pitch; - } - - /** - * Optional. Input only. Speaking pitch, in the range [-20.0, 20.0]. 20 means - * increase 20 semitones from the original pitch. -20 means decrease 20 - * semitones from the original pitch. - * - * Generated from protobuf field double pitch = 3 [(.google.api.field_behavior) = INPUT_ONLY, (.google.api.field_behavior) = OPTIONAL]; - * @param float $var - * @return $this - */ - public function setPitch($var) - { - GPBUtil::checkDouble($var); - $this->pitch = $var; - - return $this; - } - - /** - * Optional. Input only. Volume gain (in dB) of the normal native volume - * supported by the specific voice, in the range [-96.0, 16.0]. If unset, or - * set to a value of 0.0 (dB), will play at normal native signal amplitude. A - * value of -6.0 (dB) will play at approximately half the amplitude of the - * normal native signal amplitude. A value of +6.0 (dB) will play at - * approximately twice the amplitude of the normal native signal amplitude. - * Strongly recommend not to exceed +10 (dB) as there's usually no effective - * increase in loudness for any value greater than that. - * - * Generated from protobuf field double volume_gain_db = 4 [(.google.api.field_behavior) = INPUT_ONLY, (.google.api.field_behavior) = OPTIONAL]; - * @return float - */ - public function getVolumeGainDb() - { - return $this->volume_gain_db; - } - - /** - * Optional. Input only. Volume gain (in dB) of the normal native volume - * supported by the specific voice, in the range [-96.0, 16.0]. If unset, or - * set to a value of 0.0 (dB), will play at normal native signal amplitude. A - * value of -6.0 (dB) will play at approximately half the amplitude of the - * normal native signal amplitude. A value of +6.0 (dB) will play at - * approximately twice the amplitude of the normal native signal amplitude. - * Strongly recommend not to exceed +10 (dB) as there's usually no effective - * increase in loudness for any value greater than that. - * - * Generated from protobuf field double volume_gain_db = 4 [(.google.api.field_behavior) = INPUT_ONLY, (.google.api.field_behavior) = OPTIONAL]; - * @param float $var - * @return $this - */ - public function setVolumeGainDb($var) - { - GPBUtil::checkDouble($var); - $this->volume_gain_db = $var; - - return $this; - } - - /** - * Optional. The synthesis sample rate (in hertz) for this audio. When this is - * specified in SynthesizeSpeechRequest, if this is different from the voice's - * natural sample rate, then the synthesizer will honor this request by - * converting to the desired sample rate (which might result in worse audio - * quality), unless the specified sample rate is not supported for the - * encoding chosen, in which case it will fail the request and return - * [google.rpc.Code.INVALID_ARGUMENT][google.rpc.Code.INVALID_ARGUMENT]. - * - * Generated from protobuf field int32 sample_rate_hertz = 5 [(.google.api.field_behavior) = OPTIONAL]; - * @return int - */ - public function getSampleRateHertz() - { - return $this->sample_rate_hertz; - } - - /** - * Optional. The synthesis sample rate (in hertz) for this audio. When this is - * specified in SynthesizeSpeechRequest, if this is different from the voice's - * natural sample rate, then the synthesizer will honor this request by - * converting to the desired sample rate (which might result in worse audio - * quality), unless the specified sample rate is not supported for the - * encoding chosen, in which case it will fail the request and return - * [google.rpc.Code.INVALID_ARGUMENT][google.rpc.Code.INVALID_ARGUMENT]. - * - * Generated from protobuf field int32 sample_rate_hertz = 5 [(.google.api.field_behavior) = OPTIONAL]; - * @param int $var - * @return $this - */ - public function setSampleRateHertz($var) - { - GPBUtil::checkInt32($var); - $this->sample_rate_hertz = $var; - - return $this; - } - - /** - * Optional. Input only. An identifier which selects 'audio effects' profiles - * that are applied on (post synthesized) text to speech. Effects are applied - * on top of each other in the order they are given. See - * [audio - * profiles](https://cloud.google.com/text-to-speech/docs/audio-profiles) for - * current supported profile ids. - * - * Generated from protobuf field repeated string effects_profile_id = 6 [(.google.api.field_behavior) = INPUT_ONLY, (.google.api.field_behavior) = OPTIONAL]; - * @return \Google\Protobuf\Internal\RepeatedField - */ - public function getEffectsProfileId() - { - return $this->effects_profile_id; - } - - /** - * Optional. Input only. An identifier which selects 'audio effects' profiles - * that are applied on (post synthesized) text to speech. Effects are applied - * on top of each other in the order they are given. See - * [audio - * profiles](https://cloud.google.com/text-to-speech/docs/audio-profiles) for - * current supported profile ids. - * - * Generated from protobuf field repeated string effects_profile_id = 6 [(.google.api.field_behavior) = INPUT_ONLY, (.google.api.field_behavior) = OPTIONAL]; - * @param array|\Google\Protobuf\Internal\RepeatedField $var - * @return $this - */ - public function setEffectsProfileId($var) - { - $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); - $this->effects_profile_id = $arr; - - return $this; - } - -} - diff --git a/owl-bot-staging/TextToSpeech/v1/proto/src/Google/Cloud/TextToSpeech/V1/AudioEncoding.php b/owl-bot-staging/TextToSpeech/v1/proto/src/Google/Cloud/TextToSpeech/V1/AudioEncoding.php deleted file mode 100644 index 1a3ee8800a95..000000000000 --- a/owl-bot-staging/TextToSpeech/v1/proto/src/Google/Cloud/TextToSpeech/V1/AudioEncoding.php +++ /dev/null @@ -1,90 +0,0 @@ -google.cloud.texttospeech.v1.AudioEncoding - */ -class AudioEncoding -{ - /** - * Not specified. Will return result - * [google.rpc.Code.INVALID_ARGUMENT][google.rpc.Code.INVALID_ARGUMENT]. - * - * Generated from protobuf enum AUDIO_ENCODING_UNSPECIFIED = 0; - */ - const AUDIO_ENCODING_UNSPECIFIED = 0; - /** - * Uncompressed 16-bit signed little-endian samples (Linear PCM). - * Audio content returned as LINEAR16 also contains a WAV header. - * - * Generated from protobuf enum LINEAR16 = 1; - */ - const LINEAR16 = 1; - /** - * MP3 audio at 32kbps. - * - * Generated from protobuf enum MP3 = 2; - */ - const MP3 = 2; - /** - * Opus encoded audio wrapped in an ogg container. The result will be a - * file which can be played natively on Android, and in browsers (at least - * Chrome and Firefox). The quality of the encoding is considerably higher - * than MP3 while using approximately the same bitrate. - * - * Generated from protobuf enum OGG_OPUS = 3; - */ - const OGG_OPUS = 3; - /** - * 8-bit samples that compand 14-bit audio samples using G.711 PCMU/mu-law. - * Audio content returned as MULAW also contains a WAV header. - * - * Generated from protobuf enum MULAW = 5; - */ - const MULAW = 5; - /** - * 8-bit samples that compand 14-bit audio samples using G.711 PCMU/A-law. - * Audio content returned as ALAW also contains a WAV header. - * - * Generated from protobuf enum ALAW = 6; - */ - const ALAW = 6; - - private static $valueToName = [ - self::AUDIO_ENCODING_UNSPECIFIED => 'AUDIO_ENCODING_UNSPECIFIED', - self::LINEAR16 => 'LINEAR16', - self::MP3 => 'MP3', - self::OGG_OPUS => 'OGG_OPUS', - self::MULAW => 'MULAW', - self::ALAW => 'ALAW', - ]; - - public static function name($value) - { - if (!isset(self::$valueToName[$value])) { - throw new UnexpectedValueException(sprintf( - 'Enum %s has no name defined for value %s', __CLASS__, $value)); - } - return self::$valueToName[$value]; - } - - - public static function value($name) - { - $const = __CLASS__ . '::' . strtoupper($name); - if (!defined($const)) { - throw new UnexpectedValueException(sprintf( - 'Enum %s has no value defined for name %s', __CLASS__, $name)); - } - return constant($const); - } -} - diff --git a/owl-bot-staging/TextToSpeech/v1/proto/src/Google/Cloud/TextToSpeech/V1/CustomPronunciationParams.php b/owl-bot-staging/TextToSpeech/v1/proto/src/Google/Cloud/TextToSpeech/V1/CustomPronunciationParams.php deleted file mode 100644 index 2a2283ce0dea..000000000000 --- a/owl-bot-staging/TextToSpeech/v1/proto/src/Google/Cloud/TextToSpeech/V1/CustomPronunciationParams.php +++ /dev/null @@ -1,177 +0,0 @@ -google.cloud.texttospeech.v1.CustomPronunciationParams - */ -class CustomPronunciationParams extends \Google\Protobuf\Internal\Message -{ - /** - * The phrase to which the customization will be applied. - * The phrase can be multiple words (in the case of proper nouns etc), but - * should not span to a whole sentence. - * - * Generated from protobuf field optional string phrase = 1; - */ - protected $phrase = null; - /** - * The phonetic encoding of the phrase. - * - * Generated from protobuf field optional .google.cloud.texttospeech.v1.CustomPronunciationParams.PhoneticEncoding phonetic_encoding = 2; - */ - protected $phonetic_encoding = null; - /** - * The pronunciation of the phrase. This must be in the phonetic encoding - * specified above. - * - * Generated from protobuf field optional string pronunciation = 3; - */ - protected $pronunciation = null; - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type string $phrase - * The phrase to which the customization will be applied. - * The phrase can be multiple words (in the case of proper nouns etc), but - * should not span to a whole sentence. - * @type int $phonetic_encoding - * The phonetic encoding of the phrase. - * @type string $pronunciation - * The pronunciation of the phrase. This must be in the phonetic encoding - * specified above. - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Cloud\Texttospeech\V1\CloudTts::initOnce(); - parent::__construct($data); - } - - /** - * The phrase to which the customization will be applied. - * The phrase can be multiple words (in the case of proper nouns etc), but - * should not span to a whole sentence. - * - * Generated from protobuf field optional string phrase = 1; - * @return string - */ - public function getPhrase() - { - return isset($this->phrase) ? $this->phrase : ''; - } - - public function hasPhrase() - { - return isset($this->phrase); - } - - public function clearPhrase() - { - unset($this->phrase); - } - - /** - * The phrase to which the customization will be applied. - * The phrase can be multiple words (in the case of proper nouns etc), but - * should not span to a whole sentence. - * - * Generated from protobuf field optional string phrase = 1; - * @param string $var - * @return $this - */ - public function setPhrase($var) - { - GPBUtil::checkString($var, True); - $this->phrase = $var; - - return $this; - } - - /** - * The phonetic encoding of the phrase. - * - * Generated from protobuf field optional .google.cloud.texttospeech.v1.CustomPronunciationParams.PhoneticEncoding phonetic_encoding = 2; - * @return int - */ - public function getPhoneticEncoding() - { - return isset($this->phonetic_encoding) ? $this->phonetic_encoding : 0; - } - - public function hasPhoneticEncoding() - { - return isset($this->phonetic_encoding); - } - - public function clearPhoneticEncoding() - { - unset($this->phonetic_encoding); - } - - /** - * The phonetic encoding of the phrase. - * - * Generated from protobuf field optional .google.cloud.texttospeech.v1.CustomPronunciationParams.PhoneticEncoding phonetic_encoding = 2; - * @param int $var - * @return $this - */ - public function setPhoneticEncoding($var) - { - GPBUtil::checkEnum($var, \Google\Cloud\TextToSpeech\V1\CustomPronunciationParams\PhoneticEncoding::class); - $this->phonetic_encoding = $var; - - return $this; - } - - /** - * The pronunciation of the phrase. This must be in the phonetic encoding - * specified above. - * - * Generated from protobuf field optional string pronunciation = 3; - * @return string - */ - public function getPronunciation() - { - return isset($this->pronunciation) ? $this->pronunciation : ''; - } - - public function hasPronunciation() - { - return isset($this->pronunciation); - } - - public function clearPronunciation() - { - unset($this->pronunciation); - } - - /** - * The pronunciation of the phrase. This must be in the phonetic encoding - * specified above. - * - * Generated from protobuf field optional string pronunciation = 3; - * @param string $var - * @return $this - */ - public function setPronunciation($var) - { - GPBUtil::checkString($var, True); - $this->pronunciation = $var; - - return $this; - } - -} - diff --git a/owl-bot-staging/TextToSpeech/v1/proto/src/Google/Cloud/TextToSpeech/V1/CustomPronunciationParams/PhoneticEncoding.php b/owl-bot-staging/TextToSpeech/v1/proto/src/Google/Cloud/TextToSpeech/V1/CustomPronunciationParams/PhoneticEncoding.php deleted file mode 100644 index d7631a1efee4..000000000000 --- a/owl-bot-staging/TextToSpeech/v1/proto/src/Google/Cloud/TextToSpeech/V1/CustomPronunciationParams/PhoneticEncoding.php +++ /dev/null @@ -1,66 +0,0 @@ -google.cloud.texttospeech.v1.CustomPronunciationParams.PhoneticEncoding - */ -class PhoneticEncoding -{ - /** - * Not specified. - * - * Generated from protobuf enum PHONETIC_ENCODING_UNSPECIFIED = 0; - */ - const PHONETIC_ENCODING_UNSPECIFIED = 0; - /** - * IPA. (e.g. apple -> ˈæpÉ™l ) - * https://en.wikipedia.org/wiki/International_Phonetic_Alphabet - * - * Generated from protobuf enum PHONETIC_ENCODING_IPA = 1; - */ - const PHONETIC_ENCODING_IPA = 1; - /** - * X-SAMPA (e.g. apple -> "{p@l" ) - * https://en.wikipedia.org/wiki/X-SAMPA - * - * Generated from protobuf enum PHONETIC_ENCODING_X_SAMPA = 2; - */ - const PHONETIC_ENCODING_X_SAMPA = 2; - - private static $valueToName = [ - self::PHONETIC_ENCODING_UNSPECIFIED => 'PHONETIC_ENCODING_UNSPECIFIED', - self::PHONETIC_ENCODING_IPA => 'PHONETIC_ENCODING_IPA', - self::PHONETIC_ENCODING_X_SAMPA => 'PHONETIC_ENCODING_X_SAMPA', - ]; - - public static function name($value) - { - if (!isset(self::$valueToName[$value])) { - throw new UnexpectedValueException(sprintf( - 'Enum %s has no name defined for value %s', __CLASS__, $value)); - } - return self::$valueToName[$value]; - } - - - public static function value($name) - { - $const = __CLASS__ . '::' . strtoupper($name); - if (!defined($const)) { - throw new UnexpectedValueException(sprintf( - 'Enum %s has no value defined for name %s', __CLASS__, $name)); - } - return constant($const); - } -} - -// Adding a class alias for backwards compatibility with the previous class name. -class_alias(PhoneticEncoding::class, \Google\Cloud\TextToSpeech\V1\CustomPronunciationParams_PhoneticEncoding::class); - diff --git a/owl-bot-staging/TextToSpeech/v1/proto/src/Google/Cloud/TextToSpeech/V1/CustomPronunciations.php b/owl-bot-staging/TextToSpeech/v1/proto/src/Google/Cloud/TextToSpeech/V1/CustomPronunciations.php deleted file mode 100644 index fffc75dae4d1..000000000000 --- a/owl-bot-staging/TextToSpeech/v1/proto/src/Google/Cloud/TextToSpeech/V1/CustomPronunciations.php +++ /dev/null @@ -1,67 +0,0 @@ -google.cloud.texttospeech.v1.CustomPronunciations - */ -class CustomPronunciations extends \Google\Protobuf\Internal\Message -{ - /** - * The pronunciation customizations to be applied. - * - * Generated from protobuf field repeated .google.cloud.texttospeech.v1.CustomPronunciationParams pronunciations = 1; - */ - private $pronunciations; - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type array<\Google\Cloud\TextToSpeech\V1\CustomPronunciationParams>|\Google\Protobuf\Internal\RepeatedField $pronunciations - * The pronunciation customizations to be applied. - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Cloud\Texttospeech\V1\CloudTts::initOnce(); - parent::__construct($data); - } - - /** - * The pronunciation customizations to be applied. - * - * Generated from protobuf field repeated .google.cloud.texttospeech.v1.CustomPronunciationParams pronunciations = 1; - * @return \Google\Protobuf\Internal\RepeatedField - */ - public function getPronunciations() - { - return $this->pronunciations; - } - - /** - * The pronunciation customizations to be applied. - * - * Generated from protobuf field repeated .google.cloud.texttospeech.v1.CustomPronunciationParams pronunciations = 1; - * @param array<\Google\Cloud\TextToSpeech\V1\CustomPronunciationParams>|\Google\Protobuf\Internal\RepeatedField $var - * @return $this - */ - public function setPronunciations($var) - { - $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\TextToSpeech\V1\CustomPronunciationParams::class); - $this->pronunciations = $arr; - - return $this; - } - -} - diff --git a/owl-bot-staging/TextToSpeech/v1/proto/src/Google/Cloud/TextToSpeech/V1/CustomVoiceParams.php b/owl-bot-staging/TextToSpeech/v1/proto/src/Google/Cloud/TextToSpeech/V1/CustomVoiceParams.php deleted file mode 100644 index bc208aa890c7..000000000000 --- a/owl-bot-staging/TextToSpeech/v1/proto/src/Google/Cloud/TextToSpeech/V1/CustomVoiceParams.php +++ /dev/null @@ -1,106 +0,0 @@ -google.cloud.texttospeech.v1.CustomVoiceParams - */ -class CustomVoiceParams extends \Google\Protobuf\Internal\Message -{ - /** - * Required. The name of the AutoML model that synthesizes the custom voice. - * - * Generated from protobuf field string model = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { - */ - protected $model = ''; - /** - * Optional. Deprecated. The usage of the synthesized audio to be reported. - * - * Generated from protobuf field .google.cloud.texttospeech.v1.CustomVoiceParams.ReportedUsage reported_usage = 3 [deprecated = true, (.google.api.field_behavior) = OPTIONAL]; - * @deprecated - */ - protected $reported_usage = 0; - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type string $model - * Required. The name of the AutoML model that synthesizes the custom voice. - * @type int $reported_usage - * Optional. Deprecated. The usage of the synthesized audio to be reported. - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Cloud\Texttospeech\V1\CloudTts::initOnce(); - parent::__construct($data); - } - - /** - * Required. The name of the AutoML model that synthesizes the custom voice. - * - * Generated from protobuf field string model = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { - * @return string - */ - public function getModel() - { - return $this->model; - } - - /** - * Required. The name of the AutoML model that synthesizes the custom voice. - * - * Generated from protobuf field string model = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { - * @param string $var - * @return $this - */ - public function setModel($var) - { - GPBUtil::checkString($var, True); - $this->model = $var; - - return $this; - } - - /** - * Optional. Deprecated. The usage of the synthesized audio to be reported. - * - * Generated from protobuf field .google.cloud.texttospeech.v1.CustomVoiceParams.ReportedUsage reported_usage = 3 [deprecated = true, (.google.api.field_behavior) = OPTIONAL]; - * @return int - * @deprecated - */ - public function getReportedUsage() - { - @trigger_error('reported_usage is deprecated.', E_USER_DEPRECATED); - return $this->reported_usage; - } - - /** - * Optional. Deprecated. The usage of the synthesized audio to be reported. - * - * Generated from protobuf field .google.cloud.texttospeech.v1.CustomVoiceParams.ReportedUsage reported_usage = 3 [deprecated = true, (.google.api.field_behavior) = OPTIONAL]; - * @param int $var - * @return $this - * @deprecated - */ - public function setReportedUsage($var) - { - @trigger_error('reported_usage is deprecated.', E_USER_DEPRECATED); - GPBUtil::checkEnum($var, \Google\Cloud\TextToSpeech\V1\CustomVoiceParams\ReportedUsage::class); - $this->reported_usage = $var; - - return $this; - } - -} - diff --git a/owl-bot-staging/TextToSpeech/v1/proto/src/Google/Cloud/TextToSpeech/V1/CustomVoiceParams/ReportedUsage.php b/owl-bot-staging/TextToSpeech/v1/proto/src/Google/Cloud/TextToSpeech/V1/CustomVoiceParams/ReportedUsage.php deleted file mode 100644 index 6e8d93d63f04..000000000000 --- a/owl-bot-staging/TextToSpeech/v1/proto/src/Google/Cloud/TextToSpeech/V1/CustomVoiceParams/ReportedUsage.php +++ /dev/null @@ -1,68 +0,0 @@ -google.cloud.texttospeech.v1.CustomVoiceParams.ReportedUsage - */ -class ReportedUsage -{ - /** - * Request with reported usage unspecified will be rejected. - * - * Generated from protobuf enum REPORTED_USAGE_UNSPECIFIED = 0; - */ - const REPORTED_USAGE_UNSPECIFIED = 0; - /** - * For scenarios where the synthesized audio is not downloadable and can - * only be used once. For example, real-time request in IVR system. - * - * Generated from protobuf enum REALTIME = 1; - */ - const REALTIME = 1; - /** - * For scenarios where the synthesized audio is downloadable and can be - * reused. For example, the synthesized audio is downloaded, stored in - * customer service system and played repeatedly. - * - * Generated from protobuf enum OFFLINE = 2; - */ - const OFFLINE = 2; - - private static $valueToName = [ - self::REPORTED_USAGE_UNSPECIFIED => 'REPORTED_USAGE_UNSPECIFIED', - self::REALTIME => 'REALTIME', - self::OFFLINE => 'OFFLINE', - ]; - - public static function name($value) - { - if (!isset(self::$valueToName[$value])) { - throw new UnexpectedValueException(sprintf( - 'Enum %s has no name defined for value %s', __CLASS__, $value)); - } - return self::$valueToName[$value]; - } - - - public static function value($name) - { - $const = __CLASS__ . '::' . strtoupper($name); - if (!defined($const)) { - throw new UnexpectedValueException(sprintf( - 'Enum %s has no value defined for name %s', __CLASS__, $name)); - } - return constant($const); - } -} - -// Adding a class alias for backwards compatibility with the previous class name. -class_alias(ReportedUsage::class, \Google\Cloud\TextToSpeech\V1\CustomVoiceParams_ReportedUsage::class); - diff --git a/owl-bot-staging/TextToSpeech/v1/proto/src/Google/Cloud/TextToSpeech/V1/ListVoicesRequest.php b/owl-bot-staging/TextToSpeech/v1/proto/src/Google/Cloud/TextToSpeech/V1/ListVoicesRequest.php deleted file mode 100644 index a1f5971ee7a9..000000000000 --- a/owl-bot-staging/TextToSpeech/v1/proto/src/Google/Cloud/TextToSpeech/V1/ListVoicesRequest.php +++ /dev/null @@ -1,115 +0,0 @@ -google.cloud.texttospeech.v1.ListVoicesRequest - */ -class ListVoicesRequest extends \Google\Protobuf\Internal\Message -{ - /** - * Optional. Recommended. - * [BCP-47](https://www.rfc-editor.org/rfc/bcp/bcp47.txt) language tag. - * If not specified, the API will return all supported voices. - * If specified, the ListVoices call will only return voices that can be used - * to synthesize this language_code. For example, if you specify `"en-NZ"`, - * all `"en-NZ"` voices will be returned. If you specify `"no"`, both - * `"no-\*"` (Norwegian) and `"nb-\*"` (Norwegian Bokmal) voices will be - * returned. - * - * Generated from protobuf field string language_code = 1 [(.google.api.field_behavior) = OPTIONAL]; - */ - protected $language_code = ''; - - /** - * @param string $languageCode Optional. Recommended. - * [BCP-47](https://www.rfc-editor.org/rfc/bcp/bcp47.txt) language tag. - * If not specified, the API will return all supported voices. - * If specified, the ListVoices call will only return voices that can be used - * to synthesize this language_code. For example, if you specify `"en-NZ"`, - * all `"en-NZ"` voices will be returned. If you specify `"no"`, both - * `"no-\*"` (Norwegian) and `"nb-\*"` (Norwegian Bokmal) voices will be - * returned. - * - * @return \Google\Cloud\TextToSpeech\V1\ListVoicesRequest - * - * @experimental - */ - public static function build(string $languageCode): self - { - return (new self()) - ->setLanguageCode($languageCode); - } - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type string $language_code - * Optional. Recommended. - * [BCP-47](https://www.rfc-editor.org/rfc/bcp/bcp47.txt) language tag. - * If not specified, the API will return all supported voices. - * If specified, the ListVoices call will only return voices that can be used - * to synthesize this language_code. For example, if you specify `"en-NZ"`, - * all `"en-NZ"` voices will be returned. If you specify `"no"`, both - * `"no-\*"` (Norwegian) and `"nb-\*"` (Norwegian Bokmal) voices will be - * returned. - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Cloud\Texttospeech\V1\CloudTts::initOnce(); - parent::__construct($data); - } - - /** - * Optional. Recommended. - * [BCP-47](https://www.rfc-editor.org/rfc/bcp/bcp47.txt) language tag. - * If not specified, the API will return all supported voices. - * If specified, the ListVoices call will only return voices that can be used - * to synthesize this language_code. For example, if you specify `"en-NZ"`, - * all `"en-NZ"` voices will be returned. If you specify `"no"`, both - * `"no-\*"` (Norwegian) and `"nb-\*"` (Norwegian Bokmal) voices will be - * returned. - * - * Generated from protobuf field string language_code = 1 [(.google.api.field_behavior) = OPTIONAL]; - * @return string - */ - public function getLanguageCode() - { - return $this->language_code; - } - - /** - * Optional. Recommended. - * [BCP-47](https://www.rfc-editor.org/rfc/bcp/bcp47.txt) language tag. - * If not specified, the API will return all supported voices. - * If specified, the ListVoices call will only return voices that can be used - * to synthesize this language_code. For example, if you specify `"en-NZ"`, - * all `"en-NZ"` voices will be returned. If you specify `"no"`, both - * `"no-\*"` (Norwegian) and `"nb-\*"` (Norwegian Bokmal) voices will be - * returned. - * - * Generated from protobuf field string language_code = 1 [(.google.api.field_behavior) = OPTIONAL]; - * @param string $var - * @return $this - */ - public function setLanguageCode($var) - { - GPBUtil::checkString($var, True); - $this->language_code = $var; - - return $this; - } - -} - diff --git a/owl-bot-staging/TextToSpeech/v1/proto/src/Google/Cloud/TextToSpeech/V1/ListVoicesResponse.php b/owl-bot-staging/TextToSpeech/v1/proto/src/Google/Cloud/TextToSpeech/V1/ListVoicesResponse.php deleted file mode 100644 index d28b7ae0e154..000000000000 --- a/owl-bot-staging/TextToSpeech/v1/proto/src/Google/Cloud/TextToSpeech/V1/ListVoicesResponse.php +++ /dev/null @@ -1,67 +0,0 @@ -google.cloud.texttospeech.v1.ListVoicesResponse - */ -class ListVoicesResponse extends \Google\Protobuf\Internal\Message -{ - /** - * The list of voices. - * - * Generated from protobuf field repeated .google.cloud.texttospeech.v1.Voice voices = 1; - */ - private $voices; - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type array<\Google\Cloud\TextToSpeech\V1\Voice>|\Google\Protobuf\Internal\RepeatedField $voices - * The list of voices. - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Cloud\Texttospeech\V1\CloudTts::initOnce(); - parent::__construct($data); - } - - /** - * The list of voices. - * - * Generated from protobuf field repeated .google.cloud.texttospeech.v1.Voice voices = 1; - * @return \Google\Protobuf\Internal\RepeatedField - */ - public function getVoices() - { - return $this->voices; - } - - /** - * The list of voices. - * - * Generated from protobuf field repeated .google.cloud.texttospeech.v1.Voice voices = 1; - * @param array<\Google\Cloud\TextToSpeech\V1\Voice>|\Google\Protobuf\Internal\RepeatedField $var - * @return $this - */ - public function setVoices($var) - { - $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\TextToSpeech\V1\Voice::class); - $this->voices = $arr; - - return $this; - } - -} - diff --git a/owl-bot-staging/TextToSpeech/v1/proto/src/Google/Cloud/TextToSpeech/V1/SsmlVoiceGender.php b/owl-bot-staging/TextToSpeech/v1/proto/src/Google/Cloud/TextToSpeech/V1/SsmlVoiceGender.php deleted file mode 100644 index ca9b5bfd29a5..000000000000 --- a/owl-bot-staging/TextToSpeech/v1/proto/src/Google/Cloud/TextToSpeech/V1/SsmlVoiceGender.php +++ /dev/null @@ -1,73 +0,0 @@ -google.cloud.texttospeech.v1.SsmlVoiceGender - */ -class SsmlVoiceGender -{ - /** - * An unspecified gender. - * In VoiceSelectionParams, this means that the client doesn't care which - * gender the selected voice will have. In the Voice field of - * ListVoicesResponse, this may mean that the voice doesn't fit any of the - * other categories in this enum, or that the gender of the voice isn't known. - * - * Generated from protobuf enum SSML_VOICE_GENDER_UNSPECIFIED = 0; - */ - const SSML_VOICE_GENDER_UNSPECIFIED = 0; - /** - * A male voice. - * - * Generated from protobuf enum MALE = 1; - */ - const MALE = 1; - /** - * A female voice. - * - * Generated from protobuf enum FEMALE = 2; - */ - const FEMALE = 2; - /** - * A gender-neutral voice. This voice is not yet supported. - * - * Generated from protobuf enum NEUTRAL = 3; - */ - const NEUTRAL = 3; - - private static $valueToName = [ - self::SSML_VOICE_GENDER_UNSPECIFIED => 'SSML_VOICE_GENDER_UNSPECIFIED', - self::MALE => 'MALE', - self::FEMALE => 'FEMALE', - self::NEUTRAL => 'NEUTRAL', - ]; - - public static function name($value) - { - if (!isset(self::$valueToName[$value])) { - throw new UnexpectedValueException(sprintf( - 'Enum %s has no name defined for value %s', __CLASS__, $value)); - } - return self::$valueToName[$value]; - } - - - public static function value($name) - { - $const = __CLASS__ . '::' . strtoupper($name); - if (!defined($const)) { - throw new UnexpectedValueException(sprintf( - 'Enum %s has no value defined for name %s', __CLASS__, $name)); - } - return constant($const); - } -} - diff --git a/owl-bot-staging/TextToSpeech/v1/proto/src/Google/Cloud/TextToSpeech/V1/StreamingSynthesisInput.php b/owl-bot-staging/TextToSpeech/v1/proto/src/Google/Cloud/TextToSpeech/V1/StreamingSynthesisInput.php deleted file mode 100644 index c533cb8c4c2a..000000000000 --- a/owl-bot-staging/TextToSpeech/v1/proto/src/Google/Cloud/TextToSpeech/V1/StreamingSynthesisInput.php +++ /dev/null @@ -1,84 +0,0 @@ -google.cloud.texttospeech.v1.StreamingSynthesisInput - */ -class StreamingSynthesisInput extends \Google\Protobuf\Internal\Message -{ - protected $input_source; - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type string $text - * The raw text to be synthesized. It is recommended that each input - * contains complete, terminating sentences, as this will likely result in - * better prosody in the output audio. That being said, users are free to - * input text however they please. - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Cloud\Texttospeech\V1\CloudTts::initOnce(); - parent::__construct($data); - } - - /** - * The raw text to be synthesized. It is recommended that each input - * contains complete, terminating sentences, as this will likely result in - * better prosody in the output audio. That being said, users are free to - * input text however they please. - * - * Generated from protobuf field string text = 1; - * @return string - */ - public function getText() - { - return $this->readOneof(1); - } - - public function hasText() - { - return $this->hasOneof(1); - } - - /** - * The raw text to be synthesized. It is recommended that each input - * contains complete, terminating sentences, as this will likely result in - * better prosody in the output audio. That being said, users are free to - * input text however they please. - * - * Generated from protobuf field string text = 1; - * @param string $var - * @return $this - */ - public function setText($var) - { - GPBUtil::checkString($var, True); - $this->writeOneof(1, $var); - - return $this; - } - - /** - * @return string - */ - public function getInputSource() - { - return $this->whichOneof("input_source"); - } - -} - diff --git a/owl-bot-staging/TextToSpeech/v1/proto/src/Google/Cloud/TextToSpeech/V1/StreamingSynthesizeConfig.php b/owl-bot-staging/TextToSpeech/v1/proto/src/Google/Cloud/TextToSpeech/V1/StreamingSynthesizeConfig.php deleted file mode 100644 index 85db9a292704..000000000000 --- a/owl-bot-staging/TextToSpeech/v1/proto/src/Google/Cloud/TextToSpeech/V1/StreamingSynthesizeConfig.php +++ /dev/null @@ -1,77 +0,0 @@ -google.cloud.texttospeech.v1.StreamingSynthesizeConfig - */ -class StreamingSynthesizeConfig extends \Google\Protobuf\Internal\Message -{ - /** - * Required. The desired voice of the synthesized audio. - * - * Generated from protobuf field .google.cloud.texttospeech.v1.VoiceSelectionParams voice = 1 [(.google.api.field_behavior) = REQUIRED]; - */ - protected $voice = null; - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type \Google\Cloud\TextToSpeech\V1\VoiceSelectionParams $voice - * Required. The desired voice of the synthesized audio. - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Cloud\Texttospeech\V1\CloudTts::initOnce(); - parent::__construct($data); - } - - /** - * Required. The desired voice of the synthesized audio. - * - * Generated from protobuf field .google.cloud.texttospeech.v1.VoiceSelectionParams voice = 1 [(.google.api.field_behavior) = REQUIRED]; - * @return \Google\Cloud\TextToSpeech\V1\VoiceSelectionParams|null - */ - public function getVoice() - { - return $this->voice; - } - - public function hasVoice() - { - return isset($this->voice); - } - - public function clearVoice() - { - unset($this->voice); - } - - /** - * Required. The desired voice of the synthesized audio. - * - * Generated from protobuf field .google.cloud.texttospeech.v1.VoiceSelectionParams voice = 1 [(.google.api.field_behavior) = REQUIRED]; - * @param \Google\Cloud\TextToSpeech\V1\VoiceSelectionParams $var - * @return $this - */ - public function setVoice($var) - { - GPBUtil::checkMessage($var, \Google\Cloud\TextToSpeech\V1\VoiceSelectionParams::class); - $this->voice = $var; - - return $this; - } - -} - diff --git a/owl-bot-staging/TextToSpeech/v1/proto/src/Google/Cloud/TextToSpeech/V1/StreamingSynthesizeRequest.php b/owl-bot-staging/TextToSpeech/v1/proto/src/Google/Cloud/TextToSpeech/V1/StreamingSynthesizeRequest.php deleted file mode 100644 index a6eed7b698ac..000000000000 --- a/owl-bot-staging/TextToSpeech/v1/proto/src/Google/Cloud/TextToSpeech/V1/StreamingSynthesizeRequest.php +++ /dev/null @@ -1,118 +0,0 @@ -google.cloud.texttospeech.v1.StreamingSynthesizeRequest - */ -class StreamingSynthesizeRequest extends \Google\Protobuf\Internal\Message -{ - protected $streaming_request; - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type \Google\Cloud\TextToSpeech\V1\StreamingSynthesizeConfig $streaming_config - * StreamingSynthesizeConfig to be used in this streaming attempt. Only - * specified in the first message sent in a `StreamingSynthesize` call. - * @type \Google\Cloud\TextToSpeech\V1\StreamingSynthesisInput $input - * Input to synthesize. Specified in all messages but the first in a - * `StreamingSynthesize` call. - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Cloud\Texttospeech\V1\CloudTts::initOnce(); - parent::__construct($data); - } - - /** - * StreamingSynthesizeConfig to be used in this streaming attempt. Only - * specified in the first message sent in a `StreamingSynthesize` call. - * - * Generated from protobuf field .google.cloud.texttospeech.v1.StreamingSynthesizeConfig streaming_config = 1; - * @return \Google\Cloud\TextToSpeech\V1\StreamingSynthesizeConfig|null - */ - public function getStreamingConfig() - { - return $this->readOneof(1); - } - - public function hasStreamingConfig() - { - return $this->hasOneof(1); - } - - /** - * StreamingSynthesizeConfig to be used in this streaming attempt. Only - * specified in the first message sent in a `StreamingSynthesize` call. - * - * Generated from protobuf field .google.cloud.texttospeech.v1.StreamingSynthesizeConfig streaming_config = 1; - * @param \Google\Cloud\TextToSpeech\V1\StreamingSynthesizeConfig $var - * @return $this - */ - public function setStreamingConfig($var) - { - GPBUtil::checkMessage($var, \Google\Cloud\TextToSpeech\V1\StreamingSynthesizeConfig::class); - $this->writeOneof(1, $var); - - return $this; - } - - /** - * Input to synthesize. Specified in all messages but the first in a - * `StreamingSynthesize` call. - * - * Generated from protobuf field .google.cloud.texttospeech.v1.StreamingSynthesisInput input = 2; - * @return \Google\Cloud\TextToSpeech\V1\StreamingSynthesisInput|null - */ - public function getInput() - { - return $this->readOneof(2); - } - - public function hasInput() - { - return $this->hasOneof(2); - } - - /** - * Input to synthesize. Specified in all messages but the first in a - * `StreamingSynthesize` call. - * - * Generated from protobuf field .google.cloud.texttospeech.v1.StreamingSynthesisInput input = 2; - * @param \Google\Cloud\TextToSpeech\V1\StreamingSynthesisInput $var - * @return $this - */ - public function setInput($var) - { - GPBUtil::checkMessage($var, \Google\Cloud\TextToSpeech\V1\StreamingSynthesisInput::class); - $this->writeOneof(2, $var); - - return $this; - } - - /** - * @return string - */ - public function getStreamingRequest() - { - return $this->whichOneof("streaming_request"); - } - -} - diff --git a/owl-bot-staging/TextToSpeech/v1/proto/src/Google/Cloud/TextToSpeech/V1/StreamingSynthesizeResponse.php b/owl-bot-staging/TextToSpeech/v1/proto/src/Google/Cloud/TextToSpeech/V1/StreamingSynthesizeResponse.php deleted file mode 100644 index 34eb029802fd..000000000000 --- a/owl-bot-staging/TextToSpeech/v1/proto/src/Google/Cloud/TextToSpeech/V1/StreamingSynthesizeResponse.php +++ /dev/null @@ -1,73 +0,0 @@ -google.cloud.texttospeech.v1.StreamingSynthesizeResponse - */ -class StreamingSynthesizeResponse extends \Google\Protobuf\Internal\Message -{ - /** - * The audio data bytes encoded as specified in the request. This is - * headerless LINEAR16 audio with a sample rate of 24000. - * - * Generated from protobuf field bytes audio_content = 1; - */ - protected $audio_content = ''; - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type string $audio_content - * The audio data bytes encoded as specified in the request. This is - * headerless LINEAR16 audio with a sample rate of 24000. - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Cloud\Texttospeech\V1\CloudTts::initOnce(); - parent::__construct($data); - } - - /** - * The audio data bytes encoded as specified in the request. This is - * headerless LINEAR16 audio with a sample rate of 24000. - * - * Generated from protobuf field bytes audio_content = 1; - * @return string - */ - public function getAudioContent() - { - return $this->audio_content; - } - - /** - * The audio data bytes encoded as specified in the request. This is - * headerless LINEAR16 audio with a sample rate of 24000. - * - * Generated from protobuf field bytes audio_content = 1; - * @param string $var - * @return $this - */ - public function setAudioContent($var) - { - GPBUtil::checkString($var, False); - $this->audio_content = $var; - - return $this; - } - -} - diff --git a/owl-bot-staging/TextToSpeech/v1/proto/src/Google/Cloud/TextToSpeech/V1/SynthesisInput.php b/owl-bot-staging/TextToSpeech/v1/proto/src/Google/Cloud/TextToSpeech/V1/SynthesisInput.php deleted file mode 100644 index 08bf3d2edd5a..000000000000 --- a/owl-bot-staging/TextToSpeech/v1/proto/src/Google/Cloud/TextToSpeech/V1/SynthesisInput.php +++ /dev/null @@ -1,203 +0,0 @@ -google.cloud.texttospeech.v1.SynthesisInput - */ -class SynthesisInput extends \Google\Protobuf\Internal\Message -{ - /** - * Optional. The pronunciation customizations to be applied to the input. If - * this is set, the input will be synthesized using the given pronunciation - * customizations. - * The initial support will be for EFIGS (English, French, - * Italian, German, Spanish) languages, as provided in - * VoiceSelectionParams. Journey and Instant Clone voices are - * not supported yet. - * In order to customize the pronunciation of a phrase, there must be an exact - * match of the phrase in the input types. If using SSML, the phrase must not - * be inside a phoneme tag (entirely or partially). - * - * Generated from protobuf field .google.cloud.texttospeech.v1.CustomPronunciations custom_pronunciations = 3 [(.google.api.field_behavior) = OPTIONAL]; - */ - protected $custom_pronunciations = null; - protected $input_source; - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type string $text - * The raw text to be synthesized. - * @type string $ssml - * The SSML document to be synthesized. The SSML document must be valid - * and well-formed. Otherwise the RPC will fail and return - * [google.rpc.Code.INVALID_ARGUMENT][google.rpc.Code.INVALID_ARGUMENT]. For - * more information, see - * [SSML](https://cloud.google.com/text-to-speech/docs/ssml). - * @type \Google\Cloud\TextToSpeech\V1\CustomPronunciations $custom_pronunciations - * Optional. The pronunciation customizations to be applied to the input. If - * this is set, the input will be synthesized using the given pronunciation - * customizations. - * The initial support will be for EFIGS (English, French, - * Italian, German, Spanish) languages, as provided in - * VoiceSelectionParams. Journey and Instant Clone voices are - * not supported yet. - * In order to customize the pronunciation of a phrase, there must be an exact - * match of the phrase in the input types. If using SSML, the phrase must not - * be inside a phoneme tag (entirely or partially). - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Cloud\Texttospeech\V1\CloudTts::initOnce(); - parent::__construct($data); - } - - /** - * The raw text to be synthesized. - * - * Generated from protobuf field string text = 1; - * @return string - */ - public function getText() - { - return $this->readOneof(1); - } - - public function hasText() - { - return $this->hasOneof(1); - } - - /** - * The raw text to be synthesized. - * - * Generated from protobuf field string text = 1; - * @param string $var - * @return $this - */ - public function setText($var) - { - GPBUtil::checkString($var, True); - $this->writeOneof(1, $var); - - return $this; - } - - /** - * The SSML document to be synthesized. The SSML document must be valid - * and well-formed. Otherwise the RPC will fail and return - * [google.rpc.Code.INVALID_ARGUMENT][google.rpc.Code.INVALID_ARGUMENT]. For - * more information, see - * [SSML](https://cloud.google.com/text-to-speech/docs/ssml). - * - * Generated from protobuf field string ssml = 2; - * @return string - */ - public function getSsml() - { - return $this->readOneof(2); - } - - public function hasSsml() - { - return $this->hasOneof(2); - } - - /** - * The SSML document to be synthesized. The SSML document must be valid - * and well-formed. Otherwise the RPC will fail and return - * [google.rpc.Code.INVALID_ARGUMENT][google.rpc.Code.INVALID_ARGUMENT]. For - * more information, see - * [SSML](https://cloud.google.com/text-to-speech/docs/ssml). - * - * Generated from protobuf field string ssml = 2; - * @param string $var - * @return $this - */ - public function setSsml($var) - { - GPBUtil::checkString($var, True); - $this->writeOneof(2, $var); - - return $this; - } - - /** - * Optional. The pronunciation customizations to be applied to the input. If - * this is set, the input will be synthesized using the given pronunciation - * customizations. - * The initial support will be for EFIGS (English, French, - * Italian, German, Spanish) languages, as provided in - * VoiceSelectionParams. Journey and Instant Clone voices are - * not supported yet. - * In order to customize the pronunciation of a phrase, there must be an exact - * match of the phrase in the input types. If using SSML, the phrase must not - * be inside a phoneme tag (entirely or partially). - * - * Generated from protobuf field .google.cloud.texttospeech.v1.CustomPronunciations custom_pronunciations = 3 [(.google.api.field_behavior) = OPTIONAL]; - * @return \Google\Cloud\TextToSpeech\V1\CustomPronunciations|null - */ - public function getCustomPronunciations() - { - return $this->custom_pronunciations; - } - - public function hasCustomPronunciations() - { - return isset($this->custom_pronunciations); - } - - public function clearCustomPronunciations() - { - unset($this->custom_pronunciations); - } - - /** - * Optional. The pronunciation customizations to be applied to the input. If - * this is set, the input will be synthesized using the given pronunciation - * customizations. - * The initial support will be for EFIGS (English, French, - * Italian, German, Spanish) languages, as provided in - * VoiceSelectionParams. Journey and Instant Clone voices are - * not supported yet. - * In order to customize the pronunciation of a phrase, there must be an exact - * match of the phrase in the input types. If using SSML, the phrase must not - * be inside a phoneme tag (entirely or partially). - * - * Generated from protobuf field .google.cloud.texttospeech.v1.CustomPronunciations custom_pronunciations = 3 [(.google.api.field_behavior) = OPTIONAL]; - * @param \Google\Cloud\TextToSpeech\V1\CustomPronunciations $var - * @return $this - */ - public function setCustomPronunciations($var) - { - GPBUtil::checkMessage($var, \Google\Cloud\TextToSpeech\V1\CustomPronunciations::class); - $this->custom_pronunciations = $var; - - return $this; - } - - /** - * @return string - */ - public function getInputSource() - { - return $this->whichOneof("input_source"); - } - -} - diff --git a/owl-bot-staging/TextToSpeech/v1/proto/src/Google/Cloud/TextToSpeech/V1/SynthesizeLongAudioMetadata.php b/owl-bot-staging/TextToSpeech/v1/proto/src/Google/Cloud/TextToSpeech/V1/SynthesizeLongAudioMetadata.php deleted file mode 100644 index ab9407b4e614..000000000000 --- a/owl-bot-staging/TextToSpeech/v1/proto/src/Google/Cloud/TextToSpeech/V1/SynthesizeLongAudioMetadata.php +++ /dev/null @@ -1,162 +0,0 @@ -google.cloud.texttospeech.v1.SynthesizeLongAudioMetadata - */ -class SynthesizeLongAudioMetadata extends \Google\Protobuf\Internal\Message -{ - /** - * Time when the request was received. - * - * Generated from protobuf field .google.protobuf.Timestamp start_time = 1; - */ - protected $start_time = null; - /** - * Deprecated. Do not use. - * - * Generated from protobuf field .google.protobuf.Timestamp last_update_time = 2 [deprecated = true]; - * @deprecated - */ - protected $last_update_time = null; - /** - * The progress of the most recent processing update in percentage, ie. 70.0%. - * - * Generated from protobuf field double progress_percentage = 3; - */ - protected $progress_percentage = 0.0; - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type \Google\Protobuf\Timestamp $start_time - * Time when the request was received. - * @type \Google\Protobuf\Timestamp $last_update_time - * Deprecated. Do not use. - * @type float $progress_percentage - * The progress of the most recent processing update in percentage, ie. 70.0%. - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Cloud\Texttospeech\V1\CloudTtsLrs::initOnce(); - parent::__construct($data); - } - - /** - * Time when the request was received. - * - * Generated from protobuf field .google.protobuf.Timestamp start_time = 1; - * @return \Google\Protobuf\Timestamp|null - */ - public function getStartTime() - { - return $this->start_time; - } - - public function hasStartTime() - { - return isset($this->start_time); - } - - public function clearStartTime() - { - unset($this->start_time); - } - - /** - * Time when the request was received. - * - * Generated from protobuf field .google.protobuf.Timestamp start_time = 1; - * @param \Google\Protobuf\Timestamp $var - * @return $this - */ - public function setStartTime($var) - { - GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); - $this->start_time = $var; - - return $this; - } - - /** - * Deprecated. Do not use. - * - * Generated from protobuf field .google.protobuf.Timestamp last_update_time = 2 [deprecated = true]; - * @return \Google\Protobuf\Timestamp|null - * @deprecated - */ - public function getLastUpdateTime() - { - @trigger_error('last_update_time is deprecated.', E_USER_DEPRECATED); - return $this->last_update_time; - } - - public function hasLastUpdateTime() - { - @trigger_error('last_update_time is deprecated.', E_USER_DEPRECATED); - return isset($this->last_update_time); - } - - public function clearLastUpdateTime() - { - @trigger_error('last_update_time is deprecated.', E_USER_DEPRECATED); - unset($this->last_update_time); - } - - /** - * Deprecated. Do not use. - * - * Generated from protobuf field .google.protobuf.Timestamp last_update_time = 2 [deprecated = true]; - * @param \Google\Protobuf\Timestamp $var - * @return $this - * @deprecated - */ - public function setLastUpdateTime($var) - { - @trigger_error('last_update_time is deprecated.', E_USER_DEPRECATED); - GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); - $this->last_update_time = $var; - - return $this; - } - - /** - * The progress of the most recent processing update in percentage, ie. 70.0%. - * - * Generated from protobuf field double progress_percentage = 3; - * @return float - */ - public function getProgressPercentage() - { - return $this->progress_percentage; - } - - /** - * The progress of the most recent processing update in percentage, ie. 70.0%. - * - * Generated from protobuf field double progress_percentage = 3; - * @param float $var - * @return $this - */ - public function setProgressPercentage($var) - { - GPBUtil::checkDouble($var); - $this->progress_percentage = $var; - - return $this; - } - -} - diff --git a/owl-bot-staging/TextToSpeech/v1/proto/src/Google/Cloud/TextToSpeech/V1/SynthesizeLongAudioRequest.php b/owl-bot-staging/TextToSpeech/v1/proto/src/Google/Cloud/TextToSpeech/V1/SynthesizeLongAudioRequest.php deleted file mode 100644 index 951eaaae4f4d..000000000000 --- a/owl-bot-staging/TextToSpeech/v1/proto/src/Google/Cloud/TextToSpeech/V1/SynthesizeLongAudioRequest.php +++ /dev/null @@ -1,246 +0,0 @@ -google.cloud.texttospeech.v1.SynthesizeLongAudioRequest - */ -class SynthesizeLongAudioRequest extends \Google\Protobuf\Internal\Message -{ - /** - * The resource states of the request in the form of - * `projects/*/locations/*`. - * - * Generated from protobuf field string parent = 1; - */ - protected $parent = ''; - /** - * Required. The Synthesizer requires either plain text or SSML as input. - * - * Generated from protobuf field .google.cloud.texttospeech.v1.SynthesisInput input = 2 [(.google.api.field_behavior) = REQUIRED]; - */ - protected $input = null; - /** - * Required. The configuration of the synthesized audio. - * - * Generated from protobuf field .google.cloud.texttospeech.v1.AudioConfig audio_config = 3 [(.google.api.field_behavior) = REQUIRED]; - */ - protected $audio_config = null; - /** - * Required. Specifies a Cloud Storage URI for the synthesis results. Must be - * specified in the format: `gs://bucket_name/object_name`, and the bucket - * must already exist. - * - * Generated from protobuf field string output_gcs_uri = 4 [(.google.api.field_behavior) = REQUIRED]; - */ - protected $output_gcs_uri = ''; - /** - * Required. The desired voice of the synthesized audio. - * - * Generated from protobuf field .google.cloud.texttospeech.v1.VoiceSelectionParams voice = 5 [(.google.api.field_behavior) = REQUIRED]; - */ - protected $voice = null; - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type string $parent - * The resource states of the request in the form of - * `projects/*/locations/*`. - * @type \Google\Cloud\TextToSpeech\V1\SynthesisInput $input - * Required. The Synthesizer requires either plain text or SSML as input. - * @type \Google\Cloud\TextToSpeech\V1\AudioConfig $audio_config - * Required. The configuration of the synthesized audio. - * @type string $output_gcs_uri - * Required. Specifies a Cloud Storage URI for the synthesis results. Must be - * specified in the format: `gs://bucket_name/object_name`, and the bucket - * must already exist. - * @type \Google\Cloud\TextToSpeech\V1\VoiceSelectionParams $voice - * Required. The desired voice of the synthesized audio. - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Cloud\Texttospeech\V1\CloudTtsLrs::initOnce(); - parent::__construct($data); - } - - /** - * The resource states of the request in the form of - * `projects/*/locations/*`. - * - * Generated from protobuf field string parent = 1; - * @return string - */ - public function getParent() - { - return $this->parent; - } - - /** - * The resource states of the request in the form of - * `projects/*/locations/*`. - * - * Generated from protobuf field string parent = 1; - * @param string $var - * @return $this - */ - public function setParent($var) - { - GPBUtil::checkString($var, True); - $this->parent = $var; - - return $this; - } - - /** - * Required. The Synthesizer requires either plain text or SSML as input. - * - * Generated from protobuf field .google.cloud.texttospeech.v1.SynthesisInput input = 2 [(.google.api.field_behavior) = REQUIRED]; - * @return \Google\Cloud\TextToSpeech\V1\SynthesisInput|null - */ - public function getInput() - { - return $this->input; - } - - public function hasInput() - { - return isset($this->input); - } - - public function clearInput() - { - unset($this->input); - } - - /** - * Required. The Synthesizer requires either plain text or SSML as input. - * - * Generated from protobuf field .google.cloud.texttospeech.v1.SynthesisInput input = 2 [(.google.api.field_behavior) = REQUIRED]; - * @param \Google\Cloud\TextToSpeech\V1\SynthesisInput $var - * @return $this - */ - public function setInput($var) - { - GPBUtil::checkMessage($var, \Google\Cloud\TextToSpeech\V1\SynthesisInput::class); - $this->input = $var; - - return $this; - } - - /** - * Required. The configuration of the synthesized audio. - * - * Generated from protobuf field .google.cloud.texttospeech.v1.AudioConfig audio_config = 3 [(.google.api.field_behavior) = REQUIRED]; - * @return \Google\Cloud\TextToSpeech\V1\AudioConfig|null - */ - public function getAudioConfig() - { - return $this->audio_config; - } - - public function hasAudioConfig() - { - return isset($this->audio_config); - } - - public function clearAudioConfig() - { - unset($this->audio_config); - } - - /** - * Required. The configuration of the synthesized audio. - * - * Generated from protobuf field .google.cloud.texttospeech.v1.AudioConfig audio_config = 3 [(.google.api.field_behavior) = REQUIRED]; - * @param \Google\Cloud\TextToSpeech\V1\AudioConfig $var - * @return $this - */ - public function setAudioConfig($var) - { - GPBUtil::checkMessage($var, \Google\Cloud\TextToSpeech\V1\AudioConfig::class); - $this->audio_config = $var; - - return $this; - } - - /** - * Required. Specifies a Cloud Storage URI for the synthesis results. Must be - * specified in the format: `gs://bucket_name/object_name`, and the bucket - * must already exist. - * - * Generated from protobuf field string output_gcs_uri = 4 [(.google.api.field_behavior) = REQUIRED]; - * @return string - */ - public function getOutputGcsUri() - { - return $this->output_gcs_uri; - } - - /** - * Required. Specifies a Cloud Storage URI for the synthesis results. Must be - * specified in the format: `gs://bucket_name/object_name`, and the bucket - * must already exist. - * - * Generated from protobuf field string output_gcs_uri = 4 [(.google.api.field_behavior) = REQUIRED]; - * @param string $var - * @return $this - */ - public function setOutputGcsUri($var) - { - GPBUtil::checkString($var, True); - $this->output_gcs_uri = $var; - - return $this; - } - - /** - * Required. The desired voice of the synthesized audio. - * - * Generated from protobuf field .google.cloud.texttospeech.v1.VoiceSelectionParams voice = 5 [(.google.api.field_behavior) = REQUIRED]; - * @return \Google\Cloud\TextToSpeech\V1\VoiceSelectionParams|null - */ - public function getVoice() - { - return $this->voice; - } - - public function hasVoice() - { - return isset($this->voice); - } - - public function clearVoice() - { - unset($this->voice); - } - - /** - * Required. The desired voice of the synthesized audio. - * - * Generated from protobuf field .google.cloud.texttospeech.v1.VoiceSelectionParams voice = 5 [(.google.api.field_behavior) = REQUIRED]; - * @param \Google\Cloud\TextToSpeech\V1\VoiceSelectionParams $var - * @return $this - */ - public function setVoice($var) - { - GPBUtil::checkMessage($var, \Google\Cloud\TextToSpeech\V1\VoiceSelectionParams::class); - $this->voice = $var; - - return $this; - } - -} - diff --git a/owl-bot-staging/TextToSpeech/v1/proto/src/Google/Cloud/TextToSpeech/V1/SynthesizeLongAudioResponse.php b/owl-bot-staging/TextToSpeech/v1/proto/src/Google/Cloud/TextToSpeech/V1/SynthesizeLongAudioResponse.php deleted file mode 100644 index e1a3d25b4131..000000000000 --- a/owl-bot-staging/TextToSpeech/v1/proto/src/Google/Cloud/TextToSpeech/V1/SynthesizeLongAudioResponse.php +++ /dev/null @@ -1,33 +0,0 @@ -google.cloud.texttospeech.v1.SynthesizeLongAudioResponse - */ -class SynthesizeLongAudioResponse extends \Google\Protobuf\Internal\Message -{ - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Cloud\Texttospeech\V1\CloudTtsLrs::initOnce(); - parent::__construct($data); - } - -} - diff --git a/owl-bot-staging/TextToSpeech/v1/proto/src/Google/Cloud/TextToSpeech/V1/SynthesizeSpeechRequest.php b/owl-bot-staging/TextToSpeech/v1/proto/src/Google/Cloud/TextToSpeech/V1/SynthesizeSpeechRequest.php deleted file mode 100644 index ee0e47f31fe5..000000000000 --- a/owl-bot-staging/TextToSpeech/v1/proto/src/Google/Cloud/TextToSpeech/V1/SynthesizeSpeechRequest.php +++ /dev/null @@ -1,226 +0,0 @@ -google.cloud.texttospeech.v1.SynthesizeSpeechRequest - */ -class SynthesizeSpeechRequest extends \Google\Protobuf\Internal\Message -{ - /** - * Required. The Synthesizer requires either plain text or SSML as input. - * - * Generated from protobuf field .google.cloud.texttospeech.v1.SynthesisInput input = 1 [(.google.api.field_behavior) = REQUIRED]; - */ - protected $input = null; - /** - * Required. The desired voice of the synthesized audio. - * - * Generated from protobuf field .google.cloud.texttospeech.v1.VoiceSelectionParams voice = 2 [(.google.api.field_behavior) = REQUIRED]; - */ - protected $voice = null; - /** - * Required. The configuration of the synthesized audio. - * - * Generated from protobuf field .google.cloud.texttospeech.v1.AudioConfig audio_config = 3 [(.google.api.field_behavior) = REQUIRED]; - */ - protected $audio_config = null; - /** - * Advanced voice options. - * - * Generated from protobuf field optional .google.cloud.texttospeech.v1.AdvancedVoiceOptions advanced_voice_options = 8; - */ - protected $advanced_voice_options = null; - - /** - * @param \Google\Cloud\TextToSpeech\V1\SynthesisInput $input Required. The Synthesizer requires either plain text or SSML as input. - * @param \Google\Cloud\TextToSpeech\V1\VoiceSelectionParams $voice Required. The desired voice of the synthesized audio. - * @param \Google\Cloud\TextToSpeech\V1\AudioConfig $audioConfig Required. The configuration of the synthesized audio. - * - * @return \Google\Cloud\TextToSpeech\V1\SynthesizeSpeechRequest - * - * @experimental - */ - public static function build(\Google\Cloud\TextToSpeech\V1\SynthesisInput $input, \Google\Cloud\TextToSpeech\V1\VoiceSelectionParams $voice, \Google\Cloud\TextToSpeech\V1\AudioConfig $audioConfig): self - { - return (new self()) - ->setInput($input) - ->setVoice($voice) - ->setAudioConfig($audioConfig); - } - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type \Google\Cloud\TextToSpeech\V1\SynthesisInput $input - * Required. The Synthesizer requires either plain text or SSML as input. - * @type \Google\Cloud\TextToSpeech\V1\VoiceSelectionParams $voice - * Required. The desired voice of the synthesized audio. - * @type \Google\Cloud\TextToSpeech\V1\AudioConfig $audio_config - * Required. The configuration of the synthesized audio. - * @type \Google\Cloud\TextToSpeech\V1\AdvancedVoiceOptions $advanced_voice_options - * Advanced voice options. - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Cloud\Texttospeech\V1\CloudTts::initOnce(); - parent::__construct($data); - } - - /** - * Required. The Synthesizer requires either plain text or SSML as input. - * - * Generated from protobuf field .google.cloud.texttospeech.v1.SynthesisInput input = 1 [(.google.api.field_behavior) = REQUIRED]; - * @return \Google\Cloud\TextToSpeech\V1\SynthesisInput|null - */ - public function getInput() - { - return $this->input; - } - - public function hasInput() - { - return isset($this->input); - } - - public function clearInput() - { - unset($this->input); - } - - /** - * Required. The Synthesizer requires either plain text or SSML as input. - * - * Generated from protobuf field .google.cloud.texttospeech.v1.SynthesisInput input = 1 [(.google.api.field_behavior) = REQUIRED]; - * @param \Google\Cloud\TextToSpeech\V1\SynthesisInput $var - * @return $this - */ - public function setInput($var) - { - GPBUtil::checkMessage($var, \Google\Cloud\TextToSpeech\V1\SynthesisInput::class); - $this->input = $var; - - return $this; - } - - /** - * Required. The desired voice of the synthesized audio. - * - * Generated from protobuf field .google.cloud.texttospeech.v1.VoiceSelectionParams voice = 2 [(.google.api.field_behavior) = REQUIRED]; - * @return \Google\Cloud\TextToSpeech\V1\VoiceSelectionParams|null - */ - public function getVoice() - { - return $this->voice; - } - - public function hasVoice() - { - return isset($this->voice); - } - - public function clearVoice() - { - unset($this->voice); - } - - /** - * Required. The desired voice of the synthesized audio. - * - * Generated from protobuf field .google.cloud.texttospeech.v1.VoiceSelectionParams voice = 2 [(.google.api.field_behavior) = REQUIRED]; - * @param \Google\Cloud\TextToSpeech\V1\VoiceSelectionParams $var - * @return $this - */ - public function setVoice($var) - { - GPBUtil::checkMessage($var, \Google\Cloud\TextToSpeech\V1\VoiceSelectionParams::class); - $this->voice = $var; - - return $this; - } - - /** - * Required. The configuration of the synthesized audio. - * - * Generated from protobuf field .google.cloud.texttospeech.v1.AudioConfig audio_config = 3 [(.google.api.field_behavior) = REQUIRED]; - * @return \Google\Cloud\TextToSpeech\V1\AudioConfig|null - */ - public function getAudioConfig() - { - return $this->audio_config; - } - - public function hasAudioConfig() - { - return isset($this->audio_config); - } - - public function clearAudioConfig() - { - unset($this->audio_config); - } - - /** - * Required. The configuration of the synthesized audio. - * - * Generated from protobuf field .google.cloud.texttospeech.v1.AudioConfig audio_config = 3 [(.google.api.field_behavior) = REQUIRED]; - * @param \Google\Cloud\TextToSpeech\V1\AudioConfig $var - * @return $this - */ - public function setAudioConfig($var) - { - GPBUtil::checkMessage($var, \Google\Cloud\TextToSpeech\V1\AudioConfig::class); - $this->audio_config = $var; - - return $this; - } - - /** - * Advanced voice options. - * - * Generated from protobuf field optional .google.cloud.texttospeech.v1.AdvancedVoiceOptions advanced_voice_options = 8; - * @return \Google\Cloud\TextToSpeech\V1\AdvancedVoiceOptions|null - */ - public function getAdvancedVoiceOptions() - { - return $this->advanced_voice_options; - } - - public function hasAdvancedVoiceOptions() - { - return isset($this->advanced_voice_options); - } - - public function clearAdvancedVoiceOptions() - { - unset($this->advanced_voice_options); - } - - /** - * Advanced voice options. - * - * Generated from protobuf field optional .google.cloud.texttospeech.v1.AdvancedVoiceOptions advanced_voice_options = 8; - * @param \Google\Cloud\TextToSpeech\V1\AdvancedVoiceOptions $var - * @return $this - */ - public function setAdvancedVoiceOptions($var) - { - GPBUtil::checkMessage($var, \Google\Cloud\TextToSpeech\V1\AdvancedVoiceOptions::class); - $this->advanced_voice_options = $var; - - return $this; - } - -} - diff --git a/owl-bot-staging/TextToSpeech/v1/proto/src/Google/Cloud/TextToSpeech/V1/SynthesizeSpeechResponse.php b/owl-bot-staging/TextToSpeech/v1/proto/src/Google/Cloud/TextToSpeech/V1/SynthesizeSpeechResponse.php deleted file mode 100644 index bfe3329eb5e2..000000000000 --- a/owl-bot-staging/TextToSpeech/v1/proto/src/Google/Cloud/TextToSpeech/V1/SynthesizeSpeechResponse.php +++ /dev/null @@ -1,83 +0,0 @@ -google.cloud.texttospeech.v1.SynthesizeSpeechResponse - */ -class SynthesizeSpeechResponse extends \Google\Protobuf\Internal\Message -{ - /** - * The audio data bytes encoded as specified in the request, including the - * header for encodings that are wrapped in containers (e.g. MP3, OGG_OPUS). - * For LINEAR16 audio, we include the WAV header. Note: as - * with all bytes fields, protobuffers use a pure binary representation, - * whereas JSON representations use base64. - * - * Generated from protobuf field bytes audio_content = 1; - */ - protected $audio_content = ''; - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type string $audio_content - * The audio data bytes encoded as specified in the request, including the - * header for encodings that are wrapped in containers (e.g. MP3, OGG_OPUS). - * For LINEAR16 audio, we include the WAV header. Note: as - * with all bytes fields, protobuffers use a pure binary representation, - * whereas JSON representations use base64. - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Cloud\Texttospeech\V1\CloudTts::initOnce(); - parent::__construct($data); - } - - /** - * The audio data bytes encoded as specified in the request, including the - * header for encodings that are wrapped in containers (e.g. MP3, OGG_OPUS). - * For LINEAR16 audio, we include the WAV header. Note: as - * with all bytes fields, protobuffers use a pure binary representation, - * whereas JSON representations use base64. - * - * Generated from protobuf field bytes audio_content = 1; - * @return string - */ - public function getAudioContent() - { - return $this->audio_content; - } - - /** - * The audio data bytes encoded as specified in the request, including the - * header for encodings that are wrapped in containers (e.g. MP3, OGG_OPUS). - * For LINEAR16 audio, we include the WAV header. Note: as - * with all bytes fields, protobuffers use a pure binary representation, - * whereas JSON representations use base64. - * - * Generated from protobuf field bytes audio_content = 1; - * @param string $var - * @return $this - */ - public function setAudioContent($var) - { - GPBUtil::checkString($var, False); - $this->audio_content = $var; - - return $this; - } - -} - diff --git a/owl-bot-staging/TextToSpeech/v1/proto/src/Google/Cloud/TextToSpeech/V1/Voice.php b/owl-bot-staging/TextToSpeech/v1/proto/src/Google/Cloud/TextToSpeech/V1/Voice.php deleted file mode 100644 index f53642965390..000000000000 --- a/owl-bot-staging/TextToSpeech/v1/proto/src/Google/Cloud/TextToSpeech/V1/Voice.php +++ /dev/null @@ -1,177 +0,0 @@ -google.cloud.texttospeech.v1.Voice - */ -class Voice extends \Google\Protobuf\Internal\Message -{ - /** - * The languages that this voice supports, expressed as - * [BCP-47](https://www.rfc-editor.org/rfc/bcp/bcp47.txt) language tags (e.g. - * "en-US", "es-419", "cmn-tw"). - * - * Generated from protobuf field repeated string language_codes = 1; - */ - private $language_codes; - /** - * The name of this voice. Each distinct voice has a unique name. - * - * Generated from protobuf field string name = 2; - */ - protected $name = ''; - /** - * The gender of this voice. - * - * Generated from protobuf field .google.cloud.texttospeech.v1.SsmlVoiceGender ssml_gender = 3; - */ - protected $ssml_gender = 0; - /** - * The natural sample rate (in hertz) for this voice. - * - * Generated from protobuf field int32 natural_sample_rate_hertz = 4; - */ - protected $natural_sample_rate_hertz = 0; - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type array|\Google\Protobuf\Internal\RepeatedField $language_codes - * The languages that this voice supports, expressed as - * [BCP-47](https://www.rfc-editor.org/rfc/bcp/bcp47.txt) language tags (e.g. - * "en-US", "es-419", "cmn-tw"). - * @type string $name - * The name of this voice. Each distinct voice has a unique name. - * @type int $ssml_gender - * The gender of this voice. - * @type int $natural_sample_rate_hertz - * The natural sample rate (in hertz) for this voice. - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Cloud\Texttospeech\V1\CloudTts::initOnce(); - parent::__construct($data); - } - - /** - * The languages that this voice supports, expressed as - * [BCP-47](https://www.rfc-editor.org/rfc/bcp/bcp47.txt) language tags (e.g. - * "en-US", "es-419", "cmn-tw"). - * - * Generated from protobuf field repeated string language_codes = 1; - * @return \Google\Protobuf\Internal\RepeatedField - */ - public function getLanguageCodes() - { - return $this->language_codes; - } - - /** - * The languages that this voice supports, expressed as - * [BCP-47](https://www.rfc-editor.org/rfc/bcp/bcp47.txt) language tags (e.g. - * "en-US", "es-419", "cmn-tw"). - * - * Generated from protobuf field repeated string language_codes = 1; - * @param array|\Google\Protobuf\Internal\RepeatedField $var - * @return $this - */ - public function setLanguageCodes($var) - { - $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); - $this->language_codes = $arr; - - return $this; - } - - /** - * The name of this voice. Each distinct voice has a unique name. - * - * Generated from protobuf field string name = 2; - * @return string - */ - public function getName() - { - return $this->name; - } - - /** - * The name of this voice. Each distinct voice has a unique name. - * - * Generated from protobuf field string name = 2; - * @param string $var - * @return $this - */ - public function setName($var) - { - GPBUtil::checkString($var, True); - $this->name = $var; - - return $this; - } - - /** - * The gender of this voice. - * - * Generated from protobuf field .google.cloud.texttospeech.v1.SsmlVoiceGender ssml_gender = 3; - * @return int - */ - public function getSsmlGender() - { - return $this->ssml_gender; - } - - /** - * The gender of this voice. - * - * Generated from protobuf field .google.cloud.texttospeech.v1.SsmlVoiceGender ssml_gender = 3; - * @param int $var - * @return $this - */ - public function setSsmlGender($var) - { - GPBUtil::checkEnum($var, \Google\Cloud\TextToSpeech\V1\SsmlVoiceGender::class); - $this->ssml_gender = $var; - - return $this; - } - - /** - * The natural sample rate (in hertz) for this voice. - * - * Generated from protobuf field int32 natural_sample_rate_hertz = 4; - * @return int - */ - public function getNaturalSampleRateHertz() - { - return $this->natural_sample_rate_hertz; - } - - /** - * The natural sample rate (in hertz) for this voice. - * - * Generated from protobuf field int32 natural_sample_rate_hertz = 4; - * @param int $var - * @return $this - */ - public function setNaturalSampleRateHertz($var) - { - GPBUtil::checkInt32($var); - $this->natural_sample_rate_hertz = $var; - - return $this; - } - -} - diff --git a/owl-bot-staging/TextToSpeech/v1/proto/src/Google/Cloud/TextToSpeech/V1/VoiceSelectionParams.php b/owl-bot-staging/TextToSpeech/v1/proto/src/Google/Cloud/TextToSpeech/V1/VoiceSelectionParams.php deleted file mode 100644 index 5ccf9c11db9b..000000000000 --- a/owl-bot-staging/TextToSpeech/v1/proto/src/Google/Cloud/TextToSpeech/V1/VoiceSelectionParams.php +++ /dev/null @@ -1,303 +0,0 @@ -google.cloud.texttospeech.v1.VoiceSelectionParams - */ -class VoiceSelectionParams extends \Google\Protobuf\Internal\Message -{ - /** - * Required. The language (and potentially also the region) of the voice - * expressed as a [BCP-47](https://www.rfc-editor.org/rfc/bcp/bcp47.txt) - * language tag, e.g. "en-US". This should not include a script tag (e.g. use - * "cmn-cn" rather than "cmn-Hant-cn"), because the script will be inferred - * from the input provided in the SynthesisInput. The TTS service - * will use this parameter to help choose an appropriate voice. Note that - * the TTS service may choose a voice with a slightly different language code - * than the one selected; it may substitute a different region - * (e.g. using en-US rather than en-CA if there isn't a Canadian voice - * available), or even a different language, e.g. using "nb" (Norwegian - * Bokmal) instead of "no" (Norwegian)". - * - * Generated from protobuf field string language_code = 1 [(.google.api.field_behavior) = REQUIRED]; - */ - protected $language_code = ''; - /** - * The name of the voice. If both the name and the gender are not set, - * the service will choose a voice based on the other parameters such as - * language_code. - * - * Generated from protobuf field string name = 2; - */ - protected $name = ''; - /** - * The preferred gender of the voice. If not set, the service will - * choose a voice based on the other parameters such as language_code and - * name. Note that this is only a preference, not requirement; if a - * voice of the appropriate gender is not available, the synthesizer should - * substitute a voice with a different gender rather than failing the request. - * - * Generated from protobuf field .google.cloud.texttospeech.v1.SsmlVoiceGender ssml_gender = 3; - */ - protected $ssml_gender = 0; - /** - * The configuration for a custom voice. If [CustomVoiceParams.model] is set, - * the service will choose the custom voice matching the specified - * configuration. - * - * Generated from protobuf field .google.cloud.texttospeech.v1.CustomVoiceParams custom_voice = 4; - */ - protected $custom_voice = null; - /** - * Optional. The configuration for a voice clone. If - * [VoiceCloneParams.voice_clone_key] is set, the service will choose the - * voice clone matching the specified configuration. - * - * Generated from protobuf field .google.cloud.texttospeech.v1.VoiceCloneParams voice_clone = 5 [(.google.api.field_behavior) = OPTIONAL]; - */ - protected $voice_clone = null; - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type string $language_code - * Required. The language (and potentially also the region) of the voice - * expressed as a [BCP-47](https://www.rfc-editor.org/rfc/bcp/bcp47.txt) - * language tag, e.g. "en-US". This should not include a script tag (e.g. use - * "cmn-cn" rather than "cmn-Hant-cn"), because the script will be inferred - * from the input provided in the SynthesisInput. The TTS service - * will use this parameter to help choose an appropriate voice. Note that - * the TTS service may choose a voice with a slightly different language code - * than the one selected; it may substitute a different region - * (e.g. using en-US rather than en-CA if there isn't a Canadian voice - * available), or even a different language, e.g. using "nb" (Norwegian - * Bokmal) instead of "no" (Norwegian)". - * @type string $name - * The name of the voice. If both the name and the gender are not set, - * the service will choose a voice based on the other parameters such as - * language_code. - * @type int $ssml_gender - * The preferred gender of the voice. If not set, the service will - * choose a voice based on the other parameters such as language_code and - * name. Note that this is only a preference, not requirement; if a - * voice of the appropriate gender is not available, the synthesizer should - * substitute a voice with a different gender rather than failing the request. - * @type \Google\Cloud\TextToSpeech\V1\CustomVoiceParams $custom_voice - * The configuration for a custom voice. If [CustomVoiceParams.model] is set, - * the service will choose the custom voice matching the specified - * configuration. - * @type \Google\Cloud\TextToSpeech\V1\VoiceCloneParams $voice_clone - * Optional. The configuration for a voice clone. If - * [VoiceCloneParams.voice_clone_key] is set, the service will choose the - * voice clone matching the specified configuration. - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Cloud\Texttospeech\V1\CloudTts::initOnce(); - parent::__construct($data); - } - - /** - * Required. The language (and potentially also the region) of the voice - * expressed as a [BCP-47](https://www.rfc-editor.org/rfc/bcp/bcp47.txt) - * language tag, e.g. "en-US". This should not include a script tag (e.g. use - * "cmn-cn" rather than "cmn-Hant-cn"), because the script will be inferred - * from the input provided in the SynthesisInput. The TTS service - * will use this parameter to help choose an appropriate voice. Note that - * the TTS service may choose a voice with a slightly different language code - * than the one selected; it may substitute a different region - * (e.g. using en-US rather than en-CA if there isn't a Canadian voice - * available), or even a different language, e.g. using "nb" (Norwegian - * Bokmal) instead of "no" (Norwegian)". - * - * Generated from protobuf field string language_code = 1 [(.google.api.field_behavior) = REQUIRED]; - * @return string - */ - public function getLanguageCode() - { - return $this->language_code; - } - - /** - * Required. The language (and potentially also the region) of the voice - * expressed as a [BCP-47](https://www.rfc-editor.org/rfc/bcp/bcp47.txt) - * language tag, e.g. "en-US". This should not include a script tag (e.g. use - * "cmn-cn" rather than "cmn-Hant-cn"), because the script will be inferred - * from the input provided in the SynthesisInput. The TTS service - * will use this parameter to help choose an appropriate voice. Note that - * the TTS service may choose a voice with a slightly different language code - * than the one selected; it may substitute a different region - * (e.g. using en-US rather than en-CA if there isn't a Canadian voice - * available), or even a different language, e.g. using "nb" (Norwegian - * Bokmal) instead of "no" (Norwegian)". - * - * Generated from protobuf field string language_code = 1 [(.google.api.field_behavior) = REQUIRED]; - * @param string $var - * @return $this - */ - public function setLanguageCode($var) - { - GPBUtil::checkString($var, True); - $this->language_code = $var; - - return $this; - } - - /** - * The name of the voice. If both the name and the gender are not set, - * the service will choose a voice based on the other parameters such as - * language_code. - * - * Generated from protobuf field string name = 2; - * @return string - */ - public function getName() - { - return $this->name; - } - - /** - * The name of the voice. If both the name and the gender are not set, - * the service will choose a voice based on the other parameters such as - * language_code. - * - * Generated from protobuf field string name = 2; - * @param string $var - * @return $this - */ - public function setName($var) - { - GPBUtil::checkString($var, True); - $this->name = $var; - - return $this; - } - - /** - * The preferred gender of the voice. If not set, the service will - * choose a voice based on the other parameters such as language_code and - * name. Note that this is only a preference, not requirement; if a - * voice of the appropriate gender is not available, the synthesizer should - * substitute a voice with a different gender rather than failing the request. - * - * Generated from protobuf field .google.cloud.texttospeech.v1.SsmlVoiceGender ssml_gender = 3; - * @return int - */ - public function getSsmlGender() - { - return $this->ssml_gender; - } - - /** - * The preferred gender of the voice. If not set, the service will - * choose a voice based on the other parameters such as language_code and - * name. Note that this is only a preference, not requirement; if a - * voice of the appropriate gender is not available, the synthesizer should - * substitute a voice with a different gender rather than failing the request. - * - * Generated from protobuf field .google.cloud.texttospeech.v1.SsmlVoiceGender ssml_gender = 3; - * @param int $var - * @return $this - */ - public function setSsmlGender($var) - { - GPBUtil::checkEnum($var, \Google\Cloud\TextToSpeech\V1\SsmlVoiceGender::class); - $this->ssml_gender = $var; - - return $this; - } - - /** - * The configuration for a custom voice. If [CustomVoiceParams.model] is set, - * the service will choose the custom voice matching the specified - * configuration. - * - * Generated from protobuf field .google.cloud.texttospeech.v1.CustomVoiceParams custom_voice = 4; - * @return \Google\Cloud\TextToSpeech\V1\CustomVoiceParams|null - */ - public function getCustomVoice() - { - return $this->custom_voice; - } - - public function hasCustomVoice() - { - return isset($this->custom_voice); - } - - public function clearCustomVoice() - { - unset($this->custom_voice); - } - - /** - * The configuration for a custom voice. If [CustomVoiceParams.model] is set, - * the service will choose the custom voice matching the specified - * configuration. - * - * Generated from protobuf field .google.cloud.texttospeech.v1.CustomVoiceParams custom_voice = 4; - * @param \Google\Cloud\TextToSpeech\V1\CustomVoiceParams $var - * @return $this - */ - public function setCustomVoice($var) - { - GPBUtil::checkMessage($var, \Google\Cloud\TextToSpeech\V1\CustomVoiceParams::class); - $this->custom_voice = $var; - - return $this; - } - - /** - * Optional. The configuration for a voice clone. If - * [VoiceCloneParams.voice_clone_key] is set, the service will choose the - * voice clone matching the specified configuration. - * - * Generated from protobuf field .google.cloud.texttospeech.v1.VoiceCloneParams voice_clone = 5 [(.google.api.field_behavior) = OPTIONAL]; - * @return \Google\Cloud\TextToSpeech\V1\VoiceCloneParams|null - */ - public function getVoiceClone() - { - return $this->voice_clone; - } - - public function hasVoiceClone() - { - return isset($this->voice_clone); - } - - public function clearVoiceClone() - { - unset($this->voice_clone); - } - - /** - * Optional. The configuration for a voice clone. If - * [VoiceCloneParams.voice_clone_key] is set, the service will choose the - * voice clone matching the specified configuration. - * - * Generated from protobuf field .google.cloud.texttospeech.v1.VoiceCloneParams voice_clone = 5 [(.google.api.field_behavior) = OPTIONAL]; - * @param \Google\Cloud\TextToSpeech\V1\VoiceCloneParams $var - * @return $this - */ - public function setVoiceClone($var) - { - GPBUtil::checkMessage($var, \Google\Cloud\TextToSpeech\V1\VoiceCloneParams::class); - $this->voice_clone = $var; - - return $this; - } - -} - diff --git a/owl-bot-staging/TextToSpeech/v1/samples/V1/TextToSpeechClient/list_voices.php b/owl-bot-staging/TextToSpeech/v1/samples/V1/TextToSpeechClient/list_voices.php deleted file mode 100644 index 2a4357540ab2..000000000000 --- a/owl-bot-staging/TextToSpeech/v1/samples/V1/TextToSpeechClient/list_voices.php +++ /dev/null @@ -1,57 +0,0 @@ -listVoices($request); - printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); - } catch (ApiException $ex) { - printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); - } -} -// [END texttospeech_v1_generated_TextToSpeech_ListVoices_sync] diff --git a/owl-bot-staging/TextToSpeech/v1/samples/V1/TextToSpeechClient/streaming_synthesize.php b/owl-bot-staging/TextToSpeech/v1/samples/V1/TextToSpeechClient/streaming_synthesize.php deleted file mode 100644 index 47a97cf434aa..000000000000 --- a/owl-bot-staging/TextToSpeech/v1/samples/V1/TextToSpeechClient/streaming_synthesize.php +++ /dev/null @@ -1,64 +0,0 @@ -streamingSynthesize(); - $stream->writeAll([$request,]); - - /** @var StreamingSynthesizeResponse $element */ - foreach ($stream->closeWriteAndReadAll() as $element) { - printf('Element data: %s' . PHP_EOL, $element->serializeToJsonString()); - } - } catch (ApiException $ex) { - printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); - } -} -// [END texttospeech_v1_generated_TextToSpeech_StreamingSynthesize_sync] diff --git a/owl-bot-staging/TextToSpeech/v1/samples/V1/TextToSpeechClient/synthesize_speech.php b/owl-bot-staging/TextToSpeech/v1/samples/V1/TextToSpeechClient/synthesize_speech.php deleted file mode 100644 index f6bac9ae2c38..000000000000 --- a/owl-bot-staging/TextToSpeech/v1/samples/V1/TextToSpeechClient/synthesize_speech.php +++ /dev/null @@ -1,94 +0,0 @@ -setLanguageCode($voiceLanguageCode); - $audioConfig = (new AudioConfig()) - ->setAudioEncoding($audioConfigAudioEncoding); - $request = (new SynthesizeSpeechRequest()) - ->setInput($input) - ->setVoice($voice) - ->setAudioConfig($audioConfig); - - // Call the API and handle any network failures. - try { - /** @var SynthesizeSpeechResponse $response */ - $response = $textToSpeechClient->synthesizeSpeech($request); - printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); - } catch (ApiException $ex) { - printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); - } -} - -/** - * Helper to execute the sample. - * - * This sample has been automatically generated and should be regarded as a code - * template only. It will require modifications to work: - * - It may require correct/in-range values for request initialization. - * - It may require specifying regional endpoints when creating the service client, - * please see the apiEndpoint client configuration option for more details. - */ -function callSample(): void -{ - $voiceLanguageCode = '[LANGUAGE_CODE]'; - $audioConfigAudioEncoding = AudioEncoding::AUDIO_ENCODING_UNSPECIFIED; - - synthesize_speech_sample($voiceLanguageCode, $audioConfigAudioEncoding); -} -// [END texttospeech_v1_generated_TextToSpeech_SynthesizeSpeech_sync] diff --git a/owl-bot-staging/TextToSpeech/v1/samples/V1/TextToSpeechLongAudioSynthesizeClient/synthesize_long_audio.php b/owl-bot-staging/TextToSpeech/v1/samples/V1/TextToSpeechLongAudioSynthesizeClient/synthesize_long_audio.php deleted file mode 100644 index cf9eaa3f258c..000000000000 --- a/owl-bot-staging/TextToSpeech/v1/samples/V1/TextToSpeechLongAudioSynthesizeClient/synthesize_long_audio.php +++ /dev/null @@ -1,89 +0,0 @@ -setAudioEncoding($audioConfigAudioEncoding); - $request = (new SynthesizeLongAudioRequest()) - ->setInput($input) - ->setAudioConfig($audioConfig); - - // Call the API and handle any network failures. - try { - /** @var OperationResponse $response */ - $response = $textToSpeechLongAudioSynthesizeClient->synthesizeLongAudio($request); - $response->pollUntilComplete(); - - if ($response->operationSucceeded()) { - /** @var SynthesizeLongAudioResponse $result */ - $result = $response->getResult(); - printf('Operation successful with response data: %s' . PHP_EOL, $result->serializeToJsonString()); - } else { - /** @var Status $error */ - $error = $response->getError(); - printf('Operation failed with error data: %s' . PHP_EOL, $error->serializeToJsonString()); - } - } catch (ApiException $ex) { - printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); - } -} - -/** - * Helper to execute the sample. - * - * This sample has been automatically generated and should be regarded as a code - * template only. It will require modifications to work: - * - It may require correct/in-range values for request initialization. - * - It may require specifying regional endpoints when creating the service client, - * please see the apiEndpoint client configuration option for more details. - */ -function callSample(): void -{ - $audioConfigAudioEncoding = AudioEncoding::AUDIO_ENCODING_UNSPECIFIED; - - synthesize_long_audio_sample($audioConfigAudioEncoding); -} -// [END texttospeech_v1_generated_TextToSpeechLongAudioSynthesize_SynthesizeLongAudio_sync] diff --git a/owl-bot-staging/TextToSpeech/v1/src/V1/Client/TextToSpeechClient.php b/owl-bot-staging/TextToSpeech/v1/src/V1/Client/TextToSpeechClient.php deleted file mode 100644 index 79b66ce70026..000000000000 --- a/owl-bot-staging/TextToSpeech/v1/src/V1/Client/TextToSpeechClient.php +++ /dev/null @@ -1,292 +0,0 @@ - self::SERVICE_NAME, - 'apiEndpoint' => self::SERVICE_ADDRESS . ':' . self::DEFAULT_SERVICE_PORT, - 'clientConfig' => __DIR__ . '/../resources/text_to_speech_client_config.json', - 'descriptorsConfigPath' => __DIR__ . '/../resources/text_to_speech_descriptor_config.php', - 'gcpApiConfigPath' => __DIR__ . '/../resources/text_to_speech_grpc_config.json', - 'credentialsConfig' => [ - 'defaultScopes' => self::$serviceScopes, - ], - 'transportConfig' => [ - 'rest' => [ - 'restClientConfigPath' => __DIR__ . '/../resources/text_to_speech_rest_client_config.php', - ], - ], - ]; - } - - /** - * Formats a string containing the fully-qualified path to represent a model - * resource. - * - * @param string $project - * @param string $location - * @param string $model - * - * @return string The formatted model resource. - */ - public static function modelName(string $project, string $location, string $model): string - { - return self::getPathTemplate('model')->render([ - 'project' => $project, - 'location' => $location, - 'model' => $model, - ]); - } - - /** - * Parses a formatted name string and returns an associative array of the components in the name. - * The following name formats are supported: - * Template: Pattern - * - model: projects/{project}/locations/{location}/models/{model} - * - * The optional $template argument can be supplied to specify a particular pattern, - * and must match one of the templates listed above. If no $template argument is - * provided, or if the $template argument does not match one of the templates - * listed, then parseName will check each of the supported templates, and return - * the first match. - * - * @param string $formattedName The formatted name string - * @param string $template Optional name of template to match - * - * @return array An associative array from name component IDs to component values. - * - * @throws ValidationException If $formattedName could not be matched. - */ - public static function parseName(string $formattedName, string $template = null): array - { - return self::parseFormattedName($formattedName, $template); - } - - /** - * Constructor. - * - * @param array $options { - * Optional. Options for configuring the service API wrapper. - * - * @type string $apiEndpoint - * The address of the API remote host. May optionally include the port, formatted - * as ":". Default 'texttospeech.googleapis.com:443'. - * @type string|array|FetchAuthTokenInterface|CredentialsWrapper $credentials - * The credentials to be used by the client to authorize API calls. This option - * accepts either a path to a credentials file, or a decoded credentials file as a - * PHP array. - * *Advanced usage*: In addition, this option can also accept a pre-constructed - * {@see \Google\Auth\FetchAuthTokenInterface} object or - * {@see \Google\ApiCore\CredentialsWrapper} object. Note that when one of these - * objects are provided, any settings in $credentialsConfig will be ignored. - * @type array $credentialsConfig - * Options used to configure credentials, including auth token caching, for the - * client. For a full list of supporting configuration options, see - * {@see \Google\ApiCore\CredentialsWrapper::build()} . - * @type bool $disableRetries - * Determines whether or not retries defined by the client configuration should be - * disabled. Defaults to `false`. - * @type string|array $clientConfig - * Client method configuration, including retry settings. This option can be either - * a path to a JSON file, or a PHP array containing the decoded JSON data. By - * default this settings points to the default client config file, which is - * provided in the resources folder. - * @type string|TransportInterface $transport - * The transport used for executing network requests. May be either the string - * `rest` or `grpc`. Defaults to `grpc` if gRPC support is detected on the system. - * *Advanced usage*: Additionally, it is possible to pass in an already - * instantiated {@see \Google\ApiCore\Transport\TransportInterface} object. Note - * that when this object is provided, any settings in $transportConfig, and any - * $apiEndpoint setting, will be ignored. - * @type array $transportConfig - * Configuration options that will be used to construct the transport. Options for - * each supported transport type should be passed in a key for that transport. For - * example: - * $transportConfig = [ - * 'grpc' => [...], - * 'rest' => [...], - * ]; - * See the {@see \Google\ApiCore\Transport\GrpcTransport::build()} and - * {@see \Google\ApiCore\Transport\RestTransport::build()} methods for the - * supported options. - * @type callable $clientCertSource - * A callable which returns the client cert as a string. This can be used to - * provide a certificate and private key to the transport layer for mTLS. - * } - * - * @throws ValidationException - */ - public function __construct(array $options = []) - { - $clientOptions = $this->buildClientOptions($options); - $this->setClientOptions($clientOptions); - } - - /** Handles execution of the async variants for each documented method. */ - public function __call($method, $args) - { - if (substr($method, -5) !== 'Async') { - trigger_error('Call to undefined method ' . __CLASS__ . "::$method()", E_USER_ERROR); - } - - array_unshift($args, substr($method, 0, -5)); - return call_user_func_array([$this, 'startAsyncCall'], $args); - } - - /** - * Returns a list of Voice supported for synthesis. - * - * The async variant is {@see TextToSpeechClient::listVoicesAsync()} . - * - * @example samples/V1/TextToSpeechClient/list_voices.php - * - * @param ListVoicesRequest $request A request to house fields associated with the call. - * @param array $callOptions { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return ListVoicesResponse - * - * @throws ApiException Thrown if the API call fails. - */ - public function listVoices(ListVoicesRequest $request, array $callOptions = []): ListVoicesResponse - { - return $this->startApiCall('ListVoices', $request, $callOptions)->wait(); - } - - /** - * Performs bidirectional streaming speech synthesis: receive audio while - * sending text. - * - * @example samples/V1/TextToSpeechClient/streaming_synthesize.php - * - * @param array $callOptions { - * Optional. - * - * @type int $timeoutMillis - * Timeout to use for this call. - * } - * - * @return BidiStream - * - * @throws ApiException Thrown if the API call fails. - */ - public function streamingSynthesize(array $callOptions = []): BidiStream - { - return $this->startApiCall('StreamingSynthesize', null, $callOptions); - } - - /** - * Synthesizes speech synchronously: receive results after all text input - * has been processed. - * - * The async variant is {@see TextToSpeechClient::synthesizeSpeechAsync()} . - * - * @example samples/V1/TextToSpeechClient/synthesize_speech.php - * - * @param SynthesizeSpeechRequest $request A request to house fields associated with the call. - * @param array $callOptions { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return SynthesizeSpeechResponse - * - * @throws ApiException Thrown if the API call fails. - */ - public function synthesizeSpeech(SynthesizeSpeechRequest $request, array $callOptions = []): SynthesizeSpeechResponse - { - return $this->startApiCall('SynthesizeSpeech', $request, $callOptions)->wait(); - } -} diff --git a/owl-bot-staging/TextToSpeech/v1/src/V1/Client/TextToSpeechLongAudioSynthesizeClient.php b/owl-bot-staging/TextToSpeech/v1/src/V1/Client/TextToSpeechLongAudioSynthesizeClient.php deleted file mode 100644 index 2e91b8f6acfa..000000000000 --- a/owl-bot-staging/TextToSpeech/v1/src/V1/Client/TextToSpeechLongAudioSynthesizeClient.php +++ /dev/null @@ -1,274 +0,0 @@ - self::SERVICE_NAME, - 'apiEndpoint' => self::SERVICE_ADDRESS . ':' . self::DEFAULT_SERVICE_PORT, - 'clientConfig' => __DIR__ . '/../resources/text_to_speech_long_audio_synthesize_client_config.json', - 'descriptorsConfigPath' => __DIR__ . '/../resources/text_to_speech_long_audio_synthesize_descriptor_config.php', - 'gcpApiConfigPath' => __DIR__ . '/../resources/text_to_speech_long_audio_synthesize_grpc_config.json', - 'credentialsConfig' => [ - 'defaultScopes' => self::$serviceScopes, - ], - 'transportConfig' => [ - 'rest' => [ - 'restClientConfigPath' => __DIR__ . '/../resources/text_to_speech_long_audio_synthesize_rest_client_config.php', - ], - ], - ]; - } - - /** - * Return an OperationsClient object with the same endpoint as $this. - * - * @return OperationsClient - */ - public function getOperationsClient() - { - return $this->operationsClient; - } - - /** - * Resume an existing long running operation that was previously started by a long - * running API method. If $methodName is not provided, or does not match a long - * running API method, then the operation can still be resumed, but the - * OperationResponse object will not deserialize the final response. - * - * @param string $operationName The name of the long running operation - * @param string $methodName The name of the method used to start the operation - * - * @return OperationResponse - */ - public function resumeOperation($operationName, $methodName = null) - { - $options = isset($this->descriptors[$methodName]['longRunning']) ? $this->descriptors[$methodName]['longRunning'] : []; - $operation = new OperationResponse($operationName, $this->getOperationsClient(), $options); - $operation->reload(); - return $operation; - } - - /** - * Formats a string containing the fully-qualified path to represent a model - * resource. - * - * @param string $project - * @param string $location - * @param string $model - * - * @return string The formatted model resource. - */ - public static function modelName(string $project, string $location, string $model): string - { - return self::getPathTemplate('model')->render([ - 'project' => $project, - 'location' => $location, - 'model' => $model, - ]); - } - - /** - * Parses a formatted name string and returns an associative array of the components in the name. - * The following name formats are supported: - * Template: Pattern - * - model: projects/{project}/locations/{location}/models/{model} - * - * The optional $template argument can be supplied to specify a particular pattern, - * and must match one of the templates listed above. If no $template argument is - * provided, or if the $template argument does not match one of the templates - * listed, then parseName will check each of the supported templates, and return - * the first match. - * - * @param string $formattedName The formatted name string - * @param string $template Optional name of template to match - * - * @return array An associative array from name component IDs to component values. - * - * @throws ValidationException If $formattedName could not be matched. - */ - public static function parseName(string $formattedName, string $template = null): array - { - return self::parseFormattedName($formattedName, $template); - } - - /** - * Constructor. - * - * @param array $options { - * Optional. Options for configuring the service API wrapper. - * - * @type string $apiEndpoint - * The address of the API remote host. May optionally include the port, formatted - * as ":". Default 'texttospeech.googleapis.com:443'. - * @type string|array|FetchAuthTokenInterface|CredentialsWrapper $credentials - * The credentials to be used by the client to authorize API calls. This option - * accepts either a path to a credentials file, or a decoded credentials file as a - * PHP array. - * *Advanced usage*: In addition, this option can also accept a pre-constructed - * {@see \Google\Auth\FetchAuthTokenInterface} object or - * {@see \Google\ApiCore\CredentialsWrapper} object. Note that when one of these - * objects are provided, any settings in $credentialsConfig will be ignored. - * @type array $credentialsConfig - * Options used to configure credentials, including auth token caching, for the - * client. For a full list of supporting configuration options, see - * {@see \Google\ApiCore\CredentialsWrapper::build()} . - * @type bool $disableRetries - * Determines whether or not retries defined by the client configuration should be - * disabled. Defaults to `false`. - * @type string|array $clientConfig - * Client method configuration, including retry settings. This option can be either - * a path to a JSON file, or a PHP array containing the decoded JSON data. By - * default this settings points to the default client config file, which is - * provided in the resources folder. - * @type string|TransportInterface $transport - * The transport used for executing network requests. May be either the string - * `rest` or `grpc`. Defaults to `grpc` if gRPC support is detected on the system. - * *Advanced usage*: Additionally, it is possible to pass in an already - * instantiated {@see \Google\ApiCore\Transport\TransportInterface} object. Note - * that when this object is provided, any settings in $transportConfig, and any - * $apiEndpoint setting, will be ignored. - * @type array $transportConfig - * Configuration options that will be used to construct the transport. Options for - * each supported transport type should be passed in a key for that transport. For - * example: - * $transportConfig = [ - * 'grpc' => [...], - * 'rest' => [...], - * ]; - * See the {@see \Google\ApiCore\Transport\GrpcTransport::build()} and - * {@see \Google\ApiCore\Transport\RestTransport::build()} methods for the - * supported options. - * @type callable $clientCertSource - * A callable which returns the client cert as a string. This can be used to - * provide a certificate and private key to the transport layer for mTLS. - * } - * - * @throws ValidationException - */ - public function __construct(array $options = []) - { - $clientOptions = $this->buildClientOptions($options); - $this->setClientOptions($clientOptions); - $this->operationsClient = $this->createOperationsClient($clientOptions); - } - - /** Handles execution of the async variants for each documented method. */ - public function __call($method, $args) - { - if (substr($method, -5) !== 'Async') { - trigger_error('Call to undefined method ' . __CLASS__ . "::$method()", E_USER_ERROR); - } - - array_unshift($args, substr($method, 0, -5)); - return call_user_func_array([$this, 'startAsyncCall'], $args); - } - - /** - * Synthesizes long form text asynchronously. - * - * The async variant is - * {@see TextToSpeechLongAudioSynthesizeClient::synthesizeLongAudioAsync()} . - * - * @example samples/V1/TextToSpeechLongAudioSynthesizeClient/synthesize_long_audio.php - * - * @param SynthesizeLongAudioRequest $request A request to house fields associated with the call. - * @param array $callOptions { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return OperationResponse - * - * @throws ApiException Thrown if the API call fails. - */ - public function synthesizeLongAudio(SynthesizeLongAudioRequest $request, array $callOptions = []): OperationResponse - { - return $this->startApiCall('SynthesizeLongAudio', $request, $callOptions)->wait(); - } -} diff --git a/owl-bot-staging/TextToSpeech/v1/src/V1/Gapic/TextToSpeechGapicClient.php b/owl-bot-staging/TextToSpeech/v1/src/V1/Gapic/TextToSpeechGapicClient.php deleted file mode 100644 index 755f6b2fc575..000000000000 --- a/owl-bot-staging/TextToSpeech/v1/src/V1/Gapic/TextToSpeechGapicClient.php +++ /dev/null @@ -1,412 +0,0 @@ -listVoices(); - * } finally { - * $textToSpeechClient->close(); - * } - * ``` - * - * Many parameters require resource names to be formatted in a particular way. To - * assist with these names, this class includes a format method for each type of - * name, and additionally a parseName method to extract the individual identifiers - * contained within formatted names that are returned by the API. - * - * @deprecated Please use the new service client {@see \Google\Cloud\TextToSpeech\V1\Client\TextToSpeechClient}. - */ -class TextToSpeechGapicClient -{ - use GapicClientTrait; - - /** The name of the service. */ - const SERVICE_NAME = 'google.cloud.texttospeech.v1.TextToSpeech'; - - /** - * The default address of the service. - * - * @deprecated SERVICE_ADDRESS_TEMPLATE should be used instead. - */ - const SERVICE_ADDRESS = 'texttospeech.googleapis.com'; - - /** The address template of the service. */ - private const SERVICE_ADDRESS_TEMPLATE = 'texttospeech.UNIVERSE_DOMAIN'; - - /** The default port of the service. */ - const DEFAULT_SERVICE_PORT = 443; - - /** The name of the code generator, to be included in the agent header. */ - const CODEGEN_NAME = 'gapic'; - - /** The default scopes required by the service. */ - public static $serviceScopes = [ - 'https://www.googleapis.com/auth/cloud-platform', - ]; - - private static $modelNameTemplate; - - private static $pathTemplateMap; - - private static function getClientDefaults() - { - return [ - 'serviceName' => self::SERVICE_NAME, - 'apiEndpoint' => self::SERVICE_ADDRESS . ':' . self::DEFAULT_SERVICE_PORT, - 'clientConfig' => __DIR__ . '/../resources/text_to_speech_client_config.json', - 'descriptorsConfigPath' => __DIR__ . '/../resources/text_to_speech_descriptor_config.php', - 'gcpApiConfigPath' => __DIR__ . '/../resources/text_to_speech_grpc_config.json', - 'credentialsConfig' => [ - 'defaultScopes' => self::$serviceScopes, - ], - 'transportConfig' => [ - 'rest' => [ - 'restClientConfigPath' => __DIR__ . '/../resources/text_to_speech_rest_client_config.php', - ], - ], - ]; - } - - private static function getModelNameTemplate() - { - if (self::$modelNameTemplate == null) { - self::$modelNameTemplate = new PathTemplate('projects/{project}/locations/{location}/models/{model}'); - } - - return self::$modelNameTemplate; - } - - private static function getPathTemplateMap() - { - if (self::$pathTemplateMap == null) { - self::$pathTemplateMap = [ - 'model' => self::getModelNameTemplate(), - ]; - } - - return self::$pathTemplateMap; - } - - /** - * Formats a string containing the fully-qualified path to represent a model - * resource. - * - * @param string $project - * @param string $location - * @param string $model - * - * @return string The formatted model resource. - */ - public static function modelName($project, $location, $model) - { - return self::getModelNameTemplate()->render([ - 'project' => $project, - 'location' => $location, - 'model' => $model, - ]); - } - - /** - * Parses a formatted name string and returns an associative array of the components in the name. - * The following name formats are supported: - * Template: Pattern - * - model: projects/{project}/locations/{location}/models/{model} - * - * The optional $template argument can be supplied to specify a particular pattern, - * and must match one of the templates listed above. If no $template argument is - * provided, or if the $template argument does not match one of the templates - * listed, then parseName will check each of the supported templates, and return - * the first match. - * - * @param string $formattedName The formatted name string - * @param string $template Optional name of template to match - * - * @return array An associative array from name component IDs to component values. - * - * @throws ValidationException If $formattedName could not be matched. - */ - public static function parseName($formattedName, $template = null) - { - $templateMap = self::getPathTemplateMap(); - if ($template) { - if (!isset($templateMap[$template])) { - throw new ValidationException("Template name $template does not exist"); - } - - return $templateMap[$template]->match($formattedName); - } - - foreach ($templateMap as $templateName => $pathTemplate) { - try { - return $pathTemplate->match($formattedName); - } catch (ValidationException $ex) { - // Swallow the exception to continue trying other path templates - } - } - - throw new ValidationException("Input did not match any known format. Input: $formattedName"); - } - - /** - * Constructor. - * - * @param array $options { - * Optional. Options for configuring the service API wrapper. - * - * @type string $apiEndpoint - * The address of the API remote host. May optionally include the port, formatted - * as ":". Default 'texttospeech.googleapis.com:443'. - * @type string|array|FetchAuthTokenInterface|CredentialsWrapper $credentials - * The credentials to be used by the client to authorize API calls. This option - * accepts either a path to a credentials file, or a decoded credentials file as a - * PHP array. - * *Advanced usage*: In addition, this option can also accept a pre-constructed - * {@see \Google\Auth\FetchAuthTokenInterface} object or - * {@see \Google\ApiCore\CredentialsWrapper} object. Note that when one of these - * objects are provided, any settings in $credentialsConfig will be ignored. - * @type array $credentialsConfig - * Options used to configure credentials, including auth token caching, for the - * client. For a full list of supporting configuration options, see - * {@see \Google\ApiCore\CredentialsWrapper::build()} . - * @type bool $disableRetries - * Determines whether or not retries defined by the client configuration should be - * disabled. Defaults to `false`. - * @type string|array $clientConfig - * Client method configuration, including retry settings. This option can be either - * a path to a JSON file, or a PHP array containing the decoded JSON data. By - * default this settings points to the default client config file, which is - * provided in the resources folder. - * @type string|TransportInterface $transport - * The transport used for executing network requests. May be either the string - * `rest` or `grpc`. Defaults to `grpc` if gRPC support is detected on the system. - * *Advanced usage*: Additionally, it is possible to pass in an already - * instantiated {@see \Google\ApiCore\Transport\TransportInterface} object. Note - * that when this object is provided, any settings in $transportConfig, and any - * $apiEndpoint setting, will be ignored. - * @type array $transportConfig - * Configuration options that will be used to construct the transport. Options for - * each supported transport type should be passed in a key for that transport. For - * example: - * $transportConfig = [ - * 'grpc' => [...], - * 'rest' => [...], - * ]; - * See the {@see \Google\ApiCore\Transport\GrpcTransport::build()} and - * {@see \Google\ApiCore\Transport\RestTransport::build()} methods for the - * supported options. - * @type callable $clientCertSource - * A callable which returns the client cert as a string. This can be used to - * provide a certificate and private key to the transport layer for mTLS. - * } - * - * @throws ValidationException - */ - public function __construct(array $options = []) - { - $clientOptions = $this->buildClientOptions($options); - $this->setClientOptions($clientOptions); - } - - /** - * Returns a list of Voice supported for synthesis. - * - * Sample code: - * ``` - * $textToSpeechClient = new TextToSpeechClient(); - * try { - * $response = $textToSpeechClient->listVoices(); - * } finally { - * $textToSpeechClient->close(); - * } - * ``` - * - * @param array $optionalArgs { - * Optional. - * - * @type string $languageCode - * Optional. Recommended. - * [BCP-47](https://www.rfc-editor.org/rfc/bcp/bcp47.txt) language tag. - * If not specified, the API will return all supported voices. - * If specified, the ListVoices call will only return voices that can be used - * to synthesize this language_code. For example, if you specify `"en-NZ"`, - * all `"en-NZ"` voices will be returned. If you specify `"no"`, both - * `"no-\*"` (Norwegian) and `"nb-\*"` (Norwegian Bokmal) voices will be - * returned. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\TextToSpeech\V1\ListVoicesResponse - * - * @throws ApiException if the remote call fails - */ - public function listVoices(array $optionalArgs = []) - { - $request = new ListVoicesRequest(); - if (isset($optionalArgs['languageCode'])) { - $request->setLanguageCode($optionalArgs['languageCode']); - } - - return $this->startCall('ListVoices', ListVoicesResponse::class, $optionalArgs, $request)->wait(); - } - - /** - * Performs bidirectional streaming speech synthesis: receive audio while - * sending text. - * - * Sample code: - * ``` - * $textToSpeechClient = new TextToSpeechClient(); - * try { - * $request = new StreamingSynthesizeRequest(); - * // Write all requests to the server, then read all responses until the - * // stream is complete - * $requests = [ - * $request, - * ]; - * $stream = $textToSpeechClient->streamingSynthesize(); - * $stream->writeAll($requests); - * foreach ($stream->closeWriteAndReadAll() as $element) { - * // doSomethingWith($element); - * } - * // Alternatively: - * // Write requests individually, making read() calls if - * // required. Call closeWrite() once writes are complete, and read the - * // remaining responses from the server. - * $requests = [ - * $request, - * ]; - * $stream = $textToSpeechClient->streamingSynthesize(); - * foreach ($requests as $request) { - * $stream->write($request); - * // if required, read a single response from the stream - * $element = $stream->read(); - * // doSomethingWith($element) - * } - * $stream->closeWrite(); - * $element = $stream->read(); - * while (!is_null($element)) { - * // doSomethingWith($element) - * $element = $stream->read(); - * } - * } finally { - * $textToSpeechClient->close(); - * } - * ``` - * - * @param array $optionalArgs { - * Optional. - * - * @type int $timeoutMillis - * Timeout to use for this call. - * } - * - * @return \Google\ApiCore\BidiStream - * - * @throws ApiException if the remote call fails - */ - public function streamingSynthesize(array $optionalArgs = []) - { - return $this->startCall('StreamingSynthesize', StreamingSynthesizeResponse::class, $optionalArgs, null, Call::BIDI_STREAMING_CALL); - } - - /** - * Synthesizes speech synchronously: receive results after all text input - * has been processed. - * - * Sample code: - * ``` - * $textToSpeechClient = new TextToSpeechClient(); - * try { - * $input = new SynthesisInput(); - * $voice = new VoiceSelectionParams(); - * $audioConfig = new AudioConfig(); - * $response = $textToSpeechClient->synthesizeSpeech($input, $voice, $audioConfig); - * } finally { - * $textToSpeechClient->close(); - * } - * ``` - * - * @param SynthesisInput $input Required. The Synthesizer requires either plain text or SSML as input. - * @param VoiceSelectionParams $voice Required. The desired voice of the synthesized audio. - * @param AudioConfig $audioConfig Required. The configuration of the synthesized audio. - * @param array $optionalArgs { - * Optional. - * - * @type AdvancedVoiceOptions $advancedVoiceOptions - * Advanced voice options. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\TextToSpeech\V1\SynthesizeSpeechResponse - * - * @throws ApiException if the remote call fails - */ - public function synthesizeSpeech($input, $voice, $audioConfig, array $optionalArgs = []) - { - $request = new SynthesizeSpeechRequest(); - $request->setInput($input); - $request->setVoice($voice); - $request->setAudioConfig($audioConfig); - if (isset($optionalArgs['advancedVoiceOptions'])) { - $request->setAdvancedVoiceOptions($optionalArgs['advancedVoiceOptions']); - } - - return $this->startCall('SynthesizeSpeech', SynthesizeSpeechResponse::class, $optionalArgs, $request)->wait(); - } -} diff --git a/owl-bot-staging/TextToSpeech/v1/src/V1/Gapic/TextToSpeechLongAudioSynthesizeGapicClient.php b/owl-bot-staging/TextToSpeech/v1/src/V1/Gapic/TextToSpeechLongAudioSynthesizeGapicClient.php deleted file mode 100644 index 17fc72e734fa..000000000000 --- a/owl-bot-staging/TextToSpeech/v1/src/V1/Gapic/TextToSpeechLongAudioSynthesizeGapicClient.php +++ /dev/null @@ -1,403 +0,0 @@ -synthesizeLongAudio($input, $audioConfig); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * $result = $operationResponse->getResult(); - * // doSomethingWith($result) - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $textToSpeechLongAudioSynthesizeClient->synthesizeLongAudio($input, $audioConfig); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $textToSpeechLongAudioSynthesizeClient->resumeOperation($operationName, 'synthesizeLongAudio'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * $result = $newOperationResponse->getResult(); - * // doSomethingWith($result) - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $textToSpeechLongAudioSynthesizeClient->close(); - * } - * ``` - * - * Many parameters require resource names to be formatted in a particular way. To - * assist with these names, this class includes a format method for each type of - * name, and additionally a parseName method to extract the individual identifiers - * contained within formatted names that are returned by the API. - * - * @deprecated Please use the new service client {@see \Google\Cloud\TextToSpeech\V1\Client\TextToSpeechLongAudioSynthesizeClient}. - */ -class TextToSpeechLongAudioSynthesizeGapicClient -{ - use GapicClientTrait; - - /** The name of the service. */ - const SERVICE_NAME = 'google.cloud.texttospeech.v1.TextToSpeechLongAudioSynthesize'; - - /** - * The default address of the service. - * - * @deprecated SERVICE_ADDRESS_TEMPLATE should be used instead. - */ - const SERVICE_ADDRESS = 'texttospeech.googleapis.com'; - - /** The address template of the service. */ - private const SERVICE_ADDRESS_TEMPLATE = 'texttospeech.UNIVERSE_DOMAIN'; - - /** The default port of the service. */ - const DEFAULT_SERVICE_PORT = 443; - - /** The name of the code generator, to be included in the agent header. */ - const CODEGEN_NAME = 'gapic'; - - /** The default scopes required by the service. */ - public static $serviceScopes = [ - 'https://www.googleapis.com/auth/cloud-platform', - ]; - - private static $modelNameTemplate; - - private static $pathTemplateMap; - - private $operationsClient; - - private static function getClientDefaults() - { - return [ - 'serviceName' => self::SERVICE_NAME, - 'apiEndpoint' => self::SERVICE_ADDRESS . ':' . self::DEFAULT_SERVICE_PORT, - 'clientConfig' => __DIR__ . '/../resources/text_to_speech_long_audio_synthesize_client_config.json', - 'descriptorsConfigPath' => __DIR__ . '/../resources/text_to_speech_long_audio_synthesize_descriptor_config.php', - 'gcpApiConfigPath' => __DIR__ . '/../resources/text_to_speech_long_audio_synthesize_grpc_config.json', - 'credentialsConfig' => [ - 'defaultScopes' => self::$serviceScopes, - ], - 'transportConfig' => [ - 'rest' => [ - 'restClientConfigPath' => __DIR__ . '/../resources/text_to_speech_long_audio_synthesize_rest_client_config.php', - ], - ], - ]; - } - - private static function getModelNameTemplate() - { - if (self::$modelNameTemplate == null) { - self::$modelNameTemplate = new PathTemplate('projects/{project}/locations/{location}/models/{model}'); - } - - return self::$modelNameTemplate; - } - - private static function getPathTemplateMap() - { - if (self::$pathTemplateMap == null) { - self::$pathTemplateMap = [ - 'model' => self::getModelNameTemplate(), - ]; - } - - return self::$pathTemplateMap; - } - - /** - * Formats a string containing the fully-qualified path to represent a model - * resource. - * - * @param string $project - * @param string $location - * @param string $model - * - * @return string The formatted model resource. - */ - public static function modelName($project, $location, $model) - { - return self::getModelNameTemplate()->render([ - 'project' => $project, - 'location' => $location, - 'model' => $model, - ]); - } - - /** - * Parses a formatted name string and returns an associative array of the components in the name. - * The following name formats are supported: - * Template: Pattern - * - model: projects/{project}/locations/{location}/models/{model} - * - * The optional $template argument can be supplied to specify a particular pattern, - * and must match one of the templates listed above. If no $template argument is - * provided, or if the $template argument does not match one of the templates - * listed, then parseName will check each of the supported templates, and return - * the first match. - * - * @param string $formattedName The formatted name string - * @param string $template Optional name of template to match - * - * @return array An associative array from name component IDs to component values. - * - * @throws ValidationException If $formattedName could not be matched. - */ - public static function parseName($formattedName, $template = null) - { - $templateMap = self::getPathTemplateMap(); - if ($template) { - if (!isset($templateMap[$template])) { - throw new ValidationException("Template name $template does not exist"); - } - - return $templateMap[$template]->match($formattedName); - } - - foreach ($templateMap as $templateName => $pathTemplate) { - try { - return $pathTemplate->match($formattedName); - } catch (ValidationException $ex) { - // Swallow the exception to continue trying other path templates - } - } - - throw new ValidationException("Input did not match any known format. Input: $formattedName"); - } - - /** - * Return an OperationsClient object with the same endpoint as $this. - * - * @return OperationsClient - */ - public function getOperationsClient() - { - return $this->operationsClient; - } - - /** - * Resume an existing long running operation that was previously started by a long - * running API method. If $methodName is not provided, or does not match a long - * running API method, then the operation can still be resumed, but the - * OperationResponse object will not deserialize the final response. - * - * @param string $operationName The name of the long running operation - * @param string $methodName The name of the method used to start the operation - * - * @return OperationResponse - */ - public function resumeOperation($operationName, $methodName = null) - { - $options = isset($this->descriptors[$methodName]['longRunning']) ? $this->descriptors[$methodName]['longRunning'] : []; - $operation = new OperationResponse($operationName, $this->getOperationsClient(), $options); - $operation->reload(); - return $operation; - } - - /** - * Constructor. - * - * @param array $options { - * Optional. Options for configuring the service API wrapper. - * - * @type string $apiEndpoint - * The address of the API remote host. May optionally include the port, formatted - * as ":". Default 'texttospeech.googleapis.com:443'. - * @type string|array|FetchAuthTokenInterface|CredentialsWrapper $credentials - * The credentials to be used by the client to authorize API calls. This option - * accepts either a path to a credentials file, or a decoded credentials file as a - * PHP array. - * *Advanced usage*: In addition, this option can also accept a pre-constructed - * {@see \Google\Auth\FetchAuthTokenInterface} object or - * {@see \Google\ApiCore\CredentialsWrapper} object. Note that when one of these - * objects are provided, any settings in $credentialsConfig will be ignored. - * @type array $credentialsConfig - * Options used to configure credentials, including auth token caching, for the - * client. For a full list of supporting configuration options, see - * {@see \Google\ApiCore\CredentialsWrapper::build()} . - * @type bool $disableRetries - * Determines whether or not retries defined by the client configuration should be - * disabled. Defaults to `false`. - * @type string|array $clientConfig - * Client method configuration, including retry settings. This option can be either - * a path to a JSON file, or a PHP array containing the decoded JSON data. By - * default this settings points to the default client config file, which is - * provided in the resources folder. - * @type string|TransportInterface $transport - * The transport used for executing network requests. May be either the string - * `rest` or `grpc`. Defaults to `grpc` if gRPC support is detected on the system. - * *Advanced usage*: Additionally, it is possible to pass in an already - * instantiated {@see \Google\ApiCore\Transport\TransportInterface} object. Note - * that when this object is provided, any settings in $transportConfig, and any - * $apiEndpoint setting, will be ignored. - * @type array $transportConfig - * Configuration options that will be used to construct the transport. Options for - * each supported transport type should be passed in a key for that transport. For - * example: - * $transportConfig = [ - * 'grpc' => [...], - * 'rest' => [...], - * ]; - * See the {@see \Google\ApiCore\Transport\GrpcTransport::build()} and - * {@see \Google\ApiCore\Transport\RestTransport::build()} methods for the - * supported options. - * @type callable $clientCertSource - * A callable which returns the client cert as a string. This can be used to - * provide a certificate and private key to the transport layer for mTLS. - * } - * - * @throws ValidationException - */ - public function __construct(array $options = []) - { - $clientOptions = $this->buildClientOptions($options); - $this->setClientOptions($clientOptions); - $this->operationsClient = $this->createOperationsClient($clientOptions); - } - - /** - * Synthesizes long form text asynchronously. - * - * Sample code: - * ``` - * $textToSpeechLongAudioSynthesizeClient = new TextToSpeechLongAudioSynthesizeClient(); - * try { - * $input = new SynthesisInput(); - * $audioConfig = new AudioConfig(); - * $operationResponse = $textToSpeechLongAudioSynthesizeClient->synthesizeLongAudio($input, $audioConfig); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * $result = $operationResponse->getResult(); - * // doSomethingWith($result) - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $textToSpeechLongAudioSynthesizeClient->synthesizeLongAudio($input, $audioConfig); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $textToSpeechLongAudioSynthesizeClient->resumeOperation($operationName, 'synthesizeLongAudio'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * $result = $newOperationResponse->getResult(); - * // doSomethingWith($result) - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $textToSpeechLongAudioSynthesizeClient->close(); - * } - * ``` - * - * @param SynthesisInput $input Required. The Synthesizer requires either plain text or SSML as input. - * @param AudioConfig $audioConfig Required. The configuration of the synthesized audio. - * @param array $optionalArgs { - * Optional. - * - * @type string $parent - * The resource states of the request in the form of - * `projects/*/locations/*`. - * @type string $outputGcsUri - * Required. Specifies a Cloud Storage URI for the synthesis results. Must be - * specified in the format: `gs://bucket_name/object_name`, and the bucket - * must already exist. - * @type VoiceSelectionParams $voice - * Required. The desired voice of the synthesized audio. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\ApiCore\OperationResponse - * - * @throws ApiException if the remote call fails - */ - public function synthesizeLongAudio($input, $audioConfig, array $optionalArgs = []) - { - $request = new SynthesizeLongAudioRequest(); - $requestParamHeaders = []; - $request->setInput($input); - $request->setAudioConfig($audioConfig); - if (isset($optionalArgs['parent'])) { - $request->setParent($optionalArgs['parent']); - $requestParamHeaders['parent'] = $optionalArgs['parent']; - } - - if (isset($optionalArgs['outputGcsUri'])) { - $request->setOutputGcsUri($optionalArgs['outputGcsUri']); - } - - if (isset($optionalArgs['voice'])) { - $request->setVoice($optionalArgs['voice']); - } - - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->startOperationsCall('SynthesizeLongAudio', $optionalArgs, $request, $this->getOperationsClient())->wait(); - } -} diff --git a/owl-bot-staging/TextToSpeech/v1/src/V1/TextToSpeechClient.php b/owl-bot-staging/TextToSpeech/v1/src/V1/TextToSpeechClient.php deleted file mode 100644 index 0942280d0856..000000000000 --- a/owl-bot-staging/TextToSpeech/v1/src/V1/TextToSpeechClient.php +++ /dev/null @@ -1,34 +0,0 @@ - [ - 'google.cloud.texttospeech.v1.TextToSpeech' => [ - 'ListVoices' => [ - 'callType' => \Google\ApiCore\Call::UNARY_CALL, - 'responseType' => 'Google\Cloud\TextToSpeech\V1\ListVoicesResponse', - ], - 'StreamingSynthesize' => [ - 'grpcStreaming' => [ - 'grpcStreamingType' => 'BidiStreaming', - ], - 'callType' => \Google\ApiCore\Call::BIDI_STREAMING_CALL, - 'responseType' => 'Google\Cloud\TextToSpeech\V1\StreamingSynthesizeResponse', - ], - 'SynthesizeSpeech' => [ - 'callType' => \Google\ApiCore\Call::UNARY_CALL, - 'responseType' => 'Google\Cloud\TextToSpeech\V1\SynthesizeSpeechResponse', - ], - 'templateMap' => [ - 'model' => 'projects/{project}/locations/{location}/models/{model}', - ], - ], - ], -]; diff --git a/owl-bot-staging/TextToSpeech/v1/src/V1/resources/text_to_speech_long_audio_synthesize_client_config.json b/owl-bot-staging/TextToSpeech/v1/src/V1/resources/text_to_speech_long_audio_synthesize_client_config.json deleted file mode 100644 index 1f2cda4e7cf5..000000000000 --- a/owl-bot-staging/TextToSpeech/v1/src/V1/resources/text_to_speech_long_audio_synthesize_client_config.json +++ /dev/null @@ -1,37 +0,0 @@ -{ - "interfaces": { - "google.cloud.texttospeech.v1.TextToSpeechLongAudioSynthesize": { - "retry_codes": { - "no_retry_codes": [], - "no_retry_1_codes": [] - }, - "retry_params": { - "no_retry_params": { - "initial_retry_delay_millis": 0, - "retry_delay_multiplier": 0.0, - "max_retry_delay_millis": 0, - "initial_rpc_timeout_millis": 0, - "rpc_timeout_multiplier": 1.0, - "max_rpc_timeout_millis": 0, - "total_timeout_millis": 0 - }, - "no_retry_1_params": { - "initial_retry_delay_millis": 0, - "retry_delay_multiplier": 0.0, - "max_retry_delay_millis": 0, - "initial_rpc_timeout_millis": 5000000, - "rpc_timeout_multiplier": 1.0, - "max_rpc_timeout_millis": 5000000, - "total_timeout_millis": 5000000 - } - }, - "methods": { - "SynthesizeLongAudio": { - "timeout_millis": 5000000, - "retry_codes_name": "no_retry_1_codes", - "retry_params_name": "no_retry_1_params" - } - } - } - } -} diff --git a/owl-bot-staging/TextToSpeech/v1/src/V1/resources/text_to_speech_long_audio_synthesize_descriptor_config.php b/owl-bot-staging/TextToSpeech/v1/src/V1/resources/text_to_speech_long_audio_synthesize_descriptor_config.php deleted file mode 100644 index 63aa9b8d0232..000000000000 --- a/owl-bot-staging/TextToSpeech/v1/src/V1/resources/text_to_speech_long_audio_synthesize_descriptor_config.php +++ /dev/null @@ -1,50 +0,0 @@ - [ - 'google.cloud.texttospeech.v1.TextToSpeechLongAudioSynthesize' => [ - 'SynthesizeLongAudio' => [ - 'longRunning' => [ - 'operationReturnType' => '\Google\Cloud\TextToSpeech\V1\SynthesizeLongAudioResponse', - 'metadataReturnType' => '\Google\Cloud\TextToSpeech\V1\SynthesizeLongAudioMetadata', - 'initialPollDelayMillis' => '500', - 'pollDelayMultiplier' => '1.5', - 'maxPollDelayMillis' => '5000', - 'totalPollTimeoutMillis' => '300000', - ], - 'callType' => \Google\ApiCore\Call::LONGRUNNING_CALL, - 'headerParams' => [ - [ - 'keyName' => 'parent', - 'fieldAccessors' => [ - 'getParent', - ], - ], - ], - ], - 'templateMap' => [ - 'model' => 'projects/{project}/locations/{location}/models/{model}', - ], - ], - ], -]; diff --git a/owl-bot-staging/TextToSpeech/v1/src/V1/resources/text_to_speech_long_audio_synthesize_rest_client_config.php b/owl-bot-staging/TextToSpeech/v1/src/V1/resources/text_to_speech_long_audio_synthesize_rest_client_config.php deleted file mode 100644 index 690fa540c6d7..000000000000 --- a/owl-bot-staging/TextToSpeech/v1/src/V1/resources/text_to_speech_long_audio_synthesize_rest_client_config.php +++ /dev/null @@ -1,65 +0,0 @@ - [ - 'google.cloud.texttospeech.v1.TextToSpeechLongAudioSynthesize' => [ - 'SynthesizeLongAudio' => [ - 'method' => 'post', - 'uriTemplate' => '/v1/{parent=projects/*/locations/*}:synthesizeLongAudio', - 'body' => '*', - 'placeholders' => [ - 'parent' => [ - 'getters' => [ - 'getParent', - ], - ], - ], - ], - ], - 'google.longrunning.Operations' => [ - 'GetOperation' => [ - 'method' => 'get', - 'uriTemplate' => '/v1/{name=projects/*/locations/*/operations/*}', - 'placeholders' => [ - 'name' => [ - 'getters' => [ - 'getName', - ], - ], - ], - ], - 'ListOperations' => [ - 'method' => 'get', - 'uriTemplate' => '/v1/{name=projects/*/locations/*}/operations', - 'placeholders' => [ - 'name' => [ - 'getters' => [ - 'getName', - ], - ], - ], - ], - ], - ], - 'numericEnums' => true, -]; diff --git a/owl-bot-staging/TextToSpeech/v1/src/V1/resources/text_to_speech_rest_client_config.php b/owl-bot-staging/TextToSpeech/v1/src/V1/resources/text_to_speech_rest_client_config.php deleted file mode 100644 index 7014d6557556..000000000000 --- a/owl-bot-staging/TextToSpeech/v1/src/V1/resources/text_to_speech_rest_client_config.php +++ /dev/null @@ -1,62 +0,0 @@ - [ - 'google.cloud.texttospeech.v1.TextToSpeech' => [ - 'ListVoices' => [ - 'method' => 'get', - 'uriTemplate' => '/v1/voices', - ], - 'SynthesizeSpeech' => [ - 'method' => 'post', - 'uriTemplate' => '/v1/text:synthesize', - 'body' => '*', - ], - ], - 'google.longrunning.Operations' => [ - 'GetOperation' => [ - 'method' => 'get', - 'uriTemplate' => '/v1/{name=projects/*/locations/*/operations/*}', - 'placeholders' => [ - 'name' => [ - 'getters' => [ - 'getName', - ], - ], - ], - ], - 'ListOperations' => [ - 'method' => 'get', - 'uriTemplate' => '/v1/{name=projects/*/locations/*}/operations', - 'placeholders' => [ - 'name' => [ - 'getters' => [ - 'getName', - ], - ], - ], - ], - ], - ], - 'numericEnums' => true, -]; diff --git a/owl-bot-staging/TextToSpeech/v1/tests/Unit/V1/Client/TextToSpeechClientTest.php b/owl-bot-staging/TextToSpeech/v1/tests/Unit/V1/Client/TextToSpeechClientTest.php deleted file mode 100644 index f2e456c2a51a..000000000000 --- a/owl-bot-staging/TextToSpeech/v1/tests/Unit/V1/Client/TextToSpeechClientTest.php +++ /dev/null @@ -1,325 +0,0 @@ -getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); - } - - /** @return TextToSpeechClient */ - private function createClient(array $options = []) - { - $options += [ - 'credentials' => $this->createCredentials(), - ]; - return new TextToSpeechClient($options); - } - - /** @test */ - public function listVoicesTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $expectedResponse = new ListVoicesResponse(); - $transport->addResponse($expectedResponse); - $request = new ListVoicesRequest(); - $response = $gapicClient->listVoices($request); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.texttospeech.v1.TextToSpeech/ListVoices', $actualFuncCall); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listVoicesExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - $request = new ListVoicesRequest(); - try { - $gapicClient->listVoices($request); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function streamingSynthesizeTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $audioContent = '16'; - $expectedResponse = new StreamingSynthesizeResponse(); - $expectedResponse->setAudioContent($audioContent); - $transport->addResponse($expectedResponse); - $audioContent2 = '-61'; - $expectedResponse2 = new StreamingSynthesizeResponse(); - $expectedResponse2->setAudioContent($audioContent2); - $transport->addResponse($expectedResponse2); - $audioContent3 = '-60'; - $expectedResponse3 = new StreamingSynthesizeResponse(); - $expectedResponse3->setAudioContent($audioContent3); - $transport->addResponse($expectedResponse3); - // Mock request - $request = new StreamingSynthesizeRequest(); - $request2 = new StreamingSynthesizeRequest(); - $request3 = new StreamingSynthesizeRequest(); - $bidi = $gapicClient->streamingSynthesize(); - $this->assertInstanceOf(BidiStream::class, $bidi); - $bidi->write($request); - $responses = []; - $responses[] = $bidi->read(); - $bidi->writeAll([ - $request2, - $request3, - ]); - foreach ($bidi->closeWriteAndReadAll() as $response) { - $responses[] = $response; - } - - $expectedResponses = []; - $expectedResponses[] = $expectedResponse; - $expectedResponses[] = $expectedResponse2; - $expectedResponses[] = $expectedResponse3; - $this->assertEquals($expectedResponses, $responses); - $createStreamRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($createStreamRequests)); - $streamFuncCall = $createStreamRequests[0]->getFuncCall(); - $streamRequestObject = $createStreamRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.texttospeech.v1.TextToSpeech/StreamingSynthesize', $streamFuncCall); - $this->assertNull($streamRequestObject); - $callObjects = $transport->popCallObjects(); - $this->assertSame(1, count($callObjects)); - $bidiCall = $callObjects[0]; - $writeRequests = $bidiCall->popReceivedCalls(); - $expectedRequests = []; - $expectedRequests[] = $request; - $expectedRequests[] = $request2; - $expectedRequests[] = $request3; - $this->assertEquals($expectedRequests, $writeRequests); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function streamingSynthesizeExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->setStreamingStatus($status); - $this->assertTrue($transport->isExhausted()); - $bidi = $gapicClient->streamingSynthesize(); - $results = $bidi->closeWriteAndReadAll(); - try { - iterator_to_array($results); - // If the close stream method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function synthesizeSpeechTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $audioContent = '16'; - $expectedResponse = new SynthesizeSpeechResponse(); - $expectedResponse->setAudioContent($audioContent); - $transport->addResponse($expectedResponse); - // Mock request - $input = new SynthesisInput(); - $voice = new VoiceSelectionParams(); - $voiceLanguageCode = 'voiceLanguageCode-686472265'; - $voice->setLanguageCode($voiceLanguageCode); - $audioConfig = new AudioConfig(); - $audioConfigAudioEncoding = AudioEncoding::AUDIO_ENCODING_UNSPECIFIED; - $audioConfig->setAudioEncoding($audioConfigAudioEncoding); - $request = (new SynthesizeSpeechRequest()) - ->setInput($input) - ->setVoice($voice) - ->setAudioConfig($audioConfig); - $response = $gapicClient->synthesizeSpeech($request); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.texttospeech.v1.TextToSpeech/SynthesizeSpeech', $actualFuncCall); - $actualValue = $actualRequestObject->getInput(); - $this->assertProtobufEquals($input, $actualValue); - $actualValue = $actualRequestObject->getVoice(); - $this->assertProtobufEquals($voice, $actualValue); - $actualValue = $actualRequestObject->getAudioConfig(); - $this->assertProtobufEquals($audioConfig, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function synthesizeSpeechExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $input = new SynthesisInput(); - $voice = new VoiceSelectionParams(); - $voiceLanguageCode = 'voiceLanguageCode-686472265'; - $voice->setLanguageCode($voiceLanguageCode); - $audioConfig = new AudioConfig(); - $audioConfigAudioEncoding = AudioEncoding::AUDIO_ENCODING_UNSPECIFIED; - $audioConfig->setAudioEncoding($audioConfigAudioEncoding); - $request = (new SynthesizeSpeechRequest()) - ->setInput($input) - ->setVoice($voice) - ->setAudioConfig($audioConfig); - try { - $gapicClient->synthesizeSpeech($request); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listVoicesAsyncTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $expectedResponse = new ListVoicesResponse(); - $transport->addResponse($expectedResponse); - $request = new ListVoicesRequest(); - $response = $gapicClient->listVoicesAsync($request)->wait(); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.texttospeech.v1.TextToSpeech/ListVoices', $actualFuncCall); - $this->assertTrue($transport->isExhausted()); - } -} diff --git a/owl-bot-staging/TextToSpeech/v1/tests/Unit/V1/Client/TextToSpeechLongAudioSynthesizeClientTest.php b/owl-bot-staging/TextToSpeech/v1/tests/Unit/V1/Client/TextToSpeechLongAudioSynthesizeClientTest.php deleted file mode 100644 index ca56e0e2c179..000000000000 --- a/owl-bot-staging/TextToSpeech/v1/tests/Unit/V1/Client/TextToSpeechLongAudioSynthesizeClientTest.php +++ /dev/null @@ -1,270 +0,0 @@ -getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); - } - - /** @return TextToSpeechLongAudioSynthesizeClient */ - private function createClient(array $options = []) - { - $options += [ - 'credentials' => $this->createCredentials(), - ]; - return new TextToSpeechLongAudioSynthesizeClient($options); - } - - /** @test */ - public function synthesizeLongAudioTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new OperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('operations/synthesizeLongAudioTest'); - $incompleteOperation->setDone(false); - $transport->addResponse($incompleteOperation); - $expectedResponse = new SynthesizeLongAudioResponse(); - $anyResponse = new Any(); - $anyResponse->setValue($expectedResponse->serializeToString()); - $completeOperation = new Operation(); - $completeOperation->setName('operations/synthesizeLongAudioTest'); - $completeOperation->setDone(true); - $completeOperation->setResponse($anyResponse); - $operationsTransport->addResponse($completeOperation); - // Mock request - $input = new SynthesisInput(); - $audioConfig = new AudioConfig(); - $audioConfigAudioEncoding = AudioEncoding::AUDIO_ENCODING_UNSPECIFIED; - $audioConfig->setAudioEncoding($audioConfigAudioEncoding); - $request = (new SynthesizeLongAudioRequest()) - ->setInput($input) - ->setAudioConfig($audioConfig); - $response = $gapicClient->synthesizeLongAudio($request); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - $apiRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($apiRequests)); - $operationsRequestsEmpty = $operationsTransport->popReceivedCalls(); - $this->assertSame(0, count($operationsRequestsEmpty)); - $actualApiFuncCall = $apiRequests[0]->getFuncCall(); - $actualApiRequestObject = $apiRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.texttospeech.v1.TextToSpeechLongAudioSynthesize/SynthesizeLongAudio', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getInput(); - $this->assertProtobufEquals($input, $actualValue); - $actualValue = $actualApiRequestObject->getAudioConfig(); - $this->assertProtobufEquals($audioConfig, $actualValue); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/synthesizeLongAudioTest'); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $this->assertEquals($expectedResponse, $response->getResult()); - $apiRequestsEmpty = $transport->popReceivedCalls(); - $this->assertSame(0, count($apiRequestsEmpty)); - $operationsRequests = $operationsTransport->popReceivedCalls(); - $this->assertSame(1, count($operationsRequests)); - $actualOperationsFuncCall = $operationsRequests[0]->getFuncCall(); - $actualOperationsRequestObject = $operationsRequests[0]->getRequestObject(); - $this->assertSame('/google.longrunning.Operations/GetOperation', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function synthesizeLongAudioExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new OperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('operations/synthesizeLongAudioTest'); - $incompleteOperation->setDone(false); - $transport->addResponse($incompleteOperation); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $operationsTransport->addResponse(null, $status); - // Mock request - $input = new SynthesisInput(); - $audioConfig = new AudioConfig(); - $audioConfigAudioEncoding = AudioEncoding::AUDIO_ENCODING_UNSPECIFIED; - $audioConfig->setAudioEncoding($audioConfigAudioEncoding); - $request = (new SynthesizeLongAudioRequest()) - ->setInput($input) - ->setAudioConfig($audioConfig); - $response = $gapicClient->synthesizeLongAudio($request); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/synthesizeLongAudioTest'); - try { - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - // If the pollUntilComplete() method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stubs are exhausted - $transport->popReceivedCalls(); - $operationsTransport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function synthesizeLongAudioAsyncTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new OperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('operations/synthesizeLongAudioTest'); - $incompleteOperation->setDone(false); - $transport->addResponse($incompleteOperation); - $expectedResponse = new SynthesizeLongAudioResponse(); - $anyResponse = new Any(); - $anyResponse->setValue($expectedResponse->serializeToString()); - $completeOperation = new Operation(); - $completeOperation->setName('operations/synthesizeLongAudioTest'); - $completeOperation->setDone(true); - $completeOperation->setResponse($anyResponse); - $operationsTransport->addResponse($completeOperation); - // Mock request - $input = new SynthesisInput(); - $audioConfig = new AudioConfig(); - $audioConfigAudioEncoding = AudioEncoding::AUDIO_ENCODING_UNSPECIFIED; - $audioConfig->setAudioEncoding($audioConfigAudioEncoding); - $request = (new SynthesizeLongAudioRequest()) - ->setInput($input) - ->setAudioConfig($audioConfig); - $response = $gapicClient->synthesizeLongAudioAsync($request)->wait(); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - $apiRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($apiRequests)); - $operationsRequestsEmpty = $operationsTransport->popReceivedCalls(); - $this->assertSame(0, count($operationsRequestsEmpty)); - $actualApiFuncCall = $apiRequests[0]->getFuncCall(); - $actualApiRequestObject = $apiRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.texttospeech.v1.TextToSpeechLongAudioSynthesize/SynthesizeLongAudio', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getInput(); - $this->assertProtobufEquals($input, $actualValue); - $actualValue = $actualApiRequestObject->getAudioConfig(); - $this->assertProtobufEquals($audioConfig, $actualValue); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/synthesizeLongAudioTest'); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $this->assertEquals($expectedResponse, $response->getResult()); - $apiRequestsEmpty = $transport->popReceivedCalls(); - $this->assertSame(0, count($apiRequestsEmpty)); - $operationsRequests = $operationsTransport->popReceivedCalls(); - $this->assertSame(1, count($operationsRequests)); - $actualOperationsFuncCall = $operationsRequests[0]->getFuncCall(); - $actualOperationsRequestObject = $operationsRequests[0]->getRequestObject(); - $this->assertSame('/google.longrunning.Operations/GetOperation', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } -} diff --git a/owl-bot-staging/TextToSpeech/v1/tests/Unit/V1/TextToSpeechClientTest.php b/owl-bot-staging/TextToSpeech/v1/tests/Unit/V1/TextToSpeechClientTest.php deleted file mode 100644 index 5692c96e6075..000000000000 --- a/owl-bot-staging/TextToSpeech/v1/tests/Unit/V1/TextToSpeechClientTest.php +++ /dev/null @@ -1,291 +0,0 @@ -getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); - } - - /** @return TextToSpeechClient */ - private function createClient(array $options = []) - { - $options += [ - 'credentials' => $this->createCredentials(), - ]; - return new TextToSpeechClient($options); - } - - /** @test */ - public function listVoicesTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $expectedResponse = new ListVoicesResponse(); - $transport->addResponse($expectedResponse); - $response = $gapicClient->listVoices(); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.texttospeech.v1.TextToSpeech/ListVoices', $actualFuncCall); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listVoicesExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - try { - $gapicClient->listVoices(); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function streamingSynthesizeTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $audioContent = '16'; - $expectedResponse = new StreamingSynthesizeResponse(); - $expectedResponse->setAudioContent($audioContent); - $transport->addResponse($expectedResponse); - $audioContent2 = '-61'; - $expectedResponse2 = new StreamingSynthesizeResponse(); - $expectedResponse2->setAudioContent($audioContent2); - $transport->addResponse($expectedResponse2); - $audioContent3 = '-60'; - $expectedResponse3 = new StreamingSynthesizeResponse(); - $expectedResponse3->setAudioContent($audioContent3); - $transport->addResponse($expectedResponse3); - // Mock request - $request = new StreamingSynthesizeRequest(); - $request2 = new StreamingSynthesizeRequest(); - $request3 = new StreamingSynthesizeRequest(); - $bidi = $gapicClient->streamingSynthesize(); - $this->assertInstanceOf(BidiStream::class, $bidi); - $bidi->write($request); - $responses = []; - $responses[] = $bidi->read(); - $bidi->writeAll([ - $request2, - $request3, - ]); - foreach ($bidi->closeWriteAndReadAll() as $response) { - $responses[] = $response; - } - - $expectedResponses = []; - $expectedResponses[] = $expectedResponse; - $expectedResponses[] = $expectedResponse2; - $expectedResponses[] = $expectedResponse3; - $this->assertEquals($expectedResponses, $responses); - $createStreamRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($createStreamRequests)); - $streamFuncCall = $createStreamRequests[0]->getFuncCall(); - $streamRequestObject = $createStreamRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.texttospeech.v1.TextToSpeech/StreamingSynthesize', $streamFuncCall); - $this->assertNull($streamRequestObject); - $callObjects = $transport->popCallObjects(); - $this->assertSame(1, count($callObjects)); - $bidiCall = $callObjects[0]; - $writeRequests = $bidiCall->popReceivedCalls(); - $expectedRequests = []; - $expectedRequests[] = $request; - $expectedRequests[] = $request2; - $expectedRequests[] = $request3; - $this->assertEquals($expectedRequests, $writeRequests); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function streamingSynthesizeExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->setStreamingStatus($status); - $this->assertTrue($transport->isExhausted()); - $bidi = $gapicClient->streamingSynthesize(); - $results = $bidi->closeWriteAndReadAll(); - try { - iterator_to_array($results); - // If the close stream method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function synthesizeSpeechTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $audioContent = '16'; - $expectedResponse = new SynthesizeSpeechResponse(); - $expectedResponse->setAudioContent($audioContent); - $transport->addResponse($expectedResponse); - // Mock request - $input = new SynthesisInput(); - $voice = new VoiceSelectionParams(); - $voiceLanguageCode = 'voiceLanguageCode-686472265'; - $voice->setLanguageCode($voiceLanguageCode); - $audioConfig = new AudioConfig(); - $audioConfigAudioEncoding = AudioEncoding::AUDIO_ENCODING_UNSPECIFIED; - $audioConfig->setAudioEncoding($audioConfigAudioEncoding); - $response = $gapicClient->synthesizeSpeech($input, $voice, $audioConfig); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.texttospeech.v1.TextToSpeech/SynthesizeSpeech', $actualFuncCall); - $actualValue = $actualRequestObject->getInput(); - $this->assertProtobufEquals($input, $actualValue); - $actualValue = $actualRequestObject->getVoice(); - $this->assertProtobufEquals($voice, $actualValue); - $actualValue = $actualRequestObject->getAudioConfig(); - $this->assertProtobufEquals($audioConfig, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function synthesizeSpeechExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $input = new SynthesisInput(); - $voice = new VoiceSelectionParams(); - $voiceLanguageCode = 'voiceLanguageCode-686472265'; - $voice->setLanguageCode($voiceLanguageCode); - $audioConfig = new AudioConfig(); - $audioConfigAudioEncoding = AudioEncoding::AUDIO_ENCODING_UNSPECIFIED; - $audioConfig->setAudioEncoding($audioConfigAudioEncoding); - try { - $gapicClient->synthesizeSpeech($input, $voice, $audioConfig); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } -} diff --git a/owl-bot-staging/TextToSpeech/v1/tests/Unit/V1/TextToSpeechLongAudioSynthesizeClientTest.php b/owl-bot-staging/TextToSpeech/v1/tests/Unit/V1/TextToSpeechLongAudioSynthesizeClientTest.php deleted file mode 100644 index 0b386e4c2de0..000000000000 --- a/owl-bot-staging/TextToSpeech/v1/tests/Unit/V1/TextToSpeechLongAudioSynthesizeClientTest.php +++ /dev/null @@ -1,193 +0,0 @@ -getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); - } - - /** @return TextToSpeechLongAudioSynthesizeClient */ - private function createClient(array $options = []) - { - $options += [ - 'credentials' => $this->createCredentials(), - ]; - return new TextToSpeechLongAudioSynthesizeClient($options); - } - - /** @test */ - public function synthesizeLongAudioTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new OperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('operations/synthesizeLongAudioTest'); - $incompleteOperation->setDone(false); - $transport->addResponse($incompleteOperation); - $expectedResponse = new SynthesizeLongAudioResponse(); - $anyResponse = new Any(); - $anyResponse->setValue($expectedResponse->serializeToString()); - $completeOperation = new Operation(); - $completeOperation->setName('operations/synthesizeLongAudioTest'); - $completeOperation->setDone(true); - $completeOperation->setResponse($anyResponse); - $operationsTransport->addResponse($completeOperation); - // Mock request - $input = new SynthesisInput(); - $audioConfig = new AudioConfig(); - $audioConfigAudioEncoding = AudioEncoding::AUDIO_ENCODING_UNSPECIFIED; - $audioConfig->setAudioEncoding($audioConfigAudioEncoding); - $response = $gapicClient->synthesizeLongAudio($input, $audioConfig); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - $apiRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($apiRequests)); - $operationsRequestsEmpty = $operationsTransport->popReceivedCalls(); - $this->assertSame(0, count($operationsRequestsEmpty)); - $actualApiFuncCall = $apiRequests[0]->getFuncCall(); - $actualApiRequestObject = $apiRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.texttospeech.v1.TextToSpeechLongAudioSynthesize/SynthesizeLongAudio', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getInput(); - $this->assertProtobufEquals($input, $actualValue); - $actualValue = $actualApiRequestObject->getAudioConfig(); - $this->assertProtobufEquals($audioConfig, $actualValue); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/synthesizeLongAudioTest'); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $this->assertEquals($expectedResponse, $response->getResult()); - $apiRequestsEmpty = $transport->popReceivedCalls(); - $this->assertSame(0, count($apiRequestsEmpty)); - $operationsRequests = $operationsTransport->popReceivedCalls(); - $this->assertSame(1, count($operationsRequests)); - $actualOperationsFuncCall = $operationsRequests[0]->getFuncCall(); - $actualOperationsRequestObject = $operationsRequests[0]->getRequestObject(); - $this->assertSame('/google.longrunning.Operations/GetOperation', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function synthesizeLongAudioExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new OperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('operations/synthesizeLongAudioTest'); - $incompleteOperation->setDone(false); - $transport->addResponse($incompleteOperation); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $operationsTransport->addResponse(null, $status); - // Mock request - $input = new SynthesisInput(); - $audioConfig = new AudioConfig(); - $audioConfigAudioEncoding = AudioEncoding::AUDIO_ENCODING_UNSPECIFIED; - $audioConfig->setAudioEncoding($audioConfigAudioEncoding); - $response = $gapicClient->synthesizeLongAudio($input, $audioConfig); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/synthesizeLongAudioTest'); - try { - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - // If the pollUntilComplete() method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stubs are exhausted - $transport->popReceivedCalls(); - $operationsTransport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } -}