From 4633d5ea3ea80f32569b2ffb06c0fe29cff87bcd Mon Sep 17 00:00:00 2001 From: Owl Bot Date: Mon, 28 Oct 2024 16:59:49 +0000 Subject: [PATCH 1/2] feat: add multi-speaker markup, which allows generating dialogue between multiple speakers PiperOrigin-RevId: 690597076 Source-Link: https://github.com/googleapis/googleapis/commit/3bc81b79e538f42917797898eded82bcf79d024c Source-Link: https://github.com/googleapis/googleapis-gen/commit/a2253a01e6e93e79a1dec7e0b2aeea708b634d1e Copy-Tag: eyJwIjoiVGV4dFRvU3BlZWNoLy5Pd2xCb3QueWFtbCIsImgiOiJhMjI1M2EwMWU2ZTkzZTc5YTFkZWM3ZTBiMmFlZWE3MDhiNjM0ZDFlIn0= --- .../Google/Cloud/Texttospeech/V1/CloudTts.php | Bin 0 -> 4912 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 +++ .../TextToSpeech/V1/MultiSpeakerMarkup.php | 67 +++ .../V1/MultiSpeakerMarkup/Turn.php | 108 +++++ .../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 | 239 ++++++++++ .../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 ++++++++ 49 files changed, 6548 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/MultiSpeakerMarkup.php create mode 100644 owl-bot-staging/TextToSpeech/v1/proto/src/Google/Cloud/TextToSpeech/V1/MultiSpeakerMarkup/Turn.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..6d6a89bd79873be88fbb9d20cbd0fb45ad7189e0 GIT binary patch literal 4912 zcmcIo&u`oI6*pzev7c;BW}HS=>Xc;))X5yFR=R9amTiM@@p4u)kjCO%yv|D2s?bCy&0Ggq?uE4&wJQrSrfPePz%+NK#^;8f4eWbgJZt9+{ z8u}{?=b6w|4VR$uv}|{1YMySH0#&G)8ri!q_?T4oBiq98p9!H;b(#^(M!RBq#4%N) zT_mpN=(cA$brj9zdc?cRBYm@XKQK$-^scby`X zub$d7QYP7YTQW_HX2CMuTy7N82;yyu1w$vM_ij3eIx#wV(pS%Q%Xv4|1_^3rrjso1 z4}YTvS(ZATtE3)c1@2v?fhOf+_@@B-?^1gF`@VFV6>56CP}AoJsoMdTYU^0EG%bF` zral<^(50~}XF>3Rz|NR}6GZ5L5;L%Mq`Tg!rEA1(kUtKI>+vbrG*q)URC`3xtPV+X z0=KuGU;a+w#0v1^3a*VyO87^xdd?tFba^k9y_cRBN}8Dy|HeU-J@M~Be8Qm1VAlB! zSfRTy8KL(1Jj7ggU?@Fec8HT)#+UKz!}*q)sK9LCN}&?}A?%ncRYS^%={iiaX0y8GAHc3*y;Ka8H?<4pb0im&Tqy2^iLB)6)MsvQ zt-SOXj>`*hSD7m;{wD&rn}O;p(qwcL=KpsP)lGZoF~nGQe?f?$0~M-6S1H0DLiC)j z2g_V6o1Krq!fXgnT;&IiNH=_=z7)w+0jHg)fxTx!SOd?)$Tj08_brnkSu422R!28`EP?TCd49xiHI%LgfO3FW=CC~I2E%4E@`~kky&S=Bq6LZT zN?5hK^>Xc4ZdD43d|ap%E5{|}9KQ=Y)1UsJG^Hwj zj^x+jhTvKKwL5x`o=THd7f`p+ER-xPdbPwZV2BW4j2y1uK+>eF9<% z;`bcH!;R~*Eyu?LDMpj!CHk8Zm9K@r>##kbK`4O*Wx&El3y^C*5B6#pK9?OE(Fr$t2m53DW2Mi8#gYLuvB+06XJ`B5_O zgI!;Sm`^|0U`>*YGL-au6sC`Jok>Q#$cg{sAT~yGd>P_CPhRl`t%Z2@=kviCL`V%j zSMI_ls}kfM)|yxmarxEnq!nBs{uV@S-P8JPp+~RpLj2q^h6AGXRNYiMXRNlyzi&;q zI~sqKtvfFQPjHylJeL+!7l#=|?<7~Tm#>GWY0O*GIn6?JfFptt?3#PneSVO3;f^{) z>NSG!ab$7RIHzZ-RFrSGA?^^{a&W3whAxg7ESz}u+5B`(Sx+|tloJY)k0v=fqWm5< zC*JdSA=QxUwMI)WDkn{;Bwyps4OnZ)(ow5Ym60xEaHDp3cvLx-6A>{BiR%@Ba9g7? zqU-d6T#S*1cmT%!8Qj(S6K67gSYUko8%v?^2H>t~XM98^U#&g^Q9tW43GYX9V)dE+-T{QA3 zO!JeUpc&+QX^;DaOVz%T?o6C1{Uch)&EH7rzUSF)E|Yor@?~Hw{Fp&H@B3FJ4{baF zbuDL*|1tvf@@1}H`K|F)8KjDUFL~IN_Yw}_S4F`!0?`rI`r{mt+Xa9(- z6k4t3zasCK*xgJTyY#S=9=Df1J@_j8+z#$;*yT-F{B69w`9AW250J|-gj{YMB9}u6 z>12LGdyGxinternalAddGeneratedFile( + ' +ü + +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/MultiSpeakerMarkup.php b/owl-bot-staging/TextToSpeech/v1/proto/src/Google/Cloud/TextToSpeech/V1/MultiSpeakerMarkup.php new file mode 100644 index 000000000000..bb7faf68acc0 --- /dev/null +++ b/owl-bot-staging/TextToSpeech/v1/proto/src/Google/Cloud/TextToSpeech/V1/MultiSpeakerMarkup.php @@ -0,0 +1,67 @@ +google.cloud.texttospeech.v1.MultiSpeakerMarkup + */ +class MultiSpeakerMarkup extends \Google\Protobuf\Internal\Message +{ + /** + * Required. Speaker turns. + * + * Generated from protobuf field repeated .google.cloud.texttospeech.v1.MultiSpeakerMarkup.Turn turns = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + private $turns; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array<\Google\Cloud\TextToSpeech\V1\MultiSpeakerMarkup\Turn>|\Google\Protobuf\Internal\RepeatedField $turns + * Required. Speaker turns. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Texttospeech\V1\CloudTts::initOnce(); + parent::__construct($data); + } + + /** + * Required. Speaker turns. + * + * Generated from protobuf field repeated .google.cloud.texttospeech.v1.MultiSpeakerMarkup.Turn turns = 1 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getTurns() + { + return $this->turns; + } + + /** + * Required. Speaker turns. + * + * Generated from protobuf field repeated .google.cloud.texttospeech.v1.MultiSpeakerMarkup.Turn turns = 1 [(.google.api.field_behavior) = REQUIRED]; + * @param array<\Google\Cloud\TextToSpeech\V1\MultiSpeakerMarkup\Turn>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setTurns($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\TextToSpeech\V1\MultiSpeakerMarkup\Turn::class); + $this->turns = $arr; + + return $this; + } + +} + diff --git a/owl-bot-staging/TextToSpeech/v1/proto/src/Google/Cloud/TextToSpeech/V1/MultiSpeakerMarkup/Turn.php b/owl-bot-staging/TextToSpeech/v1/proto/src/Google/Cloud/TextToSpeech/V1/MultiSpeakerMarkup/Turn.php new file mode 100644 index 000000000000..c2ad106a5e69 --- /dev/null +++ b/owl-bot-staging/TextToSpeech/v1/proto/src/Google/Cloud/TextToSpeech/V1/MultiSpeakerMarkup/Turn.php @@ -0,0 +1,108 @@ +google.cloud.texttospeech.v1.MultiSpeakerMarkup.Turn + */ +class Turn extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The speaker of the turn, for example, 'O' or 'Q'. Please refer + * to documentation for available speakers. + * + * Generated from protobuf field string speaker = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $speaker = ''; + /** + * Required. The text to speak. + * + * Generated from protobuf field string text = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $text = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $speaker + * Required. The speaker of the turn, for example, 'O' or 'Q'. Please refer + * to documentation for available speakers. + * @type string $text + * Required. The text to speak. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Texttospeech\V1\CloudTts::initOnce(); + parent::__construct($data); + } + + /** + * Required. The speaker of the turn, for example, 'O' or 'Q'. Please refer + * to documentation for available speakers. + * + * Generated from protobuf field string speaker = 1 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getSpeaker() + { + return $this->speaker; + } + + /** + * Required. The speaker of the turn, for example, 'O' or 'Q'. Please refer + * to documentation for available speakers. + * + * Generated from protobuf field string speaker = 1 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setSpeaker($var) + { + GPBUtil::checkString($var, True); + $this->speaker = $var; + + return $this; + } + + /** + * Required. The text to speak. + * + * Generated from protobuf field string text = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getText() + { + return $this->text; + } + + /** + * Required. The text to speak. + * + * Generated from protobuf field string text = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setText($var) + { + GPBUtil::checkString($var, True); + $this->text = $var; + + return $this; + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(Turn::class, \Google\Cloud\TextToSpeech\V1\MultiSpeakerMarkup_Turn::class); + 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..35aa6a12b35e --- /dev/null +++ b/owl-bot-staging/TextToSpeech/v1/proto/src/Google/Cloud/TextToSpeech/V1/SynthesisInput.php @@ -0,0 +1,239 @@ +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\MultiSpeakerMarkup $multi_speaker_markup + * The multi-speaker input to be synthesized. Only applicable for + * multi-speaker synthesis. + * @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; + } + + /** + * The multi-speaker input to be synthesized. Only applicable for + * multi-speaker synthesis. + * + * Generated from protobuf field .google.cloud.texttospeech.v1.MultiSpeakerMarkup multi_speaker_markup = 4; + * @return \Google\Cloud\TextToSpeech\V1\MultiSpeakerMarkup|null + */ + public function getMultiSpeakerMarkup() + { + return $this->readOneof(4); + } + + public function hasMultiSpeakerMarkup() + { + return $this->hasOneof(4); + } + + /** + * The multi-speaker input to be synthesized. Only applicable for + * multi-speaker synthesis. + * + * Generated from protobuf field .google.cloud.texttospeech.v1.MultiSpeakerMarkup multi_speaker_markup = 4; + * @param \Google\Cloud\TextToSpeech\V1\MultiSpeakerMarkup $var + * @return $this + */ + public function setMultiSpeakerMarkup($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\TextToSpeech\V1\MultiSpeakerMarkup::class); + $this->writeOneof(4, $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 2386dc60a2da99c92e44681683aeea1b1f1f108b Mon Sep 17 00:00:00 2001 From: Owl Bot Date: Mon, 28 Oct 2024 17:03:06 +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 4683 -> 4912 bytes .../src}/V1/MultiSpeakerMarkup.php | 0 .../src}/V1/MultiSpeakerMarkup/Turn.php | 4 +- TextToSpeech/src/V1/SynthesisInput.php | 36 ++ .../Google/Cloud/Texttospeech/V1/CloudTts.php | Bin 4912 -> 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 | 239 ---------- .../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 -------- 51 files changed, 38 insertions(+), 6375 deletions(-) rename {owl-bot-staging/TextToSpeech/v1/proto/src/Google/Cloud/TextToSpeech => TextToSpeech/src}/V1/MultiSpeakerMarkup.php (100%) rename {owl-bot-staging/TextToSpeech/v1/proto/src/Google/Cloud/TextToSpeech => TextToSpeech/src}/V1/MultiSpeakerMarkup/Turn.php (98%) 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/VoiceCloneParams.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 cee048c39aed1706ac68ec1f4ab27f126319418c..6d6a89bd79873be88fbb9d20cbd0fb45ad7189e0 100644 GIT binary patch delta 208 zcmX@DvO#UbAtsi^3S2r9y>&K!ViIOmpTNi^D6R54kP&hE|FZ2_3=c3Ne_Atsi6a$GtSy>&K!ViIO$nZd}#H#v@1Zt^Y;!OgOq!dw9S4huv8 diff --git a/owl-bot-staging/TextToSpeech/v1/proto/src/Google/Cloud/TextToSpeech/V1/MultiSpeakerMarkup.php b/TextToSpeech/src/V1/MultiSpeakerMarkup.php similarity index 100% rename from owl-bot-staging/TextToSpeech/v1/proto/src/Google/Cloud/TextToSpeech/V1/MultiSpeakerMarkup.php rename to TextToSpeech/src/V1/MultiSpeakerMarkup.php diff --git a/owl-bot-staging/TextToSpeech/v1/proto/src/Google/Cloud/TextToSpeech/V1/MultiSpeakerMarkup/Turn.php b/TextToSpeech/src/V1/MultiSpeakerMarkup/Turn.php similarity index 98% rename from owl-bot-staging/TextToSpeech/v1/proto/src/Google/Cloud/TextToSpeech/V1/MultiSpeakerMarkup/Turn.php rename to TextToSpeech/src/V1/MultiSpeakerMarkup/Turn.php index c2ad106a5e69..380e3001b4ed 100644 --- a/owl-bot-staging/TextToSpeech/v1/proto/src/Google/Cloud/TextToSpeech/V1/MultiSpeakerMarkup/Turn.php +++ b/TextToSpeech/src/V1/MultiSpeakerMarkup/Turn.php @@ -21,13 +21,13 @@ class Turn extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string speaker = 1 [(.google.api.field_behavior) = REQUIRED]; */ - protected $speaker = ''; + private $speaker = ''; /** * Required. The text to speak. * * Generated from protobuf field string text = 2 [(.google.api.field_behavior) = REQUIRED]; */ - protected $text = ''; + private $text = ''; /** * Constructor. diff --git a/TextToSpeech/src/V1/SynthesisInput.php b/TextToSpeech/src/V1/SynthesisInput.php index 8c54e52eaaff..d0cee9b951b4 100644 --- a/TextToSpeech/src/V1/SynthesisInput.php +++ b/TextToSpeech/src/V1/SynthesisInput.php @@ -49,6 +49,9 @@ class SynthesisInput extends \Google\Protobuf\Internal\Message * [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\MultiSpeakerMarkup $multi_speaker_markup + * The multi-speaker input to be synthesized. Only applicable for + * multi-speaker synthesis. * @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 @@ -137,6 +140,39 @@ public function setSsml($var) return $this; } + /** + * The multi-speaker input to be synthesized. Only applicable for + * multi-speaker synthesis. + * + * Generated from protobuf field .google.cloud.texttospeech.v1.MultiSpeakerMarkup multi_speaker_markup = 4; + * @return \Google\Cloud\TextToSpeech\V1\MultiSpeakerMarkup|null + */ + public function getMultiSpeakerMarkup() + { + return $this->readOneof(4); + } + + public function hasMultiSpeakerMarkup() + { + return $this->hasOneof(4); + } + + /** + * The multi-speaker input to be synthesized. Only applicable for + * multi-speaker synthesis. + * + * Generated from protobuf field .google.cloud.texttospeech.v1.MultiSpeakerMarkup multi_speaker_markup = 4; + * @param \Google\Cloud\TextToSpeech\V1\MultiSpeakerMarkup $var + * @return $this + */ + public function setMultiSpeakerMarkup($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\TextToSpeech\V1\MultiSpeakerMarkup::class); + $this->writeOneof(4, $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 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 6d6a89bd79873be88fbb9d20cbd0fb45ad7189e0..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 4912 zcmcIo&u`oI6*pzev7c;BW}HS=>Xc;))X5yFR=R9amTiM@@p4u)kjCO%yv|D2s?bCy&0Ggq?uE4&wJQrSrfPePz%+NK#^;8f4eWbgJZt9+{ z8u}{?=b6w|4VR$uv}|{1YMySH0#&G)8ri!q_?T4oBiq98p9!H;b(#^(M!RBq#4%N) zT_mpN=(cA$brj9zdc?cRBYm@XKQK$-^scby`X zub$d7QYP7YTQW_HX2CMuTy7N82;yyu1w$vM_ij3eIx#wV(pS%Q%Xv4|1_^3rrjso1 z4}YTvS(ZATtE3)c1@2v?fhOf+_@@B-?^1gF`@VFV6>56CP}AoJsoMdTYU^0EG%bF` zral<^(50~}XF>3Rz|NR}6GZ5L5;L%Mq`Tg!rEA1(kUtKI>+vbrG*q)URC`3xtPV+X z0=KuGU;a+w#0v1^3a*VyO87^xdd?tFba^k9y_cRBN}8Dy|HeU-J@M~Be8Qm1VAlB! zSfRTy8KL(1Jj7ggU?@Fec8HT)#+UKz!}*q)sK9LCN}&?}A?%ncRYS^%={iiaX0y8GAHc3*y;Ka8H?<4pb0im&Tqy2^iLB)6)MsvQ zt-SOXj>`*hSD7m;{wD&rn}O;p(qwcL=KpsP)lGZoF~nGQe?f?$0~M-6S1H0DLiC)j z2g_V6o1Krq!fXgnT;&IiNH=_=z7)w+0jHg)fxTx!SOd?)$Tj08_brnkSu422R!28`EP?TCd49xiHI%LgfO3FW=CC~I2E%4E@`~kky&S=Bq6LZT zN?5hK^>Xc4ZdD43d|ap%E5{|}9KQ=Y)1UsJG^Hwj zj^x+jhTvKKwL5x`o=THd7f`p+ER-xPdbPwZV2BW4j2y1uK+>eF9<% z;`bcH!;R~*Eyu?LDMpj!CHk8Zm9K@r>##kbK`4O*Wx&El3y^C*5B6#pK9?OE(Fr$t2m53DW2Mi8#gYLuvB+06XJ`B5_O zgI!;Sm`^|0U`>*YGL-au6sC`Jok>Q#$cg{sAT~yGd>P_CPhRl`t%Z2@=kviCL`V%j zSMI_ls}kfM)|yxmarxEnq!nBs{uV@S-P8JPp+~RpLj2q^h6AGXRNYiMXRNlyzi&;q zI~sqKtvfFQPjHylJeL+!7l#=|?<7~Tm#>GWY0O*GIn6?JfFptt?3#PneSVO3;f^{) z>NSG!ab$7RIHzZ-RFrSGA?^^{a&W3whAxg7ESz}u+5B`(Sx+|tloJY)k0v=fqWm5< zC*JdSA=QxUwMI)WDkn{;Bwyps4OnZ)(ow5Ym60xEaHDp3cvLx-6A>{BiR%@Ba9g7? zqU-d6T#S*1cmT%!8Qj(S6K67gSYUko8%v?^2H>t~XM98^U#&g^Q9tW43GYX9V)dE+-T{QA3 zO!JeUpc&+QX^;DaOVz%T?o6C1{Uch)&EH7rzUSF)E|Yor@?~Hw{Fp&H@B3FJ4{baF zbuDL*|1tvf@@1}H`K|F)8KjDUFL~IN_Yw}_S4F`!0?`rI`r{mt+Xa9(- z6k4t3zasCK*xgJTyY#S=9=Df1J@_j8+z#$;*yT-F{B69w`9AW250J|-gj{YMB9}u6 z>12LGdyGxinternalAddGeneratedFile( - ' -ü - -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 35aa6a12b35e..000000000000 --- a/owl-bot-staging/TextToSpeech/v1/proto/src/Google/Cloud/TextToSpeech/V1/SynthesisInput.php +++ /dev/null @@ -1,239 +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\MultiSpeakerMarkup $multi_speaker_markup - * The multi-speaker input to be synthesized. Only applicable for - * multi-speaker synthesis. - * @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; - } - - /** - * The multi-speaker input to be synthesized. Only applicable for - * multi-speaker synthesis. - * - * Generated from protobuf field .google.cloud.texttospeech.v1.MultiSpeakerMarkup multi_speaker_markup = 4; - * @return \Google\Cloud\TextToSpeech\V1\MultiSpeakerMarkup|null - */ - public function getMultiSpeakerMarkup() - { - return $this->readOneof(4); - } - - public function hasMultiSpeakerMarkup() - { - return $this->hasOneof(4); - } - - /** - * The multi-speaker input to be synthesized. Only applicable for - * multi-speaker synthesis. - * - * Generated from protobuf field .google.cloud.texttospeech.v1.MultiSpeakerMarkup multi_speaker_markup = 4; - * @param \Google\Cloud\TextToSpeech\V1\MultiSpeakerMarkup $var - * @return $this - */ - public function setMultiSpeakerMarkup($var) - { - GPBUtil::checkMessage($var, \Google\Cloud\TextToSpeech\V1\MultiSpeakerMarkup::class); - $this->writeOneof(4, $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/VoiceCloneParams.php b/owl-bot-staging/TextToSpeech/v1/proto/src/Google/Cloud/TextToSpeech/V1/VoiceCloneParams.php deleted file mode 100644 index 83d52d421f52..000000000000 --- a/owl-bot-staging/TextToSpeech/v1/proto/src/Google/Cloud/TextToSpeech/V1/VoiceCloneParams.php +++ /dev/null @@ -1,67 +0,0 @@ -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 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()); - } -}