From 11ae1f1f659450f92b2da83d48228ef942e94eea Mon Sep 17 00:00:00 2001 From: Owl Bot Date: Tue, 21 Feb 2023 19:58:24 +0000 Subject: [PATCH 1/2] feat: Add supported fields in document translation request and refresh translation v3 GA service proto documentation PiperOrigin-RevId: 511225850 Source-Link: https://github.com/googleapis/googleapis/commit/84bbbc5438fbb7aaefa04447f37e91ff3a38a2f0 Source-Link: https://github.com/googleapis/googleapis-gen/commit/431d15cddae84906d4ac2e1d75e243099747c52b Copy-Tag: eyJwIjoiVHJhbnNsYXRlLy5Pd2xCb3QueWFtbCIsImgiOiI0MzFkMTVjZGRhZTg0OTA2ZDRhYzJlMWQ3NWUyNDMwOTk3NDdjNTJiIn0= --- .../Cloud/Translate/V3/TranslationService.php | Bin 0 -> 12544 bytes .../Translate/V3/BatchDocumentInputConfig.php | 123 ++ .../V3/BatchDocumentOutputConfig.php | 186 +++ .../V3/BatchTranslateDocumentMetadata.php | 411 +++++ .../BatchTranslateDocumentMetadata/State.php | 88 ++ .../BatchTranslateDocumentMetadata_State.php | 16 + .../V3/BatchTranslateDocumentRequest.php | 477 ++++++ .../V3/BatchTranslateDocumentResponse.php | 432 ++++++ .../Translate/V3/BatchTranslateMetadata.php | 225 +++ .../V3/BatchTranslateMetadata/State.php | 89 ++ .../V3/BatchTranslateMetadata_State.php | 16 + .../Translate/V3/BatchTranslateResponse.php | 234 +++ .../V3/BatchTranslateTextRequest.php | 419 ++++++ .../Translate/V3/CreateGlossaryMetadata.php | 147 ++ .../V3/CreateGlossaryMetadata/State.php | 86 ++ .../V3/CreateGlossaryMetadata_State.php | 16 + .../Translate/V3/CreateGlossaryRequest.php | 111 ++ .../Translate/V3/DeleteGlossaryMetadata.php | 147 ++ .../V3/DeleteGlossaryMetadata/State.php | 86 ++ .../V3/DeleteGlossaryMetadata_State.php | 16 + .../Translate/V3/DeleteGlossaryRequest.php | 67 + .../Translate/V3/DeleteGlossaryResponse.php | 165 ++ .../Translate/V3/DetectLanguageRequest.php | 287 ++++ .../Translate/V3/DetectLanguageResponse.php | 71 + .../Cloud/Translate/V3/DetectedLanguage.php | 105 ++ .../Translate/V3/DocumentInputConfig.php | 177 +++ .../Translate/V3/DocumentOutputConfig.php | 240 +++ .../Translate/V3/DocumentTranslation.php | 159 ++ .../Cloud/Translate/V3/GcsDestination.php | 83 + .../Google/Cloud/Translate/V3/GcsSource.php | 67 + .../Cloud/Translate/V3/GetGlossaryRequest.php | 67 + .../V3/GetSupportedLanguagesRequest.php | 203 +++ .../Google/Cloud/Translate/V3/Glossary.php | 350 +++++ .../V3/Glossary/LanguageCodePair.php | 112 ++ .../V3/Glossary/LanguageCodesSet.php | 78 + .../Translate/V3/GlossaryInputConfig.php | 120 ++ .../V3/Glossary_LanguageCodePair.php | 16 + .../V3/Glossary_LanguageCodesSet.php | 16 + .../Google/Cloud/Translate/V3/InputConfig.php | 166 ++ .../Translate/V3/ListGlossariesRequest.php | 245 +++ .../Translate/V3/ListGlossariesResponse.php | 109 ++ .../Cloud/Translate/V3/OutputConfig.php | 249 +++ .../Cloud/Translate/V3/SupportedLanguage.php | 186 +++ .../Cloud/Translate/V3/SupportedLanguages.php | 71 + .../Translate/V3/TranslateDocumentRequest.php | 593 ++++++++ .../V3/TranslateDocumentResponse.php | 231 +++ .../V3/TranslateTextGlossaryConfig.php | 118 ++ .../Translate/V3/TranslateTextRequest.php | 451 ++++++ .../Translate/V3/TranslateTextResponse.php | 123 ++ .../Google/Cloud/Translate/V3/Translation.php | 223 +++ .../V3/TranslationServiceGrpcClient.php | 204 +++ .../batch_translate_document.php | 115 ++ .../batch_translate_text.php | 112 ++ .../create_glossary.php | 86 ++ .../delete_glossary.php | 80 + .../detect_language.php | 76 + .../TranslationServiceClient/get_glossary.php | 67 + .../get_supported_languages.php | 78 + .../list_glossaries.php | 72 + .../translate_document.php | 87 ++ .../translate_text.php | 96 ++ .../Gapic/TranslationServiceGapicClient.php | 1338 +++++++++++++++++ .../v3/src/V3/TranslationServiceClient.php | 34 + .../Translate/v3/src/V3/gapic_metadata.json | 68 + .../translation_service_client_config.json | 95 ++ .../translation_service_descriptor_config.php | 58 + ...translation_service_rest_client_config.php | 228 +++ .../Unit/V3/TranslationServiceClientTest.php | 996 ++++++++++++ 68 files changed, 12363 insertions(+) create mode 100644 owl-bot-staging/Translate/v3/proto/src/GPBMetadata/Google/Cloud/Translate/V3/TranslationService.php create mode 100644 owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/BatchDocumentInputConfig.php create mode 100644 owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/BatchDocumentOutputConfig.php create mode 100644 owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/BatchTranslateDocumentMetadata.php create mode 100644 owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/BatchTranslateDocumentMetadata/State.php create mode 100644 owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/BatchTranslateDocumentMetadata_State.php create mode 100644 owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/BatchTranslateDocumentRequest.php create mode 100644 owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/BatchTranslateDocumentResponse.php create mode 100644 owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/BatchTranslateMetadata.php create mode 100644 owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/BatchTranslateMetadata/State.php create mode 100644 owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/BatchTranslateMetadata_State.php create mode 100644 owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/BatchTranslateResponse.php create mode 100644 owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/BatchTranslateTextRequest.php create mode 100644 owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/CreateGlossaryMetadata.php create mode 100644 owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/CreateGlossaryMetadata/State.php create mode 100644 owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/CreateGlossaryMetadata_State.php create mode 100644 owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/CreateGlossaryRequest.php create mode 100644 owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/DeleteGlossaryMetadata.php create mode 100644 owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/DeleteGlossaryMetadata/State.php create mode 100644 owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/DeleteGlossaryMetadata_State.php create mode 100644 owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/DeleteGlossaryRequest.php create mode 100644 owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/DeleteGlossaryResponse.php create mode 100644 owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/DetectLanguageRequest.php create mode 100644 owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/DetectLanguageResponse.php create mode 100644 owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/DetectedLanguage.php create mode 100644 owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/DocumentInputConfig.php create mode 100644 owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/DocumentOutputConfig.php create mode 100644 owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/DocumentTranslation.php create mode 100644 owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/GcsDestination.php create mode 100644 owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/GcsSource.php create mode 100644 owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/GetGlossaryRequest.php create mode 100644 owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/GetSupportedLanguagesRequest.php create mode 100644 owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/Glossary.php create mode 100644 owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/Glossary/LanguageCodePair.php create mode 100644 owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/Glossary/LanguageCodesSet.php create mode 100644 owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/GlossaryInputConfig.php create mode 100644 owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/Glossary_LanguageCodePair.php create mode 100644 owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/Glossary_LanguageCodesSet.php create mode 100644 owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/InputConfig.php create mode 100644 owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/ListGlossariesRequest.php create mode 100644 owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/ListGlossariesResponse.php create mode 100644 owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/OutputConfig.php create mode 100644 owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/SupportedLanguage.php create mode 100644 owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/SupportedLanguages.php create mode 100644 owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/TranslateDocumentRequest.php create mode 100644 owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/TranslateDocumentResponse.php create mode 100644 owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/TranslateTextGlossaryConfig.php create mode 100644 owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/TranslateTextRequest.php create mode 100644 owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/TranslateTextResponse.php create mode 100644 owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/Translation.php create mode 100644 owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/TranslationServiceGrpcClient.php create mode 100644 owl-bot-staging/Translate/v3/samples/V3/TranslationServiceClient/batch_translate_document.php create mode 100644 owl-bot-staging/Translate/v3/samples/V3/TranslationServiceClient/batch_translate_text.php create mode 100644 owl-bot-staging/Translate/v3/samples/V3/TranslationServiceClient/create_glossary.php create mode 100644 owl-bot-staging/Translate/v3/samples/V3/TranslationServiceClient/delete_glossary.php create mode 100644 owl-bot-staging/Translate/v3/samples/V3/TranslationServiceClient/detect_language.php create mode 100644 owl-bot-staging/Translate/v3/samples/V3/TranslationServiceClient/get_glossary.php create mode 100644 owl-bot-staging/Translate/v3/samples/V3/TranslationServiceClient/get_supported_languages.php create mode 100644 owl-bot-staging/Translate/v3/samples/V3/TranslationServiceClient/list_glossaries.php create mode 100644 owl-bot-staging/Translate/v3/samples/V3/TranslationServiceClient/translate_document.php create mode 100644 owl-bot-staging/Translate/v3/samples/V3/TranslationServiceClient/translate_text.php create mode 100644 owl-bot-staging/Translate/v3/src/V3/Gapic/TranslationServiceGapicClient.php create mode 100644 owl-bot-staging/Translate/v3/src/V3/TranslationServiceClient.php create mode 100644 owl-bot-staging/Translate/v3/src/V3/gapic_metadata.json create mode 100644 owl-bot-staging/Translate/v3/src/V3/resources/translation_service_client_config.json create mode 100644 owl-bot-staging/Translate/v3/src/V3/resources/translation_service_descriptor_config.php create mode 100644 owl-bot-staging/Translate/v3/src/V3/resources/translation_service_rest_client_config.php create mode 100644 owl-bot-staging/Translate/v3/tests/Unit/V3/TranslationServiceClientTest.php diff --git a/owl-bot-staging/Translate/v3/proto/src/GPBMetadata/Google/Cloud/Translate/V3/TranslationService.php b/owl-bot-staging/Translate/v3/proto/src/GPBMetadata/Google/Cloud/Translate/V3/TranslationService.php new file mode 100644 index 0000000000000000000000000000000000000000..f7615d188f389ce4c52c5f4f63b61e7b76741bf0 GIT binary patch literal 12544 zcmd5?&2t<_70>KOiqtEAwQXgk*kL_(5?hgXofQemI!dzoj6jwZOL3}piZ5Qx zbiaP@_rBls>uxKEbrS(g&)py!ngH#GF$7xxl)Ucd(vlMuS?OQ;wv@;d{VLEorC*F?PAVo$W zA=}s{zH2l{VR3cl772`|5f~ebjMT;~CAG0GNp0Mnx`|N3GJL-v9|FlWP7yso1^DN- z>z3Il_<<3?e^*SuX4+<88kYGD5N^7#X;?l1GTm!8+jb)WdIh@Sw%s6CuN62=y7r3e z02tE+$=fQ$2e8>#vIFAThP5$A{Dx<`f#a>h(n_U8f)G{uYW!(I(Qr+0EvgvqI^&;< zyx64Z*Xja(v0yB+z!MmYSC_>rs{>@o34x3qz&sT!y%b2a_yT`k+U&!eH1c#_u&+STEi>_4j+oJTpcWjh|JH4LBRGw^1JzR~nwXVE!@;2rYy zHt2^^YB-<-JMe*0R#F;8!`r}8E!cHQJ}Xbq@FjGPTU5<5>{i=o!BI|=gp!@`I9` zhVP1jyvd)BTeZ@D`WZ{&_p_ zb{Wm_>nIm_hI1(UKH23u#3#_ej$yUA;)W}kS2g|T8al7=2_Ef2)FJo{G!lsDO+Az; zFIT?W7mKg~FQW4yXbPb$leKR``Y$z(l5oKY}zRL=YlQsLswJ4tOGB&ekN5&snU===acQ zoI_!*Z=qpHMB3{0J|yk1q5nWb7Zypd)^=UT1EZ1r`Q19?0qYPt)Y18->ARM(8#Bc) zxN4oq!_1e5)%OtY<_A~1Wi6)4+C@Wm(V4D?y%cc{jY#Hc$;VVN4EA=?=TOzSZdn)~ ziazIIn#JxR{W2O}Z1`)e;H1WC+HO0jwLOztFqJo>Z=>82eLl<6kYdvjs9r~?)$rxH z6t7(Q`BVhLqu+iaVvRS@Nq7OpUtroSFF?>ZKAI%&c?e8>xDhd`5K03>`{}(U7VzI6;=?hg|ukzQ{(E!r<%#kx!v~xf^Dd zA(mOHsXX`6T~~6!m(ggW?FY^_ZTo6Q5O`+2P1^)0lSC=1;cMsu^oL;~P^134Luzhw zv*y^=ZaxP~d2NcXqXMywx$GRjO`lNG0#jRs@EM4Jcmw1&hHOSDsfi#H^-4c~_A(cjNNk!`fgd)-cjG}iMJ`#+PW{E{m z>i!XE4{D&s-$$on{Ha?OqdnIV?3#9KhYd}?&!ABiRyn1^Z=(S^!Xhj}oGia~2-Qd$ z#WhL*Uj&<%Q@&=cv1ND$v|OIg%ET-lLuWP(7`P~}sPkuGns7RRDVG)9M7=+YODN~J z>)U2fqjL)|WNL!rl1DkzD25{-ouC2E&3UM6*Q@LEwRcz6R_AAz7MAAcPCo%EdFsx) zD=SMYi>EbcgNN7Not>SZpM!T9Xfp;Es!Pl8JBv>uG+SMnonKz2OP{1m#ozFHK>wW< z2Q+M#lZ2rmCVK>cVleQ?m;wWyL_@@ep142IzJksQ)7_1PfmlJwGsxo<*FPOVLy|sZ zyeC=jz@si3Cf$y-eXe18tbfRrUy*7~8mSc}L8uz|cxV>F;418fLUJ8p*#fem5i|%S z5M|n9Q1#bH08|&yNHnYpV@%I{lFKNpFgt@{-rEJ%+Ax@+VRe8;oGkvlYVCZql%i(7 z>!paU>69zgLHL%jSR*$K+t_4J8(%@Ej?xVB%?T{I9`0$1gn)zxGPuK(F*b{@g3I!pu{8Ab#)e&Ez6o zv;KXUd(A>+77$7P7%GISS5E@1QK3Oi^Un zSSp|iG}Ylht&B*aP|fT(ph%|p8HeIKP#ma?hsA+v6)|1%NRblnm9&1a=KnK@E~-_Z zoI)IfyB<>$^iI52;l0qyso|0dC1r`ERu(?tV@j-X;ZS|BSH>CcfW((Eo|79Niw+wo= zS4a`a=Gcw}iB)WG!Lcw4l9*ksW`_+rp$C zi+XuVk44Mu9!)5%v$HS(9*dnAX<=zy-PMiKsyQ|HD)E|*EK^tOpJaPs8>Z4#wOdag zv?l9G(h^BDrY)`$if>$7TrY8LaeegC7S~CVwzxWajtsa;5=RDH6{*^yis{nU!T5hV zvxD--=Ma{$8-lR7`Go(JK_}#6HmStvqkmZ|)g#KLezV5aA)hnF(WKzR83Ew@~^^pDQl32#( zqm$wNkjbPQA?dX6cQfdu`lT4BgQPB&z)qzC8{Z?4{T@fQsh5)xQju*c_XQ}lFY3=H zZ``YNE#9v_+XFNKEB-OuNl5&xjnjvIiF+h2rBqzHzAXFjah+M)CVnMZGzF8A_^=%L z27hl7PbBZ$OIW>M)fH6a=WAvBfPbr@Gof$DY>Lxs(603ok@PwtTA5!T3s<^X=e*qWXB9lOz9&95k zCENYYxAbX+Q97RQk^Up9DNXF{SJ@~Z{~0h==N$)NtS*+!9uRL_&g29~^RP^^SQ9^& z>j}q(HPSW4zxlA556c}9T;wqN57n=31%c~VN~Qbv@5f%2jCQca@6ca|t6l+ZyeIox zF3*F)aON)>x(HWNlfxQ;d&M(P%XHGIBUkB__Eqg(l}AB-yOrH+Z8_09{3Vb?z18p5 zZ$?gc>;KlYUuDJ?*)9I!EWO3wxyV|)JM~b$+Ynd$BX|7alK-R31-`XXVS6hT$t$T; n?oQPQ*~h!77sBh;ll;DXgoogle.cloud.translation.v3.BatchDocumentInputConfig + */ +class BatchDocumentInputConfig extends \Google\Protobuf\Internal\Message +{ + protected $source; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\Translate\V3\GcsSource $gcs_source + * Google Cloud Storage location for the source input. + * This can be a single file (for example, + * `gs://translation-test/input.docx`) or a wildcard (for example, + * `gs://translation-test/*`). + * File mime type is determined based on extension. Supported mime type + * includes: + * - `pdf`, application/pdf + * - `docx`, + * application/vnd.openxmlformats-officedocument.wordprocessingml.document + * - `pptx`, + * application/vnd.openxmlformats-officedocument.presentationml.presentation + * - `xlsx`, + * application/vnd.openxmlformats-officedocument.spreadsheetml.sheet + * The max file size to support for `.docx`, `.pptx` and `.xlsx` is 100MB. + * The max file size to support for `.pdf` is 1GB and the max page limit is + * 1000 pages. + * The max file size to support for all input documents is 1GB. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Translate\V3\TranslationService::initOnce(); + parent::__construct($data); + } + + /** + * Google Cloud Storage location for the source input. + * This can be a single file (for example, + * `gs://translation-test/input.docx`) or a wildcard (for example, + * `gs://translation-test/*`). + * File mime type is determined based on extension. Supported mime type + * includes: + * - `pdf`, application/pdf + * - `docx`, + * application/vnd.openxmlformats-officedocument.wordprocessingml.document + * - `pptx`, + * application/vnd.openxmlformats-officedocument.presentationml.presentation + * - `xlsx`, + * application/vnd.openxmlformats-officedocument.spreadsheetml.sheet + * The max file size to support for `.docx`, `.pptx` and `.xlsx` is 100MB. + * The max file size to support for `.pdf` is 1GB and the max page limit is + * 1000 pages. + * The max file size to support for all input documents is 1GB. + * + * Generated from protobuf field .google.cloud.translation.v3.GcsSource gcs_source = 1; + * @return \Google\Cloud\Translate\V3\GcsSource|null + */ + public function getGcsSource() + { + return $this->readOneof(1); + } + + public function hasGcsSource() + { + return $this->hasOneof(1); + } + + /** + * Google Cloud Storage location for the source input. + * This can be a single file (for example, + * `gs://translation-test/input.docx`) or a wildcard (for example, + * `gs://translation-test/*`). + * File mime type is determined based on extension. Supported mime type + * includes: + * - `pdf`, application/pdf + * - `docx`, + * application/vnd.openxmlformats-officedocument.wordprocessingml.document + * - `pptx`, + * application/vnd.openxmlformats-officedocument.presentationml.presentation + * - `xlsx`, + * application/vnd.openxmlformats-officedocument.spreadsheetml.sheet + * The max file size to support for `.docx`, `.pptx` and `.xlsx` is 100MB. + * The max file size to support for `.pdf` is 1GB and the max page limit is + * 1000 pages. + * The max file size to support for all input documents is 1GB. + * + * Generated from protobuf field .google.cloud.translation.v3.GcsSource gcs_source = 1; + * @param \Google\Cloud\Translate\V3\GcsSource $var + * @return $this + */ + public function setGcsSource($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Translate\V3\GcsSource::class); + $this->writeOneof(1, $var); + + return $this; + } + + /** + * @return string + */ + public function getSource() + { + return $this->whichOneof("source"); + } + +} + diff --git a/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/BatchDocumentOutputConfig.php b/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/BatchDocumentOutputConfig.php new file mode 100644 index 00000000000..ae9cab5054d --- /dev/null +++ b/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/BatchDocumentOutputConfig.php @@ -0,0 +1,186 @@ +google.cloud.translation.v3.BatchDocumentOutputConfig + */ +class BatchDocumentOutputConfig extends \Google\Protobuf\Internal\Message +{ + protected $destination; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\Translate\V3\GcsDestination $gcs_destination + * Google Cloud Storage destination for output content. + * For every single input document (for example, gs://a/b/c.[extension]), we + * generate at most 2 * n output files. (n is the # of target_language_codes + * in the BatchTranslateDocumentRequest). + * While the input documents are being processed, we write/update an index + * file `index.csv` under `gcs_destination.output_uri_prefix` (for example, + * gs://translation_output/index.csv) The index file is generated/updated as + * new files are being translated. The format is: + * input_document,target_language_code,translation_output,error_output, + * glossary_translation_output,glossary_error_output + * `input_document` is one file we matched using gcs_source.input_uri. + * `target_language_code` is provided in the request. + * `translation_output` contains the translations. (details provided below) + * `error_output` contains the error message during processing of the file. + * Both translations_file and errors_file could be empty strings if we have + * no content to output. + * `glossary_translation_output` and `glossary_error_output` are the + * translated output/error when we apply glossaries. They could also be + * empty if we have no content to output. + * Once a row is present in index.csv, the input/output matching never + * changes. Callers should also expect all the content in input_file are + * processed and ready to be consumed (that is, no partial output file is + * written). + * Since index.csv will be keeping updated during the process, please make + * sure there is no custom retention policy applied on the output bucket + * that may avoid file updating. + * (https://cloud.google.com/storage/docs/bucket-lock#retention-policy) + * The naming format of translation output files follows (for target + * language code [trg]): `translation_output`: + * gs://translation_output/a_b_c_[trg]_translation.[extension] + * `glossary_translation_output`: + * gs://translation_test/a_b_c_[trg]_glossary_translation.[extension] The + * output document will maintain the same file format as the input document. + * The naming format of error output files follows (for target language code + * [trg]): `error_output`: gs://translation_test/a_b_c_[trg]_errors.txt + * `glossary_error_output`: + * gs://translation_test/a_b_c_[trg]_glossary_translation.txt The error + * output is a txt file containing error details. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Translate\V3\TranslationService::initOnce(); + parent::__construct($data); + } + + /** + * Google Cloud Storage destination for output content. + * For every single input document (for example, gs://a/b/c.[extension]), we + * generate at most 2 * n output files. (n is the # of target_language_codes + * in the BatchTranslateDocumentRequest). + * While the input documents are being processed, we write/update an index + * file `index.csv` under `gcs_destination.output_uri_prefix` (for example, + * gs://translation_output/index.csv) The index file is generated/updated as + * new files are being translated. The format is: + * input_document,target_language_code,translation_output,error_output, + * glossary_translation_output,glossary_error_output + * `input_document` is one file we matched using gcs_source.input_uri. + * `target_language_code` is provided in the request. + * `translation_output` contains the translations. (details provided below) + * `error_output` contains the error message during processing of the file. + * Both translations_file and errors_file could be empty strings if we have + * no content to output. + * `glossary_translation_output` and `glossary_error_output` are the + * translated output/error when we apply glossaries. They could also be + * empty if we have no content to output. + * Once a row is present in index.csv, the input/output matching never + * changes. Callers should also expect all the content in input_file are + * processed and ready to be consumed (that is, no partial output file is + * written). + * Since index.csv will be keeping updated during the process, please make + * sure there is no custom retention policy applied on the output bucket + * that may avoid file updating. + * (https://cloud.google.com/storage/docs/bucket-lock#retention-policy) + * The naming format of translation output files follows (for target + * language code [trg]): `translation_output`: + * gs://translation_output/a_b_c_[trg]_translation.[extension] + * `glossary_translation_output`: + * gs://translation_test/a_b_c_[trg]_glossary_translation.[extension] The + * output document will maintain the same file format as the input document. + * The naming format of error output files follows (for target language code + * [trg]): `error_output`: gs://translation_test/a_b_c_[trg]_errors.txt + * `glossary_error_output`: + * gs://translation_test/a_b_c_[trg]_glossary_translation.txt The error + * output is a txt file containing error details. + * + * Generated from protobuf field .google.cloud.translation.v3.GcsDestination gcs_destination = 1; + * @return \Google\Cloud\Translate\V3\GcsDestination|null + */ + public function getGcsDestination() + { + return $this->readOneof(1); + } + + public function hasGcsDestination() + { + return $this->hasOneof(1); + } + + /** + * Google Cloud Storage destination for output content. + * For every single input document (for example, gs://a/b/c.[extension]), we + * generate at most 2 * n output files. (n is the # of target_language_codes + * in the BatchTranslateDocumentRequest). + * While the input documents are being processed, we write/update an index + * file `index.csv` under `gcs_destination.output_uri_prefix` (for example, + * gs://translation_output/index.csv) The index file is generated/updated as + * new files are being translated. The format is: + * input_document,target_language_code,translation_output,error_output, + * glossary_translation_output,glossary_error_output + * `input_document` is one file we matched using gcs_source.input_uri. + * `target_language_code` is provided in the request. + * `translation_output` contains the translations. (details provided below) + * `error_output` contains the error message during processing of the file. + * Both translations_file and errors_file could be empty strings if we have + * no content to output. + * `glossary_translation_output` and `glossary_error_output` are the + * translated output/error when we apply glossaries. They could also be + * empty if we have no content to output. + * Once a row is present in index.csv, the input/output matching never + * changes. Callers should also expect all the content in input_file are + * processed and ready to be consumed (that is, no partial output file is + * written). + * Since index.csv will be keeping updated during the process, please make + * sure there is no custom retention policy applied on the output bucket + * that may avoid file updating. + * (https://cloud.google.com/storage/docs/bucket-lock#retention-policy) + * The naming format of translation output files follows (for target + * language code [trg]): `translation_output`: + * gs://translation_output/a_b_c_[trg]_translation.[extension] + * `glossary_translation_output`: + * gs://translation_test/a_b_c_[trg]_glossary_translation.[extension] The + * output document will maintain the same file format as the input document. + * The naming format of error output files follows (for target language code + * [trg]): `error_output`: gs://translation_test/a_b_c_[trg]_errors.txt + * `glossary_error_output`: + * gs://translation_test/a_b_c_[trg]_glossary_translation.txt The error + * output is a txt file containing error details. + * + * Generated from protobuf field .google.cloud.translation.v3.GcsDestination gcs_destination = 1; + * @param \Google\Cloud\Translate\V3\GcsDestination $var + * @return $this + */ + public function setGcsDestination($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Translate\V3\GcsDestination::class); + $this->writeOneof(1, $var); + + return $this; + } + + /** + * @return string + */ + public function getDestination() + { + return $this->whichOneof("destination"); + } + +} + diff --git a/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/BatchTranslateDocumentMetadata.php b/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/BatchTranslateDocumentMetadata.php new file mode 100644 index 00000000000..578301767c6 --- /dev/null +++ b/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/BatchTranslateDocumentMetadata.php @@ -0,0 +1,411 @@ +google.cloud.translation.v3.BatchTranslateDocumentMetadata + */ +class BatchTranslateDocumentMetadata extends \Google\Protobuf\Internal\Message +{ + /** + * The state of the operation. + * + * Generated from protobuf field .google.cloud.translation.v3.BatchTranslateDocumentMetadata.State state = 1; + */ + protected $state = 0; + /** + * Total number of pages to translate in all documents so far. Documents + * without clear page definition (such as XLSX) are not counted. + * + * Generated from protobuf field int64 total_pages = 2; + */ + protected $total_pages = 0; + /** + * Number of successfully translated pages in all documents so far. Documents + * without clear page definition (such as XLSX) are not counted. + * + * Generated from protobuf field int64 translated_pages = 3; + */ + protected $translated_pages = 0; + /** + * Number of pages that failed to process in all documents so far. Documents + * without clear page definition (such as XLSX) are not counted. + * + * Generated from protobuf field int64 failed_pages = 4; + */ + protected $failed_pages = 0; + /** + * Number of billable pages in documents with clear page definition (such as + * PDF, DOCX, PPTX) so far. + * + * Generated from protobuf field int64 total_billable_pages = 5; + */ + protected $total_billable_pages = 0; + /** + * Total number of characters (Unicode codepoints) in all documents so far. + * + * Generated from protobuf field int64 total_characters = 6; + */ + protected $total_characters = 0; + /** + * Number of successfully translated characters (Unicode codepoints) in all + * documents so far. + * + * Generated from protobuf field int64 translated_characters = 7; + */ + protected $translated_characters = 0; + /** + * Number of characters that have failed to process (Unicode codepoints) in + * all documents so far. + * + * Generated from protobuf field int64 failed_characters = 8; + */ + protected $failed_characters = 0; + /** + * Number of billable characters (Unicode codepoints) in documents without + * clear page definition (such as XLSX) so far. + * + * Generated from protobuf field int64 total_billable_characters = 9; + */ + protected $total_billable_characters = 0; + /** + * Time when the operation was submitted. + * + * Generated from protobuf field .google.protobuf.Timestamp submit_time = 10; + */ + protected $submit_time = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type int $state + * The state of the operation. + * @type int|string $total_pages + * Total number of pages to translate in all documents so far. Documents + * without clear page definition (such as XLSX) are not counted. + * @type int|string $translated_pages + * Number of successfully translated pages in all documents so far. Documents + * without clear page definition (such as XLSX) are not counted. + * @type int|string $failed_pages + * Number of pages that failed to process in all documents so far. Documents + * without clear page definition (such as XLSX) are not counted. + * @type int|string $total_billable_pages + * Number of billable pages in documents with clear page definition (such as + * PDF, DOCX, PPTX) so far. + * @type int|string $total_characters + * Total number of characters (Unicode codepoints) in all documents so far. + * @type int|string $translated_characters + * Number of successfully translated characters (Unicode codepoints) in all + * documents so far. + * @type int|string $failed_characters + * Number of characters that have failed to process (Unicode codepoints) in + * all documents so far. + * @type int|string $total_billable_characters + * Number of billable characters (Unicode codepoints) in documents without + * clear page definition (such as XLSX) so far. + * @type \Google\Protobuf\Timestamp $submit_time + * Time when the operation was submitted. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Translate\V3\TranslationService::initOnce(); + parent::__construct($data); + } + + /** + * The state of the operation. + * + * Generated from protobuf field .google.cloud.translation.v3.BatchTranslateDocumentMetadata.State state = 1; + * @return int + */ + public function getState() + { + return $this->state; + } + + /** + * The state of the operation. + * + * Generated from protobuf field .google.cloud.translation.v3.BatchTranslateDocumentMetadata.State state = 1; + * @param int $var + * @return $this + */ + public function setState($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\Translate\V3\BatchTranslateDocumentMetadata\State::class); + $this->state = $var; + + return $this; + } + + /** + * Total number of pages to translate in all documents so far. Documents + * without clear page definition (such as XLSX) are not counted. + * + * Generated from protobuf field int64 total_pages = 2; + * @return int|string + */ + public function getTotalPages() + { + return $this->total_pages; + } + + /** + * Total number of pages to translate in all documents so far. Documents + * without clear page definition (such as XLSX) are not counted. + * + * Generated from protobuf field int64 total_pages = 2; + * @param int|string $var + * @return $this + */ + public function setTotalPages($var) + { + GPBUtil::checkInt64($var); + $this->total_pages = $var; + + return $this; + } + + /** + * Number of successfully translated pages in all documents so far. Documents + * without clear page definition (such as XLSX) are not counted. + * + * Generated from protobuf field int64 translated_pages = 3; + * @return int|string + */ + public function getTranslatedPages() + { + return $this->translated_pages; + } + + /** + * Number of successfully translated pages in all documents so far. Documents + * without clear page definition (such as XLSX) are not counted. + * + * Generated from protobuf field int64 translated_pages = 3; + * @param int|string $var + * @return $this + */ + public function setTranslatedPages($var) + { + GPBUtil::checkInt64($var); + $this->translated_pages = $var; + + return $this; + } + + /** + * Number of pages that failed to process in all documents so far. Documents + * without clear page definition (such as XLSX) are not counted. + * + * Generated from protobuf field int64 failed_pages = 4; + * @return int|string + */ + public function getFailedPages() + { + return $this->failed_pages; + } + + /** + * Number of pages that failed to process in all documents so far. Documents + * without clear page definition (such as XLSX) are not counted. + * + * Generated from protobuf field int64 failed_pages = 4; + * @param int|string $var + * @return $this + */ + public function setFailedPages($var) + { + GPBUtil::checkInt64($var); + $this->failed_pages = $var; + + return $this; + } + + /** + * Number of billable pages in documents with clear page definition (such as + * PDF, DOCX, PPTX) so far. + * + * Generated from protobuf field int64 total_billable_pages = 5; + * @return int|string + */ + public function getTotalBillablePages() + { + return $this->total_billable_pages; + } + + /** + * Number of billable pages in documents with clear page definition (such as + * PDF, DOCX, PPTX) so far. + * + * Generated from protobuf field int64 total_billable_pages = 5; + * @param int|string $var + * @return $this + */ + public function setTotalBillablePages($var) + { + GPBUtil::checkInt64($var); + $this->total_billable_pages = $var; + + return $this; + } + + /** + * Total number of characters (Unicode codepoints) in all documents so far. + * + * Generated from protobuf field int64 total_characters = 6; + * @return int|string + */ + public function getTotalCharacters() + { + return $this->total_characters; + } + + /** + * Total number of characters (Unicode codepoints) in all documents so far. + * + * Generated from protobuf field int64 total_characters = 6; + * @param int|string $var + * @return $this + */ + public function setTotalCharacters($var) + { + GPBUtil::checkInt64($var); + $this->total_characters = $var; + + return $this; + } + + /** + * Number of successfully translated characters (Unicode codepoints) in all + * documents so far. + * + * Generated from protobuf field int64 translated_characters = 7; + * @return int|string + */ + public function getTranslatedCharacters() + { + return $this->translated_characters; + } + + /** + * Number of successfully translated characters (Unicode codepoints) in all + * documents so far. + * + * Generated from protobuf field int64 translated_characters = 7; + * @param int|string $var + * @return $this + */ + public function setTranslatedCharacters($var) + { + GPBUtil::checkInt64($var); + $this->translated_characters = $var; + + return $this; + } + + /** + * Number of characters that have failed to process (Unicode codepoints) in + * all documents so far. + * + * Generated from protobuf field int64 failed_characters = 8; + * @return int|string + */ + public function getFailedCharacters() + { + return $this->failed_characters; + } + + /** + * Number of characters that have failed to process (Unicode codepoints) in + * all documents so far. + * + * Generated from protobuf field int64 failed_characters = 8; + * @param int|string $var + * @return $this + */ + public function setFailedCharacters($var) + { + GPBUtil::checkInt64($var); + $this->failed_characters = $var; + + return $this; + } + + /** + * Number of billable characters (Unicode codepoints) in documents without + * clear page definition (such as XLSX) so far. + * + * Generated from protobuf field int64 total_billable_characters = 9; + * @return int|string + */ + public function getTotalBillableCharacters() + { + return $this->total_billable_characters; + } + + /** + * Number of billable characters (Unicode codepoints) in documents without + * clear page definition (such as XLSX) so far. + * + * Generated from protobuf field int64 total_billable_characters = 9; + * @param int|string $var + * @return $this + */ + public function setTotalBillableCharacters($var) + { + GPBUtil::checkInt64($var); + $this->total_billable_characters = $var; + + return $this; + } + + /** + * Time when the operation was submitted. + * + * Generated from protobuf field .google.protobuf.Timestamp submit_time = 10; + * @return \Google\Protobuf\Timestamp|null + */ + public function getSubmitTime() + { + return $this->submit_time; + } + + public function hasSubmitTime() + { + return isset($this->submit_time); + } + + public function clearSubmitTime() + { + unset($this->submit_time); + } + + /** + * Time when the operation was submitted. + * + * Generated from protobuf field .google.protobuf.Timestamp submit_time = 10; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setSubmitTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->submit_time = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/BatchTranslateDocumentMetadata/State.php b/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/BatchTranslateDocumentMetadata/State.php new file mode 100644 index 00000000000..6631a48171f --- /dev/null +++ b/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/BatchTranslateDocumentMetadata/State.php @@ -0,0 +1,88 @@ +google.cloud.translation.v3.BatchTranslateDocumentMetadata.State + */ +class State +{ + /** + * Invalid. + * + * Generated from protobuf enum STATE_UNSPECIFIED = 0; + */ + const STATE_UNSPECIFIED = 0; + /** + * Request is being processed. + * + * Generated from protobuf enum RUNNING = 1; + */ + const RUNNING = 1; + /** + * The batch is processed, and at least one item was successfully processed. + * + * Generated from protobuf enum SUCCEEDED = 2; + */ + const SUCCEEDED = 2; + /** + * The batch is done and no item was successfully processed. + * + * Generated from protobuf enum FAILED = 3; + */ + const FAILED = 3; + /** + * Request is in the process of being canceled after caller invoked + * longrunning.Operations.CancelOperation on the request id. + * + * Generated from protobuf enum CANCELLING = 4; + */ + const CANCELLING = 4; + /** + * The batch is done after the user has called the + * longrunning.Operations.CancelOperation. Any records processed before the + * cancel command are output as specified in the request. + * + * Generated from protobuf enum CANCELLED = 5; + */ + const CANCELLED = 5; + + private static $valueToName = [ + self::STATE_UNSPECIFIED => 'STATE_UNSPECIFIED', + self::RUNNING => 'RUNNING', + self::SUCCEEDED => 'SUCCEEDED', + self::FAILED => 'FAILED', + self::CANCELLING => 'CANCELLING', + self::CANCELLED => 'CANCELLED', + ]; + + 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(State::class, \Google\Cloud\Translate\V3\BatchTranslateDocumentMetadata_State::class); + diff --git a/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/BatchTranslateDocumentMetadata_State.php b/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/BatchTranslateDocumentMetadata_State.php new file mode 100644 index 00000000000..78a6194c53e --- /dev/null +++ b/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/BatchTranslateDocumentMetadata_State.php @@ -0,0 +1,16 @@ +google.cloud.translation.v3.BatchTranslateDocumentRequest + */ +class BatchTranslateDocumentRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. Location to make a regional call. + * Format: `projects/{project-number-or-id}/locations/{location-id}`. + * The `global` location is not supported for batch translation. + * Only AutoML Translation models or glossaries within the same region (have + * the same location-id) can be used, otherwise an INVALID_ARGUMENT (400) + * error is returned. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $parent = ''; + /** + * Required. The ISO-639 language code of the input document if known, for + * example, "en-US" or "sr-Latn". Supported language codes are listed in + * [Language Support](https://cloud.google.com/translate/docs/languages). + * + * Generated from protobuf field string source_language_code = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $source_language_code = ''; + /** + * Required. The ISO-639 language code to use for translation of the input + * document. Specify up to 10 language codes here. + * + * Generated from protobuf field repeated string target_language_codes = 3 [(.google.api.field_behavior) = REQUIRED]; + */ + private $target_language_codes; + /** + * Required. Input configurations. + * The total number of files matched should be <= 100. + * The total content size to translate should be <= 100M Unicode codepoints. + * The files must use UTF-8 encoding. + * + * Generated from protobuf field repeated .google.cloud.translation.v3.BatchDocumentInputConfig input_configs = 4 [(.google.api.field_behavior) = REQUIRED]; + */ + private $input_configs; + /** + * Required. Output configuration. + * If 2 input configs match to the same file (that is, same input path), + * we don't generate output for duplicate inputs. + * + * Generated from protobuf field .google.cloud.translation.v3.BatchDocumentOutputConfig output_config = 5 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $output_config = null; + /** + * Optional. The models to use for translation. Map's key is target language + * code. Map's value is the model name. Value can be a built-in general model, + * or an AutoML Translation model. + * The value format depends on model type: + * - AutoML Translation models: + * `projects/{project-number-or-id}/locations/{location-id}/models/{model-id}` + * - General (built-in) models: + * `projects/{project-number-or-id}/locations/{location-id}/models/general/nmt`, + * If the map is empty or a specific model is + * not requested for a language pair, then default google model (nmt) is used. + * + * Generated from protobuf field map models = 6 [(.google.api.field_behavior) = OPTIONAL]; + */ + private $models; + /** + * Optional. Glossaries to be applied. It's keyed by target language code. + * + * Generated from protobuf field map glossaries = 7 [(.google.api.field_behavior) = OPTIONAL]; + */ + private $glossaries; + /** + * Optional. File format conversion map to be applied to all input files. + * Map's key is the original mime_type. Map's value is the target mime_type of + * translated documents. + * Supported file format conversion includes: + * - `application/pdf` to + * `application/vnd.openxmlformats-officedocument.wordprocessingml.document` + * If nothing specified, output files will be in the same format as the + * original file. + * + * Generated from protobuf field map format_conversions = 8 [(.google.api.field_behavior) = OPTIONAL]; + */ + private $format_conversions; + /** + * Optional. This flag is to support user customized attribution. + * If not provided, the default is `Machine Translated by Google`. + * Customized attribution should follow rules in + * https://cloud.google.com/translate/attribution#attribution_and_logos + * + * Generated from protobuf field string customized_attribution = 10 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $customized_attribution = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $parent + * Required. Location to make a regional call. + * Format: `projects/{project-number-or-id}/locations/{location-id}`. + * The `global` location is not supported for batch translation. + * Only AutoML Translation models or glossaries within the same region (have + * the same location-id) can be used, otherwise an INVALID_ARGUMENT (400) + * error is returned. + * @type string $source_language_code + * Required. The ISO-639 language code of the input document if known, for + * example, "en-US" or "sr-Latn". Supported language codes are listed in + * [Language Support](https://cloud.google.com/translate/docs/languages). + * @type array|\Google\Protobuf\Internal\RepeatedField $target_language_codes + * Required. The ISO-639 language code to use for translation of the input + * document. Specify up to 10 language codes here. + * @type array<\Google\Cloud\Translate\V3\BatchDocumentInputConfig>|\Google\Protobuf\Internal\RepeatedField $input_configs + * Required. Input configurations. + * The total number of files matched should be <= 100. + * The total content size to translate should be <= 100M Unicode codepoints. + * The files must use UTF-8 encoding. + * @type \Google\Cloud\Translate\V3\BatchDocumentOutputConfig $output_config + * Required. Output configuration. + * If 2 input configs match to the same file (that is, same input path), + * we don't generate output for duplicate inputs. + * @type array|\Google\Protobuf\Internal\MapField $models + * Optional. The models to use for translation. Map's key is target language + * code. Map's value is the model name. Value can be a built-in general model, + * or an AutoML Translation model. + * The value format depends on model type: + * - AutoML Translation models: + * `projects/{project-number-or-id}/locations/{location-id}/models/{model-id}` + * - General (built-in) models: + * `projects/{project-number-or-id}/locations/{location-id}/models/general/nmt`, + * If the map is empty or a specific model is + * not requested for a language pair, then default google model (nmt) is used. + * @type array|\Google\Protobuf\Internal\MapField $glossaries + * Optional. Glossaries to be applied. It's keyed by target language code. + * @type array|\Google\Protobuf\Internal\MapField $format_conversions + * Optional. File format conversion map to be applied to all input files. + * Map's key is the original mime_type. Map's value is the target mime_type of + * translated documents. + * Supported file format conversion includes: + * - `application/pdf` to + * `application/vnd.openxmlformats-officedocument.wordprocessingml.document` + * If nothing specified, output files will be in the same format as the + * original file. + * @type string $customized_attribution + * Optional. This flag is to support user customized attribution. + * If not provided, the default is `Machine Translated by Google`. + * Customized attribution should follow rules in + * https://cloud.google.com/translate/attribution#attribution_and_logos + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Translate\V3\TranslationService::initOnce(); + parent::__construct($data); + } + + /** + * Required. Location to make a regional call. + * Format: `projects/{project-number-or-id}/locations/{location-id}`. + * The `global` location is not supported for batch translation. + * Only AutoML Translation models or glossaries within the same region (have + * the same location-id) can be used, otherwise an INVALID_ARGUMENT (400) + * error is returned. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getParent() + { + return $this->parent; + } + + /** + * Required. Location to make a regional call. + * Format: `projects/{project-number-or-id}/locations/{location-id}`. + * The `global` location is not supported for batch translation. + * Only AutoML Translation models or glossaries within the same region (have + * the same location-id) can be used, otherwise an INVALID_ARGUMENT (400) + * error is returned. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setParent($var) + { + GPBUtil::checkString($var, True); + $this->parent = $var; + + return $this; + } + + /** + * Required. The ISO-639 language code of the input document if known, for + * example, "en-US" or "sr-Latn". Supported language codes are listed in + * [Language Support](https://cloud.google.com/translate/docs/languages). + * + * Generated from protobuf field string source_language_code = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getSourceLanguageCode() + { + return $this->source_language_code; + } + + /** + * Required. The ISO-639 language code of the input document if known, for + * example, "en-US" or "sr-Latn". Supported language codes are listed in + * [Language Support](https://cloud.google.com/translate/docs/languages). + * + * Generated from protobuf field string source_language_code = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setSourceLanguageCode($var) + { + GPBUtil::checkString($var, True); + $this->source_language_code = $var; + + return $this; + } + + /** + * Required. The ISO-639 language code to use for translation of the input + * document. Specify up to 10 language codes here. + * + * Generated from protobuf field repeated string target_language_codes = 3 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getTargetLanguageCodes() + { + return $this->target_language_codes; + } + + /** + * Required. The ISO-639 language code to use for translation of the input + * document. Specify up to 10 language codes here. + * + * Generated from protobuf field repeated string target_language_codes = 3 [(.google.api.field_behavior) = REQUIRED]; + * @param array|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setTargetLanguageCodes($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); + $this->target_language_codes = $arr; + + return $this; + } + + /** + * Required. Input configurations. + * The total number of files matched should be <= 100. + * The total content size to translate should be <= 100M Unicode codepoints. + * The files must use UTF-8 encoding. + * + * Generated from protobuf field repeated .google.cloud.translation.v3.BatchDocumentInputConfig input_configs = 4 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getInputConfigs() + { + return $this->input_configs; + } + + /** + * Required. Input configurations. + * The total number of files matched should be <= 100. + * The total content size to translate should be <= 100M Unicode codepoints. + * The files must use UTF-8 encoding. + * + * Generated from protobuf field repeated .google.cloud.translation.v3.BatchDocumentInputConfig input_configs = 4 [(.google.api.field_behavior) = REQUIRED]; + * @param array<\Google\Cloud\Translate\V3\BatchDocumentInputConfig>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setInputConfigs($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Translate\V3\BatchDocumentInputConfig::class); + $this->input_configs = $arr; + + return $this; + } + + /** + * Required. Output configuration. + * If 2 input configs match to the same file (that is, same input path), + * we don't generate output for duplicate inputs. + * + * Generated from protobuf field .google.cloud.translation.v3.BatchDocumentOutputConfig output_config = 5 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Cloud\Translate\V3\BatchDocumentOutputConfig|null + */ + public function getOutputConfig() + { + return $this->output_config; + } + + public function hasOutputConfig() + { + return isset($this->output_config); + } + + public function clearOutputConfig() + { + unset($this->output_config); + } + + /** + * Required. Output configuration. + * If 2 input configs match to the same file (that is, same input path), + * we don't generate output for duplicate inputs. + * + * Generated from protobuf field .google.cloud.translation.v3.BatchDocumentOutputConfig output_config = 5 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Cloud\Translate\V3\BatchDocumentOutputConfig $var + * @return $this + */ + public function setOutputConfig($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Translate\V3\BatchDocumentOutputConfig::class); + $this->output_config = $var; + + return $this; + } + + /** + * Optional. The models to use for translation. Map's key is target language + * code. Map's value is the model name. Value can be a built-in general model, + * or an AutoML Translation model. + * The value format depends on model type: + * - AutoML Translation models: + * `projects/{project-number-or-id}/locations/{location-id}/models/{model-id}` + * - General (built-in) models: + * `projects/{project-number-or-id}/locations/{location-id}/models/general/nmt`, + * If the map is empty or a specific model is + * not requested for a language pair, then default google model (nmt) is used. + * + * Generated from protobuf field map models = 6 [(.google.api.field_behavior) = OPTIONAL]; + * @return \Google\Protobuf\Internal\MapField + */ + public function getModels() + { + return $this->models; + } + + /** + * Optional. The models to use for translation. Map's key is target language + * code. Map's value is the model name. Value can be a built-in general model, + * or an AutoML Translation model. + * The value format depends on model type: + * - AutoML Translation models: + * `projects/{project-number-or-id}/locations/{location-id}/models/{model-id}` + * - General (built-in) models: + * `projects/{project-number-or-id}/locations/{location-id}/models/general/nmt`, + * If the map is empty or a specific model is + * not requested for a language pair, then default google model (nmt) is used. + * + * Generated from protobuf field map models = 6 [(.google.api.field_behavior) = OPTIONAL]; + * @param array|\Google\Protobuf\Internal\MapField $var + * @return $this + */ + public function setModels($var) + { + $arr = GPBUtil::checkMapField($var, \Google\Protobuf\Internal\GPBType::STRING, \Google\Protobuf\Internal\GPBType::STRING); + $this->models = $arr; + + return $this; + } + + /** + * Optional. Glossaries to be applied. It's keyed by target language code. + * + * Generated from protobuf field map glossaries = 7 [(.google.api.field_behavior) = OPTIONAL]; + * @return \Google\Protobuf\Internal\MapField + */ + public function getGlossaries() + { + return $this->glossaries; + } + + /** + * Optional. Glossaries to be applied. It's keyed by target language code. + * + * Generated from protobuf field map glossaries = 7 [(.google.api.field_behavior) = OPTIONAL]; + * @param array|\Google\Protobuf\Internal\MapField $var + * @return $this + */ + public function setGlossaries($var) + { + $arr = GPBUtil::checkMapField($var, \Google\Protobuf\Internal\GPBType::STRING, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Translate\V3\TranslateTextGlossaryConfig::class); + $this->glossaries = $arr; + + return $this; + } + + /** + * Optional. File format conversion map to be applied to all input files. + * Map's key is the original mime_type. Map's value is the target mime_type of + * translated documents. + * Supported file format conversion includes: + * - `application/pdf` to + * `application/vnd.openxmlformats-officedocument.wordprocessingml.document` + * If nothing specified, output files will be in the same format as the + * original file. + * + * Generated from protobuf field map format_conversions = 8 [(.google.api.field_behavior) = OPTIONAL]; + * @return \Google\Protobuf\Internal\MapField + */ + public function getFormatConversions() + { + return $this->format_conversions; + } + + /** + * Optional. File format conversion map to be applied to all input files. + * Map's key is the original mime_type. Map's value is the target mime_type of + * translated documents. + * Supported file format conversion includes: + * - `application/pdf` to + * `application/vnd.openxmlformats-officedocument.wordprocessingml.document` + * If nothing specified, output files will be in the same format as the + * original file. + * + * Generated from protobuf field map format_conversions = 8 [(.google.api.field_behavior) = OPTIONAL]; + * @param array|\Google\Protobuf\Internal\MapField $var + * @return $this + */ + public function setFormatConversions($var) + { + $arr = GPBUtil::checkMapField($var, \Google\Protobuf\Internal\GPBType::STRING, \Google\Protobuf\Internal\GPBType::STRING); + $this->format_conversions = $arr; + + return $this; + } + + /** + * Optional. This flag is to support user customized attribution. + * If not provided, the default is `Machine Translated by Google`. + * Customized attribution should follow rules in + * https://cloud.google.com/translate/attribution#attribution_and_logos + * + * Generated from protobuf field string customized_attribution = 10 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getCustomizedAttribution() + { + return $this->customized_attribution; + } + + /** + * Optional. This flag is to support user customized attribution. + * If not provided, the default is `Machine Translated by Google`. + * Customized attribution should follow rules in + * https://cloud.google.com/translate/attribution#attribution_and_logos + * + * Generated from protobuf field string customized_attribution = 10 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setCustomizedAttribution($var) + { + GPBUtil::checkString($var, True); + $this->customized_attribution = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/BatchTranslateDocumentResponse.php b/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/BatchTranslateDocumentResponse.php new file mode 100644 index 00000000000..ac0c68355f7 --- /dev/null +++ b/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/BatchTranslateDocumentResponse.php @@ -0,0 +1,432 @@ +google.cloud.translation.v3.BatchTranslateDocumentResponse + */ +class BatchTranslateDocumentResponse extends \Google\Protobuf\Internal\Message +{ + /** + * Total number of pages to translate in all documents. Documents without + * clear page definition (such as XLSX) are not counted. + * + * Generated from protobuf field int64 total_pages = 1; + */ + protected $total_pages = 0; + /** + * Number of successfully translated pages in all documents. Documents without + * clear page definition (such as XLSX) are not counted. + * + * Generated from protobuf field int64 translated_pages = 2; + */ + protected $translated_pages = 0; + /** + * Number of pages that failed to process in all documents. Documents without + * clear page definition (such as XLSX) are not counted. + * + * Generated from protobuf field int64 failed_pages = 3; + */ + protected $failed_pages = 0; + /** + * Number of billable pages in documents with clear page definition (such as + * PDF, DOCX, PPTX) + * + * Generated from protobuf field int64 total_billable_pages = 4; + */ + protected $total_billable_pages = 0; + /** + * Total number of characters (Unicode codepoints) in all documents. + * + * Generated from protobuf field int64 total_characters = 5; + */ + protected $total_characters = 0; + /** + * Number of successfully translated characters (Unicode codepoints) in all + * documents. + * + * Generated from protobuf field int64 translated_characters = 6; + */ + protected $translated_characters = 0; + /** + * Number of characters that have failed to process (Unicode codepoints) in + * all documents. + * + * Generated from protobuf field int64 failed_characters = 7; + */ + protected $failed_characters = 0; + /** + * Number of billable characters (Unicode codepoints) in documents without + * clear page definition, such as XLSX. + * + * Generated from protobuf field int64 total_billable_characters = 8; + */ + protected $total_billable_characters = 0; + /** + * Time when the operation was submitted. + * + * Generated from protobuf field .google.protobuf.Timestamp submit_time = 9; + */ + protected $submit_time = null; + /** + * The time when the operation is finished and + * [google.longrunning.Operation.done][google.longrunning.Operation.done] is + * set to true. + * + * Generated from protobuf field .google.protobuf.Timestamp end_time = 10; + */ + protected $end_time = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type int|string $total_pages + * Total number of pages to translate in all documents. Documents without + * clear page definition (such as XLSX) are not counted. + * @type int|string $translated_pages + * Number of successfully translated pages in all documents. Documents without + * clear page definition (such as XLSX) are not counted. + * @type int|string $failed_pages + * Number of pages that failed to process in all documents. Documents without + * clear page definition (such as XLSX) are not counted. + * @type int|string $total_billable_pages + * Number of billable pages in documents with clear page definition (such as + * PDF, DOCX, PPTX) + * @type int|string $total_characters + * Total number of characters (Unicode codepoints) in all documents. + * @type int|string $translated_characters + * Number of successfully translated characters (Unicode codepoints) in all + * documents. + * @type int|string $failed_characters + * Number of characters that have failed to process (Unicode codepoints) in + * all documents. + * @type int|string $total_billable_characters + * Number of billable characters (Unicode codepoints) in documents without + * clear page definition, such as XLSX. + * @type \Google\Protobuf\Timestamp $submit_time + * Time when the operation was submitted. + * @type \Google\Protobuf\Timestamp $end_time + * The time when the operation is finished and + * [google.longrunning.Operation.done][google.longrunning.Operation.done] is + * set to true. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Translate\V3\TranslationService::initOnce(); + parent::__construct($data); + } + + /** + * Total number of pages to translate in all documents. Documents without + * clear page definition (such as XLSX) are not counted. + * + * Generated from protobuf field int64 total_pages = 1; + * @return int|string + */ + public function getTotalPages() + { + return $this->total_pages; + } + + /** + * Total number of pages to translate in all documents. Documents without + * clear page definition (such as XLSX) are not counted. + * + * Generated from protobuf field int64 total_pages = 1; + * @param int|string $var + * @return $this + */ + public function setTotalPages($var) + { + GPBUtil::checkInt64($var); + $this->total_pages = $var; + + return $this; + } + + /** + * Number of successfully translated pages in all documents. Documents without + * clear page definition (such as XLSX) are not counted. + * + * Generated from protobuf field int64 translated_pages = 2; + * @return int|string + */ + public function getTranslatedPages() + { + return $this->translated_pages; + } + + /** + * Number of successfully translated pages in all documents. Documents without + * clear page definition (such as XLSX) are not counted. + * + * Generated from protobuf field int64 translated_pages = 2; + * @param int|string $var + * @return $this + */ + public function setTranslatedPages($var) + { + GPBUtil::checkInt64($var); + $this->translated_pages = $var; + + return $this; + } + + /** + * Number of pages that failed to process in all documents. Documents without + * clear page definition (such as XLSX) are not counted. + * + * Generated from protobuf field int64 failed_pages = 3; + * @return int|string + */ + public function getFailedPages() + { + return $this->failed_pages; + } + + /** + * Number of pages that failed to process in all documents. Documents without + * clear page definition (such as XLSX) are not counted. + * + * Generated from protobuf field int64 failed_pages = 3; + * @param int|string $var + * @return $this + */ + public function setFailedPages($var) + { + GPBUtil::checkInt64($var); + $this->failed_pages = $var; + + return $this; + } + + /** + * Number of billable pages in documents with clear page definition (such as + * PDF, DOCX, PPTX) + * + * Generated from protobuf field int64 total_billable_pages = 4; + * @return int|string + */ + public function getTotalBillablePages() + { + return $this->total_billable_pages; + } + + /** + * Number of billable pages in documents with clear page definition (such as + * PDF, DOCX, PPTX) + * + * Generated from protobuf field int64 total_billable_pages = 4; + * @param int|string $var + * @return $this + */ + public function setTotalBillablePages($var) + { + GPBUtil::checkInt64($var); + $this->total_billable_pages = $var; + + return $this; + } + + /** + * Total number of characters (Unicode codepoints) in all documents. + * + * Generated from protobuf field int64 total_characters = 5; + * @return int|string + */ + public function getTotalCharacters() + { + return $this->total_characters; + } + + /** + * Total number of characters (Unicode codepoints) in all documents. + * + * Generated from protobuf field int64 total_characters = 5; + * @param int|string $var + * @return $this + */ + public function setTotalCharacters($var) + { + GPBUtil::checkInt64($var); + $this->total_characters = $var; + + return $this; + } + + /** + * Number of successfully translated characters (Unicode codepoints) in all + * documents. + * + * Generated from protobuf field int64 translated_characters = 6; + * @return int|string + */ + public function getTranslatedCharacters() + { + return $this->translated_characters; + } + + /** + * Number of successfully translated characters (Unicode codepoints) in all + * documents. + * + * Generated from protobuf field int64 translated_characters = 6; + * @param int|string $var + * @return $this + */ + public function setTranslatedCharacters($var) + { + GPBUtil::checkInt64($var); + $this->translated_characters = $var; + + return $this; + } + + /** + * Number of characters that have failed to process (Unicode codepoints) in + * all documents. + * + * Generated from protobuf field int64 failed_characters = 7; + * @return int|string + */ + public function getFailedCharacters() + { + return $this->failed_characters; + } + + /** + * Number of characters that have failed to process (Unicode codepoints) in + * all documents. + * + * Generated from protobuf field int64 failed_characters = 7; + * @param int|string $var + * @return $this + */ + public function setFailedCharacters($var) + { + GPBUtil::checkInt64($var); + $this->failed_characters = $var; + + return $this; + } + + /** + * Number of billable characters (Unicode codepoints) in documents without + * clear page definition, such as XLSX. + * + * Generated from protobuf field int64 total_billable_characters = 8; + * @return int|string + */ + public function getTotalBillableCharacters() + { + return $this->total_billable_characters; + } + + /** + * Number of billable characters (Unicode codepoints) in documents without + * clear page definition, such as XLSX. + * + * Generated from protobuf field int64 total_billable_characters = 8; + * @param int|string $var + * @return $this + */ + public function setTotalBillableCharacters($var) + { + GPBUtil::checkInt64($var); + $this->total_billable_characters = $var; + + return $this; + } + + /** + * Time when the operation was submitted. + * + * Generated from protobuf field .google.protobuf.Timestamp submit_time = 9; + * @return \Google\Protobuf\Timestamp|null + */ + public function getSubmitTime() + { + return $this->submit_time; + } + + public function hasSubmitTime() + { + return isset($this->submit_time); + } + + public function clearSubmitTime() + { + unset($this->submit_time); + } + + /** + * Time when the operation was submitted. + * + * Generated from protobuf field .google.protobuf.Timestamp submit_time = 9; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setSubmitTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->submit_time = $var; + + return $this; + } + + /** + * The time when the operation is finished and + * [google.longrunning.Operation.done][google.longrunning.Operation.done] is + * set to true. + * + * Generated from protobuf field .google.protobuf.Timestamp end_time = 10; + * @return \Google\Protobuf\Timestamp|null + */ + public function getEndTime() + { + return $this->end_time; + } + + public function hasEndTime() + { + return isset($this->end_time); + } + + public function clearEndTime() + { + unset($this->end_time); + } + + /** + * The time when the operation is finished and + * [google.longrunning.Operation.done][google.longrunning.Operation.done] is + * set to true. + * + * Generated from protobuf field .google.protobuf.Timestamp end_time = 10; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setEndTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->end_time = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/BatchTranslateMetadata.php b/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/BatchTranslateMetadata.php new file mode 100644 index 00000000000..088d15ac8a9 --- /dev/null +++ b/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/BatchTranslateMetadata.php @@ -0,0 +1,225 @@ +google.cloud.translation.v3.BatchTranslateMetadata + */ +class BatchTranslateMetadata extends \Google\Protobuf\Internal\Message +{ + /** + * The state of the operation. + * + * Generated from protobuf field .google.cloud.translation.v3.BatchTranslateMetadata.State state = 1; + */ + protected $state = 0; + /** + * Number of successfully translated characters so far (Unicode codepoints). + * + * Generated from protobuf field int64 translated_characters = 2; + */ + protected $translated_characters = 0; + /** + * Number of characters that have failed to process so far (Unicode + * codepoints). + * + * Generated from protobuf field int64 failed_characters = 3; + */ + protected $failed_characters = 0; + /** + * Total number of characters (Unicode codepoints). + * This is the total number of codepoints from input files times the number of + * target languages and appears here shortly after the call is submitted. + * + * Generated from protobuf field int64 total_characters = 4; + */ + protected $total_characters = 0; + /** + * Time when the operation was submitted. + * + * Generated from protobuf field .google.protobuf.Timestamp submit_time = 5; + */ + protected $submit_time = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type int $state + * The state of the operation. + * @type int|string $translated_characters + * Number of successfully translated characters so far (Unicode codepoints). + * @type int|string $failed_characters + * Number of characters that have failed to process so far (Unicode + * codepoints). + * @type int|string $total_characters + * Total number of characters (Unicode codepoints). + * This is the total number of codepoints from input files times the number of + * target languages and appears here shortly after the call is submitted. + * @type \Google\Protobuf\Timestamp $submit_time + * Time when the operation was submitted. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Translate\V3\TranslationService::initOnce(); + parent::__construct($data); + } + + /** + * The state of the operation. + * + * Generated from protobuf field .google.cloud.translation.v3.BatchTranslateMetadata.State state = 1; + * @return int + */ + public function getState() + { + return $this->state; + } + + /** + * The state of the operation. + * + * Generated from protobuf field .google.cloud.translation.v3.BatchTranslateMetadata.State state = 1; + * @param int $var + * @return $this + */ + public function setState($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\Translate\V3\BatchTranslateMetadata\State::class); + $this->state = $var; + + return $this; + } + + /** + * Number of successfully translated characters so far (Unicode codepoints). + * + * Generated from protobuf field int64 translated_characters = 2; + * @return int|string + */ + public function getTranslatedCharacters() + { + return $this->translated_characters; + } + + /** + * Number of successfully translated characters so far (Unicode codepoints). + * + * Generated from protobuf field int64 translated_characters = 2; + * @param int|string $var + * @return $this + */ + public function setTranslatedCharacters($var) + { + GPBUtil::checkInt64($var); + $this->translated_characters = $var; + + return $this; + } + + /** + * Number of characters that have failed to process so far (Unicode + * codepoints). + * + * Generated from protobuf field int64 failed_characters = 3; + * @return int|string + */ + public function getFailedCharacters() + { + return $this->failed_characters; + } + + /** + * Number of characters that have failed to process so far (Unicode + * codepoints). + * + * Generated from protobuf field int64 failed_characters = 3; + * @param int|string $var + * @return $this + */ + public function setFailedCharacters($var) + { + GPBUtil::checkInt64($var); + $this->failed_characters = $var; + + return $this; + } + + /** + * Total number of characters (Unicode codepoints). + * This is the total number of codepoints from input files times the number of + * target languages and appears here shortly after the call is submitted. + * + * Generated from protobuf field int64 total_characters = 4; + * @return int|string + */ + public function getTotalCharacters() + { + return $this->total_characters; + } + + /** + * Total number of characters (Unicode codepoints). + * This is the total number of codepoints from input files times the number of + * target languages and appears here shortly after the call is submitted. + * + * Generated from protobuf field int64 total_characters = 4; + * @param int|string $var + * @return $this + */ + public function setTotalCharacters($var) + { + GPBUtil::checkInt64($var); + $this->total_characters = $var; + + return $this; + } + + /** + * Time when the operation was submitted. + * + * Generated from protobuf field .google.protobuf.Timestamp submit_time = 5; + * @return \Google\Protobuf\Timestamp|null + */ + public function getSubmitTime() + { + return $this->submit_time; + } + + public function hasSubmitTime() + { + return isset($this->submit_time); + } + + public function clearSubmitTime() + { + unset($this->submit_time); + } + + /** + * Time when the operation was submitted. + * + * Generated from protobuf field .google.protobuf.Timestamp submit_time = 5; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setSubmitTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->submit_time = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/BatchTranslateMetadata/State.php b/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/BatchTranslateMetadata/State.php new file mode 100644 index 00000000000..287dfff0389 --- /dev/null +++ b/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/BatchTranslateMetadata/State.php @@ -0,0 +1,89 @@ +google.cloud.translation.v3.BatchTranslateMetadata.State + */ +class State +{ + /** + * Invalid. + * + * Generated from protobuf enum STATE_UNSPECIFIED = 0; + */ + const STATE_UNSPECIFIED = 0; + /** + * Request is being processed. + * + * Generated from protobuf enum RUNNING = 1; + */ + const RUNNING = 1; + /** + * The batch is processed, and at least one item was successfully + * processed. + * + * Generated from protobuf enum SUCCEEDED = 2; + */ + const SUCCEEDED = 2; + /** + * The batch is done and no item was successfully processed. + * + * Generated from protobuf enum FAILED = 3; + */ + const FAILED = 3; + /** + * Request is in the process of being canceled after caller invoked + * longrunning.Operations.CancelOperation on the request id. + * + * Generated from protobuf enum CANCELLING = 4; + */ + const CANCELLING = 4; + /** + * The batch is done after the user has called the + * longrunning.Operations.CancelOperation. Any records processed before the + * cancel command are output as specified in the request. + * + * Generated from protobuf enum CANCELLED = 5; + */ + const CANCELLED = 5; + + private static $valueToName = [ + self::STATE_UNSPECIFIED => 'STATE_UNSPECIFIED', + self::RUNNING => 'RUNNING', + self::SUCCEEDED => 'SUCCEEDED', + self::FAILED => 'FAILED', + self::CANCELLING => 'CANCELLING', + self::CANCELLED => 'CANCELLED', + ]; + + 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(State::class, \Google\Cloud\Translate\V3\BatchTranslateMetadata_State::class); + diff --git a/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/BatchTranslateMetadata_State.php b/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/BatchTranslateMetadata_State.php new file mode 100644 index 00000000000..289662c9e38 --- /dev/null +++ b/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/BatchTranslateMetadata_State.php @@ -0,0 +1,16 @@ +google.cloud.translation.v3.BatchTranslateResponse + */ +class BatchTranslateResponse extends \Google\Protobuf\Internal\Message +{ + /** + * Total number of characters (Unicode codepoints). + * + * Generated from protobuf field int64 total_characters = 1; + */ + protected $total_characters = 0; + /** + * Number of successfully translated characters (Unicode codepoints). + * + * Generated from protobuf field int64 translated_characters = 2; + */ + protected $translated_characters = 0; + /** + * Number of characters that have failed to process (Unicode codepoints). + * + * Generated from protobuf field int64 failed_characters = 3; + */ + protected $failed_characters = 0; + /** + * Time when the operation was submitted. + * + * Generated from protobuf field .google.protobuf.Timestamp submit_time = 4; + */ + protected $submit_time = null; + /** + * The time when the operation is finished and + * [google.longrunning.Operation.done][google.longrunning.Operation.done] is + * set to true. + * + * Generated from protobuf field .google.protobuf.Timestamp end_time = 5; + */ + protected $end_time = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type int|string $total_characters + * Total number of characters (Unicode codepoints). + * @type int|string $translated_characters + * Number of successfully translated characters (Unicode codepoints). + * @type int|string $failed_characters + * Number of characters that have failed to process (Unicode codepoints). + * @type \Google\Protobuf\Timestamp $submit_time + * Time when the operation was submitted. + * @type \Google\Protobuf\Timestamp $end_time + * The time when the operation is finished and + * [google.longrunning.Operation.done][google.longrunning.Operation.done] is + * set to true. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Translate\V3\TranslationService::initOnce(); + parent::__construct($data); + } + + /** + * Total number of characters (Unicode codepoints). + * + * Generated from protobuf field int64 total_characters = 1; + * @return int|string + */ + public function getTotalCharacters() + { + return $this->total_characters; + } + + /** + * Total number of characters (Unicode codepoints). + * + * Generated from protobuf field int64 total_characters = 1; + * @param int|string $var + * @return $this + */ + public function setTotalCharacters($var) + { + GPBUtil::checkInt64($var); + $this->total_characters = $var; + + return $this; + } + + /** + * Number of successfully translated characters (Unicode codepoints). + * + * Generated from protobuf field int64 translated_characters = 2; + * @return int|string + */ + public function getTranslatedCharacters() + { + return $this->translated_characters; + } + + /** + * Number of successfully translated characters (Unicode codepoints). + * + * Generated from protobuf field int64 translated_characters = 2; + * @param int|string $var + * @return $this + */ + public function setTranslatedCharacters($var) + { + GPBUtil::checkInt64($var); + $this->translated_characters = $var; + + return $this; + } + + /** + * Number of characters that have failed to process (Unicode codepoints). + * + * Generated from protobuf field int64 failed_characters = 3; + * @return int|string + */ + public function getFailedCharacters() + { + return $this->failed_characters; + } + + /** + * Number of characters that have failed to process (Unicode codepoints). + * + * Generated from protobuf field int64 failed_characters = 3; + * @param int|string $var + * @return $this + */ + public function setFailedCharacters($var) + { + GPBUtil::checkInt64($var); + $this->failed_characters = $var; + + return $this; + } + + /** + * Time when the operation was submitted. + * + * Generated from protobuf field .google.protobuf.Timestamp submit_time = 4; + * @return \Google\Protobuf\Timestamp|null + */ + public function getSubmitTime() + { + return $this->submit_time; + } + + public function hasSubmitTime() + { + return isset($this->submit_time); + } + + public function clearSubmitTime() + { + unset($this->submit_time); + } + + /** + * Time when the operation was submitted. + * + * Generated from protobuf field .google.protobuf.Timestamp submit_time = 4; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setSubmitTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->submit_time = $var; + + return $this; + } + + /** + * The time when the operation is finished and + * [google.longrunning.Operation.done][google.longrunning.Operation.done] is + * set to true. + * + * Generated from protobuf field .google.protobuf.Timestamp end_time = 5; + * @return \Google\Protobuf\Timestamp|null + */ + public function getEndTime() + { + return $this->end_time; + } + + public function hasEndTime() + { + return isset($this->end_time); + } + + public function clearEndTime() + { + unset($this->end_time); + } + + /** + * The time when the operation is finished and + * [google.longrunning.Operation.done][google.longrunning.Operation.done] is + * set to true. + * + * Generated from protobuf field .google.protobuf.Timestamp end_time = 5; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setEndTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->end_time = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/BatchTranslateTextRequest.php b/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/BatchTranslateTextRequest.php new file mode 100644 index 00000000000..79d9d703113 --- /dev/null +++ b/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/BatchTranslateTextRequest.php @@ -0,0 +1,419 @@ +google.cloud.translation.v3.BatchTranslateTextRequest + */ +class BatchTranslateTextRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. Location to make a call. Must refer to a caller's project. + * Format: `projects/{project-number-or-id}/locations/{location-id}`. + * The `global` location is not supported for batch translation. + * Only AutoML Translation models or glossaries within the same region (have + * the same location-id) can be used, otherwise an INVALID_ARGUMENT (400) + * error is returned. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $parent = ''; + /** + * Required. Source language code. + * + * Generated from protobuf field string source_language_code = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $source_language_code = ''; + /** + * Required. Specify up to 10 language codes here. + * + * Generated from protobuf field repeated string target_language_codes = 3 [(.google.api.field_behavior) = REQUIRED]; + */ + private $target_language_codes; + /** + * Optional. The models to use for translation. Map's key is target language + * code. Map's value is model name. Value can be a built-in general model, + * or an AutoML Translation model. + * The value format depends on model type: + * - AutoML Translation models: + * `projects/{project-number-or-id}/locations/{location-id}/models/{model-id}` + * - General (built-in) models: + * `projects/{project-number-or-id}/locations/{location-id}/models/general/nmt`, + * If the map is empty or a specific model is + * not requested for a language pair, then default google model (nmt) is used. + * + * Generated from protobuf field map models = 4 [(.google.api.field_behavior) = OPTIONAL]; + */ + private $models; + /** + * Required. Input configurations. + * The total number of files matched should be <= 100. + * The total content size should be <= 100M Unicode codepoints. + * The files must use UTF-8 encoding. + * + * Generated from protobuf field repeated .google.cloud.translation.v3.InputConfig input_configs = 5 [(.google.api.field_behavior) = REQUIRED]; + */ + private $input_configs; + /** + * Required. Output configuration. + * If 2 input configs match to the same file (that is, same input path), + * we don't generate output for duplicate inputs. + * + * Generated from protobuf field .google.cloud.translation.v3.OutputConfig output_config = 6 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $output_config = null; + /** + * Optional. Glossaries to be applied for translation. + * It's keyed by target language code. + * + * Generated from protobuf field map glossaries = 7 [(.google.api.field_behavior) = OPTIONAL]; + */ + private $glossaries; + /** + * Optional. The labels with user-defined metadata for the request. + * Label keys and values can be no longer than 63 characters + * (Unicode codepoints), can only contain lowercase letters, numeric + * characters, underscores and dashes. International characters are allowed. + * Label values are optional. Label keys must start with a letter. + * See https://cloud.google.com/translate/docs/advanced/labels for more + * information. + * + * Generated from protobuf field map labels = 9 [(.google.api.field_behavior) = OPTIONAL]; + */ + private $labels; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $parent + * Required. Location to make a call. Must refer to a caller's project. + * Format: `projects/{project-number-or-id}/locations/{location-id}`. + * The `global` location is not supported for batch translation. + * Only AutoML Translation models or glossaries within the same region (have + * the same location-id) can be used, otherwise an INVALID_ARGUMENT (400) + * error is returned. + * @type string $source_language_code + * Required. Source language code. + * @type array|\Google\Protobuf\Internal\RepeatedField $target_language_codes + * Required. Specify up to 10 language codes here. + * @type array|\Google\Protobuf\Internal\MapField $models + * Optional. The models to use for translation. Map's key is target language + * code. Map's value is model name. Value can be a built-in general model, + * or an AutoML Translation model. + * The value format depends on model type: + * - AutoML Translation models: + * `projects/{project-number-or-id}/locations/{location-id}/models/{model-id}` + * - General (built-in) models: + * `projects/{project-number-or-id}/locations/{location-id}/models/general/nmt`, + * If the map is empty or a specific model is + * not requested for a language pair, then default google model (nmt) is used. + * @type array<\Google\Cloud\Translate\V3\InputConfig>|\Google\Protobuf\Internal\RepeatedField $input_configs + * Required. Input configurations. + * The total number of files matched should be <= 100. + * The total content size should be <= 100M Unicode codepoints. + * The files must use UTF-8 encoding. + * @type \Google\Cloud\Translate\V3\OutputConfig $output_config + * Required. Output configuration. + * If 2 input configs match to the same file (that is, same input path), + * we don't generate output for duplicate inputs. + * @type array|\Google\Protobuf\Internal\MapField $glossaries + * Optional. Glossaries to be applied for translation. + * It's keyed by target language code. + * @type array|\Google\Protobuf\Internal\MapField $labels + * Optional. The labels with user-defined metadata for the request. + * Label keys and values can be no longer than 63 characters + * (Unicode codepoints), can only contain lowercase letters, numeric + * characters, underscores and dashes. International characters are allowed. + * Label values are optional. Label keys must start with a letter. + * See https://cloud.google.com/translate/docs/advanced/labels for more + * information. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Translate\V3\TranslationService::initOnce(); + parent::__construct($data); + } + + /** + * Required. Location to make a call. Must refer to a caller's project. + * Format: `projects/{project-number-or-id}/locations/{location-id}`. + * The `global` location is not supported for batch translation. + * Only AutoML Translation models or glossaries within the same region (have + * the same location-id) can be used, otherwise an INVALID_ARGUMENT (400) + * error is returned. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getParent() + { + return $this->parent; + } + + /** + * Required. Location to make a call. Must refer to a caller's project. + * Format: `projects/{project-number-or-id}/locations/{location-id}`. + * The `global` location is not supported for batch translation. + * Only AutoML Translation models or glossaries within the same region (have + * the same location-id) can be used, otherwise an INVALID_ARGUMENT (400) + * error is returned. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setParent($var) + { + GPBUtil::checkString($var, True); + $this->parent = $var; + + return $this; + } + + /** + * Required. Source language code. + * + * Generated from protobuf field string source_language_code = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getSourceLanguageCode() + { + return $this->source_language_code; + } + + /** + * Required. Source language code. + * + * Generated from protobuf field string source_language_code = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setSourceLanguageCode($var) + { + GPBUtil::checkString($var, True); + $this->source_language_code = $var; + + return $this; + } + + /** + * Required. Specify up to 10 language codes here. + * + * Generated from protobuf field repeated string target_language_codes = 3 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getTargetLanguageCodes() + { + return $this->target_language_codes; + } + + /** + * Required. Specify up to 10 language codes here. + * + * Generated from protobuf field repeated string target_language_codes = 3 [(.google.api.field_behavior) = REQUIRED]; + * @param array|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setTargetLanguageCodes($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); + $this->target_language_codes = $arr; + + return $this; + } + + /** + * Optional. The models to use for translation. Map's key is target language + * code. Map's value is model name. Value can be a built-in general model, + * or an AutoML Translation model. + * The value format depends on model type: + * - AutoML Translation models: + * `projects/{project-number-or-id}/locations/{location-id}/models/{model-id}` + * - General (built-in) models: + * `projects/{project-number-or-id}/locations/{location-id}/models/general/nmt`, + * If the map is empty or a specific model is + * not requested for a language pair, then default google model (nmt) is used. + * + * Generated from protobuf field map models = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @return \Google\Protobuf\Internal\MapField + */ + public function getModels() + { + return $this->models; + } + + /** + * Optional. The models to use for translation. Map's key is target language + * code. Map's value is model name. Value can be a built-in general model, + * or an AutoML Translation model. + * The value format depends on model type: + * - AutoML Translation models: + * `projects/{project-number-or-id}/locations/{location-id}/models/{model-id}` + * - General (built-in) models: + * `projects/{project-number-or-id}/locations/{location-id}/models/general/nmt`, + * If the map is empty or a specific model is + * not requested for a language pair, then default google model (nmt) is used. + * + * Generated from protobuf field map models = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @param array|\Google\Protobuf\Internal\MapField $var + * @return $this + */ + public function setModels($var) + { + $arr = GPBUtil::checkMapField($var, \Google\Protobuf\Internal\GPBType::STRING, \Google\Protobuf\Internal\GPBType::STRING); + $this->models = $arr; + + return $this; + } + + /** + * Required. Input configurations. + * The total number of files matched should be <= 100. + * The total content size should be <= 100M Unicode codepoints. + * The files must use UTF-8 encoding. + * + * Generated from protobuf field repeated .google.cloud.translation.v3.InputConfig input_configs = 5 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getInputConfigs() + { + return $this->input_configs; + } + + /** + * Required. Input configurations. + * The total number of files matched should be <= 100. + * The total content size should be <= 100M Unicode codepoints. + * The files must use UTF-8 encoding. + * + * Generated from protobuf field repeated .google.cloud.translation.v3.InputConfig input_configs = 5 [(.google.api.field_behavior) = REQUIRED]; + * @param array<\Google\Cloud\Translate\V3\InputConfig>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setInputConfigs($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Translate\V3\InputConfig::class); + $this->input_configs = $arr; + + return $this; + } + + /** + * Required. Output configuration. + * If 2 input configs match to the same file (that is, same input path), + * we don't generate output for duplicate inputs. + * + * Generated from protobuf field .google.cloud.translation.v3.OutputConfig output_config = 6 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Cloud\Translate\V3\OutputConfig|null + */ + public function getOutputConfig() + { + return $this->output_config; + } + + public function hasOutputConfig() + { + return isset($this->output_config); + } + + public function clearOutputConfig() + { + unset($this->output_config); + } + + /** + * Required. Output configuration. + * If 2 input configs match to the same file (that is, same input path), + * we don't generate output for duplicate inputs. + * + * Generated from protobuf field .google.cloud.translation.v3.OutputConfig output_config = 6 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Cloud\Translate\V3\OutputConfig $var + * @return $this + */ + public function setOutputConfig($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Translate\V3\OutputConfig::class); + $this->output_config = $var; + + return $this; + } + + /** + * Optional. Glossaries to be applied for translation. + * It's keyed by target language code. + * + * Generated from protobuf field map glossaries = 7 [(.google.api.field_behavior) = OPTIONAL]; + * @return \Google\Protobuf\Internal\MapField + */ + public function getGlossaries() + { + return $this->glossaries; + } + + /** + * Optional. Glossaries to be applied for translation. + * It's keyed by target language code. + * + * Generated from protobuf field map glossaries = 7 [(.google.api.field_behavior) = OPTIONAL]; + * @param array|\Google\Protobuf\Internal\MapField $var + * @return $this + */ + public function setGlossaries($var) + { + $arr = GPBUtil::checkMapField($var, \Google\Protobuf\Internal\GPBType::STRING, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Translate\V3\TranslateTextGlossaryConfig::class); + $this->glossaries = $arr; + + return $this; + } + + /** + * Optional. The labels with user-defined metadata for the request. + * Label keys and values can be no longer than 63 characters + * (Unicode codepoints), can only contain lowercase letters, numeric + * characters, underscores and dashes. International characters are allowed. + * Label values are optional. Label keys must start with a letter. + * See https://cloud.google.com/translate/docs/advanced/labels for more + * information. + * + * Generated from protobuf field map labels = 9 [(.google.api.field_behavior) = OPTIONAL]; + * @return \Google\Protobuf\Internal\MapField + */ + public function getLabels() + { + return $this->labels; + } + + /** + * Optional. The labels with user-defined metadata for the request. + * Label keys and values can be no longer than 63 characters + * (Unicode codepoints), can only contain lowercase letters, numeric + * characters, underscores and dashes. International characters are allowed. + * Label values are optional. Label keys must start with a letter. + * See https://cloud.google.com/translate/docs/advanced/labels for more + * information. + * + * Generated from protobuf field map labels = 9 [(.google.api.field_behavior) = OPTIONAL]; + * @param array|\Google\Protobuf\Internal\MapField $var + * @return $this + */ + public function setLabels($var) + { + $arr = GPBUtil::checkMapField($var, \Google\Protobuf\Internal\GPBType::STRING, \Google\Protobuf\Internal\GPBType::STRING); + $this->labels = $arr; + + return $this; + } + +} + diff --git a/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/CreateGlossaryMetadata.php b/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/CreateGlossaryMetadata.php new file mode 100644 index 00000000000..cf902834a45 --- /dev/null +++ b/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/CreateGlossaryMetadata.php @@ -0,0 +1,147 @@ +google.cloud.translation.v3.CreateGlossaryMetadata + */ +class CreateGlossaryMetadata extends \Google\Protobuf\Internal\Message +{ + /** + * The name of the glossary that is being created. + * + * Generated from protobuf field string name = 1; + */ + protected $name = ''; + /** + * The current state of the glossary creation operation. + * + * Generated from protobuf field .google.cloud.translation.v3.CreateGlossaryMetadata.State state = 2; + */ + protected $state = 0; + /** + * The time when the operation was submitted to the server. + * + * Generated from protobuf field .google.protobuf.Timestamp submit_time = 3; + */ + protected $submit_time = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * The name of the glossary that is being created. + * @type int $state + * The current state of the glossary creation operation. + * @type \Google\Protobuf\Timestamp $submit_time + * The time when the operation was submitted to the server. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Translate\V3\TranslationService::initOnce(); + parent::__construct($data); + } + + /** + * The name of the glossary that is being created. + * + * Generated from protobuf field string name = 1; + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * The name of the glossary that is being created. + * + * Generated from protobuf field string name = 1; + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * The current state of the glossary creation operation. + * + * Generated from protobuf field .google.cloud.translation.v3.CreateGlossaryMetadata.State state = 2; + * @return int + */ + public function getState() + { + return $this->state; + } + + /** + * The current state of the glossary creation operation. + * + * Generated from protobuf field .google.cloud.translation.v3.CreateGlossaryMetadata.State state = 2; + * @param int $var + * @return $this + */ + public function setState($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\Translate\V3\CreateGlossaryMetadata\State::class); + $this->state = $var; + + return $this; + } + + /** + * The time when the operation was submitted to the server. + * + * Generated from protobuf field .google.protobuf.Timestamp submit_time = 3; + * @return \Google\Protobuf\Timestamp|null + */ + public function getSubmitTime() + { + return $this->submit_time; + } + + public function hasSubmitTime() + { + return isset($this->submit_time); + } + + public function clearSubmitTime() + { + unset($this->submit_time); + } + + /** + * The time when the operation was submitted to the server. + * + * Generated from protobuf field .google.protobuf.Timestamp submit_time = 3; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setSubmitTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->submit_time = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/CreateGlossaryMetadata/State.php b/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/CreateGlossaryMetadata/State.php new file mode 100644 index 00000000000..3aed3689d19 --- /dev/null +++ b/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/CreateGlossaryMetadata/State.php @@ -0,0 +1,86 @@ +google.cloud.translation.v3.CreateGlossaryMetadata.State + */ +class State +{ + /** + * Invalid. + * + * Generated from protobuf enum STATE_UNSPECIFIED = 0; + */ + const STATE_UNSPECIFIED = 0; + /** + * Request is being processed. + * + * Generated from protobuf enum RUNNING = 1; + */ + const RUNNING = 1; + /** + * The glossary was successfully created. + * + * Generated from protobuf enum SUCCEEDED = 2; + */ + const SUCCEEDED = 2; + /** + * Failed to create the glossary. + * + * Generated from protobuf enum FAILED = 3; + */ + const FAILED = 3; + /** + * Request is in the process of being canceled after caller invoked + * longrunning.Operations.CancelOperation on the request id. + * + * Generated from protobuf enum CANCELLING = 4; + */ + const CANCELLING = 4; + /** + * The glossary creation request was successfully canceled. + * + * Generated from protobuf enum CANCELLED = 5; + */ + const CANCELLED = 5; + + private static $valueToName = [ + self::STATE_UNSPECIFIED => 'STATE_UNSPECIFIED', + self::RUNNING => 'RUNNING', + self::SUCCEEDED => 'SUCCEEDED', + self::FAILED => 'FAILED', + self::CANCELLING => 'CANCELLING', + self::CANCELLED => 'CANCELLED', + ]; + + 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(State::class, \Google\Cloud\Translate\V3\CreateGlossaryMetadata_State::class); + diff --git a/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/CreateGlossaryMetadata_State.php b/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/CreateGlossaryMetadata_State.php new file mode 100644 index 00000000000..e5428647f5e --- /dev/null +++ b/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/CreateGlossaryMetadata_State.php @@ -0,0 +1,16 @@ +google.cloud.translation.v3.CreateGlossaryRequest + */ +class CreateGlossaryRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The project name. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $parent = ''; + /** + * Required. The glossary to create. + * + * Generated from protobuf field .google.cloud.translation.v3.Glossary glossary = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $glossary = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $parent + * Required. The project name. + * @type \Google\Cloud\Translate\V3\Glossary $glossary + * Required. The glossary to create. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Translate\V3\TranslationService::initOnce(); + parent::__construct($data); + } + + /** + * Required. The project name. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getParent() + { + return $this->parent; + } + + /** + * Required. The project name. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setParent($var) + { + GPBUtil::checkString($var, True); + $this->parent = $var; + + return $this; + } + + /** + * Required. The glossary to create. + * + * Generated from protobuf field .google.cloud.translation.v3.Glossary glossary = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Cloud\Translate\V3\Glossary|null + */ + public function getGlossary() + { + return $this->glossary; + } + + public function hasGlossary() + { + return isset($this->glossary); + } + + public function clearGlossary() + { + unset($this->glossary); + } + + /** + * Required. The glossary to create. + * + * Generated from protobuf field .google.cloud.translation.v3.Glossary glossary = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Cloud\Translate\V3\Glossary $var + * @return $this + */ + public function setGlossary($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Translate\V3\Glossary::class); + $this->glossary = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/DeleteGlossaryMetadata.php b/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/DeleteGlossaryMetadata.php new file mode 100644 index 00000000000..4c4c6c924c2 --- /dev/null +++ b/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/DeleteGlossaryMetadata.php @@ -0,0 +1,147 @@ +google.cloud.translation.v3.DeleteGlossaryMetadata + */ +class DeleteGlossaryMetadata extends \Google\Protobuf\Internal\Message +{ + /** + * The name of the glossary that is being deleted. + * + * Generated from protobuf field string name = 1; + */ + protected $name = ''; + /** + * The current state of the glossary deletion operation. + * + * Generated from protobuf field .google.cloud.translation.v3.DeleteGlossaryMetadata.State state = 2; + */ + protected $state = 0; + /** + * The time when the operation was submitted to the server. + * + * Generated from protobuf field .google.protobuf.Timestamp submit_time = 3; + */ + protected $submit_time = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * The name of the glossary that is being deleted. + * @type int $state + * The current state of the glossary deletion operation. + * @type \Google\Protobuf\Timestamp $submit_time + * The time when the operation was submitted to the server. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Translate\V3\TranslationService::initOnce(); + parent::__construct($data); + } + + /** + * The name of the glossary that is being deleted. + * + * Generated from protobuf field string name = 1; + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * The name of the glossary that is being deleted. + * + * Generated from protobuf field string name = 1; + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * The current state of the glossary deletion operation. + * + * Generated from protobuf field .google.cloud.translation.v3.DeleteGlossaryMetadata.State state = 2; + * @return int + */ + public function getState() + { + return $this->state; + } + + /** + * The current state of the glossary deletion operation. + * + * Generated from protobuf field .google.cloud.translation.v3.DeleteGlossaryMetadata.State state = 2; + * @param int $var + * @return $this + */ + public function setState($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\Translate\V3\DeleteGlossaryMetadata\State::class); + $this->state = $var; + + return $this; + } + + /** + * The time when the operation was submitted to the server. + * + * Generated from protobuf field .google.protobuf.Timestamp submit_time = 3; + * @return \Google\Protobuf\Timestamp|null + */ + public function getSubmitTime() + { + return $this->submit_time; + } + + public function hasSubmitTime() + { + return isset($this->submit_time); + } + + public function clearSubmitTime() + { + unset($this->submit_time); + } + + /** + * The time when the operation was submitted to the server. + * + * Generated from protobuf field .google.protobuf.Timestamp submit_time = 3; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setSubmitTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->submit_time = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/DeleteGlossaryMetadata/State.php b/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/DeleteGlossaryMetadata/State.php new file mode 100644 index 00000000000..65fe6b5df28 --- /dev/null +++ b/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/DeleteGlossaryMetadata/State.php @@ -0,0 +1,86 @@ +google.cloud.translation.v3.DeleteGlossaryMetadata.State + */ +class State +{ + /** + * Invalid. + * + * Generated from protobuf enum STATE_UNSPECIFIED = 0; + */ + const STATE_UNSPECIFIED = 0; + /** + * Request is being processed. + * + * Generated from protobuf enum RUNNING = 1; + */ + const RUNNING = 1; + /** + * The glossary was successfully deleted. + * + * Generated from protobuf enum SUCCEEDED = 2; + */ + const SUCCEEDED = 2; + /** + * Failed to delete the glossary. + * + * Generated from protobuf enum FAILED = 3; + */ + const FAILED = 3; + /** + * Request is in the process of being canceled after caller invoked + * longrunning.Operations.CancelOperation on the request id. + * + * Generated from protobuf enum CANCELLING = 4; + */ + const CANCELLING = 4; + /** + * The glossary deletion request was successfully canceled. + * + * Generated from protobuf enum CANCELLED = 5; + */ + const CANCELLED = 5; + + private static $valueToName = [ + self::STATE_UNSPECIFIED => 'STATE_UNSPECIFIED', + self::RUNNING => 'RUNNING', + self::SUCCEEDED => 'SUCCEEDED', + self::FAILED => 'FAILED', + self::CANCELLING => 'CANCELLING', + self::CANCELLED => 'CANCELLED', + ]; + + 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(State::class, \Google\Cloud\Translate\V3\DeleteGlossaryMetadata_State::class); + diff --git a/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/DeleteGlossaryMetadata_State.php b/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/DeleteGlossaryMetadata_State.php new file mode 100644 index 00000000000..910836761d4 --- /dev/null +++ b/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/DeleteGlossaryMetadata_State.php @@ -0,0 +1,16 @@ +google.cloud.translation.v3.DeleteGlossaryRequest + */ +class DeleteGlossaryRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The name of the glossary to delete. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. The name of the glossary to delete. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Translate\V3\TranslationService::initOnce(); + parent::__construct($data); + } + + /** + * Required. The name of the glossary to delete. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Required. The name of the glossary to delete. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/DeleteGlossaryResponse.php b/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/DeleteGlossaryResponse.php new file mode 100644 index 00000000000..d3bc457df68 --- /dev/null +++ b/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/DeleteGlossaryResponse.php @@ -0,0 +1,165 @@ +google.cloud.translation.v3.DeleteGlossaryResponse + */ +class DeleteGlossaryResponse extends \Google\Protobuf\Internal\Message +{ + /** + * The name of the deleted glossary. + * + * Generated from protobuf field string name = 1; + */ + protected $name = ''; + /** + * The time when the operation was submitted to the server. + * + * Generated from protobuf field .google.protobuf.Timestamp submit_time = 2; + */ + protected $submit_time = null; + /** + * The time when the glossary deletion is finished and + * [google.longrunning.Operation.done][google.longrunning.Operation.done] is + * set to true. + * + * Generated from protobuf field .google.protobuf.Timestamp end_time = 3; + */ + protected $end_time = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * The name of the deleted glossary. + * @type \Google\Protobuf\Timestamp $submit_time + * The time when the operation was submitted to the server. + * @type \Google\Protobuf\Timestamp $end_time + * The time when the glossary deletion is finished and + * [google.longrunning.Operation.done][google.longrunning.Operation.done] is + * set to true. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Translate\V3\TranslationService::initOnce(); + parent::__construct($data); + } + + /** + * The name of the deleted glossary. + * + * Generated from protobuf field string name = 1; + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * The name of the deleted glossary. + * + * Generated from protobuf field string name = 1; + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * The time when the operation was submitted to the server. + * + * Generated from protobuf field .google.protobuf.Timestamp submit_time = 2; + * @return \Google\Protobuf\Timestamp|null + */ + public function getSubmitTime() + { + return $this->submit_time; + } + + public function hasSubmitTime() + { + return isset($this->submit_time); + } + + public function clearSubmitTime() + { + unset($this->submit_time); + } + + /** + * The time when the operation was submitted to the server. + * + * Generated from protobuf field .google.protobuf.Timestamp submit_time = 2; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setSubmitTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->submit_time = $var; + + return $this; + } + + /** + * The time when the glossary deletion is finished and + * [google.longrunning.Operation.done][google.longrunning.Operation.done] is + * set to true. + * + * Generated from protobuf field .google.protobuf.Timestamp end_time = 3; + * @return \Google\Protobuf\Timestamp|null + */ + public function getEndTime() + { + return $this->end_time; + } + + public function hasEndTime() + { + return isset($this->end_time); + } + + public function clearEndTime() + { + unset($this->end_time); + } + + /** + * The time when the glossary deletion is finished and + * [google.longrunning.Operation.done][google.longrunning.Operation.done] is + * set to true. + * + * Generated from protobuf field .google.protobuf.Timestamp end_time = 3; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setEndTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->end_time = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/DetectLanguageRequest.php b/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/DetectLanguageRequest.php new file mode 100644 index 00000000000..ae97c57669c --- /dev/null +++ b/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/DetectLanguageRequest.php @@ -0,0 +1,287 @@ +google.cloud.translation.v3.DetectLanguageRequest + */ +class DetectLanguageRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. Project or location to make a call. Must refer to a caller's + * project. + * Format: `projects/{project-number-or-id}/locations/{location-id}` or + * `projects/{project-number-or-id}`. + * For global calls, use `projects/{project-number-or-id}/locations/global` or + * `projects/{project-number-or-id}`. + * Only models within the same region (has same location-id) can be used. + * Otherwise an INVALID_ARGUMENT (400) error is returned. + * + * Generated from protobuf field string parent = 5 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $parent = ''; + /** + * Optional. The language detection model to be used. + * Format: + * `projects/{project-number-or-id}/locations/{location-id}/models/language-detection/{model-id}` + * Only one language detection model is currently supported: + * `projects/{project-number-or-id}/locations/{location-id}/models/language-detection/default`. + * If not specified, the default model is used. + * + * Generated from protobuf field string model = 4 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $model = ''; + /** + * Optional. The format of the source text, for example, "text/html", + * "text/plain". If left blank, the MIME type defaults to "text/html". + * + * Generated from protobuf field string mime_type = 3 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $mime_type = ''; + /** + * Optional. The labels with user-defined metadata for the request. + * Label keys and values can be no longer than 63 characters + * (Unicode codepoints), can only contain lowercase letters, numeric + * characters, underscores and dashes. International characters are allowed. + * Label values are optional. Label keys must start with a letter. + * See https://cloud.google.com/translate/docs/advanced/labels for more + * information. + * + * Generated from protobuf field map labels = 6 [(.google.api.field_behavior) = OPTIONAL]; + */ + private $labels; + protected $source; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $parent + * Required. Project or location to make a call. Must refer to a caller's + * project. + * Format: `projects/{project-number-or-id}/locations/{location-id}` or + * `projects/{project-number-or-id}`. + * For global calls, use `projects/{project-number-or-id}/locations/global` or + * `projects/{project-number-or-id}`. + * Only models within the same region (has same location-id) can be used. + * Otherwise an INVALID_ARGUMENT (400) error is returned. + * @type string $model + * Optional. The language detection model to be used. + * Format: + * `projects/{project-number-or-id}/locations/{location-id}/models/language-detection/{model-id}` + * Only one language detection model is currently supported: + * `projects/{project-number-or-id}/locations/{location-id}/models/language-detection/default`. + * If not specified, the default model is used. + * @type string $content + * The content of the input stored as a string. + * @type string $mime_type + * Optional. The format of the source text, for example, "text/html", + * "text/plain". If left blank, the MIME type defaults to "text/html". + * @type array|\Google\Protobuf\Internal\MapField $labels + * Optional. The labels with user-defined metadata for the request. + * Label keys and values can be no longer than 63 characters + * (Unicode codepoints), can only contain lowercase letters, numeric + * characters, underscores and dashes. International characters are allowed. + * Label values are optional. Label keys must start with a letter. + * See https://cloud.google.com/translate/docs/advanced/labels for more + * information. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Translate\V3\TranslationService::initOnce(); + parent::__construct($data); + } + + /** + * Required. Project or location to make a call. Must refer to a caller's + * project. + * Format: `projects/{project-number-or-id}/locations/{location-id}` or + * `projects/{project-number-or-id}`. + * For global calls, use `projects/{project-number-or-id}/locations/global` or + * `projects/{project-number-or-id}`. + * Only models within the same region (has same location-id) can be used. + * Otherwise an INVALID_ARGUMENT (400) error is returned. + * + * Generated from protobuf field string parent = 5 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getParent() + { + return $this->parent; + } + + /** + * Required. Project or location to make a call. Must refer to a caller's + * project. + * Format: `projects/{project-number-or-id}/locations/{location-id}` or + * `projects/{project-number-or-id}`. + * For global calls, use `projects/{project-number-or-id}/locations/global` or + * `projects/{project-number-or-id}`. + * Only models within the same region (has same location-id) can be used. + * Otherwise an INVALID_ARGUMENT (400) error is returned. + * + * Generated from protobuf field string parent = 5 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setParent($var) + { + GPBUtil::checkString($var, True); + $this->parent = $var; + + return $this; + } + + /** + * Optional. The language detection model to be used. + * Format: + * `projects/{project-number-or-id}/locations/{location-id}/models/language-detection/{model-id}` + * Only one language detection model is currently supported: + * `projects/{project-number-or-id}/locations/{location-id}/models/language-detection/default`. + * If not specified, the default model is used. + * + * Generated from protobuf field string model = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getModel() + { + return $this->model; + } + + /** + * Optional. The language detection model to be used. + * Format: + * `projects/{project-number-or-id}/locations/{location-id}/models/language-detection/{model-id}` + * Only one language detection model is currently supported: + * `projects/{project-number-or-id}/locations/{location-id}/models/language-detection/default`. + * If not specified, the default model is used. + * + * Generated from protobuf field string model = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setModel($var) + { + GPBUtil::checkString($var, True); + $this->model = $var; + + return $this; + } + + /** + * The content of the input stored as a string. + * + * Generated from protobuf field string content = 1; + * @return string + */ + public function getContent() + { + return $this->readOneof(1); + } + + public function hasContent() + { + return $this->hasOneof(1); + } + + /** + * The content of the input stored as a string. + * + * Generated from protobuf field string content = 1; + * @param string $var + * @return $this + */ + public function setContent($var) + { + GPBUtil::checkString($var, True); + $this->writeOneof(1, $var); + + return $this; + } + + /** + * Optional. The format of the source text, for example, "text/html", + * "text/plain". If left blank, the MIME type defaults to "text/html". + * + * Generated from protobuf field string mime_type = 3 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getMimeType() + { + return $this->mime_type; + } + + /** + * Optional. The format of the source text, for example, "text/html", + * "text/plain". If left blank, the MIME type defaults to "text/html". + * + * Generated from protobuf field string mime_type = 3 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setMimeType($var) + { + GPBUtil::checkString($var, True); + $this->mime_type = $var; + + return $this; + } + + /** + * Optional. The labels with user-defined metadata for the request. + * Label keys and values can be no longer than 63 characters + * (Unicode codepoints), can only contain lowercase letters, numeric + * characters, underscores and dashes. International characters are allowed. + * Label values are optional. Label keys must start with a letter. + * See https://cloud.google.com/translate/docs/advanced/labels for more + * information. + * + * Generated from protobuf field map labels = 6 [(.google.api.field_behavior) = OPTIONAL]; + * @return \Google\Protobuf\Internal\MapField + */ + public function getLabels() + { + return $this->labels; + } + + /** + * Optional. The labels with user-defined metadata for the request. + * Label keys and values can be no longer than 63 characters + * (Unicode codepoints), can only contain lowercase letters, numeric + * characters, underscores and dashes. International characters are allowed. + * Label values are optional. Label keys must start with a letter. + * See https://cloud.google.com/translate/docs/advanced/labels for more + * information. + * + * Generated from protobuf field map labels = 6 [(.google.api.field_behavior) = OPTIONAL]; + * @param array|\Google\Protobuf\Internal\MapField $var + * @return $this + */ + public function setLabels($var) + { + $arr = GPBUtil::checkMapField($var, \Google\Protobuf\Internal\GPBType::STRING, \Google\Protobuf\Internal\GPBType::STRING); + $this->labels = $arr; + + return $this; + } + + /** + * @return string + */ + public function getSource() + { + return $this->whichOneof("source"); + } + +} + diff --git a/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/DetectLanguageResponse.php b/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/DetectLanguageResponse.php new file mode 100644 index 00000000000..7bcf6ef7f39 --- /dev/null +++ b/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/DetectLanguageResponse.php @@ -0,0 +1,71 @@ +google.cloud.translation.v3.DetectLanguageResponse + */ +class DetectLanguageResponse extends \Google\Protobuf\Internal\Message +{ + /** + * The most probable language detected by the Translation API. For each + * request, the Translation API will always return only one result. + * + * Generated from protobuf field repeated .google.cloud.translation.v3.DetectedLanguage languages = 1; + */ + private $languages; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array<\Google\Cloud\Translate\V3\DetectedLanguage>|\Google\Protobuf\Internal\RepeatedField $languages + * The most probable language detected by the Translation API. For each + * request, the Translation API will always return only one result. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Translate\V3\TranslationService::initOnce(); + parent::__construct($data); + } + + /** + * The most probable language detected by the Translation API. For each + * request, the Translation API will always return only one result. + * + * Generated from protobuf field repeated .google.cloud.translation.v3.DetectedLanguage languages = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getLanguages() + { + return $this->languages; + } + + /** + * The most probable language detected by the Translation API. For each + * request, the Translation API will always return only one result. + * + * Generated from protobuf field repeated .google.cloud.translation.v3.DetectedLanguage languages = 1; + * @param array<\Google\Cloud\Translate\V3\DetectedLanguage>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setLanguages($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Translate\V3\DetectedLanguage::class); + $this->languages = $arr; + + return $this; + } + +} + diff --git a/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/DetectedLanguage.php b/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/DetectedLanguage.php new file mode 100644 index 00000000000..b0e30fd6ed8 --- /dev/null +++ b/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/DetectedLanguage.php @@ -0,0 +1,105 @@ +google.cloud.translation.v3.DetectedLanguage + */ +class DetectedLanguage extends \Google\Protobuf\Internal\Message +{ + /** + * The ISO-639 language code of the source content in the request, detected + * automatically. + * + * Generated from protobuf field string language_code = 1; + */ + protected $language_code = ''; + /** + * The confidence of the detection result for this language. + * + * Generated from protobuf field float confidence = 2; + */ + protected $confidence = 0.0; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $language_code + * The ISO-639 language code of the source content in the request, detected + * automatically. + * @type float $confidence + * The confidence of the detection result for this language. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Translate\V3\TranslationService::initOnce(); + parent::__construct($data); + } + + /** + * The ISO-639 language code of the source content in the request, detected + * automatically. + * + * Generated from protobuf field string language_code = 1; + * @return string + */ + public function getLanguageCode() + { + return $this->language_code; + } + + /** + * The ISO-639 language code of the source content in the request, detected + * automatically. + * + * Generated from protobuf field string language_code = 1; + * @param string $var + * @return $this + */ + public function setLanguageCode($var) + { + GPBUtil::checkString($var, True); + $this->language_code = $var; + + return $this; + } + + /** + * The confidence of the detection result for this language. + * + * Generated from protobuf field float confidence = 2; + * @return float + */ + public function getConfidence() + { + return $this->confidence; + } + + /** + * The confidence of the detection result for this language. + * + * Generated from protobuf field float confidence = 2; + * @param float $var + * @return $this + */ + public function setConfidence($var) + { + GPBUtil::checkFloat($var); + $this->confidence = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/DocumentInputConfig.php b/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/DocumentInputConfig.php new file mode 100644 index 00000000000..2285639ebfc --- /dev/null +++ b/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/DocumentInputConfig.php @@ -0,0 +1,177 @@ +google.cloud.translation.v3.DocumentInputConfig + */ +class DocumentInputConfig extends \Google\Protobuf\Internal\Message +{ + /** + * Specifies the input document's mime_type. + * If not specified it will be determined using the file extension for + * gcs_source provided files. For a file provided through bytes content the + * mime_type must be provided. + * Currently supported mime types are: + * - application/pdf + * - application/vnd.openxmlformats-officedocument.wordprocessingml.document + * - application/vnd.openxmlformats-officedocument.presentationml.presentation + * - application/vnd.openxmlformats-officedocument.spreadsheetml.sheet + * + * Generated from protobuf field string mime_type = 4; + */ + protected $mime_type = ''; + protected $source; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $content + * Document's content represented as a stream of bytes. + * @type \Google\Cloud\Translate\V3\GcsSource $gcs_source + * Google Cloud Storage location. This must be a single file. + * For example: gs://example_bucket/example_file.pdf + * @type string $mime_type + * Specifies the input document's mime_type. + * If not specified it will be determined using the file extension for + * gcs_source provided files. For a file provided through bytes content the + * mime_type must be provided. + * Currently supported mime types are: + * - application/pdf + * - application/vnd.openxmlformats-officedocument.wordprocessingml.document + * - application/vnd.openxmlformats-officedocument.presentationml.presentation + * - application/vnd.openxmlformats-officedocument.spreadsheetml.sheet + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Translate\V3\TranslationService::initOnce(); + parent::__construct($data); + } + + /** + * Document's content represented as a stream of bytes. + * + * Generated from protobuf field bytes content = 1; + * @return string + */ + public function getContent() + { + return $this->readOneof(1); + } + + public function hasContent() + { + return $this->hasOneof(1); + } + + /** + * Document's content represented as a stream of bytes. + * + * Generated from protobuf field bytes content = 1; + * @param string $var + * @return $this + */ + public function setContent($var) + { + GPBUtil::checkString($var, False); + $this->writeOneof(1, $var); + + return $this; + } + + /** + * Google Cloud Storage location. This must be a single file. + * For example: gs://example_bucket/example_file.pdf + * + * Generated from protobuf field .google.cloud.translation.v3.GcsSource gcs_source = 2; + * @return \Google\Cloud\Translate\V3\GcsSource|null + */ + public function getGcsSource() + { + return $this->readOneof(2); + } + + public function hasGcsSource() + { + return $this->hasOneof(2); + } + + /** + * Google Cloud Storage location. This must be a single file. + * For example: gs://example_bucket/example_file.pdf + * + * Generated from protobuf field .google.cloud.translation.v3.GcsSource gcs_source = 2; + * @param \Google\Cloud\Translate\V3\GcsSource $var + * @return $this + */ + public function setGcsSource($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Translate\V3\GcsSource::class); + $this->writeOneof(2, $var); + + return $this; + } + + /** + * Specifies the input document's mime_type. + * If not specified it will be determined using the file extension for + * gcs_source provided files. For a file provided through bytes content the + * mime_type must be provided. + * Currently supported mime types are: + * - application/pdf + * - application/vnd.openxmlformats-officedocument.wordprocessingml.document + * - application/vnd.openxmlformats-officedocument.presentationml.presentation + * - application/vnd.openxmlformats-officedocument.spreadsheetml.sheet + * + * Generated from protobuf field string mime_type = 4; + * @return string + */ + public function getMimeType() + { + return $this->mime_type; + } + + /** + * Specifies the input document's mime_type. + * If not specified it will be determined using the file extension for + * gcs_source provided files. For a file provided through bytes content the + * mime_type must be provided. + * Currently supported mime types are: + * - application/pdf + * - application/vnd.openxmlformats-officedocument.wordprocessingml.document + * - application/vnd.openxmlformats-officedocument.presentationml.presentation + * - application/vnd.openxmlformats-officedocument.spreadsheetml.sheet + * + * Generated from protobuf field string mime_type = 4; + * @param string $var + * @return $this + */ + public function setMimeType($var) + { + GPBUtil::checkString($var, True); + $this->mime_type = $var; + + return $this; + } + + /** + * @return string + */ + public function getSource() + { + return $this->whichOneof("source"); + } + +} + diff --git a/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/DocumentOutputConfig.php b/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/DocumentOutputConfig.php new file mode 100644 index 00000000000..a5327ff872a --- /dev/null +++ b/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/DocumentOutputConfig.php @@ -0,0 +1,240 @@ +google.cloud.translation.v3.DocumentOutputConfig + */ +class DocumentOutputConfig extends \Google\Protobuf\Internal\Message +{ + /** + * Optional. Specifies the translated document's mime_type. + * If not specified, the translated file's mime type will be the same as the + * input file's mime type. + * Currently only support the output mime type to be the same as input mime + * type. + * - application/pdf + * - application/vnd.openxmlformats-officedocument.wordprocessingml.document + * - application/vnd.openxmlformats-officedocument.presentationml.presentation + * - application/vnd.openxmlformats-officedocument.spreadsheetml.sheet + * + * Generated from protobuf field string mime_type = 3 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $mime_type = ''; + protected $destination; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\Translate\V3\GcsDestination $gcs_destination + * Optional. Google Cloud Storage destination for the translation output, + * e.g., `gs://my_bucket/my_directory/`. + * The destination directory provided does not have to be empty, but the + * bucket must exist. If a file with the same name as the output file + * already exists in the destination an error will be returned. + * For a DocumentInputConfig.contents provided document, the output file + * will have the name "output_[trg]_translations.[ext]", where + * - [trg] corresponds to the translated file's language code, + * - [ext] corresponds to the translated file's extension according to its + * mime type. + * For a DocumentInputConfig.gcs_uri provided document, the output file will + * have a name according to its URI. For example: an input file with URI: + * "gs://a/b/c.[extension]" stored in a gcs_destination bucket with name + * "my_bucket" will have an output URI: + * "gs://my_bucket/a_b_c_[trg]_translations.[ext]", where + * - [trg] corresponds to the translated file's language code, + * - [ext] corresponds to the translated file's extension according to its + * mime type. + * If the document was directly provided through the request, then the + * output document will have the format: + * "gs://my_bucket/translated_document_[trg]_translations.[ext], where + * - [trg] corresponds to the translated file's language code, + * - [ext] corresponds to the translated file's extension according to its + * mime type. + * If a glossary was provided, then the output URI for the glossary + * translation will be equal to the default output URI but have + * `glossary_translations` instead of `translations`. For the previous + * example, its glossary URI would be: + * "gs://my_bucket/a_b_c_[trg]_glossary_translations.[ext]". + * Thus the max number of output files will be 2 (Translated document, + * Glossary translated document). + * Callers should expect no partial outputs. If there is any error during + * document translation, no output will be stored in the Cloud Storage + * bucket. + * @type string $mime_type + * Optional. Specifies the translated document's mime_type. + * If not specified, the translated file's mime type will be the same as the + * input file's mime type. + * Currently only support the output mime type to be the same as input mime + * type. + * - application/pdf + * - application/vnd.openxmlformats-officedocument.wordprocessingml.document + * - application/vnd.openxmlformats-officedocument.presentationml.presentation + * - application/vnd.openxmlformats-officedocument.spreadsheetml.sheet + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Translate\V3\TranslationService::initOnce(); + parent::__construct($data); + } + + /** + * Optional. Google Cloud Storage destination for the translation output, + * e.g., `gs://my_bucket/my_directory/`. + * The destination directory provided does not have to be empty, but the + * bucket must exist. If a file with the same name as the output file + * already exists in the destination an error will be returned. + * For a DocumentInputConfig.contents provided document, the output file + * will have the name "output_[trg]_translations.[ext]", where + * - [trg] corresponds to the translated file's language code, + * - [ext] corresponds to the translated file's extension according to its + * mime type. + * For a DocumentInputConfig.gcs_uri provided document, the output file will + * have a name according to its URI. For example: an input file with URI: + * "gs://a/b/c.[extension]" stored in a gcs_destination bucket with name + * "my_bucket" will have an output URI: + * "gs://my_bucket/a_b_c_[trg]_translations.[ext]", where + * - [trg] corresponds to the translated file's language code, + * - [ext] corresponds to the translated file's extension according to its + * mime type. + * If the document was directly provided through the request, then the + * output document will have the format: + * "gs://my_bucket/translated_document_[trg]_translations.[ext], where + * - [trg] corresponds to the translated file's language code, + * - [ext] corresponds to the translated file's extension according to its + * mime type. + * If a glossary was provided, then the output URI for the glossary + * translation will be equal to the default output URI but have + * `glossary_translations` instead of `translations`. For the previous + * example, its glossary URI would be: + * "gs://my_bucket/a_b_c_[trg]_glossary_translations.[ext]". + * Thus the max number of output files will be 2 (Translated document, + * Glossary translated document). + * Callers should expect no partial outputs. If there is any error during + * document translation, no output will be stored in the Cloud Storage + * bucket. + * + * Generated from protobuf field .google.cloud.translation.v3.GcsDestination gcs_destination = 1 [(.google.api.field_behavior) = OPTIONAL]; + * @return \Google\Cloud\Translate\V3\GcsDestination|null + */ + public function getGcsDestination() + { + return $this->readOneof(1); + } + + public function hasGcsDestination() + { + return $this->hasOneof(1); + } + + /** + * Optional. Google Cloud Storage destination for the translation output, + * e.g., `gs://my_bucket/my_directory/`. + * The destination directory provided does not have to be empty, but the + * bucket must exist. If a file with the same name as the output file + * already exists in the destination an error will be returned. + * For a DocumentInputConfig.contents provided document, the output file + * will have the name "output_[trg]_translations.[ext]", where + * - [trg] corresponds to the translated file's language code, + * - [ext] corresponds to the translated file's extension according to its + * mime type. + * For a DocumentInputConfig.gcs_uri provided document, the output file will + * have a name according to its URI. For example: an input file with URI: + * "gs://a/b/c.[extension]" stored in a gcs_destination bucket with name + * "my_bucket" will have an output URI: + * "gs://my_bucket/a_b_c_[trg]_translations.[ext]", where + * - [trg] corresponds to the translated file's language code, + * - [ext] corresponds to the translated file's extension according to its + * mime type. + * If the document was directly provided through the request, then the + * output document will have the format: + * "gs://my_bucket/translated_document_[trg]_translations.[ext], where + * - [trg] corresponds to the translated file's language code, + * - [ext] corresponds to the translated file's extension according to its + * mime type. + * If a glossary was provided, then the output URI for the glossary + * translation will be equal to the default output URI but have + * `glossary_translations` instead of `translations`. For the previous + * example, its glossary URI would be: + * "gs://my_bucket/a_b_c_[trg]_glossary_translations.[ext]". + * Thus the max number of output files will be 2 (Translated document, + * Glossary translated document). + * Callers should expect no partial outputs. If there is any error during + * document translation, no output will be stored in the Cloud Storage + * bucket. + * + * Generated from protobuf field .google.cloud.translation.v3.GcsDestination gcs_destination = 1 [(.google.api.field_behavior) = OPTIONAL]; + * @param \Google\Cloud\Translate\V3\GcsDestination $var + * @return $this + */ + public function setGcsDestination($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Translate\V3\GcsDestination::class); + $this->writeOneof(1, $var); + + return $this; + } + + /** + * Optional. Specifies the translated document's mime_type. + * If not specified, the translated file's mime type will be the same as the + * input file's mime type. + * Currently only support the output mime type to be the same as input mime + * type. + * - application/pdf + * - application/vnd.openxmlformats-officedocument.wordprocessingml.document + * - application/vnd.openxmlformats-officedocument.presentationml.presentation + * - application/vnd.openxmlformats-officedocument.spreadsheetml.sheet + * + * Generated from protobuf field string mime_type = 3 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getMimeType() + { + return $this->mime_type; + } + + /** + * Optional. Specifies the translated document's mime_type. + * If not specified, the translated file's mime type will be the same as the + * input file's mime type. + * Currently only support the output mime type to be the same as input mime + * type. + * - application/pdf + * - application/vnd.openxmlformats-officedocument.wordprocessingml.document + * - application/vnd.openxmlformats-officedocument.presentationml.presentation + * - application/vnd.openxmlformats-officedocument.spreadsheetml.sheet + * + * Generated from protobuf field string mime_type = 3 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setMimeType($var) + { + GPBUtil::checkString($var, True); + $this->mime_type = $var; + + return $this; + } + + /** + * @return string + */ + public function getDestination() + { + return $this->whichOneof("destination"); + } + +} + diff --git a/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/DocumentTranslation.php b/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/DocumentTranslation.php new file mode 100644 index 00000000000..a03fe5adad2 --- /dev/null +++ b/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/DocumentTranslation.php @@ -0,0 +1,159 @@ +google.cloud.translation.v3.DocumentTranslation + */ +class DocumentTranslation extends \Google\Protobuf\Internal\Message +{ + /** + * The array of translated documents. It is expected to be size 1 for now. We + * may produce multiple translated documents in the future for other type of + * file formats. + * + * Generated from protobuf field repeated bytes byte_stream_outputs = 1; + */ + private $byte_stream_outputs; + /** + * The translated document's mime type. + * + * Generated from protobuf field string mime_type = 2; + */ + protected $mime_type = ''; + /** + * The detected language for the input document. + * If the user did not provide the source language for the input document, + * this field will have the language code automatically detected. If the + * source language was passed, auto-detection of the language does not occur + * and this field is empty. + * + * Generated from protobuf field string detected_language_code = 3; + */ + protected $detected_language_code = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array|\Google\Protobuf\Internal\RepeatedField $byte_stream_outputs + * The array of translated documents. It is expected to be size 1 for now. We + * may produce multiple translated documents in the future for other type of + * file formats. + * @type string $mime_type + * The translated document's mime type. + * @type string $detected_language_code + * The detected language for the input document. + * If the user did not provide the source language for the input document, + * this field will have the language code automatically detected. If the + * source language was passed, auto-detection of the language does not occur + * and this field is empty. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Translate\V3\TranslationService::initOnce(); + parent::__construct($data); + } + + /** + * The array of translated documents. It is expected to be size 1 for now. We + * may produce multiple translated documents in the future for other type of + * file formats. + * + * Generated from protobuf field repeated bytes byte_stream_outputs = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getByteStreamOutputs() + { + return $this->byte_stream_outputs; + } + + /** + * The array of translated documents. It is expected to be size 1 for now. We + * may produce multiple translated documents in the future for other type of + * file formats. + * + * Generated from protobuf field repeated bytes byte_stream_outputs = 1; + * @param array|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setByteStreamOutputs($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::BYTES); + $this->byte_stream_outputs = $arr; + + return $this; + } + + /** + * The translated document's mime type. + * + * Generated from protobuf field string mime_type = 2; + * @return string + */ + public function getMimeType() + { + return $this->mime_type; + } + + /** + * The translated document's mime type. + * + * Generated from protobuf field string mime_type = 2; + * @param string $var + * @return $this + */ + public function setMimeType($var) + { + GPBUtil::checkString($var, True); + $this->mime_type = $var; + + return $this; + } + + /** + * The detected language for the input document. + * If the user did not provide the source language for the input document, + * this field will have the language code automatically detected. If the + * source language was passed, auto-detection of the language does not occur + * and this field is empty. + * + * Generated from protobuf field string detected_language_code = 3; + * @return string + */ + public function getDetectedLanguageCode() + { + return $this->detected_language_code; + } + + /** + * The detected language for the input document. + * If the user did not provide the source language for the input document, + * this field will have the language code automatically detected. If the + * source language was passed, auto-detection of the language does not occur + * and this field is empty. + * + * Generated from protobuf field string detected_language_code = 3; + * @param string $var + * @return $this + */ + public function setDetectedLanguageCode($var) + { + GPBUtil::checkString($var, True); + $this->detected_language_code = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/GcsDestination.php b/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/GcsDestination.php new file mode 100644 index 00000000000..6294ede95c7 --- /dev/null +++ b/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/GcsDestination.php @@ -0,0 +1,83 @@ +google.cloud.translation.v3.GcsDestination + */ +class GcsDestination extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The bucket used in 'output_uri_prefix' must exist and there must + * be no files under 'output_uri_prefix'. 'output_uri_prefix' must end with + * "/" and start with "gs://". One 'output_uri_prefix' can only be used by one + * batch translation job at a time. Otherwise an INVALID_ARGUMENT (400) error + * is returned. + * + * Generated from protobuf field string output_uri_prefix = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $output_uri_prefix = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $output_uri_prefix + * Required. The bucket used in 'output_uri_prefix' must exist and there must + * be no files under 'output_uri_prefix'. 'output_uri_prefix' must end with + * "/" and start with "gs://". One 'output_uri_prefix' can only be used by one + * batch translation job at a time. Otherwise an INVALID_ARGUMENT (400) error + * is returned. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Translate\V3\TranslationService::initOnce(); + parent::__construct($data); + } + + /** + * Required. The bucket used in 'output_uri_prefix' must exist and there must + * be no files under 'output_uri_prefix'. 'output_uri_prefix' must end with + * "/" and start with "gs://". One 'output_uri_prefix' can only be used by one + * batch translation job at a time. Otherwise an INVALID_ARGUMENT (400) error + * is returned. + * + * Generated from protobuf field string output_uri_prefix = 1 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getOutputUriPrefix() + { + return $this->output_uri_prefix; + } + + /** + * Required. The bucket used in 'output_uri_prefix' must exist and there must + * be no files under 'output_uri_prefix'. 'output_uri_prefix' must end with + * "/" and start with "gs://". One 'output_uri_prefix' can only be used by one + * batch translation job at a time. Otherwise an INVALID_ARGUMENT (400) error + * is returned. + * + * Generated from protobuf field string output_uri_prefix = 1 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setOutputUriPrefix($var) + { + GPBUtil::checkString($var, True); + $this->output_uri_prefix = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/GcsSource.php b/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/GcsSource.php new file mode 100644 index 00000000000..9dfda6fc818 --- /dev/null +++ b/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/GcsSource.php @@ -0,0 +1,67 @@ +google.cloud.translation.v3.GcsSource + */ +class GcsSource extends \Google\Protobuf\Internal\Message +{ + /** + * Required. Source data URI. For example, `gs://my_bucket/my_object`. + * + * Generated from protobuf field string input_uri = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $input_uri = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $input_uri + * Required. Source data URI. For example, `gs://my_bucket/my_object`. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Translate\V3\TranslationService::initOnce(); + parent::__construct($data); + } + + /** + * Required. Source data URI. For example, `gs://my_bucket/my_object`. + * + * Generated from protobuf field string input_uri = 1 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getInputUri() + { + return $this->input_uri; + } + + /** + * Required. Source data URI. For example, `gs://my_bucket/my_object`. + * + * Generated from protobuf field string input_uri = 1 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setInputUri($var) + { + GPBUtil::checkString($var, True); + $this->input_uri = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/GetGlossaryRequest.php b/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/GetGlossaryRequest.php new file mode 100644 index 00000000000..613ca43bce0 --- /dev/null +++ b/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/GetGlossaryRequest.php @@ -0,0 +1,67 @@ +google.cloud.translation.v3.GetGlossaryRequest + */ +class GetGlossaryRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The name of the glossary to retrieve. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. The name of the glossary to retrieve. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Translate\V3\TranslationService::initOnce(); + parent::__construct($data); + } + + /** + * Required. The name of the glossary to retrieve. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Required. The name of the glossary to retrieve. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/GetSupportedLanguagesRequest.php b/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/GetSupportedLanguagesRequest.php new file mode 100644 index 00000000000..bc996f1db82 --- /dev/null +++ b/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/GetSupportedLanguagesRequest.php @@ -0,0 +1,203 @@ +google.cloud.translation.v3.GetSupportedLanguagesRequest + */ +class GetSupportedLanguagesRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. Project or location to make a call. Must refer to a caller's + * project. + * Format: `projects/{project-number-or-id}` or + * `projects/{project-number-or-id}/locations/{location-id}`. + * For global calls, use `projects/{project-number-or-id}/locations/global` or + * `projects/{project-number-or-id}`. + * Non-global location is required for AutoML models. + * Only models within the same region (have same location-id) can be used, + * otherwise an INVALID_ARGUMENT (400) error is returned. + * + * Generated from protobuf field string parent = 3 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $parent = ''; + /** + * Optional. The language to use to return localized, human readable names + * of supported languages. If missing, then display names are not returned + * in a response. + * + * Generated from protobuf field string display_language_code = 1 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $display_language_code = ''; + /** + * Optional. Get supported languages of this model. + * The format depends on model type: + * - AutoML Translation models: + * `projects/{project-number-or-id}/locations/{location-id}/models/{model-id}` + * - General (built-in) models: + * `projects/{project-number-or-id}/locations/{location-id}/models/general/nmt`, + * Returns languages supported by the specified model. + * If missing, we get supported languages of Google general NMT model. + * + * Generated from protobuf field string model = 2 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $model = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $parent + * Required. Project or location to make a call. Must refer to a caller's + * project. + * Format: `projects/{project-number-or-id}` or + * `projects/{project-number-or-id}/locations/{location-id}`. + * For global calls, use `projects/{project-number-or-id}/locations/global` or + * `projects/{project-number-or-id}`. + * Non-global location is required for AutoML models. + * Only models within the same region (have same location-id) can be used, + * otherwise an INVALID_ARGUMENT (400) error is returned. + * @type string $display_language_code + * Optional. The language to use to return localized, human readable names + * of supported languages. If missing, then display names are not returned + * in a response. + * @type string $model + * Optional. Get supported languages of this model. + * The format depends on model type: + * - AutoML Translation models: + * `projects/{project-number-or-id}/locations/{location-id}/models/{model-id}` + * - General (built-in) models: + * `projects/{project-number-or-id}/locations/{location-id}/models/general/nmt`, + * Returns languages supported by the specified model. + * If missing, we get supported languages of Google general NMT model. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Translate\V3\TranslationService::initOnce(); + parent::__construct($data); + } + + /** + * Required. Project or location to make a call. Must refer to a caller's + * project. + * Format: `projects/{project-number-or-id}` or + * `projects/{project-number-or-id}/locations/{location-id}`. + * For global calls, use `projects/{project-number-or-id}/locations/global` or + * `projects/{project-number-or-id}`. + * Non-global location is required for AutoML models. + * Only models within the same region (have same location-id) can be used, + * otherwise an INVALID_ARGUMENT (400) error is returned. + * + * Generated from protobuf field string parent = 3 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getParent() + { + return $this->parent; + } + + /** + * Required. Project or location to make a call. Must refer to a caller's + * project. + * Format: `projects/{project-number-or-id}` or + * `projects/{project-number-or-id}/locations/{location-id}`. + * For global calls, use `projects/{project-number-or-id}/locations/global` or + * `projects/{project-number-or-id}`. + * Non-global location is required for AutoML models. + * Only models within the same region (have same location-id) can be used, + * otherwise an INVALID_ARGUMENT (400) error is returned. + * + * Generated from protobuf field string parent = 3 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setParent($var) + { + GPBUtil::checkString($var, True); + $this->parent = $var; + + return $this; + } + + /** + * Optional. The language to use to return localized, human readable names + * of supported languages. If missing, then display names are not returned + * in a response. + * + * Generated from protobuf field string display_language_code = 1 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getDisplayLanguageCode() + { + return $this->display_language_code; + } + + /** + * Optional. The language to use to return localized, human readable names + * of supported languages. If missing, then display names are not returned + * in a response. + * + * Generated from protobuf field string display_language_code = 1 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setDisplayLanguageCode($var) + { + GPBUtil::checkString($var, True); + $this->display_language_code = $var; + + return $this; + } + + /** + * Optional. Get supported languages of this model. + * The format depends on model type: + * - AutoML Translation models: + * `projects/{project-number-or-id}/locations/{location-id}/models/{model-id}` + * - General (built-in) models: + * `projects/{project-number-or-id}/locations/{location-id}/models/general/nmt`, + * Returns languages supported by the specified model. + * If missing, we get supported languages of Google general NMT model. + * + * Generated from protobuf field string model = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getModel() + { + return $this->model; + } + + /** + * Optional. Get supported languages of this model. + * The format depends on model type: + * - AutoML Translation models: + * `projects/{project-number-or-id}/locations/{location-id}/models/{model-id}` + * - General (built-in) models: + * `projects/{project-number-or-id}/locations/{location-id}/models/general/nmt`, + * Returns languages supported by the specified model. + * If missing, we get supported languages of Google general NMT model. + * + * Generated from protobuf field string model = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setModel($var) + { + GPBUtil::checkString($var, True); + $this->model = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/Glossary.php b/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/Glossary.php new file mode 100644 index 00000000000..dac3eb5708c --- /dev/null +++ b/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/Glossary.php @@ -0,0 +1,350 @@ +google.cloud.translation.v3.Glossary + */ +class Glossary extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The resource name of the glossary. Glossary names have the form + * `projects/{project-number-or-id}/locations/{location-id}/glossaries/{glossary-id}`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $name = ''; + /** + * Required. Provides examples to build the glossary from. + * Total glossary must not exceed 10M Unicode codepoints. + * + * Generated from protobuf field .google.cloud.translation.v3.GlossaryInputConfig input_config = 5; + */ + protected $input_config = null; + /** + * Output only. The number of entries defined in the glossary. + * + * Generated from protobuf field int32 entry_count = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $entry_count = 0; + /** + * Output only. When CreateGlossary was called. + * + * Generated from protobuf field .google.protobuf.Timestamp submit_time = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $submit_time = null; + /** + * Output only. When the glossary creation was finished. + * + * Generated from protobuf field .google.protobuf.Timestamp end_time = 8 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $end_time = null; + /** + * Optional. The display name of the glossary. + * + * Generated from protobuf field string display_name = 9 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $display_name = ''; + protected $languages; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. The resource name of the glossary. Glossary names have the form + * `projects/{project-number-or-id}/locations/{location-id}/glossaries/{glossary-id}`. + * @type \Google\Cloud\Translate\V3\Glossary\LanguageCodePair $language_pair + * Used with unidirectional glossaries. + * @type \Google\Cloud\Translate\V3\Glossary\LanguageCodesSet $language_codes_set + * Used with equivalent term set glossaries. + * @type \Google\Cloud\Translate\V3\GlossaryInputConfig $input_config + * Required. Provides examples to build the glossary from. + * Total glossary must not exceed 10M Unicode codepoints. + * @type int $entry_count + * Output only. The number of entries defined in the glossary. + * @type \Google\Protobuf\Timestamp $submit_time + * Output only. When CreateGlossary was called. + * @type \Google\Protobuf\Timestamp $end_time + * Output only. When the glossary creation was finished. + * @type string $display_name + * Optional. The display name of the glossary. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Translate\V3\TranslationService::initOnce(); + parent::__construct($data); + } + + /** + * Required. The resource name of the glossary. Glossary names have the form + * `projects/{project-number-or-id}/locations/{location-id}/glossaries/{glossary-id}`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Required. The resource name of the glossary. Glossary names have the form + * `projects/{project-number-or-id}/locations/{location-id}/glossaries/{glossary-id}`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * Used with unidirectional glossaries. + * + * Generated from protobuf field .google.cloud.translation.v3.Glossary.LanguageCodePair language_pair = 3; + * @return \Google\Cloud\Translate\V3\Glossary\LanguageCodePair|null + */ + public function getLanguagePair() + { + return $this->readOneof(3); + } + + public function hasLanguagePair() + { + return $this->hasOneof(3); + } + + /** + * Used with unidirectional glossaries. + * + * Generated from protobuf field .google.cloud.translation.v3.Glossary.LanguageCodePair language_pair = 3; + * @param \Google\Cloud\Translate\V3\Glossary\LanguageCodePair $var + * @return $this + */ + public function setLanguagePair($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Translate\V3\Glossary\LanguageCodePair::class); + $this->writeOneof(3, $var); + + return $this; + } + + /** + * Used with equivalent term set glossaries. + * + * Generated from protobuf field .google.cloud.translation.v3.Glossary.LanguageCodesSet language_codes_set = 4; + * @return \Google\Cloud\Translate\V3\Glossary\LanguageCodesSet|null + */ + public function getLanguageCodesSet() + { + return $this->readOneof(4); + } + + public function hasLanguageCodesSet() + { + return $this->hasOneof(4); + } + + /** + * Used with equivalent term set glossaries. + * + * Generated from protobuf field .google.cloud.translation.v3.Glossary.LanguageCodesSet language_codes_set = 4; + * @param \Google\Cloud\Translate\V3\Glossary\LanguageCodesSet $var + * @return $this + */ + public function setLanguageCodesSet($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Translate\V3\Glossary\LanguageCodesSet::class); + $this->writeOneof(4, $var); + + return $this; + } + + /** + * Required. Provides examples to build the glossary from. + * Total glossary must not exceed 10M Unicode codepoints. + * + * Generated from protobuf field .google.cloud.translation.v3.GlossaryInputConfig input_config = 5; + * @return \Google\Cloud\Translate\V3\GlossaryInputConfig|null + */ + public function getInputConfig() + { + return $this->input_config; + } + + public function hasInputConfig() + { + return isset($this->input_config); + } + + public function clearInputConfig() + { + unset($this->input_config); + } + + /** + * Required. Provides examples to build the glossary from. + * Total glossary must not exceed 10M Unicode codepoints. + * + * Generated from protobuf field .google.cloud.translation.v3.GlossaryInputConfig input_config = 5; + * @param \Google\Cloud\Translate\V3\GlossaryInputConfig $var + * @return $this + */ + public function setInputConfig($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Translate\V3\GlossaryInputConfig::class); + $this->input_config = $var; + + return $this; + } + + /** + * Output only. The number of entries defined in the glossary. + * + * Generated from protobuf field int32 entry_count = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return int + */ + public function getEntryCount() + { + return $this->entry_count; + } + + /** + * Output only. The number of entries defined in the glossary. + * + * Generated from protobuf field int32 entry_count = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param int $var + * @return $this + */ + public function setEntryCount($var) + { + GPBUtil::checkInt32($var); + $this->entry_count = $var; + + return $this; + } + + /** + * Output only. When CreateGlossary was called. + * + * Generated from protobuf field .google.protobuf.Timestamp submit_time = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Protobuf\Timestamp|null + */ + public function getSubmitTime() + { + return $this->submit_time; + } + + public function hasSubmitTime() + { + return isset($this->submit_time); + } + + public function clearSubmitTime() + { + unset($this->submit_time); + } + + /** + * Output only. When CreateGlossary was called. + * + * Generated from protobuf field .google.protobuf.Timestamp submit_time = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setSubmitTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->submit_time = $var; + + return $this; + } + + /** + * Output only. When the glossary creation was finished. + * + * Generated from protobuf field .google.protobuf.Timestamp end_time = 8 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Protobuf\Timestamp|null + */ + public function getEndTime() + { + return $this->end_time; + } + + public function hasEndTime() + { + return isset($this->end_time); + } + + public function clearEndTime() + { + unset($this->end_time); + } + + /** + * Output only. When the glossary creation was finished. + * + * Generated from protobuf field .google.protobuf.Timestamp end_time = 8 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setEndTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->end_time = $var; + + return $this; + } + + /** + * Optional. The display name of the glossary. + * + * Generated from protobuf field string display_name = 9 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getDisplayName() + { + return $this->display_name; + } + + /** + * Optional. The display name of the glossary. + * + * Generated from protobuf field string display_name = 9 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setDisplayName($var) + { + GPBUtil::checkString($var, True); + $this->display_name = $var; + + return $this; + } + + /** + * @return string + */ + public function getLanguages() + { + return $this->whichOneof("languages"); + } + +} + diff --git a/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/Glossary/LanguageCodePair.php b/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/Glossary/LanguageCodePair.php new file mode 100644 index 00000000000..4b228dd3f15 --- /dev/null +++ b/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/Glossary/LanguageCodePair.php @@ -0,0 +1,112 @@ +google.cloud.translation.v3.Glossary.LanguageCodePair + */ +class LanguageCodePair extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The ISO-639 language code of the input text, for example, + * "en-US". Expected to be an exact match for GlossaryTerm.language_code. + * + * Generated from protobuf field string source_language_code = 1; + */ + protected $source_language_code = ''; + /** + * Required. The ISO-639 language code for translation output, for example, + * "zh-CN". Expected to be an exact match for GlossaryTerm.language_code. + * + * Generated from protobuf field string target_language_code = 2; + */ + protected $target_language_code = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $source_language_code + * Required. The ISO-639 language code of the input text, for example, + * "en-US". Expected to be an exact match for GlossaryTerm.language_code. + * @type string $target_language_code + * Required. The ISO-639 language code for translation output, for example, + * "zh-CN". Expected to be an exact match for GlossaryTerm.language_code. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Translate\V3\TranslationService::initOnce(); + parent::__construct($data); + } + + /** + * Required. The ISO-639 language code of the input text, for example, + * "en-US". Expected to be an exact match for GlossaryTerm.language_code. + * + * Generated from protobuf field string source_language_code = 1; + * @return string + */ + public function getSourceLanguageCode() + { + return $this->source_language_code; + } + + /** + * Required. The ISO-639 language code of the input text, for example, + * "en-US". Expected to be an exact match for GlossaryTerm.language_code. + * + * Generated from protobuf field string source_language_code = 1; + * @param string $var + * @return $this + */ + public function setSourceLanguageCode($var) + { + GPBUtil::checkString($var, True); + $this->source_language_code = $var; + + return $this; + } + + /** + * Required. The ISO-639 language code for translation output, for example, + * "zh-CN". Expected to be an exact match for GlossaryTerm.language_code. + * + * Generated from protobuf field string target_language_code = 2; + * @return string + */ + public function getTargetLanguageCode() + { + return $this->target_language_code; + } + + /** + * Required. The ISO-639 language code for translation output, for example, + * "zh-CN". Expected to be an exact match for GlossaryTerm.language_code. + * + * Generated from protobuf field string target_language_code = 2; + * @param string $var + * @return $this + */ + public function setTargetLanguageCode($var) + { + GPBUtil::checkString($var, True); + $this->target_language_code = $var; + + return $this; + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(LanguageCodePair::class, \Google\Cloud\Translate\V3\Glossary_LanguageCodePair::class); + diff --git a/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/Glossary/LanguageCodesSet.php b/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/Glossary/LanguageCodesSet.php new file mode 100644 index 00000000000..164d340406c --- /dev/null +++ b/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/Glossary/LanguageCodesSet.php @@ -0,0 +1,78 @@ +google.cloud.translation.v3.Glossary.LanguageCodesSet + */ +class LanguageCodesSet extends \Google\Protobuf\Internal\Message +{ + /** + * The ISO-639 language code(s) for terms defined in the glossary. + * All entries are unique. The list contains at least two entries. + * Expected to be an exact match for GlossaryTerm.language_code. + * + * Generated from protobuf field repeated string language_codes = 1; + */ + private $language_codes; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array|\Google\Protobuf\Internal\RepeatedField $language_codes + * The ISO-639 language code(s) for terms defined in the glossary. + * All entries are unique. The list contains at least two entries. + * Expected to be an exact match for GlossaryTerm.language_code. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Translate\V3\TranslationService::initOnce(); + parent::__construct($data); + } + + /** + * The ISO-639 language code(s) for terms defined in the glossary. + * All entries are unique. The list contains at least two entries. + * Expected to be an exact match for GlossaryTerm.language_code. + * + * Generated from protobuf field repeated string language_codes = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getLanguageCodes() + { + return $this->language_codes; + } + + /** + * The ISO-639 language code(s) for terms defined in the glossary. + * All entries are unique. The list contains at least two entries. + * Expected to be an exact match for GlossaryTerm.language_code. + * + * 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; + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(LanguageCodesSet::class, \Google\Cloud\Translate\V3\Glossary_LanguageCodesSet::class); + diff --git a/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/GlossaryInputConfig.php b/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/GlossaryInputConfig.php new file mode 100644 index 00000000000..a5800834223 --- /dev/null +++ b/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/GlossaryInputConfig.php @@ -0,0 +1,120 @@ +google.cloud.translation.v3.GlossaryInputConfig + */ +class GlossaryInputConfig extends \Google\Protobuf\Internal\Message +{ + protected $source; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\Translate\V3\GcsSource $gcs_source + * Required. Google Cloud Storage location of glossary data. + * File format is determined based on the filename extension. API returns + * [google.rpc.Code.INVALID_ARGUMENT] for unsupported URI-s and file + * formats. Wildcards are not allowed. This must be a single file in one of + * the following formats: + * For unidirectional glossaries: + * - TSV/CSV (`.tsv`/`.csv`): Two column file, tab- or comma-separated. + * The first column is source text. The second column is target text. + * No headers in this file. The first row contains data and not column + * names. + * - TMX (`.tmx`): TMX file with parallel data defining source/target term + * pairs. + * For equivalent term sets glossaries: + * - CSV (`.csv`): Multi-column CSV file defining equivalent glossary terms + * in multiple languages. See documentation for more information - + * [glossaries](https://cloud.google.com/translate/docs/advanced/glossary). + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Translate\V3\TranslationService::initOnce(); + parent::__construct($data); + } + + /** + * Required. Google Cloud Storage location of glossary data. + * File format is determined based on the filename extension. API returns + * [google.rpc.Code.INVALID_ARGUMENT] for unsupported URI-s and file + * formats. Wildcards are not allowed. This must be a single file in one of + * the following formats: + * For unidirectional glossaries: + * - TSV/CSV (`.tsv`/`.csv`): Two column file, tab- or comma-separated. + * The first column is source text. The second column is target text. + * No headers in this file. The first row contains data and not column + * names. + * - TMX (`.tmx`): TMX file with parallel data defining source/target term + * pairs. + * For equivalent term sets glossaries: + * - CSV (`.csv`): Multi-column CSV file defining equivalent glossary terms + * in multiple languages. See documentation for more information - + * [glossaries](https://cloud.google.com/translate/docs/advanced/glossary). + * + * Generated from protobuf field .google.cloud.translation.v3.GcsSource gcs_source = 1; + * @return \Google\Cloud\Translate\V3\GcsSource|null + */ + public function getGcsSource() + { + return $this->readOneof(1); + } + + public function hasGcsSource() + { + return $this->hasOneof(1); + } + + /** + * Required. Google Cloud Storage location of glossary data. + * File format is determined based on the filename extension. API returns + * [google.rpc.Code.INVALID_ARGUMENT] for unsupported URI-s and file + * formats. Wildcards are not allowed. This must be a single file in one of + * the following formats: + * For unidirectional glossaries: + * - TSV/CSV (`.tsv`/`.csv`): Two column file, tab- or comma-separated. + * The first column is source text. The second column is target text. + * No headers in this file. The first row contains data and not column + * names. + * - TMX (`.tmx`): TMX file with parallel data defining source/target term + * pairs. + * For equivalent term sets glossaries: + * - CSV (`.csv`): Multi-column CSV file defining equivalent glossary terms + * in multiple languages. See documentation for more information - + * [glossaries](https://cloud.google.com/translate/docs/advanced/glossary). + * + * Generated from protobuf field .google.cloud.translation.v3.GcsSource gcs_source = 1; + * @param \Google\Cloud\Translate\V3\GcsSource $var + * @return $this + */ + public function setGcsSource($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Translate\V3\GcsSource::class); + $this->writeOneof(1, $var); + + return $this; + } + + /** + * @return string + */ + public function getSource() + { + return $this->whichOneof("source"); + } + +} + diff --git a/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/Glossary_LanguageCodePair.php b/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/Glossary_LanguageCodePair.php new file mode 100644 index 00000000000..4e7ddaa0737 --- /dev/null +++ b/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/Glossary_LanguageCodePair.php @@ -0,0 +1,16 @@ +google.cloud.translation.v3.InputConfig + */ +class InputConfig extends \Google\Protobuf\Internal\Message +{ + /** + * Optional. Can be "text/plain" or "text/html". + * For `.tsv`, "text/html" is used if mime_type is missing. + * For `.html`, this field must be "text/html" or empty. + * For `.txt`, this field must be "text/plain" or empty. + * + * Generated from protobuf field string mime_type = 1 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $mime_type = ''; + protected $source; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $mime_type + * Optional. Can be "text/plain" or "text/html". + * For `.tsv`, "text/html" is used if mime_type is missing. + * For `.html`, this field must be "text/html" or empty. + * For `.txt`, this field must be "text/plain" or empty. + * @type \Google\Cloud\Translate\V3\GcsSource $gcs_source + * Required. Google Cloud Storage location for the source input. + * This can be a single file (for example, + * `gs://translation-test/input.tsv`) or a wildcard (for example, + * `gs://translation-test/*`). If a file extension is `.tsv`, it can + * contain either one or two columns. The first column (optional) is the id + * of the text request. If the first column is missing, we use the row + * number (0-based) from the input file as the ID in the output file. The + * second column is the actual text to be + * translated. We recommend each row be <= 10K Unicode codepoints, + * otherwise an error might be returned. + * Note that the input tsv must be RFC 4180 compliant. + * You could use https://github.com/Clever/csvlint to check potential + * formatting errors in your tsv file. + * csvlint --delimiter='\t' your_input_file.tsv + * The other supported file extensions are `.txt` or `.html`, which is + * treated as a single large chunk of text. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Translate\V3\TranslationService::initOnce(); + parent::__construct($data); + } + + /** + * Optional. Can be "text/plain" or "text/html". + * For `.tsv`, "text/html" is used if mime_type is missing. + * For `.html`, this field must be "text/html" or empty. + * For `.txt`, this field must be "text/plain" or empty. + * + * Generated from protobuf field string mime_type = 1 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getMimeType() + { + return $this->mime_type; + } + + /** + * Optional. Can be "text/plain" or "text/html". + * For `.tsv`, "text/html" is used if mime_type is missing. + * For `.html`, this field must be "text/html" or empty. + * For `.txt`, this field must be "text/plain" or empty. + * + * Generated from protobuf field string mime_type = 1 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setMimeType($var) + { + GPBUtil::checkString($var, True); + $this->mime_type = $var; + + return $this; + } + + /** + * Required. Google Cloud Storage location for the source input. + * This can be a single file (for example, + * `gs://translation-test/input.tsv`) or a wildcard (for example, + * `gs://translation-test/*`). If a file extension is `.tsv`, it can + * contain either one or two columns. The first column (optional) is the id + * of the text request. If the first column is missing, we use the row + * number (0-based) from the input file as the ID in the output file. The + * second column is the actual text to be + * translated. We recommend each row be <= 10K Unicode codepoints, + * otherwise an error might be returned. + * Note that the input tsv must be RFC 4180 compliant. + * You could use https://github.com/Clever/csvlint to check potential + * formatting errors in your tsv file. + * csvlint --delimiter='\t' your_input_file.tsv + * The other supported file extensions are `.txt` or `.html`, which is + * treated as a single large chunk of text. + * + * Generated from protobuf field .google.cloud.translation.v3.GcsSource gcs_source = 2; + * @return \Google\Cloud\Translate\V3\GcsSource|null + */ + public function getGcsSource() + { + return $this->readOneof(2); + } + + public function hasGcsSource() + { + return $this->hasOneof(2); + } + + /** + * Required. Google Cloud Storage location for the source input. + * This can be a single file (for example, + * `gs://translation-test/input.tsv`) or a wildcard (for example, + * `gs://translation-test/*`). If a file extension is `.tsv`, it can + * contain either one or two columns. The first column (optional) is the id + * of the text request. If the first column is missing, we use the row + * number (0-based) from the input file as the ID in the output file. The + * second column is the actual text to be + * translated. We recommend each row be <= 10K Unicode codepoints, + * otherwise an error might be returned. + * Note that the input tsv must be RFC 4180 compliant. + * You could use https://github.com/Clever/csvlint to check potential + * formatting errors in your tsv file. + * csvlint --delimiter='\t' your_input_file.tsv + * The other supported file extensions are `.txt` or `.html`, which is + * treated as a single large chunk of text. + * + * Generated from protobuf field .google.cloud.translation.v3.GcsSource gcs_source = 2; + * @param \Google\Cloud\Translate\V3\GcsSource $var + * @return $this + */ + public function setGcsSource($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Translate\V3\GcsSource::class); + $this->writeOneof(2, $var); + + return $this; + } + + /** + * @return string + */ + public function getSource() + { + return $this->whichOneof("source"); + } + +} + diff --git a/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/ListGlossariesRequest.php b/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/ListGlossariesRequest.php new file mode 100644 index 00000000000..f27147799a8 --- /dev/null +++ b/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/ListGlossariesRequest.php @@ -0,0 +1,245 @@ +google.cloud.translation.v3.ListGlossariesRequest + */ +class ListGlossariesRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The name of the project from which to list all of the glossaries. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $parent = ''; + /** + * Optional. Requested page size. The server may return fewer glossaries than + * requested. If unspecified, the server picks an appropriate default. + * + * Generated from protobuf field int32 page_size = 2 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $page_size = 0; + /** + * Optional. A token identifying a page of results the server should return. + * Typically, this is the value of [ListGlossariesResponse.next_page_token] + * returned from the previous call to `ListGlossaries` method. + * The first page is returned if `page_token`is empty or missing. + * + * Generated from protobuf field string page_token = 3 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $page_token = ''; + /** + * Optional. Filter specifying constraints of a list operation. + * Specify the constraint by the format of "key=value", where key must be + * "src" or "tgt", and the value must be a valid language code. + * For multiple restrictions, concatenate them by "AND" (uppercase only), + * such as: "src=en-US AND tgt=zh-CN". Notice that the exact match is used + * here, which means using 'en-US' and 'en' can lead to different results, + * which depends on the language code you used when you create the glossary. + * For the unidirectional glossaries, the "src" and "tgt" add restrictions + * on the source and target language code separately. + * For the equivalent term set glossaries, the "src" and/or "tgt" add + * restrictions on the term set. + * For example: "src=en-US AND tgt=zh-CN" will only pick the unidirectional + * glossaries which exactly match the source language code as "en-US" and the + * target language code "zh-CN", but all equivalent term set glossaries which + * contain "en-US" and "zh-CN" in their language set will be picked. + * If missing, no filtering is performed. + * + * Generated from protobuf field string filter = 4 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $filter = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $parent + * Required. The name of the project from which to list all of the glossaries. + * @type int $page_size + * Optional. Requested page size. The server may return fewer glossaries than + * requested. If unspecified, the server picks an appropriate default. + * @type string $page_token + * Optional. A token identifying a page of results the server should return. + * Typically, this is the value of [ListGlossariesResponse.next_page_token] + * returned from the previous call to `ListGlossaries` method. + * The first page is returned if `page_token`is empty or missing. + * @type string $filter + * Optional. Filter specifying constraints of a list operation. + * Specify the constraint by the format of "key=value", where key must be + * "src" or "tgt", and the value must be a valid language code. + * For multiple restrictions, concatenate them by "AND" (uppercase only), + * such as: "src=en-US AND tgt=zh-CN". Notice that the exact match is used + * here, which means using 'en-US' and 'en' can lead to different results, + * which depends on the language code you used when you create the glossary. + * For the unidirectional glossaries, the "src" and "tgt" add restrictions + * on the source and target language code separately. + * For the equivalent term set glossaries, the "src" and/or "tgt" add + * restrictions on the term set. + * For example: "src=en-US AND tgt=zh-CN" will only pick the unidirectional + * glossaries which exactly match the source language code as "en-US" and the + * target language code "zh-CN", but all equivalent term set glossaries which + * contain "en-US" and "zh-CN" in their language set will be picked. + * If missing, no filtering is performed. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Translate\V3\TranslationService::initOnce(); + parent::__construct($data); + } + + /** + * Required. The name of the project from which to list all of the glossaries. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getParent() + { + return $this->parent; + } + + /** + * Required. The name of the project from which to list all of the glossaries. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setParent($var) + { + GPBUtil::checkString($var, True); + $this->parent = $var; + + return $this; + } + + /** + * Optional. Requested page size. The server may return fewer glossaries than + * requested. If unspecified, the server picks an appropriate default. + * + * Generated from protobuf field int32 page_size = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @return int + */ + public function getPageSize() + { + return $this->page_size; + } + + /** + * Optional. Requested page size. The server may return fewer glossaries than + * requested. If unspecified, the server picks an appropriate default. + * + * Generated from protobuf field int32 page_size = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @param int $var + * @return $this + */ + public function setPageSize($var) + { + GPBUtil::checkInt32($var); + $this->page_size = $var; + + return $this; + } + + /** + * Optional. A token identifying a page of results the server should return. + * Typically, this is the value of [ListGlossariesResponse.next_page_token] + * returned from the previous call to `ListGlossaries` method. + * The first page is returned if `page_token`is empty or missing. + * + * Generated from protobuf field string page_token = 3 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getPageToken() + { + return $this->page_token; + } + + /** + * Optional. A token identifying a page of results the server should return. + * Typically, this is the value of [ListGlossariesResponse.next_page_token] + * returned from the previous call to `ListGlossaries` method. + * The first page is returned if `page_token`is empty or missing. + * + * Generated from protobuf field string page_token = 3 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setPageToken($var) + { + GPBUtil::checkString($var, True); + $this->page_token = $var; + + return $this; + } + + /** + * Optional. Filter specifying constraints of a list operation. + * Specify the constraint by the format of "key=value", where key must be + * "src" or "tgt", and the value must be a valid language code. + * For multiple restrictions, concatenate them by "AND" (uppercase only), + * such as: "src=en-US AND tgt=zh-CN". Notice that the exact match is used + * here, which means using 'en-US' and 'en' can lead to different results, + * which depends on the language code you used when you create the glossary. + * For the unidirectional glossaries, the "src" and "tgt" add restrictions + * on the source and target language code separately. + * For the equivalent term set glossaries, the "src" and/or "tgt" add + * restrictions on the term set. + * For example: "src=en-US AND tgt=zh-CN" will only pick the unidirectional + * glossaries which exactly match the source language code as "en-US" and the + * target language code "zh-CN", but all equivalent term set glossaries which + * contain "en-US" and "zh-CN" in their language set will be picked. + * If missing, no filtering is performed. + * + * Generated from protobuf field string filter = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getFilter() + { + return $this->filter; + } + + /** + * Optional. Filter specifying constraints of a list operation. + * Specify the constraint by the format of "key=value", where key must be + * "src" or "tgt", and the value must be a valid language code. + * For multiple restrictions, concatenate them by "AND" (uppercase only), + * such as: "src=en-US AND tgt=zh-CN". Notice that the exact match is used + * here, which means using 'en-US' and 'en' can lead to different results, + * which depends on the language code you used when you create the glossary. + * For the unidirectional glossaries, the "src" and "tgt" add restrictions + * on the source and target language code separately. + * For the equivalent term set glossaries, the "src" and/or "tgt" add + * restrictions on the term set. + * For example: "src=en-US AND tgt=zh-CN" will only pick the unidirectional + * glossaries which exactly match the source language code as "en-US" and the + * target language code "zh-CN", but all equivalent term set glossaries which + * contain "en-US" and "zh-CN" in their language set will be picked. + * If missing, no filtering is performed. + * + * Generated from protobuf field string filter = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setFilter($var) + { + GPBUtil::checkString($var, True); + $this->filter = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/ListGlossariesResponse.php b/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/ListGlossariesResponse.php new file mode 100644 index 00000000000..4671da068fa --- /dev/null +++ b/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/ListGlossariesResponse.php @@ -0,0 +1,109 @@ +google.cloud.translation.v3.ListGlossariesResponse + */ +class ListGlossariesResponse extends \Google\Protobuf\Internal\Message +{ + /** + * The list of glossaries for a project. + * + * Generated from protobuf field repeated .google.cloud.translation.v3.Glossary glossaries = 1; + */ + private $glossaries; + /** + * A token to retrieve a page of results. Pass this value in the + * [ListGlossariesRequest.page_token] field in the subsequent call to + * `ListGlossaries` method to retrieve the next page of results. + * + * Generated from protobuf field string next_page_token = 2; + */ + protected $next_page_token = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array<\Google\Cloud\Translate\V3\Glossary>|\Google\Protobuf\Internal\RepeatedField $glossaries + * The list of glossaries for a project. + * @type string $next_page_token + * A token to retrieve a page of results. Pass this value in the + * [ListGlossariesRequest.page_token] field in the subsequent call to + * `ListGlossaries` method to retrieve the next page of results. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Translate\V3\TranslationService::initOnce(); + parent::__construct($data); + } + + /** + * The list of glossaries for a project. + * + * Generated from protobuf field repeated .google.cloud.translation.v3.Glossary glossaries = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getGlossaries() + { + return $this->glossaries; + } + + /** + * The list of glossaries for a project. + * + * Generated from protobuf field repeated .google.cloud.translation.v3.Glossary glossaries = 1; + * @param array<\Google\Cloud\Translate\V3\Glossary>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setGlossaries($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Translate\V3\Glossary::class); + $this->glossaries = $arr; + + return $this; + } + + /** + * A token to retrieve a page of results. Pass this value in the + * [ListGlossariesRequest.page_token] field in the subsequent call to + * `ListGlossaries` method to retrieve the next page of results. + * + * Generated from protobuf field string next_page_token = 2; + * @return string + */ + public function getNextPageToken() + { + return $this->next_page_token; + } + + /** + * A token to retrieve a page of results. Pass this value in the + * [ListGlossariesRequest.page_token] field in the subsequent call to + * `ListGlossaries` method to retrieve the next page of results. + * + * Generated from protobuf field string next_page_token = 2; + * @param string $var + * @return $this + */ + public function setNextPageToken($var) + { + GPBUtil::checkString($var, True); + $this->next_page_token = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/OutputConfig.php b/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/OutputConfig.php new file mode 100644 index 00000000000..4059eea266f --- /dev/null +++ b/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/OutputConfig.php @@ -0,0 +1,249 @@ +google.cloud.translation.v3.OutputConfig + */ +class OutputConfig extends \Google\Protobuf\Internal\Message +{ + protected $destination; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\Translate\V3\GcsDestination $gcs_destination + * Google Cloud Storage destination for output content. + * For every single input file (for example, gs://a/b/c.[extension]), we + * generate at most 2 * n output files. (n is the # of target_language_codes + * in the BatchTranslateTextRequest). + * Output files (tsv) generated are compliant with RFC 4180 except that + * record delimiters are '\n' instead of '\r\n'. We don't provide any way to + * change record delimiters. + * While the input files are being processed, we write/update an index file + * 'index.csv' under 'output_uri_prefix' (for example, + * gs://translation-test/index.csv) The index file is generated/updated as + * new files are being translated. The format is: + * input_file,target_language_code,translations_file,errors_file, + * glossary_translations_file,glossary_errors_file + * input_file is one file we matched using gcs_source.input_uri. + * target_language_code is provided in the request. + * translations_file contains the translations. (details provided below) + * errors_file contains the errors during processing of the file. (details + * below). Both translations_file and errors_file could be empty + * strings if we have no content to output. + * glossary_translations_file and glossary_errors_file are always empty + * strings if the input_file is tsv. They could also be empty if we have no + * content to output. + * Once a row is present in index.csv, the input/output matching never + * changes. Callers should also expect all the content in input_file are + * processed and ready to be consumed (that is, no partial output file is + * written). + * Since index.csv will be keeping updated during the process, please make + * sure there is no custom retention policy applied on the output bucket + * that may avoid file updating. + * (https://cloud.google.com/storage/docs/bucket-lock#retention-policy) + * The format of translations_file (for target language code 'trg') is: + * `gs://translation_test/a_b_c_'trg'_translations.[extension]` + * If the input file extension is tsv, the output has the following + * columns: + * Column 1: ID of the request provided in the input, if it's not + * provided in the input, then the input row number is used (0-based). + * Column 2: source sentence. + * Column 3: translation without applying a glossary. Empty string if there + * is an error. + * Column 4 (only present if a glossary is provided in the request): + * translation after applying the glossary. Empty string if there is an + * error applying the glossary. Could be same string as column 3 if there is + * no glossary applied. + * If input file extension is a txt or html, the translation is directly + * written to the output file. If glossary is requested, a separate + * glossary_translations_file has format of + * gs://translation_test/a_b_c_'trg'_glossary_translations.[extension] + * The format of errors file (for target language code 'trg') is: + * gs://translation_test/a_b_c_'trg'_errors.[extension] + * If the input file extension is tsv, errors_file contains the following: + * Column 1: ID of the request provided in the input, if it's not + * provided in the input, then the input row number is used (0-based). + * Column 2: source sentence. + * Column 3: Error detail for the translation. Could be empty. + * Column 4 (only present if a glossary is provided in the request): + * Error when applying the glossary. + * If the input file extension is txt or html, glossary_error_file will be + * generated that contains error details. glossary_error_file has format of + * gs://translation_test/a_b_c_'trg'_glossary_errors.[extension] + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Translate\V3\TranslationService::initOnce(); + parent::__construct($data); + } + + /** + * Google Cloud Storage destination for output content. + * For every single input file (for example, gs://a/b/c.[extension]), we + * generate at most 2 * n output files. (n is the # of target_language_codes + * in the BatchTranslateTextRequest). + * Output files (tsv) generated are compliant with RFC 4180 except that + * record delimiters are '\n' instead of '\r\n'. We don't provide any way to + * change record delimiters. + * While the input files are being processed, we write/update an index file + * 'index.csv' under 'output_uri_prefix' (for example, + * gs://translation-test/index.csv) The index file is generated/updated as + * new files are being translated. The format is: + * input_file,target_language_code,translations_file,errors_file, + * glossary_translations_file,glossary_errors_file + * input_file is one file we matched using gcs_source.input_uri. + * target_language_code is provided in the request. + * translations_file contains the translations. (details provided below) + * errors_file contains the errors during processing of the file. (details + * below). Both translations_file and errors_file could be empty + * strings if we have no content to output. + * glossary_translations_file and glossary_errors_file are always empty + * strings if the input_file is tsv. They could also be empty if we have no + * content to output. + * Once a row is present in index.csv, the input/output matching never + * changes. Callers should also expect all the content in input_file are + * processed and ready to be consumed (that is, no partial output file is + * written). + * Since index.csv will be keeping updated during the process, please make + * sure there is no custom retention policy applied on the output bucket + * that may avoid file updating. + * (https://cloud.google.com/storage/docs/bucket-lock#retention-policy) + * The format of translations_file (for target language code 'trg') is: + * `gs://translation_test/a_b_c_'trg'_translations.[extension]` + * If the input file extension is tsv, the output has the following + * columns: + * Column 1: ID of the request provided in the input, if it's not + * provided in the input, then the input row number is used (0-based). + * Column 2: source sentence. + * Column 3: translation without applying a glossary. Empty string if there + * is an error. + * Column 4 (only present if a glossary is provided in the request): + * translation after applying the glossary. Empty string if there is an + * error applying the glossary. Could be same string as column 3 if there is + * no glossary applied. + * If input file extension is a txt or html, the translation is directly + * written to the output file. If glossary is requested, a separate + * glossary_translations_file has format of + * gs://translation_test/a_b_c_'trg'_glossary_translations.[extension] + * The format of errors file (for target language code 'trg') is: + * gs://translation_test/a_b_c_'trg'_errors.[extension] + * If the input file extension is tsv, errors_file contains the following: + * Column 1: ID of the request provided in the input, if it's not + * provided in the input, then the input row number is used (0-based). + * Column 2: source sentence. + * Column 3: Error detail for the translation. Could be empty. + * Column 4 (only present if a glossary is provided in the request): + * Error when applying the glossary. + * If the input file extension is txt or html, glossary_error_file will be + * generated that contains error details. glossary_error_file has format of + * gs://translation_test/a_b_c_'trg'_glossary_errors.[extension] + * + * Generated from protobuf field .google.cloud.translation.v3.GcsDestination gcs_destination = 1; + * @return \Google\Cloud\Translate\V3\GcsDestination|null + */ + public function getGcsDestination() + { + return $this->readOneof(1); + } + + public function hasGcsDestination() + { + return $this->hasOneof(1); + } + + /** + * Google Cloud Storage destination for output content. + * For every single input file (for example, gs://a/b/c.[extension]), we + * generate at most 2 * n output files. (n is the # of target_language_codes + * in the BatchTranslateTextRequest). + * Output files (tsv) generated are compliant with RFC 4180 except that + * record delimiters are '\n' instead of '\r\n'. We don't provide any way to + * change record delimiters. + * While the input files are being processed, we write/update an index file + * 'index.csv' under 'output_uri_prefix' (for example, + * gs://translation-test/index.csv) The index file is generated/updated as + * new files are being translated. The format is: + * input_file,target_language_code,translations_file,errors_file, + * glossary_translations_file,glossary_errors_file + * input_file is one file we matched using gcs_source.input_uri. + * target_language_code is provided in the request. + * translations_file contains the translations. (details provided below) + * errors_file contains the errors during processing of the file. (details + * below). Both translations_file and errors_file could be empty + * strings if we have no content to output. + * glossary_translations_file and glossary_errors_file are always empty + * strings if the input_file is tsv. They could also be empty if we have no + * content to output. + * Once a row is present in index.csv, the input/output matching never + * changes. Callers should also expect all the content in input_file are + * processed and ready to be consumed (that is, no partial output file is + * written). + * Since index.csv will be keeping updated during the process, please make + * sure there is no custom retention policy applied on the output bucket + * that may avoid file updating. + * (https://cloud.google.com/storage/docs/bucket-lock#retention-policy) + * The format of translations_file (for target language code 'trg') is: + * `gs://translation_test/a_b_c_'trg'_translations.[extension]` + * If the input file extension is tsv, the output has the following + * columns: + * Column 1: ID of the request provided in the input, if it's not + * provided in the input, then the input row number is used (0-based). + * Column 2: source sentence. + * Column 3: translation without applying a glossary. Empty string if there + * is an error. + * Column 4 (only present if a glossary is provided in the request): + * translation after applying the glossary. Empty string if there is an + * error applying the glossary. Could be same string as column 3 if there is + * no glossary applied. + * If input file extension is a txt or html, the translation is directly + * written to the output file. If glossary is requested, a separate + * glossary_translations_file has format of + * gs://translation_test/a_b_c_'trg'_glossary_translations.[extension] + * The format of errors file (for target language code 'trg') is: + * gs://translation_test/a_b_c_'trg'_errors.[extension] + * If the input file extension is tsv, errors_file contains the following: + * Column 1: ID of the request provided in the input, if it's not + * provided in the input, then the input row number is used (0-based). + * Column 2: source sentence. + * Column 3: Error detail for the translation. Could be empty. + * Column 4 (only present if a glossary is provided in the request): + * Error when applying the glossary. + * If the input file extension is txt or html, glossary_error_file will be + * generated that contains error details. glossary_error_file has format of + * gs://translation_test/a_b_c_'trg'_glossary_errors.[extension] + * + * Generated from protobuf field .google.cloud.translation.v3.GcsDestination gcs_destination = 1; + * @param \Google\Cloud\Translate\V3\GcsDestination $var + * @return $this + */ + public function setGcsDestination($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Translate\V3\GcsDestination::class); + $this->writeOneof(1, $var); + + return $this; + } + + /** + * @return string + */ + public function getDestination() + { + return $this->whichOneof("destination"); + } + +} + diff --git a/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/SupportedLanguage.php b/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/SupportedLanguage.php new file mode 100644 index 00000000000..cfb8756c2c1 --- /dev/null +++ b/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/SupportedLanguage.php @@ -0,0 +1,186 @@ +google.cloud.translation.v3.SupportedLanguage + */ +class SupportedLanguage extends \Google\Protobuf\Internal\Message +{ + /** + * Supported language code, generally consisting of its ISO 639-1 + * identifier, for example, 'en', 'ja'. In certain cases, ISO-639 codes + * including language and region identifiers are returned (for example, + * 'zh-TW' and 'zh-CN'). + * + * Generated from protobuf field string language_code = 1; + */ + protected $language_code = ''; + /** + * Human-readable name of the language localized in the display language + * specified in the request. + * + * Generated from protobuf field string display_name = 2; + */ + protected $display_name = ''; + /** + * Can be used as a source language. + * + * Generated from protobuf field bool support_source = 3; + */ + protected $support_source = false; + /** + * Can be used as a target language. + * + * Generated from protobuf field bool support_target = 4; + */ + protected $support_target = false; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $language_code + * Supported language code, generally consisting of its ISO 639-1 + * identifier, for example, 'en', 'ja'. In certain cases, ISO-639 codes + * including language and region identifiers are returned (for example, + * 'zh-TW' and 'zh-CN'). + * @type string $display_name + * Human-readable name of the language localized in the display language + * specified in the request. + * @type bool $support_source + * Can be used as a source language. + * @type bool $support_target + * Can be used as a target language. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Translate\V3\TranslationService::initOnce(); + parent::__construct($data); + } + + /** + * Supported language code, generally consisting of its ISO 639-1 + * identifier, for example, 'en', 'ja'. In certain cases, ISO-639 codes + * including language and region identifiers are returned (for example, + * 'zh-TW' and 'zh-CN'). + * + * Generated from protobuf field string language_code = 1; + * @return string + */ + public function getLanguageCode() + { + return $this->language_code; + } + + /** + * Supported language code, generally consisting of its ISO 639-1 + * identifier, for example, 'en', 'ja'. In certain cases, ISO-639 codes + * including language and region identifiers are returned (for example, + * 'zh-TW' and 'zh-CN'). + * + * Generated from protobuf field string language_code = 1; + * @param string $var + * @return $this + */ + public function setLanguageCode($var) + { + GPBUtil::checkString($var, True); + $this->language_code = $var; + + return $this; + } + + /** + * Human-readable name of the language localized in the display language + * specified in the request. + * + * Generated from protobuf field string display_name = 2; + * @return string + */ + public function getDisplayName() + { + return $this->display_name; + } + + /** + * Human-readable name of the language localized in the display language + * specified in the request. + * + * Generated from protobuf field string display_name = 2; + * @param string $var + * @return $this + */ + public function setDisplayName($var) + { + GPBUtil::checkString($var, True); + $this->display_name = $var; + + return $this; + } + + /** + * Can be used as a source language. + * + * Generated from protobuf field bool support_source = 3; + * @return bool + */ + public function getSupportSource() + { + return $this->support_source; + } + + /** + * Can be used as a source language. + * + * Generated from protobuf field bool support_source = 3; + * @param bool $var + * @return $this + */ + public function setSupportSource($var) + { + GPBUtil::checkBool($var); + $this->support_source = $var; + + return $this; + } + + /** + * Can be used as a target language. + * + * Generated from protobuf field bool support_target = 4; + * @return bool + */ + public function getSupportTarget() + { + return $this->support_target; + } + + /** + * Can be used as a target language. + * + * Generated from protobuf field bool support_target = 4; + * @param bool $var + * @return $this + */ + public function setSupportTarget($var) + { + GPBUtil::checkBool($var); + $this->support_target = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/SupportedLanguages.php b/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/SupportedLanguages.php new file mode 100644 index 00000000000..1bfb36123e5 --- /dev/null +++ b/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/SupportedLanguages.php @@ -0,0 +1,71 @@ +google.cloud.translation.v3.SupportedLanguages + */ +class SupportedLanguages extends \Google\Protobuf\Internal\Message +{ + /** + * A list of supported language responses. This list contains an entry + * for each language the Translation API supports. + * + * Generated from protobuf field repeated .google.cloud.translation.v3.SupportedLanguage languages = 1; + */ + private $languages; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array<\Google\Cloud\Translate\V3\SupportedLanguage>|\Google\Protobuf\Internal\RepeatedField $languages + * A list of supported language responses. This list contains an entry + * for each language the Translation API supports. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Translate\V3\TranslationService::initOnce(); + parent::__construct($data); + } + + /** + * A list of supported language responses. This list contains an entry + * for each language the Translation API supports. + * + * Generated from protobuf field repeated .google.cloud.translation.v3.SupportedLanguage languages = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getLanguages() + { + return $this->languages; + } + + /** + * A list of supported language responses. This list contains an entry + * for each language the Translation API supports. + * + * Generated from protobuf field repeated .google.cloud.translation.v3.SupportedLanguage languages = 1; + * @param array<\Google\Cloud\Translate\V3\SupportedLanguage>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setLanguages($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Translate\V3\SupportedLanguage::class); + $this->languages = $arr; + + return $this; + } + +} + diff --git a/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/TranslateDocumentRequest.php b/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/TranslateDocumentRequest.php new file mode 100644 index 00000000000..e71340e67d6 --- /dev/null +++ b/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/TranslateDocumentRequest.php @@ -0,0 +1,593 @@ +google.cloud.translation.v3.TranslateDocumentRequest + */ +class TranslateDocumentRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. Location to make a regional call. + * Format: `projects/{project-number-or-id}/locations/{location-id}`. + * For global calls, use `projects/{project-number-or-id}/locations/global` or + * `projects/{project-number-or-id}`. + * Non-global location is required for requests using AutoML models or custom + * glossaries. + * Models and glossaries must be within the same region (have the same + * location-id), otherwise an INVALID_ARGUMENT (400) error is returned. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $parent = ''; + /** + * Optional. The ISO-639 language code of the input document if known, for + * example, "en-US" or "sr-Latn". Supported language codes are listed in + * Language Support. If the source language isn't specified, the API attempts + * to identify the source language automatically and returns the source + * language within the response. Source language must be specified if the + * request contains a glossary or a custom model. + * + * Generated from protobuf field string source_language_code = 2 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $source_language_code = ''; + /** + * Required. The ISO-639 language code to use for translation of the input + * document, set to one of the language codes listed in Language Support. + * + * Generated from protobuf field string target_language_code = 3 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $target_language_code = ''; + /** + * Required. Input configurations. + * + * Generated from protobuf field .google.cloud.translation.v3.DocumentInputConfig document_input_config = 4 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $document_input_config = null; + /** + * Optional. Output configurations. + * Defines if the output file should be stored within Cloud Storage as well + * as the desired output format. If not provided the translated file will + * only be returned through a byte-stream and its output mime type will be + * the same as the input file's mime type. + * + * Generated from protobuf field .google.cloud.translation.v3.DocumentOutputConfig document_output_config = 5 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $document_output_config = null; + /** + * Optional. The `model` type requested for this translation. + * The format depends on model type: + * - AutoML Translation models: + * `projects/{project-number-or-id}/locations/{location-id}/models/{model-id}` + * - General (built-in) models: + * `projects/{project-number-or-id}/locations/{location-id}/models/general/nmt`, + * If not provided, the default Google model (NMT) will be used for + * translation. + * + * Generated from protobuf field string model = 6 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $model = ''; + /** + * Optional. Glossary to be applied. The glossary must be within the same + * region (have the same location-id) as the model, otherwise an + * INVALID_ARGUMENT (400) error is returned. + * + * Generated from protobuf field .google.cloud.translation.v3.TranslateTextGlossaryConfig glossary_config = 7 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $glossary_config = null; + /** + * Optional. The labels with user-defined metadata for the request. + * Label keys and values can be no longer than 63 characters (Unicode + * codepoints), can only contain lowercase letters, numeric characters, + * underscores and dashes. International characters are allowed. Label values + * are optional. Label keys must start with a letter. + * See https://cloud.google.com/translate/docs/advanced/labels for more + * information. + * + * Generated from protobuf field map labels = 8 [(.google.api.field_behavior) = OPTIONAL]; + */ + private $labels; + /** + * Optional. This flag is to support user customized attribution. + * If not provided, the default is `Machine Translated by Google`. + * Customized attribution should follow rules in + * https://cloud.google.com/translate/attribution#attribution_and_logos + * + * Generated from protobuf field string customized_attribution = 10 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $customized_attribution = ''; + /** + * Optional. If true, the page limit of online native pdf translation is 300 + * and only native pdf pages will be translated. + * + * Generated from protobuf field bool is_translate_native_pdf_only = 11 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $is_translate_native_pdf_only = false; + /** + * Optional. If true, use the text removal to remove the shadow text on + * background image for native pdf translation. + * Shadow removal feature can only be enabled when + * is_translate_native_pdf_only is false + * + * Generated from protobuf field bool enable_shadow_removal_native_pdf = 12 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $enable_shadow_removal_native_pdf = false; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $parent + * Required. Location to make a regional call. + * Format: `projects/{project-number-or-id}/locations/{location-id}`. + * For global calls, use `projects/{project-number-or-id}/locations/global` or + * `projects/{project-number-or-id}`. + * Non-global location is required for requests using AutoML models or custom + * glossaries. + * Models and glossaries must be within the same region (have the same + * location-id), otherwise an INVALID_ARGUMENT (400) error is returned. + * @type string $source_language_code + * Optional. The ISO-639 language code of the input document if known, for + * example, "en-US" or "sr-Latn". Supported language codes are listed in + * Language Support. If the source language isn't specified, the API attempts + * to identify the source language automatically and returns the source + * language within the response. Source language must be specified if the + * request contains a glossary or a custom model. + * @type string $target_language_code + * Required. The ISO-639 language code to use for translation of the input + * document, set to one of the language codes listed in Language Support. + * @type \Google\Cloud\Translate\V3\DocumentInputConfig $document_input_config + * Required. Input configurations. + * @type \Google\Cloud\Translate\V3\DocumentOutputConfig $document_output_config + * Optional. Output configurations. + * Defines if the output file should be stored within Cloud Storage as well + * as the desired output format. If not provided the translated file will + * only be returned through a byte-stream and its output mime type will be + * the same as the input file's mime type. + * @type string $model + * Optional. The `model` type requested for this translation. + * The format depends on model type: + * - AutoML Translation models: + * `projects/{project-number-or-id}/locations/{location-id}/models/{model-id}` + * - General (built-in) models: + * `projects/{project-number-or-id}/locations/{location-id}/models/general/nmt`, + * If not provided, the default Google model (NMT) will be used for + * translation. + * @type \Google\Cloud\Translate\V3\TranslateTextGlossaryConfig $glossary_config + * Optional. Glossary to be applied. The glossary must be within the same + * region (have the same location-id) as the model, otherwise an + * INVALID_ARGUMENT (400) error is returned. + * @type array|\Google\Protobuf\Internal\MapField $labels + * Optional. The labels with user-defined metadata for the request. + * Label keys and values can be no longer than 63 characters (Unicode + * codepoints), can only contain lowercase letters, numeric characters, + * underscores and dashes. International characters are allowed. Label values + * are optional. Label keys must start with a letter. + * See https://cloud.google.com/translate/docs/advanced/labels for more + * information. + * @type string $customized_attribution + * Optional. This flag is to support user customized attribution. + * If not provided, the default is `Machine Translated by Google`. + * Customized attribution should follow rules in + * https://cloud.google.com/translate/attribution#attribution_and_logos + * @type bool $is_translate_native_pdf_only + * Optional. If true, the page limit of online native pdf translation is 300 + * and only native pdf pages will be translated. + * @type bool $enable_shadow_removal_native_pdf + * Optional. If true, use the text removal to remove the shadow text on + * background image for native pdf translation. + * Shadow removal feature can only be enabled when + * is_translate_native_pdf_only is false + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Translate\V3\TranslationService::initOnce(); + parent::__construct($data); + } + + /** + * Required. Location to make a regional call. + * Format: `projects/{project-number-or-id}/locations/{location-id}`. + * For global calls, use `projects/{project-number-or-id}/locations/global` or + * `projects/{project-number-or-id}`. + * Non-global location is required for requests using AutoML models or custom + * glossaries. + * Models and glossaries must be within the same region (have the same + * location-id), otherwise an INVALID_ARGUMENT (400) error is returned. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getParent() + { + return $this->parent; + } + + /** + * Required. Location to make a regional call. + * Format: `projects/{project-number-or-id}/locations/{location-id}`. + * For global calls, use `projects/{project-number-or-id}/locations/global` or + * `projects/{project-number-or-id}`. + * Non-global location is required for requests using AutoML models or custom + * glossaries. + * Models and glossaries must be within the same region (have the same + * location-id), otherwise an INVALID_ARGUMENT (400) error is returned. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setParent($var) + { + GPBUtil::checkString($var, True); + $this->parent = $var; + + return $this; + } + + /** + * Optional. The ISO-639 language code of the input document if known, for + * example, "en-US" or "sr-Latn". Supported language codes are listed in + * Language Support. If the source language isn't specified, the API attempts + * to identify the source language automatically and returns the source + * language within the response. Source language must be specified if the + * request contains a glossary or a custom model. + * + * Generated from protobuf field string source_language_code = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getSourceLanguageCode() + { + return $this->source_language_code; + } + + /** + * Optional. The ISO-639 language code of the input document if known, for + * example, "en-US" or "sr-Latn". Supported language codes are listed in + * Language Support. If the source language isn't specified, the API attempts + * to identify the source language automatically and returns the source + * language within the response. Source language must be specified if the + * request contains a glossary or a custom model. + * + * Generated from protobuf field string source_language_code = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setSourceLanguageCode($var) + { + GPBUtil::checkString($var, True); + $this->source_language_code = $var; + + return $this; + } + + /** + * Required. The ISO-639 language code to use for translation of the input + * document, set to one of the language codes listed in Language Support. + * + * Generated from protobuf field string target_language_code = 3 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getTargetLanguageCode() + { + return $this->target_language_code; + } + + /** + * Required. The ISO-639 language code to use for translation of the input + * document, set to one of the language codes listed in Language Support. + * + * Generated from protobuf field string target_language_code = 3 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setTargetLanguageCode($var) + { + GPBUtil::checkString($var, True); + $this->target_language_code = $var; + + return $this; + } + + /** + * Required. Input configurations. + * + * Generated from protobuf field .google.cloud.translation.v3.DocumentInputConfig document_input_config = 4 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Cloud\Translate\V3\DocumentInputConfig|null + */ + public function getDocumentInputConfig() + { + return $this->document_input_config; + } + + public function hasDocumentInputConfig() + { + return isset($this->document_input_config); + } + + public function clearDocumentInputConfig() + { + unset($this->document_input_config); + } + + /** + * Required. Input configurations. + * + * Generated from protobuf field .google.cloud.translation.v3.DocumentInputConfig document_input_config = 4 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Cloud\Translate\V3\DocumentInputConfig $var + * @return $this + */ + public function setDocumentInputConfig($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Translate\V3\DocumentInputConfig::class); + $this->document_input_config = $var; + + return $this; + } + + /** + * Optional. Output configurations. + * Defines if the output file should be stored within Cloud Storage as well + * as the desired output format. If not provided the translated file will + * only be returned through a byte-stream and its output mime type will be + * the same as the input file's mime type. + * + * Generated from protobuf field .google.cloud.translation.v3.DocumentOutputConfig document_output_config = 5 [(.google.api.field_behavior) = OPTIONAL]; + * @return \Google\Cloud\Translate\V3\DocumentOutputConfig|null + */ + public function getDocumentOutputConfig() + { + return $this->document_output_config; + } + + public function hasDocumentOutputConfig() + { + return isset($this->document_output_config); + } + + public function clearDocumentOutputConfig() + { + unset($this->document_output_config); + } + + /** + * Optional. Output configurations. + * Defines if the output file should be stored within Cloud Storage as well + * as the desired output format. If not provided the translated file will + * only be returned through a byte-stream and its output mime type will be + * the same as the input file's mime type. + * + * Generated from protobuf field .google.cloud.translation.v3.DocumentOutputConfig document_output_config = 5 [(.google.api.field_behavior) = OPTIONAL]; + * @param \Google\Cloud\Translate\V3\DocumentOutputConfig $var + * @return $this + */ + public function setDocumentOutputConfig($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Translate\V3\DocumentOutputConfig::class); + $this->document_output_config = $var; + + return $this; + } + + /** + * Optional. The `model` type requested for this translation. + * The format depends on model type: + * - AutoML Translation models: + * `projects/{project-number-or-id}/locations/{location-id}/models/{model-id}` + * - General (built-in) models: + * `projects/{project-number-or-id}/locations/{location-id}/models/general/nmt`, + * If not provided, the default Google model (NMT) will be used for + * translation. + * + * Generated from protobuf field string model = 6 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getModel() + { + return $this->model; + } + + /** + * Optional. The `model` type requested for this translation. + * The format depends on model type: + * - AutoML Translation models: + * `projects/{project-number-or-id}/locations/{location-id}/models/{model-id}` + * - General (built-in) models: + * `projects/{project-number-or-id}/locations/{location-id}/models/general/nmt`, + * If not provided, the default Google model (NMT) will be used for + * translation. + * + * Generated from protobuf field string model = 6 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setModel($var) + { + GPBUtil::checkString($var, True); + $this->model = $var; + + return $this; + } + + /** + * Optional. Glossary to be applied. The glossary must be within the same + * region (have the same location-id) as the model, otherwise an + * INVALID_ARGUMENT (400) error is returned. + * + * Generated from protobuf field .google.cloud.translation.v3.TranslateTextGlossaryConfig glossary_config = 7 [(.google.api.field_behavior) = OPTIONAL]; + * @return \Google\Cloud\Translate\V3\TranslateTextGlossaryConfig|null + */ + public function getGlossaryConfig() + { + return $this->glossary_config; + } + + public function hasGlossaryConfig() + { + return isset($this->glossary_config); + } + + public function clearGlossaryConfig() + { + unset($this->glossary_config); + } + + /** + * Optional. Glossary to be applied. The glossary must be within the same + * region (have the same location-id) as the model, otherwise an + * INVALID_ARGUMENT (400) error is returned. + * + * Generated from protobuf field .google.cloud.translation.v3.TranslateTextGlossaryConfig glossary_config = 7 [(.google.api.field_behavior) = OPTIONAL]; + * @param \Google\Cloud\Translate\V3\TranslateTextGlossaryConfig $var + * @return $this + */ + public function setGlossaryConfig($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Translate\V3\TranslateTextGlossaryConfig::class); + $this->glossary_config = $var; + + return $this; + } + + /** + * Optional. The labels with user-defined metadata for the request. + * Label keys and values can be no longer than 63 characters (Unicode + * codepoints), can only contain lowercase letters, numeric characters, + * underscores and dashes. International characters are allowed. Label values + * are optional. Label keys must start with a letter. + * See https://cloud.google.com/translate/docs/advanced/labels for more + * information. + * + * Generated from protobuf field map labels = 8 [(.google.api.field_behavior) = OPTIONAL]; + * @return \Google\Protobuf\Internal\MapField + */ + public function getLabels() + { + return $this->labels; + } + + /** + * Optional. The labels with user-defined metadata for the request. + * Label keys and values can be no longer than 63 characters (Unicode + * codepoints), can only contain lowercase letters, numeric characters, + * underscores and dashes. International characters are allowed. Label values + * are optional. Label keys must start with a letter. + * See https://cloud.google.com/translate/docs/advanced/labels for more + * information. + * + * Generated from protobuf field map labels = 8 [(.google.api.field_behavior) = OPTIONAL]; + * @param array|\Google\Protobuf\Internal\MapField $var + * @return $this + */ + public function setLabels($var) + { + $arr = GPBUtil::checkMapField($var, \Google\Protobuf\Internal\GPBType::STRING, \Google\Protobuf\Internal\GPBType::STRING); + $this->labels = $arr; + + return $this; + } + + /** + * Optional. This flag is to support user customized attribution. + * If not provided, the default is `Machine Translated by Google`. + * Customized attribution should follow rules in + * https://cloud.google.com/translate/attribution#attribution_and_logos + * + * Generated from protobuf field string customized_attribution = 10 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getCustomizedAttribution() + { + return $this->customized_attribution; + } + + /** + * Optional. This flag is to support user customized attribution. + * If not provided, the default is `Machine Translated by Google`. + * Customized attribution should follow rules in + * https://cloud.google.com/translate/attribution#attribution_and_logos + * + * Generated from protobuf field string customized_attribution = 10 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setCustomizedAttribution($var) + { + GPBUtil::checkString($var, True); + $this->customized_attribution = $var; + + return $this; + } + + /** + * Optional. If true, the page limit of online native pdf translation is 300 + * and only native pdf pages will be translated. + * + * Generated from protobuf field bool is_translate_native_pdf_only = 11 [(.google.api.field_behavior) = OPTIONAL]; + * @return bool + */ + public function getIsTranslateNativePdfOnly() + { + return $this->is_translate_native_pdf_only; + } + + /** + * Optional. If true, the page limit of online native pdf translation is 300 + * and only native pdf pages will be translated. + * + * Generated from protobuf field bool is_translate_native_pdf_only = 11 [(.google.api.field_behavior) = OPTIONAL]; + * @param bool $var + * @return $this + */ + public function setIsTranslateNativePdfOnly($var) + { + GPBUtil::checkBool($var); + $this->is_translate_native_pdf_only = $var; + + return $this; + } + + /** + * Optional. If true, use the text removal to remove the shadow text on + * background image for native pdf translation. + * Shadow removal feature can only be enabled when + * is_translate_native_pdf_only is false + * + * Generated from protobuf field bool enable_shadow_removal_native_pdf = 12 [(.google.api.field_behavior) = OPTIONAL]; + * @return bool + */ + public function getEnableShadowRemovalNativePdf() + { + return $this->enable_shadow_removal_native_pdf; + } + + /** + * Optional. If true, use the text removal to remove the shadow text on + * background image for native pdf translation. + * Shadow removal feature can only be enabled when + * is_translate_native_pdf_only is false + * + * Generated from protobuf field bool enable_shadow_removal_native_pdf = 12 [(.google.api.field_behavior) = OPTIONAL]; + * @param bool $var + * @return $this + */ + public function setEnableShadowRemovalNativePdf($var) + { + GPBUtil::checkBool($var); + $this->enable_shadow_removal_native_pdf = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/TranslateDocumentResponse.php b/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/TranslateDocumentResponse.php new file mode 100644 index 00000000000..cb03652f953 --- /dev/null +++ b/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/TranslateDocumentResponse.php @@ -0,0 +1,231 @@ +google.cloud.translation.v3.TranslateDocumentResponse + */ +class TranslateDocumentResponse extends \Google\Protobuf\Internal\Message +{ + /** + * Translated document. + * + * Generated from protobuf field .google.cloud.translation.v3.DocumentTranslation document_translation = 1; + */ + protected $document_translation = null; + /** + * The document's translation output if a glossary is provided in the request. + * This can be the same as [TranslateDocumentResponse.document_translation] + * if no glossary terms apply. + * + * Generated from protobuf field .google.cloud.translation.v3.DocumentTranslation glossary_document_translation = 2; + */ + protected $glossary_document_translation = null; + /** + * Only present when 'model' is present in the request. + * 'model' is normalized to have a project number. + * For example: + * If the 'model' field in TranslateDocumentRequest is: + * `projects/{project-id}/locations/{location-id}/models/general/nmt` then + * `model` here would be normalized to + * `projects/{project-number}/locations/{location-id}/models/general/nmt`. + * + * Generated from protobuf field string model = 3; + */ + protected $model = ''; + /** + * The `glossary_config` used for this translation. + * + * Generated from protobuf field .google.cloud.translation.v3.TranslateTextGlossaryConfig glossary_config = 4; + */ + protected $glossary_config = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\Translate\V3\DocumentTranslation $document_translation + * Translated document. + * @type \Google\Cloud\Translate\V3\DocumentTranslation $glossary_document_translation + * The document's translation output if a glossary is provided in the request. + * This can be the same as [TranslateDocumentResponse.document_translation] + * if no glossary terms apply. + * @type string $model + * Only present when 'model' is present in the request. + * 'model' is normalized to have a project number. + * For example: + * If the 'model' field in TranslateDocumentRequest is: + * `projects/{project-id}/locations/{location-id}/models/general/nmt` then + * `model` here would be normalized to + * `projects/{project-number}/locations/{location-id}/models/general/nmt`. + * @type \Google\Cloud\Translate\V3\TranslateTextGlossaryConfig $glossary_config + * The `glossary_config` used for this translation. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Translate\V3\TranslationService::initOnce(); + parent::__construct($data); + } + + /** + * Translated document. + * + * Generated from protobuf field .google.cloud.translation.v3.DocumentTranslation document_translation = 1; + * @return \Google\Cloud\Translate\V3\DocumentTranslation|null + */ + public function getDocumentTranslation() + { + return $this->document_translation; + } + + public function hasDocumentTranslation() + { + return isset($this->document_translation); + } + + public function clearDocumentTranslation() + { + unset($this->document_translation); + } + + /** + * Translated document. + * + * Generated from protobuf field .google.cloud.translation.v3.DocumentTranslation document_translation = 1; + * @param \Google\Cloud\Translate\V3\DocumentTranslation $var + * @return $this + */ + public function setDocumentTranslation($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Translate\V3\DocumentTranslation::class); + $this->document_translation = $var; + + return $this; + } + + /** + * The document's translation output if a glossary is provided in the request. + * This can be the same as [TranslateDocumentResponse.document_translation] + * if no glossary terms apply. + * + * Generated from protobuf field .google.cloud.translation.v3.DocumentTranslation glossary_document_translation = 2; + * @return \Google\Cloud\Translate\V3\DocumentTranslation|null + */ + public function getGlossaryDocumentTranslation() + { + return $this->glossary_document_translation; + } + + public function hasGlossaryDocumentTranslation() + { + return isset($this->glossary_document_translation); + } + + public function clearGlossaryDocumentTranslation() + { + unset($this->glossary_document_translation); + } + + /** + * The document's translation output if a glossary is provided in the request. + * This can be the same as [TranslateDocumentResponse.document_translation] + * if no glossary terms apply. + * + * Generated from protobuf field .google.cloud.translation.v3.DocumentTranslation glossary_document_translation = 2; + * @param \Google\Cloud\Translate\V3\DocumentTranslation $var + * @return $this + */ + public function setGlossaryDocumentTranslation($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Translate\V3\DocumentTranslation::class); + $this->glossary_document_translation = $var; + + return $this; + } + + /** + * Only present when 'model' is present in the request. + * 'model' is normalized to have a project number. + * For example: + * If the 'model' field in TranslateDocumentRequest is: + * `projects/{project-id}/locations/{location-id}/models/general/nmt` then + * `model` here would be normalized to + * `projects/{project-number}/locations/{location-id}/models/general/nmt`. + * + * Generated from protobuf field string model = 3; + * @return string + */ + public function getModel() + { + return $this->model; + } + + /** + * Only present when 'model' is present in the request. + * 'model' is normalized to have a project number. + * For example: + * If the 'model' field in TranslateDocumentRequest is: + * `projects/{project-id}/locations/{location-id}/models/general/nmt` then + * `model` here would be normalized to + * `projects/{project-number}/locations/{location-id}/models/general/nmt`. + * + * Generated from protobuf field string model = 3; + * @param string $var + * @return $this + */ + public function setModel($var) + { + GPBUtil::checkString($var, True); + $this->model = $var; + + return $this; + } + + /** + * The `glossary_config` used for this translation. + * + * Generated from protobuf field .google.cloud.translation.v3.TranslateTextGlossaryConfig glossary_config = 4; + * @return \Google\Cloud\Translate\V3\TranslateTextGlossaryConfig|null + */ + public function getGlossaryConfig() + { + return $this->glossary_config; + } + + public function hasGlossaryConfig() + { + return isset($this->glossary_config); + } + + public function clearGlossaryConfig() + { + unset($this->glossary_config); + } + + /** + * The `glossary_config` used for this translation. + * + * Generated from protobuf field .google.cloud.translation.v3.TranslateTextGlossaryConfig glossary_config = 4; + * @param \Google\Cloud\Translate\V3\TranslateTextGlossaryConfig $var + * @return $this + */ + public function setGlossaryConfig($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Translate\V3\TranslateTextGlossaryConfig::class); + $this->glossary_config = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/TranslateTextGlossaryConfig.php b/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/TranslateTextGlossaryConfig.php new file mode 100644 index 00000000000..c4d90ab49b1 --- /dev/null +++ b/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/TranslateTextGlossaryConfig.php @@ -0,0 +1,118 @@ +google.cloud.translation.v3.TranslateTextGlossaryConfig + */ +class TranslateTextGlossaryConfig extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The `glossary` to be applied for this translation. + * The format depends on the glossary: + * - User-provided custom glossary: + * `projects/{project-number-or-id}/locations/{location-id}/glossaries/{glossary-id}` + * + * Generated from protobuf field string glossary = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $glossary = ''; + /** + * Optional. Indicates match is case insensitive. The default value is `false` + * if missing. + * + * Generated from protobuf field bool ignore_case = 2 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $ignore_case = false; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $glossary + * Required. The `glossary` to be applied for this translation. + * The format depends on the glossary: + * - User-provided custom glossary: + * `projects/{project-number-or-id}/locations/{location-id}/glossaries/{glossary-id}` + * @type bool $ignore_case + * Optional. Indicates match is case insensitive. The default value is `false` + * if missing. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Translate\V3\TranslationService::initOnce(); + parent::__construct($data); + } + + /** + * Required. The `glossary` to be applied for this translation. + * The format depends on the glossary: + * - User-provided custom glossary: + * `projects/{project-number-or-id}/locations/{location-id}/glossaries/{glossary-id}` + * + * Generated from protobuf field string glossary = 1 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getGlossary() + { + return $this->glossary; + } + + /** + * Required. The `glossary` to be applied for this translation. + * The format depends on the glossary: + * - User-provided custom glossary: + * `projects/{project-number-or-id}/locations/{location-id}/glossaries/{glossary-id}` + * + * Generated from protobuf field string glossary = 1 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setGlossary($var) + { + GPBUtil::checkString($var, True); + $this->glossary = $var; + + return $this; + } + + /** + * Optional. Indicates match is case insensitive. The default value is `false` + * if missing. + * + * Generated from protobuf field bool ignore_case = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @return bool + */ + public function getIgnoreCase() + { + return $this->ignore_case; + } + + /** + * Optional. Indicates match is case insensitive. The default value is `false` + * if missing. + * + * Generated from protobuf field bool ignore_case = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @param bool $var + * @return $this + */ + public function setIgnoreCase($var) + { + GPBUtil::checkBool($var); + $this->ignore_case = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/TranslateTextRequest.php b/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/TranslateTextRequest.php new file mode 100644 index 00000000000..4cff39bc49f --- /dev/null +++ b/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/TranslateTextRequest.php @@ -0,0 +1,451 @@ +google.cloud.translation.v3.TranslateTextRequest + */ +class TranslateTextRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The content of the input in string format. + * We recommend the total content be less than 30,000 codepoints. The max + * length of this field is 1024. Use BatchTranslateText for larger text. + * + * Generated from protobuf field repeated string contents = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + private $contents; + /** + * Optional. The format of the source text, for example, "text/html", + * "text/plain". If left blank, the MIME type defaults to "text/html". + * + * Generated from protobuf field string mime_type = 3 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $mime_type = ''; + /** + * Optional. The ISO-639 language code of the input text if + * known, for example, "en-US" or "sr-Latn". Supported language codes are + * listed in Language Support. If the source language isn't specified, the API + * attempts to identify the source language automatically and returns the + * source language within the response. + * + * Generated from protobuf field string source_language_code = 4 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $source_language_code = ''; + /** + * Required. The ISO-639 language code to use for translation of the input + * text, set to one of the language codes listed in Language Support. + * + * Generated from protobuf field string target_language_code = 5 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $target_language_code = ''; + /** + * Required. Project or location to make a call. Must refer to a caller's + * project. + * Format: `projects/{project-number-or-id}` or + * `projects/{project-number-or-id}/locations/{location-id}`. + * For global calls, use `projects/{project-number-or-id}/locations/global` or + * `projects/{project-number-or-id}`. + * Non-global location is required for requests using AutoML models or + * custom glossaries. + * Models and glossaries must be within the same region (have same + * location-id), otherwise an INVALID_ARGUMENT (400) error is returned. + * + * Generated from protobuf field string parent = 8 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $parent = ''; + /** + * Optional. The `model` type requested for this translation. + * The format depends on model type: + * - AutoML Translation models: + * `projects/{project-number-or-id}/locations/{location-id}/models/{model-id}` + * - General (built-in) models: + * `projects/{project-number-or-id}/locations/{location-id}/models/general/nmt`, + * For global (non-regionalized) requests, use `location-id` `global`. + * For example, + * `projects/{project-number-or-id}/locations/global/models/general/nmt`. + * If not provided, the default Google model (NMT) will be used. + * + * Generated from protobuf field string model = 6 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $model = ''; + /** + * Optional. Glossary to be applied. The glossary must be + * within the same region (have the same location-id) as the model, otherwise + * an INVALID_ARGUMENT (400) error is returned. + * + * Generated from protobuf field .google.cloud.translation.v3.TranslateTextGlossaryConfig glossary_config = 7 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $glossary_config = null; + /** + * Optional. The labels with user-defined metadata for the request. + * Label keys and values can be no longer than 63 characters + * (Unicode codepoints), can only contain lowercase letters, numeric + * characters, underscores and dashes. International characters are allowed. + * Label values are optional. Label keys must start with a letter. + * See https://cloud.google.com/translate/docs/advanced/labels for more + * information. + * + * Generated from protobuf field map labels = 10 [(.google.api.field_behavior) = OPTIONAL]; + */ + private $labels; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array|\Google\Protobuf\Internal\RepeatedField $contents + * Required. The content of the input in string format. + * We recommend the total content be less than 30,000 codepoints. The max + * length of this field is 1024. Use BatchTranslateText for larger text. + * @type string $mime_type + * Optional. The format of the source text, for example, "text/html", + * "text/plain". If left blank, the MIME type defaults to "text/html". + * @type string $source_language_code + * Optional. The ISO-639 language code of the input text if + * known, for example, "en-US" or "sr-Latn". Supported language codes are + * listed in Language Support. If the source language isn't specified, the API + * attempts to identify the source language automatically and returns the + * source language within the response. + * @type string $target_language_code + * Required. The ISO-639 language code to use for translation of the input + * text, set to one of the language codes listed in Language Support. + * @type string $parent + * Required. Project or location to make a call. Must refer to a caller's + * project. + * Format: `projects/{project-number-or-id}` or + * `projects/{project-number-or-id}/locations/{location-id}`. + * For global calls, use `projects/{project-number-or-id}/locations/global` or + * `projects/{project-number-or-id}`. + * Non-global location is required for requests using AutoML models or + * custom glossaries. + * Models and glossaries must be within the same region (have same + * location-id), otherwise an INVALID_ARGUMENT (400) error is returned. + * @type string $model + * Optional. The `model` type requested for this translation. + * The format depends on model type: + * - AutoML Translation models: + * `projects/{project-number-or-id}/locations/{location-id}/models/{model-id}` + * - General (built-in) models: + * `projects/{project-number-or-id}/locations/{location-id}/models/general/nmt`, + * For global (non-regionalized) requests, use `location-id` `global`. + * For example, + * `projects/{project-number-or-id}/locations/global/models/general/nmt`. + * If not provided, the default Google model (NMT) will be used. + * @type \Google\Cloud\Translate\V3\TranslateTextGlossaryConfig $glossary_config + * Optional. Glossary to be applied. The glossary must be + * within the same region (have the same location-id) as the model, otherwise + * an INVALID_ARGUMENT (400) error is returned. + * @type array|\Google\Protobuf\Internal\MapField $labels + * Optional. The labels with user-defined metadata for the request. + * Label keys and values can be no longer than 63 characters + * (Unicode codepoints), can only contain lowercase letters, numeric + * characters, underscores and dashes. International characters are allowed. + * Label values are optional. Label keys must start with a letter. + * See https://cloud.google.com/translate/docs/advanced/labels for more + * information. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Translate\V3\TranslationService::initOnce(); + parent::__construct($data); + } + + /** + * Required. The content of the input in string format. + * We recommend the total content be less than 30,000 codepoints. The max + * length of this field is 1024. Use BatchTranslateText for larger text. + * + * Generated from protobuf field repeated string contents = 1 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getContents() + { + return $this->contents; + } + + /** + * Required. The content of the input in string format. + * We recommend the total content be less than 30,000 codepoints. The max + * length of this field is 1024. Use BatchTranslateText for larger text. + * + * Generated from protobuf field repeated string contents = 1 [(.google.api.field_behavior) = REQUIRED]; + * @param array|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setContents($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); + $this->contents = $arr; + + return $this; + } + + /** + * Optional. The format of the source text, for example, "text/html", + * "text/plain". If left blank, the MIME type defaults to "text/html". + * + * Generated from protobuf field string mime_type = 3 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getMimeType() + { + return $this->mime_type; + } + + /** + * Optional. The format of the source text, for example, "text/html", + * "text/plain". If left blank, the MIME type defaults to "text/html". + * + * Generated from protobuf field string mime_type = 3 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setMimeType($var) + { + GPBUtil::checkString($var, True); + $this->mime_type = $var; + + return $this; + } + + /** + * Optional. The ISO-639 language code of the input text if + * known, for example, "en-US" or "sr-Latn". Supported language codes are + * listed in Language Support. If the source language isn't specified, the API + * attempts to identify the source language automatically and returns the + * source language within the response. + * + * Generated from protobuf field string source_language_code = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getSourceLanguageCode() + { + return $this->source_language_code; + } + + /** + * Optional. The ISO-639 language code of the input text if + * known, for example, "en-US" or "sr-Latn". Supported language codes are + * listed in Language Support. If the source language isn't specified, the API + * attempts to identify the source language automatically and returns the + * source language within the response. + * + * Generated from protobuf field string source_language_code = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setSourceLanguageCode($var) + { + GPBUtil::checkString($var, True); + $this->source_language_code = $var; + + return $this; + } + + /** + * Required. The ISO-639 language code to use for translation of the input + * text, set to one of the language codes listed in Language Support. + * + * Generated from protobuf field string target_language_code = 5 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getTargetLanguageCode() + { + return $this->target_language_code; + } + + /** + * Required. The ISO-639 language code to use for translation of the input + * text, set to one of the language codes listed in Language Support. + * + * Generated from protobuf field string target_language_code = 5 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setTargetLanguageCode($var) + { + GPBUtil::checkString($var, True); + $this->target_language_code = $var; + + return $this; + } + + /** + * Required. Project or location to make a call. Must refer to a caller's + * project. + * Format: `projects/{project-number-or-id}` or + * `projects/{project-number-or-id}/locations/{location-id}`. + * For global calls, use `projects/{project-number-or-id}/locations/global` or + * `projects/{project-number-or-id}`. + * Non-global location is required for requests using AutoML models or + * custom glossaries. + * Models and glossaries must be within the same region (have same + * location-id), otherwise an INVALID_ARGUMENT (400) error is returned. + * + * Generated from protobuf field string parent = 8 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getParent() + { + return $this->parent; + } + + /** + * Required. Project or location to make a call. Must refer to a caller's + * project. + * Format: `projects/{project-number-or-id}` or + * `projects/{project-number-or-id}/locations/{location-id}`. + * For global calls, use `projects/{project-number-or-id}/locations/global` or + * `projects/{project-number-or-id}`. + * Non-global location is required for requests using AutoML models or + * custom glossaries. + * Models and glossaries must be within the same region (have same + * location-id), otherwise an INVALID_ARGUMENT (400) error is returned. + * + * Generated from protobuf field string parent = 8 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setParent($var) + { + GPBUtil::checkString($var, True); + $this->parent = $var; + + return $this; + } + + /** + * Optional. The `model` type requested for this translation. + * The format depends on model type: + * - AutoML Translation models: + * `projects/{project-number-or-id}/locations/{location-id}/models/{model-id}` + * - General (built-in) models: + * `projects/{project-number-or-id}/locations/{location-id}/models/general/nmt`, + * For global (non-regionalized) requests, use `location-id` `global`. + * For example, + * `projects/{project-number-or-id}/locations/global/models/general/nmt`. + * If not provided, the default Google model (NMT) will be used. + * + * Generated from protobuf field string model = 6 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getModel() + { + return $this->model; + } + + /** + * Optional. The `model` type requested for this translation. + * The format depends on model type: + * - AutoML Translation models: + * `projects/{project-number-or-id}/locations/{location-id}/models/{model-id}` + * - General (built-in) models: + * `projects/{project-number-or-id}/locations/{location-id}/models/general/nmt`, + * For global (non-regionalized) requests, use `location-id` `global`. + * For example, + * `projects/{project-number-or-id}/locations/global/models/general/nmt`. + * If not provided, the default Google model (NMT) will be used. + * + * Generated from protobuf field string model = 6 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setModel($var) + { + GPBUtil::checkString($var, True); + $this->model = $var; + + return $this; + } + + /** + * Optional. Glossary to be applied. The glossary must be + * within the same region (have the same location-id) as the model, otherwise + * an INVALID_ARGUMENT (400) error is returned. + * + * Generated from protobuf field .google.cloud.translation.v3.TranslateTextGlossaryConfig glossary_config = 7 [(.google.api.field_behavior) = OPTIONAL]; + * @return \Google\Cloud\Translate\V3\TranslateTextGlossaryConfig|null + */ + public function getGlossaryConfig() + { + return $this->glossary_config; + } + + public function hasGlossaryConfig() + { + return isset($this->glossary_config); + } + + public function clearGlossaryConfig() + { + unset($this->glossary_config); + } + + /** + * Optional. Glossary to be applied. The glossary must be + * within the same region (have the same location-id) as the model, otherwise + * an INVALID_ARGUMENT (400) error is returned. + * + * Generated from protobuf field .google.cloud.translation.v3.TranslateTextGlossaryConfig glossary_config = 7 [(.google.api.field_behavior) = OPTIONAL]; + * @param \Google\Cloud\Translate\V3\TranslateTextGlossaryConfig $var + * @return $this + */ + public function setGlossaryConfig($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Translate\V3\TranslateTextGlossaryConfig::class); + $this->glossary_config = $var; + + return $this; + } + + /** + * Optional. The labels with user-defined metadata for the request. + * Label keys and values can be no longer than 63 characters + * (Unicode codepoints), can only contain lowercase letters, numeric + * characters, underscores and dashes. International characters are allowed. + * Label values are optional. Label keys must start with a letter. + * See https://cloud.google.com/translate/docs/advanced/labels for more + * information. + * + * Generated from protobuf field map labels = 10 [(.google.api.field_behavior) = OPTIONAL]; + * @return \Google\Protobuf\Internal\MapField + */ + public function getLabels() + { + return $this->labels; + } + + /** + * Optional. The labels with user-defined metadata for the request. + * Label keys and values can be no longer than 63 characters + * (Unicode codepoints), can only contain lowercase letters, numeric + * characters, underscores and dashes. International characters are allowed. + * Label values are optional. Label keys must start with a letter. + * See https://cloud.google.com/translate/docs/advanced/labels for more + * information. + * + * Generated from protobuf field map labels = 10 [(.google.api.field_behavior) = OPTIONAL]; + * @param array|\Google\Protobuf\Internal\MapField $var + * @return $this + */ + public function setLabels($var) + { + $arr = GPBUtil::checkMapField($var, \Google\Protobuf\Internal\GPBType::STRING, \Google\Protobuf\Internal\GPBType::STRING); + $this->labels = $arr; + + return $this; + } + +} + diff --git a/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/TranslateTextResponse.php b/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/TranslateTextResponse.php new file mode 100644 index 00000000000..421453b6959 --- /dev/null +++ b/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/TranslateTextResponse.php @@ -0,0 +1,123 @@ +google.cloud.translation.v3.TranslateTextResponse + */ +class TranslateTextResponse extends \Google\Protobuf\Internal\Message +{ + /** + * Text translation responses with no glossary applied. + * This field has the same length as + * [`contents`][google.cloud.translation.v3.TranslateTextRequest.contents]. + * + * Generated from protobuf field repeated .google.cloud.translation.v3.Translation translations = 1; + */ + private $translations; + /** + * Text translation responses if a glossary is provided in the request. + * This can be the same as + * [`translations`][google.cloud.translation.v3.TranslateTextResponse.translations] + * if no terms apply. This field has the same length as + * [`contents`][google.cloud.translation.v3.TranslateTextRequest.contents]. + * + * Generated from protobuf field repeated .google.cloud.translation.v3.Translation glossary_translations = 3; + */ + private $glossary_translations; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array<\Google\Cloud\Translate\V3\Translation>|\Google\Protobuf\Internal\RepeatedField $translations + * Text translation responses with no glossary applied. + * This field has the same length as + * [`contents`][google.cloud.translation.v3.TranslateTextRequest.contents]. + * @type array<\Google\Cloud\Translate\V3\Translation>|\Google\Protobuf\Internal\RepeatedField $glossary_translations + * Text translation responses if a glossary is provided in the request. + * This can be the same as + * [`translations`][google.cloud.translation.v3.TranslateTextResponse.translations] + * if no terms apply. This field has the same length as + * [`contents`][google.cloud.translation.v3.TranslateTextRequest.contents]. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Translate\V3\TranslationService::initOnce(); + parent::__construct($data); + } + + /** + * Text translation responses with no glossary applied. + * This field has the same length as + * [`contents`][google.cloud.translation.v3.TranslateTextRequest.contents]. + * + * Generated from protobuf field repeated .google.cloud.translation.v3.Translation translations = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getTranslations() + { + return $this->translations; + } + + /** + * Text translation responses with no glossary applied. + * This field has the same length as + * [`contents`][google.cloud.translation.v3.TranslateTextRequest.contents]. + * + * Generated from protobuf field repeated .google.cloud.translation.v3.Translation translations = 1; + * @param array<\Google\Cloud\Translate\V3\Translation>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setTranslations($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Translate\V3\Translation::class); + $this->translations = $arr; + + return $this; + } + + /** + * Text translation responses if a glossary is provided in the request. + * This can be the same as + * [`translations`][google.cloud.translation.v3.TranslateTextResponse.translations] + * if no terms apply. This field has the same length as + * [`contents`][google.cloud.translation.v3.TranslateTextRequest.contents]. + * + * Generated from protobuf field repeated .google.cloud.translation.v3.Translation glossary_translations = 3; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getGlossaryTranslations() + { + return $this->glossary_translations; + } + + /** + * Text translation responses if a glossary is provided in the request. + * This can be the same as + * [`translations`][google.cloud.translation.v3.TranslateTextResponse.translations] + * if no terms apply. This field has the same length as + * [`contents`][google.cloud.translation.v3.TranslateTextRequest.contents]. + * + * Generated from protobuf field repeated .google.cloud.translation.v3.Translation glossary_translations = 3; + * @param array<\Google\Cloud\Translate\V3\Translation>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setGlossaryTranslations($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Translate\V3\Translation::class); + $this->glossary_translations = $arr; + + return $this; + } + +} + diff --git a/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/Translation.php b/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/Translation.php new file mode 100644 index 00000000000..f57fa9baac7 --- /dev/null +++ b/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/Translation.php @@ -0,0 +1,223 @@ +google.cloud.translation.v3.Translation + */ +class Translation extends \Google\Protobuf\Internal\Message +{ + /** + * Text translated into the target language. + * If an error occurs during translation, this field might be excluded from + * the response. + * + * Generated from protobuf field string translated_text = 1; + */ + protected $translated_text = ''; + /** + * Only present when `model` is present in the request. + * `model` here is normalized to have project number. + * For example: + * If the `model` requested in TranslationTextRequest is + * `projects/{project-id}/locations/{location-id}/models/general/nmt` then + * `model` here would be normalized to + * `projects/{project-number}/locations/{location-id}/models/general/nmt`. + * + * Generated from protobuf field string model = 2; + */ + protected $model = ''; + /** + * The ISO-639 language code of source text in the initial request, detected + * automatically, if no source language was passed within the initial + * request. If the source language was passed, auto-detection of the language + * does not occur and this field is empty. + * + * Generated from protobuf field string detected_language_code = 4; + */ + protected $detected_language_code = ''; + /** + * The `glossary_config` used for this translation. + * + * Generated from protobuf field .google.cloud.translation.v3.TranslateTextGlossaryConfig glossary_config = 3; + */ + protected $glossary_config = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $translated_text + * Text translated into the target language. + * If an error occurs during translation, this field might be excluded from + * the response. + * @type string $model + * Only present when `model` is present in the request. + * `model` here is normalized to have project number. + * For example: + * If the `model` requested in TranslationTextRequest is + * `projects/{project-id}/locations/{location-id}/models/general/nmt` then + * `model` here would be normalized to + * `projects/{project-number}/locations/{location-id}/models/general/nmt`. + * @type string $detected_language_code + * The ISO-639 language code of source text in the initial request, detected + * automatically, if no source language was passed within the initial + * request. If the source language was passed, auto-detection of the language + * does not occur and this field is empty. + * @type \Google\Cloud\Translate\V3\TranslateTextGlossaryConfig $glossary_config + * The `glossary_config` used for this translation. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Translate\V3\TranslationService::initOnce(); + parent::__construct($data); + } + + /** + * Text translated into the target language. + * If an error occurs during translation, this field might be excluded from + * the response. + * + * Generated from protobuf field string translated_text = 1; + * @return string + */ + public function getTranslatedText() + { + return $this->translated_text; + } + + /** + * Text translated into the target language. + * If an error occurs during translation, this field might be excluded from + * the response. + * + * Generated from protobuf field string translated_text = 1; + * @param string $var + * @return $this + */ + public function setTranslatedText($var) + { + GPBUtil::checkString($var, True); + $this->translated_text = $var; + + return $this; + } + + /** + * Only present when `model` is present in the request. + * `model` here is normalized to have project number. + * For example: + * If the `model` requested in TranslationTextRequest is + * `projects/{project-id}/locations/{location-id}/models/general/nmt` then + * `model` here would be normalized to + * `projects/{project-number}/locations/{location-id}/models/general/nmt`. + * + * Generated from protobuf field string model = 2; + * @return string + */ + public function getModel() + { + return $this->model; + } + + /** + * Only present when `model` is present in the request. + * `model` here is normalized to have project number. + * For example: + * If the `model` requested in TranslationTextRequest is + * `projects/{project-id}/locations/{location-id}/models/general/nmt` then + * `model` here would be normalized to + * `projects/{project-number}/locations/{location-id}/models/general/nmt`. + * + * Generated from protobuf field string model = 2; + * @param string $var + * @return $this + */ + public function setModel($var) + { + GPBUtil::checkString($var, True); + $this->model = $var; + + return $this; + } + + /** + * The ISO-639 language code of source text in the initial request, detected + * automatically, if no source language was passed within the initial + * request. If the source language was passed, auto-detection of the language + * does not occur and this field is empty. + * + * Generated from protobuf field string detected_language_code = 4; + * @return string + */ + public function getDetectedLanguageCode() + { + return $this->detected_language_code; + } + + /** + * The ISO-639 language code of source text in the initial request, detected + * automatically, if no source language was passed within the initial + * request. If the source language was passed, auto-detection of the language + * does not occur and this field is empty. + * + * Generated from protobuf field string detected_language_code = 4; + * @param string $var + * @return $this + */ + public function setDetectedLanguageCode($var) + { + GPBUtil::checkString($var, True); + $this->detected_language_code = $var; + + return $this; + } + + /** + * The `glossary_config` used for this translation. + * + * Generated from protobuf field .google.cloud.translation.v3.TranslateTextGlossaryConfig glossary_config = 3; + * @return \Google\Cloud\Translate\V3\TranslateTextGlossaryConfig|null + */ + public function getGlossaryConfig() + { + return $this->glossary_config; + } + + public function hasGlossaryConfig() + { + return isset($this->glossary_config); + } + + public function clearGlossaryConfig() + { + unset($this->glossary_config); + } + + /** + * The `glossary_config` used for this translation. + * + * Generated from protobuf field .google.cloud.translation.v3.TranslateTextGlossaryConfig glossary_config = 3; + * @param \Google\Cloud\Translate\V3\TranslateTextGlossaryConfig $var + * @return $this + */ + public function setGlossaryConfig($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Translate\V3\TranslateTextGlossaryConfig::class); + $this->glossary_config = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/TranslationServiceGrpcClient.php b/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/TranslationServiceGrpcClient.php new file mode 100644 index 00000000000..26ea28e2549 --- /dev/null +++ b/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/TranslationServiceGrpcClient.php @@ -0,0 +1,204 @@ +_simpleRequest('/google.cloud.translation.v3.TranslationService/TranslateText', + $argument, + ['\Google\Cloud\Translate\V3\TranslateTextResponse', 'decode'], + $metadata, $options); + } + + /** + * Detects the language of text within a request. + * @param \Google\Cloud\Translate\V3\DetectLanguageRequest $argument input argument + * @param array $metadata metadata + * @param array $options call options + * @return \Grpc\UnaryCall + */ + public function DetectLanguage(\Google\Cloud\Translate\V3\DetectLanguageRequest $argument, + $metadata = [], $options = []) { + return $this->_simpleRequest('/google.cloud.translation.v3.TranslationService/DetectLanguage', + $argument, + ['\Google\Cloud\Translate\V3\DetectLanguageResponse', 'decode'], + $metadata, $options); + } + + /** + * Returns a list of supported languages for translation. + * @param \Google\Cloud\Translate\V3\GetSupportedLanguagesRequest $argument input argument + * @param array $metadata metadata + * @param array $options call options + * @return \Grpc\UnaryCall + */ + public function GetSupportedLanguages(\Google\Cloud\Translate\V3\GetSupportedLanguagesRequest $argument, + $metadata = [], $options = []) { + return $this->_simpleRequest('/google.cloud.translation.v3.TranslationService/GetSupportedLanguages', + $argument, + ['\Google\Cloud\Translate\V3\SupportedLanguages', 'decode'], + $metadata, $options); + } + + /** + * Translates documents in synchronous mode. + * @param \Google\Cloud\Translate\V3\TranslateDocumentRequest $argument input argument + * @param array $metadata metadata + * @param array $options call options + * @return \Grpc\UnaryCall + */ + public function TranslateDocument(\Google\Cloud\Translate\V3\TranslateDocumentRequest $argument, + $metadata = [], $options = []) { + return $this->_simpleRequest('/google.cloud.translation.v3.TranslationService/TranslateDocument', + $argument, + ['\Google\Cloud\Translate\V3\TranslateDocumentResponse', 'decode'], + $metadata, $options); + } + + /** + * Translates a large volume of text in asynchronous batch mode. + * This function provides real-time output as the inputs are being processed. + * If caller cancels a request, the partial results (for an input file, it's + * all or nothing) may still be available on the specified output location. + * + * This call returns immediately and you can + * use google.longrunning.Operation.name to poll the status of the call. + * @param \Google\Cloud\Translate\V3\BatchTranslateTextRequest $argument input argument + * @param array $metadata metadata + * @param array $options call options + * @return \Grpc\UnaryCall + */ + public function BatchTranslateText(\Google\Cloud\Translate\V3\BatchTranslateTextRequest $argument, + $metadata = [], $options = []) { + return $this->_simpleRequest('/google.cloud.translation.v3.TranslationService/BatchTranslateText', + $argument, + ['\Google\LongRunning\Operation', 'decode'], + $metadata, $options); + } + + /** + * Translates a large volume of document in asynchronous batch mode. + * This function provides real-time output as the inputs are being processed. + * If caller cancels a request, the partial results (for an input file, it's + * all or nothing) may still be available on the specified output location. + * + * This call returns immediately and you can use + * google.longrunning.Operation.name to poll the status of the call. + * @param \Google\Cloud\Translate\V3\BatchTranslateDocumentRequest $argument input argument + * @param array $metadata metadata + * @param array $options call options + * @return \Grpc\UnaryCall + */ + public function BatchTranslateDocument(\Google\Cloud\Translate\V3\BatchTranslateDocumentRequest $argument, + $metadata = [], $options = []) { + return $this->_simpleRequest('/google.cloud.translation.v3.TranslationService/BatchTranslateDocument', + $argument, + ['\Google\LongRunning\Operation', 'decode'], + $metadata, $options); + } + + /** + * Creates a glossary and returns the long-running operation. Returns + * NOT_FOUND, if the project doesn't exist. + * @param \Google\Cloud\Translate\V3\CreateGlossaryRequest $argument input argument + * @param array $metadata metadata + * @param array $options call options + * @return \Grpc\UnaryCall + */ + public function CreateGlossary(\Google\Cloud\Translate\V3\CreateGlossaryRequest $argument, + $metadata = [], $options = []) { + return $this->_simpleRequest('/google.cloud.translation.v3.TranslationService/CreateGlossary', + $argument, + ['\Google\LongRunning\Operation', 'decode'], + $metadata, $options); + } + + /** + * Lists glossaries in a project. Returns NOT_FOUND, if the project doesn't + * exist. + * @param \Google\Cloud\Translate\V3\ListGlossariesRequest $argument input argument + * @param array $metadata metadata + * @param array $options call options + * @return \Grpc\UnaryCall + */ + public function ListGlossaries(\Google\Cloud\Translate\V3\ListGlossariesRequest $argument, + $metadata = [], $options = []) { + return $this->_simpleRequest('/google.cloud.translation.v3.TranslationService/ListGlossaries', + $argument, + ['\Google\Cloud\Translate\V3\ListGlossariesResponse', 'decode'], + $metadata, $options); + } + + /** + * Gets a glossary. Returns NOT_FOUND, if the glossary doesn't + * exist. + * @param \Google\Cloud\Translate\V3\GetGlossaryRequest $argument input argument + * @param array $metadata metadata + * @param array $options call options + * @return \Grpc\UnaryCall + */ + public function GetGlossary(\Google\Cloud\Translate\V3\GetGlossaryRequest $argument, + $metadata = [], $options = []) { + return $this->_simpleRequest('/google.cloud.translation.v3.TranslationService/GetGlossary', + $argument, + ['\Google\Cloud\Translate\V3\Glossary', 'decode'], + $metadata, $options); + } + + /** + * Deletes a glossary, or cancels glossary construction + * if the glossary isn't created yet. + * Returns NOT_FOUND, if the glossary doesn't exist. + * @param \Google\Cloud\Translate\V3\DeleteGlossaryRequest $argument input argument + * @param array $metadata metadata + * @param array $options call options + * @return \Grpc\UnaryCall + */ + public function DeleteGlossary(\Google\Cloud\Translate\V3\DeleteGlossaryRequest $argument, + $metadata = [], $options = []) { + return $this->_simpleRequest('/google.cloud.translation.v3.TranslationService/DeleteGlossary', + $argument, + ['\Google\LongRunning\Operation', 'decode'], + $metadata, $options); + } + +} diff --git a/owl-bot-staging/Translate/v3/samples/V3/TranslationServiceClient/batch_translate_document.php b/owl-bot-staging/Translate/v3/samples/V3/TranslationServiceClient/batch_translate_document.php new file mode 100644 index 00000000000..a4ce7fbe8a3 --- /dev/null +++ b/owl-bot-staging/Translate/v3/samples/V3/TranslationServiceClient/batch_translate_document.php @@ -0,0 +1,115 @@ +batchTranslateDocument( + $formattedParent, + $sourceLanguageCode, + $targetLanguageCodes, + $inputConfigs, + $outputConfig + ); + $response->pollUntilComplete(); + + if ($response->operationSucceeded()) { + /** @var BatchTranslateDocumentResponse $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 +{ + $formattedParent = TranslationServiceClient::locationName('[PROJECT]', '[LOCATION]'); + $sourceLanguageCode = '[SOURCE_LANGUAGE_CODE]'; + $targetLanguageCodesElement = '[TARGET_LANGUAGE_CODES]'; + + batch_translate_document_sample($formattedParent, $sourceLanguageCode, $targetLanguageCodesElement); +} +// [END translate_v3_generated_TranslationService_BatchTranslateDocument_sync] diff --git a/owl-bot-staging/Translate/v3/samples/V3/TranslationServiceClient/batch_translate_text.php b/owl-bot-staging/Translate/v3/samples/V3/TranslationServiceClient/batch_translate_text.php new file mode 100644 index 00000000000..0b34520d9a6 --- /dev/null +++ b/owl-bot-staging/Translate/v3/samples/V3/TranslationServiceClient/batch_translate_text.php @@ -0,0 +1,112 @@ +batchTranslateText( + $formattedParent, + $sourceLanguageCode, + $targetLanguageCodes, + $inputConfigs, + $outputConfig + ); + $response->pollUntilComplete(); + + if ($response->operationSucceeded()) { + /** @var BatchTranslateResponse $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 +{ + $formattedParent = TranslationServiceClient::locationName('[PROJECT]', '[LOCATION]'); + $sourceLanguageCode = '[SOURCE_LANGUAGE_CODE]'; + $targetLanguageCodesElement = '[TARGET_LANGUAGE_CODES]'; + + batch_translate_text_sample($formattedParent, $sourceLanguageCode, $targetLanguageCodesElement); +} +// [END translate_v3_generated_TranslationService_BatchTranslateText_sync] diff --git a/owl-bot-staging/Translate/v3/samples/V3/TranslationServiceClient/create_glossary.php b/owl-bot-staging/Translate/v3/samples/V3/TranslationServiceClient/create_glossary.php new file mode 100644 index 00000000000..8f39729e7b5 --- /dev/null +++ b/owl-bot-staging/Translate/v3/samples/V3/TranslationServiceClient/create_glossary.php @@ -0,0 +1,86 @@ +setName($glossaryName); + + // Call the API and handle any network failures. + try { + /** @var OperationResponse $response */ + $response = $translationServiceClient->createGlossary($formattedParent, $glossary); + $response->pollUntilComplete(); + + if ($response->operationSucceeded()) { + /** @var Glossary $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 +{ + $formattedParent = TranslationServiceClient::locationName('[PROJECT]', '[LOCATION]'); + $glossaryName = '[NAME]'; + + create_glossary_sample($formattedParent, $glossaryName); +} +// [END translate_v3_generated_TranslationService_CreateGlossary_sync] diff --git a/owl-bot-staging/Translate/v3/samples/V3/TranslationServiceClient/delete_glossary.php b/owl-bot-staging/Translate/v3/samples/V3/TranslationServiceClient/delete_glossary.php new file mode 100644 index 00000000000..06f96be93cb --- /dev/null +++ b/owl-bot-staging/Translate/v3/samples/V3/TranslationServiceClient/delete_glossary.php @@ -0,0 +1,80 @@ +deleteGlossary($formattedName); + $response->pollUntilComplete(); + + if ($response->operationSucceeded()) { + /** @var DeleteGlossaryResponse $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 +{ + $formattedName = TranslationServiceClient::glossaryName('[PROJECT]', '[LOCATION]', '[GLOSSARY]'); + + delete_glossary_sample($formattedName); +} +// [END translate_v3_generated_TranslationService_DeleteGlossary_sync] diff --git a/owl-bot-staging/Translate/v3/samples/V3/TranslationServiceClient/detect_language.php b/owl-bot-staging/Translate/v3/samples/V3/TranslationServiceClient/detect_language.php new file mode 100644 index 00000000000..bbde3538a39 --- /dev/null +++ b/owl-bot-staging/Translate/v3/samples/V3/TranslationServiceClient/detect_language.php @@ -0,0 +1,76 @@ +detectLanguage($formattedParent); + 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 +{ + $formattedParent = TranslationServiceClient::locationName('[PROJECT]', '[LOCATION]'); + + detect_language_sample($formattedParent); +} +// [END translate_v3_generated_TranslationService_DetectLanguage_sync] diff --git a/owl-bot-staging/Translate/v3/samples/V3/TranslationServiceClient/get_glossary.php b/owl-bot-staging/Translate/v3/samples/V3/TranslationServiceClient/get_glossary.php new file mode 100644 index 00000000000..4317cffc4b5 --- /dev/null +++ b/owl-bot-staging/Translate/v3/samples/V3/TranslationServiceClient/get_glossary.php @@ -0,0 +1,67 @@ +getGlossary($formattedName); + 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 +{ + $formattedName = TranslationServiceClient::glossaryName('[PROJECT]', '[LOCATION]', '[GLOSSARY]'); + + get_glossary_sample($formattedName); +} +// [END translate_v3_generated_TranslationService_GetGlossary_sync] diff --git a/owl-bot-staging/Translate/v3/samples/V3/TranslationServiceClient/get_supported_languages.php b/owl-bot-staging/Translate/v3/samples/V3/TranslationServiceClient/get_supported_languages.php new file mode 100644 index 00000000000..e69828a8902 --- /dev/null +++ b/owl-bot-staging/Translate/v3/samples/V3/TranslationServiceClient/get_supported_languages.php @@ -0,0 +1,78 @@ +getSupportedLanguages($formattedParent); + 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 +{ + $formattedParent = TranslationServiceClient::locationName('[PROJECT]', '[LOCATION]'); + + get_supported_languages_sample($formattedParent); +} +// [END translate_v3_generated_TranslationService_GetSupportedLanguages_sync] diff --git a/owl-bot-staging/Translate/v3/samples/V3/TranslationServiceClient/list_glossaries.php b/owl-bot-staging/Translate/v3/samples/V3/TranslationServiceClient/list_glossaries.php new file mode 100644 index 00000000000..8c1d286d8b9 --- /dev/null +++ b/owl-bot-staging/Translate/v3/samples/V3/TranslationServiceClient/list_glossaries.php @@ -0,0 +1,72 @@ +listGlossaries($formattedParent); + + /** @var Glossary $element */ + foreach ($response as $element) { + printf('Element data: %s' . PHP_EOL, $element->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 +{ + $formattedParent = TranslationServiceClient::locationName('[PROJECT]', '[LOCATION]'); + + list_glossaries_sample($formattedParent); +} +// [END translate_v3_generated_TranslationService_ListGlossaries_sync] diff --git a/owl-bot-staging/Translate/v3/samples/V3/TranslationServiceClient/translate_document.php b/owl-bot-staging/Translate/v3/samples/V3/TranslationServiceClient/translate_document.php new file mode 100644 index 00000000000..1023ea68222 --- /dev/null +++ b/owl-bot-staging/Translate/v3/samples/V3/TranslationServiceClient/translate_document.php @@ -0,0 +1,87 @@ +translateDocument( + $parent, + $targetLanguageCode, + $documentInputConfig + ); + 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 +{ + $parent = '[PARENT]'; + $targetLanguageCode = '[TARGET_LANGUAGE_CODE]'; + + translate_document_sample($parent, $targetLanguageCode); +} +// [END translate_v3_generated_TranslationService_TranslateDocument_sync] diff --git a/owl-bot-staging/Translate/v3/samples/V3/TranslationServiceClient/translate_text.php b/owl-bot-staging/Translate/v3/samples/V3/TranslationServiceClient/translate_text.php new file mode 100644 index 00000000000..9ebd1f05f47 --- /dev/null +++ b/owl-bot-staging/Translate/v3/samples/V3/TranslationServiceClient/translate_text.php @@ -0,0 +1,96 @@ +translateText( + $contents, + $targetLanguageCode, + $formattedParent + ); + 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 +{ + $contentsElement = '[CONTENTS]'; + $targetLanguageCode = '[TARGET_LANGUAGE_CODE]'; + $formattedParent = TranslationServiceClient::locationName('[PROJECT]', '[LOCATION]'); + + translate_text_sample($contentsElement, $targetLanguageCode, $formattedParent); +} +// [END translate_v3_generated_TranslationService_TranslateText_sync] diff --git a/owl-bot-staging/Translate/v3/src/V3/Gapic/TranslationServiceGapicClient.php b/owl-bot-staging/Translate/v3/src/V3/Gapic/TranslationServiceGapicClient.php new file mode 100644 index 00000000000..9b7956b474f --- /dev/null +++ b/owl-bot-staging/Translate/v3/src/V3/Gapic/TranslationServiceGapicClient.php @@ -0,0 +1,1338 @@ +locationName('[PROJECT]', '[LOCATION]'); + * $sourceLanguageCode = 'source_language_code'; + * $targetLanguageCodes = []; + * $inputConfigs = []; + * $outputConfig = new BatchDocumentOutputConfig(); + * $operationResponse = $translationServiceClient->batchTranslateDocument($formattedParent, $sourceLanguageCode, $targetLanguageCodes, $inputConfigs, $outputConfig); + * $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 = $translationServiceClient->batchTranslateDocument($formattedParent, $sourceLanguageCode, $targetLanguageCodes, $inputConfigs, $outputConfig); + * $operationName = $operationResponse->getName(); + * // ... do other work + * $newOperationResponse = $translationServiceClient->resumeOperation($operationName, 'batchTranslateDocument'); + * while (!$newOperationResponse->isDone()) { + * // ... do other work + * $newOperationResponse->reload(); + * } + * if ($newOperationResponse->operationSucceeded()) { + * $result = $newOperationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $newOperationResponse->getError(); + * // handleError($error) + * } + * } finally { + * $translationServiceClient->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. + */ +class TranslationServiceGapicClient +{ + use GapicClientTrait; + + /** The name of the service. */ + const SERVICE_NAME = 'google.cloud.translation.v3.TranslationService'; + + /** The default address of the service. */ + const SERVICE_ADDRESS = 'translate.googleapis.com'; + + /** 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', + 'https://www.googleapis.com/auth/cloud-translation', + ]; + + private static $glossaryNameTemplate; + + private static $locationNameTemplate; + + 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/translation_service_client_config.json', + 'descriptorsConfigPath' => __DIR__ . '/../resources/translation_service_descriptor_config.php', + 'gcpApiConfigPath' => __DIR__ . '/../resources/translation_service_grpc_config.json', + 'credentialsConfig' => [ + 'defaultScopes' => self::$serviceScopes, + ], + 'transportConfig' => [ + 'rest' => [ + 'restClientConfigPath' => __DIR__ . '/../resources/translation_service_rest_client_config.php', + ], + ], + ]; + } + + private static function getGlossaryNameTemplate() + { + if (self::$glossaryNameTemplate == null) { + self::$glossaryNameTemplate = new PathTemplate('projects/{project}/locations/{location}/glossaries/{glossary}'); + } + + return self::$glossaryNameTemplate; + } + + private static function getLocationNameTemplate() + { + if (self::$locationNameTemplate == null) { + self::$locationNameTemplate = new PathTemplate('projects/{project}/locations/{location}'); + } + + return self::$locationNameTemplate; + } + + private static function getPathTemplateMap() + { + if (self::$pathTemplateMap == null) { + self::$pathTemplateMap = [ + 'glossary' => self::getGlossaryNameTemplate(), + 'location' => self::getLocationNameTemplate(), + ]; + } + + return self::$pathTemplateMap; + } + + /** + * Formats a string containing the fully-qualified path to represent a glossary + * resource. + * + * @param string $project + * @param string $location + * @param string $glossary + * + * @return string The formatted glossary resource. + */ + public static function glossaryName($project, $location, $glossary) + { + return self::getGlossaryNameTemplate()->render([ + 'project' => $project, + 'location' => $location, + 'glossary' => $glossary, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a location + * resource. + * + * @param string $project + * @param string $location + * + * @return string The formatted location resource. + */ + public static function locationName($project, $location) + { + return self::getLocationNameTemplate()->render([ + 'project' => $project, + 'location' => $location, + ]); + } + + /** + * Parses a formatted name string and returns an associative array of the components in the name. + * The following name formats are supported: + * Template: Pattern + * - glossary: projects/{project}/locations/{location}/glossaries/{glossary} + * - location: projects/{project}/locations/{location} + * + * 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 'translate.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); + } + + /** + * Translates a large volume of document in asynchronous batch mode. + * This function provides real-time output as the inputs are being processed. + * If caller cancels a request, the partial results (for an input file, it's + * all or nothing) may still be available on the specified output location. + * + * This call returns immediately and you can use + * google.longrunning.Operation.name to poll the status of the call. + * + * Sample code: + * ``` + * $translationServiceClient = new TranslationServiceClient(); + * try { + * $formattedParent = $translationServiceClient->locationName('[PROJECT]', '[LOCATION]'); + * $sourceLanguageCode = 'source_language_code'; + * $targetLanguageCodes = []; + * $inputConfigs = []; + * $outputConfig = new BatchDocumentOutputConfig(); + * $operationResponse = $translationServiceClient->batchTranslateDocument($formattedParent, $sourceLanguageCode, $targetLanguageCodes, $inputConfigs, $outputConfig); + * $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 = $translationServiceClient->batchTranslateDocument($formattedParent, $sourceLanguageCode, $targetLanguageCodes, $inputConfigs, $outputConfig); + * $operationName = $operationResponse->getName(); + * // ... do other work + * $newOperationResponse = $translationServiceClient->resumeOperation($operationName, 'batchTranslateDocument'); + * while (!$newOperationResponse->isDone()) { + * // ... do other work + * $newOperationResponse->reload(); + * } + * if ($newOperationResponse->operationSucceeded()) { + * $result = $newOperationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $newOperationResponse->getError(); + * // handleError($error) + * } + * } finally { + * $translationServiceClient->close(); + * } + * ``` + * + * @param string $parent Required. Location to make a regional call. + * + * Format: `projects/{project-number-or-id}/locations/{location-id}`. + * + * The `global` location is not supported for batch translation. + * + * Only AutoML Translation models or glossaries within the same region (have + * the same location-id) can be used, otherwise an INVALID_ARGUMENT (400) + * error is returned. + * @param string $sourceLanguageCode Required. The ISO-639 language code of the input document if known, for + * example, "en-US" or "sr-Latn". Supported language codes are listed in + * [Language Support](https://cloud.google.com/translate/docs/languages). + * @param string[] $targetLanguageCodes Required. The ISO-639 language code to use for translation of the input + * document. Specify up to 10 language codes here. + * @param BatchDocumentInputConfig[] $inputConfigs Required. Input configurations. + * The total number of files matched should be <= 100. + * The total content size to translate should be <= 100M Unicode codepoints. + * The files must use UTF-8 encoding. + * @param BatchDocumentOutputConfig $outputConfig Required. Output configuration. + * If 2 input configs match to the same file (that is, same input path), + * we don't generate output for duplicate inputs. + * @param array $optionalArgs { + * Optional. + * + * @type array $models + * Optional. The models to use for translation. Map's key is target language + * code. Map's value is the model name. Value can be a built-in general model, + * or an AutoML Translation model. + * + * The value format depends on model type: + * + * - AutoML Translation models: + * `projects/{project-number-or-id}/locations/{location-id}/models/{model-id}` + * + * - General (built-in) models: + * `projects/{project-number-or-id}/locations/{location-id}/models/general/nmt`, + * + * + * If the map is empty or a specific model is + * not requested for a language pair, then default google model (nmt) is used. + * @type array $glossaries + * Optional. Glossaries to be applied. It's keyed by target language code. + * @type array $formatConversions + * Optional. File format conversion map to be applied to all input files. + * Map's key is the original mime_type. Map's value is the target mime_type of + * translated documents. + * + * Supported file format conversion includes: + * - `application/pdf` to + * `application/vnd.openxmlformats-officedocument.wordprocessingml.document` + * + * If nothing specified, output files will be in the same format as the + * original file. + * @type string $customizedAttribution + * Optional. This flag is to support user customized attribution. + * If not provided, the default is `Machine Translated by Google`. + * Customized attribution should follow rules in + * https://cloud.google.com/translate/attribution#attribution_and_logos + * @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 batchTranslateDocument($parent, $sourceLanguageCode, $targetLanguageCodes, $inputConfigs, $outputConfig, array $optionalArgs = []) + { + $request = new BatchTranslateDocumentRequest(); + $requestParamHeaders = []; + $request->setParent($parent); + $request->setSourceLanguageCode($sourceLanguageCode); + $request->setTargetLanguageCodes($targetLanguageCodes); + $request->setInputConfigs($inputConfigs); + $request->setOutputConfig($outputConfig); + $requestParamHeaders['parent'] = $parent; + if (isset($optionalArgs['models'])) { + $request->setModels($optionalArgs['models']); + } + + if (isset($optionalArgs['glossaries'])) { + $request->setGlossaries($optionalArgs['glossaries']); + } + + if (isset($optionalArgs['formatConversions'])) { + $request->setFormatConversions($optionalArgs['formatConversions']); + } + + if (isset($optionalArgs['customizedAttribution'])) { + $request->setCustomizedAttribution($optionalArgs['customizedAttribution']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startOperationsCall('BatchTranslateDocument', $optionalArgs, $request, $this->getOperationsClient())->wait(); + } + + /** + * Translates a large volume of text in asynchronous batch mode. + * This function provides real-time output as the inputs are being processed. + * If caller cancels a request, the partial results (for an input file, it's + * all or nothing) may still be available on the specified output location. + * + * This call returns immediately and you can + * use google.longrunning.Operation.name to poll the status of the call. + * + * Sample code: + * ``` + * $translationServiceClient = new TranslationServiceClient(); + * try { + * $formattedParent = $translationServiceClient->locationName('[PROJECT]', '[LOCATION]'); + * $sourceLanguageCode = 'source_language_code'; + * $targetLanguageCodes = []; + * $inputConfigs = []; + * $outputConfig = new OutputConfig(); + * $operationResponse = $translationServiceClient->batchTranslateText($formattedParent, $sourceLanguageCode, $targetLanguageCodes, $inputConfigs, $outputConfig); + * $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 = $translationServiceClient->batchTranslateText($formattedParent, $sourceLanguageCode, $targetLanguageCodes, $inputConfigs, $outputConfig); + * $operationName = $operationResponse->getName(); + * // ... do other work + * $newOperationResponse = $translationServiceClient->resumeOperation($operationName, 'batchTranslateText'); + * while (!$newOperationResponse->isDone()) { + * // ... do other work + * $newOperationResponse->reload(); + * } + * if ($newOperationResponse->operationSucceeded()) { + * $result = $newOperationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $newOperationResponse->getError(); + * // handleError($error) + * } + * } finally { + * $translationServiceClient->close(); + * } + * ``` + * + * @param string $parent Required. Location to make a call. Must refer to a caller's project. + * + * Format: `projects/{project-number-or-id}/locations/{location-id}`. + * + * The `global` location is not supported for batch translation. + * + * Only AutoML Translation models or glossaries within the same region (have + * the same location-id) can be used, otherwise an INVALID_ARGUMENT (400) + * error is returned. + * @param string $sourceLanguageCode Required. Source language code. + * @param string[] $targetLanguageCodes Required. Specify up to 10 language codes here. + * @param InputConfig[] $inputConfigs Required. Input configurations. + * The total number of files matched should be <= 100. + * The total content size should be <= 100M Unicode codepoints. + * The files must use UTF-8 encoding. + * @param OutputConfig $outputConfig Required. Output configuration. + * If 2 input configs match to the same file (that is, same input path), + * we don't generate output for duplicate inputs. + * @param array $optionalArgs { + * Optional. + * + * @type array $models + * Optional. The models to use for translation. Map's key is target language + * code. Map's value is model name. Value can be a built-in general model, + * or an AutoML Translation model. + * + * The value format depends on model type: + * + * - AutoML Translation models: + * `projects/{project-number-or-id}/locations/{location-id}/models/{model-id}` + * + * - General (built-in) models: + * `projects/{project-number-or-id}/locations/{location-id}/models/general/nmt`, + * + * + * If the map is empty or a specific model is + * not requested for a language pair, then default google model (nmt) is used. + * @type array $glossaries + * Optional. Glossaries to be applied for translation. + * It's keyed by target language code. + * @type array $labels + * Optional. The labels with user-defined metadata for the request. + * + * Label keys and values can be no longer than 63 characters + * (Unicode codepoints), can only contain lowercase letters, numeric + * characters, underscores and dashes. International characters are allowed. + * Label values are optional. Label keys must start with a letter. + * + * See https://cloud.google.com/translate/docs/advanced/labels for more + * information. + * @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 batchTranslateText($parent, $sourceLanguageCode, $targetLanguageCodes, $inputConfigs, $outputConfig, array $optionalArgs = []) + { + $request = new BatchTranslateTextRequest(); + $requestParamHeaders = []; + $request->setParent($parent); + $request->setSourceLanguageCode($sourceLanguageCode); + $request->setTargetLanguageCodes($targetLanguageCodes); + $request->setInputConfigs($inputConfigs); + $request->setOutputConfig($outputConfig); + $requestParamHeaders['parent'] = $parent; + if (isset($optionalArgs['models'])) { + $request->setModels($optionalArgs['models']); + } + + if (isset($optionalArgs['glossaries'])) { + $request->setGlossaries($optionalArgs['glossaries']); + } + + if (isset($optionalArgs['labels'])) { + $request->setLabels($optionalArgs['labels']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startOperationsCall('BatchTranslateText', $optionalArgs, $request, $this->getOperationsClient())->wait(); + } + + /** + * Creates a glossary and returns the long-running operation. Returns + * NOT_FOUND, if the project doesn't exist. + * + * Sample code: + * ``` + * $translationServiceClient = new TranslationServiceClient(); + * try { + * $formattedParent = $translationServiceClient->locationName('[PROJECT]', '[LOCATION]'); + * $glossary = new Glossary(); + * $operationResponse = $translationServiceClient->createGlossary($formattedParent, $glossary); + * $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 = $translationServiceClient->createGlossary($formattedParent, $glossary); + * $operationName = $operationResponse->getName(); + * // ... do other work + * $newOperationResponse = $translationServiceClient->resumeOperation($operationName, 'createGlossary'); + * while (!$newOperationResponse->isDone()) { + * // ... do other work + * $newOperationResponse->reload(); + * } + * if ($newOperationResponse->operationSucceeded()) { + * $result = $newOperationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $newOperationResponse->getError(); + * // handleError($error) + * } + * } finally { + * $translationServiceClient->close(); + * } + * ``` + * + * @param string $parent Required. The project name. + * @param Glossary $glossary Required. The glossary to create. + * @param array $optionalArgs { + * 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 \Google\ApiCore\OperationResponse + * + * @throws ApiException if the remote call fails + */ + public function createGlossary($parent, $glossary, array $optionalArgs = []) + { + $request = new CreateGlossaryRequest(); + $requestParamHeaders = []; + $request->setParent($parent); + $request->setGlossary($glossary); + $requestParamHeaders['parent'] = $parent; + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startOperationsCall('CreateGlossary', $optionalArgs, $request, $this->getOperationsClient())->wait(); + } + + /** + * Deletes a glossary, or cancels glossary construction + * if the glossary isn't created yet. + * Returns NOT_FOUND, if the glossary doesn't exist. + * + * Sample code: + * ``` + * $translationServiceClient = new TranslationServiceClient(); + * try { + * $formattedName = $translationServiceClient->glossaryName('[PROJECT]', '[LOCATION]', '[GLOSSARY]'); + * $operationResponse = $translationServiceClient->deleteGlossary($formattedName); + * $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 = $translationServiceClient->deleteGlossary($formattedName); + * $operationName = $operationResponse->getName(); + * // ... do other work + * $newOperationResponse = $translationServiceClient->resumeOperation($operationName, 'deleteGlossary'); + * while (!$newOperationResponse->isDone()) { + * // ... do other work + * $newOperationResponse->reload(); + * } + * if ($newOperationResponse->operationSucceeded()) { + * $result = $newOperationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $newOperationResponse->getError(); + * // handleError($error) + * } + * } finally { + * $translationServiceClient->close(); + * } + * ``` + * + * @param string $name Required. The name of the glossary to delete. + * @param array $optionalArgs { + * 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 \Google\ApiCore\OperationResponse + * + * @throws ApiException if the remote call fails + */ + public function deleteGlossary($name, array $optionalArgs = []) + { + $request = new DeleteGlossaryRequest(); + $requestParamHeaders = []; + $request->setName($name); + $requestParamHeaders['name'] = $name; + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startOperationsCall('DeleteGlossary', $optionalArgs, $request, $this->getOperationsClient())->wait(); + } + + /** + * Detects the language of text within a request. + * + * Sample code: + * ``` + * $translationServiceClient = new TranslationServiceClient(); + * try { + * $formattedParent = $translationServiceClient->locationName('[PROJECT]', '[LOCATION]'); + * $response = $translationServiceClient->detectLanguage($formattedParent); + * } finally { + * $translationServiceClient->close(); + * } + * ``` + * + * @param string $parent Required. Project or location to make a call. Must refer to a caller's + * project. + * + * Format: `projects/{project-number-or-id}/locations/{location-id}` or + * `projects/{project-number-or-id}`. + * + * For global calls, use `projects/{project-number-or-id}/locations/global` or + * `projects/{project-number-or-id}`. + * + * Only models within the same region (has same location-id) can be used. + * Otherwise an INVALID_ARGUMENT (400) error is returned. + * @param array $optionalArgs { + * Optional. + * + * @type string $model + * Optional. The language detection model to be used. + * + * Format: + * `projects/{project-number-or-id}/locations/{location-id}/models/language-detection/{model-id}` + * + * Only one language detection model is currently supported: + * `projects/{project-number-or-id}/locations/{location-id}/models/language-detection/default`. + * + * If not specified, the default model is used. + * @type string $content + * The content of the input stored as a string. + * @type string $mimeType + * Optional. The format of the source text, for example, "text/html", + * "text/plain". If left blank, the MIME type defaults to "text/html". + * @type array $labels + * Optional. The labels with user-defined metadata for the request. + * + * Label keys and values can be no longer than 63 characters + * (Unicode codepoints), can only contain lowercase letters, numeric + * characters, underscores and dashes. International characters are allowed. + * Label values are optional. Label keys must start with a letter. + * + * See https://cloud.google.com/translate/docs/advanced/labels for more + * information. + * @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\Translate\V3\DetectLanguageResponse + * + * @throws ApiException if the remote call fails + */ + public function detectLanguage($parent, array $optionalArgs = []) + { + $request = new DetectLanguageRequest(); + $requestParamHeaders = []; + $request->setParent($parent); + $requestParamHeaders['parent'] = $parent; + if (isset($optionalArgs['model'])) { + $request->setModel($optionalArgs['model']); + } + + if (isset($optionalArgs['content'])) { + $request->setContent($optionalArgs['content']); + } + + if (isset($optionalArgs['mimeType'])) { + $request->setMimeType($optionalArgs['mimeType']); + } + + if (isset($optionalArgs['labels'])) { + $request->setLabels($optionalArgs['labels']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('DetectLanguage', DetectLanguageResponse::class, $optionalArgs, $request)->wait(); + } + + /** + * Gets a glossary. Returns NOT_FOUND, if the glossary doesn't + * exist. + * + * Sample code: + * ``` + * $translationServiceClient = new TranslationServiceClient(); + * try { + * $formattedName = $translationServiceClient->glossaryName('[PROJECT]', '[LOCATION]', '[GLOSSARY]'); + * $response = $translationServiceClient->getGlossary($formattedName); + * } finally { + * $translationServiceClient->close(); + * } + * ``` + * + * @param string $name Required. The name of the glossary to retrieve. + * @param array $optionalArgs { + * 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 \Google\Cloud\Translate\V3\Glossary + * + * @throws ApiException if the remote call fails + */ + public function getGlossary($name, array $optionalArgs = []) + { + $request = new GetGlossaryRequest(); + $requestParamHeaders = []; + $request->setName($name); + $requestParamHeaders['name'] = $name; + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('GetGlossary', Glossary::class, $optionalArgs, $request)->wait(); + } + + /** + * Returns a list of supported languages for translation. + * + * Sample code: + * ``` + * $translationServiceClient = new TranslationServiceClient(); + * try { + * $formattedParent = $translationServiceClient->locationName('[PROJECT]', '[LOCATION]'); + * $response = $translationServiceClient->getSupportedLanguages($formattedParent); + * } finally { + * $translationServiceClient->close(); + * } + * ``` + * + * @param string $parent Required. Project or location to make a call. Must refer to a caller's + * project. + * + * Format: `projects/{project-number-or-id}` or + * `projects/{project-number-or-id}/locations/{location-id}`. + * + * For global calls, use `projects/{project-number-or-id}/locations/global` or + * `projects/{project-number-or-id}`. + * + * Non-global location is required for AutoML models. + * + * Only models within the same region (have same location-id) can be used, + * otherwise an INVALID_ARGUMENT (400) error is returned. + * @param array $optionalArgs { + * Optional. + * + * @type string $displayLanguageCode + * Optional. The language to use to return localized, human readable names + * of supported languages. If missing, then display names are not returned + * in a response. + * @type string $model + * Optional. Get supported languages of this model. + * + * The format depends on model type: + * + * - AutoML Translation models: + * `projects/{project-number-or-id}/locations/{location-id}/models/{model-id}` + * + * - General (built-in) models: + * `projects/{project-number-or-id}/locations/{location-id}/models/general/nmt`, + * + * + * Returns languages supported by the specified model. + * If missing, we get supported languages of Google general NMT model. + * @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\Translate\V3\SupportedLanguages + * + * @throws ApiException if the remote call fails + */ + public function getSupportedLanguages($parent, array $optionalArgs = []) + { + $request = new GetSupportedLanguagesRequest(); + $requestParamHeaders = []; + $request->setParent($parent); + $requestParamHeaders['parent'] = $parent; + if (isset($optionalArgs['displayLanguageCode'])) { + $request->setDisplayLanguageCode($optionalArgs['displayLanguageCode']); + } + + if (isset($optionalArgs['model'])) { + $request->setModel($optionalArgs['model']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('GetSupportedLanguages', SupportedLanguages::class, $optionalArgs, $request)->wait(); + } + + /** + * Lists glossaries in a project. Returns NOT_FOUND, if the project doesn't + * exist. + * + * Sample code: + * ``` + * $translationServiceClient = new TranslationServiceClient(); + * try { + * $formattedParent = $translationServiceClient->locationName('[PROJECT]', '[LOCATION]'); + * // Iterate over pages of elements + * $pagedResponse = $translationServiceClient->listGlossaries($formattedParent); + * foreach ($pagedResponse->iteratePages() as $page) { + * foreach ($page as $element) { + * // doSomethingWith($element); + * } + * } + * // Alternatively: + * // Iterate through all elements + * $pagedResponse = $translationServiceClient->listGlossaries($formattedParent); + * foreach ($pagedResponse->iterateAllElements() as $element) { + * // doSomethingWith($element); + * } + * } finally { + * $translationServiceClient->close(); + * } + * ``` + * + * @param string $parent Required. The name of the project from which to list all of the glossaries. + * @param array $optionalArgs { + * Optional. + * + * @type int $pageSize + * The maximum number of resources contained in the underlying API + * response. The API may return fewer values in a page, even if + * there are additional values to be retrieved. + * @type string $pageToken + * A page token is used to specify a page of values to be returned. + * If no page token is specified (the default), the first page + * of values will be returned. Any page token used here must have + * been generated by a previous call to the API. + * @type string $filter + * Optional. Filter specifying constraints of a list operation. + * Specify the constraint by the format of "key=value", where key must be + * "src" or "tgt", and the value must be a valid language code. + * For multiple restrictions, concatenate them by "AND" (uppercase only), + * such as: "src=en-US AND tgt=zh-CN". Notice that the exact match is used + * here, which means using 'en-US' and 'en' can lead to different results, + * which depends on the language code you used when you create the glossary. + * For the unidirectional glossaries, the "src" and "tgt" add restrictions + * on the source and target language code separately. + * For the equivalent term set glossaries, the "src" and/or "tgt" add + * restrictions on the term set. + * For example: "src=en-US AND tgt=zh-CN" will only pick the unidirectional + * glossaries which exactly match the source language code as "en-US" and the + * target language code "zh-CN", but all equivalent term set glossaries which + * contain "en-US" and "zh-CN" in their language set will be picked. + * If missing, no filtering is performed. + * @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\PagedListResponse + * + * @throws ApiException if the remote call fails + */ + public function listGlossaries($parent, array $optionalArgs = []) + { + $request = new ListGlossariesRequest(); + $requestParamHeaders = []; + $request->setParent($parent); + $requestParamHeaders['parent'] = $parent; + if (isset($optionalArgs['pageSize'])) { + $request->setPageSize($optionalArgs['pageSize']); + } + + if (isset($optionalArgs['pageToken'])) { + $request->setPageToken($optionalArgs['pageToken']); + } + + if (isset($optionalArgs['filter'])) { + $request->setFilter($optionalArgs['filter']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->getPagedListResponse('ListGlossaries', $optionalArgs, ListGlossariesResponse::class, $request); + } + + /** + * Translates documents in synchronous mode. + * + * Sample code: + * ``` + * $translationServiceClient = new TranslationServiceClient(); + * try { + * $parent = 'parent'; + * $targetLanguageCode = 'target_language_code'; + * $documentInputConfig = new DocumentInputConfig(); + * $response = $translationServiceClient->translateDocument($parent, $targetLanguageCode, $documentInputConfig); + * } finally { + * $translationServiceClient->close(); + * } + * ``` + * + * @param string $parent Required. Location to make a regional call. + * + * Format: `projects/{project-number-or-id}/locations/{location-id}`. + * + * For global calls, use `projects/{project-number-or-id}/locations/global` or + * `projects/{project-number-or-id}`. + * + * Non-global location is required for requests using AutoML models or custom + * glossaries. + * + * Models and glossaries must be within the same region (have the same + * location-id), otherwise an INVALID_ARGUMENT (400) error is returned. + * @param string $targetLanguageCode Required. The ISO-639 language code to use for translation of the input + * document, set to one of the language codes listed in Language Support. + * @param DocumentInputConfig $documentInputConfig Required. Input configurations. + * @param array $optionalArgs { + * Optional. + * + * @type string $sourceLanguageCode + * Optional. The ISO-639 language code of the input document if known, for + * example, "en-US" or "sr-Latn". Supported language codes are listed in + * Language Support. If the source language isn't specified, the API attempts + * to identify the source language automatically and returns the source + * language within the response. Source language must be specified if the + * request contains a glossary or a custom model. + * @type DocumentOutputConfig $documentOutputConfig + * Optional. Output configurations. + * Defines if the output file should be stored within Cloud Storage as well + * as the desired output format. If not provided the translated file will + * only be returned through a byte-stream and its output mime type will be + * the same as the input file's mime type. + * @type string $model + * Optional. The `model` type requested for this translation. + * + * The format depends on model type: + * + * - AutoML Translation models: + * `projects/{project-number-or-id}/locations/{location-id}/models/{model-id}` + * + * - General (built-in) models: + * `projects/{project-number-or-id}/locations/{location-id}/models/general/nmt`, + * + * + * If not provided, the default Google model (NMT) will be used for + * translation. + * @type TranslateTextGlossaryConfig $glossaryConfig + * Optional. Glossary to be applied. The glossary must be within the same + * region (have the same location-id) as the model, otherwise an + * INVALID_ARGUMENT (400) error is returned. + * @type array $labels + * Optional. The labels with user-defined metadata for the request. + * + * Label keys and values can be no longer than 63 characters (Unicode + * codepoints), can only contain lowercase letters, numeric characters, + * underscores and dashes. International characters are allowed. Label values + * are optional. Label keys must start with a letter. + * + * See https://cloud.google.com/translate/docs/advanced/labels for more + * information. + * @type string $customizedAttribution + * Optional. This flag is to support user customized attribution. + * If not provided, the default is `Machine Translated by Google`. + * Customized attribution should follow rules in + * https://cloud.google.com/translate/attribution#attribution_and_logos + * @type bool $isTranslateNativePdfOnly + * Optional. If true, the page limit of online native pdf translation is 300 + * and only native pdf pages will be translated. + * @type bool $enableShadowRemovalNativePdf + * Optional. If true, use the text removal to remove the shadow text on + * background image for native pdf translation. + * Shadow removal feature can only be enabled when + * is_translate_native_pdf_only is false + * @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\Translate\V3\TranslateDocumentResponse + * + * @throws ApiException if the remote call fails + */ + public function translateDocument($parent, $targetLanguageCode, $documentInputConfig, array $optionalArgs = []) + { + $request = new TranslateDocumentRequest(); + $requestParamHeaders = []; + $request->setParent($parent); + $request->setTargetLanguageCode($targetLanguageCode); + $request->setDocumentInputConfig($documentInputConfig); + $requestParamHeaders['parent'] = $parent; + if (isset($optionalArgs['sourceLanguageCode'])) { + $request->setSourceLanguageCode($optionalArgs['sourceLanguageCode']); + } + + if (isset($optionalArgs['documentOutputConfig'])) { + $request->setDocumentOutputConfig($optionalArgs['documentOutputConfig']); + } + + if (isset($optionalArgs['model'])) { + $request->setModel($optionalArgs['model']); + } + + if (isset($optionalArgs['glossaryConfig'])) { + $request->setGlossaryConfig($optionalArgs['glossaryConfig']); + } + + if (isset($optionalArgs['labels'])) { + $request->setLabels($optionalArgs['labels']); + } + + if (isset($optionalArgs['customizedAttribution'])) { + $request->setCustomizedAttribution($optionalArgs['customizedAttribution']); + } + + if (isset($optionalArgs['isTranslateNativePdfOnly'])) { + $request->setIsTranslateNativePdfOnly($optionalArgs['isTranslateNativePdfOnly']); + } + + if (isset($optionalArgs['enableShadowRemovalNativePdf'])) { + $request->setEnableShadowRemovalNativePdf($optionalArgs['enableShadowRemovalNativePdf']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('TranslateDocument', TranslateDocumentResponse::class, $optionalArgs, $request)->wait(); + } + + /** + * Translates input text and returns translated text. + * + * Sample code: + * ``` + * $translationServiceClient = new TranslationServiceClient(); + * try { + * $contents = []; + * $targetLanguageCode = 'target_language_code'; + * $formattedParent = $translationServiceClient->locationName('[PROJECT]', '[LOCATION]'); + * $response = $translationServiceClient->translateText($contents, $targetLanguageCode, $formattedParent); + * } finally { + * $translationServiceClient->close(); + * } + * ``` + * + * @param string[] $contents Required. The content of the input in string format. + * We recommend the total content be less than 30,000 codepoints. The max + * length of this field is 1024. Use BatchTranslateText for larger text. + * @param string $targetLanguageCode Required. The ISO-639 language code to use for translation of the input + * text, set to one of the language codes listed in Language Support. + * @param string $parent Required. Project or location to make a call. Must refer to a caller's + * project. + * + * Format: `projects/{project-number-or-id}` or + * `projects/{project-number-or-id}/locations/{location-id}`. + * + * For global calls, use `projects/{project-number-or-id}/locations/global` or + * `projects/{project-number-or-id}`. + * + * Non-global location is required for requests using AutoML models or + * custom glossaries. + * + * Models and glossaries must be within the same region (have same + * location-id), otherwise an INVALID_ARGUMENT (400) error is returned. + * @param array $optionalArgs { + * Optional. + * + * @type string $mimeType + * Optional. The format of the source text, for example, "text/html", + * "text/plain". If left blank, the MIME type defaults to "text/html". + * @type string $sourceLanguageCode + * Optional. The ISO-639 language code of the input text if + * known, for example, "en-US" or "sr-Latn". Supported language codes are + * listed in Language Support. If the source language isn't specified, the API + * attempts to identify the source language automatically and returns the + * source language within the response. + * @type string $model + * Optional. The `model` type requested for this translation. + * + * The format depends on model type: + * + * - AutoML Translation models: + * `projects/{project-number-or-id}/locations/{location-id}/models/{model-id}` + * + * - General (built-in) models: + * `projects/{project-number-or-id}/locations/{location-id}/models/general/nmt`, + * + * + * For global (non-regionalized) requests, use `location-id` `global`. + * For example, + * `projects/{project-number-or-id}/locations/global/models/general/nmt`. + * + * If not provided, the default Google model (NMT) will be used. + * @type TranslateTextGlossaryConfig $glossaryConfig + * Optional. Glossary to be applied. The glossary must be + * within the same region (have the same location-id) as the model, otherwise + * an INVALID_ARGUMENT (400) error is returned. + * @type array $labels + * Optional. The labels with user-defined metadata for the request. + * + * Label keys and values can be no longer than 63 characters + * (Unicode codepoints), can only contain lowercase letters, numeric + * characters, underscores and dashes. International characters are allowed. + * Label values are optional. Label keys must start with a letter. + * + * See https://cloud.google.com/translate/docs/advanced/labels for more + * information. + * @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\Translate\V3\TranslateTextResponse + * + * @throws ApiException if the remote call fails + */ + public function translateText($contents, $targetLanguageCode, $parent, array $optionalArgs = []) + { + $request = new TranslateTextRequest(); + $requestParamHeaders = []; + $request->setContents($contents); + $request->setTargetLanguageCode($targetLanguageCode); + $request->setParent($parent); + $requestParamHeaders['parent'] = $parent; + if (isset($optionalArgs['mimeType'])) { + $request->setMimeType($optionalArgs['mimeType']); + } + + if (isset($optionalArgs['sourceLanguageCode'])) { + $request->setSourceLanguageCode($optionalArgs['sourceLanguageCode']); + } + + if (isset($optionalArgs['model'])) { + $request->setModel($optionalArgs['model']); + } + + if (isset($optionalArgs['glossaryConfig'])) { + $request->setGlossaryConfig($optionalArgs['glossaryConfig']); + } + + if (isset($optionalArgs['labels'])) { + $request->setLabels($optionalArgs['labels']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('TranslateText', TranslateTextResponse::class, $optionalArgs, $request)->wait(); + } +} diff --git a/owl-bot-staging/Translate/v3/src/V3/TranslationServiceClient.php b/owl-bot-staging/Translate/v3/src/V3/TranslationServiceClient.php new file mode 100644 index 00000000000..2a4a28a809c --- /dev/null +++ b/owl-bot-staging/Translate/v3/src/V3/TranslationServiceClient.php @@ -0,0 +1,34 @@ + [ + 'google.cloud.translation.v3.TranslationService' => [ + 'BatchTranslateDocument' => [ + 'longRunning' => [ + 'operationReturnType' => '\Google\Cloud\Translate\V3\BatchTranslateDocumentResponse', + 'metadataReturnType' => '\Google\Cloud\Translate\V3\BatchTranslateDocumentMetadata', + 'initialPollDelayMillis' => '500', + 'pollDelayMultiplier' => '1.5', + 'maxPollDelayMillis' => '5000', + 'totalPollTimeoutMillis' => '300000', + ], + ], + 'BatchTranslateText' => [ + 'longRunning' => [ + 'operationReturnType' => '\Google\Cloud\Translate\V3\BatchTranslateResponse', + 'metadataReturnType' => '\Google\Cloud\Translate\V3\BatchTranslateMetadata', + 'initialPollDelayMillis' => '500', + 'pollDelayMultiplier' => '1.5', + 'maxPollDelayMillis' => '5000', + 'totalPollTimeoutMillis' => '300000', + ], + ], + 'CreateGlossary' => [ + 'longRunning' => [ + 'operationReturnType' => '\Google\Cloud\Translate\V3\Glossary', + 'metadataReturnType' => '\Google\Cloud\Translate\V3\CreateGlossaryMetadata', + 'initialPollDelayMillis' => '500', + 'pollDelayMultiplier' => '1.5', + 'maxPollDelayMillis' => '5000', + 'totalPollTimeoutMillis' => '300000', + ], + ], + 'DeleteGlossary' => [ + 'longRunning' => [ + 'operationReturnType' => '\Google\Cloud\Translate\V3\DeleteGlossaryResponse', + 'metadataReturnType' => '\Google\Cloud\Translate\V3\DeleteGlossaryMetadata', + 'initialPollDelayMillis' => '500', + 'pollDelayMultiplier' => '1.5', + 'maxPollDelayMillis' => '5000', + 'totalPollTimeoutMillis' => '300000', + ], + ], + 'ListGlossaries' => [ + 'pageStreaming' => [ + 'requestPageTokenGetMethod' => 'getPageToken', + 'requestPageTokenSetMethod' => 'setPageToken', + 'requestPageSizeGetMethod' => 'getPageSize', + 'requestPageSizeSetMethod' => 'setPageSize', + 'responsePageTokenGetMethod' => 'getNextPageToken', + 'resourcesGetMethod' => 'getGlossaries', + ], + ], + ], + ], +]; diff --git a/owl-bot-staging/Translate/v3/src/V3/resources/translation_service_rest_client_config.php b/owl-bot-staging/Translate/v3/src/V3/resources/translation_service_rest_client_config.php new file mode 100644 index 00000000000..0239536089f --- /dev/null +++ b/owl-bot-staging/Translate/v3/src/V3/resources/translation_service_rest_client_config.php @@ -0,0 +1,228 @@ + [ + 'google.cloud.location.Locations' => [ + 'GetLocation' => [ + 'method' => 'get', + 'uriTemplate' => '/v3/{name=projects/*/locations/*}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'ListLocations' => [ + 'method' => 'get', + 'uriTemplate' => '/v3/{name=projects/*}/locations', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + ], + 'google.cloud.translation.v3.TranslationService' => [ + 'BatchTranslateDocument' => [ + 'method' => 'post', + 'uriTemplate' => '/v3/{parent=projects/*/locations/*}:batchTranslateDocument', + 'body' => '*', + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + ], + 'BatchTranslateText' => [ + 'method' => 'post', + 'uriTemplate' => '/v3/{parent=projects/*/locations/*}:batchTranslateText', + 'body' => '*', + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + ], + 'CreateGlossary' => [ + 'method' => 'post', + 'uriTemplate' => '/v3/{parent=projects/*/locations/*}/glossaries', + 'body' => 'glossary', + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + ], + 'DeleteGlossary' => [ + 'method' => 'delete', + 'uriTemplate' => '/v3/{name=projects/*/locations/*/glossaries/*}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'DetectLanguage' => [ + 'method' => 'post', + 'uriTemplate' => '/v3/{parent=projects/*/locations/*}:detectLanguage', + 'body' => '*', + 'additionalBindings' => [ + [ + 'method' => 'post', + 'uriTemplate' => '/v3/{parent=projects/*}:detectLanguage', + 'body' => '*', + ], + ], + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + ], + 'GetGlossary' => [ + 'method' => 'get', + 'uriTemplate' => '/v3/{name=projects/*/locations/*/glossaries/*}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'GetSupportedLanguages' => [ + 'method' => 'get', + 'uriTemplate' => '/v3/{parent=projects/*/locations/*}/supportedLanguages', + 'additionalBindings' => [ + [ + 'method' => 'get', + 'uriTemplate' => '/v3/{parent=projects/*}/supportedLanguages', + ], + ], + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + ], + 'ListGlossaries' => [ + 'method' => 'get', + 'uriTemplate' => '/v3/{parent=projects/*/locations/*}/glossaries', + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + ], + 'TranslateDocument' => [ + 'method' => 'post', + 'uriTemplate' => '/v3/{parent=projects/*/locations/*}:translateDocument', + 'body' => '*', + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + ], + 'TranslateText' => [ + 'method' => 'post', + 'uriTemplate' => '/v3/{parent=projects/*/locations/*}:translateText', + 'body' => '*', + 'additionalBindings' => [ + [ + 'method' => 'post', + 'uriTemplate' => '/v3/{parent=projects/*}:translateText', + 'body' => '*', + ], + ], + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + ], + ], + 'google.longrunning.Operations' => [ + 'CancelOperation' => [ + 'method' => 'post', + 'uriTemplate' => '/v3/{name=projects/*/locations/*/operations/*}:cancel', + 'body' => '*', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'DeleteOperation' => [ + 'method' => 'delete', + 'uriTemplate' => '/v3/{name=projects/*/locations/*/operations/*}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'GetOperation' => [ + 'method' => 'get', + 'uriTemplate' => '/v3/{name=projects/*/locations/*/operations/*}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'ListOperations' => [ + 'method' => 'get', + 'uriTemplate' => '/v3/{name=projects/*/locations/*}/operations', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'WaitOperation' => [ + 'method' => 'post', + 'uriTemplate' => '/v3/{name=projects/*/locations/*/operations/*}:wait', + 'body' => '*', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + ], + ], + 'numericEnums' => true, +]; diff --git a/owl-bot-staging/Translate/v3/tests/Unit/V3/TranslationServiceClientTest.php b/owl-bot-staging/Translate/v3/tests/Unit/V3/TranslationServiceClientTest.php new file mode 100644 index 00000000000..9ba2aa0e0f6 --- /dev/null +++ b/owl-bot-staging/Translate/v3/tests/Unit/V3/TranslationServiceClientTest.php @@ -0,0 +1,996 @@ +getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); + } + + /** @return TranslationServiceClient */ + private function createClient(array $options = []) + { + $options += [ + 'credentials' => $this->createCredentials(), + ]; + return new TranslationServiceClient($options); + } + + /** @test */ + public function batchTranslateDocumentTest() + { + $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/batchTranslateDocumentTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $totalPages = 396186871; + $translatedPages = 1652747493; + $failedPages = 2002254526; + $totalBillablePages = 1292117569; + $totalCharacters = 1368640955; + $translatedCharacters = 1337326221; + $failedCharacters = 1723028396; + $totalBillableCharacters = 1242495501; + $expectedResponse = new BatchTranslateDocumentResponse(); + $expectedResponse->setTotalPages($totalPages); + $expectedResponse->setTranslatedPages($translatedPages); + $expectedResponse->setFailedPages($failedPages); + $expectedResponse->setTotalBillablePages($totalBillablePages); + $expectedResponse->setTotalCharacters($totalCharacters); + $expectedResponse->setTranslatedCharacters($translatedCharacters); + $expectedResponse->setFailedCharacters($failedCharacters); + $expectedResponse->setTotalBillableCharacters($totalBillableCharacters); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/batchTranslateDocumentTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + $sourceLanguageCode = 'sourceLanguageCode1687263568'; + $targetLanguageCodes = []; + $inputConfigs = []; + $outputConfig = new BatchDocumentOutputConfig(); + $response = $gapicClient->batchTranslateDocument($formattedParent, $sourceLanguageCode, $targetLanguageCodes, $inputConfigs, $outputConfig); + $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.translation.v3.TranslationService/BatchTranslateDocument', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $actualValue = $actualApiRequestObject->getSourceLanguageCode(); + $this->assertProtobufEquals($sourceLanguageCode, $actualValue); + $actualValue = $actualApiRequestObject->getTargetLanguageCodes(); + $this->assertProtobufEquals($targetLanguageCodes, $actualValue); + $actualValue = $actualApiRequestObject->getInputConfigs(); + $this->assertProtobufEquals($inputConfigs, $actualValue); + $actualValue = $actualApiRequestObject->getOutputConfig(); + $this->assertProtobufEquals($outputConfig, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/batchTranslateDocumentTest'); + $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 batchTranslateDocumentExceptionTest() + { + $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/batchTranslateDocumentTest'); + $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 + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + $sourceLanguageCode = 'sourceLanguageCode1687263568'; + $targetLanguageCodes = []; + $inputConfigs = []; + $outputConfig = new BatchDocumentOutputConfig(); + $response = $gapicClient->batchTranslateDocument($formattedParent, $sourceLanguageCode, $targetLanguageCodes, $inputConfigs, $outputConfig); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/batchTranslateDocumentTest'); + 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 batchTranslateTextTest() + { + $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/batchTranslateTextTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $totalCharacters = 1368640955; + $translatedCharacters = 1337326221; + $failedCharacters = 1723028396; + $expectedResponse = new BatchTranslateResponse(); + $expectedResponse->setTotalCharacters($totalCharacters); + $expectedResponse->setTranslatedCharacters($translatedCharacters); + $expectedResponse->setFailedCharacters($failedCharacters); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/batchTranslateTextTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + $sourceLanguageCode = 'sourceLanguageCode1687263568'; + $targetLanguageCodes = []; + $inputConfigs = []; + $outputConfig = new OutputConfig(); + $response = $gapicClient->batchTranslateText($formattedParent, $sourceLanguageCode, $targetLanguageCodes, $inputConfigs, $outputConfig); + $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.translation.v3.TranslationService/BatchTranslateText', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $actualValue = $actualApiRequestObject->getSourceLanguageCode(); + $this->assertProtobufEquals($sourceLanguageCode, $actualValue); + $actualValue = $actualApiRequestObject->getTargetLanguageCodes(); + $this->assertProtobufEquals($targetLanguageCodes, $actualValue); + $actualValue = $actualApiRequestObject->getInputConfigs(); + $this->assertProtobufEquals($inputConfigs, $actualValue); + $actualValue = $actualApiRequestObject->getOutputConfig(); + $this->assertProtobufEquals($outputConfig, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/batchTranslateTextTest'); + $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 batchTranslateTextExceptionTest() + { + $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/batchTranslateTextTest'); + $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 + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + $sourceLanguageCode = 'sourceLanguageCode1687263568'; + $targetLanguageCodes = []; + $inputConfigs = []; + $outputConfig = new OutputConfig(); + $response = $gapicClient->batchTranslateText($formattedParent, $sourceLanguageCode, $targetLanguageCodes, $inputConfigs, $outputConfig); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/batchTranslateTextTest'); + 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 createGlossaryTest() + { + $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/createGlossaryTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $name = 'name3373707'; + $entryCount = 811131134; + $displayName = 'displayName1615086568'; + $expectedResponse = new Glossary(); + $expectedResponse->setName($name); + $expectedResponse->setEntryCount($entryCount); + $expectedResponse->setDisplayName($displayName); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/createGlossaryTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + $glossary = new Glossary(); + $glossaryName = 'glossaryName-297469495'; + $glossary->setName($glossaryName); + $response = $gapicClient->createGlossary($formattedParent, $glossary); + $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.translation.v3.TranslationService/CreateGlossary', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $actualValue = $actualApiRequestObject->getGlossary(); + $this->assertProtobufEquals($glossary, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/createGlossaryTest'); + $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 createGlossaryExceptionTest() + { + $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/createGlossaryTest'); + $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 + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + $glossary = new Glossary(); + $glossaryName = 'glossaryName-297469495'; + $glossary->setName($glossaryName); + $response = $gapicClient->createGlossary($formattedParent, $glossary); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/createGlossaryTest'); + 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 deleteGlossaryTest() + { + $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/deleteGlossaryTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $name2 = 'name2-1052831874'; + $expectedResponse = new DeleteGlossaryResponse(); + $expectedResponse->setName($name2); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/deleteGlossaryTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $formattedName = $gapicClient->glossaryName('[PROJECT]', '[LOCATION]', '[GLOSSARY]'); + $response = $gapicClient->deleteGlossary($formattedName); + $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.translation.v3.TranslationService/DeleteGlossary', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/deleteGlossaryTest'); + $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 deleteGlossaryExceptionTest() + { + $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/deleteGlossaryTest'); + $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 + $formattedName = $gapicClient->glossaryName('[PROJECT]', '[LOCATION]', '[GLOSSARY]'); + $response = $gapicClient->deleteGlossary($formattedName); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/deleteGlossaryTest'); + 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 detectLanguageTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $expectedResponse = new DetectLanguageResponse(); + $transport->addResponse($expectedResponse); + // Mock request + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + $response = $gapicClient->detectLanguage($formattedParent); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.translation.v3.TranslationService/DetectLanguage', $actualFuncCall); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function detectLanguageExceptionTest() + { + $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 + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + try { + $gapicClient->detectLanguage($formattedParent); + // 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 getGlossaryTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name2 = 'name2-1052831874'; + $entryCount = 811131134; + $displayName = 'displayName1615086568'; + $expectedResponse = new Glossary(); + $expectedResponse->setName($name2); + $expectedResponse->setEntryCount($entryCount); + $expectedResponse->setDisplayName($displayName); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->glossaryName('[PROJECT]', '[LOCATION]', '[GLOSSARY]'); + $response = $gapicClient->getGlossary($formattedName); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.translation.v3.TranslationService/GetGlossary', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getGlossaryExceptionTest() + { + $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 + $formattedName = $gapicClient->glossaryName('[PROJECT]', '[LOCATION]', '[GLOSSARY]'); + try { + $gapicClient->getGlossary($formattedName); + // 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 getSupportedLanguagesTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $expectedResponse = new SupportedLanguages(); + $transport->addResponse($expectedResponse); + // Mock request + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + $response = $gapicClient->getSupportedLanguages($formattedParent); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.translation.v3.TranslationService/GetSupportedLanguages', $actualFuncCall); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getSupportedLanguagesExceptionTest() + { + $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 + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + try { + $gapicClient->getSupportedLanguages($formattedParent); + // 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 listGlossariesTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $nextPageToken = ''; + $glossariesElement = new Glossary(); + $glossaries = [ + $glossariesElement, + ]; + $expectedResponse = new ListGlossariesResponse(); + $expectedResponse->setNextPageToken($nextPageToken); + $expectedResponse->setGlossaries($glossaries); + $transport->addResponse($expectedResponse); + // Mock request + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + $response = $gapicClient->listGlossaries($formattedParent); + $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); + $resources = iterator_to_array($response->iterateAllElements()); + $this->assertSame(1, count($resources)); + $this->assertEquals($expectedResponse->getGlossaries()[0], $resources[0]); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.translation.v3.TranslationService/ListGlossaries', $actualFuncCall); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listGlossariesExceptionTest() + { + $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 + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + try { + $gapicClient->listGlossaries($formattedParent); + // 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 translateDocumentTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $model2 = 'model21226956956'; + $expectedResponse = new TranslateDocumentResponse(); + $expectedResponse->setModel($model2); + $transport->addResponse($expectedResponse); + // Mock request + $parent = 'parent-995424086'; + $targetLanguageCode = 'targetLanguageCode1323228230'; + $documentInputConfig = new DocumentInputConfig(); + $response = $gapicClient->translateDocument($parent, $targetLanguageCode, $documentInputConfig); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.translation.v3.TranslationService/TranslateDocument', $actualFuncCall); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($parent, $actualValue); + $actualValue = $actualRequestObject->getTargetLanguageCode(); + $this->assertProtobufEquals($targetLanguageCode, $actualValue); + $actualValue = $actualRequestObject->getDocumentInputConfig(); + $this->assertProtobufEquals($documentInputConfig, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function translateDocumentExceptionTest() + { + $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 + $parent = 'parent-995424086'; + $targetLanguageCode = 'targetLanguageCode1323228230'; + $documentInputConfig = new DocumentInputConfig(); + try { + $gapicClient->translateDocument($parent, $targetLanguageCode, $documentInputConfig); + // 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 translateTextTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $expectedResponse = new TranslateTextResponse(); + $transport->addResponse($expectedResponse); + // Mock request + $contents = []; + $targetLanguageCode = 'targetLanguageCode1323228230'; + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + $response = $gapicClient->translateText($contents, $targetLanguageCode, $formattedParent); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.translation.v3.TranslationService/TranslateText', $actualFuncCall); + $actualValue = $actualRequestObject->getContents(); + $this->assertProtobufEquals($contents, $actualValue); + $actualValue = $actualRequestObject->getTargetLanguageCode(); + $this->assertProtobufEquals($targetLanguageCode, $actualValue); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function translateTextExceptionTest() + { + $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 + $contents = []; + $targetLanguageCode = 'targetLanguageCode1323228230'; + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + try { + $gapicClient->translateText($contents, $targetLanguageCode, $formattedParent); + // 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()); + } +} From bbf5badb542d659d189f039efe685c4ebcf5713f Mon Sep 17 00:00:00 2001 From: Owl Bot Date: Tue, 21 Feb 2023 20:01:45 +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 --- Translate/metadata/V3/TranslationService.php | Bin 12353 -> 12544 bytes .../batch_translate_document.php | 6 +- .../translate_document.php | 2 +- .../translate_text.php | 7 +- .../src/V3/BatchDocumentOutputConfig.php | 6 +- .../src/V3/BatchTranslateDocumentRequest.php | 70 +- Translate/src/V3/DetectedLanguage.php | 8 +- .../Gapic/TranslationServiceGapicClient.php | 53 +- Translate/src/V3/Glossary.php | 36 +- .../src/V3/Glossary/LanguageCodePair.php | 16 +- .../src/V3/Glossary/LanguageCodesSet.php | 8 +- Translate/src/V3/GlossaryInputConfig.php | 18 +- Translate/src/V3/OutputConfig.php | 6 +- Translate/src/V3/SupportedLanguage.php | 40 +- Translate/src/V3/TranslateDocumentRequest.php | 146 +- .../src/V3/TranslateTextGlossaryConfig.php | 32 +- Translate/src/V3/TranslateTextRequest.php | 36 +- Translate/src/V3/Translation.php | 8 +- .../Unit/V3/TranslationServiceClientTest.php | 4 + .../Cloud/Translate/V3/TranslationService.php | Bin 12544 -> 0 bytes .../Translate/V3/BatchDocumentInputConfig.php | 123 -- .../V3/BatchDocumentOutputConfig.php | 186 --- .../V3/BatchTranslateDocumentMetadata.php | 411 ----- .../BatchTranslateDocumentMetadata/State.php | 88 -- .../BatchTranslateDocumentMetadata_State.php | 16 - .../V3/BatchTranslateDocumentRequest.php | 477 ------ .../V3/BatchTranslateDocumentResponse.php | 432 ------ .../Translate/V3/BatchTranslateMetadata.php | 225 --- .../V3/BatchTranslateMetadata/State.php | 89 -- .../V3/BatchTranslateMetadata_State.php | 16 - .../Translate/V3/BatchTranslateResponse.php | 234 --- .../V3/BatchTranslateTextRequest.php | 419 ------ .../Translate/V3/CreateGlossaryMetadata.php | 147 -- .../V3/CreateGlossaryMetadata/State.php | 86 -- .../V3/CreateGlossaryMetadata_State.php | 16 - .../Translate/V3/CreateGlossaryRequest.php | 111 -- .../Translate/V3/DeleteGlossaryMetadata.php | 147 -- .../V3/DeleteGlossaryMetadata/State.php | 86 -- .../V3/DeleteGlossaryMetadata_State.php | 16 - .../Translate/V3/DeleteGlossaryRequest.php | 67 - .../Translate/V3/DeleteGlossaryResponse.php | 165 -- .../Translate/V3/DetectLanguageRequest.php | 287 ---- .../Translate/V3/DetectLanguageResponse.php | 71 - .../Cloud/Translate/V3/DetectedLanguage.php | 105 -- .../Translate/V3/DocumentInputConfig.php | 177 --- .../Translate/V3/DocumentOutputConfig.php | 240 --- .../Translate/V3/DocumentTranslation.php | 159 -- .../Cloud/Translate/V3/GcsDestination.php | 83 - .../Google/Cloud/Translate/V3/GcsSource.php | 67 - .../Cloud/Translate/V3/GetGlossaryRequest.php | 67 - .../V3/GetSupportedLanguagesRequest.php | 203 --- .../Google/Cloud/Translate/V3/Glossary.php | 350 ----- .../V3/Glossary/LanguageCodePair.php | 112 -- .../V3/Glossary/LanguageCodesSet.php | 78 - .../Translate/V3/GlossaryInputConfig.php | 120 -- .../V3/Glossary_LanguageCodePair.php | 16 - .../V3/Glossary_LanguageCodesSet.php | 16 - .../Google/Cloud/Translate/V3/InputConfig.php | 166 -- .../Translate/V3/ListGlossariesRequest.php | 245 --- .../Translate/V3/ListGlossariesResponse.php | 109 -- .../Cloud/Translate/V3/OutputConfig.php | 249 --- .../Cloud/Translate/V3/SupportedLanguage.php | 186 --- .../Cloud/Translate/V3/SupportedLanguages.php | 71 - .../Translate/V3/TranslateDocumentRequest.php | 593 -------- .../V3/TranslateDocumentResponse.php | 231 --- .../V3/TranslateTextGlossaryConfig.php | 118 -- .../Translate/V3/TranslateTextRequest.php | 451 ------ .../Translate/V3/TranslateTextResponse.php | 123 -- .../Google/Cloud/Translate/V3/Translation.php | 223 --- .../V3/TranslationServiceGrpcClient.php | 204 --- .../batch_translate_document.php | 115 -- .../batch_translate_text.php | 112 -- .../create_glossary.php | 86 -- .../delete_glossary.php | 80 - .../detect_language.php | 76 - .../TranslationServiceClient/get_glossary.php | 67 - .../get_supported_languages.php | 78 - .../list_glossaries.php | 72 - .../translate_document.php | 87 -- .../translate_text.php | 96 -- .../Gapic/TranslationServiceGapicClient.php | 1338 ----------------- .../v3/src/V3/TranslationServiceClient.php | 34 - .../Translate/v3/src/V3/gapic_metadata.json | 68 - .../translation_service_client_config.json | 95 -- .../translation_service_descriptor_config.php | 58 - ...translation_service_rest_client_config.php | 228 --- .../Unit/V3/TranslationServiceClientTest.php | 996 ------------ 87 files changed, 372 insertions(+), 12493 deletions(-) delete mode 100644 owl-bot-staging/Translate/v3/proto/src/GPBMetadata/Google/Cloud/Translate/V3/TranslationService.php delete mode 100644 owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/BatchDocumentInputConfig.php delete mode 100644 owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/BatchDocumentOutputConfig.php delete mode 100644 owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/BatchTranslateDocumentMetadata.php delete mode 100644 owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/BatchTranslateDocumentMetadata/State.php delete mode 100644 owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/BatchTranslateDocumentMetadata_State.php delete mode 100644 owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/BatchTranslateDocumentRequest.php delete mode 100644 owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/BatchTranslateDocumentResponse.php delete mode 100644 owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/BatchTranslateMetadata.php delete mode 100644 owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/BatchTranslateMetadata/State.php delete mode 100644 owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/BatchTranslateMetadata_State.php delete mode 100644 owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/BatchTranslateResponse.php delete mode 100644 owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/BatchTranslateTextRequest.php delete mode 100644 owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/CreateGlossaryMetadata.php delete mode 100644 owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/CreateGlossaryMetadata/State.php delete mode 100644 owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/CreateGlossaryMetadata_State.php delete mode 100644 owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/CreateGlossaryRequest.php delete mode 100644 owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/DeleteGlossaryMetadata.php delete mode 100644 owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/DeleteGlossaryMetadata/State.php delete mode 100644 owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/DeleteGlossaryMetadata_State.php delete mode 100644 owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/DeleteGlossaryRequest.php delete mode 100644 owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/DeleteGlossaryResponse.php delete mode 100644 owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/DetectLanguageRequest.php delete mode 100644 owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/DetectLanguageResponse.php delete mode 100644 owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/DetectedLanguage.php delete mode 100644 owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/DocumentInputConfig.php delete mode 100644 owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/DocumentOutputConfig.php delete mode 100644 owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/DocumentTranslation.php delete mode 100644 owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/GcsDestination.php delete mode 100644 owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/GcsSource.php delete mode 100644 owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/GetGlossaryRequest.php delete mode 100644 owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/GetSupportedLanguagesRequest.php delete mode 100644 owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/Glossary.php delete mode 100644 owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/Glossary/LanguageCodePair.php delete mode 100644 owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/Glossary/LanguageCodesSet.php delete mode 100644 owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/GlossaryInputConfig.php delete mode 100644 owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/Glossary_LanguageCodePair.php delete mode 100644 owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/Glossary_LanguageCodesSet.php delete mode 100644 owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/InputConfig.php delete mode 100644 owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/ListGlossariesRequest.php delete mode 100644 owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/ListGlossariesResponse.php delete mode 100644 owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/OutputConfig.php delete mode 100644 owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/SupportedLanguage.php delete mode 100644 owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/SupportedLanguages.php delete mode 100644 owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/TranslateDocumentRequest.php delete mode 100644 owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/TranslateDocumentResponse.php delete mode 100644 owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/TranslateTextGlossaryConfig.php delete mode 100644 owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/TranslateTextRequest.php delete mode 100644 owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/TranslateTextResponse.php delete mode 100644 owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/Translation.php delete mode 100644 owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/TranslationServiceGrpcClient.php delete mode 100644 owl-bot-staging/Translate/v3/samples/V3/TranslationServiceClient/batch_translate_document.php delete mode 100644 owl-bot-staging/Translate/v3/samples/V3/TranslationServiceClient/batch_translate_text.php delete mode 100644 owl-bot-staging/Translate/v3/samples/V3/TranslationServiceClient/create_glossary.php delete mode 100644 owl-bot-staging/Translate/v3/samples/V3/TranslationServiceClient/delete_glossary.php delete mode 100644 owl-bot-staging/Translate/v3/samples/V3/TranslationServiceClient/detect_language.php delete mode 100644 owl-bot-staging/Translate/v3/samples/V3/TranslationServiceClient/get_glossary.php delete mode 100644 owl-bot-staging/Translate/v3/samples/V3/TranslationServiceClient/get_supported_languages.php delete mode 100644 owl-bot-staging/Translate/v3/samples/V3/TranslationServiceClient/list_glossaries.php delete mode 100644 owl-bot-staging/Translate/v3/samples/V3/TranslationServiceClient/translate_document.php delete mode 100644 owl-bot-staging/Translate/v3/samples/V3/TranslationServiceClient/translate_text.php delete mode 100644 owl-bot-staging/Translate/v3/src/V3/Gapic/TranslationServiceGapicClient.php delete mode 100644 owl-bot-staging/Translate/v3/src/V3/TranslationServiceClient.php delete mode 100644 owl-bot-staging/Translate/v3/src/V3/gapic_metadata.json delete mode 100644 owl-bot-staging/Translate/v3/src/V3/resources/translation_service_client_config.json delete mode 100644 owl-bot-staging/Translate/v3/src/V3/resources/translation_service_descriptor_config.php delete mode 100644 owl-bot-staging/Translate/v3/src/V3/resources/translation_service_rest_client_config.php delete mode 100644 owl-bot-staging/Translate/v3/tests/Unit/V3/TranslationServiceClientTest.php diff --git a/Translate/metadata/V3/TranslationService.php b/Translate/metadata/V3/TranslationService.php index bc97c6130b895740f9e94f782f9ac6e4c1355f1c..f7615d188f389ce4c52c5f4f63b61e7b76741bf0 100644 GIT binary patch delta 250 zcmX?@(2%sjhneYB)Mh{C1)NM%SvP;+dCpibq|7CjTv}X`pPN~gni8K_Qc{$eR9cdm zpC`ekz^K9L#QeaKQAm?ZCbKxcq$n}3I47|rH9jw~B(p3vz91znK0hy~Qi2<(lmntv zmrEfvFEJ@6HNH3_F(tn|z9=;}zbr8aNsj~%T=`@XHiOOV{F3ZUvsgDPiS;u|3rTYE uq+}Ksq&3>tySh6bLzd@drOalU|S+h<9pa}w&1heoA=K+&?2rsjR4;lvo{{*w47LNh5OBl=r a1k?r!9h31N9kVzdUjma=6P>eJA*T;r1{fs( diff --git a/Translate/samples/V3/TranslationServiceClient/batch_translate_document.php b/Translate/samples/V3/TranslationServiceClient/batch_translate_document.php index b17e436d30a..53ea4c08032 100644 --- a/Translate/samples/V3/TranslationServiceClient/batch_translate_document.php +++ b/Translate/samples/V3/TranslationServiceClient/batch_translate_document.php @@ -50,10 +50,10 @@ * the same location-id) can be used, otherwise an INVALID_ARGUMENT (400) * error is returned. Please see * {@see TranslationServiceClient::locationName()} for help formatting this field. - * @param string $sourceLanguageCode The BCP-47 language code of the input document if known, for + * @param string $sourceLanguageCode The ISO-639 language code of the input document if known, for * example, "en-US" or "sr-Latn". Supported language codes are listed in - * Language Support (https://cloud.google.com/translate/docs/languages). - * @param string $targetLanguageCodesElement The BCP-47 language code to use for translation of the input + * [Language Support](https://cloud.google.com/translate/docs/languages). + * @param string $targetLanguageCodesElement The ISO-639 language code to use for translation of the input * document. Specify up to 10 language codes here. */ function batch_translate_document_sample( diff --git a/Translate/samples/V3/TranslationServiceClient/translate_document.php b/Translate/samples/V3/TranslationServiceClient/translate_document.php index 9e4edd83703..ab9034650d9 100644 --- a/Translate/samples/V3/TranslationServiceClient/translate_document.php +++ b/Translate/samples/V3/TranslationServiceClient/translate_document.php @@ -43,7 +43,7 @@ * * Models and glossaries must be within the same region (have the same * location-id), otherwise an INVALID_ARGUMENT (400) error is returned. - * @param string $targetLanguageCode The BCP-47 language code to use for translation of the input + * @param string $targetLanguageCode The ISO-639 language code to use for translation of the input * document, set to one of the language codes listed in Language Support. */ function translate_document_sample(string $parent, string $targetLanguageCode): void diff --git a/Translate/samples/V3/TranslationServiceClient/translate_text.php b/Translate/samples/V3/TranslationServiceClient/translate_text.php index b4cd16bfd8e..960046525ae 100644 --- a/Translate/samples/V3/TranslationServiceClient/translate_text.php +++ b/Translate/samples/V3/TranslationServiceClient/translate_text.php @@ -31,10 +31,9 @@ * Translates input text and returns translated text. * * @param string $contentsElement The content of the input in string format. - * We recommend the total content be less than 30k codepoints. The max length - * of this field is 1024. - * Use BatchTranslateText for larger text. - * @param string $targetLanguageCode The BCP-47 language code to use for translation of the input + * We recommend the total content be less than 30,000 codepoints. The max + * length of this field is 1024. Use BatchTranslateText for larger text. + * @param string $targetLanguageCode The ISO-639 language code to use for translation of the input * text, set to one of the language codes listed in Language Support. * @param string $formattedParent Project or location to make a call. Must refer to a caller's * project. diff --git a/Translate/src/V3/BatchDocumentOutputConfig.php b/Translate/src/V3/BatchDocumentOutputConfig.php index ba84707c1ab..ae9cab5054d 100644 --- a/Translate/src/V3/BatchDocumentOutputConfig.php +++ b/Translate/src/V3/BatchDocumentOutputConfig.php @@ -50,7 +50,7 @@ class BatchDocumentOutputConfig extends \Google\Protobuf\Internal\Message * Since index.csv will be keeping updated during the process, please make * sure there is no custom retention policy applied on the output bucket * that may avoid file updating. - * (https://cloud.google.com/storage/docs/bucket-lock?hl=en#retention-policy) + * (https://cloud.google.com/storage/docs/bucket-lock#retention-policy) * The naming format of translation output files follows (for target * language code [trg]): `translation_output`: * gs://translation_output/a_b_c_[trg]_translation.[extension] @@ -96,7 +96,7 @@ public function __construct($data = NULL) { * Since index.csv will be keeping updated during the process, please make * sure there is no custom retention policy applied on the output bucket * that may avoid file updating. - * (https://cloud.google.com/storage/docs/bucket-lock?hl=en#retention-policy) + * (https://cloud.google.com/storage/docs/bucket-lock#retention-policy) * The naming format of translation output files follows (for target * language code [trg]): `translation_output`: * gs://translation_output/a_b_c_[trg]_translation.[extension] @@ -149,7 +149,7 @@ public function hasGcsDestination() * Since index.csv will be keeping updated during the process, please make * sure there is no custom retention policy applied on the output bucket * that may avoid file updating. - * (https://cloud.google.com/storage/docs/bucket-lock?hl=en#retention-policy) + * (https://cloud.google.com/storage/docs/bucket-lock#retention-policy) * The naming format of translation output files follows (for target * language code [trg]): `translation_output`: * gs://translation_output/a_b_c_[trg]_translation.[extension] diff --git a/Translate/src/V3/BatchTranslateDocumentRequest.php b/Translate/src/V3/BatchTranslateDocumentRequest.php index 5405b091a27..5c1d8d0c575 100644 --- a/Translate/src/V3/BatchTranslateDocumentRequest.php +++ b/Translate/src/V3/BatchTranslateDocumentRequest.php @@ -27,15 +27,15 @@ class BatchTranslateDocumentRequest extends \Google\Protobuf\Internal\Message */ private $parent = ''; /** - * Required. The BCP-47 language code of the input document if known, for + * Required. The ISO-639 language code of the input document if known, for * example, "en-US" or "sr-Latn". Supported language codes are listed in - * Language Support (https://cloud.google.com/translate/docs/languages). + * [Language Support](https://cloud.google.com/translate/docs/languages). * * Generated from protobuf field string source_language_code = 2 [(.google.api.field_behavior) = REQUIRED]; */ private $source_language_code = ''; /** - * Required. The BCP-47 language code to use for translation of the input + * Required. The ISO-639 language code to use for translation of the input * document. Specify up to 10 language codes here. * * Generated from protobuf field repeated string target_language_codes = 3 [(.google.api.field_behavior) = REQUIRED]; @@ -92,6 +92,15 @@ class BatchTranslateDocumentRequest extends \Google\Protobuf\Internal\Message * Generated from protobuf field map format_conversions = 8 [(.google.api.field_behavior) = OPTIONAL]; */ private $format_conversions; + /** + * Optional. This flag is to support user customized attribution. + * If not provided, the default is `Machine Translated by Google`. + * Customized attribution should follow rules in + * https://cloud.google.com/translate/attribution#attribution_and_logos + * + * Generated from protobuf field string customized_attribution = 10 [(.google.api.field_behavior) = OPTIONAL]; + */ + private $customized_attribution = ''; /** * Constructor. @@ -107,11 +116,11 @@ class BatchTranslateDocumentRequest extends \Google\Protobuf\Internal\Message * the same location-id) can be used, otherwise an INVALID_ARGUMENT (400) * error is returned. * @type string $source_language_code - * Required. The BCP-47 language code of the input document if known, for + * Required. The ISO-639 language code of the input document if known, for * example, "en-US" or "sr-Latn". Supported language codes are listed in - * Language Support (https://cloud.google.com/translate/docs/languages). + * [Language Support](https://cloud.google.com/translate/docs/languages). * @type array|\Google\Protobuf\Internal\RepeatedField $target_language_codes - * Required. The BCP-47 language code to use for translation of the input + * Required. The ISO-639 language code to use for translation of the input * document. Specify up to 10 language codes here. * @type array<\Google\Cloud\Translate\V3\BatchDocumentInputConfig>|\Google\Protobuf\Internal\RepeatedField $input_configs * Required. Input configurations. @@ -144,6 +153,11 @@ class BatchTranslateDocumentRequest extends \Google\Protobuf\Internal\Message * `application/vnd.openxmlformats-officedocument.wordprocessingml.document` * If nothing specified, output files will be in the same format as the * original file. + * @type string $customized_attribution + * Optional. This flag is to support user customized attribution. + * If not provided, the default is `Machine Translated by Google`. + * Customized attribution should follow rules in + * https://cloud.google.com/translate/attribution#attribution_and_logos * } */ public function __construct($data = NULL) { @@ -188,9 +202,9 @@ public function setParent($var) } /** - * Required. The BCP-47 language code of the input document if known, for + * Required. The ISO-639 language code of the input document if known, for * example, "en-US" or "sr-Latn". Supported language codes are listed in - * Language Support (https://cloud.google.com/translate/docs/languages). + * [Language Support](https://cloud.google.com/translate/docs/languages). * * Generated from protobuf field string source_language_code = 2 [(.google.api.field_behavior) = REQUIRED]; * @return string @@ -201,9 +215,9 @@ public function getSourceLanguageCode() } /** - * Required. The BCP-47 language code of the input document if known, for + * Required. The ISO-639 language code of the input document if known, for * example, "en-US" or "sr-Latn". Supported language codes are listed in - * Language Support (https://cloud.google.com/translate/docs/languages). + * [Language Support](https://cloud.google.com/translate/docs/languages). * * Generated from protobuf field string source_language_code = 2 [(.google.api.field_behavior) = REQUIRED]; * @param string $var @@ -218,7 +232,7 @@ public function setSourceLanguageCode($var) } /** - * Required. The BCP-47 language code to use for translation of the input + * Required. The ISO-639 language code to use for translation of the input * document. Specify up to 10 language codes here. * * Generated from protobuf field repeated string target_language_codes = 3 [(.google.api.field_behavior) = REQUIRED]; @@ -230,7 +244,7 @@ public function getTargetLanguageCodes() } /** - * Required. The BCP-47 language code to use for translation of the input + * Required. The ISO-639 language code to use for translation of the input * document. Specify up to 10 language codes here. * * Generated from protobuf field repeated string target_language_codes = 3 [(.google.api.field_behavior) = REQUIRED]; @@ -427,5 +441,37 @@ public function setFormatConversions($var) return $this; } + /** + * Optional. This flag is to support user customized attribution. + * If not provided, the default is `Machine Translated by Google`. + * Customized attribution should follow rules in + * https://cloud.google.com/translate/attribution#attribution_and_logos + * + * Generated from protobuf field string customized_attribution = 10 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getCustomizedAttribution() + { + return $this->customized_attribution; + } + + /** + * Optional. This flag is to support user customized attribution. + * If not provided, the default is `Machine Translated by Google`. + * Customized attribution should follow rules in + * https://cloud.google.com/translate/attribution#attribution_and_logos + * + * Generated from protobuf field string customized_attribution = 10 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setCustomizedAttribution($var) + { + GPBUtil::checkString($var, True); + $this->customized_attribution = $var; + + return $this; + } + } diff --git a/Translate/src/V3/DetectedLanguage.php b/Translate/src/V3/DetectedLanguage.php index 22f07300c9e..8d9d6ee4c48 100644 --- a/Translate/src/V3/DetectedLanguage.php +++ b/Translate/src/V3/DetectedLanguage.php @@ -16,7 +16,7 @@ class DetectedLanguage extends \Google\Protobuf\Internal\Message { /** - * The BCP-47 language code of source content in the request, detected + * The ISO-639 language code of the source content in the request, detected * automatically. * * Generated from protobuf field string language_code = 1; @@ -36,7 +36,7 @@ class DetectedLanguage extends \Google\Protobuf\Internal\Message * Optional. Data for populating the Message object. * * @type string $language_code - * The BCP-47 language code of source content in the request, detected + * The ISO-639 language code of the source content in the request, detected * automatically. * @type float $confidence * The confidence of the detection result for this language. @@ -48,7 +48,7 @@ public function __construct($data = NULL) { } /** - * The BCP-47 language code of source content in the request, detected + * The ISO-639 language code of the source content in the request, detected * automatically. * * Generated from protobuf field string language_code = 1; @@ -60,7 +60,7 @@ public function getLanguageCode() } /** - * The BCP-47 language code of source content in the request, detected + * The ISO-639 language code of the source content in the request, detected * automatically. * * Generated from protobuf field string language_code = 1; diff --git a/Translate/src/V3/Gapic/TranslationServiceGapicClient.php b/Translate/src/V3/Gapic/TranslationServiceGapicClient.php index 79690128af3..c4997f53c63 100644 --- a/Translate/src/V3/Gapic/TranslationServiceGapicClient.php +++ b/Translate/src/V3/Gapic/TranslationServiceGapicClient.php @@ -415,10 +415,10 @@ public function __construct(array $options = []) * Only AutoML Translation models or glossaries within the same region (have * the same location-id) can be used, otherwise an INVALID_ARGUMENT (400) * error is returned. - * @param string $sourceLanguageCode Required. The BCP-47 language code of the input document if known, for + * @param string $sourceLanguageCode Required. The ISO-639 language code of the input document if known, for * example, "en-US" or "sr-Latn". Supported language codes are listed in - * Language Support (https://cloud.google.com/translate/docs/languages). - * @param string[] $targetLanguageCodes Required. The BCP-47 language code to use for translation of the input + * [Language Support](https://cloud.google.com/translate/docs/languages). + * @param string[] $targetLanguageCodes Required. The ISO-639 language code to use for translation of the input * document. Specify up to 10 language codes here. * @param BatchDocumentInputConfig[] $inputConfigs Required. Input configurations. * The total number of files matched should be <= 100. @@ -459,6 +459,11 @@ public function __construct(array $options = []) * * If nothing specified, output files will be in the same format as the * original file. + * @type string $customizedAttribution + * Optional. This flag is to support user customized attribution. + * If not provided, the default is `Machine Translated by Google`. + * Customized attribution should follow rules in + * https://cloud.google.com/translate/attribution#attribution_and_logos * @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 @@ -491,6 +496,10 @@ public function batchTranslateDocument($parent, $sourceLanguageCode, $targetLang $request->setFormatConversions($optionalArgs['formatConversions']); } + if (isset($optionalArgs['customizedAttribution'])) { + $request->setCustomizedAttribution($optionalArgs['customizedAttribution']); + } + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); return $this->startOperationsCall('BatchTranslateDocument', $optionalArgs, $request, $this->getOperationsClient())->wait(); @@ -1091,14 +1100,14 @@ public function listGlossaries($parent, array $optionalArgs = []) * * Models and glossaries must be within the same region (have the same * location-id), otherwise an INVALID_ARGUMENT (400) error is returned. - * @param string $targetLanguageCode Required. The BCP-47 language code to use for translation of the input + * @param string $targetLanguageCode Required. The ISO-639 language code to use for translation of the input * document, set to one of the language codes listed in Language Support. * @param DocumentInputConfig $documentInputConfig Required. Input configurations. * @param array $optionalArgs { * Optional. * * @type string $sourceLanguageCode - * Optional. The BCP-47 language code of the input document if known, for + * Optional. The ISO-639 language code of the input document if known, for * example, "en-US" or "sr-Latn". Supported language codes are listed in * Language Support. If the source language isn't specified, the API attempts * to identify the source language automatically and returns the source @@ -1138,6 +1147,19 @@ public function listGlossaries($parent, array $optionalArgs = []) * * See https://cloud.google.com/translate/docs/advanced/labels for more * information. + * @type string $customizedAttribution + * Optional. This flag is to support user customized attribution. + * If not provided, the default is `Machine Translated by Google`. + * Customized attribution should follow rules in + * https://cloud.google.com/translate/attribution#attribution_and_logos + * @type bool $isTranslateNativePdfOnly + * Optional. If true, the page limit of online native pdf translation is 300 + * and only native pdf pages will be translated. + * @type bool $enableShadowRemovalNativePdf + * Optional. If true, use the text removal to remove the shadow text on + * background image for native pdf translation. + * Shadow removal feature can only be enabled when + * is_translate_native_pdf_only is false * @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 @@ -1176,6 +1198,18 @@ public function translateDocument($parent, $targetLanguageCode, $documentInputCo $request->setLabels($optionalArgs['labels']); } + if (isset($optionalArgs['customizedAttribution'])) { + $request->setCustomizedAttribution($optionalArgs['customizedAttribution']); + } + + if (isset($optionalArgs['isTranslateNativePdfOnly'])) { + $request->setIsTranslateNativePdfOnly($optionalArgs['isTranslateNativePdfOnly']); + } + + if (isset($optionalArgs['enableShadowRemovalNativePdf'])) { + $request->setEnableShadowRemovalNativePdf($optionalArgs['enableShadowRemovalNativePdf']); + } + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); return $this->startCall('TranslateDocument', TranslateDocumentResponse::class, $optionalArgs, $request)->wait(); @@ -1198,10 +1232,9 @@ public function translateDocument($parent, $targetLanguageCode, $documentInputCo * ``` * * @param string[] $contents Required. The content of the input in string format. - * We recommend the total content be less than 30k codepoints. The max length - * of this field is 1024. - * Use BatchTranslateText for larger text. - * @param string $targetLanguageCode Required. The BCP-47 language code to use for translation of the input + * We recommend the total content be less than 30,000 codepoints. The max + * length of this field is 1024. Use BatchTranslateText for larger text. + * @param string $targetLanguageCode Required. The ISO-639 language code to use for translation of the input * text, set to one of the language codes listed in Language Support. * @param string $parent Required. Project or location to make a call. Must refer to a caller's * project. @@ -1224,7 +1257,7 @@ public function translateDocument($parent, $targetLanguageCode, $documentInputCo * Optional. The format of the source text, for example, "text/html", * "text/plain". If left blank, the MIME type defaults to "text/html". * @type string $sourceLanguageCode - * Optional. The BCP-47 language code of the input text if + * Optional. The ISO-639 language code of the input text if * known, for example, "en-US" or "sr-Latn". Supported language codes are * listed in Language Support. If the source language isn't specified, the API * attempts to identify the source language automatically and returns the diff --git a/Translate/src/V3/Glossary.php b/Translate/src/V3/Glossary.php index 5035fe80ea4..74fcad43b5d 100644 --- a/Translate/src/V3/Glossary.php +++ b/Translate/src/V3/Glossary.php @@ -9,7 +9,7 @@ use Google\Protobuf\Internal\GPBUtil; /** - * Represents a glossary built from user provided data. + * Represents a glossary built from user-provided data. * * Generated from protobuf message google.cloud.translation.v3.Glossary */ @@ -47,6 +47,12 @@ class Glossary extends \Google\Protobuf\Internal\Message * Generated from protobuf field .google.protobuf.Timestamp end_time = 8 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ private $end_time = null; + /** + * Optional. The display name of the glossary. + * + * Generated from protobuf field string display_name = 9 [(.google.api.field_behavior) = OPTIONAL]; + */ + private $display_name = ''; protected $languages; /** @@ -71,6 +77,8 @@ class Glossary extends \Google\Protobuf\Internal\Message * Output only. When CreateGlossary was called. * @type \Google\Protobuf\Timestamp $end_time * Output only. When the glossary creation was finished. + * @type string $display_name + * Optional. The display name of the glossary. * } */ public function __construct($data = NULL) { @@ -304,6 +312,32 @@ public function setEndTime($var) return $this; } + /** + * Optional. The display name of the glossary. + * + * Generated from protobuf field string display_name = 9 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getDisplayName() + { + return $this->display_name; + } + + /** + * Optional. The display name of the glossary. + * + * Generated from protobuf field string display_name = 9 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setDisplayName($var) + { + GPBUtil::checkString($var, True); + $this->display_name = $var; + + return $this; + } + /** * @return string */ diff --git a/Translate/src/V3/Glossary/LanguageCodePair.php b/Translate/src/V3/Glossary/LanguageCodePair.php index 081c37a713b..32fc3faebda 100644 --- a/Translate/src/V3/Glossary/LanguageCodePair.php +++ b/Translate/src/V3/Glossary/LanguageCodePair.php @@ -16,14 +16,14 @@ class LanguageCodePair extends \Google\Protobuf\Internal\Message { /** - * Required. The BCP-47 language code of the input text, for example, + * Required. The ISO-639 language code of the input text, for example, * "en-US". Expected to be an exact match for GlossaryTerm.language_code. * * Generated from protobuf field string source_language_code = 1; */ private $source_language_code = ''; /** - * Required. The BCP-47 language code for translation output, for example, + * Required. The ISO-639 language code for translation output, for example, * "zh-CN". Expected to be an exact match for GlossaryTerm.language_code. * * Generated from protobuf field string target_language_code = 2; @@ -37,10 +37,10 @@ class LanguageCodePair extends \Google\Protobuf\Internal\Message * Optional. Data for populating the Message object. * * @type string $source_language_code - * Required. The BCP-47 language code of the input text, for example, + * Required. The ISO-639 language code of the input text, for example, * "en-US". Expected to be an exact match for GlossaryTerm.language_code. * @type string $target_language_code - * Required. The BCP-47 language code for translation output, for example, + * Required. The ISO-639 language code for translation output, for example, * "zh-CN". Expected to be an exact match for GlossaryTerm.language_code. * } */ @@ -50,7 +50,7 @@ public function __construct($data = NULL) { } /** - * Required. The BCP-47 language code of the input text, for example, + * Required. The ISO-639 language code of the input text, for example, * "en-US". Expected to be an exact match for GlossaryTerm.language_code. * * Generated from protobuf field string source_language_code = 1; @@ -62,7 +62,7 @@ public function getSourceLanguageCode() } /** - * Required. The BCP-47 language code of the input text, for example, + * Required. The ISO-639 language code of the input text, for example, * "en-US". Expected to be an exact match for GlossaryTerm.language_code. * * Generated from protobuf field string source_language_code = 1; @@ -78,7 +78,7 @@ public function setSourceLanguageCode($var) } /** - * Required. The BCP-47 language code for translation output, for example, + * Required. The ISO-639 language code for translation output, for example, * "zh-CN". Expected to be an exact match for GlossaryTerm.language_code. * * Generated from protobuf field string target_language_code = 2; @@ -90,7 +90,7 @@ public function getTargetLanguageCode() } /** - * Required. The BCP-47 language code for translation output, for example, + * Required. The ISO-639 language code for translation output, for example, * "zh-CN". Expected to be an exact match for GlossaryTerm.language_code. * * Generated from protobuf field string target_language_code = 2; diff --git a/Translate/src/V3/Glossary/LanguageCodesSet.php b/Translate/src/V3/Glossary/LanguageCodesSet.php index aa8c14f638b..164d340406c 100644 --- a/Translate/src/V3/Glossary/LanguageCodesSet.php +++ b/Translate/src/V3/Glossary/LanguageCodesSet.php @@ -16,7 +16,7 @@ class LanguageCodesSet extends \Google\Protobuf\Internal\Message { /** - * The BCP-47 language code(s) for terms defined in the glossary. + * The ISO-639 language code(s) for terms defined in the glossary. * All entries are unique. The list contains at least two entries. * Expected to be an exact match for GlossaryTerm.language_code. * @@ -31,7 +31,7 @@ class LanguageCodesSet extends \Google\Protobuf\Internal\Message * Optional. Data for populating the Message object. * * @type array|\Google\Protobuf\Internal\RepeatedField $language_codes - * The BCP-47 language code(s) for terms defined in the glossary. + * The ISO-639 language code(s) for terms defined in the glossary. * All entries are unique. The list contains at least two entries. * Expected to be an exact match for GlossaryTerm.language_code. * } @@ -42,7 +42,7 @@ public function __construct($data = NULL) { } /** - * The BCP-47 language code(s) for terms defined in the glossary. + * The ISO-639 language code(s) for terms defined in the glossary. * All entries are unique. The list contains at least two entries. * Expected to be an exact match for GlossaryTerm.language_code. * @@ -55,7 +55,7 @@ public function getLanguageCodes() } /** - * The BCP-47 language code(s) for terms defined in the glossary. + * The ISO-639 language code(s) for terms defined in the glossary. * All entries are unique. The list contains at least two entries. * Expected to be an exact match for GlossaryTerm.language_code. * diff --git a/Translate/src/V3/GlossaryInputConfig.php b/Translate/src/V3/GlossaryInputConfig.php index d1d24714390..a5800834223 100644 --- a/Translate/src/V3/GlossaryInputConfig.php +++ b/Translate/src/V3/GlossaryInputConfig.php @@ -30,10 +30,10 @@ class GlossaryInputConfig extends \Google\Protobuf\Internal\Message * formats. Wildcards are not allowed. This must be a single file in one of * the following formats: * For unidirectional glossaries: - * - TSV/CSV (`.tsv`/`.csv`): 2 column file, tab- or comma-separated. + * - TSV/CSV (`.tsv`/`.csv`): Two column file, tab- or comma-separated. * The first column is source text. The second column is target text. - * The file must not contain headers. That is, the first row is data, not - * column names. + * No headers in this file. The first row contains data and not column + * names. * - TMX (`.tmx`): TMX file with parallel data defining source/target term * pairs. * For equivalent term sets glossaries: @@ -54,10 +54,10 @@ public function __construct($data = NULL) { * formats. Wildcards are not allowed. This must be a single file in one of * the following formats: * For unidirectional glossaries: - * - TSV/CSV (`.tsv`/`.csv`): 2 column file, tab- or comma-separated. + * - TSV/CSV (`.tsv`/`.csv`): Two column file, tab- or comma-separated. * The first column is source text. The second column is target text. - * The file must not contain headers. That is, the first row is data, not - * column names. + * No headers in this file. The first row contains data and not column + * names. * - TMX (`.tmx`): TMX file with parallel data defining source/target term * pairs. * For equivalent term sets glossaries: @@ -85,10 +85,10 @@ public function hasGcsSource() * formats. Wildcards are not allowed. This must be a single file in one of * the following formats: * For unidirectional glossaries: - * - TSV/CSV (`.tsv`/`.csv`): 2 column file, tab- or comma-separated. + * - TSV/CSV (`.tsv`/`.csv`): Two column file, tab- or comma-separated. * The first column is source text. The second column is target text. - * The file must not contain headers. That is, the first row is data, not - * column names. + * No headers in this file. The first row contains data and not column + * names. * - TMX (`.tmx`): TMX file with parallel data defining source/target term * pairs. * For equivalent term sets glossaries: diff --git a/Translate/src/V3/OutputConfig.php b/Translate/src/V3/OutputConfig.php index e6b91925abc..4059eea266f 100644 --- a/Translate/src/V3/OutputConfig.php +++ b/Translate/src/V3/OutputConfig.php @@ -53,7 +53,7 @@ class OutputConfig extends \Google\Protobuf\Internal\Message * Since index.csv will be keeping updated during the process, please make * sure there is no custom retention policy applied on the output bucket * that may avoid file updating. - * (https://cloud.google.com/storage/docs/bucket-lock?hl=en#retention-policy) + * (https://cloud.google.com/storage/docs/bucket-lock#retention-policy) * The format of translations_file (for target language code 'trg') is: * `gs://translation_test/a_b_c_'trg'_translations.[extension]` * If the input file extension is tsv, the output has the following @@ -120,7 +120,7 @@ public function __construct($data = NULL) { * Since index.csv will be keeping updated during the process, please make * sure there is no custom retention policy applied on the output bucket * that may avoid file updating. - * (https://cloud.google.com/storage/docs/bucket-lock?hl=en#retention-policy) + * (https://cloud.google.com/storage/docs/bucket-lock#retention-policy) * The format of translations_file (for target language code 'trg') is: * `gs://translation_test/a_b_c_'trg'_translations.[extension]` * If the input file extension is tsv, the output has the following @@ -194,7 +194,7 @@ public function hasGcsDestination() * Since index.csv will be keeping updated during the process, please make * sure there is no custom retention policy applied on the output bucket * that may avoid file updating. - * (https://cloud.google.com/storage/docs/bucket-lock?hl=en#retention-policy) + * (https://cloud.google.com/storage/docs/bucket-lock#retention-policy) * The format of translations_file (for target language code 'trg') is: * `gs://translation_test/a_b_c_'trg'_translations.[extension]` * If the input file extension is tsv, the output has the following diff --git a/Translate/src/V3/SupportedLanguage.php b/Translate/src/V3/SupportedLanguage.php index f0492b9eb1b..693d120494d 100644 --- a/Translate/src/V3/SupportedLanguage.php +++ b/Translate/src/V3/SupportedLanguage.php @@ -18,28 +18,28 @@ class SupportedLanguage extends \Google\Protobuf\Internal\Message { /** * Supported language code, generally consisting of its ISO 639-1 - * identifier, for example, 'en', 'ja'. In certain cases, BCP-47 codes + * identifier, for example, 'en', 'ja'. In certain cases, ISO-639 codes * including language and region identifiers are returned (for example, - * 'zh-TW' and 'zh-CN') + * 'zh-TW' and 'zh-CN'). * * Generated from protobuf field string language_code = 1; */ private $language_code = ''; /** - * Human readable name of the language localized in the display language + * Human-readable name of the language localized in the display language * specified in the request. * * Generated from protobuf field string display_name = 2; */ private $display_name = ''; /** - * Can be used as source language. + * Can be used as a source language. * * Generated from protobuf field bool support_source = 3; */ private $support_source = false; /** - * Can be used as target language. + * Can be used as a target language. * * Generated from protobuf field bool support_target = 4; */ @@ -53,16 +53,16 @@ class SupportedLanguage extends \Google\Protobuf\Internal\Message * * @type string $language_code * Supported language code, generally consisting of its ISO 639-1 - * identifier, for example, 'en', 'ja'. In certain cases, BCP-47 codes + * identifier, for example, 'en', 'ja'. In certain cases, ISO-639 codes * including language and region identifiers are returned (for example, - * 'zh-TW' and 'zh-CN') + * 'zh-TW' and 'zh-CN'). * @type string $display_name - * Human readable name of the language localized in the display language + * Human-readable name of the language localized in the display language * specified in the request. * @type bool $support_source - * Can be used as source language. + * Can be used as a source language. * @type bool $support_target - * Can be used as target language. + * Can be used as a target language. * } */ public function __construct($data = NULL) { @@ -72,9 +72,9 @@ public function __construct($data = NULL) { /** * Supported language code, generally consisting of its ISO 639-1 - * identifier, for example, 'en', 'ja'. In certain cases, BCP-47 codes + * identifier, for example, 'en', 'ja'. In certain cases, ISO-639 codes * including language and region identifiers are returned (for example, - * 'zh-TW' and 'zh-CN') + * 'zh-TW' and 'zh-CN'). * * Generated from protobuf field string language_code = 1; * @return string @@ -86,9 +86,9 @@ public function getLanguageCode() /** * Supported language code, generally consisting of its ISO 639-1 - * identifier, for example, 'en', 'ja'. In certain cases, BCP-47 codes + * identifier, for example, 'en', 'ja'. In certain cases, ISO-639 codes * including language and region identifiers are returned (for example, - * 'zh-TW' and 'zh-CN') + * 'zh-TW' and 'zh-CN'). * * Generated from protobuf field string language_code = 1; * @param string $var @@ -103,7 +103,7 @@ public function setLanguageCode($var) } /** - * Human readable name of the language localized in the display language + * Human-readable name of the language localized in the display language * specified in the request. * * Generated from protobuf field string display_name = 2; @@ -115,7 +115,7 @@ public function getDisplayName() } /** - * Human readable name of the language localized in the display language + * Human-readable name of the language localized in the display language * specified in the request. * * Generated from protobuf field string display_name = 2; @@ -131,7 +131,7 @@ public function setDisplayName($var) } /** - * Can be used as source language. + * Can be used as a source language. * * Generated from protobuf field bool support_source = 3; * @return bool @@ -142,7 +142,7 @@ public function getSupportSource() } /** - * Can be used as source language. + * Can be used as a source language. * * Generated from protobuf field bool support_source = 3; * @param bool $var @@ -157,7 +157,7 @@ public function setSupportSource($var) } /** - * Can be used as target language. + * Can be used as a target language. * * Generated from protobuf field bool support_target = 4; * @return bool @@ -168,7 +168,7 @@ public function getSupportTarget() } /** - * Can be used as target language. + * Can be used as a target language. * * Generated from protobuf field bool support_target = 4; * @param bool $var diff --git a/Translate/src/V3/TranslateDocumentRequest.php b/Translate/src/V3/TranslateDocumentRequest.php index 4f7e119ab03..214deb092ce 100644 --- a/Translate/src/V3/TranslateDocumentRequest.php +++ b/Translate/src/V3/TranslateDocumentRequest.php @@ -29,7 +29,7 @@ class TranslateDocumentRequest extends \Google\Protobuf\Internal\Message */ private $parent = ''; /** - * Optional. The BCP-47 language code of the input document if known, for + * Optional. The ISO-639 language code of the input document if known, for * example, "en-US" or "sr-Latn". Supported language codes are listed in * Language Support. If the source language isn't specified, the API attempts * to identify the source language automatically and returns the source @@ -40,7 +40,7 @@ class TranslateDocumentRequest extends \Google\Protobuf\Internal\Message */ private $source_language_code = ''; /** - * Required. The BCP-47 language code to use for translation of the input + * Required. The ISO-639 language code to use for translation of the input * document, set to one of the language codes listed in Language Support. * * Generated from protobuf field string target_language_code = 3 [(.google.api.field_behavior) = REQUIRED]; @@ -95,6 +95,31 @@ class TranslateDocumentRequest extends \Google\Protobuf\Internal\Message * Generated from protobuf field map labels = 8 [(.google.api.field_behavior) = OPTIONAL]; */ private $labels; + /** + * Optional. This flag is to support user customized attribution. + * If not provided, the default is `Machine Translated by Google`. + * Customized attribution should follow rules in + * https://cloud.google.com/translate/attribution#attribution_and_logos + * + * Generated from protobuf field string customized_attribution = 10 [(.google.api.field_behavior) = OPTIONAL]; + */ + private $customized_attribution = ''; + /** + * Optional. If true, the page limit of online native pdf translation is 300 + * and only native pdf pages will be translated. + * + * Generated from protobuf field bool is_translate_native_pdf_only = 11 [(.google.api.field_behavior) = OPTIONAL]; + */ + private $is_translate_native_pdf_only = false; + /** + * Optional. If true, use the text removal to remove the shadow text on + * background image for native pdf translation. + * Shadow removal feature can only be enabled when + * is_translate_native_pdf_only is false + * + * Generated from protobuf field bool enable_shadow_removal_native_pdf = 12 [(.google.api.field_behavior) = OPTIONAL]; + */ + private $enable_shadow_removal_native_pdf = false; /** * Constructor. @@ -112,14 +137,14 @@ class TranslateDocumentRequest extends \Google\Protobuf\Internal\Message * Models and glossaries must be within the same region (have the same * location-id), otherwise an INVALID_ARGUMENT (400) error is returned. * @type string $source_language_code - * Optional. The BCP-47 language code of the input document if known, for + * Optional. The ISO-639 language code of the input document if known, for * example, "en-US" or "sr-Latn". Supported language codes are listed in * Language Support. If the source language isn't specified, the API attempts * to identify the source language automatically and returns the source * language within the response. Source language must be specified if the * request contains a glossary or a custom model. * @type string $target_language_code - * Required. The BCP-47 language code to use for translation of the input + * Required. The ISO-639 language code to use for translation of the input * document, set to one of the language codes listed in Language Support. * @type \Google\Cloud\Translate\V3\DocumentInputConfig $document_input_config * Required. Input configurations. @@ -150,6 +175,19 @@ class TranslateDocumentRequest extends \Google\Protobuf\Internal\Message * are optional. Label keys must start with a letter. * See https://cloud.google.com/translate/docs/advanced/labels for more * information. + * @type string $customized_attribution + * Optional. This flag is to support user customized attribution. + * If not provided, the default is `Machine Translated by Google`. + * Customized attribution should follow rules in + * https://cloud.google.com/translate/attribution#attribution_and_logos + * @type bool $is_translate_native_pdf_only + * Optional. If true, the page limit of online native pdf translation is 300 + * and only native pdf pages will be translated. + * @type bool $enable_shadow_removal_native_pdf + * Optional. If true, use the text removal to remove the shadow text on + * background image for native pdf translation. + * Shadow removal feature can only be enabled when + * is_translate_native_pdf_only is false * } */ public function __construct($data = NULL) { @@ -198,7 +236,7 @@ public function setParent($var) } /** - * Optional. The BCP-47 language code of the input document if known, for + * Optional. The ISO-639 language code of the input document if known, for * example, "en-US" or "sr-Latn". Supported language codes are listed in * Language Support. If the source language isn't specified, the API attempts * to identify the source language automatically and returns the source @@ -214,7 +252,7 @@ public function getSourceLanguageCode() } /** - * Optional. The BCP-47 language code of the input document if known, for + * Optional. The ISO-639 language code of the input document if known, for * example, "en-US" or "sr-Latn". Supported language codes are listed in * Language Support. If the source language isn't specified, the API attempts * to identify the source language automatically and returns the source @@ -234,7 +272,7 @@ public function setSourceLanguageCode($var) } /** - * Required. The BCP-47 language code to use for translation of the input + * Required. The ISO-639 language code to use for translation of the input * document, set to one of the language codes listed in Language Support. * * Generated from protobuf field string target_language_code = 3 [(.google.api.field_behavior) = REQUIRED]; @@ -246,7 +284,7 @@ public function getTargetLanguageCode() } /** - * Required. The BCP-47 language code to use for translation of the input + * Required. The ISO-639 language code to use for translation of the input * document, set to one of the language codes listed in Language Support. * * Generated from protobuf field string target_language_code = 3 [(.google.api.field_behavior) = REQUIRED]; @@ -459,5 +497,97 @@ public function setLabels($var) return $this; } + /** + * Optional. This flag is to support user customized attribution. + * If not provided, the default is `Machine Translated by Google`. + * Customized attribution should follow rules in + * https://cloud.google.com/translate/attribution#attribution_and_logos + * + * Generated from protobuf field string customized_attribution = 10 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getCustomizedAttribution() + { + return $this->customized_attribution; + } + + /** + * Optional. This flag is to support user customized attribution. + * If not provided, the default is `Machine Translated by Google`. + * Customized attribution should follow rules in + * https://cloud.google.com/translate/attribution#attribution_and_logos + * + * Generated from protobuf field string customized_attribution = 10 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setCustomizedAttribution($var) + { + GPBUtil::checkString($var, True); + $this->customized_attribution = $var; + + return $this; + } + + /** + * Optional. If true, the page limit of online native pdf translation is 300 + * and only native pdf pages will be translated. + * + * Generated from protobuf field bool is_translate_native_pdf_only = 11 [(.google.api.field_behavior) = OPTIONAL]; + * @return bool + */ + public function getIsTranslateNativePdfOnly() + { + return $this->is_translate_native_pdf_only; + } + + /** + * Optional. If true, the page limit of online native pdf translation is 300 + * and only native pdf pages will be translated. + * + * Generated from protobuf field bool is_translate_native_pdf_only = 11 [(.google.api.field_behavior) = OPTIONAL]; + * @param bool $var + * @return $this + */ + public function setIsTranslateNativePdfOnly($var) + { + GPBUtil::checkBool($var); + $this->is_translate_native_pdf_only = $var; + + return $this; + } + + /** + * Optional. If true, use the text removal to remove the shadow text on + * background image for native pdf translation. + * Shadow removal feature can only be enabled when + * is_translate_native_pdf_only is false + * + * Generated from protobuf field bool enable_shadow_removal_native_pdf = 12 [(.google.api.field_behavior) = OPTIONAL]; + * @return bool + */ + public function getEnableShadowRemovalNativePdf() + { + return $this->enable_shadow_removal_native_pdf; + } + + /** + * Optional. If true, use the text removal to remove the shadow text on + * background image for native pdf translation. + * Shadow removal feature can only be enabled when + * is_translate_native_pdf_only is false + * + * Generated from protobuf field bool enable_shadow_removal_native_pdf = 12 [(.google.api.field_behavior) = OPTIONAL]; + * @param bool $var + * @return $this + */ + public function setEnableShadowRemovalNativePdf($var) + { + GPBUtil::checkBool($var); + $this->enable_shadow_removal_native_pdf = $var; + + return $this; + } + } diff --git a/Translate/src/V3/TranslateTextGlossaryConfig.php b/Translate/src/V3/TranslateTextGlossaryConfig.php index 309e29da807..b5a3f07f69e 100644 --- a/Translate/src/V3/TranslateTextGlossaryConfig.php +++ b/Translate/src/V3/TranslateTextGlossaryConfig.php @@ -18,16 +18,16 @@ class TranslateTextGlossaryConfig extends \Google\Protobuf\Internal\Message { /** * Required. The `glossary` to be applied for this translation. - * The format depends on glossary: - * - User provided custom glossary: + * The format depends on the glossary: + * - User-provided custom glossary: * `projects/{project-number-or-id}/locations/{location-id}/glossaries/{glossary-id}` * * Generated from protobuf field string glossary = 1 [(.google.api.field_behavior) = REQUIRED]; */ private $glossary = ''; /** - * Optional. Indicates match is case-insensitive. - * Default value is false if missing. + * Optional. Indicates match is case insensitive. The default value is `false` + * if missing. * * Generated from protobuf field bool ignore_case = 2 [(.google.api.field_behavior) = OPTIONAL]; */ @@ -41,12 +41,12 @@ class TranslateTextGlossaryConfig extends \Google\Protobuf\Internal\Message * * @type string $glossary * Required. The `glossary` to be applied for this translation. - * The format depends on glossary: - * - User provided custom glossary: + * The format depends on the glossary: + * - User-provided custom glossary: * `projects/{project-number-or-id}/locations/{location-id}/glossaries/{glossary-id}` * @type bool $ignore_case - * Optional. Indicates match is case-insensitive. - * Default value is false if missing. + * Optional. Indicates match is case insensitive. The default value is `false` + * if missing. * } */ public function __construct($data = NULL) { @@ -56,8 +56,8 @@ public function __construct($data = NULL) { /** * Required. The `glossary` to be applied for this translation. - * The format depends on glossary: - * - User provided custom glossary: + * The format depends on the glossary: + * - User-provided custom glossary: * `projects/{project-number-or-id}/locations/{location-id}/glossaries/{glossary-id}` * * Generated from protobuf field string glossary = 1 [(.google.api.field_behavior) = REQUIRED]; @@ -70,8 +70,8 @@ public function getGlossary() /** * Required. The `glossary` to be applied for this translation. - * The format depends on glossary: - * - User provided custom glossary: + * The format depends on the glossary: + * - User-provided custom glossary: * `projects/{project-number-or-id}/locations/{location-id}/glossaries/{glossary-id}` * * Generated from protobuf field string glossary = 1 [(.google.api.field_behavior) = REQUIRED]; @@ -87,8 +87,8 @@ public function setGlossary($var) } /** - * Optional. Indicates match is case-insensitive. - * Default value is false if missing. + * Optional. Indicates match is case insensitive. The default value is `false` + * if missing. * * Generated from protobuf field bool ignore_case = 2 [(.google.api.field_behavior) = OPTIONAL]; * @return bool @@ -99,8 +99,8 @@ public function getIgnoreCase() } /** - * Optional. Indicates match is case-insensitive. - * Default value is false if missing. + * Optional. Indicates match is case insensitive. The default value is `false` + * if missing. * * Generated from protobuf field bool ignore_case = 2 [(.google.api.field_behavior) = OPTIONAL]; * @param bool $var diff --git a/Translate/src/V3/TranslateTextRequest.php b/Translate/src/V3/TranslateTextRequest.php index 7efcc52db44..bb5858479eb 100644 --- a/Translate/src/V3/TranslateTextRequest.php +++ b/Translate/src/V3/TranslateTextRequest.php @@ -17,9 +17,8 @@ class TranslateTextRequest extends \Google\Protobuf\Internal\Message { /** * Required. The content of the input in string format. - * We recommend the total content be less than 30k codepoints. The max length - * of this field is 1024. - * Use BatchTranslateText for larger text. + * We recommend the total content be less than 30,000 codepoints. The max + * length of this field is 1024. Use BatchTranslateText for larger text. * * Generated from protobuf field repeated string contents = 1 [(.google.api.field_behavior) = REQUIRED]; */ @@ -32,7 +31,7 @@ class TranslateTextRequest extends \Google\Protobuf\Internal\Message */ private $mime_type = ''; /** - * Optional. The BCP-47 language code of the input text if + * Optional. The ISO-639 language code of the input text if * known, for example, "en-US" or "sr-Latn". Supported language codes are * listed in Language Support. If the source language isn't specified, the API * attempts to identify the source language automatically and returns the @@ -42,7 +41,7 @@ class TranslateTextRequest extends \Google\Protobuf\Internal\Message */ private $source_language_code = ''; /** - * Required. The BCP-47 language code to use for translation of the input + * Required. The ISO-639 language code to use for translation of the input * text, set to one of the language codes listed in Language Support. * * Generated from protobuf field string target_language_code = 5 [(.google.api.field_behavior) = REQUIRED]; @@ -107,20 +106,19 @@ class TranslateTextRequest extends \Google\Protobuf\Internal\Message * * @type array|\Google\Protobuf\Internal\RepeatedField $contents * Required. The content of the input in string format. - * We recommend the total content be less than 30k codepoints. The max length - * of this field is 1024. - * Use BatchTranslateText for larger text. + * We recommend the total content be less than 30,000 codepoints. The max + * length of this field is 1024. Use BatchTranslateText for larger text. * @type string $mime_type * Optional. The format of the source text, for example, "text/html", * "text/plain". If left blank, the MIME type defaults to "text/html". * @type string $source_language_code - * Optional. The BCP-47 language code of the input text if + * Optional. The ISO-639 language code of the input text if * known, for example, "en-US" or "sr-Latn". Supported language codes are * listed in Language Support. If the source language isn't specified, the API * attempts to identify the source language automatically and returns the * source language within the response. * @type string $target_language_code - * Required. The BCP-47 language code to use for translation of the input + * Required. The ISO-639 language code to use for translation of the input * text, set to one of the language codes listed in Language Support. * @type string $parent * Required. Project or location to make a call. Must refer to a caller's @@ -165,9 +163,8 @@ public function __construct($data = NULL) { /** * Required. The content of the input in string format. - * We recommend the total content be less than 30k codepoints. The max length - * of this field is 1024. - * Use BatchTranslateText for larger text. + * We recommend the total content be less than 30,000 codepoints. The max + * length of this field is 1024. Use BatchTranslateText for larger text. * * Generated from protobuf field repeated string contents = 1 [(.google.api.field_behavior) = REQUIRED]; * @return \Google\Protobuf\Internal\RepeatedField @@ -179,9 +176,8 @@ public function getContents() /** * Required. The content of the input in string format. - * We recommend the total content be less than 30k codepoints. The max length - * of this field is 1024. - * Use BatchTranslateText for larger text. + * We recommend the total content be less than 30,000 codepoints. The max + * length of this field is 1024. Use BatchTranslateText for larger text. * * Generated from protobuf field repeated string contents = 1 [(.google.api.field_behavior) = REQUIRED]; * @param array|\Google\Protobuf\Internal\RepeatedField $var @@ -224,7 +220,7 @@ public function setMimeType($var) } /** - * Optional. The BCP-47 language code of the input text if + * Optional. The ISO-639 language code of the input text if * known, for example, "en-US" or "sr-Latn". Supported language codes are * listed in Language Support. If the source language isn't specified, the API * attempts to identify the source language automatically and returns the @@ -239,7 +235,7 @@ public function getSourceLanguageCode() } /** - * Optional. The BCP-47 language code of the input text if + * Optional. The ISO-639 language code of the input text if * known, for example, "en-US" or "sr-Latn". Supported language codes are * listed in Language Support. If the source language isn't specified, the API * attempts to identify the source language automatically and returns the @@ -258,7 +254,7 @@ public function setSourceLanguageCode($var) } /** - * Required. The BCP-47 language code to use for translation of the input + * Required. The ISO-639 language code to use for translation of the input * text, set to one of the language codes listed in Language Support. * * Generated from protobuf field string target_language_code = 5 [(.google.api.field_behavior) = REQUIRED]; @@ -270,7 +266,7 @@ public function getTargetLanguageCode() } /** - * Required. The BCP-47 language code to use for translation of the input + * Required. The ISO-639 language code to use for translation of the input * text, set to one of the language codes listed in Language Support. * * Generated from protobuf field string target_language_code = 5 [(.google.api.field_behavior) = REQUIRED]; diff --git a/Translate/src/V3/Translation.php b/Translate/src/V3/Translation.php index 2ecc3ab81fb..82722a76ebe 100644 --- a/Translate/src/V3/Translation.php +++ b/Translate/src/V3/Translation.php @@ -36,7 +36,7 @@ class Translation extends \Google\Protobuf\Internal\Message */ private $model = ''; /** - * The BCP-47 language code of source text in the initial request, detected + * The ISO-639 language code of source text in the initial request, detected * automatically, if no source language was passed within the initial * request. If the source language was passed, auto-detection of the language * does not occur and this field is empty. @@ -70,7 +70,7 @@ class Translation extends \Google\Protobuf\Internal\Message * `model` here would be normalized to * `projects/{project-number}/locations/{location-id}/models/general/nmt`. * @type string $detected_language_code - * The BCP-47 language code of source text in the initial request, detected + * The ISO-639 language code of source text in the initial request, detected * automatically, if no source language was passed within the initial * request. If the source language was passed, auto-detection of the language * does not occur and this field is empty. @@ -152,7 +152,7 @@ public function setModel($var) } /** - * The BCP-47 language code of source text in the initial request, detected + * The ISO-639 language code of source text in the initial request, detected * automatically, if no source language was passed within the initial * request. If the source language was passed, auto-detection of the language * does not occur and this field is empty. @@ -166,7 +166,7 @@ public function getDetectedLanguageCode() } /** - * The BCP-47 language code of source text in the initial request, detected + * The ISO-639 language code of source text in the initial request, detected * automatically, if no source language was passed within the initial * request. If the source language was passed, auto-detection of the language * does not occur and this field is empty. diff --git a/Translate/tests/Unit/V3/TranslationServiceClientTest.php b/Translate/tests/Unit/V3/TranslationServiceClientTest.php index 7e833c2cae0..da38d3bf29b 100644 --- a/Translate/tests/Unit/V3/TranslationServiceClientTest.php +++ b/Translate/tests/Unit/V3/TranslationServiceClientTest.php @@ -385,9 +385,11 @@ public function createGlossaryTest() $transport->addResponse($incompleteOperation); $name = 'name3373707'; $entryCount = 811131134; + $displayName = 'displayName1615086568'; $expectedResponse = new Glossary(); $expectedResponse->setName($name); $expectedResponse->setEntryCount($entryCount); + $expectedResponse->setDisplayName($displayName); $anyResponse = new Any(); $anyResponse->setValue($expectedResponse->serializeToString()); $completeOperation = new Operation(); @@ -679,9 +681,11 @@ public function getGlossaryTest() // Mock response $name2 = 'name2-1052831874'; $entryCount = 811131134; + $displayName = 'displayName1615086568'; $expectedResponse = new Glossary(); $expectedResponse->setName($name2); $expectedResponse->setEntryCount($entryCount); + $expectedResponse->setDisplayName($displayName); $transport->addResponse($expectedResponse); // Mock request $formattedName = $gapicClient->glossaryName('[PROJECT]', '[LOCATION]', '[GLOSSARY]'); diff --git a/owl-bot-staging/Translate/v3/proto/src/GPBMetadata/Google/Cloud/Translate/V3/TranslationService.php b/owl-bot-staging/Translate/v3/proto/src/GPBMetadata/Google/Cloud/Translate/V3/TranslationService.php deleted file mode 100644 index f7615d188f389ce4c52c5f4f63b61e7b76741bf0..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 12544 zcmd5?&2t<_70>KOiqtEAwQXgk*kL_(5?hgXofQemI!dzoj6jwZOL3}piZ5Qx zbiaP@_rBls>uxKEbrS(g&)py!ngH#GF$7xxl)Ucd(vlMuS?OQ;wv@;d{VLEorC*F?PAVo$W zA=}s{zH2l{VR3cl772`|5f~ebjMT;~CAG0GNp0Mnx`|N3GJL-v9|FlWP7yso1^DN- z>z3Il_<<3?e^*SuX4+<88kYGD5N^7#X;?l1GTm!8+jb)WdIh@Sw%s6CuN62=y7r3e z02tE+$=fQ$2e8>#vIFAThP5$A{Dx<`f#a>h(n_U8f)G{uYW!(I(Qr+0EvgvqI^&;< zyx64Z*Xja(v0yB+z!MmYSC_>rs{>@o34x3qz&sT!y%b2a_yT`k+U&!eH1c#_u&+STEi>_4j+oJTpcWjh|JH4LBRGw^1JzR~nwXVE!@;2rYy zHt2^^YB-<-JMe*0R#F;8!`r}8E!cHQJ}Xbq@FjGPTU5<5>{i=o!BI|=gp!@`I9` zhVP1jyvd)BTeZ@D`WZ{&_p_ zb{Wm_>nIm_hI1(UKH23u#3#_ej$yUA;)W}kS2g|T8al7=2_Ef2)FJo{G!lsDO+Az; zFIT?W7mKg~FQW4yXbPb$leKR``Y$z(l5oKY}zRL=YlQsLswJ4tOGB&ekN5&snU===acQ zoI_!*Z=qpHMB3{0J|yk1q5nWb7Zypd)^=UT1EZ1r`Q19?0qYPt)Y18->ARM(8#Bc) zxN4oq!_1e5)%OtY<_A~1Wi6)4+C@Wm(V4D?y%cc{jY#Hc$;VVN4EA=?=TOzSZdn)~ ziazIIn#JxR{W2O}Z1`)e;H1WC+HO0jwLOztFqJo>Z=>82eLl<6kYdvjs9r~?)$rxH z6t7(Q`BVhLqu+iaVvRS@Nq7OpUtroSFF?>ZKAI%&c?e8>xDhd`5K03>`{}(U7VzI6;=?hg|ukzQ{(E!r<%#kx!v~xf^Dd zA(mOHsXX`6T~~6!m(ggW?FY^_ZTo6Q5O`+2P1^)0lSC=1;cMsu^oL;~P^134Luzhw zv*y^=ZaxP~d2NcXqXMywx$GRjO`lNG0#jRs@EM4Jcmw1&hHOSDsfi#H^-4c~_A(cjNNk!`fgd)-cjG}iMJ`#+PW{E{m z>i!XE4{D&s-$$on{Ha?OqdnIV?3#9KhYd}?&!ABiRyn1^Z=(S^!Xhj}oGia~2-Qd$ z#WhL*Uj&<%Q@&=cv1ND$v|OIg%ET-lLuWP(7`P~}sPkuGns7RRDVG)9M7=+YODN~J z>)U2fqjL)|WNL!rl1DkzD25{-ouC2E&3UM6*Q@LEwRcz6R_AAz7MAAcPCo%EdFsx) zD=SMYi>EbcgNN7Not>SZpM!T9Xfp;Es!Pl8JBv>uG+SMnonKz2OP{1m#ozFHK>wW< z2Q+M#lZ2rmCVK>cVleQ?m;wWyL_@@ep142IzJksQ)7_1PfmlJwGsxo<*FPOVLy|sZ zyeC=jz@si3Cf$y-eXe18tbfRrUy*7~8mSc}L8uz|cxV>F;418fLUJ8p*#fem5i|%S z5M|n9Q1#bH08|&yNHnYpV@%I{lFKNpFgt@{-rEJ%+Ax@+VRe8;oGkvlYVCZql%i(7 z>!paU>69zgLHL%jSR*$K+t_4J8(%@Ej?xVB%?T{I9`0$1gn)zxGPuK(F*b{@g3I!pu{8Ab#)e&Ez6o zv;KXUd(A>+77$7P7%GISS5E@1QK3Oi^Un zSSp|iG}Ylht&B*aP|fT(ph%|p8HeIKP#ma?hsA+v6)|1%NRblnm9&1a=KnK@E~-_Z zoI)IfyB<>$^iI52;l0qyso|0dC1r`ERu(?tV@j-X;ZS|BSH>CcfW((Eo|79Niw+wo= zS4a`a=Gcw}iB)WG!Lcw4l9*ksW`_+rp$C zi+XuVk44Mu9!)5%v$HS(9*dnAX<=zy-PMiKsyQ|HD)E|*EK^tOpJaPs8>Z4#wOdag zv?l9G(h^BDrY)`$if>$7TrY8LaeegC7S~CVwzxWajtsa;5=RDH6{*^yis{nU!T5hV zvxD--=Ma{$8-lR7`Go(JK_}#6HmStvqkmZ|)g#KLezV5aA)hnF(WKzR83Ew@~^^pDQl32#( zqm$wNkjbPQA?dX6cQfdu`lT4BgQPB&z)qzC8{Z?4{T@fQsh5)xQju*c_XQ}lFY3=H zZ``YNE#9v_+XFNKEB-OuNl5&xjnjvIiF+h2rBqzHzAXFjah+M)CVnMZGzF8A_^=%L z27hl7PbBZ$OIW>M)fH6a=WAvBfPbr@Gof$DY>Lxs(603ok@PwtTA5!T3s<^X=e*qWXB9lOz9&95k zCENYYxAbX+Q97RQk^Up9DNXF{SJ@~Z{~0h==N$)NtS*+!9uRL_&g29~^RP^^SQ9^& z>j}q(HPSW4zxlA556c}9T;wqN57n=31%c~VN~Qbv@5f%2jCQca@6ca|t6l+ZyeIox zF3*F)aON)>x(HWNlfxQ;d&M(P%XHGIBUkB__Eqg(l}AB-yOrH+Z8_09{3Vb?z18p5 zZ$?gc>;KlYUuDJ?*)9I!EWO3wxyV|)JM~b$+Ynd$BX|7alK-R31-`XXVS6hT$t$T; n?oQPQ*~h!77sBh;ll;DXgoogle.cloud.translation.v3.BatchDocumentInputConfig - */ -class BatchDocumentInputConfig extends \Google\Protobuf\Internal\Message -{ - protected $source; - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type \Google\Cloud\Translate\V3\GcsSource $gcs_source - * Google Cloud Storage location for the source input. - * This can be a single file (for example, - * `gs://translation-test/input.docx`) or a wildcard (for example, - * `gs://translation-test/*`). - * File mime type is determined based on extension. Supported mime type - * includes: - * - `pdf`, application/pdf - * - `docx`, - * application/vnd.openxmlformats-officedocument.wordprocessingml.document - * - `pptx`, - * application/vnd.openxmlformats-officedocument.presentationml.presentation - * - `xlsx`, - * application/vnd.openxmlformats-officedocument.spreadsheetml.sheet - * The max file size to support for `.docx`, `.pptx` and `.xlsx` is 100MB. - * The max file size to support for `.pdf` is 1GB and the max page limit is - * 1000 pages. - * The max file size to support for all input documents is 1GB. - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Cloud\Translate\V3\TranslationService::initOnce(); - parent::__construct($data); - } - - /** - * Google Cloud Storage location for the source input. - * This can be a single file (for example, - * `gs://translation-test/input.docx`) or a wildcard (for example, - * `gs://translation-test/*`). - * File mime type is determined based on extension. Supported mime type - * includes: - * - `pdf`, application/pdf - * - `docx`, - * application/vnd.openxmlformats-officedocument.wordprocessingml.document - * - `pptx`, - * application/vnd.openxmlformats-officedocument.presentationml.presentation - * - `xlsx`, - * application/vnd.openxmlformats-officedocument.spreadsheetml.sheet - * The max file size to support for `.docx`, `.pptx` and `.xlsx` is 100MB. - * The max file size to support for `.pdf` is 1GB and the max page limit is - * 1000 pages. - * The max file size to support for all input documents is 1GB. - * - * Generated from protobuf field .google.cloud.translation.v3.GcsSource gcs_source = 1; - * @return \Google\Cloud\Translate\V3\GcsSource|null - */ - public function getGcsSource() - { - return $this->readOneof(1); - } - - public function hasGcsSource() - { - return $this->hasOneof(1); - } - - /** - * Google Cloud Storage location for the source input. - * This can be a single file (for example, - * `gs://translation-test/input.docx`) or a wildcard (for example, - * `gs://translation-test/*`). - * File mime type is determined based on extension. Supported mime type - * includes: - * - `pdf`, application/pdf - * - `docx`, - * application/vnd.openxmlformats-officedocument.wordprocessingml.document - * - `pptx`, - * application/vnd.openxmlformats-officedocument.presentationml.presentation - * - `xlsx`, - * application/vnd.openxmlformats-officedocument.spreadsheetml.sheet - * The max file size to support for `.docx`, `.pptx` and `.xlsx` is 100MB. - * The max file size to support for `.pdf` is 1GB and the max page limit is - * 1000 pages. - * The max file size to support for all input documents is 1GB. - * - * Generated from protobuf field .google.cloud.translation.v3.GcsSource gcs_source = 1; - * @param \Google\Cloud\Translate\V3\GcsSource $var - * @return $this - */ - public function setGcsSource($var) - { - GPBUtil::checkMessage($var, \Google\Cloud\Translate\V3\GcsSource::class); - $this->writeOneof(1, $var); - - return $this; - } - - /** - * @return string - */ - public function getSource() - { - return $this->whichOneof("source"); - } - -} - diff --git a/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/BatchDocumentOutputConfig.php b/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/BatchDocumentOutputConfig.php deleted file mode 100644 index ae9cab5054d..00000000000 --- a/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/BatchDocumentOutputConfig.php +++ /dev/null @@ -1,186 +0,0 @@ -google.cloud.translation.v3.BatchDocumentOutputConfig - */ -class BatchDocumentOutputConfig extends \Google\Protobuf\Internal\Message -{ - protected $destination; - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type \Google\Cloud\Translate\V3\GcsDestination $gcs_destination - * Google Cloud Storage destination for output content. - * For every single input document (for example, gs://a/b/c.[extension]), we - * generate at most 2 * n output files. (n is the # of target_language_codes - * in the BatchTranslateDocumentRequest). - * While the input documents are being processed, we write/update an index - * file `index.csv` under `gcs_destination.output_uri_prefix` (for example, - * gs://translation_output/index.csv) The index file is generated/updated as - * new files are being translated. The format is: - * input_document,target_language_code,translation_output,error_output, - * glossary_translation_output,glossary_error_output - * `input_document` is one file we matched using gcs_source.input_uri. - * `target_language_code` is provided in the request. - * `translation_output` contains the translations. (details provided below) - * `error_output` contains the error message during processing of the file. - * Both translations_file and errors_file could be empty strings if we have - * no content to output. - * `glossary_translation_output` and `glossary_error_output` are the - * translated output/error when we apply glossaries. They could also be - * empty if we have no content to output. - * Once a row is present in index.csv, the input/output matching never - * changes. Callers should also expect all the content in input_file are - * processed and ready to be consumed (that is, no partial output file is - * written). - * Since index.csv will be keeping updated during the process, please make - * sure there is no custom retention policy applied on the output bucket - * that may avoid file updating. - * (https://cloud.google.com/storage/docs/bucket-lock#retention-policy) - * The naming format of translation output files follows (for target - * language code [trg]): `translation_output`: - * gs://translation_output/a_b_c_[trg]_translation.[extension] - * `glossary_translation_output`: - * gs://translation_test/a_b_c_[trg]_glossary_translation.[extension] The - * output document will maintain the same file format as the input document. - * The naming format of error output files follows (for target language code - * [trg]): `error_output`: gs://translation_test/a_b_c_[trg]_errors.txt - * `glossary_error_output`: - * gs://translation_test/a_b_c_[trg]_glossary_translation.txt The error - * output is a txt file containing error details. - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Cloud\Translate\V3\TranslationService::initOnce(); - parent::__construct($data); - } - - /** - * Google Cloud Storage destination for output content. - * For every single input document (for example, gs://a/b/c.[extension]), we - * generate at most 2 * n output files. (n is the # of target_language_codes - * in the BatchTranslateDocumentRequest). - * While the input documents are being processed, we write/update an index - * file `index.csv` under `gcs_destination.output_uri_prefix` (for example, - * gs://translation_output/index.csv) The index file is generated/updated as - * new files are being translated. The format is: - * input_document,target_language_code,translation_output,error_output, - * glossary_translation_output,glossary_error_output - * `input_document` is one file we matched using gcs_source.input_uri. - * `target_language_code` is provided in the request. - * `translation_output` contains the translations. (details provided below) - * `error_output` contains the error message during processing of the file. - * Both translations_file and errors_file could be empty strings if we have - * no content to output. - * `glossary_translation_output` and `glossary_error_output` are the - * translated output/error when we apply glossaries. They could also be - * empty if we have no content to output. - * Once a row is present in index.csv, the input/output matching never - * changes. Callers should also expect all the content in input_file are - * processed and ready to be consumed (that is, no partial output file is - * written). - * Since index.csv will be keeping updated during the process, please make - * sure there is no custom retention policy applied on the output bucket - * that may avoid file updating. - * (https://cloud.google.com/storage/docs/bucket-lock#retention-policy) - * The naming format of translation output files follows (for target - * language code [trg]): `translation_output`: - * gs://translation_output/a_b_c_[trg]_translation.[extension] - * `glossary_translation_output`: - * gs://translation_test/a_b_c_[trg]_glossary_translation.[extension] The - * output document will maintain the same file format as the input document. - * The naming format of error output files follows (for target language code - * [trg]): `error_output`: gs://translation_test/a_b_c_[trg]_errors.txt - * `glossary_error_output`: - * gs://translation_test/a_b_c_[trg]_glossary_translation.txt The error - * output is a txt file containing error details. - * - * Generated from protobuf field .google.cloud.translation.v3.GcsDestination gcs_destination = 1; - * @return \Google\Cloud\Translate\V3\GcsDestination|null - */ - public function getGcsDestination() - { - return $this->readOneof(1); - } - - public function hasGcsDestination() - { - return $this->hasOneof(1); - } - - /** - * Google Cloud Storage destination for output content. - * For every single input document (for example, gs://a/b/c.[extension]), we - * generate at most 2 * n output files. (n is the # of target_language_codes - * in the BatchTranslateDocumentRequest). - * While the input documents are being processed, we write/update an index - * file `index.csv` under `gcs_destination.output_uri_prefix` (for example, - * gs://translation_output/index.csv) The index file is generated/updated as - * new files are being translated. The format is: - * input_document,target_language_code,translation_output,error_output, - * glossary_translation_output,glossary_error_output - * `input_document` is one file we matched using gcs_source.input_uri. - * `target_language_code` is provided in the request. - * `translation_output` contains the translations. (details provided below) - * `error_output` contains the error message during processing of the file. - * Both translations_file and errors_file could be empty strings if we have - * no content to output. - * `glossary_translation_output` and `glossary_error_output` are the - * translated output/error when we apply glossaries. They could also be - * empty if we have no content to output. - * Once a row is present in index.csv, the input/output matching never - * changes. Callers should also expect all the content in input_file are - * processed and ready to be consumed (that is, no partial output file is - * written). - * Since index.csv will be keeping updated during the process, please make - * sure there is no custom retention policy applied on the output bucket - * that may avoid file updating. - * (https://cloud.google.com/storage/docs/bucket-lock#retention-policy) - * The naming format of translation output files follows (for target - * language code [trg]): `translation_output`: - * gs://translation_output/a_b_c_[trg]_translation.[extension] - * `glossary_translation_output`: - * gs://translation_test/a_b_c_[trg]_glossary_translation.[extension] The - * output document will maintain the same file format as the input document. - * The naming format of error output files follows (for target language code - * [trg]): `error_output`: gs://translation_test/a_b_c_[trg]_errors.txt - * `glossary_error_output`: - * gs://translation_test/a_b_c_[trg]_glossary_translation.txt The error - * output is a txt file containing error details. - * - * Generated from protobuf field .google.cloud.translation.v3.GcsDestination gcs_destination = 1; - * @param \Google\Cloud\Translate\V3\GcsDestination $var - * @return $this - */ - public function setGcsDestination($var) - { - GPBUtil::checkMessage($var, \Google\Cloud\Translate\V3\GcsDestination::class); - $this->writeOneof(1, $var); - - return $this; - } - - /** - * @return string - */ - public function getDestination() - { - return $this->whichOneof("destination"); - } - -} - diff --git a/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/BatchTranslateDocumentMetadata.php b/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/BatchTranslateDocumentMetadata.php deleted file mode 100644 index 578301767c6..00000000000 --- a/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/BatchTranslateDocumentMetadata.php +++ /dev/null @@ -1,411 +0,0 @@ -google.cloud.translation.v3.BatchTranslateDocumentMetadata - */ -class BatchTranslateDocumentMetadata extends \Google\Protobuf\Internal\Message -{ - /** - * The state of the operation. - * - * Generated from protobuf field .google.cloud.translation.v3.BatchTranslateDocumentMetadata.State state = 1; - */ - protected $state = 0; - /** - * Total number of pages to translate in all documents so far. Documents - * without clear page definition (such as XLSX) are not counted. - * - * Generated from protobuf field int64 total_pages = 2; - */ - protected $total_pages = 0; - /** - * Number of successfully translated pages in all documents so far. Documents - * without clear page definition (such as XLSX) are not counted. - * - * Generated from protobuf field int64 translated_pages = 3; - */ - protected $translated_pages = 0; - /** - * Number of pages that failed to process in all documents so far. Documents - * without clear page definition (such as XLSX) are not counted. - * - * Generated from protobuf field int64 failed_pages = 4; - */ - protected $failed_pages = 0; - /** - * Number of billable pages in documents with clear page definition (such as - * PDF, DOCX, PPTX) so far. - * - * Generated from protobuf field int64 total_billable_pages = 5; - */ - protected $total_billable_pages = 0; - /** - * Total number of characters (Unicode codepoints) in all documents so far. - * - * Generated from protobuf field int64 total_characters = 6; - */ - protected $total_characters = 0; - /** - * Number of successfully translated characters (Unicode codepoints) in all - * documents so far. - * - * Generated from protobuf field int64 translated_characters = 7; - */ - protected $translated_characters = 0; - /** - * Number of characters that have failed to process (Unicode codepoints) in - * all documents so far. - * - * Generated from protobuf field int64 failed_characters = 8; - */ - protected $failed_characters = 0; - /** - * Number of billable characters (Unicode codepoints) in documents without - * clear page definition (such as XLSX) so far. - * - * Generated from protobuf field int64 total_billable_characters = 9; - */ - protected $total_billable_characters = 0; - /** - * Time when the operation was submitted. - * - * Generated from protobuf field .google.protobuf.Timestamp submit_time = 10; - */ - protected $submit_time = null; - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type int $state - * The state of the operation. - * @type int|string $total_pages - * Total number of pages to translate in all documents so far. Documents - * without clear page definition (such as XLSX) are not counted. - * @type int|string $translated_pages - * Number of successfully translated pages in all documents so far. Documents - * without clear page definition (such as XLSX) are not counted. - * @type int|string $failed_pages - * Number of pages that failed to process in all documents so far. Documents - * without clear page definition (such as XLSX) are not counted. - * @type int|string $total_billable_pages - * Number of billable pages in documents with clear page definition (such as - * PDF, DOCX, PPTX) so far. - * @type int|string $total_characters - * Total number of characters (Unicode codepoints) in all documents so far. - * @type int|string $translated_characters - * Number of successfully translated characters (Unicode codepoints) in all - * documents so far. - * @type int|string $failed_characters - * Number of characters that have failed to process (Unicode codepoints) in - * all documents so far. - * @type int|string $total_billable_characters - * Number of billable characters (Unicode codepoints) in documents without - * clear page definition (such as XLSX) so far. - * @type \Google\Protobuf\Timestamp $submit_time - * Time when the operation was submitted. - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Cloud\Translate\V3\TranslationService::initOnce(); - parent::__construct($data); - } - - /** - * The state of the operation. - * - * Generated from protobuf field .google.cloud.translation.v3.BatchTranslateDocumentMetadata.State state = 1; - * @return int - */ - public function getState() - { - return $this->state; - } - - /** - * The state of the operation. - * - * Generated from protobuf field .google.cloud.translation.v3.BatchTranslateDocumentMetadata.State state = 1; - * @param int $var - * @return $this - */ - public function setState($var) - { - GPBUtil::checkEnum($var, \Google\Cloud\Translate\V3\BatchTranslateDocumentMetadata\State::class); - $this->state = $var; - - return $this; - } - - /** - * Total number of pages to translate in all documents so far. Documents - * without clear page definition (such as XLSX) are not counted. - * - * Generated from protobuf field int64 total_pages = 2; - * @return int|string - */ - public function getTotalPages() - { - return $this->total_pages; - } - - /** - * Total number of pages to translate in all documents so far. Documents - * without clear page definition (such as XLSX) are not counted. - * - * Generated from protobuf field int64 total_pages = 2; - * @param int|string $var - * @return $this - */ - public function setTotalPages($var) - { - GPBUtil::checkInt64($var); - $this->total_pages = $var; - - return $this; - } - - /** - * Number of successfully translated pages in all documents so far. Documents - * without clear page definition (such as XLSX) are not counted. - * - * Generated from protobuf field int64 translated_pages = 3; - * @return int|string - */ - public function getTranslatedPages() - { - return $this->translated_pages; - } - - /** - * Number of successfully translated pages in all documents so far. Documents - * without clear page definition (such as XLSX) are not counted. - * - * Generated from protobuf field int64 translated_pages = 3; - * @param int|string $var - * @return $this - */ - public function setTranslatedPages($var) - { - GPBUtil::checkInt64($var); - $this->translated_pages = $var; - - return $this; - } - - /** - * Number of pages that failed to process in all documents so far. Documents - * without clear page definition (such as XLSX) are not counted. - * - * Generated from protobuf field int64 failed_pages = 4; - * @return int|string - */ - public function getFailedPages() - { - return $this->failed_pages; - } - - /** - * Number of pages that failed to process in all documents so far. Documents - * without clear page definition (such as XLSX) are not counted. - * - * Generated from protobuf field int64 failed_pages = 4; - * @param int|string $var - * @return $this - */ - public function setFailedPages($var) - { - GPBUtil::checkInt64($var); - $this->failed_pages = $var; - - return $this; - } - - /** - * Number of billable pages in documents with clear page definition (such as - * PDF, DOCX, PPTX) so far. - * - * Generated from protobuf field int64 total_billable_pages = 5; - * @return int|string - */ - public function getTotalBillablePages() - { - return $this->total_billable_pages; - } - - /** - * Number of billable pages in documents with clear page definition (such as - * PDF, DOCX, PPTX) so far. - * - * Generated from protobuf field int64 total_billable_pages = 5; - * @param int|string $var - * @return $this - */ - public function setTotalBillablePages($var) - { - GPBUtil::checkInt64($var); - $this->total_billable_pages = $var; - - return $this; - } - - /** - * Total number of characters (Unicode codepoints) in all documents so far. - * - * Generated from protobuf field int64 total_characters = 6; - * @return int|string - */ - public function getTotalCharacters() - { - return $this->total_characters; - } - - /** - * Total number of characters (Unicode codepoints) in all documents so far. - * - * Generated from protobuf field int64 total_characters = 6; - * @param int|string $var - * @return $this - */ - public function setTotalCharacters($var) - { - GPBUtil::checkInt64($var); - $this->total_characters = $var; - - return $this; - } - - /** - * Number of successfully translated characters (Unicode codepoints) in all - * documents so far. - * - * Generated from protobuf field int64 translated_characters = 7; - * @return int|string - */ - public function getTranslatedCharacters() - { - return $this->translated_characters; - } - - /** - * Number of successfully translated characters (Unicode codepoints) in all - * documents so far. - * - * Generated from protobuf field int64 translated_characters = 7; - * @param int|string $var - * @return $this - */ - public function setTranslatedCharacters($var) - { - GPBUtil::checkInt64($var); - $this->translated_characters = $var; - - return $this; - } - - /** - * Number of characters that have failed to process (Unicode codepoints) in - * all documents so far. - * - * Generated from protobuf field int64 failed_characters = 8; - * @return int|string - */ - public function getFailedCharacters() - { - return $this->failed_characters; - } - - /** - * Number of characters that have failed to process (Unicode codepoints) in - * all documents so far. - * - * Generated from protobuf field int64 failed_characters = 8; - * @param int|string $var - * @return $this - */ - public function setFailedCharacters($var) - { - GPBUtil::checkInt64($var); - $this->failed_characters = $var; - - return $this; - } - - /** - * Number of billable characters (Unicode codepoints) in documents without - * clear page definition (such as XLSX) so far. - * - * Generated from protobuf field int64 total_billable_characters = 9; - * @return int|string - */ - public function getTotalBillableCharacters() - { - return $this->total_billable_characters; - } - - /** - * Number of billable characters (Unicode codepoints) in documents without - * clear page definition (such as XLSX) so far. - * - * Generated from protobuf field int64 total_billable_characters = 9; - * @param int|string $var - * @return $this - */ - public function setTotalBillableCharacters($var) - { - GPBUtil::checkInt64($var); - $this->total_billable_characters = $var; - - return $this; - } - - /** - * Time when the operation was submitted. - * - * Generated from protobuf field .google.protobuf.Timestamp submit_time = 10; - * @return \Google\Protobuf\Timestamp|null - */ - public function getSubmitTime() - { - return $this->submit_time; - } - - public function hasSubmitTime() - { - return isset($this->submit_time); - } - - public function clearSubmitTime() - { - unset($this->submit_time); - } - - /** - * Time when the operation was submitted. - * - * Generated from protobuf field .google.protobuf.Timestamp submit_time = 10; - * @param \Google\Protobuf\Timestamp $var - * @return $this - */ - public function setSubmitTime($var) - { - GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); - $this->submit_time = $var; - - return $this; - } - -} - diff --git a/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/BatchTranslateDocumentMetadata/State.php b/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/BatchTranslateDocumentMetadata/State.php deleted file mode 100644 index 6631a48171f..00000000000 --- a/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/BatchTranslateDocumentMetadata/State.php +++ /dev/null @@ -1,88 +0,0 @@ -google.cloud.translation.v3.BatchTranslateDocumentMetadata.State - */ -class State -{ - /** - * Invalid. - * - * Generated from protobuf enum STATE_UNSPECIFIED = 0; - */ - const STATE_UNSPECIFIED = 0; - /** - * Request is being processed. - * - * Generated from protobuf enum RUNNING = 1; - */ - const RUNNING = 1; - /** - * The batch is processed, and at least one item was successfully processed. - * - * Generated from protobuf enum SUCCEEDED = 2; - */ - const SUCCEEDED = 2; - /** - * The batch is done and no item was successfully processed. - * - * Generated from protobuf enum FAILED = 3; - */ - const FAILED = 3; - /** - * Request is in the process of being canceled after caller invoked - * longrunning.Operations.CancelOperation on the request id. - * - * Generated from protobuf enum CANCELLING = 4; - */ - const CANCELLING = 4; - /** - * The batch is done after the user has called the - * longrunning.Operations.CancelOperation. Any records processed before the - * cancel command are output as specified in the request. - * - * Generated from protobuf enum CANCELLED = 5; - */ - const CANCELLED = 5; - - private static $valueToName = [ - self::STATE_UNSPECIFIED => 'STATE_UNSPECIFIED', - self::RUNNING => 'RUNNING', - self::SUCCEEDED => 'SUCCEEDED', - self::FAILED => 'FAILED', - self::CANCELLING => 'CANCELLING', - self::CANCELLED => 'CANCELLED', - ]; - - 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(State::class, \Google\Cloud\Translate\V3\BatchTranslateDocumentMetadata_State::class); - diff --git a/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/BatchTranslateDocumentMetadata_State.php b/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/BatchTranslateDocumentMetadata_State.php deleted file mode 100644 index 78a6194c53e..00000000000 --- a/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/BatchTranslateDocumentMetadata_State.php +++ /dev/null @@ -1,16 +0,0 @@ -google.cloud.translation.v3.BatchTranslateDocumentRequest - */ -class BatchTranslateDocumentRequest extends \Google\Protobuf\Internal\Message -{ - /** - * Required. Location to make a regional call. - * Format: `projects/{project-number-or-id}/locations/{location-id}`. - * The `global` location is not supported for batch translation. - * Only AutoML Translation models or glossaries within the same region (have - * the same location-id) can be used, otherwise an INVALID_ARGUMENT (400) - * error is returned. - * - * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { - */ - protected $parent = ''; - /** - * Required. The ISO-639 language code of the input document if known, for - * example, "en-US" or "sr-Latn". Supported language codes are listed in - * [Language Support](https://cloud.google.com/translate/docs/languages). - * - * Generated from protobuf field string source_language_code = 2 [(.google.api.field_behavior) = REQUIRED]; - */ - protected $source_language_code = ''; - /** - * Required. The ISO-639 language code to use for translation of the input - * document. Specify up to 10 language codes here. - * - * Generated from protobuf field repeated string target_language_codes = 3 [(.google.api.field_behavior) = REQUIRED]; - */ - private $target_language_codes; - /** - * Required. Input configurations. - * The total number of files matched should be <= 100. - * The total content size to translate should be <= 100M Unicode codepoints. - * The files must use UTF-8 encoding. - * - * Generated from protobuf field repeated .google.cloud.translation.v3.BatchDocumentInputConfig input_configs = 4 [(.google.api.field_behavior) = REQUIRED]; - */ - private $input_configs; - /** - * Required. Output configuration. - * If 2 input configs match to the same file (that is, same input path), - * we don't generate output for duplicate inputs. - * - * Generated from protobuf field .google.cloud.translation.v3.BatchDocumentOutputConfig output_config = 5 [(.google.api.field_behavior) = REQUIRED]; - */ - protected $output_config = null; - /** - * Optional. The models to use for translation. Map's key is target language - * code. Map's value is the model name. Value can be a built-in general model, - * or an AutoML Translation model. - * The value format depends on model type: - * - AutoML Translation models: - * `projects/{project-number-or-id}/locations/{location-id}/models/{model-id}` - * - General (built-in) models: - * `projects/{project-number-or-id}/locations/{location-id}/models/general/nmt`, - * If the map is empty or a specific model is - * not requested for a language pair, then default google model (nmt) is used. - * - * Generated from protobuf field map models = 6 [(.google.api.field_behavior) = OPTIONAL]; - */ - private $models; - /** - * Optional. Glossaries to be applied. It's keyed by target language code. - * - * Generated from protobuf field map glossaries = 7 [(.google.api.field_behavior) = OPTIONAL]; - */ - private $glossaries; - /** - * Optional. File format conversion map to be applied to all input files. - * Map's key is the original mime_type. Map's value is the target mime_type of - * translated documents. - * Supported file format conversion includes: - * - `application/pdf` to - * `application/vnd.openxmlformats-officedocument.wordprocessingml.document` - * If nothing specified, output files will be in the same format as the - * original file. - * - * Generated from protobuf field map format_conversions = 8 [(.google.api.field_behavior) = OPTIONAL]; - */ - private $format_conversions; - /** - * Optional. This flag is to support user customized attribution. - * If not provided, the default is `Machine Translated by Google`. - * Customized attribution should follow rules in - * https://cloud.google.com/translate/attribution#attribution_and_logos - * - * Generated from protobuf field string customized_attribution = 10 [(.google.api.field_behavior) = OPTIONAL]; - */ - protected $customized_attribution = ''; - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type string $parent - * Required. Location to make a regional call. - * Format: `projects/{project-number-or-id}/locations/{location-id}`. - * The `global` location is not supported for batch translation. - * Only AutoML Translation models or glossaries within the same region (have - * the same location-id) can be used, otherwise an INVALID_ARGUMENT (400) - * error is returned. - * @type string $source_language_code - * Required. The ISO-639 language code of the input document if known, for - * example, "en-US" or "sr-Latn". Supported language codes are listed in - * [Language Support](https://cloud.google.com/translate/docs/languages). - * @type array|\Google\Protobuf\Internal\RepeatedField $target_language_codes - * Required. The ISO-639 language code to use for translation of the input - * document. Specify up to 10 language codes here. - * @type array<\Google\Cloud\Translate\V3\BatchDocumentInputConfig>|\Google\Protobuf\Internal\RepeatedField $input_configs - * Required. Input configurations. - * The total number of files matched should be <= 100. - * The total content size to translate should be <= 100M Unicode codepoints. - * The files must use UTF-8 encoding. - * @type \Google\Cloud\Translate\V3\BatchDocumentOutputConfig $output_config - * Required. Output configuration. - * If 2 input configs match to the same file (that is, same input path), - * we don't generate output for duplicate inputs. - * @type array|\Google\Protobuf\Internal\MapField $models - * Optional. The models to use for translation. Map's key is target language - * code. Map's value is the model name. Value can be a built-in general model, - * or an AutoML Translation model. - * The value format depends on model type: - * - AutoML Translation models: - * `projects/{project-number-or-id}/locations/{location-id}/models/{model-id}` - * - General (built-in) models: - * `projects/{project-number-or-id}/locations/{location-id}/models/general/nmt`, - * If the map is empty or a specific model is - * not requested for a language pair, then default google model (nmt) is used. - * @type array|\Google\Protobuf\Internal\MapField $glossaries - * Optional. Glossaries to be applied. It's keyed by target language code. - * @type array|\Google\Protobuf\Internal\MapField $format_conversions - * Optional. File format conversion map to be applied to all input files. - * Map's key is the original mime_type. Map's value is the target mime_type of - * translated documents. - * Supported file format conversion includes: - * - `application/pdf` to - * `application/vnd.openxmlformats-officedocument.wordprocessingml.document` - * If nothing specified, output files will be in the same format as the - * original file. - * @type string $customized_attribution - * Optional. This flag is to support user customized attribution. - * If not provided, the default is `Machine Translated by Google`. - * Customized attribution should follow rules in - * https://cloud.google.com/translate/attribution#attribution_and_logos - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Cloud\Translate\V3\TranslationService::initOnce(); - parent::__construct($data); - } - - /** - * Required. Location to make a regional call. - * Format: `projects/{project-number-or-id}/locations/{location-id}`. - * The `global` location is not supported for batch translation. - * Only AutoML Translation models or glossaries within the same region (have - * the same location-id) can be used, otherwise an INVALID_ARGUMENT (400) - * error is returned. - * - * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { - * @return string - */ - public function getParent() - { - return $this->parent; - } - - /** - * Required. Location to make a regional call. - * Format: `projects/{project-number-or-id}/locations/{location-id}`. - * The `global` location is not supported for batch translation. - * Only AutoML Translation models or glossaries within the same region (have - * the same location-id) can be used, otherwise an INVALID_ARGUMENT (400) - * error is returned. - * - * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { - * @param string $var - * @return $this - */ - public function setParent($var) - { - GPBUtil::checkString($var, True); - $this->parent = $var; - - return $this; - } - - /** - * Required. The ISO-639 language code of the input document if known, for - * example, "en-US" or "sr-Latn". Supported language codes are listed in - * [Language Support](https://cloud.google.com/translate/docs/languages). - * - * Generated from protobuf field string source_language_code = 2 [(.google.api.field_behavior) = REQUIRED]; - * @return string - */ - public function getSourceLanguageCode() - { - return $this->source_language_code; - } - - /** - * Required. The ISO-639 language code of the input document if known, for - * example, "en-US" or "sr-Latn". Supported language codes are listed in - * [Language Support](https://cloud.google.com/translate/docs/languages). - * - * Generated from protobuf field string source_language_code = 2 [(.google.api.field_behavior) = REQUIRED]; - * @param string $var - * @return $this - */ - public function setSourceLanguageCode($var) - { - GPBUtil::checkString($var, True); - $this->source_language_code = $var; - - return $this; - } - - /** - * Required. The ISO-639 language code to use for translation of the input - * document. Specify up to 10 language codes here. - * - * Generated from protobuf field repeated string target_language_codes = 3 [(.google.api.field_behavior) = REQUIRED]; - * @return \Google\Protobuf\Internal\RepeatedField - */ - public function getTargetLanguageCodes() - { - return $this->target_language_codes; - } - - /** - * Required. The ISO-639 language code to use for translation of the input - * document. Specify up to 10 language codes here. - * - * Generated from protobuf field repeated string target_language_codes = 3 [(.google.api.field_behavior) = REQUIRED]; - * @param array|\Google\Protobuf\Internal\RepeatedField $var - * @return $this - */ - public function setTargetLanguageCodes($var) - { - $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); - $this->target_language_codes = $arr; - - return $this; - } - - /** - * Required. Input configurations. - * The total number of files matched should be <= 100. - * The total content size to translate should be <= 100M Unicode codepoints. - * The files must use UTF-8 encoding. - * - * Generated from protobuf field repeated .google.cloud.translation.v3.BatchDocumentInputConfig input_configs = 4 [(.google.api.field_behavior) = REQUIRED]; - * @return \Google\Protobuf\Internal\RepeatedField - */ - public function getInputConfigs() - { - return $this->input_configs; - } - - /** - * Required. Input configurations. - * The total number of files matched should be <= 100. - * The total content size to translate should be <= 100M Unicode codepoints. - * The files must use UTF-8 encoding. - * - * Generated from protobuf field repeated .google.cloud.translation.v3.BatchDocumentInputConfig input_configs = 4 [(.google.api.field_behavior) = REQUIRED]; - * @param array<\Google\Cloud\Translate\V3\BatchDocumentInputConfig>|\Google\Protobuf\Internal\RepeatedField $var - * @return $this - */ - public function setInputConfigs($var) - { - $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Translate\V3\BatchDocumentInputConfig::class); - $this->input_configs = $arr; - - return $this; - } - - /** - * Required. Output configuration. - * If 2 input configs match to the same file (that is, same input path), - * we don't generate output for duplicate inputs. - * - * Generated from protobuf field .google.cloud.translation.v3.BatchDocumentOutputConfig output_config = 5 [(.google.api.field_behavior) = REQUIRED]; - * @return \Google\Cloud\Translate\V3\BatchDocumentOutputConfig|null - */ - public function getOutputConfig() - { - return $this->output_config; - } - - public function hasOutputConfig() - { - return isset($this->output_config); - } - - public function clearOutputConfig() - { - unset($this->output_config); - } - - /** - * Required. Output configuration. - * If 2 input configs match to the same file (that is, same input path), - * we don't generate output for duplicate inputs. - * - * Generated from protobuf field .google.cloud.translation.v3.BatchDocumentOutputConfig output_config = 5 [(.google.api.field_behavior) = REQUIRED]; - * @param \Google\Cloud\Translate\V3\BatchDocumentOutputConfig $var - * @return $this - */ - public function setOutputConfig($var) - { - GPBUtil::checkMessage($var, \Google\Cloud\Translate\V3\BatchDocumentOutputConfig::class); - $this->output_config = $var; - - return $this; - } - - /** - * Optional. The models to use for translation. Map's key is target language - * code. Map's value is the model name. Value can be a built-in general model, - * or an AutoML Translation model. - * The value format depends on model type: - * - AutoML Translation models: - * `projects/{project-number-or-id}/locations/{location-id}/models/{model-id}` - * - General (built-in) models: - * `projects/{project-number-or-id}/locations/{location-id}/models/general/nmt`, - * If the map is empty or a specific model is - * not requested for a language pair, then default google model (nmt) is used. - * - * Generated from protobuf field map models = 6 [(.google.api.field_behavior) = OPTIONAL]; - * @return \Google\Protobuf\Internal\MapField - */ - public function getModels() - { - return $this->models; - } - - /** - * Optional. The models to use for translation. Map's key is target language - * code. Map's value is the model name. Value can be a built-in general model, - * or an AutoML Translation model. - * The value format depends on model type: - * - AutoML Translation models: - * `projects/{project-number-or-id}/locations/{location-id}/models/{model-id}` - * - General (built-in) models: - * `projects/{project-number-or-id}/locations/{location-id}/models/general/nmt`, - * If the map is empty or a specific model is - * not requested for a language pair, then default google model (nmt) is used. - * - * Generated from protobuf field map models = 6 [(.google.api.field_behavior) = OPTIONAL]; - * @param array|\Google\Protobuf\Internal\MapField $var - * @return $this - */ - public function setModels($var) - { - $arr = GPBUtil::checkMapField($var, \Google\Protobuf\Internal\GPBType::STRING, \Google\Protobuf\Internal\GPBType::STRING); - $this->models = $arr; - - return $this; - } - - /** - * Optional. Glossaries to be applied. It's keyed by target language code. - * - * Generated from protobuf field map glossaries = 7 [(.google.api.field_behavior) = OPTIONAL]; - * @return \Google\Protobuf\Internal\MapField - */ - public function getGlossaries() - { - return $this->glossaries; - } - - /** - * Optional. Glossaries to be applied. It's keyed by target language code. - * - * Generated from protobuf field map glossaries = 7 [(.google.api.field_behavior) = OPTIONAL]; - * @param array|\Google\Protobuf\Internal\MapField $var - * @return $this - */ - public function setGlossaries($var) - { - $arr = GPBUtil::checkMapField($var, \Google\Protobuf\Internal\GPBType::STRING, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Translate\V3\TranslateTextGlossaryConfig::class); - $this->glossaries = $arr; - - return $this; - } - - /** - * Optional. File format conversion map to be applied to all input files. - * Map's key is the original mime_type. Map's value is the target mime_type of - * translated documents. - * Supported file format conversion includes: - * - `application/pdf` to - * `application/vnd.openxmlformats-officedocument.wordprocessingml.document` - * If nothing specified, output files will be in the same format as the - * original file. - * - * Generated from protobuf field map format_conversions = 8 [(.google.api.field_behavior) = OPTIONAL]; - * @return \Google\Protobuf\Internal\MapField - */ - public function getFormatConversions() - { - return $this->format_conversions; - } - - /** - * Optional. File format conversion map to be applied to all input files. - * Map's key is the original mime_type. Map's value is the target mime_type of - * translated documents. - * Supported file format conversion includes: - * - `application/pdf` to - * `application/vnd.openxmlformats-officedocument.wordprocessingml.document` - * If nothing specified, output files will be in the same format as the - * original file. - * - * Generated from protobuf field map format_conversions = 8 [(.google.api.field_behavior) = OPTIONAL]; - * @param array|\Google\Protobuf\Internal\MapField $var - * @return $this - */ - public function setFormatConversions($var) - { - $arr = GPBUtil::checkMapField($var, \Google\Protobuf\Internal\GPBType::STRING, \Google\Protobuf\Internal\GPBType::STRING); - $this->format_conversions = $arr; - - return $this; - } - - /** - * Optional. This flag is to support user customized attribution. - * If not provided, the default is `Machine Translated by Google`. - * Customized attribution should follow rules in - * https://cloud.google.com/translate/attribution#attribution_and_logos - * - * Generated from protobuf field string customized_attribution = 10 [(.google.api.field_behavior) = OPTIONAL]; - * @return string - */ - public function getCustomizedAttribution() - { - return $this->customized_attribution; - } - - /** - * Optional. This flag is to support user customized attribution. - * If not provided, the default is `Machine Translated by Google`. - * Customized attribution should follow rules in - * https://cloud.google.com/translate/attribution#attribution_and_logos - * - * Generated from protobuf field string customized_attribution = 10 [(.google.api.field_behavior) = OPTIONAL]; - * @param string $var - * @return $this - */ - public function setCustomizedAttribution($var) - { - GPBUtil::checkString($var, True); - $this->customized_attribution = $var; - - return $this; - } - -} - diff --git a/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/BatchTranslateDocumentResponse.php b/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/BatchTranslateDocumentResponse.php deleted file mode 100644 index ac0c68355f7..00000000000 --- a/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/BatchTranslateDocumentResponse.php +++ /dev/null @@ -1,432 +0,0 @@ -google.cloud.translation.v3.BatchTranslateDocumentResponse - */ -class BatchTranslateDocumentResponse extends \Google\Protobuf\Internal\Message -{ - /** - * Total number of pages to translate in all documents. Documents without - * clear page definition (such as XLSX) are not counted. - * - * Generated from protobuf field int64 total_pages = 1; - */ - protected $total_pages = 0; - /** - * Number of successfully translated pages in all documents. Documents without - * clear page definition (such as XLSX) are not counted. - * - * Generated from protobuf field int64 translated_pages = 2; - */ - protected $translated_pages = 0; - /** - * Number of pages that failed to process in all documents. Documents without - * clear page definition (such as XLSX) are not counted. - * - * Generated from protobuf field int64 failed_pages = 3; - */ - protected $failed_pages = 0; - /** - * Number of billable pages in documents with clear page definition (such as - * PDF, DOCX, PPTX) - * - * Generated from protobuf field int64 total_billable_pages = 4; - */ - protected $total_billable_pages = 0; - /** - * Total number of characters (Unicode codepoints) in all documents. - * - * Generated from protobuf field int64 total_characters = 5; - */ - protected $total_characters = 0; - /** - * Number of successfully translated characters (Unicode codepoints) in all - * documents. - * - * Generated from protobuf field int64 translated_characters = 6; - */ - protected $translated_characters = 0; - /** - * Number of characters that have failed to process (Unicode codepoints) in - * all documents. - * - * Generated from protobuf field int64 failed_characters = 7; - */ - protected $failed_characters = 0; - /** - * Number of billable characters (Unicode codepoints) in documents without - * clear page definition, such as XLSX. - * - * Generated from protobuf field int64 total_billable_characters = 8; - */ - protected $total_billable_characters = 0; - /** - * Time when the operation was submitted. - * - * Generated from protobuf field .google.protobuf.Timestamp submit_time = 9; - */ - protected $submit_time = null; - /** - * The time when the operation is finished and - * [google.longrunning.Operation.done][google.longrunning.Operation.done] is - * set to true. - * - * Generated from protobuf field .google.protobuf.Timestamp end_time = 10; - */ - protected $end_time = null; - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type int|string $total_pages - * Total number of pages to translate in all documents. Documents without - * clear page definition (such as XLSX) are not counted. - * @type int|string $translated_pages - * Number of successfully translated pages in all documents. Documents without - * clear page definition (such as XLSX) are not counted. - * @type int|string $failed_pages - * Number of pages that failed to process in all documents. Documents without - * clear page definition (such as XLSX) are not counted. - * @type int|string $total_billable_pages - * Number of billable pages in documents with clear page definition (such as - * PDF, DOCX, PPTX) - * @type int|string $total_characters - * Total number of characters (Unicode codepoints) in all documents. - * @type int|string $translated_characters - * Number of successfully translated characters (Unicode codepoints) in all - * documents. - * @type int|string $failed_characters - * Number of characters that have failed to process (Unicode codepoints) in - * all documents. - * @type int|string $total_billable_characters - * Number of billable characters (Unicode codepoints) in documents without - * clear page definition, such as XLSX. - * @type \Google\Protobuf\Timestamp $submit_time - * Time when the operation was submitted. - * @type \Google\Protobuf\Timestamp $end_time - * The time when the operation is finished and - * [google.longrunning.Operation.done][google.longrunning.Operation.done] is - * set to true. - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Cloud\Translate\V3\TranslationService::initOnce(); - parent::__construct($data); - } - - /** - * Total number of pages to translate in all documents. Documents without - * clear page definition (such as XLSX) are not counted. - * - * Generated from protobuf field int64 total_pages = 1; - * @return int|string - */ - public function getTotalPages() - { - return $this->total_pages; - } - - /** - * Total number of pages to translate in all documents. Documents without - * clear page definition (such as XLSX) are not counted. - * - * Generated from protobuf field int64 total_pages = 1; - * @param int|string $var - * @return $this - */ - public function setTotalPages($var) - { - GPBUtil::checkInt64($var); - $this->total_pages = $var; - - return $this; - } - - /** - * Number of successfully translated pages in all documents. Documents without - * clear page definition (such as XLSX) are not counted. - * - * Generated from protobuf field int64 translated_pages = 2; - * @return int|string - */ - public function getTranslatedPages() - { - return $this->translated_pages; - } - - /** - * Number of successfully translated pages in all documents. Documents without - * clear page definition (such as XLSX) are not counted. - * - * Generated from protobuf field int64 translated_pages = 2; - * @param int|string $var - * @return $this - */ - public function setTranslatedPages($var) - { - GPBUtil::checkInt64($var); - $this->translated_pages = $var; - - return $this; - } - - /** - * Number of pages that failed to process in all documents. Documents without - * clear page definition (such as XLSX) are not counted. - * - * Generated from protobuf field int64 failed_pages = 3; - * @return int|string - */ - public function getFailedPages() - { - return $this->failed_pages; - } - - /** - * Number of pages that failed to process in all documents. Documents without - * clear page definition (such as XLSX) are not counted. - * - * Generated from protobuf field int64 failed_pages = 3; - * @param int|string $var - * @return $this - */ - public function setFailedPages($var) - { - GPBUtil::checkInt64($var); - $this->failed_pages = $var; - - return $this; - } - - /** - * Number of billable pages in documents with clear page definition (such as - * PDF, DOCX, PPTX) - * - * Generated from protobuf field int64 total_billable_pages = 4; - * @return int|string - */ - public function getTotalBillablePages() - { - return $this->total_billable_pages; - } - - /** - * Number of billable pages in documents with clear page definition (such as - * PDF, DOCX, PPTX) - * - * Generated from protobuf field int64 total_billable_pages = 4; - * @param int|string $var - * @return $this - */ - public function setTotalBillablePages($var) - { - GPBUtil::checkInt64($var); - $this->total_billable_pages = $var; - - return $this; - } - - /** - * Total number of characters (Unicode codepoints) in all documents. - * - * Generated from protobuf field int64 total_characters = 5; - * @return int|string - */ - public function getTotalCharacters() - { - return $this->total_characters; - } - - /** - * Total number of characters (Unicode codepoints) in all documents. - * - * Generated from protobuf field int64 total_characters = 5; - * @param int|string $var - * @return $this - */ - public function setTotalCharacters($var) - { - GPBUtil::checkInt64($var); - $this->total_characters = $var; - - return $this; - } - - /** - * Number of successfully translated characters (Unicode codepoints) in all - * documents. - * - * Generated from protobuf field int64 translated_characters = 6; - * @return int|string - */ - public function getTranslatedCharacters() - { - return $this->translated_characters; - } - - /** - * Number of successfully translated characters (Unicode codepoints) in all - * documents. - * - * Generated from protobuf field int64 translated_characters = 6; - * @param int|string $var - * @return $this - */ - public function setTranslatedCharacters($var) - { - GPBUtil::checkInt64($var); - $this->translated_characters = $var; - - return $this; - } - - /** - * Number of characters that have failed to process (Unicode codepoints) in - * all documents. - * - * Generated from protobuf field int64 failed_characters = 7; - * @return int|string - */ - public function getFailedCharacters() - { - return $this->failed_characters; - } - - /** - * Number of characters that have failed to process (Unicode codepoints) in - * all documents. - * - * Generated from protobuf field int64 failed_characters = 7; - * @param int|string $var - * @return $this - */ - public function setFailedCharacters($var) - { - GPBUtil::checkInt64($var); - $this->failed_characters = $var; - - return $this; - } - - /** - * Number of billable characters (Unicode codepoints) in documents without - * clear page definition, such as XLSX. - * - * Generated from protobuf field int64 total_billable_characters = 8; - * @return int|string - */ - public function getTotalBillableCharacters() - { - return $this->total_billable_characters; - } - - /** - * Number of billable characters (Unicode codepoints) in documents without - * clear page definition, such as XLSX. - * - * Generated from protobuf field int64 total_billable_characters = 8; - * @param int|string $var - * @return $this - */ - public function setTotalBillableCharacters($var) - { - GPBUtil::checkInt64($var); - $this->total_billable_characters = $var; - - return $this; - } - - /** - * Time when the operation was submitted. - * - * Generated from protobuf field .google.protobuf.Timestamp submit_time = 9; - * @return \Google\Protobuf\Timestamp|null - */ - public function getSubmitTime() - { - return $this->submit_time; - } - - public function hasSubmitTime() - { - return isset($this->submit_time); - } - - public function clearSubmitTime() - { - unset($this->submit_time); - } - - /** - * Time when the operation was submitted. - * - * Generated from protobuf field .google.protobuf.Timestamp submit_time = 9; - * @param \Google\Protobuf\Timestamp $var - * @return $this - */ - public function setSubmitTime($var) - { - GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); - $this->submit_time = $var; - - return $this; - } - - /** - * The time when the operation is finished and - * [google.longrunning.Operation.done][google.longrunning.Operation.done] is - * set to true. - * - * Generated from protobuf field .google.protobuf.Timestamp end_time = 10; - * @return \Google\Protobuf\Timestamp|null - */ - public function getEndTime() - { - return $this->end_time; - } - - public function hasEndTime() - { - return isset($this->end_time); - } - - public function clearEndTime() - { - unset($this->end_time); - } - - /** - * The time when the operation is finished and - * [google.longrunning.Operation.done][google.longrunning.Operation.done] is - * set to true. - * - * Generated from protobuf field .google.protobuf.Timestamp end_time = 10; - * @param \Google\Protobuf\Timestamp $var - * @return $this - */ - public function setEndTime($var) - { - GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); - $this->end_time = $var; - - return $this; - } - -} - diff --git a/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/BatchTranslateMetadata.php b/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/BatchTranslateMetadata.php deleted file mode 100644 index 088d15ac8a9..00000000000 --- a/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/BatchTranslateMetadata.php +++ /dev/null @@ -1,225 +0,0 @@ -google.cloud.translation.v3.BatchTranslateMetadata - */ -class BatchTranslateMetadata extends \Google\Protobuf\Internal\Message -{ - /** - * The state of the operation. - * - * Generated from protobuf field .google.cloud.translation.v3.BatchTranslateMetadata.State state = 1; - */ - protected $state = 0; - /** - * Number of successfully translated characters so far (Unicode codepoints). - * - * Generated from protobuf field int64 translated_characters = 2; - */ - protected $translated_characters = 0; - /** - * Number of characters that have failed to process so far (Unicode - * codepoints). - * - * Generated from protobuf field int64 failed_characters = 3; - */ - protected $failed_characters = 0; - /** - * Total number of characters (Unicode codepoints). - * This is the total number of codepoints from input files times the number of - * target languages and appears here shortly after the call is submitted. - * - * Generated from protobuf field int64 total_characters = 4; - */ - protected $total_characters = 0; - /** - * Time when the operation was submitted. - * - * Generated from protobuf field .google.protobuf.Timestamp submit_time = 5; - */ - protected $submit_time = null; - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type int $state - * The state of the operation. - * @type int|string $translated_characters - * Number of successfully translated characters so far (Unicode codepoints). - * @type int|string $failed_characters - * Number of characters that have failed to process so far (Unicode - * codepoints). - * @type int|string $total_characters - * Total number of characters (Unicode codepoints). - * This is the total number of codepoints from input files times the number of - * target languages and appears here shortly after the call is submitted. - * @type \Google\Protobuf\Timestamp $submit_time - * Time when the operation was submitted. - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Cloud\Translate\V3\TranslationService::initOnce(); - parent::__construct($data); - } - - /** - * The state of the operation. - * - * Generated from protobuf field .google.cloud.translation.v3.BatchTranslateMetadata.State state = 1; - * @return int - */ - public function getState() - { - return $this->state; - } - - /** - * The state of the operation. - * - * Generated from protobuf field .google.cloud.translation.v3.BatchTranslateMetadata.State state = 1; - * @param int $var - * @return $this - */ - public function setState($var) - { - GPBUtil::checkEnum($var, \Google\Cloud\Translate\V3\BatchTranslateMetadata\State::class); - $this->state = $var; - - return $this; - } - - /** - * Number of successfully translated characters so far (Unicode codepoints). - * - * Generated from protobuf field int64 translated_characters = 2; - * @return int|string - */ - public function getTranslatedCharacters() - { - return $this->translated_characters; - } - - /** - * Number of successfully translated characters so far (Unicode codepoints). - * - * Generated from protobuf field int64 translated_characters = 2; - * @param int|string $var - * @return $this - */ - public function setTranslatedCharacters($var) - { - GPBUtil::checkInt64($var); - $this->translated_characters = $var; - - return $this; - } - - /** - * Number of characters that have failed to process so far (Unicode - * codepoints). - * - * Generated from protobuf field int64 failed_characters = 3; - * @return int|string - */ - public function getFailedCharacters() - { - return $this->failed_characters; - } - - /** - * Number of characters that have failed to process so far (Unicode - * codepoints). - * - * Generated from protobuf field int64 failed_characters = 3; - * @param int|string $var - * @return $this - */ - public function setFailedCharacters($var) - { - GPBUtil::checkInt64($var); - $this->failed_characters = $var; - - return $this; - } - - /** - * Total number of characters (Unicode codepoints). - * This is the total number of codepoints from input files times the number of - * target languages and appears here shortly after the call is submitted. - * - * Generated from protobuf field int64 total_characters = 4; - * @return int|string - */ - public function getTotalCharacters() - { - return $this->total_characters; - } - - /** - * Total number of characters (Unicode codepoints). - * This is the total number of codepoints from input files times the number of - * target languages and appears here shortly after the call is submitted. - * - * Generated from protobuf field int64 total_characters = 4; - * @param int|string $var - * @return $this - */ - public function setTotalCharacters($var) - { - GPBUtil::checkInt64($var); - $this->total_characters = $var; - - return $this; - } - - /** - * Time when the operation was submitted. - * - * Generated from protobuf field .google.protobuf.Timestamp submit_time = 5; - * @return \Google\Protobuf\Timestamp|null - */ - public function getSubmitTime() - { - return $this->submit_time; - } - - public function hasSubmitTime() - { - return isset($this->submit_time); - } - - public function clearSubmitTime() - { - unset($this->submit_time); - } - - /** - * Time when the operation was submitted. - * - * Generated from protobuf field .google.protobuf.Timestamp submit_time = 5; - * @param \Google\Protobuf\Timestamp $var - * @return $this - */ - public function setSubmitTime($var) - { - GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); - $this->submit_time = $var; - - return $this; - } - -} - diff --git a/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/BatchTranslateMetadata/State.php b/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/BatchTranslateMetadata/State.php deleted file mode 100644 index 287dfff0389..00000000000 --- a/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/BatchTranslateMetadata/State.php +++ /dev/null @@ -1,89 +0,0 @@ -google.cloud.translation.v3.BatchTranslateMetadata.State - */ -class State -{ - /** - * Invalid. - * - * Generated from protobuf enum STATE_UNSPECIFIED = 0; - */ - const STATE_UNSPECIFIED = 0; - /** - * Request is being processed. - * - * Generated from protobuf enum RUNNING = 1; - */ - const RUNNING = 1; - /** - * The batch is processed, and at least one item was successfully - * processed. - * - * Generated from protobuf enum SUCCEEDED = 2; - */ - const SUCCEEDED = 2; - /** - * The batch is done and no item was successfully processed. - * - * Generated from protobuf enum FAILED = 3; - */ - const FAILED = 3; - /** - * Request is in the process of being canceled after caller invoked - * longrunning.Operations.CancelOperation on the request id. - * - * Generated from protobuf enum CANCELLING = 4; - */ - const CANCELLING = 4; - /** - * The batch is done after the user has called the - * longrunning.Operations.CancelOperation. Any records processed before the - * cancel command are output as specified in the request. - * - * Generated from protobuf enum CANCELLED = 5; - */ - const CANCELLED = 5; - - private static $valueToName = [ - self::STATE_UNSPECIFIED => 'STATE_UNSPECIFIED', - self::RUNNING => 'RUNNING', - self::SUCCEEDED => 'SUCCEEDED', - self::FAILED => 'FAILED', - self::CANCELLING => 'CANCELLING', - self::CANCELLED => 'CANCELLED', - ]; - - 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(State::class, \Google\Cloud\Translate\V3\BatchTranslateMetadata_State::class); - diff --git a/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/BatchTranslateMetadata_State.php b/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/BatchTranslateMetadata_State.php deleted file mode 100644 index 289662c9e38..00000000000 --- a/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/BatchTranslateMetadata_State.php +++ /dev/null @@ -1,16 +0,0 @@ -google.cloud.translation.v3.BatchTranslateResponse - */ -class BatchTranslateResponse extends \Google\Protobuf\Internal\Message -{ - /** - * Total number of characters (Unicode codepoints). - * - * Generated from protobuf field int64 total_characters = 1; - */ - protected $total_characters = 0; - /** - * Number of successfully translated characters (Unicode codepoints). - * - * Generated from protobuf field int64 translated_characters = 2; - */ - protected $translated_characters = 0; - /** - * Number of characters that have failed to process (Unicode codepoints). - * - * Generated from protobuf field int64 failed_characters = 3; - */ - protected $failed_characters = 0; - /** - * Time when the operation was submitted. - * - * Generated from protobuf field .google.protobuf.Timestamp submit_time = 4; - */ - protected $submit_time = null; - /** - * The time when the operation is finished and - * [google.longrunning.Operation.done][google.longrunning.Operation.done] is - * set to true. - * - * Generated from protobuf field .google.protobuf.Timestamp end_time = 5; - */ - protected $end_time = null; - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type int|string $total_characters - * Total number of characters (Unicode codepoints). - * @type int|string $translated_characters - * Number of successfully translated characters (Unicode codepoints). - * @type int|string $failed_characters - * Number of characters that have failed to process (Unicode codepoints). - * @type \Google\Protobuf\Timestamp $submit_time - * Time when the operation was submitted. - * @type \Google\Protobuf\Timestamp $end_time - * The time when the operation is finished and - * [google.longrunning.Operation.done][google.longrunning.Operation.done] is - * set to true. - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Cloud\Translate\V3\TranslationService::initOnce(); - parent::__construct($data); - } - - /** - * Total number of characters (Unicode codepoints). - * - * Generated from protobuf field int64 total_characters = 1; - * @return int|string - */ - public function getTotalCharacters() - { - return $this->total_characters; - } - - /** - * Total number of characters (Unicode codepoints). - * - * Generated from protobuf field int64 total_characters = 1; - * @param int|string $var - * @return $this - */ - public function setTotalCharacters($var) - { - GPBUtil::checkInt64($var); - $this->total_characters = $var; - - return $this; - } - - /** - * Number of successfully translated characters (Unicode codepoints). - * - * Generated from protobuf field int64 translated_characters = 2; - * @return int|string - */ - public function getTranslatedCharacters() - { - return $this->translated_characters; - } - - /** - * Number of successfully translated characters (Unicode codepoints). - * - * Generated from protobuf field int64 translated_characters = 2; - * @param int|string $var - * @return $this - */ - public function setTranslatedCharacters($var) - { - GPBUtil::checkInt64($var); - $this->translated_characters = $var; - - return $this; - } - - /** - * Number of characters that have failed to process (Unicode codepoints). - * - * Generated from protobuf field int64 failed_characters = 3; - * @return int|string - */ - public function getFailedCharacters() - { - return $this->failed_characters; - } - - /** - * Number of characters that have failed to process (Unicode codepoints). - * - * Generated from protobuf field int64 failed_characters = 3; - * @param int|string $var - * @return $this - */ - public function setFailedCharacters($var) - { - GPBUtil::checkInt64($var); - $this->failed_characters = $var; - - return $this; - } - - /** - * Time when the operation was submitted. - * - * Generated from protobuf field .google.protobuf.Timestamp submit_time = 4; - * @return \Google\Protobuf\Timestamp|null - */ - public function getSubmitTime() - { - return $this->submit_time; - } - - public function hasSubmitTime() - { - return isset($this->submit_time); - } - - public function clearSubmitTime() - { - unset($this->submit_time); - } - - /** - * Time when the operation was submitted. - * - * Generated from protobuf field .google.protobuf.Timestamp submit_time = 4; - * @param \Google\Protobuf\Timestamp $var - * @return $this - */ - public function setSubmitTime($var) - { - GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); - $this->submit_time = $var; - - return $this; - } - - /** - * The time when the operation is finished and - * [google.longrunning.Operation.done][google.longrunning.Operation.done] is - * set to true. - * - * Generated from protobuf field .google.protobuf.Timestamp end_time = 5; - * @return \Google\Protobuf\Timestamp|null - */ - public function getEndTime() - { - return $this->end_time; - } - - public function hasEndTime() - { - return isset($this->end_time); - } - - public function clearEndTime() - { - unset($this->end_time); - } - - /** - * The time when the operation is finished and - * [google.longrunning.Operation.done][google.longrunning.Operation.done] is - * set to true. - * - * Generated from protobuf field .google.protobuf.Timestamp end_time = 5; - * @param \Google\Protobuf\Timestamp $var - * @return $this - */ - public function setEndTime($var) - { - GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); - $this->end_time = $var; - - return $this; - } - -} - diff --git a/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/BatchTranslateTextRequest.php b/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/BatchTranslateTextRequest.php deleted file mode 100644 index 79d9d703113..00000000000 --- a/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/BatchTranslateTextRequest.php +++ /dev/null @@ -1,419 +0,0 @@ -google.cloud.translation.v3.BatchTranslateTextRequest - */ -class BatchTranslateTextRequest extends \Google\Protobuf\Internal\Message -{ - /** - * Required. Location to make a call. Must refer to a caller's project. - * Format: `projects/{project-number-or-id}/locations/{location-id}`. - * The `global` location is not supported for batch translation. - * Only AutoML Translation models or glossaries within the same region (have - * the same location-id) can be used, otherwise an INVALID_ARGUMENT (400) - * error is returned. - * - * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { - */ - protected $parent = ''; - /** - * Required. Source language code. - * - * Generated from protobuf field string source_language_code = 2 [(.google.api.field_behavior) = REQUIRED]; - */ - protected $source_language_code = ''; - /** - * Required. Specify up to 10 language codes here. - * - * Generated from protobuf field repeated string target_language_codes = 3 [(.google.api.field_behavior) = REQUIRED]; - */ - private $target_language_codes; - /** - * Optional. The models to use for translation. Map's key is target language - * code. Map's value is model name. Value can be a built-in general model, - * or an AutoML Translation model. - * The value format depends on model type: - * - AutoML Translation models: - * `projects/{project-number-or-id}/locations/{location-id}/models/{model-id}` - * - General (built-in) models: - * `projects/{project-number-or-id}/locations/{location-id}/models/general/nmt`, - * If the map is empty or a specific model is - * not requested for a language pair, then default google model (nmt) is used. - * - * Generated from protobuf field map models = 4 [(.google.api.field_behavior) = OPTIONAL]; - */ - private $models; - /** - * Required. Input configurations. - * The total number of files matched should be <= 100. - * The total content size should be <= 100M Unicode codepoints. - * The files must use UTF-8 encoding. - * - * Generated from protobuf field repeated .google.cloud.translation.v3.InputConfig input_configs = 5 [(.google.api.field_behavior) = REQUIRED]; - */ - private $input_configs; - /** - * Required. Output configuration. - * If 2 input configs match to the same file (that is, same input path), - * we don't generate output for duplicate inputs. - * - * Generated from protobuf field .google.cloud.translation.v3.OutputConfig output_config = 6 [(.google.api.field_behavior) = REQUIRED]; - */ - protected $output_config = null; - /** - * Optional. Glossaries to be applied for translation. - * It's keyed by target language code. - * - * Generated from protobuf field map glossaries = 7 [(.google.api.field_behavior) = OPTIONAL]; - */ - private $glossaries; - /** - * Optional. The labels with user-defined metadata for the request. - * Label keys and values can be no longer than 63 characters - * (Unicode codepoints), can only contain lowercase letters, numeric - * characters, underscores and dashes. International characters are allowed. - * Label values are optional. Label keys must start with a letter. - * See https://cloud.google.com/translate/docs/advanced/labels for more - * information. - * - * Generated from protobuf field map labels = 9 [(.google.api.field_behavior) = OPTIONAL]; - */ - private $labels; - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type string $parent - * Required. Location to make a call. Must refer to a caller's project. - * Format: `projects/{project-number-or-id}/locations/{location-id}`. - * The `global` location is not supported for batch translation. - * Only AutoML Translation models or glossaries within the same region (have - * the same location-id) can be used, otherwise an INVALID_ARGUMENT (400) - * error is returned. - * @type string $source_language_code - * Required. Source language code. - * @type array|\Google\Protobuf\Internal\RepeatedField $target_language_codes - * Required. Specify up to 10 language codes here. - * @type array|\Google\Protobuf\Internal\MapField $models - * Optional. The models to use for translation. Map's key is target language - * code. Map's value is model name. Value can be a built-in general model, - * or an AutoML Translation model. - * The value format depends on model type: - * - AutoML Translation models: - * `projects/{project-number-or-id}/locations/{location-id}/models/{model-id}` - * - General (built-in) models: - * `projects/{project-number-or-id}/locations/{location-id}/models/general/nmt`, - * If the map is empty or a specific model is - * not requested for a language pair, then default google model (nmt) is used. - * @type array<\Google\Cloud\Translate\V3\InputConfig>|\Google\Protobuf\Internal\RepeatedField $input_configs - * Required. Input configurations. - * The total number of files matched should be <= 100. - * The total content size should be <= 100M Unicode codepoints. - * The files must use UTF-8 encoding. - * @type \Google\Cloud\Translate\V3\OutputConfig $output_config - * Required. Output configuration. - * If 2 input configs match to the same file (that is, same input path), - * we don't generate output for duplicate inputs. - * @type array|\Google\Protobuf\Internal\MapField $glossaries - * Optional. Glossaries to be applied for translation. - * It's keyed by target language code. - * @type array|\Google\Protobuf\Internal\MapField $labels - * Optional. The labels with user-defined metadata for the request. - * Label keys and values can be no longer than 63 characters - * (Unicode codepoints), can only contain lowercase letters, numeric - * characters, underscores and dashes. International characters are allowed. - * Label values are optional. Label keys must start with a letter. - * See https://cloud.google.com/translate/docs/advanced/labels for more - * information. - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Cloud\Translate\V3\TranslationService::initOnce(); - parent::__construct($data); - } - - /** - * Required. Location to make a call. Must refer to a caller's project. - * Format: `projects/{project-number-or-id}/locations/{location-id}`. - * The `global` location is not supported for batch translation. - * Only AutoML Translation models or glossaries within the same region (have - * the same location-id) can be used, otherwise an INVALID_ARGUMENT (400) - * error is returned. - * - * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { - * @return string - */ - public function getParent() - { - return $this->parent; - } - - /** - * Required. Location to make a call. Must refer to a caller's project. - * Format: `projects/{project-number-or-id}/locations/{location-id}`. - * The `global` location is not supported for batch translation. - * Only AutoML Translation models or glossaries within the same region (have - * the same location-id) can be used, otherwise an INVALID_ARGUMENT (400) - * error is returned. - * - * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { - * @param string $var - * @return $this - */ - public function setParent($var) - { - GPBUtil::checkString($var, True); - $this->parent = $var; - - return $this; - } - - /** - * Required. Source language code. - * - * Generated from protobuf field string source_language_code = 2 [(.google.api.field_behavior) = REQUIRED]; - * @return string - */ - public function getSourceLanguageCode() - { - return $this->source_language_code; - } - - /** - * Required. Source language code. - * - * Generated from protobuf field string source_language_code = 2 [(.google.api.field_behavior) = REQUIRED]; - * @param string $var - * @return $this - */ - public function setSourceLanguageCode($var) - { - GPBUtil::checkString($var, True); - $this->source_language_code = $var; - - return $this; - } - - /** - * Required. Specify up to 10 language codes here. - * - * Generated from protobuf field repeated string target_language_codes = 3 [(.google.api.field_behavior) = REQUIRED]; - * @return \Google\Protobuf\Internal\RepeatedField - */ - public function getTargetLanguageCodes() - { - return $this->target_language_codes; - } - - /** - * Required. Specify up to 10 language codes here. - * - * Generated from protobuf field repeated string target_language_codes = 3 [(.google.api.field_behavior) = REQUIRED]; - * @param array|\Google\Protobuf\Internal\RepeatedField $var - * @return $this - */ - public function setTargetLanguageCodes($var) - { - $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); - $this->target_language_codes = $arr; - - return $this; - } - - /** - * Optional. The models to use for translation. Map's key is target language - * code. Map's value is model name. Value can be a built-in general model, - * or an AutoML Translation model. - * The value format depends on model type: - * - AutoML Translation models: - * `projects/{project-number-or-id}/locations/{location-id}/models/{model-id}` - * - General (built-in) models: - * `projects/{project-number-or-id}/locations/{location-id}/models/general/nmt`, - * If the map is empty or a specific model is - * not requested for a language pair, then default google model (nmt) is used. - * - * Generated from protobuf field map models = 4 [(.google.api.field_behavior) = OPTIONAL]; - * @return \Google\Protobuf\Internal\MapField - */ - public function getModels() - { - return $this->models; - } - - /** - * Optional. The models to use for translation. Map's key is target language - * code. Map's value is model name. Value can be a built-in general model, - * or an AutoML Translation model. - * The value format depends on model type: - * - AutoML Translation models: - * `projects/{project-number-or-id}/locations/{location-id}/models/{model-id}` - * - General (built-in) models: - * `projects/{project-number-or-id}/locations/{location-id}/models/general/nmt`, - * If the map is empty or a specific model is - * not requested for a language pair, then default google model (nmt) is used. - * - * Generated from protobuf field map models = 4 [(.google.api.field_behavior) = OPTIONAL]; - * @param array|\Google\Protobuf\Internal\MapField $var - * @return $this - */ - public function setModels($var) - { - $arr = GPBUtil::checkMapField($var, \Google\Protobuf\Internal\GPBType::STRING, \Google\Protobuf\Internal\GPBType::STRING); - $this->models = $arr; - - return $this; - } - - /** - * Required. Input configurations. - * The total number of files matched should be <= 100. - * The total content size should be <= 100M Unicode codepoints. - * The files must use UTF-8 encoding. - * - * Generated from protobuf field repeated .google.cloud.translation.v3.InputConfig input_configs = 5 [(.google.api.field_behavior) = REQUIRED]; - * @return \Google\Protobuf\Internal\RepeatedField - */ - public function getInputConfigs() - { - return $this->input_configs; - } - - /** - * Required. Input configurations. - * The total number of files matched should be <= 100. - * The total content size should be <= 100M Unicode codepoints. - * The files must use UTF-8 encoding. - * - * Generated from protobuf field repeated .google.cloud.translation.v3.InputConfig input_configs = 5 [(.google.api.field_behavior) = REQUIRED]; - * @param array<\Google\Cloud\Translate\V3\InputConfig>|\Google\Protobuf\Internal\RepeatedField $var - * @return $this - */ - public function setInputConfigs($var) - { - $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Translate\V3\InputConfig::class); - $this->input_configs = $arr; - - return $this; - } - - /** - * Required. Output configuration. - * If 2 input configs match to the same file (that is, same input path), - * we don't generate output for duplicate inputs. - * - * Generated from protobuf field .google.cloud.translation.v3.OutputConfig output_config = 6 [(.google.api.field_behavior) = REQUIRED]; - * @return \Google\Cloud\Translate\V3\OutputConfig|null - */ - public function getOutputConfig() - { - return $this->output_config; - } - - public function hasOutputConfig() - { - return isset($this->output_config); - } - - public function clearOutputConfig() - { - unset($this->output_config); - } - - /** - * Required. Output configuration. - * If 2 input configs match to the same file (that is, same input path), - * we don't generate output for duplicate inputs. - * - * Generated from protobuf field .google.cloud.translation.v3.OutputConfig output_config = 6 [(.google.api.field_behavior) = REQUIRED]; - * @param \Google\Cloud\Translate\V3\OutputConfig $var - * @return $this - */ - public function setOutputConfig($var) - { - GPBUtil::checkMessage($var, \Google\Cloud\Translate\V3\OutputConfig::class); - $this->output_config = $var; - - return $this; - } - - /** - * Optional. Glossaries to be applied for translation. - * It's keyed by target language code. - * - * Generated from protobuf field map glossaries = 7 [(.google.api.field_behavior) = OPTIONAL]; - * @return \Google\Protobuf\Internal\MapField - */ - public function getGlossaries() - { - return $this->glossaries; - } - - /** - * Optional. Glossaries to be applied for translation. - * It's keyed by target language code. - * - * Generated from protobuf field map glossaries = 7 [(.google.api.field_behavior) = OPTIONAL]; - * @param array|\Google\Protobuf\Internal\MapField $var - * @return $this - */ - public function setGlossaries($var) - { - $arr = GPBUtil::checkMapField($var, \Google\Protobuf\Internal\GPBType::STRING, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Translate\V3\TranslateTextGlossaryConfig::class); - $this->glossaries = $arr; - - return $this; - } - - /** - * Optional. The labels with user-defined metadata for the request. - * Label keys and values can be no longer than 63 characters - * (Unicode codepoints), can only contain lowercase letters, numeric - * characters, underscores and dashes. International characters are allowed. - * Label values are optional. Label keys must start with a letter. - * See https://cloud.google.com/translate/docs/advanced/labels for more - * information. - * - * Generated from protobuf field map labels = 9 [(.google.api.field_behavior) = OPTIONAL]; - * @return \Google\Protobuf\Internal\MapField - */ - public function getLabels() - { - return $this->labels; - } - - /** - * Optional. The labels with user-defined metadata for the request. - * Label keys and values can be no longer than 63 characters - * (Unicode codepoints), can only contain lowercase letters, numeric - * characters, underscores and dashes. International characters are allowed. - * Label values are optional. Label keys must start with a letter. - * See https://cloud.google.com/translate/docs/advanced/labels for more - * information. - * - * Generated from protobuf field map labels = 9 [(.google.api.field_behavior) = OPTIONAL]; - * @param array|\Google\Protobuf\Internal\MapField $var - * @return $this - */ - public function setLabels($var) - { - $arr = GPBUtil::checkMapField($var, \Google\Protobuf\Internal\GPBType::STRING, \Google\Protobuf\Internal\GPBType::STRING); - $this->labels = $arr; - - return $this; - } - -} - diff --git a/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/CreateGlossaryMetadata.php b/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/CreateGlossaryMetadata.php deleted file mode 100644 index cf902834a45..00000000000 --- a/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/CreateGlossaryMetadata.php +++ /dev/null @@ -1,147 +0,0 @@ -google.cloud.translation.v3.CreateGlossaryMetadata - */ -class CreateGlossaryMetadata extends \Google\Protobuf\Internal\Message -{ - /** - * The name of the glossary that is being created. - * - * Generated from protobuf field string name = 1; - */ - protected $name = ''; - /** - * The current state of the glossary creation operation. - * - * Generated from protobuf field .google.cloud.translation.v3.CreateGlossaryMetadata.State state = 2; - */ - protected $state = 0; - /** - * The time when the operation was submitted to the server. - * - * Generated from protobuf field .google.protobuf.Timestamp submit_time = 3; - */ - protected $submit_time = null; - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type string $name - * The name of the glossary that is being created. - * @type int $state - * The current state of the glossary creation operation. - * @type \Google\Protobuf\Timestamp $submit_time - * The time when the operation was submitted to the server. - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Cloud\Translate\V3\TranslationService::initOnce(); - parent::__construct($data); - } - - /** - * The name of the glossary that is being created. - * - * Generated from protobuf field string name = 1; - * @return string - */ - public function getName() - { - return $this->name; - } - - /** - * The name of the glossary that is being created. - * - * Generated from protobuf field string name = 1; - * @param string $var - * @return $this - */ - public function setName($var) - { - GPBUtil::checkString($var, True); - $this->name = $var; - - return $this; - } - - /** - * The current state of the glossary creation operation. - * - * Generated from protobuf field .google.cloud.translation.v3.CreateGlossaryMetadata.State state = 2; - * @return int - */ - public function getState() - { - return $this->state; - } - - /** - * The current state of the glossary creation operation. - * - * Generated from protobuf field .google.cloud.translation.v3.CreateGlossaryMetadata.State state = 2; - * @param int $var - * @return $this - */ - public function setState($var) - { - GPBUtil::checkEnum($var, \Google\Cloud\Translate\V3\CreateGlossaryMetadata\State::class); - $this->state = $var; - - return $this; - } - - /** - * The time when the operation was submitted to the server. - * - * Generated from protobuf field .google.protobuf.Timestamp submit_time = 3; - * @return \Google\Protobuf\Timestamp|null - */ - public function getSubmitTime() - { - return $this->submit_time; - } - - public function hasSubmitTime() - { - return isset($this->submit_time); - } - - public function clearSubmitTime() - { - unset($this->submit_time); - } - - /** - * The time when the operation was submitted to the server. - * - * Generated from protobuf field .google.protobuf.Timestamp submit_time = 3; - * @param \Google\Protobuf\Timestamp $var - * @return $this - */ - public function setSubmitTime($var) - { - GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); - $this->submit_time = $var; - - return $this; - } - -} - diff --git a/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/CreateGlossaryMetadata/State.php b/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/CreateGlossaryMetadata/State.php deleted file mode 100644 index 3aed3689d19..00000000000 --- a/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/CreateGlossaryMetadata/State.php +++ /dev/null @@ -1,86 +0,0 @@ -google.cloud.translation.v3.CreateGlossaryMetadata.State - */ -class State -{ - /** - * Invalid. - * - * Generated from protobuf enum STATE_UNSPECIFIED = 0; - */ - const STATE_UNSPECIFIED = 0; - /** - * Request is being processed. - * - * Generated from protobuf enum RUNNING = 1; - */ - const RUNNING = 1; - /** - * The glossary was successfully created. - * - * Generated from protobuf enum SUCCEEDED = 2; - */ - const SUCCEEDED = 2; - /** - * Failed to create the glossary. - * - * Generated from protobuf enum FAILED = 3; - */ - const FAILED = 3; - /** - * Request is in the process of being canceled after caller invoked - * longrunning.Operations.CancelOperation on the request id. - * - * Generated from protobuf enum CANCELLING = 4; - */ - const CANCELLING = 4; - /** - * The glossary creation request was successfully canceled. - * - * Generated from protobuf enum CANCELLED = 5; - */ - const CANCELLED = 5; - - private static $valueToName = [ - self::STATE_UNSPECIFIED => 'STATE_UNSPECIFIED', - self::RUNNING => 'RUNNING', - self::SUCCEEDED => 'SUCCEEDED', - self::FAILED => 'FAILED', - self::CANCELLING => 'CANCELLING', - self::CANCELLED => 'CANCELLED', - ]; - - 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(State::class, \Google\Cloud\Translate\V3\CreateGlossaryMetadata_State::class); - diff --git a/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/CreateGlossaryMetadata_State.php b/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/CreateGlossaryMetadata_State.php deleted file mode 100644 index e5428647f5e..00000000000 --- a/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/CreateGlossaryMetadata_State.php +++ /dev/null @@ -1,16 +0,0 @@ -google.cloud.translation.v3.CreateGlossaryRequest - */ -class CreateGlossaryRequest extends \Google\Protobuf\Internal\Message -{ - /** - * Required. The project name. - * - * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { - */ - protected $parent = ''; - /** - * Required. The glossary to create. - * - * Generated from protobuf field .google.cloud.translation.v3.Glossary glossary = 2 [(.google.api.field_behavior) = REQUIRED]; - */ - protected $glossary = null; - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type string $parent - * Required. The project name. - * @type \Google\Cloud\Translate\V3\Glossary $glossary - * Required. The glossary to create. - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Cloud\Translate\V3\TranslationService::initOnce(); - parent::__construct($data); - } - - /** - * Required. The project name. - * - * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { - * @return string - */ - public function getParent() - { - return $this->parent; - } - - /** - * Required. The project name. - * - * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { - * @param string $var - * @return $this - */ - public function setParent($var) - { - GPBUtil::checkString($var, True); - $this->parent = $var; - - return $this; - } - - /** - * Required. The glossary to create. - * - * Generated from protobuf field .google.cloud.translation.v3.Glossary glossary = 2 [(.google.api.field_behavior) = REQUIRED]; - * @return \Google\Cloud\Translate\V3\Glossary|null - */ - public function getGlossary() - { - return $this->glossary; - } - - public function hasGlossary() - { - return isset($this->glossary); - } - - public function clearGlossary() - { - unset($this->glossary); - } - - /** - * Required. The glossary to create. - * - * Generated from protobuf field .google.cloud.translation.v3.Glossary glossary = 2 [(.google.api.field_behavior) = REQUIRED]; - * @param \Google\Cloud\Translate\V3\Glossary $var - * @return $this - */ - public function setGlossary($var) - { - GPBUtil::checkMessage($var, \Google\Cloud\Translate\V3\Glossary::class); - $this->glossary = $var; - - return $this; - } - -} - diff --git a/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/DeleteGlossaryMetadata.php b/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/DeleteGlossaryMetadata.php deleted file mode 100644 index 4c4c6c924c2..00000000000 --- a/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/DeleteGlossaryMetadata.php +++ /dev/null @@ -1,147 +0,0 @@ -google.cloud.translation.v3.DeleteGlossaryMetadata - */ -class DeleteGlossaryMetadata extends \Google\Protobuf\Internal\Message -{ - /** - * The name of the glossary that is being deleted. - * - * Generated from protobuf field string name = 1; - */ - protected $name = ''; - /** - * The current state of the glossary deletion operation. - * - * Generated from protobuf field .google.cloud.translation.v3.DeleteGlossaryMetadata.State state = 2; - */ - protected $state = 0; - /** - * The time when the operation was submitted to the server. - * - * Generated from protobuf field .google.protobuf.Timestamp submit_time = 3; - */ - protected $submit_time = null; - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type string $name - * The name of the glossary that is being deleted. - * @type int $state - * The current state of the glossary deletion operation. - * @type \Google\Protobuf\Timestamp $submit_time - * The time when the operation was submitted to the server. - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Cloud\Translate\V3\TranslationService::initOnce(); - parent::__construct($data); - } - - /** - * The name of the glossary that is being deleted. - * - * Generated from protobuf field string name = 1; - * @return string - */ - public function getName() - { - return $this->name; - } - - /** - * The name of the glossary that is being deleted. - * - * Generated from protobuf field string name = 1; - * @param string $var - * @return $this - */ - public function setName($var) - { - GPBUtil::checkString($var, True); - $this->name = $var; - - return $this; - } - - /** - * The current state of the glossary deletion operation. - * - * Generated from protobuf field .google.cloud.translation.v3.DeleteGlossaryMetadata.State state = 2; - * @return int - */ - public function getState() - { - return $this->state; - } - - /** - * The current state of the glossary deletion operation. - * - * Generated from protobuf field .google.cloud.translation.v3.DeleteGlossaryMetadata.State state = 2; - * @param int $var - * @return $this - */ - public function setState($var) - { - GPBUtil::checkEnum($var, \Google\Cloud\Translate\V3\DeleteGlossaryMetadata\State::class); - $this->state = $var; - - return $this; - } - - /** - * The time when the operation was submitted to the server. - * - * Generated from protobuf field .google.protobuf.Timestamp submit_time = 3; - * @return \Google\Protobuf\Timestamp|null - */ - public function getSubmitTime() - { - return $this->submit_time; - } - - public function hasSubmitTime() - { - return isset($this->submit_time); - } - - public function clearSubmitTime() - { - unset($this->submit_time); - } - - /** - * The time when the operation was submitted to the server. - * - * Generated from protobuf field .google.protobuf.Timestamp submit_time = 3; - * @param \Google\Protobuf\Timestamp $var - * @return $this - */ - public function setSubmitTime($var) - { - GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); - $this->submit_time = $var; - - return $this; - } - -} - diff --git a/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/DeleteGlossaryMetadata/State.php b/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/DeleteGlossaryMetadata/State.php deleted file mode 100644 index 65fe6b5df28..00000000000 --- a/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/DeleteGlossaryMetadata/State.php +++ /dev/null @@ -1,86 +0,0 @@ -google.cloud.translation.v3.DeleteGlossaryMetadata.State - */ -class State -{ - /** - * Invalid. - * - * Generated from protobuf enum STATE_UNSPECIFIED = 0; - */ - const STATE_UNSPECIFIED = 0; - /** - * Request is being processed. - * - * Generated from protobuf enum RUNNING = 1; - */ - const RUNNING = 1; - /** - * The glossary was successfully deleted. - * - * Generated from protobuf enum SUCCEEDED = 2; - */ - const SUCCEEDED = 2; - /** - * Failed to delete the glossary. - * - * Generated from protobuf enum FAILED = 3; - */ - const FAILED = 3; - /** - * Request is in the process of being canceled after caller invoked - * longrunning.Operations.CancelOperation on the request id. - * - * Generated from protobuf enum CANCELLING = 4; - */ - const CANCELLING = 4; - /** - * The glossary deletion request was successfully canceled. - * - * Generated from protobuf enum CANCELLED = 5; - */ - const CANCELLED = 5; - - private static $valueToName = [ - self::STATE_UNSPECIFIED => 'STATE_UNSPECIFIED', - self::RUNNING => 'RUNNING', - self::SUCCEEDED => 'SUCCEEDED', - self::FAILED => 'FAILED', - self::CANCELLING => 'CANCELLING', - self::CANCELLED => 'CANCELLED', - ]; - - 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(State::class, \Google\Cloud\Translate\V3\DeleteGlossaryMetadata_State::class); - diff --git a/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/DeleteGlossaryMetadata_State.php b/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/DeleteGlossaryMetadata_State.php deleted file mode 100644 index 910836761d4..00000000000 --- a/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/DeleteGlossaryMetadata_State.php +++ /dev/null @@ -1,16 +0,0 @@ -google.cloud.translation.v3.DeleteGlossaryRequest - */ -class DeleteGlossaryRequest extends \Google\Protobuf\Internal\Message -{ - /** - * Required. The name of the glossary to delete. - * - * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { - */ - protected $name = ''; - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type string $name - * Required. The name of the glossary to delete. - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Cloud\Translate\V3\TranslationService::initOnce(); - parent::__construct($data); - } - - /** - * Required. The name of the glossary to delete. - * - * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { - * @return string - */ - public function getName() - { - return $this->name; - } - - /** - * Required. The name of the glossary to delete. - * - * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { - * @param string $var - * @return $this - */ - public function setName($var) - { - GPBUtil::checkString($var, True); - $this->name = $var; - - return $this; - } - -} - diff --git a/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/DeleteGlossaryResponse.php b/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/DeleteGlossaryResponse.php deleted file mode 100644 index d3bc457df68..00000000000 --- a/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/DeleteGlossaryResponse.php +++ /dev/null @@ -1,165 +0,0 @@ -google.cloud.translation.v3.DeleteGlossaryResponse - */ -class DeleteGlossaryResponse extends \Google\Protobuf\Internal\Message -{ - /** - * The name of the deleted glossary. - * - * Generated from protobuf field string name = 1; - */ - protected $name = ''; - /** - * The time when the operation was submitted to the server. - * - * Generated from protobuf field .google.protobuf.Timestamp submit_time = 2; - */ - protected $submit_time = null; - /** - * The time when the glossary deletion is finished and - * [google.longrunning.Operation.done][google.longrunning.Operation.done] is - * set to true. - * - * Generated from protobuf field .google.protobuf.Timestamp end_time = 3; - */ - protected $end_time = null; - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type string $name - * The name of the deleted glossary. - * @type \Google\Protobuf\Timestamp $submit_time - * The time when the operation was submitted to the server. - * @type \Google\Protobuf\Timestamp $end_time - * The time when the glossary deletion is finished and - * [google.longrunning.Operation.done][google.longrunning.Operation.done] is - * set to true. - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Cloud\Translate\V3\TranslationService::initOnce(); - parent::__construct($data); - } - - /** - * The name of the deleted glossary. - * - * Generated from protobuf field string name = 1; - * @return string - */ - public function getName() - { - return $this->name; - } - - /** - * The name of the deleted glossary. - * - * Generated from protobuf field string name = 1; - * @param string $var - * @return $this - */ - public function setName($var) - { - GPBUtil::checkString($var, True); - $this->name = $var; - - return $this; - } - - /** - * The time when the operation was submitted to the server. - * - * Generated from protobuf field .google.protobuf.Timestamp submit_time = 2; - * @return \Google\Protobuf\Timestamp|null - */ - public function getSubmitTime() - { - return $this->submit_time; - } - - public function hasSubmitTime() - { - return isset($this->submit_time); - } - - public function clearSubmitTime() - { - unset($this->submit_time); - } - - /** - * The time when the operation was submitted to the server. - * - * Generated from protobuf field .google.protobuf.Timestamp submit_time = 2; - * @param \Google\Protobuf\Timestamp $var - * @return $this - */ - public function setSubmitTime($var) - { - GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); - $this->submit_time = $var; - - return $this; - } - - /** - * The time when the glossary deletion is finished and - * [google.longrunning.Operation.done][google.longrunning.Operation.done] is - * set to true. - * - * Generated from protobuf field .google.protobuf.Timestamp end_time = 3; - * @return \Google\Protobuf\Timestamp|null - */ - public function getEndTime() - { - return $this->end_time; - } - - public function hasEndTime() - { - return isset($this->end_time); - } - - public function clearEndTime() - { - unset($this->end_time); - } - - /** - * The time when the glossary deletion is finished and - * [google.longrunning.Operation.done][google.longrunning.Operation.done] is - * set to true. - * - * Generated from protobuf field .google.protobuf.Timestamp end_time = 3; - * @param \Google\Protobuf\Timestamp $var - * @return $this - */ - public function setEndTime($var) - { - GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); - $this->end_time = $var; - - return $this; - } - -} - diff --git a/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/DetectLanguageRequest.php b/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/DetectLanguageRequest.php deleted file mode 100644 index ae97c57669c..00000000000 --- a/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/DetectLanguageRequest.php +++ /dev/null @@ -1,287 +0,0 @@ -google.cloud.translation.v3.DetectLanguageRequest - */ -class DetectLanguageRequest extends \Google\Protobuf\Internal\Message -{ - /** - * Required. Project or location to make a call. Must refer to a caller's - * project. - * Format: `projects/{project-number-or-id}/locations/{location-id}` or - * `projects/{project-number-or-id}`. - * For global calls, use `projects/{project-number-or-id}/locations/global` or - * `projects/{project-number-or-id}`. - * Only models within the same region (has same location-id) can be used. - * Otherwise an INVALID_ARGUMENT (400) error is returned. - * - * Generated from protobuf field string parent = 5 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { - */ - protected $parent = ''; - /** - * Optional. The language detection model to be used. - * Format: - * `projects/{project-number-or-id}/locations/{location-id}/models/language-detection/{model-id}` - * Only one language detection model is currently supported: - * `projects/{project-number-or-id}/locations/{location-id}/models/language-detection/default`. - * If not specified, the default model is used. - * - * Generated from protobuf field string model = 4 [(.google.api.field_behavior) = OPTIONAL]; - */ - protected $model = ''; - /** - * Optional. The format of the source text, for example, "text/html", - * "text/plain". If left blank, the MIME type defaults to "text/html". - * - * Generated from protobuf field string mime_type = 3 [(.google.api.field_behavior) = OPTIONAL]; - */ - protected $mime_type = ''; - /** - * Optional. The labels with user-defined metadata for the request. - * Label keys and values can be no longer than 63 characters - * (Unicode codepoints), can only contain lowercase letters, numeric - * characters, underscores and dashes. International characters are allowed. - * Label values are optional. Label keys must start with a letter. - * See https://cloud.google.com/translate/docs/advanced/labels for more - * information. - * - * Generated from protobuf field map labels = 6 [(.google.api.field_behavior) = OPTIONAL]; - */ - private $labels; - protected $source; - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type string $parent - * Required. Project or location to make a call. Must refer to a caller's - * project. - * Format: `projects/{project-number-or-id}/locations/{location-id}` or - * `projects/{project-number-or-id}`. - * For global calls, use `projects/{project-number-or-id}/locations/global` or - * `projects/{project-number-or-id}`. - * Only models within the same region (has same location-id) can be used. - * Otherwise an INVALID_ARGUMENT (400) error is returned. - * @type string $model - * Optional. The language detection model to be used. - * Format: - * `projects/{project-number-or-id}/locations/{location-id}/models/language-detection/{model-id}` - * Only one language detection model is currently supported: - * `projects/{project-number-or-id}/locations/{location-id}/models/language-detection/default`. - * If not specified, the default model is used. - * @type string $content - * The content of the input stored as a string. - * @type string $mime_type - * Optional. The format of the source text, for example, "text/html", - * "text/plain". If left blank, the MIME type defaults to "text/html". - * @type array|\Google\Protobuf\Internal\MapField $labels - * Optional. The labels with user-defined metadata for the request. - * Label keys and values can be no longer than 63 characters - * (Unicode codepoints), can only contain lowercase letters, numeric - * characters, underscores and dashes. International characters are allowed. - * Label values are optional. Label keys must start with a letter. - * See https://cloud.google.com/translate/docs/advanced/labels for more - * information. - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Cloud\Translate\V3\TranslationService::initOnce(); - parent::__construct($data); - } - - /** - * Required. Project or location to make a call. Must refer to a caller's - * project. - * Format: `projects/{project-number-or-id}/locations/{location-id}` or - * `projects/{project-number-or-id}`. - * For global calls, use `projects/{project-number-or-id}/locations/global` or - * `projects/{project-number-or-id}`. - * Only models within the same region (has same location-id) can be used. - * Otherwise an INVALID_ARGUMENT (400) error is returned. - * - * Generated from protobuf field string parent = 5 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { - * @return string - */ - public function getParent() - { - return $this->parent; - } - - /** - * Required. Project or location to make a call. Must refer to a caller's - * project. - * Format: `projects/{project-number-or-id}/locations/{location-id}` or - * `projects/{project-number-or-id}`. - * For global calls, use `projects/{project-number-or-id}/locations/global` or - * `projects/{project-number-or-id}`. - * Only models within the same region (has same location-id) can be used. - * Otherwise an INVALID_ARGUMENT (400) error is returned. - * - * Generated from protobuf field string parent = 5 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { - * @param string $var - * @return $this - */ - public function setParent($var) - { - GPBUtil::checkString($var, True); - $this->parent = $var; - - return $this; - } - - /** - * Optional. The language detection model to be used. - * Format: - * `projects/{project-number-or-id}/locations/{location-id}/models/language-detection/{model-id}` - * Only one language detection model is currently supported: - * `projects/{project-number-or-id}/locations/{location-id}/models/language-detection/default`. - * If not specified, the default model is used. - * - * Generated from protobuf field string model = 4 [(.google.api.field_behavior) = OPTIONAL]; - * @return string - */ - public function getModel() - { - return $this->model; - } - - /** - * Optional. The language detection model to be used. - * Format: - * `projects/{project-number-or-id}/locations/{location-id}/models/language-detection/{model-id}` - * Only one language detection model is currently supported: - * `projects/{project-number-or-id}/locations/{location-id}/models/language-detection/default`. - * If not specified, the default model is used. - * - * Generated from protobuf field string model = 4 [(.google.api.field_behavior) = OPTIONAL]; - * @param string $var - * @return $this - */ - public function setModel($var) - { - GPBUtil::checkString($var, True); - $this->model = $var; - - return $this; - } - - /** - * The content of the input stored as a string. - * - * Generated from protobuf field string content = 1; - * @return string - */ - public function getContent() - { - return $this->readOneof(1); - } - - public function hasContent() - { - return $this->hasOneof(1); - } - - /** - * The content of the input stored as a string. - * - * Generated from protobuf field string content = 1; - * @param string $var - * @return $this - */ - public function setContent($var) - { - GPBUtil::checkString($var, True); - $this->writeOneof(1, $var); - - return $this; - } - - /** - * Optional. The format of the source text, for example, "text/html", - * "text/plain". If left blank, the MIME type defaults to "text/html". - * - * Generated from protobuf field string mime_type = 3 [(.google.api.field_behavior) = OPTIONAL]; - * @return string - */ - public function getMimeType() - { - return $this->mime_type; - } - - /** - * Optional. The format of the source text, for example, "text/html", - * "text/plain". If left blank, the MIME type defaults to "text/html". - * - * Generated from protobuf field string mime_type = 3 [(.google.api.field_behavior) = OPTIONAL]; - * @param string $var - * @return $this - */ - public function setMimeType($var) - { - GPBUtil::checkString($var, True); - $this->mime_type = $var; - - return $this; - } - - /** - * Optional. The labels with user-defined metadata for the request. - * Label keys and values can be no longer than 63 characters - * (Unicode codepoints), can only contain lowercase letters, numeric - * characters, underscores and dashes. International characters are allowed. - * Label values are optional. Label keys must start with a letter. - * See https://cloud.google.com/translate/docs/advanced/labels for more - * information. - * - * Generated from protobuf field map labels = 6 [(.google.api.field_behavior) = OPTIONAL]; - * @return \Google\Protobuf\Internal\MapField - */ - public function getLabels() - { - return $this->labels; - } - - /** - * Optional. The labels with user-defined metadata for the request. - * Label keys and values can be no longer than 63 characters - * (Unicode codepoints), can only contain lowercase letters, numeric - * characters, underscores and dashes. International characters are allowed. - * Label values are optional. Label keys must start with a letter. - * See https://cloud.google.com/translate/docs/advanced/labels for more - * information. - * - * Generated from protobuf field map labels = 6 [(.google.api.field_behavior) = OPTIONAL]; - * @param array|\Google\Protobuf\Internal\MapField $var - * @return $this - */ - public function setLabels($var) - { - $arr = GPBUtil::checkMapField($var, \Google\Protobuf\Internal\GPBType::STRING, \Google\Protobuf\Internal\GPBType::STRING); - $this->labels = $arr; - - return $this; - } - - /** - * @return string - */ - public function getSource() - { - return $this->whichOneof("source"); - } - -} - diff --git a/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/DetectLanguageResponse.php b/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/DetectLanguageResponse.php deleted file mode 100644 index 7bcf6ef7f39..00000000000 --- a/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/DetectLanguageResponse.php +++ /dev/null @@ -1,71 +0,0 @@ -google.cloud.translation.v3.DetectLanguageResponse - */ -class DetectLanguageResponse extends \Google\Protobuf\Internal\Message -{ - /** - * The most probable language detected by the Translation API. For each - * request, the Translation API will always return only one result. - * - * Generated from protobuf field repeated .google.cloud.translation.v3.DetectedLanguage languages = 1; - */ - private $languages; - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type array<\Google\Cloud\Translate\V3\DetectedLanguage>|\Google\Protobuf\Internal\RepeatedField $languages - * The most probable language detected by the Translation API. For each - * request, the Translation API will always return only one result. - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Cloud\Translate\V3\TranslationService::initOnce(); - parent::__construct($data); - } - - /** - * The most probable language detected by the Translation API. For each - * request, the Translation API will always return only one result. - * - * Generated from protobuf field repeated .google.cloud.translation.v3.DetectedLanguage languages = 1; - * @return \Google\Protobuf\Internal\RepeatedField - */ - public function getLanguages() - { - return $this->languages; - } - - /** - * The most probable language detected by the Translation API. For each - * request, the Translation API will always return only one result. - * - * Generated from protobuf field repeated .google.cloud.translation.v3.DetectedLanguage languages = 1; - * @param array<\Google\Cloud\Translate\V3\DetectedLanguage>|\Google\Protobuf\Internal\RepeatedField $var - * @return $this - */ - public function setLanguages($var) - { - $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Translate\V3\DetectedLanguage::class); - $this->languages = $arr; - - return $this; - } - -} - diff --git a/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/DetectedLanguage.php b/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/DetectedLanguage.php deleted file mode 100644 index b0e30fd6ed8..00000000000 --- a/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/DetectedLanguage.php +++ /dev/null @@ -1,105 +0,0 @@ -google.cloud.translation.v3.DetectedLanguage - */ -class DetectedLanguage extends \Google\Protobuf\Internal\Message -{ - /** - * The ISO-639 language code of the source content in the request, detected - * automatically. - * - * Generated from protobuf field string language_code = 1; - */ - protected $language_code = ''; - /** - * The confidence of the detection result for this language. - * - * Generated from protobuf field float confidence = 2; - */ - protected $confidence = 0.0; - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type string $language_code - * The ISO-639 language code of the source content in the request, detected - * automatically. - * @type float $confidence - * The confidence of the detection result for this language. - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Cloud\Translate\V3\TranslationService::initOnce(); - parent::__construct($data); - } - - /** - * The ISO-639 language code of the source content in the request, detected - * automatically. - * - * Generated from protobuf field string language_code = 1; - * @return string - */ - public function getLanguageCode() - { - return $this->language_code; - } - - /** - * The ISO-639 language code of the source content in the request, detected - * automatically. - * - * Generated from protobuf field string language_code = 1; - * @param string $var - * @return $this - */ - public function setLanguageCode($var) - { - GPBUtil::checkString($var, True); - $this->language_code = $var; - - return $this; - } - - /** - * The confidence of the detection result for this language. - * - * Generated from protobuf field float confidence = 2; - * @return float - */ - public function getConfidence() - { - return $this->confidence; - } - - /** - * The confidence of the detection result for this language. - * - * Generated from protobuf field float confidence = 2; - * @param float $var - * @return $this - */ - public function setConfidence($var) - { - GPBUtil::checkFloat($var); - $this->confidence = $var; - - return $this; - } - -} - diff --git a/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/DocumentInputConfig.php b/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/DocumentInputConfig.php deleted file mode 100644 index 2285639ebfc..00000000000 --- a/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/DocumentInputConfig.php +++ /dev/null @@ -1,177 +0,0 @@ -google.cloud.translation.v3.DocumentInputConfig - */ -class DocumentInputConfig extends \Google\Protobuf\Internal\Message -{ - /** - * Specifies the input document's mime_type. - * If not specified it will be determined using the file extension for - * gcs_source provided files. For a file provided through bytes content the - * mime_type must be provided. - * Currently supported mime types are: - * - application/pdf - * - application/vnd.openxmlformats-officedocument.wordprocessingml.document - * - application/vnd.openxmlformats-officedocument.presentationml.presentation - * - application/vnd.openxmlformats-officedocument.spreadsheetml.sheet - * - * Generated from protobuf field string mime_type = 4; - */ - protected $mime_type = ''; - protected $source; - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type string $content - * Document's content represented as a stream of bytes. - * @type \Google\Cloud\Translate\V3\GcsSource $gcs_source - * Google Cloud Storage location. This must be a single file. - * For example: gs://example_bucket/example_file.pdf - * @type string $mime_type - * Specifies the input document's mime_type. - * If not specified it will be determined using the file extension for - * gcs_source provided files. For a file provided through bytes content the - * mime_type must be provided. - * Currently supported mime types are: - * - application/pdf - * - application/vnd.openxmlformats-officedocument.wordprocessingml.document - * - application/vnd.openxmlformats-officedocument.presentationml.presentation - * - application/vnd.openxmlformats-officedocument.spreadsheetml.sheet - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Cloud\Translate\V3\TranslationService::initOnce(); - parent::__construct($data); - } - - /** - * Document's content represented as a stream of bytes. - * - * Generated from protobuf field bytes content = 1; - * @return string - */ - public function getContent() - { - return $this->readOneof(1); - } - - public function hasContent() - { - return $this->hasOneof(1); - } - - /** - * Document's content represented as a stream of bytes. - * - * Generated from protobuf field bytes content = 1; - * @param string $var - * @return $this - */ - public function setContent($var) - { - GPBUtil::checkString($var, False); - $this->writeOneof(1, $var); - - return $this; - } - - /** - * Google Cloud Storage location. This must be a single file. - * For example: gs://example_bucket/example_file.pdf - * - * Generated from protobuf field .google.cloud.translation.v3.GcsSource gcs_source = 2; - * @return \Google\Cloud\Translate\V3\GcsSource|null - */ - public function getGcsSource() - { - return $this->readOneof(2); - } - - public function hasGcsSource() - { - return $this->hasOneof(2); - } - - /** - * Google Cloud Storage location. This must be a single file. - * For example: gs://example_bucket/example_file.pdf - * - * Generated from protobuf field .google.cloud.translation.v3.GcsSource gcs_source = 2; - * @param \Google\Cloud\Translate\V3\GcsSource $var - * @return $this - */ - public function setGcsSource($var) - { - GPBUtil::checkMessage($var, \Google\Cloud\Translate\V3\GcsSource::class); - $this->writeOneof(2, $var); - - return $this; - } - - /** - * Specifies the input document's mime_type. - * If not specified it will be determined using the file extension for - * gcs_source provided files. For a file provided through bytes content the - * mime_type must be provided. - * Currently supported mime types are: - * - application/pdf - * - application/vnd.openxmlformats-officedocument.wordprocessingml.document - * - application/vnd.openxmlformats-officedocument.presentationml.presentation - * - application/vnd.openxmlformats-officedocument.spreadsheetml.sheet - * - * Generated from protobuf field string mime_type = 4; - * @return string - */ - public function getMimeType() - { - return $this->mime_type; - } - - /** - * Specifies the input document's mime_type. - * If not specified it will be determined using the file extension for - * gcs_source provided files. For a file provided through bytes content the - * mime_type must be provided. - * Currently supported mime types are: - * - application/pdf - * - application/vnd.openxmlformats-officedocument.wordprocessingml.document - * - application/vnd.openxmlformats-officedocument.presentationml.presentation - * - application/vnd.openxmlformats-officedocument.spreadsheetml.sheet - * - * Generated from protobuf field string mime_type = 4; - * @param string $var - * @return $this - */ - public function setMimeType($var) - { - GPBUtil::checkString($var, True); - $this->mime_type = $var; - - return $this; - } - - /** - * @return string - */ - public function getSource() - { - return $this->whichOneof("source"); - } - -} - diff --git a/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/DocumentOutputConfig.php b/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/DocumentOutputConfig.php deleted file mode 100644 index a5327ff872a..00000000000 --- a/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/DocumentOutputConfig.php +++ /dev/null @@ -1,240 +0,0 @@ -google.cloud.translation.v3.DocumentOutputConfig - */ -class DocumentOutputConfig extends \Google\Protobuf\Internal\Message -{ - /** - * Optional. Specifies the translated document's mime_type. - * If not specified, the translated file's mime type will be the same as the - * input file's mime type. - * Currently only support the output mime type to be the same as input mime - * type. - * - application/pdf - * - application/vnd.openxmlformats-officedocument.wordprocessingml.document - * - application/vnd.openxmlformats-officedocument.presentationml.presentation - * - application/vnd.openxmlformats-officedocument.spreadsheetml.sheet - * - * Generated from protobuf field string mime_type = 3 [(.google.api.field_behavior) = OPTIONAL]; - */ - protected $mime_type = ''; - protected $destination; - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type \Google\Cloud\Translate\V3\GcsDestination $gcs_destination - * Optional. Google Cloud Storage destination for the translation output, - * e.g., `gs://my_bucket/my_directory/`. - * The destination directory provided does not have to be empty, but the - * bucket must exist. If a file with the same name as the output file - * already exists in the destination an error will be returned. - * For a DocumentInputConfig.contents provided document, the output file - * will have the name "output_[trg]_translations.[ext]", where - * - [trg] corresponds to the translated file's language code, - * - [ext] corresponds to the translated file's extension according to its - * mime type. - * For a DocumentInputConfig.gcs_uri provided document, the output file will - * have a name according to its URI. For example: an input file with URI: - * "gs://a/b/c.[extension]" stored in a gcs_destination bucket with name - * "my_bucket" will have an output URI: - * "gs://my_bucket/a_b_c_[trg]_translations.[ext]", where - * - [trg] corresponds to the translated file's language code, - * - [ext] corresponds to the translated file's extension according to its - * mime type. - * If the document was directly provided through the request, then the - * output document will have the format: - * "gs://my_bucket/translated_document_[trg]_translations.[ext], where - * - [trg] corresponds to the translated file's language code, - * - [ext] corresponds to the translated file's extension according to its - * mime type. - * If a glossary was provided, then the output URI for the glossary - * translation will be equal to the default output URI but have - * `glossary_translations` instead of `translations`. For the previous - * example, its glossary URI would be: - * "gs://my_bucket/a_b_c_[trg]_glossary_translations.[ext]". - * Thus the max number of output files will be 2 (Translated document, - * Glossary translated document). - * Callers should expect no partial outputs. If there is any error during - * document translation, no output will be stored in the Cloud Storage - * bucket. - * @type string $mime_type - * Optional. Specifies the translated document's mime_type. - * If not specified, the translated file's mime type will be the same as the - * input file's mime type. - * Currently only support the output mime type to be the same as input mime - * type. - * - application/pdf - * - application/vnd.openxmlformats-officedocument.wordprocessingml.document - * - application/vnd.openxmlformats-officedocument.presentationml.presentation - * - application/vnd.openxmlformats-officedocument.spreadsheetml.sheet - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Cloud\Translate\V3\TranslationService::initOnce(); - parent::__construct($data); - } - - /** - * Optional. Google Cloud Storage destination for the translation output, - * e.g., `gs://my_bucket/my_directory/`. - * The destination directory provided does not have to be empty, but the - * bucket must exist. If a file with the same name as the output file - * already exists in the destination an error will be returned. - * For a DocumentInputConfig.contents provided document, the output file - * will have the name "output_[trg]_translations.[ext]", where - * - [trg] corresponds to the translated file's language code, - * - [ext] corresponds to the translated file's extension according to its - * mime type. - * For a DocumentInputConfig.gcs_uri provided document, the output file will - * have a name according to its URI. For example: an input file with URI: - * "gs://a/b/c.[extension]" stored in a gcs_destination bucket with name - * "my_bucket" will have an output URI: - * "gs://my_bucket/a_b_c_[trg]_translations.[ext]", where - * - [trg] corresponds to the translated file's language code, - * - [ext] corresponds to the translated file's extension according to its - * mime type. - * If the document was directly provided through the request, then the - * output document will have the format: - * "gs://my_bucket/translated_document_[trg]_translations.[ext], where - * - [trg] corresponds to the translated file's language code, - * - [ext] corresponds to the translated file's extension according to its - * mime type. - * If a glossary was provided, then the output URI for the glossary - * translation will be equal to the default output URI but have - * `glossary_translations` instead of `translations`. For the previous - * example, its glossary URI would be: - * "gs://my_bucket/a_b_c_[trg]_glossary_translations.[ext]". - * Thus the max number of output files will be 2 (Translated document, - * Glossary translated document). - * Callers should expect no partial outputs. If there is any error during - * document translation, no output will be stored in the Cloud Storage - * bucket. - * - * Generated from protobuf field .google.cloud.translation.v3.GcsDestination gcs_destination = 1 [(.google.api.field_behavior) = OPTIONAL]; - * @return \Google\Cloud\Translate\V3\GcsDestination|null - */ - public function getGcsDestination() - { - return $this->readOneof(1); - } - - public function hasGcsDestination() - { - return $this->hasOneof(1); - } - - /** - * Optional. Google Cloud Storage destination for the translation output, - * e.g., `gs://my_bucket/my_directory/`. - * The destination directory provided does not have to be empty, but the - * bucket must exist. If a file with the same name as the output file - * already exists in the destination an error will be returned. - * For a DocumentInputConfig.contents provided document, the output file - * will have the name "output_[trg]_translations.[ext]", where - * - [trg] corresponds to the translated file's language code, - * - [ext] corresponds to the translated file's extension according to its - * mime type. - * For a DocumentInputConfig.gcs_uri provided document, the output file will - * have a name according to its URI. For example: an input file with URI: - * "gs://a/b/c.[extension]" stored in a gcs_destination bucket with name - * "my_bucket" will have an output URI: - * "gs://my_bucket/a_b_c_[trg]_translations.[ext]", where - * - [trg] corresponds to the translated file's language code, - * - [ext] corresponds to the translated file's extension according to its - * mime type. - * If the document was directly provided through the request, then the - * output document will have the format: - * "gs://my_bucket/translated_document_[trg]_translations.[ext], where - * - [trg] corresponds to the translated file's language code, - * - [ext] corresponds to the translated file's extension according to its - * mime type. - * If a glossary was provided, then the output URI for the glossary - * translation will be equal to the default output URI but have - * `glossary_translations` instead of `translations`. For the previous - * example, its glossary URI would be: - * "gs://my_bucket/a_b_c_[trg]_glossary_translations.[ext]". - * Thus the max number of output files will be 2 (Translated document, - * Glossary translated document). - * Callers should expect no partial outputs. If there is any error during - * document translation, no output will be stored in the Cloud Storage - * bucket. - * - * Generated from protobuf field .google.cloud.translation.v3.GcsDestination gcs_destination = 1 [(.google.api.field_behavior) = OPTIONAL]; - * @param \Google\Cloud\Translate\V3\GcsDestination $var - * @return $this - */ - public function setGcsDestination($var) - { - GPBUtil::checkMessage($var, \Google\Cloud\Translate\V3\GcsDestination::class); - $this->writeOneof(1, $var); - - return $this; - } - - /** - * Optional. Specifies the translated document's mime_type. - * If not specified, the translated file's mime type will be the same as the - * input file's mime type. - * Currently only support the output mime type to be the same as input mime - * type. - * - application/pdf - * - application/vnd.openxmlformats-officedocument.wordprocessingml.document - * - application/vnd.openxmlformats-officedocument.presentationml.presentation - * - application/vnd.openxmlformats-officedocument.spreadsheetml.sheet - * - * Generated from protobuf field string mime_type = 3 [(.google.api.field_behavior) = OPTIONAL]; - * @return string - */ - public function getMimeType() - { - return $this->mime_type; - } - - /** - * Optional. Specifies the translated document's mime_type. - * If not specified, the translated file's mime type will be the same as the - * input file's mime type. - * Currently only support the output mime type to be the same as input mime - * type. - * - application/pdf - * - application/vnd.openxmlformats-officedocument.wordprocessingml.document - * - application/vnd.openxmlformats-officedocument.presentationml.presentation - * - application/vnd.openxmlformats-officedocument.spreadsheetml.sheet - * - * Generated from protobuf field string mime_type = 3 [(.google.api.field_behavior) = OPTIONAL]; - * @param string $var - * @return $this - */ - public function setMimeType($var) - { - GPBUtil::checkString($var, True); - $this->mime_type = $var; - - return $this; - } - - /** - * @return string - */ - public function getDestination() - { - return $this->whichOneof("destination"); - } - -} - diff --git a/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/DocumentTranslation.php b/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/DocumentTranslation.php deleted file mode 100644 index a03fe5adad2..00000000000 --- a/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/DocumentTranslation.php +++ /dev/null @@ -1,159 +0,0 @@ -google.cloud.translation.v3.DocumentTranslation - */ -class DocumentTranslation extends \Google\Protobuf\Internal\Message -{ - /** - * The array of translated documents. It is expected to be size 1 for now. We - * may produce multiple translated documents in the future for other type of - * file formats. - * - * Generated from protobuf field repeated bytes byte_stream_outputs = 1; - */ - private $byte_stream_outputs; - /** - * The translated document's mime type. - * - * Generated from protobuf field string mime_type = 2; - */ - protected $mime_type = ''; - /** - * The detected language for the input document. - * If the user did not provide the source language for the input document, - * this field will have the language code automatically detected. If the - * source language was passed, auto-detection of the language does not occur - * and this field is empty. - * - * Generated from protobuf field string detected_language_code = 3; - */ - protected $detected_language_code = ''; - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type array|\Google\Protobuf\Internal\RepeatedField $byte_stream_outputs - * The array of translated documents. It is expected to be size 1 for now. We - * may produce multiple translated documents in the future for other type of - * file formats. - * @type string $mime_type - * The translated document's mime type. - * @type string $detected_language_code - * The detected language for the input document. - * If the user did not provide the source language for the input document, - * this field will have the language code automatically detected. If the - * source language was passed, auto-detection of the language does not occur - * and this field is empty. - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Cloud\Translate\V3\TranslationService::initOnce(); - parent::__construct($data); - } - - /** - * The array of translated documents. It is expected to be size 1 for now. We - * may produce multiple translated documents in the future for other type of - * file formats. - * - * Generated from protobuf field repeated bytes byte_stream_outputs = 1; - * @return \Google\Protobuf\Internal\RepeatedField - */ - public function getByteStreamOutputs() - { - return $this->byte_stream_outputs; - } - - /** - * The array of translated documents. It is expected to be size 1 for now. We - * may produce multiple translated documents in the future for other type of - * file formats. - * - * Generated from protobuf field repeated bytes byte_stream_outputs = 1; - * @param array|\Google\Protobuf\Internal\RepeatedField $var - * @return $this - */ - public function setByteStreamOutputs($var) - { - $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::BYTES); - $this->byte_stream_outputs = $arr; - - return $this; - } - - /** - * The translated document's mime type. - * - * Generated from protobuf field string mime_type = 2; - * @return string - */ - public function getMimeType() - { - return $this->mime_type; - } - - /** - * The translated document's mime type. - * - * Generated from protobuf field string mime_type = 2; - * @param string $var - * @return $this - */ - public function setMimeType($var) - { - GPBUtil::checkString($var, True); - $this->mime_type = $var; - - return $this; - } - - /** - * The detected language for the input document. - * If the user did not provide the source language for the input document, - * this field will have the language code automatically detected. If the - * source language was passed, auto-detection of the language does not occur - * and this field is empty. - * - * Generated from protobuf field string detected_language_code = 3; - * @return string - */ - public function getDetectedLanguageCode() - { - return $this->detected_language_code; - } - - /** - * The detected language for the input document. - * If the user did not provide the source language for the input document, - * this field will have the language code automatically detected. If the - * source language was passed, auto-detection of the language does not occur - * and this field is empty. - * - * Generated from protobuf field string detected_language_code = 3; - * @param string $var - * @return $this - */ - public function setDetectedLanguageCode($var) - { - GPBUtil::checkString($var, True); - $this->detected_language_code = $var; - - return $this; - } - -} - diff --git a/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/GcsDestination.php b/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/GcsDestination.php deleted file mode 100644 index 6294ede95c7..00000000000 --- a/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/GcsDestination.php +++ /dev/null @@ -1,83 +0,0 @@ -google.cloud.translation.v3.GcsDestination - */ -class GcsDestination extends \Google\Protobuf\Internal\Message -{ - /** - * Required. The bucket used in 'output_uri_prefix' must exist and there must - * be no files under 'output_uri_prefix'. 'output_uri_prefix' must end with - * "/" and start with "gs://". One 'output_uri_prefix' can only be used by one - * batch translation job at a time. Otherwise an INVALID_ARGUMENT (400) error - * is returned. - * - * Generated from protobuf field string output_uri_prefix = 1 [(.google.api.field_behavior) = REQUIRED]; - */ - protected $output_uri_prefix = ''; - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type string $output_uri_prefix - * Required. The bucket used in 'output_uri_prefix' must exist and there must - * be no files under 'output_uri_prefix'. 'output_uri_prefix' must end with - * "/" and start with "gs://". One 'output_uri_prefix' can only be used by one - * batch translation job at a time. Otherwise an INVALID_ARGUMENT (400) error - * is returned. - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Cloud\Translate\V3\TranslationService::initOnce(); - parent::__construct($data); - } - - /** - * Required. The bucket used in 'output_uri_prefix' must exist and there must - * be no files under 'output_uri_prefix'. 'output_uri_prefix' must end with - * "/" and start with "gs://". One 'output_uri_prefix' can only be used by one - * batch translation job at a time. Otherwise an INVALID_ARGUMENT (400) error - * is returned. - * - * Generated from protobuf field string output_uri_prefix = 1 [(.google.api.field_behavior) = REQUIRED]; - * @return string - */ - public function getOutputUriPrefix() - { - return $this->output_uri_prefix; - } - - /** - * Required. The bucket used in 'output_uri_prefix' must exist and there must - * be no files under 'output_uri_prefix'. 'output_uri_prefix' must end with - * "/" and start with "gs://". One 'output_uri_prefix' can only be used by one - * batch translation job at a time. Otherwise an INVALID_ARGUMENT (400) error - * is returned. - * - * Generated from protobuf field string output_uri_prefix = 1 [(.google.api.field_behavior) = REQUIRED]; - * @param string $var - * @return $this - */ - public function setOutputUriPrefix($var) - { - GPBUtil::checkString($var, True); - $this->output_uri_prefix = $var; - - return $this; - } - -} - diff --git a/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/GcsSource.php b/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/GcsSource.php deleted file mode 100644 index 9dfda6fc818..00000000000 --- a/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/GcsSource.php +++ /dev/null @@ -1,67 +0,0 @@ -google.cloud.translation.v3.GcsSource - */ -class GcsSource extends \Google\Protobuf\Internal\Message -{ - /** - * Required. Source data URI. For example, `gs://my_bucket/my_object`. - * - * Generated from protobuf field string input_uri = 1 [(.google.api.field_behavior) = REQUIRED]; - */ - protected $input_uri = ''; - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type string $input_uri - * Required. Source data URI. For example, `gs://my_bucket/my_object`. - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Cloud\Translate\V3\TranslationService::initOnce(); - parent::__construct($data); - } - - /** - * Required. Source data URI. For example, `gs://my_bucket/my_object`. - * - * Generated from protobuf field string input_uri = 1 [(.google.api.field_behavior) = REQUIRED]; - * @return string - */ - public function getInputUri() - { - return $this->input_uri; - } - - /** - * Required. Source data URI. For example, `gs://my_bucket/my_object`. - * - * Generated from protobuf field string input_uri = 1 [(.google.api.field_behavior) = REQUIRED]; - * @param string $var - * @return $this - */ - public function setInputUri($var) - { - GPBUtil::checkString($var, True); - $this->input_uri = $var; - - return $this; - } - -} - diff --git a/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/GetGlossaryRequest.php b/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/GetGlossaryRequest.php deleted file mode 100644 index 613ca43bce0..00000000000 --- a/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/GetGlossaryRequest.php +++ /dev/null @@ -1,67 +0,0 @@ -google.cloud.translation.v3.GetGlossaryRequest - */ -class GetGlossaryRequest extends \Google\Protobuf\Internal\Message -{ - /** - * Required. The name of the glossary to retrieve. - * - * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { - */ - protected $name = ''; - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type string $name - * Required. The name of the glossary to retrieve. - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Cloud\Translate\V3\TranslationService::initOnce(); - parent::__construct($data); - } - - /** - * Required. The name of the glossary to retrieve. - * - * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { - * @return string - */ - public function getName() - { - return $this->name; - } - - /** - * Required. The name of the glossary to retrieve. - * - * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { - * @param string $var - * @return $this - */ - public function setName($var) - { - GPBUtil::checkString($var, True); - $this->name = $var; - - return $this; - } - -} - diff --git a/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/GetSupportedLanguagesRequest.php b/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/GetSupportedLanguagesRequest.php deleted file mode 100644 index bc996f1db82..00000000000 --- a/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/GetSupportedLanguagesRequest.php +++ /dev/null @@ -1,203 +0,0 @@ -google.cloud.translation.v3.GetSupportedLanguagesRequest - */ -class GetSupportedLanguagesRequest extends \Google\Protobuf\Internal\Message -{ - /** - * Required. Project or location to make a call. Must refer to a caller's - * project. - * Format: `projects/{project-number-or-id}` or - * `projects/{project-number-or-id}/locations/{location-id}`. - * For global calls, use `projects/{project-number-or-id}/locations/global` or - * `projects/{project-number-or-id}`. - * Non-global location is required for AutoML models. - * Only models within the same region (have same location-id) can be used, - * otherwise an INVALID_ARGUMENT (400) error is returned. - * - * Generated from protobuf field string parent = 3 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { - */ - protected $parent = ''; - /** - * Optional. The language to use to return localized, human readable names - * of supported languages. If missing, then display names are not returned - * in a response. - * - * Generated from protobuf field string display_language_code = 1 [(.google.api.field_behavior) = OPTIONAL]; - */ - protected $display_language_code = ''; - /** - * Optional. Get supported languages of this model. - * The format depends on model type: - * - AutoML Translation models: - * `projects/{project-number-or-id}/locations/{location-id}/models/{model-id}` - * - General (built-in) models: - * `projects/{project-number-or-id}/locations/{location-id}/models/general/nmt`, - * Returns languages supported by the specified model. - * If missing, we get supported languages of Google general NMT model. - * - * Generated from protobuf field string model = 2 [(.google.api.field_behavior) = OPTIONAL]; - */ - protected $model = ''; - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type string $parent - * Required. Project or location to make a call. Must refer to a caller's - * project. - * Format: `projects/{project-number-or-id}` or - * `projects/{project-number-or-id}/locations/{location-id}`. - * For global calls, use `projects/{project-number-or-id}/locations/global` or - * `projects/{project-number-or-id}`. - * Non-global location is required for AutoML models. - * Only models within the same region (have same location-id) can be used, - * otherwise an INVALID_ARGUMENT (400) error is returned. - * @type string $display_language_code - * Optional. The language to use to return localized, human readable names - * of supported languages. If missing, then display names are not returned - * in a response. - * @type string $model - * Optional. Get supported languages of this model. - * The format depends on model type: - * - AutoML Translation models: - * `projects/{project-number-or-id}/locations/{location-id}/models/{model-id}` - * - General (built-in) models: - * `projects/{project-number-or-id}/locations/{location-id}/models/general/nmt`, - * Returns languages supported by the specified model. - * If missing, we get supported languages of Google general NMT model. - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Cloud\Translate\V3\TranslationService::initOnce(); - parent::__construct($data); - } - - /** - * Required. Project or location to make a call. Must refer to a caller's - * project. - * Format: `projects/{project-number-or-id}` or - * `projects/{project-number-or-id}/locations/{location-id}`. - * For global calls, use `projects/{project-number-or-id}/locations/global` or - * `projects/{project-number-or-id}`. - * Non-global location is required for AutoML models. - * Only models within the same region (have same location-id) can be used, - * otherwise an INVALID_ARGUMENT (400) error is returned. - * - * Generated from protobuf field string parent = 3 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { - * @return string - */ - public function getParent() - { - return $this->parent; - } - - /** - * Required. Project or location to make a call. Must refer to a caller's - * project. - * Format: `projects/{project-number-or-id}` or - * `projects/{project-number-or-id}/locations/{location-id}`. - * For global calls, use `projects/{project-number-or-id}/locations/global` or - * `projects/{project-number-or-id}`. - * Non-global location is required for AutoML models. - * Only models within the same region (have same location-id) can be used, - * otherwise an INVALID_ARGUMENT (400) error is returned. - * - * Generated from protobuf field string parent = 3 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { - * @param string $var - * @return $this - */ - public function setParent($var) - { - GPBUtil::checkString($var, True); - $this->parent = $var; - - return $this; - } - - /** - * Optional. The language to use to return localized, human readable names - * of supported languages. If missing, then display names are not returned - * in a response. - * - * Generated from protobuf field string display_language_code = 1 [(.google.api.field_behavior) = OPTIONAL]; - * @return string - */ - public function getDisplayLanguageCode() - { - return $this->display_language_code; - } - - /** - * Optional. The language to use to return localized, human readable names - * of supported languages. If missing, then display names are not returned - * in a response. - * - * Generated from protobuf field string display_language_code = 1 [(.google.api.field_behavior) = OPTIONAL]; - * @param string $var - * @return $this - */ - public function setDisplayLanguageCode($var) - { - GPBUtil::checkString($var, True); - $this->display_language_code = $var; - - return $this; - } - - /** - * Optional. Get supported languages of this model. - * The format depends on model type: - * - AutoML Translation models: - * `projects/{project-number-or-id}/locations/{location-id}/models/{model-id}` - * - General (built-in) models: - * `projects/{project-number-or-id}/locations/{location-id}/models/general/nmt`, - * Returns languages supported by the specified model. - * If missing, we get supported languages of Google general NMT model. - * - * Generated from protobuf field string model = 2 [(.google.api.field_behavior) = OPTIONAL]; - * @return string - */ - public function getModel() - { - return $this->model; - } - - /** - * Optional. Get supported languages of this model. - * The format depends on model type: - * - AutoML Translation models: - * `projects/{project-number-or-id}/locations/{location-id}/models/{model-id}` - * - General (built-in) models: - * `projects/{project-number-or-id}/locations/{location-id}/models/general/nmt`, - * Returns languages supported by the specified model. - * If missing, we get supported languages of Google general NMT model. - * - * Generated from protobuf field string model = 2 [(.google.api.field_behavior) = OPTIONAL]; - * @param string $var - * @return $this - */ - public function setModel($var) - { - GPBUtil::checkString($var, True); - $this->model = $var; - - return $this; - } - -} - diff --git a/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/Glossary.php b/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/Glossary.php deleted file mode 100644 index dac3eb5708c..00000000000 --- a/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/Glossary.php +++ /dev/null @@ -1,350 +0,0 @@ -google.cloud.translation.v3.Glossary - */ -class Glossary extends \Google\Protobuf\Internal\Message -{ - /** - * Required. The resource name of the glossary. Glossary names have the form - * `projects/{project-number-or-id}/locations/{location-id}/glossaries/{glossary-id}`. - * - * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED]; - */ - protected $name = ''; - /** - * Required. Provides examples to build the glossary from. - * Total glossary must not exceed 10M Unicode codepoints. - * - * Generated from protobuf field .google.cloud.translation.v3.GlossaryInputConfig input_config = 5; - */ - protected $input_config = null; - /** - * Output only. The number of entries defined in the glossary. - * - * Generated from protobuf field int32 entry_count = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; - */ - protected $entry_count = 0; - /** - * Output only. When CreateGlossary was called. - * - * Generated from protobuf field .google.protobuf.Timestamp submit_time = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; - */ - protected $submit_time = null; - /** - * Output only. When the glossary creation was finished. - * - * Generated from protobuf field .google.protobuf.Timestamp end_time = 8 [(.google.api.field_behavior) = OUTPUT_ONLY]; - */ - protected $end_time = null; - /** - * Optional. The display name of the glossary. - * - * Generated from protobuf field string display_name = 9 [(.google.api.field_behavior) = OPTIONAL]; - */ - protected $display_name = ''; - protected $languages; - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type string $name - * Required. The resource name of the glossary. Glossary names have the form - * `projects/{project-number-or-id}/locations/{location-id}/glossaries/{glossary-id}`. - * @type \Google\Cloud\Translate\V3\Glossary\LanguageCodePair $language_pair - * Used with unidirectional glossaries. - * @type \Google\Cloud\Translate\V3\Glossary\LanguageCodesSet $language_codes_set - * Used with equivalent term set glossaries. - * @type \Google\Cloud\Translate\V3\GlossaryInputConfig $input_config - * Required. Provides examples to build the glossary from. - * Total glossary must not exceed 10M Unicode codepoints. - * @type int $entry_count - * Output only. The number of entries defined in the glossary. - * @type \Google\Protobuf\Timestamp $submit_time - * Output only. When CreateGlossary was called. - * @type \Google\Protobuf\Timestamp $end_time - * Output only. When the glossary creation was finished. - * @type string $display_name - * Optional. The display name of the glossary. - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Cloud\Translate\V3\TranslationService::initOnce(); - parent::__construct($data); - } - - /** - * Required. The resource name of the glossary. Glossary names have the form - * `projects/{project-number-or-id}/locations/{location-id}/glossaries/{glossary-id}`. - * - * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED]; - * @return string - */ - public function getName() - { - return $this->name; - } - - /** - * Required. The resource name of the glossary. Glossary names have the form - * `projects/{project-number-or-id}/locations/{location-id}/glossaries/{glossary-id}`. - * - * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED]; - * @param string $var - * @return $this - */ - public function setName($var) - { - GPBUtil::checkString($var, True); - $this->name = $var; - - return $this; - } - - /** - * Used with unidirectional glossaries. - * - * Generated from protobuf field .google.cloud.translation.v3.Glossary.LanguageCodePair language_pair = 3; - * @return \Google\Cloud\Translate\V3\Glossary\LanguageCodePair|null - */ - public function getLanguagePair() - { - return $this->readOneof(3); - } - - public function hasLanguagePair() - { - return $this->hasOneof(3); - } - - /** - * Used with unidirectional glossaries. - * - * Generated from protobuf field .google.cloud.translation.v3.Glossary.LanguageCodePair language_pair = 3; - * @param \Google\Cloud\Translate\V3\Glossary\LanguageCodePair $var - * @return $this - */ - public function setLanguagePair($var) - { - GPBUtil::checkMessage($var, \Google\Cloud\Translate\V3\Glossary\LanguageCodePair::class); - $this->writeOneof(3, $var); - - return $this; - } - - /** - * Used with equivalent term set glossaries. - * - * Generated from protobuf field .google.cloud.translation.v3.Glossary.LanguageCodesSet language_codes_set = 4; - * @return \Google\Cloud\Translate\V3\Glossary\LanguageCodesSet|null - */ - public function getLanguageCodesSet() - { - return $this->readOneof(4); - } - - public function hasLanguageCodesSet() - { - return $this->hasOneof(4); - } - - /** - * Used with equivalent term set glossaries. - * - * Generated from protobuf field .google.cloud.translation.v3.Glossary.LanguageCodesSet language_codes_set = 4; - * @param \Google\Cloud\Translate\V3\Glossary\LanguageCodesSet $var - * @return $this - */ - public function setLanguageCodesSet($var) - { - GPBUtil::checkMessage($var, \Google\Cloud\Translate\V3\Glossary\LanguageCodesSet::class); - $this->writeOneof(4, $var); - - return $this; - } - - /** - * Required. Provides examples to build the glossary from. - * Total glossary must not exceed 10M Unicode codepoints. - * - * Generated from protobuf field .google.cloud.translation.v3.GlossaryInputConfig input_config = 5; - * @return \Google\Cloud\Translate\V3\GlossaryInputConfig|null - */ - public function getInputConfig() - { - return $this->input_config; - } - - public function hasInputConfig() - { - return isset($this->input_config); - } - - public function clearInputConfig() - { - unset($this->input_config); - } - - /** - * Required. Provides examples to build the glossary from. - * Total glossary must not exceed 10M Unicode codepoints. - * - * Generated from protobuf field .google.cloud.translation.v3.GlossaryInputConfig input_config = 5; - * @param \Google\Cloud\Translate\V3\GlossaryInputConfig $var - * @return $this - */ - public function setInputConfig($var) - { - GPBUtil::checkMessage($var, \Google\Cloud\Translate\V3\GlossaryInputConfig::class); - $this->input_config = $var; - - return $this; - } - - /** - * Output only. The number of entries defined in the glossary. - * - * Generated from protobuf field int32 entry_count = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; - * @return int - */ - public function getEntryCount() - { - return $this->entry_count; - } - - /** - * Output only. The number of entries defined in the glossary. - * - * Generated from protobuf field int32 entry_count = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; - * @param int $var - * @return $this - */ - public function setEntryCount($var) - { - GPBUtil::checkInt32($var); - $this->entry_count = $var; - - return $this; - } - - /** - * Output only. When CreateGlossary was called. - * - * Generated from protobuf field .google.protobuf.Timestamp submit_time = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; - * @return \Google\Protobuf\Timestamp|null - */ - public function getSubmitTime() - { - return $this->submit_time; - } - - public function hasSubmitTime() - { - return isset($this->submit_time); - } - - public function clearSubmitTime() - { - unset($this->submit_time); - } - - /** - * Output only. When CreateGlossary was called. - * - * Generated from protobuf field .google.protobuf.Timestamp submit_time = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; - * @param \Google\Protobuf\Timestamp $var - * @return $this - */ - public function setSubmitTime($var) - { - GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); - $this->submit_time = $var; - - return $this; - } - - /** - * Output only. When the glossary creation was finished. - * - * Generated from protobuf field .google.protobuf.Timestamp end_time = 8 [(.google.api.field_behavior) = OUTPUT_ONLY]; - * @return \Google\Protobuf\Timestamp|null - */ - public function getEndTime() - { - return $this->end_time; - } - - public function hasEndTime() - { - return isset($this->end_time); - } - - public function clearEndTime() - { - unset($this->end_time); - } - - /** - * Output only. When the glossary creation was finished. - * - * Generated from protobuf field .google.protobuf.Timestamp end_time = 8 [(.google.api.field_behavior) = OUTPUT_ONLY]; - * @param \Google\Protobuf\Timestamp $var - * @return $this - */ - public function setEndTime($var) - { - GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); - $this->end_time = $var; - - return $this; - } - - /** - * Optional. The display name of the glossary. - * - * Generated from protobuf field string display_name = 9 [(.google.api.field_behavior) = OPTIONAL]; - * @return string - */ - public function getDisplayName() - { - return $this->display_name; - } - - /** - * Optional. The display name of the glossary. - * - * Generated from protobuf field string display_name = 9 [(.google.api.field_behavior) = OPTIONAL]; - * @param string $var - * @return $this - */ - public function setDisplayName($var) - { - GPBUtil::checkString($var, True); - $this->display_name = $var; - - return $this; - } - - /** - * @return string - */ - public function getLanguages() - { - return $this->whichOneof("languages"); - } - -} - diff --git a/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/Glossary/LanguageCodePair.php b/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/Glossary/LanguageCodePair.php deleted file mode 100644 index 4b228dd3f15..00000000000 --- a/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/Glossary/LanguageCodePair.php +++ /dev/null @@ -1,112 +0,0 @@ -google.cloud.translation.v3.Glossary.LanguageCodePair - */ -class LanguageCodePair extends \Google\Protobuf\Internal\Message -{ - /** - * Required. The ISO-639 language code of the input text, for example, - * "en-US". Expected to be an exact match for GlossaryTerm.language_code. - * - * Generated from protobuf field string source_language_code = 1; - */ - protected $source_language_code = ''; - /** - * Required. The ISO-639 language code for translation output, for example, - * "zh-CN". Expected to be an exact match for GlossaryTerm.language_code. - * - * Generated from protobuf field string target_language_code = 2; - */ - protected $target_language_code = ''; - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type string $source_language_code - * Required. The ISO-639 language code of the input text, for example, - * "en-US". Expected to be an exact match for GlossaryTerm.language_code. - * @type string $target_language_code - * Required. The ISO-639 language code for translation output, for example, - * "zh-CN". Expected to be an exact match for GlossaryTerm.language_code. - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Cloud\Translate\V3\TranslationService::initOnce(); - parent::__construct($data); - } - - /** - * Required. The ISO-639 language code of the input text, for example, - * "en-US". Expected to be an exact match for GlossaryTerm.language_code. - * - * Generated from protobuf field string source_language_code = 1; - * @return string - */ - public function getSourceLanguageCode() - { - return $this->source_language_code; - } - - /** - * Required. The ISO-639 language code of the input text, for example, - * "en-US". Expected to be an exact match for GlossaryTerm.language_code. - * - * Generated from protobuf field string source_language_code = 1; - * @param string $var - * @return $this - */ - public function setSourceLanguageCode($var) - { - GPBUtil::checkString($var, True); - $this->source_language_code = $var; - - return $this; - } - - /** - * Required. The ISO-639 language code for translation output, for example, - * "zh-CN". Expected to be an exact match for GlossaryTerm.language_code. - * - * Generated from protobuf field string target_language_code = 2; - * @return string - */ - public function getTargetLanguageCode() - { - return $this->target_language_code; - } - - /** - * Required. The ISO-639 language code for translation output, for example, - * "zh-CN". Expected to be an exact match for GlossaryTerm.language_code. - * - * Generated from protobuf field string target_language_code = 2; - * @param string $var - * @return $this - */ - public function setTargetLanguageCode($var) - { - GPBUtil::checkString($var, True); - $this->target_language_code = $var; - - return $this; - } - -} - -// Adding a class alias for backwards compatibility with the previous class name. -class_alias(LanguageCodePair::class, \Google\Cloud\Translate\V3\Glossary_LanguageCodePair::class); - diff --git a/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/Glossary/LanguageCodesSet.php b/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/Glossary/LanguageCodesSet.php deleted file mode 100644 index 164d340406c..00000000000 --- a/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/Glossary/LanguageCodesSet.php +++ /dev/null @@ -1,78 +0,0 @@ -google.cloud.translation.v3.Glossary.LanguageCodesSet - */ -class LanguageCodesSet extends \Google\Protobuf\Internal\Message -{ - /** - * The ISO-639 language code(s) for terms defined in the glossary. - * All entries are unique. The list contains at least two entries. - * Expected to be an exact match for GlossaryTerm.language_code. - * - * Generated from protobuf field repeated string language_codes = 1; - */ - private $language_codes; - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type array|\Google\Protobuf\Internal\RepeatedField $language_codes - * The ISO-639 language code(s) for terms defined in the glossary. - * All entries are unique. The list contains at least two entries. - * Expected to be an exact match for GlossaryTerm.language_code. - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Cloud\Translate\V3\TranslationService::initOnce(); - parent::__construct($data); - } - - /** - * The ISO-639 language code(s) for terms defined in the glossary. - * All entries are unique. The list contains at least two entries. - * Expected to be an exact match for GlossaryTerm.language_code. - * - * Generated from protobuf field repeated string language_codes = 1; - * @return \Google\Protobuf\Internal\RepeatedField - */ - public function getLanguageCodes() - { - return $this->language_codes; - } - - /** - * The ISO-639 language code(s) for terms defined in the glossary. - * All entries are unique. The list contains at least two entries. - * Expected to be an exact match for GlossaryTerm.language_code. - * - * 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; - } - -} - -// Adding a class alias for backwards compatibility with the previous class name. -class_alias(LanguageCodesSet::class, \Google\Cloud\Translate\V3\Glossary_LanguageCodesSet::class); - diff --git a/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/GlossaryInputConfig.php b/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/GlossaryInputConfig.php deleted file mode 100644 index a5800834223..00000000000 --- a/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/GlossaryInputConfig.php +++ /dev/null @@ -1,120 +0,0 @@ -google.cloud.translation.v3.GlossaryInputConfig - */ -class GlossaryInputConfig extends \Google\Protobuf\Internal\Message -{ - protected $source; - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type \Google\Cloud\Translate\V3\GcsSource $gcs_source - * Required. Google Cloud Storage location of glossary data. - * File format is determined based on the filename extension. API returns - * [google.rpc.Code.INVALID_ARGUMENT] for unsupported URI-s and file - * formats. Wildcards are not allowed. This must be a single file in one of - * the following formats: - * For unidirectional glossaries: - * - TSV/CSV (`.tsv`/`.csv`): Two column file, tab- or comma-separated. - * The first column is source text. The second column is target text. - * No headers in this file. The first row contains data and not column - * names. - * - TMX (`.tmx`): TMX file with parallel data defining source/target term - * pairs. - * For equivalent term sets glossaries: - * - CSV (`.csv`): Multi-column CSV file defining equivalent glossary terms - * in multiple languages. See documentation for more information - - * [glossaries](https://cloud.google.com/translate/docs/advanced/glossary). - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Cloud\Translate\V3\TranslationService::initOnce(); - parent::__construct($data); - } - - /** - * Required. Google Cloud Storage location of glossary data. - * File format is determined based on the filename extension. API returns - * [google.rpc.Code.INVALID_ARGUMENT] for unsupported URI-s and file - * formats. Wildcards are not allowed. This must be a single file in one of - * the following formats: - * For unidirectional glossaries: - * - TSV/CSV (`.tsv`/`.csv`): Two column file, tab- or comma-separated. - * The first column is source text. The second column is target text. - * No headers in this file. The first row contains data and not column - * names. - * - TMX (`.tmx`): TMX file with parallel data defining source/target term - * pairs. - * For equivalent term sets glossaries: - * - CSV (`.csv`): Multi-column CSV file defining equivalent glossary terms - * in multiple languages. See documentation for more information - - * [glossaries](https://cloud.google.com/translate/docs/advanced/glossary). - * - * Generated from protobuf field .google.cloud.translation.v3.GcsSource gcs_source = 1; - * @return \Google\Cloud\Translate\V3\GcsSource|null - */ - public function getGcsSource() - { - return $this->readOneof(1); - } - - public function hasGcsSource() - { - return $this->hasOneof(1); - } - - /** - * Required. Google Cloud Storage location of glossary data. - * File format is determined based on the filename extension. API returns - * [google.rpc.Code.INVALID_ARGUMENT] for unsupported URI-s and file - * formats. Wildcards are not allowed. This must be a single file in one of - * the following formats: - * For unidirectional glossaries: - * - TSV/CSV (`.tsv`/`.csv`): Two column file, tab- or comma-separated. - * The first column is source text. The second column is target text. - * No headers in this file. The first row contains data and not column - * names. - * - TMX (`.tmx`): TMX file with parallel data defining source/target term - * pairs. - * For equivalent term sets glossaries: - * - CSV (`.csv`): Multi-column CSV file defining equivalent glossary terms - * in multiple languages. See documentation for more information - - * [glossaries](https://cloud.google.com/translate/docs/advanced/glossary). - * - * Generated from protobuf field .google.cloud.translation.v3.GcsSource gcs_source = 1; - * @param \Google\Cloud\Translate\V3\GcsSource $var - * @return $this - */ - public function setGcsSource($var) - { - GPBUtil::checkMessage($var, \Google\Cloud\Translate\V3\GcsSource::class); - $this->writeOneof(1, $var); - - return $this; - } - - /** - * @return string - */ - public function getSource() - { - return $this->whichOneof("source"); - } - -} - diff --git a/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/Glossary_LanguageCodePair.php b/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/Glossary_LanguageCodePair.php deleted file mode 100644 index 4e7ddaa0737..00000000000 --- a/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/Glossary_LanguageCodePair.php +++ /dev/null @@ -1,16 +0,0 @@ -google.cloud.translation.v3.InputConfig - */ -class InputConfig extends \Google\Protobuf\Internal\Message -{ - /** - * Optional. Can be "text/plain" or "text/html". - * For `.tsv`, "text/html" is used if mime_type is missing. - * For `.html`, this field must be "text/html" or empty. - * For `.txt`, this field must be "text/plain" or empty. - * - * Generated from protobuf field string mime_type = 1 [(.google.api.field_behavior) = OPTIONAL]; - */ - protected $mime_type = ''; - protected $source; - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type string $mime_type - * Optional. Can be "text/plain" or "text/html". - * For `.tsv`, "text/html" is used if mime_type is missing. - * For `.html`, this field must be "text/html" or empty. - * For `.txt`, this field must be "text/plain" or empty. - * @type \Google\Cloud\Translate\V3\GcsSource $gcs_source - * Required. Google Cloud Storage location for the source input. - * This can be a single file (for example, - * `gs://translation-test/input.tsv`) or a wildcard (for example, - * `gs://translation-test/*`). If a file extension is `.tsv`, it can - * contain either one or two columns. The first column (optional) is the id - * of the text request. If the first column is missing, we use the row - * number (0-based) from the input file as the ID in the output file. The - * second column is the actual text to be - * translated. We recommend each row be <= 10K Unicode codepoints, - * otherwise an error might be returned. - * Note that the input tsv must be RFC 4180 compliant. - * You could use https://github.com/Clever/csvlint to check potential - * formatting errors in your tsv file. - * csvlint --delimiter='\t' your_input_file.tsv - * The other supported file extensions are `.txt` or `.html`, which is - * treated as a single large chunk of text. - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Cloud\Translate\V3\TranslationService::initOnce(); - parent::__construct($data); - } - - /** - * Optional. Can be "text/plain" or "text/html". - * For `.tsv`, "text/html" is used if mime_type is missing. - * For `.html`, this field must be "text/html" or empty. - * For `.txt`, this field must be "text/plain" or empty. - * - * Generated from protobuf field string mime_type = 1 [(.google.api.field_behavior) = OPTIONAL]; - * @return string - */ - public function getMimeType() - { - return $this->mime_type; - } - - /** - * Optional. Can be "text/plain" or "text/html". - * For `.tsv`, "text/html" is used if mime_type is missing. - * For `.html`, this field must be "text/html" or empty. - * For `.txt`, this field must be "text/plain" or empty. - * - * Generated from protobuf field string mime_type = 1 [(.google.api.field_behavior) = OPTIONAL]; - * @param string $var - * @return $this - */ - public function setMimeType($var) - { - GPBUtil::checkString($var, True); - $this->mime_type = $var; - - return $this; - } - - /** - * Required. Google Cloud Storage location for the source input. - * This can be a single file (for example, - * `gs://translation-test/input.tsv`) or a wildcard (for example, - * `gs://translation-test/*`). If a file extension is `.tsv`, it can - * contain either one or two columns. The first column (optional) is the id - * of the text request. If the first column is missing, we use the row - * number (0-based) from the input file as the ID in the output file. The - * second column is the actual text to be - * translated. We recommend each row be <= 10K Unicode codepoints, - * otherwise an error might be returned. - * Note that the input tsv must be RFC 4180 compliant. - * You could use https://github.com/Clever/csvlint to check potential - * formatting errors in your tsv file. - * csvlint --delimiter='\t' your_input_file.tsv - * The other supported file extensions are `.txt` or `.html`, which is - * treated as a single large chunk of text. - * - * Generated from protobuf field .google.cloud.translation.v3.GcsSource gcs_source = 2; - * @return \Google\Cloud\Translate\V3\GcsSource|null - */ - public function getGcsSource() - { - return $this->readOneof(2); - } - - public function hasGcsSource() - { - return $this->hasOneof(2); - } - - /** - * Required. Google Cloud Storage location for the source input. - * This can be a single file (for example, - * `gs://translation-test/input.tsv`) or a wildcard (for example, - * `gs://translation-test/*`). If a file extension is `.tsv`, it can - * contain either one or two columns. The first column (optional) is the id - * of the text request. If the first column is missing, we use the row - * number (0-based) from the input file as the ID in the output file. The - * second column is the actual text to be - * translated. We recommend each row be <= 10K Unicode codepoints, - * otherwise an error might be returned. - * Note that the input tsv must be RFC 4180 compliant. - * You could use https://github.com/Clever/csvlint to check potential - * formatting errors in your tsv file. - * csvlint --delimiter='\t' your_input_file.tsv - * The other supported file extensions are `.txt` or `.html`, which is - * treated as a single large chunk of text. - * - * Generated from protobuf field .google.cloud.translation.v3.GcsSource gcs_source = 2; - * @param \Google\Cloud\Translate\V3\GcsSource $var - * @return $this - */ - public function setGcsSource($var) - { - GPBUtil::checkMessage($var, \Google\Cloud\Translate\V3\GcsSource::class); - $this->writeOneof(2, $var); - - return $this; - } - - /** - * @return string - */ - public function getSource() - { - return $this->whichOneof("source"); - } - -} - diff --git a/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/ListGlossariesRequest.php b/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/ListGlossariesRequest.php deleted file mode 100644 index f27147799a8..00000000000 --- a/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/ListGlossariesRequest.php +++ /dev/null @@ -1,245 +0,0 @@ -google.cloud.translation.v3.ListGlossariesRequest - */ -class ListGlossariesRequest extends \Google\Protobuf\Internal\Message -{ - /** - * Required. The name of the project from which to list all of the glossaries. - * - * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { - */ - protected $parent = ''; - /** - * Optional. Requested page size. The server may return fewer glossaries than - * requested. If unspecified, the server picks an appropriate default. - * - * Generated from protobuf field int32 page_size = 2 [(.google.api.field_behavior) = OPTIONAL]; - */ - protected $page_size = 0; - /** - * Optional. A token identifying a page of results the server should return. - * Typically, this is the value of [ListGlossariesResponse.next_page_token] - * returned from the previous call to `ListGlossaries` method. - * The first page is returned if `page_token`is empty or missing. - * - * Generated from protobuf field string page_token = 3 [(.google.api.field_behavior) = OPTIONAL]; - */ - protected $page_token = ''; - /** - * Optional. Filter specifying constraints of a list operation. - * Specify the constraint by the format of "key=value", where key must be - * "src" or "tgt", and the value must be a valid language code. - * For multiple restrictions, concatenate them by "AND" (uppercase only), - * such as: "src=en-US AND tgt=zh-CN". Notice that the exact match is used - * here, which means using 'en-US' and 'en' can lead to different results, - * which depends on the language code you used when you create the glossary. - * For the unidirectional glossaries, the "src" and "tgt" add restrictions - * on the source and target language code separately. - * For the equivalent term set glossaries, the "src" and/or "tgt" add - * restrictions on the term set. - * For example: "src=en-US AND tgt=zh-CN" will only pick the unidirectional - * glossaries which exactly match the source language code as "en-US" and the - * target language code "zh-CN", but all equivalent term set glossaries which - * contain "en-US" and "zh-CN" in their language set will be picked. - * If missing, no filtering is performed. - * - * Generated from protobuf field string filter = 4 [(.google.api.field_behavior) = OPTIONAL]; - */ - protected $filter = ''; - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type string $parent - * Required. The name of the project from which to list all of the glossaries. - * @type int $page_size - * Optional. Requested page size. The server may return fewer glossaries than - * requested. If unspecified, the server picks an appropriate default. - * @type string $page_token - * Optional. A token identifying a page of results the server should return. - * Typically, this is the value of [ListGlossariesResponse.next_page_token] - * returned from the previous call to `ListGlossaries` method. - * The first page is returned if `page_token`is empty or missing. - * @type string $filter - * Optional. Filter specifying constraints of a list operation. - * Specify the constraint by the format of "key=value", where key must be - * "src" or "tgt", and the value must be a valid language code. - * For multiple restrictions, concatenate them by "AND" (uppercase only), - * such as: "src=en-US AND tgt=zh-CN". Notice that the exact match is used - * here, which means using 'en-US' and 'en' can lead to different results, - * which depends on the language code you used when you create the glossary. - * For the unidirectional glossaries, the "src" and "tgt" add restrictions - * on the source and target language code separately. - * For the equivalent term set glossaries, the "src" and/or "tgt" add - * restrictions on the term set. - * For example: "src=en-US AND tgt=zh-CN" will only pick the unidirectional - * glossaries which exactly match the source language code as "en-US" and the - * target language code "zh-CN", but all equivalent term set glossaries which - * contain "en-US" and "zh-CN" in their language set will be picked. - * If missing, no filtering is performed. - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Cloud\Translate\V3\TranslationService::initOnce(); - parent::__construct($data); - } - - /** - * Required. The name of the project from which to list all of the glossaries. - * - * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { - * @return string - */ - public function getParent() - { - return $this->parent; - } - - /** - * Required. The name of the project from which to list all of the glossaries. - * - * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { - * @param string $var - * @return $this - */ - public function setParent($var) - { - GPBUtil::checkString($var, True); - $this->parent = $var; - - return $this; - } - - /** - * Optional. Requested page size. The server may return fewer glossaries than - * requested. If unspecified, the server picks an appropriate default. - * - * Generated from protobuf field int32 page_size = 2 [(.google.api.field_behavior) = OPTIONAL]; - * @return int - */ - public function getPageSize() - { - return $this->page_size; - } - - /** - * Optional. Requested page size. The server may return fewer glossaries than - * requested. If unspecified, the server picks an appropriate default. - * - * Generated from protobuf field int32 page_size = 2 [(.google.api.field_behavior) = OPTIONAL]; - * @param int $var - * @return $this - */ - public function setPageSize($var) - { - GPBUtil::checkInt32($var); - $this->page_size = $var; - - return $this; - } - - /** - * Optional. A token identifying a page of results the server should return. - * Typically, this is the value of [ListGlossariesResponse.next_page_token] - * returned from the previous call to `ListGlossaries` method. - * The first page is returned if `page_token`is empty or missing. - * - * Generated from protobuf field string page_token = 3 [(.google.api.field_behavior) = OPTIONAL]; - * @return string - */ - public function getPageToken() - { - return $this->page_token; - } - - /** - * Optional. A token identifying a page of results the server should return. - * Typically, this is the value of [ListGlossariesResponse.next_page_token] - * returned from the previous call to `ListGlossaries` method. - * The first page is returned if `page_token`is empty or missing. - * - * Generated from protobuf field string page_token = 3 [(.google.api.field_behavior) = OPTIONAL]; - * @param string $var - * @return $this - */ - public function setPageToken($var) - { - GPBUtil::checkString($var, True); - $this->page_token = $var; - - return $this; - } - - /** - * Optional. Filter specifying constraints of a list operation. - * Specify the constraint by the format of "key=value", where key must be - * "src" or "tgt", and the value must be a valid language code. - * For multiple restrictions, concatenate them by "AND" (uppercase only), - * such as: "src=en-US AND tgt=zh-CN". Notice that the exact match is used - * here, which means using 'en-US' and 'en' can lead to different results, - * which depends on the language code you used when you create the glossary. - * For the unidirectional glossaries, the "src" and "tgt" add restrictions - * on the source and target language code separately. - * For the equivalent term set glossaries, the "src" and/or "tgt" add - * restrictions on the term set. - * For example: "src=en-US AND tgt=zh-CN" will only pick the unidirectional - * glossaries which exactly match the source language code as "en-US" and the - * target language code "zh-CN", but all equivalent term set glossaries which - * contain "en-US" and "zh-CN" in their language set will be picked. - * If missing, no filtering is performed. - * - * Generated from protobuf field string filter = 4 [(.google.api.field_behavior) = OPTIONAL]; - * @return string - */ - public function getFilter() - { - return $this->filter; - } - - /** - * Optional. Filter specifying constraints of a list operation. - * Specify the constraint by the format of "key=value", where key must be - * "src" or "tgt", and the value must be a valid language code. - * For multiple restrictions, concatenate them by "AND" (uppercase only), - * such as: "src=en-US AND tgt=zh-CN". Notice that the exact match is used - * here, which means using 'en-US' and 'en' can lead to different results, - * which depends on the language code you used when you create the glossary. - * For the unidirectional glossaries, the "src" and "tgt" add restrictions - * on the source and target language code separately. - * For the equivalent term set glossaries, the "src" and/or "tgt" add - * restrictions on the term set. - * For example: "src=en-US AND tgt=zh-CN" will only pick the unidirectional - * glossaries which exactly match the source language code as "en-US" and the - * target language code "zh-CN", but all equivalent term set glossaries which - * contain "en-US" and "zh-CN" in their language set will be picked. - * If missing, no filtering is performed. - * - * Generated from protobuf field string filter = 4 [(.google.api.field_behavior) = OPTIONAL]; - * @param string $var - * @return $this - */ - public function setFilter($var) - { - GPBUtil::checkString($var, True); - $this->filter = $var; - - return $this; - } - -} - diff --git a/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/ListGlossariesResponse.php b/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/ListGlossariesResponse.php deleted file mode 100644 index 4671da068fa..00000000000 --- a/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/ListGlossariesResponse.php +++ /dev/null @@ -1,109 +0,0 @@ -google.cloud.translation.v3.ListGlossariesResponse - */ -class ListGlossariesResponse extends \Google\Protobuf\Internal\Message -{ - /** - * The list of glossaries for a project. - * - * Generated from protobuf field repeated .google.cloud.translation.v3.Glossary glossaries = 1; - */ - private $glossaries; - /** - * A token to retrieve a page of results. Pass this value in the - * [ListGlossariesRequest.page_token] field in the subsequent call to - * `ListGlossaries` method to retrieve the next page of results. - * - * Generated from protobuf field string next_page_token = 2; - */ - protected $next_page_token = ''; - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type array<\Google\Cloud\Translate\V3\Glossary>|\Google\Protobuf\Internal\RepeatedField $glossaries - * The list of glossaries for a project. - * @type string $next_page_token - * A token to retrieve a page of results. Pass this value in the - * [ListGlossariesRequest.page_token] field in the subsequent call to - * `ListGlossaries` method to retrieve the next page of results. - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Cloud\Translate\V3\TranslationService::initOnce(); - parent::__construct($data); - } - - /** - * The list of glossaries for a project. - * - * Generated from protobuf field repeated .google.cloud.translation.v3.Glossary glossaries = 1; - * @return \Google\Protobuf\Internal\RepeatedField - */ - public function getGlossaries() - { - return $this->glossaries; - } - - /** - * The list of glossaries for a project. - * - * Generated from protobuf field repeated .google.cloud.translation.v3.Glossary glossaries = 1; - * @param array<\Google\Cloud\Translate\V3\Glossary>|\Google\Protobuf\Internal\RepeatedField $var - * @return $this - */ - public function setGlossaries($var) - { - $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Translate\V3\Glossary::class); - $this->glossaries = $arr; - - return $this; - } - - /** - * A token to retrieve a page of results. Pass this value in the - * [ListGlossariesRequest.page_token] field in the subsequent call to - * `ListGlossaries` method to retrieve the next page of results. - * - * Generated from protobuf field string next_page_token = 2; - * @return string - */ - public function getNextPageToken() - { - return $this->next_page_token; - } - - /** - * A token to retrieve a page of results. Pass this value in the - * [ListGlossariesRequest.page_token] field in the subsequent call to - * `ListGlossaries` method to retrieve the next page of results. - * - * Generated from protobuf field string next_page_token = 2; - * @param string $var - * @return $this - */ - public function setNextPageToken($var) - { - GPBUtil::checkString($var, True); - $this->next_page_token = $var; - - return $this; - } - -} - diff --git a/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/OutputConfig.php b/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/OutputConfig.php deleted file mode 100644 index 4059eea266f..00000000000 --- a/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/OutputConfig.php +++ /dev/null @@ -1,249 +0,0 @@ -google.cloud.translation.v3.OutputConfig - */ -class OutputConfig extends \Google\Protobuf\Internal\Message -{ - protected $destination; - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type \Google\Cloud\Translate\V3\GcsDestination $gcs_destination - * Google Cloud Storage destination for output content. - * For every single input file (for example, gs://a/b/c.[extension]), we - * generate at most 2 * n output files. (n is the # of target_language_codes - * in the BatchTranslateTextRequest). - * Output files (tsv) generated are compliant with RFC 4180 except that - * record delimiters are '\n' instead of '\r\n'. We don't provide any way to - * change record delimiters. - * While the input files are being processed, we write/update an index file - * 'index.csv' under 'output_uri_prefix' (for example, - * gs://translation-test/index.csv) The index file is generated/updated as - * new files are being translated. The format is: - * input_file,target_language_code,translations_file,errors_file, - * glossary_translations_file,glossary_errors_file - * input_file is one file we matched using gcs_source.input_uri. - * target_language_code is provided in the request. - * translations_file contains the translations. (details provided below) - * errors_file contains the errors during processing of the file. (details - * below). Both translations_file and errors_file could be empty - * strings if we have no content to output. - * glossary_translations_file and glossary_errors_file are always empty - * strings if the input_file is tsv. They could also be empty if we have no - * content to output. - * Once a row is present in index.csv, the input/output matching never - * changes. Callers should also expect all the content in input_file are - * processed and ready to be consumed (that is, no partial output file is - * written). - * Since index.csv will be keeping updated during the process, please make - * sure there is no custom retention policy applied on the output bucket - * that may avoid file updating. - * (https://cloud.google.com/storage/docs/bucket-lock#retention-policy) - * The format of translations_file (for target language code 'trg') is: - * `gs://translation_test/a_b_c_'trg'_translations.[extension]` - * If the input file extension is tsv, the output has the following - * columns: - * Column 1: ID of the request provided in the input, if it's not - * provided in the input, then the input row number is used (0-based). - * Column 2: source sentence. - * Column 3: translation without applying a glossary. Empty string if there - * is an error. - * Column 4 (only present if a glossary is provided in the request): - * translation after applying the glossary. Empty string if there is an - * error applying the glossary. Could be same string as column 3 if there is - * no glossary applied. - * If input file extension is a txt or html, the translation is directly - * written to the output file. If glossary is requested, a separate - * glossary_translations_file has format of - * gs://translation_test/a_b_c_'trg'_glossary_translations.[extension] - * The format of errors file (for target language code 'trg') is: - * gs://translation_test/a_b_c_'trg'_errors.[extension] - * If the input file extension is tsv, errors_file contains the following: - * Column 1: ID of the request provided in the input, if it's not - * provided in the input, then the input row number is used (0-based). - * Column 2: source sentence. - * Column 3: Error detail for the translation. Could be empty. - * Column 4 (only present if a glossary is provided in the request): - * Error when applying the glossary. - * If the input file extension is txt or html, glossary_error_file will be - * generated that contains error details. glossary_error_file has format of - * gs://translation_test/a_b_c_'trg'_glossary_errors.[extension] - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Cloud\Translate\V3\TranslationService::initOnce(); - parent::__construct($data); - } - - /** - * Google Cloud Storage destination for output content. - * For every single input file (for example, gs://a/b/c.[extension]), we - * generate at most 2 * n output files. (n is the # of target_language_codes - * in the BatchTranslateTextRequest). - * Output files (tsv) generated are compliant with RFC 4180 except that - * record delimiters are '\n' instead of '\r\n'. We don't provide any way to - * change record delimiters. - * While the input files are being processed, we write/update an index file - * 'index.csv' under 'output_uri_prefix' (for example, - * gs://translation-test/index.csv) The index file is generated/updated as - * new files are being translated. The format is: - * input_file,target_language_code,translations_file,errors_file, - * glossary_translations_file,glossary_errors_file - * input_file is one file we matched using gcs_source.input_uri. - * target_language_code is provided in the request. - * translations_file contains the translations. (details provided below) - * errors_file contains the errors during processing of the file. (details - * below). Both translations_file and errors_file could be empty - * strings if we have no content to output. - * glossary_translations_file and glossary_errors_file are always empty - * strings if the input_file is tsv. They could also be empty if we have no - * content to output. - * Once a row is present in index.csv, the input/output matching never - * changes. Callers should also expect all the content in input_file are - * processed and ready to be consumed (that is, no partial output file is - * written). - * Since index.csv will be keeping updated during the process, please make - * sure there is no custom retention policy applied on the output bucket - * that may avoid file updating. - * (https://cloud.google.com/storage/docs/bucket-lock#retention-policy) - * The format of translations_file (for target language code 'trg') is: - * `gs://translation_test/a_b_c_'trg'_translations.[extension]` - * If the input file extension is tsv, the output has the following - * columns: - * Column 1: ID of the request provided in the input, if it's not - * provided in the input, then the input row number is used (0-based). - * Column 2: source sentence. - * Column 3: translation without applying a glossary. Empty string if there - * is an error. - * Column 4 (only present if a glossary is provided in the request): - * translation after applying the glossary. Empty string if there is an - * error applying the glossary. Could be same string as column 3 if there is - * no glossary applied. - * If input file extension is a txt or html, the translation is directly - * written to the output file. If glossary is requested, a separate - * glossary_translations_file has format of - * gs://translation_test/a_b_c_'trg'_glossary_translations.[extension] - * The format of errors file (for target language code 'trg') is: - * gs://translation_test/a_b_c_'trg'_errors.[extension] - * If the input file extension is tsv, errors_file contains the following: - * Column 1: ID of the request provided in the input, if it's not - * provided in the input, then the input row number is used (0-based). - * Column 2: source sentence. - * Column 3: Error detail for the translation. Could be empty. - * Column 4 (only present if a glossary is provided in the request): - * Error when applying the glossary. - * If the input file extension is txt or html, glossary_error_file will be - * generated that contains error details. glossary_error_file has format of - * gs://translation_test/a_b_c_'trg'_glossary_errors.[extension] - * - * Generated from protobuf field .google.cloud.translation.v3.GcsDestination gcs_destination = 1; - * @return \Google\Cloud\Translate\V3\GcsDestination|null - */ - public function getGcsDestination() - { - return $this->readOneof(1); - } - - public function hasGcsDestination() - { - return $this->hasOneof(1); - } - - /** - * Google Cloud Storage destination for output content. - * For every single input file (for example, gs://a/b/c.[extension]), we - * generate at most 2 * n output files. (n is the # of target_language_codes - * in the BatchTranslateTextRequest). - * Output files (tsv) generated are compliant with RFC 4180 except that - * record delimiters are '\n' instead of '\r\n'. We don't provide any way to - * change record delimiters. - * While the input files are being processed, we write/update an index file - * 'index.csv' under 'output_uri_prefix' (for example, - * gs://translation-test/index.csv) The index file is generated/updated as - * new files are being translated. The format is: - * input_file,target_language_code,translations_file,errors_file, - * glossary_translations_file,glossary_errors_file - * input_file is one file we matched using gcs_source.input_uri. - * target_language_code is provided in the request. - * translations_file contains the translations. (details provided below) - * errors_file contains the errors during processing of the file. (details - * below). Both translations_file and errors_file could be empty - * strings if we have no content to output. - * glossary_translations_file and glossary_errors_file are always empty - * strings if the input_file is tsv. They could also be empty if we have no - * content to output. - * Once a row is present in index.csv, the input/output matching never - * changes. Callers should also expect all the content in input_file are - * processed and ready to be consumed (that is, no partial output file is - * written). - * Since index.csv will be keeping updated during the process, please make - * sure there is no custom retention policy applied on the output bucket - * that may avoid file updating. - * (https://cloud.google.com/storage/docs/bucket-lock#retention-policy) - * The format of translations_file (for target language code 'trg') is: - * `gs://translation_test/a_b_c_'trg'_translations.[extension]` - * If the input file extension is tsv, the output has the following - * columns: - * Column 1: ID of the request provided in the input, if it's not - * provided in the input, then the input row number is used (0-based). - * Column 2: source sentence. - * Column 3: translation without applying a glossary. Empty string if there - * is an error. - * Column 4 (only present if a glossary is provided in the request): - * translation after applying the glossary. Empty string if there is an - * error applying the glossary. Could be same string as column 3 if there is - * no glossary applied. - * If input file extension is a txt or html, the translation is directly - * written to the output file. If glossary is requested, a separate - * glossary_translations_file has format of - * gs://translation_test/a_b_c_'trg'_glossary_translations.[extension] - * The format of errors file (for target language code 'trg') is: - * gs://translation_test/a_b_c_'trg'_errors.[extension] - * If the input file extension is tsv, errors_file contains the following: - * Column 1: ID of the request provided in the input, if it's not - * provided in the input, then the input row number is used (0-based). - * Column 2: source sentence. - * Column 3: Error detail for the translation. Could be empty. - * Column 4 (only present if a glossary is provided in the request): - * Error when applying the glossary. - * If the input file extension is txt or html, glossary_error_file will be - * generated that contains error details. glossary_error_file has format of - * gs://translation_test/a_b_c_'trg'_glossary_errors.[extension] - * - * Generated from protobuf field .google.cloud.translation.v3.GcsDestination gcs_destination = 1; - * @param \Google\Cloud\Translate\V3\GcsDestination $var - * @return $this - */ - public function setGcsDestination($var) - { - GPBUtil::checkMessage($var, \Google\Cloud\Translate\V3\GcsDestination::class); - $this->writeOneof(1, $var); - - return $this; - } - - /** - * @return string - */ - public function getDestination() - { - return $this->whichOneof("destination"); - } - -} - diff --git a/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/SupportedLanguage.php b/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/SupportedLanguage.php deleted file mode 100644 index cfb8756c2c1..00000000000 --- a/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/SupportedLanguage.php +++ /dev/null @@ -1,186 +0,0 @@ -google.cloud.translation.v3.SupportedLanguage - */ -class SupportedLanguage extends \Google\Protobuf\Internal\Message -{ - /** - * Supported language code, generally consisting of its ISO 639-1 - * identifier, for example, 'en', 'ja'. In certain cases, ISO-639 codes - * including language and region identifiers are returned (for example, - * 'zh-TW' and 'zh-CN'). - * - * Generated from protobuf field string language_code = 1; - */ - protected $language_code = ''; - /** - * Human-readable name of the language localized in the display language - * specified in the request. - * - * Generated from protobuf field string display_name = 2; - */ - protected $display_name = ''; - /** - * Can be used as a source language. - * - * Generated from protobuf field bool support_source = 3; - */ - protected $support_source = false; - /** - * Can be used as a target language. - * - * Generated from protobuf field bool support_target = 4; - */ - protected $support_target = false; - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type string $language_code - * Supported language code, generally consisting of its ISO 639-1 - * identifier, for example, 'en', 'ja'. In certain cases, ISO-639 codes - * including language and region identifiers are returned (for example, - * 'zh-TW' and 'zh-CN'). - * @type string $display_name - * Human-readable name of the language localized in the display language - * specified in the request. - * @type bool $support_source - * Can be used as a source language. - * @type bool $support_target - * Can be used as a target language. - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Cloud\Translate\V3\TranslationService::initOnce(); - parent::__construct($data); - } - - /** - * Supported language code, generally consisting of its ISO 639-1 - * identifier, for example, 'en', 'ja'. In certain cases, ISO-639 codes - * including language and region identifiers are returned (for example, - * 'zh-TW' and 'zh-CN'). - * - * Generated from protobuf field string language_code = 1; - * @return string - */ - public function getLanguageCode() - { - return $this->language_code; - } - - /** - * Supported language code, generally consisting of its ISO 639-1 - * identifier, for example, 'en', 'ja'. In certain cases, ISO-639 codes - * including language and region identifiers are returned (for example, - * 'zh-TW' and 'zh-CN'). - * - * Generated from protobuf field string language_code = 1; - * @param string $var - * @return $this - */ - public function setLanguageCode($var) - { - GPBUtil::checkString($var, True); - $this->language_code = $var; - - return $this; - } - - /** - * Human-readable name of the language localized in the display language - * specified in the request. - * - * Generated from protobuf field string display_name = 2; - * @return string - */ - public function getDisplayName() - { - return $this->display_name; - } - - /** - * Human-readable name of the language localized in the display language - * specified in the request. - * - * Generated from protobuf field string display_name = 2; - * @param string $var - * @return $this - */ - public function setDisplayName($var) - { - GPBUtil::checkString($var, True); - $this->display_name = $var; - - return $this; - } - - /** - * Can be used as a source language. - * - * Generated from protobuf field bool support_source = 3; - * @return bool - */ - public function getSupportSource() - { - return $this->support_source; - } - - /** - * Can be used as a source language. - * - * Generated from protobuf field bool support_source = 3; - * @param bool $var - * @return $this - */ - public function setSupportSource($var) - { - GPBUtil::checkBool($var); - $this->support_source = $var; - - return $this; - } - - /** - * Can be used as a target language. - * - * Generated from protobuf field bool support_target = 4; - * @return bool - */ - public function getSupportTarget() - { - return $this->support_target; - } - - /** - * Can be used as a target language. - * - * Generated from protobuf field bool support_target = 4; - * @param bool $var - * @return $this - */ - public function setSupportTarget($var) - { - GPBUtil::checkBool($var); - $this->support_target = $var; - - return $this; - } - -} - diff --git a/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/SupportedLanguages.php b/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/SupportedLanguages.php deleted file mode 100644 index 1bfb36123e5..00000000000 --- a/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/SupportedLanguages.php +++ /dev/null @@ -1,71 +0,0 @@ -google.cloud.translation.v3.SupportedLanguages - */ -class SupportedLanguages extends \Google\Protobuf\Internal\Message -{ - /** - * A list of supported language responses. This list contains an entry - * for each language the Translation API supports. - * - * Generated from protobuf field repeated .google.cloud.translation.v3.SupportedLanguage languages = 1; - */ - private $languages; - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type array<\Google\Cloud\Translate\V3\SupportedLanguage>|\Google\Protobuf\Internal\RepeatedField $languages - * A list of supported language responses. This list contains an entry - * for each language the Translation API supports. - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Cloud\Translate\V3\TranslationService::initOnce(); - parent::__construct($data); - } - - /** - * A list of supported language responses. This list contains an entry - * for each language the Translation API supports. - * - * Generated from protobuf field repeated .google.cloud.translation.v3.SupportedLanguage languages = 1; - * @return \Google\Protobuf\Internal\RepeatedField - */ - public function getLanguages() - { - return $this->languages; - } - - /** - * A list of supported language responses. This list contains an entry - * for each language the Translation API supports. - * - * Generated from protobuf field repeated .google.cloud.translation.v3.SupportedLanguage languages = 1; - * @param array<\Google\Cloud\Translate\V3\SupportedLanguage>|\Google\Protobuf\Internal\RepeatedField $var - * @return $this - */ - public function setLanguages($var) - { - $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Translate\V3\SupportedLanguage::class); - $this->languages = $arr; - - return $this; - } - -} - diff --git a/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/TranslateDocumentRequest.php b/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/TranslateDocumentRequest.php deleted file mode 100644 index e71340e67d6..00000000000 --- a/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/TranslateDocumentRequest.php +++ /dev/null @@ -1,593 +0,0 @@ -google.cloud.translation.v3.TranslateDocumentRequest - */ -class TranslateDocumentRequest extends \Google\Protobuf\Internal\Message -{ - /** - * Required. Location to make a regional call. - * Format: `projects/{project-number-or-id}/locations/{location-id}`. - * For global calls, use `projects/{project-number-or-id}/locations/global` or - * `projects/{project-number-or-id}`. - * Non-global location is required for requests using AutoML models or custom - * glossaries. - * Models and glossaries must be within the same region (have the same - * location-id), otherwise an INVALID_ARGUMENT (400) error is returned. - * - * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED]; - */ - protected $parent = ''; - /** - * Optional. The ISO-639 language code of the input document if known, for - * example, "en-US" or "sr-Latn". Supported language codes are listed in - * Language Support. If the source language isn't specified, the API attempts - * to identify the source language automatically and returns the source - * language within the response. Source language must be specified if the - * request contains a glossary or a custom model. - * - * Generated from protobuf field string source_language_code = 2 [(.google.api.field_behavior) = OPTIONAL]; - */ - protected $source_language_code = ''; - /** - * Required. The ISO-639 language code to use for translation of the input - * document, set to one of the language codes listed in Language Support. - * - * Generated from protobuf field string target_language_code = 3 [(.google.api.field_behavior) = REQUIRED]; - */ - protected $target_language_code = ''; - /** - * Required. Input configurations. - * - * Generated from protobuf field .google.cloud.translation.v3.DocumentInputConfig document_input_config = 4 [(.google.api.field_behavior) = REQUIRED]; - */ - protected $document_input_config = null; - /** - * Optional. Output configurations. - * Defines if the output file should be stored within Cloud Storage as well - * as the desired output format. If not provided the translated file will - * only be returned through a byte-stream and its output mime type will be - * the same as the input file's mime type. - * - * Generated from protobuf field .google.cloud.translation.v3.DocumentOutputConfig document_output_config = 5 [(.google.api.field_behavior) = OPTIONAL]; - */ - protected $document_output_config = null; - /** - * Optional. The `model` type requested for this translation. - * The format depends on model type: - * - AutoML Translation models: - * `projects/{project-number-or-id}/locations/{location-id}/models/{model-id}` - * - General (built-in) models: - * `projects/{project-number-or-id}/locations/{location-id}/models/general/nmt`, - * If not provided, the default Google model (NMT) will be used for - * translation. - * - * Generated from protobuf field string model = 6 [(.google.api.field_behavior) = OPTIONAL]; - */ - protected $model = ''; - /** - * Optional. Glossary to be applied. The glossary must be within the same - * region (have the same location-id) as the model, otherwise an - * INVALID_ARGUMENT (400) error is returned. - * - * Generated from protobuf field .google.cloud.translation.v3.TranslateTextGlossaryConfig glossary_config = 7 [(.google.api.field_behavior) = OPTIONAL]; - */ - protected $glossary_config = null; - /** - * Optional. The labels with user-defined metadata for the request. - * Label keys and values can be no longer than 63 characters (Unicode - * codepoints), can only contain lowercase letters, numeric characters, - * underscores and dashes. International characters are allowed. Label values - * are optional. Label keys must start with a letter. - * See https://cloud.google.com/translate/docs/advanced/labels for more - * information. - * - * Generated from protobuf field map labels = 8 [(.google.api.field_behavior) = OPTIONAL]; - */ - private $labels; - /** - * Optional. This flag is to support user customized attribution. - * If not provided, the default is `Machine Translated by Google`. - * Customized attribution should follow rules in - * https://cloud.google.com/translate/attribution#attribution_and_logos - * - * Generated from protobuf field string customized_attribution = 10 [(.google.api.field_behavior) = OPTIONAL]; - */ - protected $customized_attribution = ''; - /** - * Optional. If true, the page limit of online native pdf translation is 300 - * and only native pdf pages will be translated. - * - * Generated from protobuf field bool is_translate_native_pdf_only = 11 [(.google.api.field_behavior) = OPTIONAL]; - */ - protected $is_translate_native_pdf_only = false; - /** - * Optional. If true, use the text removal to remove the shadow text on - * background image for native pdf translation. - * Shadow removal feature can only be enabled when - * is_translate_native_pdf_only is false - * - * Generated from protobuf field bool enable_shadow_removal_native_pdf = 12 [(.google.api.field_behavior) = OPTIONAL]; - */ - protected $enable_shadow_removal_native_pdf = false; - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type string $parent - * Required. Location to make a regional call. - * Format: `projects/{project-number-or-id}/locations/{location-id}`. - * For global calls, use `projects/{project-number-or-id}/locations/global` or - * `projects/{project-number-or-id}`. - * Non-global location is required for requests using AutoML models or custom - * glossaries. - * Models and glossaries must be within the same region (have the same - * location-id), otherwise an INVALID_ARGUMENT (400) error is returned. - * @type string $source_language_code - * Optional. The ISO-639 language code of the input document if known, for - * example, "en-US" or "sr-Latn". Supported language codes are listed in - * Language Support. If the source language isn't specified, the API attempts - * to identify the source language automatically and returns the source - * language within the response. Source language must be specified if the - * request contains a glossary or a custom model. - * @type string $target_language_code - * Required. The ISO-639 language code to use for translation of the input - * document, set to one of the language codes listed in Language Support. - * @type \Google\Cloud\Translate\V3\DocumentInputConfig $document_input_config - * Required. Input configurations. - * @type \Google\Cloud\Translate\V3\DocumentOutputConfig $document_output_config - * Optional. Output configurations. - * Defines if the output file should be stored within Cloud Storage as well - * as the desired output format. If not provided the translated file will - * only be returned through a byte-stream and its output mime type will be - * the same as the input file's mime type. - * @type string $model - * Optional. The `model` type requested for this translation. - * The format depends on model type: - * - AutoML Translation models: - * `projects/{project-number-or-id}/locations/{location-id}/models/{model-id}` - * - General (built-in) models: - * `projects/{project-number-or-id}/locations/{location-id}/models/general/nmt`, - * If not provided, the default Google model (NMT) will be used for - * translation. - * @type \Google\Cloud\Translate\V3\TranslateTextGlossaryConfig $glossary_config - * Optional. Glossary to be applied. The glossary must be within the same - * region (have the same location-id) as the model, otherwise an - * INVALID_ARGUMENT (400) error is returned. - * @type array|\Google\Protobuf\Internal\MapField $labels - * Optional. The labels with user-defined metadata for the request. - * Label keys and values can be no longer than 63 characters (Unicode - * codepoints), can only contain lowercase letters, numeric characters, - * underscores and dashes. International characters are allowed. Label values - * are optional. Label keys must start with a letter. - * See https://cloud.google.com/translate/docs/advanced/labels for more - * information. - * @type string $customized_attribution - * Optional. This flag is to support user customized attribution. - * If not provided, the default is `Machine Translated by Google`. - * Customized attribution should follow rules in - * https://cloud.google.com/translate/attribution#attribution_and_logos - * @type bool $is_translate_native_pdf_only - * Optional. If true, the page limit of online native pdf translation is 300 - * and only native pdf pages will be translated. - * @type bool $enable_shadow_removal_native_pdf - * Optional. If true, use the text removal to remove the shadow text on - * background image for native pdf translation. - * Shadow removal feature can only be enabled when - * is_translate_native_pdf_only is false - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Cloud\Translate\V3\TranslationService::initOnce(); - parent::__construct($data); - } - - /** - * Required. Location to make a regional call. - * Format: `projects/{project-number-or-id}/locations/{location-id}`. - * For global calls, use `projects/{project-number-or-id}/locations/global` or - * `projects/{project-number-or-id}`. - * Non-global location is required for requests using AutoML models or custom - * glossaries. - * Models and glossaries must be within the same region (have the same - * location-id), otherwise an INVALID_ARGUMENT (400) error is returned. - * - * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED]; - * @return string - */ - public function getParent() - { - return $this->parent; - } - - /** - * Required. Location to make a regional call. - * Format: `projects/{project-number-or-id}/locations/{location-id}`. - * For global calls, use `projects/{project-number-or-id}/locations/global` or - * `projects/{project-number-or-id}`. - * Non-global location is required for requests using AutoML models or custom - * glossaries. - * Models and glossaries must be within the same region (have the same - * location-id), otherwise an INVALID_ARGUMENT (400) error is returned. - * - * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED]; - * @param string $var - * @return $this - */ - public function setParent($var) - { - GPBUtil::checkString($var, True); - $this->parent = $var; - - return $this; - } - - /** - * Optional. The ISO-639 language code of the input document if known, for - * example, "en-US" or "sr-Latn". Supported language codes are listed in - * Language Support. If the source language isn't specified, the API attempts - * to identify the source language automatically and returns the source - * language within the response. Source language must be specified if the - * request contains a glossary or a custom model. - * - * Generated from protobuf field string source_language_code = 2 [(.google.api.field_behavior) = OPTIONAL]; - * @return string - */ - public function getSourceLanguageCode() - { - return $this->source_language_code; - } - - /** - * Optional. The ISO-639 language code of the input document if known, for - * example, "en-US" or "sr-Latn". Supported language codes are listed in - * Language Support. If the source language isn't specified, the API attempts - * to identify the source language automatically and returns the source - * language within the response. Source language must be specified if the - * request contains a glossary or a custom model. - * - * Generated from protobuf field string source_language_code = 2 [(.google.api.field_behavior) = OPTIONAL]; - * @param string $var - * @return $this - */ - public function setSourceLanguageCode($var) - { - GPBUtil::checkString($var, True); - $this->source_language_code = $var; - - return $this; - } - - /** - * Required. The ISO-639 language code to use for translation of the input - * document, set to one of the language codes listed in Language Support. - * - * Generated from protobuf field string target_language_code = 3 [(.google.api.field_behavior) = REQUIRED]; - * @return string - */ - public function getTargetLanguageCode() - { - return $this->target_language_code; - } - - /** - * Required. The ISO-639 language code to use for translation of the input - * document, set to one of the language codes listed in Language Support. - * - * Generated from protobuf field string target_language_code = 3 [(.google.api.field_behavior) = REQUIRED]; - * @param string $var - * @return $this - */ - public function setTargetLanguageCode($var) - { - GPBUtil::checkString($var, True); - $this->target_language_code = $var; - - return $this; - } - - /** - * Required. Input configurations. - * - * Generated from protobuf field .google.cloud.translation.v3.DocumentInputConfig document_input_config = 4 [(.google.api.field_behavior) = REQUIRED]; - * @return \Google\Cloud\Translate\V3\DocumentInputConfig|null - */ - public function getDocumentInputConfig() - { - return $this->document_input_config; - } - - public function hasDocumentInputConfig() - { - return isset($this->document_input_config); - } - - public function clearDocumentInputConfig() - { - unset($this->document_input_config); - } - - /** - * Required. Input configurations. - * - * Generated from protobuf field .google.cloud.translation.v3.DocumentInputConfig document_input_config = 4 [(.google.api.field_behavior) = REQUIRED]; - * @param \Google\Cloud\Translate\V3\DocumentInputConfig $var - * @return $this - */ - public function setDocumentInputConfig($var) - { - GPBUtil::checkMessage($var, \Google\Cloud\Translate\V3\DocumentInputConfig::class); - $this->document_input_config = $var; - - return $this; - } - - /** - * Optional. Output configurations. - * Defines if the output file should be stored within Cloud Storage as well - * as the desired output format. If not provided the translated file will - * only be returned through a byte-stream and its output mime type will be - * the same as the input file's mime type. - * - * Generated from protobuf field .google.cloud.translation.v3.DocumentOutputConfig document_output_config = 5 [(.google.api.field_behavior) = OPTIONAL]; - * @return \Google\Cloud\Translate\V3\DocumentOutputConfig|null - */ - public function getDocumentOutputConfig() - { - return $this->document_output_config; - } - - public function hasDocumentOutputConfig() - { - return isset($this->document_output_config); - } - - public function clearDocumentOutputConfig() - { - unset($this->document_output_config); - } - - /** - * Optional. Output configurations. - * Defines if the output file should be stored within Cloud Storage as well - * as the desired output format. If not provided the translated file will - * only be returned through a byte-stream and its output mime type will be - * the same as the input file's mime type. - * - * Generated from protobuf field .google.cloud.translation.v3.DocumentOutputConfig document_output_config = 5 [(.google.api.field_behavior) = OPTIONAL]; - * @param \Google\Cloud\Translate\V3\DocumentOutputConfig $var - * @return $this - */ - public function setDocumentOutputConfig($var) - { - GPBUtil::checkMessage($var, \Google\Cloud\Translate\V3\DocumentOutputConfig::class); - $this->document_output_config = $var; - - return $this; - } - - /** - * Optional. The `model` type requested for this translation. - * The format depends on model type: - * - AutoML Translation models: - * `projects/{project-number-or-id}/locations/{location-id}/models/{model-id}` - * - General (built-in) models: - * `projects/{project-number-or-id}/locations/{location-id}/models/general/nmt`, - * If not provided, the default Google model (NMT) will be used for - * translation. - * - * Generated from protobuf field string model = 6 [(.google.api.field_behavior) = OPTIONAL]; - * @return string - */ - public function getModel() - { - return $this->model; - } - - /** - * Optional. The `model` type requested for this translation. - * The format depends on model type: - * - AutoML Translation models: - * `projects/{project-number-or-id}/locations/{location-id}/models/{model-id}` - * - General (built-in) models: - * `projects/{project-number-or-id}/locations/{location-id}/models/general/nmt`, - * If not provided, the default Google model (NMT) will be used for - * translation. - * - * Generated from protobuf field string model = 6 [(.google.api.field_behavior) = OPTIONAL]; - * @param string $var - * @return $this - */ - public function setModel($var) - { - GPBUtil::checkString($var, True); - $this->model = $var; - - return $this; - } - - /** - * Optional. Glossary to be applied. The glossary must be within the same - * region (have the same location-id) as the model, otherwise an - * INVALID_ARGUMENT (400) error is returned. - * - * Generated from protobuf field .google.cloud.translation.v3.TranslateTextGlossaryConfig glossary_config = 7 [(.google.api.field_behavior) = OPTIONAL]; - * @return \Google\Cloud\Translate\V3\TranslateTextGlossaryConfig|null - */ - public function getGlossaryConfig() - { - return $this->glossary_config; - } - - public function hasGlossaryConfig() - { - return isset($this->glossary_config); - } - - public function clearGlossaryConfig() - { - unset($this->glossary_config); - } - - /** - * Optional. Glossary to be applied. The glossary must be within the same - * region (have the same location-id) as the model, otherwise an - * INVALID_ARGUMENT (400) error is returned. - * - * Generated from protobuf field .google.cloud.translation.v3.TranslateTextGlossaryConfig glossary_config = 7 [(.google.api.field_behavior) = OPTIONAL]; - * @param \Google\Cloud\Translate\V3\TranslateTextGlossaryConfig $var - * @return $this - */ - public function setGlossaryConfig($var) - { - GPBUtil::checkMessage($var, \Google\Cloud\Translate\V3\TranslateTextGlossaryConfig::class); - $this->glossary_config = $var; - - return $this; - } - - /** - * Optional. The labels with user-defined metadata for the request. - * Label keys and values can be no longer than 63 characters (Unicode - * codepoints), can only contain lowercase letters, numeric characters, - * underscores and dashes. International characters are allowed. Label values - * are optional. Label keys must start with a letter. - * See https://cloud.google.com/translate/docs/advanced/labels for more - * information. - * - * Generated from protobuf field map labels = 8 [(.google.api.field_behavior) = OPTIONAL]; - * @return \Google\Protobuf\Internal\MapField - */ - public function getLabels() - { - return $this->labels; - } - - /** - * Optional. The labels with user-defined metadata for the request. - * Label keys and values can be no longer than 63 characters (Unicode - * codepoints), can only contain lowercase letters, numeric characters, - * underscores and dashes. International characters are allowed. Label values - * are optional. Label keys must start with a letter. - * See https://cloud.google.com/translate/docs/advanced/labels for more - * information. - * - * Generated from protobuf field map labels = 8 [(.google.api.field_behavior) = OPTIONAL]; - * @param array|\Google\Protobuf\Internal\MapField $var - * @return $this - */ - public function setLabels($var) - { - $arr = GPBUtil::checkMapField($var, \Google\Protobuf\Internal\GPBType::STRING, \Google\Protobuf\Internal\GPBType::STRING); - $this->labels = $arr; - - return $this; - } - - /** - * Optional. This flag is to support user customized attribution. - * If not provided, the default is `Machine Translated by Google`. - * Customized attribution should follow rules in - * https://cloud.google.com/translate/attribution#attribution_and_logos - * - * Generated from protobuf field string customized_attribution = 10 [(.google.api.field_behavior) = OPTIONAL]; - * @return string - */ - public function getCustomizedAttribution() - { - return $this->customized_attribution; - } - - /** - * Optional. This flag is to support user customized attribution. - * If not provided, the default is `Machine Translated by Google`. - * Customized attribution should follow rules in - * https://cloud.google.com/translate/attribution#attribution_and_logos - * - * Generated from protobuf field string customized_attribution = 10 [(.google.api.field_behavior) = OPTIONAL]; - * @param string $var - * @return $this - */ - public function setCustomizedAttribution($var) - { - GPBUtil::checkString($var, True); - $this->customized_attribution = $var; - - return $this; - } - - /** - * Optional. If true, the page limit of online native pdf translation is 300 - * and only native pdf pages will be translated. - * - * Generated from protobuf field bool is_translate_native_pdf_only = 11 [(.google.api.field_behavior) = OPTIONAL]; - * @return bool - */ - public function getIsTranslateNativePdfOnly() - { - return $this->is_translate_native_pdf_only; - } - - /** - * Optional. If true, the page limit of online native pdf translation is 300 - * and only native pdf pages will be translated. - * - * Generated from protobuf field bool is_translate_native_pdf_only = 11 [(.google.api.field_behavior) = OPTIONAL]; - * @param bool $var - * @return $this - */ - public function setIsTranslateNativePdfOnly($var) - { - GPBUtil::checkBool($var); - $this->is_translate_native_pdf_only = $var; - - return $this; - } - - /** - * Optional. If true, use the text removal to remove the shadow text on - * background image for native pdf translation. - * Shadow removal feature can only be enabled when - * is_translate_native_pdf_only is false - * - * Generated from protobuf field bool enable_shadow_removal_native_pdf = 12 [(.google.api.field_behavior) = OPTIONAL]; - * @return bool - */ - public function getEnableShadowRemovalNativePdf() - { - return $this->enable_shadow_removal_native_pdf; - } - - /** - * Optional. If true, use the text removal to remove the shadow text on - * background image for native pdf translation. - * Shadow removal feature can only be enabled when - * is_translate_native_pdf_only is false - * - * Generated from protobuf field bool enable_shadow_removal_native_pdf = 12 [(.google.api.field_behavior) = OPTIONAL]; - * @param bool $var - * @return $this - */ - public function setEnableShadowRemovalNativePdf($var) - { - GPBUtil::checkBool($var); - $this->enable_shadow_removal_native_pdf = $var; - - return $this; - } - -} - diff --git a/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/TranslateDocumentResponse.php b/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/TranslateDocumentResponse.php deleted file mode 100644 index cb03652f953..00000000000 --- a/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/TranslateDocumentResponse.php +++ /dev/null @@ -1,231 +0,0 @@ -google.cloud.translation.v3.TranslateDocumentResponse - */ -class TranslateDocumentResponse extends \Google\Protobuf\Internal\Message -{ - /** - * Translated document. - * - * Generated from protobuf field .google.cloud.translation.v3.DocumentTranslation document_translation = 1; - */ - protected $document_translation = null; - /** - * The document's translation output if a glossary is provided in the request. - * This can be the same as [TranslateDocumentResponse.document_translation] - * if no glossary terms apply. - * - * Generated from protobuf field .google.cloud.translation.v3.DocumentTranslation glossary_document_translation = 2; - */ - protected $glossary_document_translation = null; - /** - * Only present when 'model' is present in the request. - * 'model' is normalized to have a project number. - * For example: - * If the 'model' field in TranslateDocumentRequest is: - * `projects/{project-id}/locations/{location-id}/models/general/nmt` then - * `model` here would be normalized to - * `projects/{project-number}/locations/{location-id}/models/general/nmt`. - * - * Generated from protobuf field string model = 3; - */ - protected $model = ''; - /** - * The `glossary_config` used for this translation. - * - * Generated from protobuf field .google.cloud.translation.v3.TranslateTextGlossaryConfig glossary_config = 4; - */ - protected $glossary_config = null; - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type \Google\Cloud\Translate\V3\DocumentTranslation $document_translation - * Translated document. - * @type \Google\Cloud\Translate\V3\DocumentTranslation $glossary_document_translation - * The document's translation output if a glossary is provided in the request. - * This can be the same as [TranslateDocumentResponse.document_translation] - * if no glossary terms apply. - * @type string $model - * Only present when 'model' is present in the request. - * 'model' is normalized to have a project number. - * For example: - * If the 'model' field in TranslateDocumentRequest is: - * `projects/{project-id}/locations/{location-id}/models/general/nmt` then - * `model` here would be normalized to - * `projects/{project-number}/locations/{location-id}/models/general/nmt`. - * @type \Google\Cloud\Translate\V3\TranslateTextGlossaryConfig $glossary_config - * The `glossary_config` used for this translation. - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Cloud\Translate\V3\TranslationService::initOnce(); - parent::__construct($data); - } - - /** - * Translated document. - * - * Generated from protobuf field .google.cloud.translation.v3.DocumentTranslation document_translation = 1; - * @return \Google\Cloud\Translate\V3\DocumentTranslation|null - */ - public function getDocumentTranslation() - { - return $this->document_translation; - } - - public function hasDocumentTranslation() - { - return isset($this->document_translation); - } - - public function clearDocumentTranslation() - { - unset($this->document_translation); - } - - /** - * Translated document. - * - * Generated from protobuf field .google.cloud.translation.v3.DocumentTranslation document_translation = 1; - * @param \Google\Cloud\Translate\V3\DocumentTranslation $var - * @return $this - */ - public function setDocumentTranslation($var) - { - GPBUtil::checkMessage($var, \Google\Cloud\Translate\V3\DocumentTranslation::class); - $this->document_translation = $var; - - return $this; - } - - /** - * The document's translation output if a glossary is provided in the request. - * This can be the same as [TranslateDocumentResponse.document_translation] - * if no glossary terms apply. - * - * Generated from protobuf field .google.cloud.translation.v3.DocumentTranslation glossary_document_translation = 2; - * @return \Google\Cloud\Translate\V3\DocumentTranslation|null - */ - public function getGlossaryDocumentTranslation() - { - return $this->glossary_document_translation; - } - - public function hasGlossaryDocumentTranslation() - { - return isset($this->glossary_document_translation); - } - - public function clearGlossaryDocumentTranslation() - { - unset($this->glossary_document_translation); - } - - /** - * The document's translation output if a glossary is provided in the request. - * This can be the same as [TranslateDocumentResponse.document_translation] - * if no glossary terms apply. - * - * Generated from protobuf field .google.cloud.translation.v3.DocumentTranslation glossary_document_translation = 2; - * @param \Google\Cloud\Translate\V3\DocumentTranslation $var - * @return $this - */ - public function setGlossaryDocumentTranslation($var) - { - GPBUtil::checkMessage($var, \Google\Cloud\Translate\V3\DocumentTranslation::class); - $this->glossary_document_translation = $var; - - return $this; - } - - /** - * Only present when 'model' is present in the request. - * 'model' is normalized to have a project number. - * For example: - * If the 'model' field in TranslateDocumentRequest is: - * `projects/{project-id}/locations/{location-id}/models/general/nmt` then - * `model` here would be normalized to - * `projects/{project-number}/locations/{location-id}/models/general/nmt`. - * - * Generated from protobuf field string model = 3; - * @return string - */ - public function getModel() - { - return $this->model; - } - - /** - * Only present when 'model' is present in the request. - * 'model' is normalized to have a project number. - * For example: - * If the 'model' field in TranslateDocumentRequest is: - * `projects/{project-id}/locations/{location-id}/models/general/nmt` then - * `model` here would be normalized to - * `projects/{project-number}/locations/{location-id}/models/general/nmt`. - * - * Generated from protobuf field string model = 3; - * @param string $var - * @return $this - */ - public function setModel($var) - { - GPBUtil::checkString($var, True); - $this->model = $var; - - return $this; - } - - /** - * The `glossary_config` used for this translation. - * - * Generated from protobuf field .google.cloud.translation.v3.TranslateTextGlossaryConfig glossary_config = 4; - * @return \Google\Cloud\Translate\V3\TranslateTextGlossaryConfig|null - */ - public function getGlossaryConfig() - { - return $this->glossary_config; - } - - public function hasGlossaryConfig() - { - return isset($this->glossary_config); - } - - public function clearGlossaryConfig() - { - unset($this->glossary_config); - } - - /** - * The `glossary_config` used for this translation. - * - * Generated from protobuf field .google.cloud.translation.v3.TranslateTextGlossaryConfig glossary_config = 4; - * @param \Google\Cloud\Translate\V3\TranslateTextGlossaryConfig $var - * @return $this - */ - public function setGlossaryConfig($var) - { - GPBUtil::checkMessage($var, \Google\Cloud\Translate\V3\TranslateTextGlossaryConfig::class); - $this->glossary_config = $var; - - return $this; - } - -} - diff --git a/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/TranslateTextGlossaryConfig.php b/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/TranslateTextGlossaryConfig.php deleted file mode 100644 index c4d90ab49b1..00000000000 --- a/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/TranslateTextGlossaryConfig.php +++ /dev/null @@ -1,118 +0,0 @@ -google.cloud.translation.v3.TranslateTextGlossaryConfig - */ -class TranslateTextGlossaryConfig extends \Google\Protobuf\Internal\Message -{ - /** - * Required. The `glossary` to be applied for this translation. - * The format depends on the glossary: - * - User-provided custom glossary: - * `projects/{project-number-or-id}/locations/{location-id}/glossaries/{glossary-id}` - * - * Generated from protobuf field string glossary = 1 [(.google.api.field_behavior) = REQUIRED]; - */ - protected $glossary = ''; - /** - * Optional. Indicates match is case insensitive. The default value is `false` - * if missing. - * - * Generated from protobuf field bool ignore_case = 2 [(.google.api.field_behavior) = OPTIONAL]; - */ - protected $ignore_case = false; - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type string $glossary - * Required. The `glossary` to be applied for this translation. - * The format depends on the glossary: - * - User-provided custom glossary: - * `projects/{project-number-or-id}/locations/{location-id}/glossaries/{glossary-id}` - * @type bool $ignore_case - * Optional. Indicates match is case insensitive. The default value is `false` - * if missing. - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Cloud\Translate\V3\TranslationService::initOnce(); - parent::__construct($data); - } - - /** - * Required. The `glossary` to be applied for this translation. - * The format depends on the glossary: - * - User-provided custom glossary: - * `projects/{project-number-or-id}/locations/{location-id}/glossaries/{glossary-id}` - * - * Generated from protobuf field string glossary = 1 [(.google.api.field_behavior) = REQUIRED]; - * @return string - */ - public function getGlossary() - { - return $this->glossary; - } - - /** - * Required. The `glossary` to be applied for this translation. - * The format depends on the glossary: - * - User-provided custom glossary: - * `projects/{project-number-or-id}/locations/{location-id}/glossaries/{glossary-id}` - * - * Generated from protobuf field string glossary = 1 [(.google.api.field_behavior) = REQUIRED]; - * @param string $var - * @return $this - */ - public function setGlossary($var) - { - GPBUtil::checkString($var, True); - $this->glossary = $var; - - return $this; - } - - /** - * Optional. Indicates match is case insensitive. The default value is `false` - * if missing. - * - * Generated from protobuf field bool ignore_case = 2 [(.google.api.field_behavior) = OPTIONAL]; - * @return bool - */ - public function getIgnoreCase() - { - return $this->ignore_case; - } - - /** - * Optional. Indicates match is case insensitive. The default value is `false` - * if missing. - * - * Generated from protobuf field bool ignore_case = 2 [(.google.api.field_behavior) = OPTIONAL]; - * @param bool $var - * @return $this - */ - public function setIgnoreCase($var) - { - GPBUtil::checkBool($var); - $this->ignore_case = $var; - - return $this; - } - -} - diff --git a/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/TranslateTextRequest.php b/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/TranslateTextRequest.php deleted file mode 100644 index 4cff39bc49f..00000000000 --- a/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/TranslateTextRequest.php +++ /dev/null @@ -1,451 +0,0 @@ -google.cloud.translation.v3.TranslateTextRequest - */ -class TranslateTextRequest extends \Google\Protobuf\Internal\Message -{ - /** - * Required. The content of the input in string format. - * We recommend the total content be less than 30,000 codepoints. The max - * length of this field is 1024. Use BatchTranslateText for larger text. - * - * Generated from protobuf field repeated string contents = 1 [(.google.api.field_behavior) = REQUIRED]; - */ - private $contents; - /** - * Optional. The format of the source text, for example, "text/html", - * "text/plain". If left blank, the MIME type defaults to "text/html". - * - * Generated from protobuf field string mime_type = 3 [(.google.api.field_behavior) = OPTIONAL]; - */ - protected $mime_type = ''; - /** - * Optional. The ISO-639 language code of the input text if - * known, for example, "en-US" or "sr-Latn". Supported language codes are - * listed in Language Support. If the source language isn't specified, the API - * attempts to identify the source language automatically and returns the - * source language within the response. - * - * Generated from protobuf field string source_language_code = 4 [(.google.api.field_behavior) = OPTIONAL]; - */ - protected $source_language_code = ''; - /** - * Required. The ISO-639 language code to use for translation of the input - * text, set to one of the language codes listed in Language Support. - * - * Generated from protobuf field string target_language_code = 5 [(.google.api.field_behavior) = REQUIRED]; - */ - protected $target_language_code = ''; - /** - * Required. Project or location to make a call. Must refer to a caller's - * project. - * Format: `projects/{project-number-or-id}` or - * `projects/{project-number-or-id}/locations/{location-id}`. - * For global calls, use `projects/{project-number-or-id}/locations/global` or - * `projects/{project-number-or-id}`. - * Non-global location is required for requests using AutoML models or - * custom glossaries. - * Models and glossaries must be within the same region (have same - * location-id), otherwise an INVALID_ARGUMENT (400) error is returned. - * - * Generated from protobuf field string parent = 8 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { - */ - protected $parent = ''; - /** - * Optional. The `model` type requested for this translation. - * The format depends on model type: - * - AutoML Translation models: - * `projects/{project-number-or-id}/locations/{location-id}/models/{model-id}` - * - General (built-in) models: - * `projects/{project-number-or-id}/locations/{location-id}/models/general/nmt`, - * For global (non-regionalized) requests, use `location-id` `global`. - * For example, - * `projects/{project-number-or-id}/locations/global/models/general/nmt`. - * If not provided, the default Google model (NMT) will be used. - * - * Generated from protobuf field string model = 6 [(.google.api.field_behavior) = OPTIONAL]; - */ - protected $model = ''; - /** - * Optional. Glossary to be applied. The glossary must be - * within the same region (have the same location-id) as the model, otherwise - * an INVALID_ARGUMENT (400) error is returned. - * - * Generated from protobuf field .google.cloud.translation.v3.TranslateTextGlossaryConfig glossary_config = 7 [(.google.api.field_behavior) = OPTIONAL]; - */ - protected $glossary_config = null; - /** - * Optional. The labels with user-defined metadata for the request. - * Label keys and values can be no longer than 63 characters - * (Unicode codepoints), can only contain lowercase letters, numeric - * characters, underscores and dashes. International characters are allowed. - * Label values are optional. Label keys must start with a letter. - * See https://cloud.google.com/translate/docs/advanced/labels for more - * information. - * - * Generated from protobuf field map labels = 10 [(.google.api.field_behavior) = OPTIONAL]; - */ - private $labels; - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type array|\Google\Protobuf\Internal\RepeatedField $contents - * Required. The content of the input in string format. - * We recommend the total content be less than 30,000 codepoints. The max - * length of this field is 1024. Use BatchTranslateText for larger text. - * @type string $mime_type - * Optional. The format of the source text, for example, "text/html", - * "text/plain". If left blank, the MIME type defaults to "text/html". - * @type string $source_language_code - * Optional. The ISO-639 language code of the input text if - * known, for example, "en-US" or "sr-Latn". Supported language codes are - * listed in Language Support. If the source language isn't specified, the API - * attempts to identify the source language automatically and returns the - * source language within the response. - * @type string $target_language_code - * Required. The ISO-639 language code to use for translation of the input - * text, set to one of the language codes listed in Language Support. - * @type string $parent - * Required. Project or location to make a call. Must refer to a caller's - * project. - * Format: `projects/{project-number-or-id}` or - * `projects/{project-number-or-id}/locations/{location-id}`. - * For global calls, use `projects/{project-number-or-id}/locations/global` or - * `projects/{project-number-or-id}`. - * Non-global location is required for requests using AutoML models or - * custom glossaries. - * Models and glossaries must be within the same region (have same - * location-id), otherwise an INVALID_ARGUMENT (400) error is returned. - * @type string $model - * Optional. The `model` type requested for this translation. - * The format depends on model type: - * - AutoML Translation models: - * `projects/{project-number-or-id}/locations/{location-id}/models/{model-id}` - * - General (built-in) models: - * `projects/{project-number-or-id}/locations/{location-id}/models/general/nmt`, - * For global (non-regionalized) requests, use `location-id` `global`. - * For example, - * `projects/{project-number-or-id}/locations/global/models/general/nmt`. - * If not provided, the default Google model (NMT) will be used. - * @type \Google\Cloud\Translate\V3\TranslateTextGlossaryConfig $glossary_config - * Optional. Glossary to be applied. The glossary must be - * within the same region (have the same location-id) as the model, otherwise - * an INVALID_ARGUMENT (400) error is returned. - * @type array|\Google\Protobuf\Internal\MapField $labels - * Optional. The labels with user-defined metadata for the request. - * Label keys and values can be no longer than 63 characters - * (Unicode codepoints), can only contain lowercase letters, numeric - * characters, underscores and dashes. International characters are allowed. - * Label values are optional. Label keys must start with a letter. - * See https://cloud.google.com/translate/docs/advanced/labels for more - * information. - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Cloud\Translate\V3\TranslationService::initOnce(); - parent::__construct($data); - } - - /** - * Required. The content of the input in string format. - * We recommend the total content be less than 30,000 codepoints. The max - * length of this field is 1024. Use BatchTranslateText for larger text. - * - * Generated from protobuf field repeated string contents = 1 [(.google.api.field_behavior) = REQUIRED]; - * @return \Google\Protobuf\Internal\RepeatedField - */ - public function getContents() - { - return $this->contents; - } - - /** - * Required. The content of the input in string format. - * We recommend the total content be less than 30,000 codepoints. The max - * length of this field is 1024. Use BatchTranslateText for larger text. - * - * Generated from protobuf field repeated string contents = 1 [(.google.api.field_behavior) = REQUIRED]; - * @param array|\Google\Protobuf\Internal\RepeatedField $var - * @return $this - */ - public function setContents($var) - { - $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); - $this->contents = $arr; - - return $this; - } - - /** - * Optional. The format of the source text, for example, "text/html", - * "text/plain". If left blank, the MIME type defaults to "text/html". - * - * Generated from protobuf field string mime_type = 3 [(.google.api.field_behavior) = OPTIONAL]; - * @return string - */ - public function getMimeType() - { - return $this->mime_type; - } - - /** - * Optional. The format of the source text, for example, "text/html", - * "text/plain". If left blank, the MIME type defaults to "text/html". - * - * Generated from protobuf field string mime_type = 3 [(.google.api.field_behavior) = OPTIONAL]; - * @param string $var - * @return $this - */ - public function setMimeType($var) - { - GPBUtil::checkString($var, True); - $this->mime_type = $var; - - return $this; - } - - /** - * Optional. The ISO-639 language code of the input text if - * known, for example, "en-US" or "sr-Latn". Supported language codes are - * listed in Language Support. If the source language isn't specified, the API - * attempts to identify the source language automatically and returns the - * source language within the response. - * - * Generated from protobuf field string source_language_code = 4 [(.google.api.field_behavior) = OPTIONAL]; - * @return string - */ - public function getSourceLanguageCode() - { - return $this->source_language_code; - } - - /** - * Optional. The ISO-639 language code of the input text if - * known, for example, "en-US" or "sr-Latn". Supported language codes are - * listed in Language Support. If the source language isn't specified, the API - * attempts to identify the source language automatically and returns the - * source language within the response. - * - * Generated from protobuf field string source_language_code = 4 [(.google.api.field_behavior) = OPTIONAL]; - * @param string $var - * @return $this - */ - public function setSourceLanguageCode($var) - { - GPBUtil::checkString($var, True); - $this->source_language_code = $var; - - return $this; - } - - /** - * Required. The ISO-639 language code to use for translation of the input - * text, set to one of the language codes listed in Language Support. - * - * Generated from protobuf field string target_language_code = 5 [(.google.api.field_behavior) = REQUIRED]; - * @return string - */ - public function getTargetLanguageCode() - { - return $this->target_language_code; - } - - /** - * Required. The ISO-639 language code to use for translation of the input - * text, set to one of the language codes listed in Language Support. - * - * Generated from protobuf field string target_language_code = 5 [(.google.api.field_behavior) = REQUIRED]; - * @param string $var - * @return $this - */ - public function setTargetLanguageCode($var) - { - GPBUtil::checkString($var, True); - $this->target_language_code = $var; - - return $this; - } - - /** - * Required. Project or location to make a call. Must refer to a caller's - * project. - * Format: `projects/{project-number-or-id}` or - * `projects/{project-number-or-id}/locations/{location-id}`. - * For global calls, use `projects/{project-number-or-id}/locations/global` or - * `projects/{project-number-or-id}`. - * Non-global location is required for requests using AutoML models or - * custom glossaries. - * Models and glossaries must be within the same region (have same - * location-id), otherwise an INVALID_ARGUMENT (400) error is returned. - * - * Generated from protobuf field string parent = 8 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { - * @return string - */ - public function getParent() - { - return $this->parent; - } - - /** - * Required. Project or location to make a call. Must refer to a caller's - * project. - * Format: `projects/{project-number-or-id}` or - * `projects/{project-number-or-id}/locations/{location-id}`. - * For global calls, use `projects/{project-number-or-id}/locations/global` or - * `projects/{project-number-or-id}`. - * Non-global location is required for requests using AutoML models or - * custom glossaries. - * Models and glossaries must be within the same region (have same - * location-id), otherwise an INVALID_ARGUMENT (400) error is returned. - * - * Generated from protobuf field string parent = 8 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { - * @param string $var - * @return $this - */ - public function setParent($var) - { - GPBUtil::checkString($var, True); - $this->parent = $var; - - return $this; - } - - /** - * Optional. The `model` type requested for this translation. - * The format depends on model type: - * - AutoML Translation models: - * `projects/{project-number-or-id}/locations/{location-id}/models/{model-id}` - * - General (built-in) models: - * `projects/{project-number-or-id}/locations/{location-id}/models/general/nmt`, - * For global (non-regionalized) requests, use `location-id` `global`. - * For example, - * `projects/{project-number-or-id}/locations/global/models/general/nmt`. - * If not provided, the default Google model (NMT) will be used. - * - * Generated from protobuf field string model = 6 [(.google.api.field_behavior) = OPTIONAL]; - * @return string - */ - public function getModel() - { - return $this->model; - } - - /** - * Optional. The `model` type requested for this translation. - * The format depends on model type: - * - AutoML Translation models: - * `projects/{project-number-or-id}/locations/{location-id}/models/{model-id}` - * - General (built-in) models: - * `projects/{project-number-or-id}/locations/{location-id}/models/general/nmt`, - * For global (non-regionalized) requests, use `location-id` `global`. - * For example, - * `projects/{project-number-or-id}/locations/global/models/general/nmt`. - * If not provided, the default Google model (NMT) will be used. - * - * Generated from protobuf field string model = 6 [(.google.api.field_behavior) = OPTIONAL]; - * @param string $var - * @return $this - */ - public function setModel($var) - { - GPBUtil::checkString($var, True); - $this->model = $var; - - return $this; - } - - /** - * Optional. Glossary to be applied. The glossary must be - * within the same region (have the same location-id) as the model, otherwise - * an INVALID_ARGUMENT (400) error is returned. - * - * Generated from protobuf field .google.cloud.translation.v3.TranslateTextGlossaryConfig glossary_config = 7 [(.google.api.field_behavior) = OPTIONAL]; - * @return \Google\Cloud\Translate\V3\TranslateTextGlossaryConfig|null - */ - public function getGlossaryConfig() - { - return $this->glossary_config; - } - - public function hasGlossaryConfig() - { - return isset($this->glossary_config); - } - - public function clearGlossaryConfig() - { - unset($this->glossary_config); - } - - /** - * Optional. Glossary to be applied. The glossary must be - * within the same region (have the same location-id) as the model, otherwise - * an INVALID_ARGUMENT (400) error is returned. - * - * Generated from protobuf field .google.cloud.translation.v3.TranslateTextGlossaryConfig glossary_config = 7 [(.google.api.field_behavior) = OPTIONAL]; - * @param \Google\Cloud\Translate\V3\TranslateTextGlossaryConfig $var - * @return $this - */ - public function setGlossaryConfig($var) - { - GPBUtil::checkMessage($var, \Google\Cloud\Translate\V3\TranslateTextGlossaryConfig::class); - $this->glossary_config = $var; - - return $this; - } - - /** - * Optional. The labels with user-defined metadata for the request. - * Label keys and values can be no longer than 63 characters - * (Unicode codepoints), can only contain lowercase letters, numeric - * characters, underscores and dashes. International characters are allowed. - * Label values are optional. Label keys must start with a letter. - * See https://cloud.google.com/translate/docs/advanced/labels for more - * information. - * - * Generated from protobuf field map labels = 10 [(.google.api.field_behavior) = OPTIONAL]; - * @return \Google\Protobuf\Internal\MapField - */ - public function getLabels() - { - return $this->labels; - } - - /** - * Optional. The labels with user-defined metadata for the request. - * Label keys and values can be no longer than 63 characters - * (Unicode codepoints), can only contain lowercase letters, numeric - * characters, underscores and dashes. International characters are allowed. - * Label values are optional. Label keys must start with a letter. - * See https://cloud.google.com/translate/docs/advanced/labels for more - * information. - * - * Generated from protobuf field map labels = 10 [(.google.api.field_behavior) = OPTIONAL]; - * @param array|\Google\Protobuf\Internal\MapField $var - * @return $this - */ - public function setLabels($var) - { - $arr = GPBUtil::checkMapField($var, \Google\Protobuf\Internal\GPBType::STRING, \Google\Protobuf\Internal\GPBType::STRING); - $this->labels = $arr; - - return $this; - } - -} - diff --git a/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/TranslateTextResponse.php b/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/TranslateTextResponse.php deleted file mode 100644 index 421453b6959..00000000000 --- a/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/TranslateTextResponse.php +++ /dev/null @@ -1,123 +0,0 @@ -google.cloud.translation.v3.TranslateTextResponse - */ -class TranslateTextResponse extends \Google\Protobuf\Internal\Message -{ - /** - * Text translation responses with no glossary applied. - * This field has the same length as - * [`contents`][google.cloud.translation.v3.TranslateTextRequest.contents]. - * - * Generated from protobuf field repeated .google.cloud.translation.v3.Translation translations = 1; - */ - private $translations; - /** - * Text translation responses if a glossary is provided in the request. - * This can be the same as - * [`translations`][google.cloud.translation.v3.TranslateTextResponse.translations] - * if no terms apply. This field has the same length as - * [`contents`][google.cloud.translation.v3.TranslateTextRequest.contents]. - * - * Generated from protobuf field repeated .google.cloud.translation.v3.Translation glossary_translations = 3; - */ - private $glossary_translations; - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type array<\Google\Cloud\Translate\V3\Translation>|\Google\Protobuf\Internal\RepeatedField $translations - * Text translation responses with no glossary applied. - * This field has the same length as - * [`contents`][google.cloud.translation.v3.TranslateTextRequest.contents]. - * @type array<\Google\Cloud\Translate\V3\Translation>|\Google\Protobuf\Internal\RepeatedField $glossary_translations - * Text translation responses if a glossary is provided in the request. - * This can be the same as - * [`translations`][google.cloud.translation.v3.TranslateTextResponse.translations] - * if no terms apply. This field has the same length as - * [`contents`][google.cloud.translation.v3.TranslateTextRequest.contents]. - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Cloud\Translate\V3\TranslationService::initOnce(); - parent::__construct($data); - } - - /** - * Text translation responses with no glossary applied. - * This field has the same length as - * [`contents`][google.cloud.translation.v3.TranslateTextRequest.contents]. - * - * Generated from protobuf field repeated .google.cloud.translation.v3.Translation translations = 1; - * @return \Google\Protobuf\Internal\RepeatedField - */ - public function getTranslations() - { - return $this->translations; - } - - /** - * Text translation responses with no glossary applied. - * This field has the same length as - * [`contents`][google.cloud.translation.v3.TranslateTextRequest.contents]. - * - * Generated from protobuf field repeated .google.cloud.translation.v3.Translation translations = 1; - * @param array<\Google\Cloud\Translate\V3\Translation>|\Google\Protobuf\Internal\RepeatedField $var - * @return $this - */ - public function setTranslations($var) - { - $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Translate\V3\Translation::class); - $this->translations = $arr; - - return $this; - } - - /** - * Text translation responses if a glossary is provided in the request. - * This can be the same as - * [`translations`][google.cloud.translation.v3.TranslateTextResponse.translations] - * if no terms apply. This field has the same length as - * [`contents`][google.cloud.translation.v3.TranslateTextRequest.contents]. - * - * Generated from protobuf field repeated .google.cloud.translation.v3.Translation glossary_translations = 3; - * @return \Google\Protobuf\Internal\RepeatedField - */ - public function getGlossaryTranslations() - { - return $this->glossary_translations; - } - - /** - * Text translation responses if a glossary is provided in the request. - * This can be the same as - * [`translations`][google.cloud.translation.v3.TranslateTextResponse.translations] - * if no terms apply. This field has the same length as - * [`contents`][google.cloud.translation.v3.TranslateTextRequest.contents]. - * - * Generated from protobuf field repeated .google.cloud.translation.v3.Translation glossary_translations = 3; - * @param array<\Google\Cloud\Translate\V3\Translation>|\Google\Protobuf\Internal\RepeatedField $var - * @return $this - */ - public function setGlossaryTranslations($var) - { - $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Translate\V3\Translation::class); - $this->glossary_translations = $arr; - - return $this; - } - -} - diff --git a/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/Translation.php b/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/Translation.php deleted file mode 100644 index f57fa9baac7..00000000000 --- a/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/Translation.php +++ /dev/null @@ -1,223 +0,0 @@ -google.cloud.translation.v3.Translation - */ -class Translation extends \Google\Protobuf\Internal\Message -{ - /** - * Text translated into the target language. - * If an error occurs during translation, this field might be excluded from - * the response. - * - * Generated from protobuf field string translated_text = 1; - */ - protected $translated_text = ''; - /** - * Only present when `model` is present in the request. - * `model` here is normalized to have project number. - * For example: - * If the `model` requested in TranslationTextRequest is - * `projects/{project-id}/locations/{location-id}/models/general/nmt` then - * `model` here would be normalized to - * `projects/{project-number}/locations/{location-id}/models/general/nmt`. - * - * Generated from protobuf field string model = 2; - */ - protected $model = ''; - /** - * The ISO-639 language code of source text in the initial request, detected - * automatically, if no source language was passed within the initial - * request. If the source language was passed, auto-detection of the language - * does not occur and this field is empty. - * - * Generated from protobuf field string detected_language_code = 4; - */ - protected $detected_language_code = ''; - /** - * The `glossary_config` used for this translation. - * - * Generated from protobuf field .google.cloud.translation.v3.TranslateTextGlossaryConfig glossary_config = 3; - */ - protected $glossary_config = null; - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type string $translated_text - * Text translated into the target language. - * If an error occurs during translation, this field might be excluded from - * the response. - * @type string $model - * Only present when `model` is present in the request. - * `model` here is normalized to have project number. - * For example: - * If the `model` requested in TranslationTextRequest is - * `projects/{project-id}/locations/{location-id}/models/general/nmt` then - * `model` here would be normalized to - * `projects/{project-number}/locations/{location-id}/models/general/nmt`. - * @type string $detected_language_code - * The ISO-639 language code of source text in the initial request, detected - * automatically, if no source language was passed within the initial - * request. If the source language was passed, auto-detection of the language - * does not occur and this field is empty. - * @type \Google\Cloud\Translate\V3\TranslateTextGlossaryConfig $glossary_config - * The `glossary_config` used for this translation. - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Cloud\Translate\V3\TranslationService::initOnce(); - parent::__construct($data); - } - - /** - * Text translated into the target language. - * If an error occurs during translation, this field might be excluded from - * the response. - * - * Generated from protobuf field string translated_text = 1; - * @return string - */ - public function getTranslatedText() - { - return $this->translated_text; - } - - /** - * Text translated into the target language. - * If an error occurs during translation, this field might be excluded from - * the response. - * - * Generated from protobuf field string translated_text = 1; - * @param string $var - * @return $this - */ - public function setTranslatedText($var) - { - GPBUtil::checkString($var, True); - $this->translated_text = $var; - - return $this; - } - - /** - * Only present when `model` is present in the request. - * `model` here is normalized to have project number. - * For example: - * If the `model` requested in TranslationTextRequest is - * `projects/{project-id}/locations/{location-id}/models/general/nmt` then - * `model` here would be normalized to - * `projects/{project-number}/locations/{location-id}/models/general/nmt`. - * - * Generated from protobuf field string model = 2; - * @return string - */ - public function getModel() - { - return $this->model; - } - - /** - * Only present when `model` is present in the request. - * `model` here is normalized to have project number. - * For example: - * If the `model` requested in TranslationTextRequest is - * `projects/{project-id}/locations/{location-id}/models/general/nmt` then - * `model` here would be normalized to - * `projects/{project-number}/locations/{location-id}/models/general/nmt`. - * - * Generated from protobuf field string model = 2; - * @param string $var - * @return $this - */ - public function setModel($var) - { - GPBUtil::checkString($var, True); - $this->model = $var; - - return $this; - } - - /** - * The ISO-639 language code of source text in the initial request, detected - * automatically, if no source language was passed within the initial - * request. If the source language was passed, auto-detection of the language - * does not occur and this field is empty. - * - * Generated from protobuf field string detected_language_code = 4; - * @return string - */ - public function getDetectedLanguageCode() - { - return $this->detected_language_code; - } - - /** - * The ISO-639 language code of source text in the initial request, detected - * automatically, if no source language was passed within the initial - * request. If the source language was passed, auto-detection of the language - * does not occur and this field is empty. - * - * Generated from protobuf field string detected_language_code = 4; - * @param string $var - * @return $this - */ - public function setDetectedLanguageCode($var) - { - GPBUtil::checkString($var, True); - $this->detected_language_code = $var; - - return $this; - } - - /** - * The `glossary_config` used for this translation. - * - * Generated from protobuf field .google.cloud.translation.v3.TranslateTextGlossaryConfig glossary_config = 3; - * @return \Google\Cloud\Translate\V3\TranslateTextGlossaryConfig|null - */ - public function getGlossaryConfig() - { - return $this->glossary_config; - } - - public function hasGlossaryConfig() - { - return isset($this->glossary_config); - } - - public function clearGlossaryConfig() - { - unset($this->glossary_config); - } - - /** - * The `glossary_config` used for this translation. - * - * Generated from protobuf field .google.cloud.translation.v3.TranslateTextGlossaryConfig glossary_config = 3; - * @param \Google\Cloud\Translate\V3\TranslateTextGlossaryConfig $var - * @return $this - */ - public function setGlossaryConfig($var) - { - GPBUtil::checkMessage($var, \Google\Cloud\Translate\V3\TranslateTextGlossaryConfig::class); - $this->glossary_config = $var; - - return $this; - } - -} - diff --git a/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/TranslationServiceGrpcClient.php b/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/TranslationServiceGrpcClient.php deleted file mode 100644 index 26ea28e2549..00000000000 --- a/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/TranslationServiceGrpcClient.php +++ /dev/null @@ -1,204 +0,0 @@ -_simpleRequest('/google.cloud.translation.v3.TranslationService/TranslateText', - $argument, - ['\Google\Cloud\Translate\V3\TranslateTextResponse', 'decode'], - $metadata, $options); - } - - /** - * Detects the language of text within a request. - * @param \Google\Cloud\Translate\V3\DetectLanguageRequest $argument input argument - * @param array $metadata metadata - * @param array $options call options - * @return \Grpc\UnaryCall - */ - public function DetectLanguage(\Google\Cloud\Translate\V3\DetectLanguageRequest $argument, - $metadata = [], $options = []) { - return $this->_simpleRequest('/google.cloud.translation.v3.TranslationService/DetectLanguage', - $argument, - ['\Google\Cloud\Translate\V3\DetectLanguageResponse', 'decode'], - $metadata, $options); - } - - /** - * Returns a list of supported languages for translation. - * @param \Google\Cloud\Translate\V3\GetSupportedLanguagesRequest $argument input argument - * @param array $metadata metadata - * @param array $options call options - * @return \Grpc\UnaryCall - */ - public function GetSupportedLanguages(\Google\Cloud\Translate\V3\GetSupportedLanguagesRequest $argument, - $metadata = [], $options = []) { - return $this->_simpleRequest('/google.cloud.translation.v3.TranslationService/GetSupportedLanguages', - $argument, - ['\Google\Cloud\Translate\V3\SupportedLanguages', 'decode'], - $metadata, $options); - } - - /** - * Translates documents in synchronous mode. - * @param \Google\Cloud\Translate\V3\TranslateDocumentRequest $argument input argument - * @param array $metadata metadata - * @param array $options call options - * @return \Grpc\UnaryCall - */ - public function TranslateDocument(\Google\Cloud\Translate\V3\TranslateDocumentRequest $argument, - $metadata = [], $options = []) { - return $this->_simpleRequest('/google.cloud.translation.v3.TranslationService/TranslateDocument', - $argument, - ['\Google\Cloud\Translate\V3\TranslateDocumentResponse', 'decode'], - $metadata, $options); - } - - /** - * Translates a large volume of text in asynchronous batch mode. - * This function provides real-time output as the inputs are being processed. - * If caller cancels a request, the partial results (for an input file, it's - * all or nothing) may still be available on the specified output location. - * - * This call returns immediately and you can - * use google.longrunning.Operation.name to poll the status of the call. - * @param \Google\Cloud\Translate\V3\BatchTranslateTextRequest $argument input argument - * @param array $metadata metadata - * @param array $options call options - * @return \Grpc\UnaryCall - */ - public function BatchTranslateText(\Google\Cloud\Translate\V3\BatchTranslateTextRequest $argument, - $metadata = [], $options = []) { - return $this->_simpleRequest('/google.cloud.translation.v3.TranslationService/BatchTranslateText', - $argument, - ['\Google\LongRunning\Operation', 'decode'], - $metadata, $options); - } - - /** - * Translates a large volume of document in asynchronous batch mode. - * This function provides real-time output as the inputs are being processed. - * If caller cancels a request, the partial results (for an input file, it's - * all or nothing) may still be available on the specified output location. - * - * This call returns immediately and you can use - * google.longrunning.Operation.name to poll the status of the call. - * @param \Google\Cloud\Translate\V3\BatchTranslateDocumentRequest $argument input argument - * @param array $metadata metadata - * @param array $options call options - * @return \Grpc\UnaryCall - */ - public function BatchTranslateDocument(\Google\Cloud\Translate\V3\BatchTranslateDocumentRequest $argument, - $metadata = [], $options = []) { - return $this->_simpleRequest('/google.cloud.translation.v3.TranslationService/BatchTranslateDocument', - $argument, - ['\Google\LongRunning\Operation', 'decode'], - $metadata, $options); - } - - /** - * Creates a glossary and returns the long-running operation. Returns - * NOT_FOUND, if the project doesn't exist. - * @param \Google\Cloud\Translate\V3\CreateGlossaryRequest $argument input argument - * @param array $metadata metadata - * @param array $options call options - * @return \Grpc\UnaryCall - */ - public function CreateGlossary(\Google\Cloud\Translate\V3\CreateGlossaryRequest $argument, - $metadata = [], $options = []) { - return $this->_simpleRequest('/google.cloud.translation.v3.TranslationService/CreateGlossary', - $argument, - ['\Google\LongRunning\Operation', 'decode'], - $metadata, $options); - } - - /** - * Lists glossaries in a project. Returns NOT_FOUND, if the project doesn't - * exist. - * @param \Google\Cloud\Translate\V3\ListGlossariesRequest $argument input argument - * @param array $metadata metadata - * @param array $options call options - * @return \Grpc\UnaryCall - */ - public function ListGlossaries(\Google\Cloud\Translate\V3\ListGlossariesRequest $argument, - $metadata = [], $options = []) { - return $this->_simpleRequest('/google.cloud.translation.v3.TranslationService/ListGlossaries', - $argument, - ['\Google\Cloud\Translate\V3\ListGlossariesResponse', 'decode'], - $metadata, $options); - } - - /** - * Gets a glossary. Returns NOT_FOUND, if the glossary doesn't - * exist. - * @param \Google\Cloud\Translate\V3\GetGlossaryRequest $argument input argument - * @param array $metadata metadata - * @param array $options call options - * @return \Grpc\UnaryCall - */ - public function GetGlossary(\Google\Cloud\Translate\V3\GetGlossaryRequest $argument, - $metadata = [], $options = []) { - return $this->_simpleRequest('/google.cloud.translation.v3.TranslationService/GetGlossary', - $argument, - ['\Google\Cloud\Translate\V3\Glossary', 'decode'], - $metadata, $options); - } - - /** - * Deletes a glossary, or cancels glossary construction - * if the glossary isn't created yet. - * Returns NOT_FOUND, if the glossary doesn't exist. - * @param \Google\Cloud\Translate\V3\DeleteGlossaryRequest $argument input argument - * @param array $metadata metadata - * @param array $options call options - * @return \Grpc\UnaryCall - */ - public function DeleteGlossary(\Google\Cloud\Translate\V3\DeleteGlossaryRequest $argument, - $metadata = [], $options = []) { - return $this->_simpleRequest('/google.cloud.translation.v3.TranslationService/DeleteGlossary', - $argument, - ['\Google\LongRunning\Operation', 'decode'], - $metadata, $options); - } - -} diff --git a/owl-bot-staging/Translate/v3/samples/V3/TranslationServiceClient/batch_translate_document.php b/owl-bot-staging/Translate/v3/samples/V3/TranslationServiceClient/batch_translate_document.php deleted file mode 100644 index a4ce7fbe8a3..00000000000 --- a/owl-bot-staging/Translate/v3/samples/V3/TranslationServiceClient/batch_translate_document.php +++ /dev/null @@ -1,115 +0,0 @@ -batchTranslateDocument( - $formattedParent, - $sourceLanguageCode, - $targetLanguageCodes, - $inputConfigs, - $outputConfig - ); - $response->pollUntilComplete(); - - if ($response->operationSucceeded()) { - /** @var BatchTranslateDocumentResponse $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 -{ - $formattedParent = TranslationServiceClient::locationName('[PROJECT]', '[LOCATION]'); - $sourceLanguageCode = '[SOURCE_LANGUAGE_CODE]'; - $targetLanguageCodesElement = '[TARGET_LANGUAGE_CODES]'; - - batch_translate_document_sample($formattedParent, $sourceLanguageCode, $targetLanguageCodesElement); -} -// [END translate_v3_generated_TranslationService_BatchTranslateDocument_sync] diff --git a/owl-bot-staging/Translate/v3/samples/V3/TranslationServiceClient/batch_translate_text.php b/owl-bot-staging/Translate/v3/samples/V3/TranslationServiceClient/batch_translate_text.php deleted file mode 100644 index 0b34520d9a6..00000000000 --- a/owl-bot-staging/Translate/v3/samples/V3/TranslationServiceClient/batch_translate_text.php +++ /dev/null @@ -1,112 +0,0 @@ -batchTranslateText( - $formattedParent, - $sourceLanguageCode, - $targetLanguageCodes, - $inputConfigs, - $outputConfig - ); - $response->pollUntilComplete(); - - if ($response->operationSucceeded()) { - /** @var BatchTranslateResponse $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 -{ - $formattedParent = TranslationServiceClient::locationName('[PROJECT]', '[LOCATION]'); - $sourceLanguageCode = '[SOURCE_LANGUAGE_CODE]'; - $targetLanguageCodesElement = '[TARGET_LANGUAGE_CODES]'; - - batch_translate_text_sample($formattedParent, $sourceLanguageCode, $targetLanguageCodesElement); -} -// [END translate_v3_generated_TranslationService_BatchTranslateText_sync] diff --git a/owl-bot-staging/Translate/v3/samples/V3/TranslationServiceClient/create_glossary.php b/owl-bot-staging/Translate/v3/samples/V3/TranslationServiceClient/create_glossary.php deleted file mode 100644 index 8f39729e7b5..00000000000 --- a/owl-bot-staging/Translate/v3/samples/V3/TranslationServiceClient/create_glossary.php +++ /dev/null @@ -1,86 +0,0 @@ -setName($glossaryName); - - // Call the API and handle any network failures. - try { - /** @var OperationResponse $response */ - $response = $translationServiceClient->createGlossary($formattedParent, $glossary); - $response->pollUntilComplete(); - - if ($response->operationSucceeded()) { - /** @var Glossary $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 -{ - $formattedParent = TranslationServiceClient::locationName('[PROJECT]', '[LOCATION]'); - $glossaryName = '[NAME]'; - - create_glossary_sample($formattedParent, $glossaryName); -} -// [END translate_v3_generated_TranslationService_CreateGlossary_sync] diff --git a/owl-bot-staging/Translate/v3/samples/V3/TranslationServiceClient/delete_glossary.php b/owl-bot-staging/Translate/v3/samples/V3/TranslationServiceClient/delete_glossary.php deleted file mode 100644 index 06f96be93cb..00000000000 --- a/owl-bot-staging/Translate/v3/samples/V3/TranslationServiceClient/delete_glossary.php +++ /dev/null @@ -1,80 +0,0 @@ -deleteGlossary($formattedName); - $response->pollUntilComplete(); - - if ($response->operationSucceeded()) { - /** @var DeleteGlossaryResponse $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 -{ - $formattedName = TranslationServiceClient::glossaryName('[PROJECT]', '[LOCATION]', '[GLOSSARY]'); - - delete_glossary_sample($formattedName); -} -// [END translate_v3_generated_TranslationService_DeleteGlossary_sync] diff --git a/owl-bot-staging/Translate/v3/samples/V3/TranslationServiceClient/detect_language.php b/owl-bot-staging/Translate/v3/samples/V3/TranslationServiceClient/detect_language.php deleted file mode 100644 index bbde3538a39..00000000000 --- a/owl-bot-staging/Translate/v3/samples/V3/TranslationServiceClient/detect_language.php +++ /dev/null @@ -1,76 +0,0 @@ -detectLanguage($formattedParent); - 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 -{ - $formattedParent = TranslationServiceClient::locationName('[PROJECT]', '[LOCATION]'); - - detect_language_sample($formattedParent); -} -// [END translate_v3_generated_TranslationService_DetectLanguage_sync] diff --git a/owl-bot-staging/Translate/v3/samples/V3/TranslationServiceClient/get_glossary.php b/owl-bot-staging/Translate/v3/samples/V3/TranslationServiceClient/get_glossary.php deleted file mode 100644 index 4317cffc4b5..00000000000 --- a/owl-bot-staging/Translate/v3/samples/V3/TranslationServiceClient/get_glossary.php +++ /dev/null @@ -1,67 +0,0 @@ -getGlossary($formattedName); - 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 -{ - $formattedName = TranslationServiceClient::glossaryName('[PROJECT]', '[LOCATION]', '[GLOSSARY]'); - - get_glossary_sample($formattedName); -} -// [END translate_v3_generated_TranslationService_GetGlossary_sync] diff --git a/owl-bot-staging/Translate/v3/samples/V3/TranslationServiceClient/get_supported_languages.php b/owl-bot-staging/Translate/v3/samples/V3/TranslationServiceClient/get_supported_languages.php deleted file mode 100644 index e69828a8902..00000000000 --- a/owl-bot-staging/Translate/v3/samples/V3/TranslationServiceClient/get_supported_languages.php +++ /dev/null @@ -1,78 +0,0 @@ -getSupportedLanguages($formattedParent); - 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 -{ - $formattedParent = TranslationServiceClient::locationName('[PROJECT]', '[LOCATION]'); - - get_supported_languages_sample($formattedParent); -} -// [END translate_v3_generated_TranslationService_GetSupportedLanguages_sync] diff --git a/owl-bot-staging/Translate/v3/samples/V3/TranslationServiceClient/list_glossaries.php b/owl-bot-staging/Translate/v3/samples/V3/TranslationServiceClient/list_glossaries.php deleted file mode 100644 index 8c1d286d8b9..00000000000 --- a/owl-bot-staging/Translate/v3/samples/V3/TranslationServiceClient/list_glossaries.php +++ /dev/null @@ -1,72 +0,0 @@ -listGlossaries($formattedParent); - - /** @var Glossary $element */ - foreach ($response as $element) { - printf('Element data: %s' . PHP_EOL, $element->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 -{ - $formattedParent = TranslationServiceClient::locationName('[PROJECT]', '[LOCATION]'); - - list_glossaries_sample($formattedParent); -} -// [END translate_v3_generated_TranslationService_ListGlossaries_sync] diff --git a/owl-bot-staging/Translate/v3/samples/V3/TranslationServiceClient/translate_document.php b/owl-bot-staging/Translate/v3/samples/V3/TranslationServiceClient/translate_document.php deleted file mode 100644 index 1023ea68222..00000000000 --- a/owl-bot-staging/Translate/v3/samples/V3/TranslationServiceClient/translate_document.php +++ /dev/null @@ -1,87 +0,0 @@ -translateDocument( - $parent, - $targetLanguageCode, - $documentInputConfig - ); - 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 -{ - $parent = '[PARENT]'; - $targetLanguageCode = '[TARGET_LANGUAGE_CODE]'; - - translate_document_sample($parent, $targetLanguageCode); -} -// [END translate_v3_generated_TranslationService_TranslateDocument_sync] diff --git a/owl-bot-staging/Translate/v3/samples/V3/TranslationServiceClient/translate_text.php b/owl-bot-staging/Translate/v3/samples/V3/TranslationServiceClient/translate_text.php deleted file mode 100644 index 9ebd1f05f47..00000000000 --- a/owl-bot-staging/Translate/v3/samples/V3/TranslationServiceClient/translate_text.php +++ /dev/null @@ -1,96 +0,0 @@ -translateText( - $contents, - $targetLanguageCode, - $formattedParent - ); - 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 -{ - $contentsElement = '[CONTENTS]'; - $targetLanguageCode = '[TARGET_LANGUAGE_CODE]'; - $formattedParent = TranslationServiceClient::locationName('[PROJECT]', '[LOCATION]'); - - translate_text_sample($contentsElement, $targetLanguageCode, $formattedParent); -} -// [END translate_v3_generated_TranslationService_TranslateText_sync] diff --git a/owl-bot-staging/Translate/v3/src/V3/Gapic/TranslationServiceGapicClient.php b/owl-bot-staging/Translate/v3/src/V3/Gapic/TranslationServiceGapicClient.php deleted file mode 100644 index 9b7956b474f..00000000000 --- a/owl-bot-staging/Translate/v3/src/V3/Gapic/TranslationServiceGapicClient.php +++ /dev/null @@ -1,1338 +0,0 @@ -locationName('[PROJECT]', '[LOCATION]'); - * $sourceLanguageCode = 'source_language_code'; - * $targetLanguageCodes = []; - * $inputConfigs = []; - * $outputConfig = new BatchDocumentOutputConfig(); - * $operationResponse = $translationServiceClient->batchTranslateDocument($formattedParent, $sourceLanguageCode, $targetLanguageCodes, $inputConfigs, $outputConfig); - * $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 = $translationServiceClient->batchTranslateDocument($formattedParent, $sourceLanguageCode, $targetLanguageCodes, $inputConfigs, $outputConfig); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $translationServiceClient->resumeOperation($operationName, 'batchTranslateDocument'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * $result = $newOperationResponse->getResult(); - * // doSomethingWith($result) - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $translationServiceClient->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. - */ -class TranslationServiceGapicClient -{ - use GapicClientTrait; - - /** The name of the service. */ - const SERVICE_NAME = 'google.cloud.translation.v3.TranslationService'; - - /** The default address of the service. */ - const SERVICE_ADDRESS = 'translate.googleapis.com'; - - /** 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', - 'https://www.googleapis.com/auth/cloud-translation', - ]; - - private static $glossaryNameTemplate; - - private static $locationNameTemplate; - - 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/translation_service_client_config.json', - 'descriptorsConfigPath' => __DIR__ . '/../resources/translation_service_descriptor_config.php', - 'gcpApiConfigPath' => __DIR__ . '/../resources/translation_service_grpc_config.json', - 'credentialsConfig' => [ - 'defaultScopes' => self::$serviceScopes, - ], - 'transportConfig' => [ - 'rest' => [ - 'restClientConfigPath' => __DIR__ . '/../resources/translation_service_rest_client_config.php', - ], - ], - ]; - } - - private static function getGlossaryNameTemplate() - { - if (self::$glossaryNameTemplate == null) { - self::$glossaryNameTemplate = new PathTemplate('projects/{project}/locations/{location}/glossaries/{glossary}'); - } - - return self::$glossaryNameTemplate; - } - - private static function getLocationNameTemplate() - { - if (self::$locationNameTemplate == null) { - self::$locationNameTemplate = new PathTemplate('projects/{project}/locations/{location}'); - } - - return self::$locationNameTemplate; - } - - private static function getPathTemplateMap() - { - if (self::$pathTemplateMap == null) { - self::$pathTemplateMap = [ - 'glossary' => self::getGlossaryNameTemplate(), - 'location' => self::getLocationNameTemplate(), - ]; - } - - return self::$pathTemplateMap; - } - - /** - * Formats a string containing the fully-qualified path to represent a glossary - * resource. - * - * @param string $project - * @param string $location - * @param string $glossary - * - * @return string The formatted glossary resource. - */ - public static function glossaryName($project, $location, $glossary) - { - return self::getGlossaryNameTemplate()->render([ - 'project' => $project, - 'location' => $location, - 'glossary' => $glossary, - ]); - } - - /** - * Formats a string containing the fully-qualified path to represent a location - * resource. - * - * @param string $project - * @param string $location - * - * @return string The formatted location resource. - */ - public static function locationName($project, $location) - { - return self::getLocationNameTemplate()->render([ - 'project' => $project, - 'location' => $location, - ]); - } - - /** - * Parses a formatted name string and returns an associative array of the components in the name. - * The following name formats are supported: - * Template: Pattern - * - glossary: projects/{project}/locations/{location}/glossaries/{glossary} - * - location: projects/{project}/locations/{location} - * - * 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 'translate.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); - } - - /** - * Translates a large volume of document in asynchronous batch mode. - * This function provides real-time output as the inputs are being processed. - * If caller cancels a request, the partial results (for an input file, it's - * all or nothing) may still be available on the specified output location. - * - * This call returns immediately and you can use - * google.longrunning.Operation.name to poll the status of the call. - * - * Sample code: - * ``` - * $translationServiceClient = new TranslationServiceClient(); - * try { - * $formattedParent = $translationServiceClient->locationName('[PROJECT]', '[LOCATION]'); - * $sourceLanguageCode = 'source_language_code'; - * $targetLanguageCodes = []; - * $inputConfigs = []; - * $outputConfig = new BatchDocumentOutputConfig(); - * $operationResponse = $translationServiceClient->batchTranslateDocument($formattedParent, $sourceLanguageCode, $targetLanguageCodes, $inputConfigs, $outputConfig); - * $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 = $translationServiceClient->batchTranslateDocument($formattedParent, $sourceLanguageCode, $targetLanguageCodes, $inputConfigs, $outputConfig); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $translationServiceClient->resumeOperation($operationName, 'batchTranslateDocument'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * $result = $newOperationResponse->getResult(); - * // doSomethingWith($result) - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $translationServiceClient->close(); - * } - * ``` - * - * @param string $parent Required. Location to make a regional call. - * - * Format: `projects/{project-number-or-id}/locations/{location-id}`. - * - * The `global` location is not supported for batch translation. - * - * Only AutoML Translation models or glossaries within the same region (have - * the same location-id) can be used, otherwise an INVALID_ARGUMENT (400) - * error is returned. - * @param string $sourceLanguageCode Required. The ISO-639 language code of the input document if known, for - * example, "en-US" or "sr-Latn". Supported language codes are listed in - * [Language Support](https://cloud.google.com/translate/docs/languages). - * @param string[] $targetLanguageCodes Required. The ISO-639 language code to use for translation of the input - * document. Specify up to 10 language codes here. - * @param BatchDocumentInputConfig[] $inputConfigs Required. Input configurations. - * The total number of files matched should be <= 100. - * The total content size to translate should be <= 100M Unicode codepoints. - * The files must use UTF-8 encoding. - * @param BatchDocumentOutputConfig $outputConfig Required. Output configuration. - * If 2 input configs match to the same file (that is, same input path), - * we don't generate output for duplicate inputs. - * @param array $optionalArgs { - * Optional. - * - * @type array $models - * Optional. The models to use for translation. Map's key is target language - * code. Map's value is the model name. Value can be a built-in general model, - * or an AutoML Translation model. - * - * The value format depends on model type: - * - * - AutoML Translation models: - * `projects/{project-number-or-id}/locations/{location-id}/models/{model-id}` - * - * - General (built-in) models: - * `projects/{project-number-or-id}/locations/{location-id}/models/general/nmt`, - * - * - * If the map is empty or a specific model is - * not requested for a language pair, then default google model (nmt) is used. - * @type array $glossaries - * Optional. Glossaries to be applied. It's keyed by target language code. - * @type array $formatConversions - * Optional. File format conversion map to be applied to all input files. - * Map's key is the original mime_type. Map's value is the target mime_type of - * translated documents. - * - * Supported file format conversion includes: - * - `application/pdf` to - * `application/vnd.openxmlformats-officedocument.wordprocessingml.document` - * - * If nothing specified, output files will be in the same format as the - * original file. - * @type string $customizedAttribution - * Optional. This flag is to support user customized attribution. - * If not provided, the default is `Machine Translated by Google`. - * Customized attribution should follow rules in - * https://cloud.google.com/translate/attribution#attribution_and_logos - * @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 batchTranslateDocument($parent, $sourceLanguageCode, $targetLanguageCodes, $inputConfigs, $outputConfig, array $optionalArgs = []) - { - $request = new BatchTranslateDocumentRequest(); - $requestParamHeaders = []; - $request->setParent($parent); - $request->setSourceLanguageCode($sourceLanguageCode); - $request->setTargetLanguageCodes($targetLanguageCodes); - $request->setInputConfigs($inputConfigs); - $request->setOutputConfig($outputConfig); - $requestParamHeaders['parent'] = $parent; - if (isset($optionalArgs['models'])) { - $request->setModels($optionalArgs['models']); - } - - if (isset($optionalArgs['glossaries'])) { - $request->setGlossaries($optionalArgs['glossaries']); - } - - if (isset($optionalArgs['formatConversions'])) { - $request->setFormatConversions($optionalArgs['formatConversions']); - } - - if (isset($optionalArgs['customizedAttribution'])) { - $request->setCustomizedAttribution($optionalArgs['customizedAttribution']); - } - - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->startOperationsCall('BatchTranslateDocument', $optionalArgs, $request, $this->getOperationsClient())->wait(); - } - - /** - * Translates a large volume of text in asynchronous batch mode. - * This function provides real-time output as the inputs are being processed. - * If caller cancels a request, the partial results (for an input file, it's - * all or nothing) may still be available on the specified output location. - * - * This call returns immediately and you can - * use google.longrunning.Operation.name to poll the status of the call. - * - * Sample code: - * ``` - * $translationServiceClient = new TranslationServiceClient(); - * try { - * $formattedParent = $translationServiceClient->locationName('[PROJECT]', '[LOCATION]'); - * $sourceLanguageCode = 'source_language_code'; - * $targetLanguageCodes = []; - * $inputConfigs = []; - * $outputConfig = new OutputConfig(); - * $operationResponse = $translationServiceClient->batchTranslateText($formattedParent, $sourceLanguageCode, $targetLanguageCodes, $inputConfigs, $outputConfig); - * $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 = $translationServiceClient->batchTranslateText($formattedParent, $sourceLanguageCode, $targetLanguageCodes, $inputConfigs, $outputConfig); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $translationServiceClient->resumeOperation($operationName, 'batchTranslateText'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * $result = $newOperationResponse->getResult(); - * // doSomethingWith($result) - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $translationServiceClient->close(); - * } - * ``` - * - * @param string $parent Required. Location to make a call. Must refer to a caller's project. - * - * Format: `projects/{project-number-or-id}/locations/{location-id}`. - * - * The `global` location is not supported for batch translation. - * - * Only AutoML Translation models or glossaries within the same region (have - * the same location-id) can be used, otherwise an INVALID_ARGUMENT (400) - * error is returned. - * @param string $sourceLanguageCode Required. Source language code. - * @param string[] $targetLanguageCodes Required. Specify up to 10 language codes here. - * @param InputConfig[] $inputConfigs Required. Input configurations. - * The total number of files matched should be <= 100. - * The total content size should be <= 100M Unicode codepoints. - * The files must use UTF-8 encoding. - * @param OutputConfig $outputConfig Required. Output configuration. - * If 2 input configs match to the same file (that is, same input path), - * we don't generate output for duplicate inputs. - * @param array $optionalArgs { - * Optional. - * - * @type array $models - * Optional. The models to use for translation. Map's key is target language - * code. Map's value is model name. Value can be a built-in general model, - * or an AutoML Translation model. - * - * The value format depends on model type: - * - * - AutoML Translation models: - * `projects/{project-number-or-id}/locations/{location-id}/models/{model-id}` - * - * - General (built-in) models: - * `projects/{project-number-or-id}/locations/{location-id}/models/general/nmt`, - * - * - * If the map is empty or a specific model is - * not requested for a language pair, then default google model (nmt) is used. - * @type array $glossaries - * Optional. Glossaries to be applied for translation. - * It's keyed by target language code. - * @type array $labels - * Optional. The labels with user-defined metadata for the request. - * - * Label keys and values can be no longer than 63 characters - * (Unicode codepoints), can only contain lowercase letters, numeric - * characters, underscores and dashes. International characters are allowed. - * Label values are optional. Label keys must start with a letter. - * - * See https://cloud.google.com/translate/docs/advanced/labels for more - * information. - * @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 batchTranslateText($parent, $sourceLanguageCode, $targetLanguageCodes, $inputConfigs, $outputConfig, array $optionalArgs = []) - { - $request = new BatchTranslateTextRequest(); - $requestParamHeaders = []; - $request->setParent($parent); - $request->setSourceLanguageCode($sourceLanguageCode); - $request->setTargetLanguageCodes($targetLanguageCodes); - $request->setInputConfigs($inputConfigs); - $request->setOutputConfig($outputConfig); - $requestParamHeaders['parent'] = $parent; - if (isset($optionalArgs['models'])) { - $request->setModels($optionalArgs['models']); - } - - if (isset($optionalArgs['glossaries'])) { - $request->setGlossaries($optionalArgs['glossaries']); - } - - if (isset($optionalArgs['labels'])) { - $request->setLabels($optionalArgs['labels']); - } - - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->startOperationsCall('BatchTranslateText', $optionalArgs, $request, $this->getOperationsClient())->wait(); - } - - /** - * Creates a glossary and returns the long-running operation. Returns - * NOT_FOUND, if the project doesn't exist. - * - * Sample code: - * ``` - * $translationServiceClient = new TranslationServiceClient(); - * try { - * $formattedParent = $translationServiceClient->locationName('[PROJECT]', '[LOCATION]'); - * $glossary = new Glossary(); - * $operationResponse = $translationServiceClient->createGlossary($formattedParent, $glossary); - * $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 = $translationServiceClient->createGlossary($formattedParent, $glossary); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $translationServiceClient->resumeOperation($operationName, 'createGlossary'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * $result = $newOperationResponse->getResult(); - * // doSomethingWith($result) - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $translationServiceClient->close(); - * } - * ``` - * - * @param string $parent Required. The project name. - * @param Glossary $glossary Required. The glossary to create. - * @param array $optionalArgs { - * 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 \Google\ApiCore\OperationResponse - * - * @throws ApiException if the remote call fails - */ - public function createGlossary($parent, $glossary, array $optionalArgs = []) - { - $request = new CreateGlossaryRequest(); - $requestParamHeaders = []; - $request->setParent($parent); - $request->setGlossary($glossary); - $requestParamHeaders['parent'] = $parent; - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->startOperationsCall('CreateGlossary', $optionalArgs, $request, $this->getOperationsClient())->wait(); - } - - /** - * Deletes a glossary, or cancels glossary construction - * if the glossary isn't created yet. - * Returns NOT_FOUND, if the glossary doesn't exist. - * - * Sample code: - * ``` - * $translationServiceClient = new TranslationServiceClient(); - * try { - * $formattedName = $translationServiceClient->glossaryName('[PROJECT]', '[LOCATION]', '[GLOSSARY]'); - * $operationResponse = $translationServiceClient->deleteGlossary($formattedName); - * $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 = $translationServiceClient->deleteGlossary($formattedName); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $translationServiceClient->resumeOperation($operationName, 'deleteGlossary'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * $result = $newOperationResponse->getResult(); - * // doSomethingWith($result) - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $translationServiceClient->close(); - * } - * ``` - * - * @param string $name Required. The name of the glossary to delete. - * @param array $optionalArgs { - * 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 \Google\ApiCore\OperationResponse - * - * @throws ApiException if the remote call fails - */ - public function deleteGlossary($name, array $optionalArgs = []) - { - $request = new DeleteGlossaryRequest(); - $requestParamHeaders = []; - $request->setName($name); - $requestParamHeaders['name'] = $name; - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->startOperationsCall('DeleteGlossary', $optionalArgs, $request, $this->getOperationsClient())->wait(); - } - - /** - * Detects the language of text within a request. - * - * Sample code: - * ``` - * $translationServiceClient = new TranslationServiceClient(); - * try { - * $formattedParent = $translationServiceClient->locationName('[PROJECT]', '[LOCATION]'); - * $response = $translationServiceClient->detectLanguage($formattedParent); - * } finally { - * $translationServiceClient->close(); - * } - * ``` - * - * @param string $parent Required. Project or location to make a call. Must refer to a caller's - * project. - * - * Format: `projects/{project-number-or-id}/locations/{location-id}` or - * `projects/{project-number-or-id}`. - * - * For global calls, use `projects/{project-number-or-id}/locations/global` or - * `projects/{project-number-or-id}`. - * - * Only models within the same region (has same location-id) can be used. - * Otherwise an INVALID_ARGUMENT (400) error is returned. - * @param array $optionalArgs { - * Optional. - * - * @type string $model - * Optional. The language detection model to be used. - * - * Format: - * `projects/{project-number-or-id}/locations/{location-id}/models/language-detection/{model-id}` - * - * Only one language detection model is currently supported: - * `projects/{project-number-or-id}/locations/{location-id}/models/language-detection/default`. - * - * If not specified, the default model is used. - * @type string $content - * The content of the input stored as a string. - * @type string $mimeType - * Optional. The format of the source text, for example, "text/html", - * "text/plain". If left blank, the MIME type defaults to "text/html". - * @type array $labels - * Optional. The labels with user-defined metadata for the request. - * - * Label keys and values can be no longer than 63 characters - * (Unicode codepoints), can only contain lowercase letters, numeric - * characters, underscores and dashes. International characters are allowed. - * Label values are optional. Label keys must start with a letter. - * - * See https://cloud.google.com/translate/docs/advanced/labels for more - * information. - * @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\Translate\V3\DetectLanguageResponse - * - * @throws ApiException if the remote call fails - */ - public function detectLanguage($parent, array $optionalArgs = []) - { - $request = new DetectLanguageRequest(); - $requestParamHeaders = []; - $request->setParent($parent); - $requestParamHeaders['parent'] = $parent; - if (isset($optionalArgs['model'])) { - $request->setModel($optionalArgs['model']); - } - - if (isset($optionalArgs['content'])) { - $request->setContent($optionalArgs['content']); - } - - if (isset($optionalArgs['mimeType'])) { - $request->setMimeType($optionalArgs['mimeType']); - } - - if (isset($optionalArgs['labels'])) { - $request->setLabels($optionalArgs['labels']); - } - - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->startCall('DetectLanguage', DetectLanguageResponse::class, $optionalArgs, $request)->wait(); - } - - /** - * Gets a glossary. Returns NOT_FOUND, if the glossary doesn't - * exist. - * - * Sample code: - * ``` - * $translationServiceClient = new TranslationServiceClient(); - * try { - * $formattedName = $translationServiceClient->glossaryName('[PROJECT]', '[LOCATION]', '[GLOSSARY]'); - * $response = $translationServiceClient->getGlossary($formattedName); - * } finally { - * $translationServiceClient->close(); - * } - * ``` - * - * @param string $name Required. The name of the glossary to retrieve. - * @param array $optionalArgs { - * 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 \Google\Cloud\Translate\V3\Glossary - * - * @throws ApiException if the remote call fails - */ - public function getGlossary($name, array $optionalArgs = []) - { - $request = new GetGlossaryRequest(); - $requestParamHeaders = []; - $request->setName($name); - $requestParamHeaders['name'] = $name; - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->startCall('GetGlossary', Glossary::class, $optionalArgs, $request)->wait(); - } - - /** - * Returns a list of supported languages for translation. - * - * Sample code: - * ``` - * $translationServiceClient = new TranslationServiceClient(); - * try { - * $formattedParent = $translationServiceClient->locationName('[PROJECT]', '[LOCATION]'); - * $response = $translationServiceClient->getSupportedLanguages($formattedParent); - * } finally { - * $translationServiceClient->close(); - * } - * ``` - * - * @param string $parent Required. Project or location to make a call. Must refer to a caller's - * project. - * - * Format: `projects/{project-number-or-id}` or - * `projects/{project-number-or-id}/locations/{location-id}`. - * - * For global calls, use `projects/{project-number-or-id}/locations/global` or - * `projects/{project-number-or-id}`. - * - * Non-global location is required for AutoML models. - * - * Only models within the same region (have same location-id) can be used, - * otherwise an INVALID_ARGUMENT (400) error is returned. - * @param array $optionalArgs { - * Optional. - * - * @type string $displayLanguageCode - * Optional. The language to use to return localized, human readable names - * of supported languages. If missing, then display names are not returned - * in a response. - * @type string $model - * Optional. Get supported languages of this model. - * - * The format depends on model type: - * - * - AutoML Translation models: - * `projects/{project-number-or-id}/locations/{location-id}/models/{model-id}` - * - * - General (built-in) models: - * `projects/{project-number-or-id}/locations/{location-id}/models/general/nmt`, - * - * - * Returns languages supported by the specified model. - * If missing, we get supported languages of Google general NMT model. - * @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\Translate\V3\SupportedLanguages - * - * @throws ApiException if the remote call fails - */ - public function getSupportedLanguages($parent, array $optionalArgs = []) - { - $request = new GetSupportedLanguagesRequest(); - $requestParamHeaders = []; - $request->setParent($parent); - $requestParamHeaders['parent'] = $parent; - if (isset($optionalArgs['displayLanguageCode'])) { - $request->setDisplayLanguageCode($optionalArgs['displayLanguageCode']); - } - - if (isset($optionalArgs['model'])) { - $request->setModel($optionalArgs['model']); - } - - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->startCall('GetSupportedLanguages', SupportedLanguages::class, $optionalArgs, $request)->wait(); - } - - /** - * Lists glossaries in a project. Returns NOT_FOUND, if the project doesn't - * exist. - * - * Sample code: - * ``` - * $translationServiceClient = new TranslationServiceClient(); - * try { - * $formattedParent = $translationServiceClient->locationName('[PROJECT]', '[LOCATION]'); - * // Iterate over pages of elements - * $pagedResponse = $translationServiceClient->listGlossaries($formattedParent); - * foreach ($pagedResponse->iteratePages() as $page) { - * foreach ($page as $element) { - * // doSomethingWith($element); - * } - * } - * // Alternatively: - * // Iterate through all elements - * $pagedResponse = $translationServiceClient->listGlossaries($formattedParent); - * foreach ($pagedResponse->iterateAllElements() as $element) { - * // doSomethingWith($element); - * } - * } finally { - * $translationServiceClient->close(); - * } - * ``` - * - * @param string $parent Required. The name of the project from which to list all of the glossaries. - * @param array $optionalArgs { - * Optional. - * - * @type int $pageSize - * The maximum number of resources contained in the underlying API - * response. The API may return fewer values in a page, even if - * there are additional values to be retrieved. - * @type string $pageToken - * A page token is used to specify a page of values to be returned. - * If no page token is specified (the default), the first page - * of values will be returned. Any page token used here must have - * been generated by a previous call to the API. - * @type string $filter - * Optional. Filter specifying constraints of a list operation. - * Specify the constraint by the format of "key=value", where key must be - * "src" or "tgt", and the value must be a valid language code. - * For multiple restrictions, concatenate them by "AND" (uppercase only), - * such as: "src=en-US AND tgt=zh-CN". Notice that the exact match is used - * here, which means using 'en-US' and 'en' can lead to different results, - * which depends on the language code you used when you create the glossary. - * For the unidirectional glossaries, the "src" and "tgt" add restrictions - * on the source and target language code separately. - * For the equivalent term set glossaries, the "src" and/or "tgt" add - * restrictions on the term set. - * For example: "src=en-US AND tgt=zh-CN" will only pick the unidirectional - * glossaries which exactly match the source language code as "en-US" and the - * target language code "zh-CN", but all equivalent term set glossaries which - * contain "en-US" and "zh-CN" in their language set will be picked. - * If missing, no filtering is performed. - * @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\PagedListResponse - * - * @throws ApiException if the remote call fails - */ - public function listGlossaries($parent, array $optionalArgs = []) - { - $request = new ListGlossariesRequest(); - $requestParamHeaders = []; - $request->setParent($parent); - $requestParamHeaders['parent'] = $parent; - if (isset($optionalArgs['pageSize'])) { - $request->setPageSize($optionalArgs['pageSize']); - } - - if (isset($optionalArgs['pageToken'])) { - $request->setPageToken($optionalArgs['pageToken']); - } - - if (isset($optionalArgs['filter'])) { - $request->setFilter($optionalArgs['filter']); - } - - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->getPagedListResponse('ListGlossaries', $optionalArgs, ListGlossariesResponse::class, $request); - } - - /** - * Translates documents in synchronous mode. - * - * Sample code: - * ``` - * $translationServiceClient = new TranslationServiceClient(); - * try { - * $parent = 'parent'; - * $targetLanguageCode = 'target_language_code'; - * $documentInputConfig = new DocumentInputConfig(); - * $response = $translationServiceClient->translateDocument($parent, $targetLanguageCode, $documentInputConfig); - * } finally { - * $translationServiceClient->close(); - * } - * ``` - * - * @param string $parent Required. Location to make a regional call. - * - * Format: `projects/{project-number-or-id}/locations/{location-id}`. - * - * For global calls, use `projects/{project-number-or-id}/locations/global` or - * `projects/{project-number-or-id}`. - * - * Non-global location is required for requests using AutoML models or custom - * glossaries. - * - * Models and glossaries must be within the same region (have the same - * location-id), otherwise an INVALID_ARGUMENT (400) error is returned. - * @param string $targetLanguageCode Required. The ISO-639 language code to use for translation of the input - * document, set to one of the language codes listed in Language Support. - * @param DocumentInputConfig $documentInputConfig Required. Input configurations. - * @param array $optionalArgs { - * Optional. - * - * @type string $sourceLanguageCode - * Optional. The ISO-639 language code of the input document if known, for - * example, "en-US" or "sr-Latn". Supported language codes are listed in - * Language Support. If the source language isn't specified, the API attempts - * to identify the source language automatically and returns the source - * language within the response. Source language must be specified if the - * request contains a glossary or a custom model. - * @type DocumentOutputConfig $documentOutputConfig - * Optional. Output configurations. - * Defines if the output file should be stored within Cloud Storage as well - * as the desired output format. If not provided the translated file will - * only be returned through a byte-stream and its output mime type will be - * the same as the input file's mime type. - * @type string $model - * Optional. The `model` type requested for this translation. - * - * The format depends on model type: - * - * - AutoML Translation models: - * `projects/{project-number-or-id}/locations/{location-id}/models/{model-id}` - * - * - General (built-in) models: - * `projects/{project-number-or-id}/locations/{location-id}/models/general/nmt`, - * - * - * If not provided, the default Google model (NMT) will be used for - * translation. - * @type TranslateTextGlossaryConfig $glossaryConfig - * Optional. Glossary to be applied. The glossary must be within the same - * region (have the same location-id) as the model, otherwise an - * INVALID_ARGUMENT (400) error is returned. - * @type array $labels - * Optional. The labels with user-defined metadata for the request. - * - * Label keys and values can be no longer than 63 characters (Unicode - * codepoints), can only contain lowercase letters, numeric characters, - * underscores and dashes. International characters are allowed. Label values - * are optional. Label keys must start with a letter. - * - * See https://cloud.google.com/translate/docs/advanced/labels for more - * information. - * @type string $customizedAttribution - * Optional. This flag is to support user customized attribution. - * If not provided, the default is `Machine Translated by Google`. - * Customized attribution should follow rules in - * https://cloud.google.com/translate/attribution#attribution_and_logos - * @type bool $isTranslateNativePdfOnly - * Optional. If true, the page limit of online native pdf translation is 300 - * and only native pdf pages will be translated. - * @type bool $enableShadowRemovalNativePdf - * Optional. If true, use the text removal to remove the shadow text on - * background image for native pdf translation. - * Shadow removal feature can only be enabled when - * is_translate_native_pdf_only is false - * @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\Translate\V3\TranslateDocumentResponse - * - * @throws ApiException if the remote call fails - */ - public function translateDocument($parent, $targetLanguageCode, $documentInputConfig, array $optionalArgs = []) - { - $request = new TranslateDocumentRequest(); - $requestParamHeaders = []; - $request->setParent($parent); - $request->setTargetLanguageCode($targetLanguageCode); - $request->setDocumentInputConfig($documentInputConfig); - $requestParamHeaders['parent'] = $parent; - if (isset($optionalArgs['sourceLanguageCode'])) { - $request->setSourceLanguageCode($optionalArgs['sourceLanguageCode']); - } - - if (isset($optionalArgs['documentOutputConfig'])) { - $request->setDocumentOutputConfig($optionalArgs['documentOutputConfig']); - } - - if (isset($optionalArgs['model'])) { - $request->setModel($optionalArgs['model']); - } - - if (isset($optionalArgs['glossaryConfig'])) { - $request->setGlossaryConfig($optionalArgs['glossaryConfig']); - } - - if (isset($optionalArgs['labels'])) { - $request->setLabels($optionalArgs['labels']); - } - - if (isset($optionalArgs['customizedAttribution'])) { - $request->setCustomizedAttribution($optionalArgs['customizedAttribution']); - } - - if (isset($optionalArgs['isTranslateNativePdfOnly'])) { - $request->setIsTranslateNativePdfOnly($optionalArgs['isTranslateNativePdfOnly']); - } - - if (isset($optionalArgs['enableShadowRemovalNativePdf'])) { - $request->setEnableShadowRemovalNativePdf($optionalArgs['enableShadowRemovalNativePdf']); - } - - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->startCall('TranslateDocument', TranslateDocumentResponse::class, $optionalArgs, $request)->wait(); - } - - /** - * Translates input text and returns translated text. - * - * Sample code: - * ``` - * $translationServiceClient = new TranslationServiceClient(); - * try { - * $contents = []; - * $targetLanguageCode = 'target_language_code'; - * $formattedParent = $translationServiceClient->locationName('[PROJECT]', '[LOCATION]'); - * $response = $translationServiceClient->translateText($contents, $targetLanguageCode, $formattedParent); - * } finally { - * $translationServiceClient->close(); - * } - * ``` - * - * @param string[] $contents Required. The content of the input in string format. - * We recommend the total content be less than 30,000 codepoints. The max - * length of this field is 1024. Use BatchTranslateText for larger text. - * @param string $targetLanguageCode Required. The ISO-639 language code to use for translation of the input - * text, set to one of the language codes listed in Language Support. - * @param string $parent Required. Project or location to make a call. Must refer to a caller's - * project. - * - * Format: `projects/{project-number-or-id}` or - * `projects/{project-number-or-id}/locations/{location-id}`. - * - * For global calls, use `projects/{project-number-or-id}/locations/global` or - * `projects/{project-number-or-id}`. - * - * Non-global location is required for requests using AutoML models or - * custom glossaries. - * - * Models and glossaries must be within the same region (have same - * location-id), otherwise an INVALID_ARGUMENT (400) error is returned. - * @param array $optionalArgs { - * Optional. - * - * @type string $mimeType - * Optional. The format of the source text, for example, "text/html", - * "text/plain". If left blank, the MIME type defaults to "text/html". - * @type string $sourceLanguageCode - * Optional. The ISO-639 language code of the input text if - * known, for example, "en-US" or "sr-Latn". Supported language codes are - * listed in Language Support. If the source language isn't specified, the API - * attempts to identify the source language automatically and returns the - * source language within the response. - * @type string $model - * Optional. The `model` type requested for this translation. - * - * The format depends on model type: - * - * - AutoML Translation models: - * `projects/{project-number-or-id}/locations/{location-id}/models/{model-id}` - * - * - General (built-in) models: - * `projects/{project-number-or-id}/locations/{location-id}/models/general/nmt`, - * - * - * For global (non-regionalized) requests, use `location-id` `global`. - * For example, - * `projects/{project-number-or-id}/locations/global/models/general/nmt`. - * - * If not provided, the default Google model (NMT) will be used. - * @type TranslateTextGlossaryConfig $glossaryConfig - * Optional. Glossary to be applied. The glossary must be - * within the same region (have the same location-id) as the model, otherwise - * an INVALID_ARGUMENT (400) error is returned. - * @type array $labels - * Optional. The labels with user-defined metadata for the request. - * - * Label keys and values can be no longer than 63 characters - * (Unicode codepoints), can only contain lowercase letters, numeric - * characters, underscores and dashes. International characters are allowed. - * Label values are optional. Label keys must start with a letter. - * - * See https://cloud.google.com/translate/docs/advanced/labels for more - * information. - * @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\Translate\V3\TranslateTextResponse - * - * @throws ApiException if the remote call fails - */ - public function translateText($contents, $targetLanguageCode, $parent, array $optionalArgs = []) - { - $request = new TranslateTextRequest(); - $requestParamHeaders = []; - $request->setContents($contents); - $request->setTargetLanguageCode($targetLanguageCode); - $request->setParent($parent); - $requestParamHeaders['parent'] = $parent; - if (isset($optionalArgs['mimeType'])) { - $request->setMimeType($optionalArgs['mimeType']); - } - - if (isset($optionalArgs['sourceLanguageCode'])) { - $request->setSourceLanguageCode($optionalArgs['sourceLanguageCode']); - } - - if (isset($optionalArgs['model'])) { - $request->setModel($optionalArgs['model']); - } - - if (isset($optionalArgs['glossaryConfig'])) { - $request->setGlossaryConfig($optionalArgs['glossaryConfig']); - } - - if (isset($optionalArgs['labels'])) { - $request->setLabels($optionalArgs['labels']); - } - - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->startCall('TranslateText', TranslateTextResponse::class, $optionalArgs, $request)->wait(); - } -} diff --git a/owl-bot-staging/Translate/v3/src/V3/TranslationServiceClient.php b/owl-bot-staging/Translate/v3/src/V3/TranslationServiceClient.php deleted file mode 100644 index 2a4a28a809c..00000000000 --- a/owl-bot-staging/Translate/v3/src/V3/TranslationServiceClient.php +++ /dev/null @@ -1,34 +0,0 @@ - [ - 'google.cloud.translation.v3.TranslationService' => [ - 'BatchTranslateDocument' => [ - 'longRunning' => [ - 'operationReturnType' => '\Google\Cloud\Translate\V3\BatchTranslateDocumentResponse', - 'metadataReturnType' => '\Google\Cloud\Translate\V3\BatchTranslateDocumentMetadata', - 'initialPollDelayMillis' => '500', - 'pollDelayMultiplier' => '1.5', - 'maxPollDelayMillis' => '5000', - 'totalPollTimeoutMillis' => '300000', - ], - ], - 'BatchTranslateText' => [ - 'longRunning' => [ - 'operationReturnType' => '\Google\Cloud\Translate\V3\BatchTranslateResponse', - 'metadataReturnType' => '\Google\Cloud\Translate\V3\BatchTranslateMetadata', - 'initialPollDelayMillis' => '500', - 'pollDelayMultiplier' => '1.5', - 'maxPollDelayMillis' => '5000', - 'totalPollTimeoutMillis' => '300000', - ], - ], - 'CreateGlossary' => [ - 'longRunning' => [ - 'operationReturnType' => '\Google\Cloud\Translate\V3\Glossary', - 'metadataReturnType' => '\Google\Cloud\Translate\V3\CreateGlossaryMetadata', - 'initialPollDelayMillis' => '500', - 'pollDelayMultiplier' => '1.5', - 'maxPollDelayMillis' => '5000', - 'totalPollTimeoutMillis' => '300000', - ], - ], - 'DeleteGlossary' => [ - 'longRunning' => [ - 'operationReturnType' => '\Google\Cloud\Translate\V3\DeleteGlossaryResponse', - 'metadataReturnType' => '\Google\Cloud\Translate\V3\DeleteGlossaryMetadata', - 'initialPollDelayMillis' => '500', - 'pollDelayMultiplier' => '1.5', - 'maxPollDelayMillis' => '5000', - 'totalPollTimeoutMillis' => '300000', - ], - ], - 'ListGlossaries' => [ - 'pageStreaming' => [ - 'requestPageTokenGetMethod' => 'getPageToken', - 'requestPageTokenSetMethod' => 'setPageToken', - 'requestPageSizeGetMethod' => 'getPageSize', - 'requestPageSizeSetMethod' => 'setPageSize', - 'responsePageTokenGetMethod' => 'getNextPageToken', - 'resourcesGetMethod' => 'getGlossaries', - ], - ], - ], - ], -]; diff --git a/owl-bot-staging/Translate/v3/src/V3/resources/translation_service_rest_client_config.php b/owl-bot-staging/Translate/v3/src/V3/resources/translation_service_rest_client_config.php deleted file mode 100644 index 0239536089f..00000000000 --- a/owl-bot-staging/Translate/v3/src/V3/resources/translation_service_rest_client_config.php +++ /dev/null @@ -1,228 +0,0 @@ - [ - 'google.cloud.location.Locations' => [ - 'GetLocation' => [ - 'method' => 'get', - 'uriTemplate' => '/v3/{name=projects/*/locations/*}', - 'placeholders' => [ - 'name' => [ - 'getters' => [ - 'getName', - ], - ], - ], - ], - 'ListLocations' => [ - 'method' => 'get', - 'uriTemplate' => '/v3/{name=projects/*}/locations', - 'placeholders' => [ - 'name' => [ - 'getters' => [ - 'getName', - ], - ], - ], - ], - ], - 'google.cloud.translation.v3.TranslationService' => [ - 'BatchTranslateDocument' => [ - 'method' => 'post', - 'uriTemplate' => '/v3/{parent=projects/*/locations/*}:batchTranslateDocument', - 'body' => '*', - 'placeholders' => [ - 'parent' => [ - 'getters' => [ - 'getParent', - ], - ], - ], - ], - 'BatchTranslateText' => [ - 'method' => 'post', - 'uriTemplate' => '/v3/{parent=projects/*/locations/*}:batchTranslateText', - 'body' => '*', - 'placeholders' => [ - 'parent' => [ - 'getters' => [ - 'getParent', - ], - ], - ], - ], - 'CreateGlossary' => [ - 'method' => 'post', - 'uriTemplate' => '/v3/{parent=projects/*/locations/*}/glossaries', - 'body' => 'glossary', - 'placeholders' => [ - 'parent' => [ - 'getters' => [ - 'getParent', - ], - ], - ], - ], - 'DeleteGlossary' => [ - 'method' => 'delete', - 'uriTemplate' => '/v3/{name=projects/*/locations/*/glossaries/*}', - 'placeholders' => [ - 'name' => [ - 'getters' => [ - 'getName', - ], - ], - ], - ], - 'DetectLanguage' => [ - 'method' => 'post', - 'uriTemplate' => '/v3/{parent=projects/*/locations/*}:detectLanguage', - 'body' => '*', - 'additionalBindings' => [ - [ - 'method' => 'post', - 'uriTemplate' => '/v3/{parent=projects/*}:detectLanguage', - 'body' => '*', - ], - ], - 'placeholders' => [ - 'parent' => [ - 'getters' => [ - 'getParent', - ], - ], - ], - ], - 'GetGlossary' => [ - 'method' => 'get', - 'uriTemplate' => '/v3/{name=projects/*/locations/*/glossaries/*}', - 'placeholders' => [ - 'name' => [ - 'getters' => [ - 'getName', - ], - ], - ], - ], - 'GetSupportedLanguages' => [ - 'method' => 'get', - 'uriTemplate' => '/v3/{parent=projects/*/locations/*}/supportedLanguages', - 'additionalBindings' => [ - [ - 'method' => 'get', - 'uriTemplate' => '/v3/{parent=projects/*}/supportedLanguages', - ], - ], - 'placeholders' => [ - 'parent' => [ - 'getters' => [ - 'getParent', - ], - ], - ], - ], - 'ListGlossaries' => [ - 'method' => 'get', - 'uriTemplate' => '/v3/{parent=projects/*/locations/*}/glossaries', - 'placeholders' => [ - 'parent' => [ - 'getters' => [ - 'getParent', - ], - ], - ], - ], - 'TranslateDocument' => [ - 'method' => 'post', - 'uriTemplate' => '/v3/{parent=projects/*/locations/*}:translateDocument', - 'body' => '*', - 'placeholders' => [ - 'parent' => [ - 'getters' => [ - 'getParent', - ], - ], - ], - ], - 'TranslateText' => [ - 'method' => 'post', - 'uriTemplate' => '/v3/{parent=projects/*/locations/*}:translateText', - 'body' => '*', - 'additionalBindings' => [ - [ - 'method' => 'post', - 'uriTemplate' => '/v3/{parent=projects/*}:translateText', - 'body' => '*', - ], - ], - 'placeholders' => [ - 'parent' => [ - 'getters' => [ - 'getParent', - ], - ], - ], - ], - ], - 'google.longrunning.Operations' => [ - 'CancelOperation' => [ - 'method' => 'post', - 'uriTemplate' => '/v3/{name=projects/*/locations/*/operations/*}:cancel', - 'body' => '*', - 'placeholders' => [ - 'name' => [ - 'getters' => [ - 'getName', - ], - ], - ], - ], - 'DeleteOperation' => [ - 'method' => 'delete', - 'uriTemplate' => '/v3/{name=projects/*/locations/*/operations/*}', - 'placeholders' => [ - 'name' => [ - 'getters' => [ - 'getName', - ], - ], - ], - ], - 'GetOperation' => [ - 'method' => 'get', - 'uriTemplate' => '/v3/{name=projects/*/locations/*/operations/*}', - 'placeholders' => [ - 'name' => [ - 'getters' => [ - 'getName', - ], - ], - ], - ], - 'ListOperations' => [ - 'method' => 'get', - 'uriTemplate' => '/v3/{name=projects/*/locations/*}/operations', - 'placeholders' => [ - 'name' => [ - 'getters' => [ - 'getName', - ], - ], - ], - ], - 'WaitOperation' => [ - 'method' => 'post', - 'uriTemplate' => '/v3/{name=projects/*/locations/*/operations/*}:wait', - 'body' => '*', - 'placeholders' => [ - 'name' => [ - 'getters' => [ - 'getName', - ], - ], - ], - ], - ], - ], - 'numericEnums' => true, -]; diff --git a/owl-bot-staging/Translate/v3/tests/Unit/V3/TranslationServiceClientTest.php b/owl-bot-staging/Translate/v3/tests/Unit/V3/TranslationServiceClientTest.php deleted file mode 100644 index 9ba2aa0e0f6..00000000000 --- a/owl-bot-staging/Translate/v3/tests/Unit/V3/TranslationServiceClientTest.php +++ /dev/null @@ -1,996 +0,0 @@ -getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); - } - - /** @return TranslationServiceClient */ - private function createClient(array $options = []) - { - $options += [ - 'credentials' => $this->createCredentials(), - ]; - return new TranslationServiceClient($options); - } - - /** @test */ - public function batchTranslateDocumentTest() - { - $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/batchTranslateDocumentTest'); - $incompleteOperation->setDone(false); - $transport->addResponse($incompleteOperation); - $totalPages = 396186871; - $translatedPages = 1652747493; - $failedPages = 2002254526; - $totalBillablePages = 1292117569; - $totalCharacters = 1368640955; - $translatedCharacters = 1337326221; - $failedCharacters = 1723028396; - $totalBillableCharacters = 1242495501; - $expectedResponse = new BatchTranslateDocumentResponse(); - $expectedResponse->setTotalPages($totalPages); - $expectedResponse->setTranslatedPages($translatedPages); - $expectedResponse->setFailedPages($failedPages); - $expectedResponse->setTotalBillablePages($totalBillablePages); - $expectedResponse->setTotalCharacters($totalCharacters); - $expectedResponse->setTranslatedCharacters($translatedCharacters); - $expectedResponse->setFailedCharacters($failedCharacters); - $expectedResponse->setTotalBillableCharacters($totalBillableCharacters); - $anyResponse = new Any(); - $anyResponse->setValue($expectedResponse->serializeToString()); - $completeOperation = new Operation(); - $completeOperation->setName('operations/batchTranslateDocumentTest'); - $completeOperation->setDone(true); - $completeOperation->setResponse($anyResponse); - $operationsTransport->addResponse($completeOperation); - // Mock request - $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); - $sourceLanguageCode = 'sourceLanguageCode1687263568'; - $targetLanguageCodes = []; - $inputConfigs = []; - $outputConfig = new BatchDocumentOutputConfig(); - $response = $gapicClient->batchTranslateDocument($formattedParent, $sourceLanguageCode, $targetLanguageCodes, $inputConfigs, $outputConfig); - $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.translation.v3.TranslationService/BatchTranslateDocument', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getParent(); - $this->assertProtobufEquals($formattedParent, $actualValue); - $actualValue = $actualApiRequestObject->getSourceLanguageCode(); - $this->assertProtobufEquals($sourceLanguageCode, $actualValue); - $actualValue = $actualApiRequestObject->getTargetLanguageCodes(); - $this->assertProtobufEquals($targetLanguageCodes, $actualValue); - $actualValue = $actualApiRequestObject->getInputConfigs(); - $this->assertProtobufEquals($inputConfigs, $actualValue); - $actualValue = $actualApiRequestObject->getOutputConfig(); - $this->assertProtobufEquals($outputConfig, $actualValue); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/batchTranslateDocumentTest'); - $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 batchTranslateDocumentExceptionTest() - { - $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/batchTranslateDocumentTest'); - $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 - $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); - $sourceLanguageCode = 'sourceLanguageCode1687263568'; - $targetLanguageCodes = []; - $inputConfigs = []; - $outputConfig = new BatchDocumentOutputConfig(); - $response = $gapicClient->batchTranslateDocument($formattedParent, $sourceLanguageCode, $targetLanguageCodes, $inputConfigs, $outputConfig); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/batchTranslateDocumentTest'); - 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 batchTranslateTextTest() - { - $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/batchTranslateTextTest'); - $incompleteOperation->setDone(false); - $transport->addResponse($incompleteOperation); - $totalCharacters = 1368640955; - $translatedCharacters = 1337326221; - $failedCharacters = 1723028396; - $expectedResponse = new BatchTranslateResponse(); - $expectedResponse->setTotalCharacters($totalCharacters); - $expectedResponse->setTranslatedCharacters($translatedCharacters); - $expectedResponse->setFailedCharacters($failedCharacters); - $anyResponse = new Any(); - $anyResponse->setValue($expectedResponse->serializeToString()); - $completeOperation = new Operation(); - $completeOperation->setName('operations/batchTranslateTextTest'); - $completeOperation->setDone(true); - $completeOperation->setResponse($anyResponse); - $operationsTransport->addResponse($completeOperation); - // Mock request - $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); - $sourceLanguageCode = 'sourceLanguageCode1687263568'; - $targetLanguageCodes = []; - $inputConfigs = []; - $outputConfig = new OutputConfig(); - $response = $gapicClient->batchTranslateText($formattedParent, $sourceLanguageCode, $targetLanguageCodes, $inputConfigs, $outputConfig); - $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.translation.v3.TranslationService/BatchTranslateText', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getParent(); - $this->assertProtobufEquals($formattedParent, $actualValue); - $actualValue = $actualApiRequestObject->getSourceLanguageCode(); - $this->assertProtobufEquals($sourceLanguageCode, $actualValue); - $actualValue = $actualApiRequestObject->getTargetLanguageCodes(); - $this->assertProtobufEquals($targetLanguageCodes, $actualValue); - $actualValue = $actualApiRequestObject->getInputConfigs(); - $this->assertProtobufEquals($inputConfigs, $actualValue); - $actualValue = $actualApiRequestObject->getOutputConfig(); - $this->assertProtobufEquals($outputConfig, $actualValue); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/batchTranslateTextTest'); - $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 batchTranslateTextExceptionTest() - { - $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/batchTranslateTextTest'); - $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 - $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); - $sourceLanguageCode = 'sourceLanguageCode1687263568'; - $targetLanguageCodes = []; - $inputConfigs = []; - $outputConfig = new OutputConfig(); - $response = $gapicClient->batchTranslateText($formattedParent, $sourceLanguageCode, $targetLanguageCodes, $inputConfigs, $outputConfig); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/batchTranslateTextTest'); - 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 createGlossaryTest() - { - $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/createGlossaryTest'); - $incompleteOperation->setDone(false); - $transport->addResponse($incompleteOperation); - $name = 'name3373707'; - $entryCount = 811131134; - $displayName = 'displayName1615086568'; - $expectedResponse = new Glossary(); - $expectedResponse->setName($name); - $expectedResponse->setEntryCount($entryCount); - $expectedResponse->setDisplayName($displayName); - $anyResponse = new Any(); - $anyResponse->setValue($expectedResponse->serializeToString()); - $completeOperation = new Operation(); - $completeOperation->setName('operations/createGlossaryTest'); - $completeOperation->setDone(true); - $completeOperation->setResponse($anyResponse); - $operationsTransport->addResponse($completeOperation); - // Mock request - $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); - $glossary = new Glossary(); - $glossaryName = 'glossaryName-297469495'; - $glossary->setName($glossaryName); - $response = $gapicClient->createGlossary($formattedParent, $glossary); - $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.translation.v3.TranslationService/CreateGlossary', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getParent(); - $this->assertProtobufEquals($formattedParent, $actualValue); - $actualValue = $actualApiRequestObject->getGlossary(); - $this->assertProtobufEquals($glossary, $actualValue); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/createGlossaryTest'); - $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 createGlossaryExceptionTest() - { - $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/createGlossaryTest'); - $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 - $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); - $glossary = new Glossary(); - $glossaryName = 'glossaryName-297469495'; - $glossary->setName($glossaryName); - $response = $gapicClient->createGlossary($formattedParent, $glossary); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/createGlossaryTest'); - 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 deleteGlossaryTest() - { - $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/deleteGlossaryTest'); - $incompleteOperation->setDone(false); - $transport->addResponse($incompleteOperation); - $name2 = 'name2-1052831874'; - $expectedResponse = new DeleteGlossaryResponse(); - $expectedResponse->setName($name2); - $anyResponse = new Any(); - $anyResponse->setValue($expectedResponse->serializeToString()); - $completeOperation = new Operation(); - $completeOperation->setName('operations/deleteGlossaryTest'); - $completeOperation->setDone(true); - $completeOperation->setResponse($anyResponse); - $operationsTransport->addResponse($completeOperation); - // Mock request - $formattedName = $gapicClient->glossaryName('[PROJECT]', '[LOCATION]', '[GLOSSARY]'); - $response = $gapicClient->deleteGlossary($formattedName); - $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.translation.v3.TranslationService/DeleteGlossary', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getName(); - $this->assertProtobufEquals($formattedName, $actualValue); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/deleteGlossaryTest'); - $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 deleteGlossaryExceptionTest() - { - $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/deleteGlossaryTest'); - $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 - $formattedName = $gapicClient->glossaryName('[PROJECT]', '[LOCATION]', '[GLOSSARY]'); - $response = $gapicClient->deleteGlossary($formattedName); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/deleteGlossaryTest'); - 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 detectLanguageTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $expectedResponse = new DetectLanguageResponse(); - $transport->addResponse($expectedResponse); - // Mock request - $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); - $response = $gapicClient->detectLanguage($formattedParent); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.translation.v3.TranslationService/DetectLanguage', $actualFuncCall); - $actualValue = $actualRequestObject->getParent(); - $this->assertProtobufEquals($formattedParent, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function detectLanguageExceptionTest() - { - $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 - $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); - try { - $gapicClient->detectLanguage($formattedParent); - // 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 getGlossaryTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $name2 = 'name2-1052831874'; - $entryCount = 811131134; - $displayName = 'displayName1615086568'; - $expectedResponse = new Glossary(); - $expectedResponse->setName($name2); - $expectedResponse->setEntryCount($entryCount); - $expectedResponse->setDisplayName($displayName); - $transport->addResponse($expectedResponse); - // Mock request - $formattedName = $gapicClient->glossaryName('[PROJECT]', '[LOCATION]', '[GLOSSARY]'); - $response = $gapicClient->getGlossary($formattedName); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.translation.v3.TranslationService/GetGlossary', $actualFuncCall); - $actualValue = $actualRequestObject->getName(); - $this->assertProtobufEquals($formattedName, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getGlossaryExceptionTest() - { - $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 - $formattedName = $gapicClient->glossaryName('[PROJECT]', '[LOCATION]', '[GLOSSARY]'); - try { - $gapicClient->getGlossary($formattedName); - // 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 getSupportedLanguagesTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $expectedResponse = new SupportedLanguages(); - $transport->addResponse($expectedResponse); - // Mock request - $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); - $response = $gapicClient->getSupportedLanguages($formattedParent); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.translation.v3.TranslationService/GetSupportedLanguages', $actualFuncCall); - $actualValue = $actualRequestObject->getParent(); - $this->assertProtobufEquals($formattedParent, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getSupportedLanguagesExceptionTest() - { - $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 - $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); - try { - $gapicClient->getSupportedLanguages($formattedParent); - // 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 listGlossariesTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $nextPageToken = ''; - $glossariesElement = new Glossary(); - $glossaries = [ - $glossariesElement, - ]; - $expectedResponse = new ListGlossariesResponse(); - $expectedResponse->setNextPageToken($nextPageToken); - $expectedResponse->setGlossaries($glossaries); - $transport->addResponse($expectedResponse); - // Mock request - $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); - $response = $gapicClient->listGlossaries($formattedParent); - $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); - $resources = iterator_to_array($response->iterateAllElements()); - $this->assertSame(1, count($resources)); - $this->assertEquals($expectedResponse->getGlossaries()[0], $resources[0]); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.translation.v3.TranslationService/ListGlossaries', $actualFuncCall); - $actualValue = $actualRequestObject->getParent(); - $this->assertProtobufEquals($formattedParent, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listGlossariesExceptionTest() - { - $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 - $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); - try { - $gapicClient->listGlossaries($formattedParent); - // 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 translateDocumentTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $model2 = 'model21226956956'; - $expectedResponse = new TranslateDocumentResponse(); - $expectedResponse->setModel($model2); - $transport->addResponse($expectedResponse); - // Mock request - $parent = 'parent-995424086'; - $targetLanguageCode = 'targetLanguageCode1323228230'; - $documentInputConfig = new DocumentInputConfig(); - $response = $gapicClient->translateDocument($parent, $targetLanguageCode, $documentInputConfig); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.translation.v3.TranslationService/TranslateDocument', $actualFuncCall); - $actualValue = $actualRequestObject->getParent(); - $this->assertProtobufEquals($parent, $actualValue); - $actualValue = $actualRequestObject->getTargetLanguageCode(); - $this->assertProtobufEquals($targetLanguageCode, $actualValue); - $actualValue = $actualRequestObject->getDocumentInputConfig(); - $this->assertProtobufEquals($documentInputConfig, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function translateDocumentExceptionTest() - { - $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 - $parent = 'parent-995424086'; - $targetLanguageCode = 'targetLanguageCode1323228230'; - $documentInputConfig = new DocumentInputConfig(); - try { - $gapicClient->translateDocument($parent, $targetLanguageCode, $documentInputConfig); - // 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 translateTextTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $expectedResponse = new TranslateTextResponse(); - $transport->addResponse($expectedResponse); - // Mock request - $contents = []; - $targetLanguageCode = 'targetLanguageCode1323228230'; - $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); - $response = $gapicClient->translateText($contents, $targetLanguageCode, $formattedParent); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.translation.v3.TranslationService/TranslateText', $actualFuncCall); - $actualValue = $actualRequestObject->getContents(); - $this->assertProtobufEquals($contents, $actualValue); - $actualValue = $actualRequestObject->getTargetLanguageCode(); - $this->assertProtobufEquals($targetLanguageCode, $actualValue); - $actualValue = $actualRequestObject->getParent(); - $this->assertProtobufEquals($formattedParent, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function translateTextExceptionTest() - { - $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 - $contents = []; - $targetLanguageCode = 'targetLanguageCode1323228230'; - $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); - try { - $gapicClient->translateText($contents, $targetLanguageCode, $formattedParent); - // 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()); - } -}