diff --git a/translation/samples/generated_samples/snippet_metadata_translate_v3.json b/translation/samples/generated_samples/snippet_metadata_translate_v3.json new file mode 100644 index 000000000000..32c166f1edf1 --- /dev/null +++ b/translation/samples/generated_samples/snippet_metadata_translate_v3.json @@ -0,0 +1,894 @@ +{ + "snippets": [ + { + "clientMethod": { + "async": true, + "method": { + "service": { + "shortName": "TranslationService" + }, + "shortName": "BatchTranslateDocument" + } + }, + "file": "translate_v3_generated_translation_service_batch_translate_document_async.py", + "regionTag": "translate_v3_generated_TranslationService_BatchTranslateDocument_async", + "segments": [ + { + "end": 58, + "start": 27, + "type": "FULL" + }, + { + "end": 58, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 48, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 55, + "start": 49, + "type": "REQUEST_EXECUTION" + }, + { + "end": 59, + "start": 56, + "type": "RESPONSE_HANDLING" + } + ] + }, + { + "clientMethod": { + "method": { + "service": { + "shortName": "TranslationService" + }, + "shortName": "BatchTranslateDocument" + } + }, + "file": "translate_v3_generated_translation_service_batch_translate_document_sync.py", + "regionTag": "translate_v3_generated_TranslationService_BatchTranslateDocument_sync", + "segments": [ + { + "end": 58, + "start": 27, + "type": "FULL" + }, + { + "end": 58, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 48, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 55, + "start": 49, + "type": "REQUEST_EXECUTION" + }, + { + "end": 59, + "start": 56, + "type": "RESPONSE_HANDLING" + } + ] + }, + { + "clientMethod": { + "async": true, + "method": { + "service": { + "shortName": "TranslationService" + }, + "shortName": "BatchTranslateText" + } + }, + "file": "translate_v3_generated_translation_service_batch_translate_text_async.py", + "regionTag": "translate_v3_generated_TranslationService_BatchTranslateText_async", + "segments": [ + { + "end": 58, + "start": 27, + "type": "FULL" + }, + { + "end": 58, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 48, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 55, + "start": 49, + "type": "REQUEST_EXECUTION" + }, + { + "end": 59, + "start": 56, + "type": "RESPONSE_HANDLING" + } + ] + }, + { + "clientMethod": { + "method": { + "service": { + "shortName": "TranslationService" + }, + "shortName": "BatchTranslateText" + } + }, + "file": "translate_v3_generated_translation_service_batch_translate_text_sync.py", + "regionTag": "translate_v3_generated_TranslationService_BatchTranslateText_sync", + "segments": [ + { + "end": 58, + "start": 27, + "type": "FULL" + }, + { + "end": 58, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 48, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 55, + "start": 49, + "type": "REQUEST_EXECUTION" + }, + { + "end": 59, + "start": 56, + "type": "RESPONSE_HANDLING" + } + ] + }, + { + "clientMethod": { + "async": true, + "method": { + "service": { + "shortName": "TranslationService" + }, + "shortName": "CreateGlossary" + } + }, + "file": "translate_v3_generated_translation_service_create_glossary_async.py", + "regionTag": "translate_v3_generated_TranslationService_CreateGlossary_async", + "segments": [ + { + "end": 52, + "start": 27, + "type": "FULL" + }, + { + "end": 52, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 42, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 49, + "start": 43, + "type": "REQUEST_EXECUTION" + }, + { + "end": 53, + "start": 50, + "type": "RESPONSE_HANDLING" + } + ] + }, + { + "clientMethod": { + "method": { + "service": { + "shortName": "TranslationService" + }, + "shortName": "CreateGlossary" + } + }, + "file": "translate_v3_generated_translation_service_create_glossary_sync.py", + "regionTag": "translate_v3_generated_TranslationService_CreateGlossary_sync", + "segments": [ + { + "end": 52, + "start": 27, + "type": "FULL" + }, + { + "end": 52, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 42, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 49, + "start": 43, + "type": "REQUEST_EXECUTION" + }, + { + "end": 53, + "start": 50, + "type": "RESPONSE_HANDLING" + } + ] + }, + { + "clientMethod": { + "async": true, + "method": { + "service": { + "shortName": "TranslationService" + }, + "shortName": "DeleteGlossary" + } + }, + "file": "translate_v3_generated_translation_service_delete_glossary_async.py", + "regionTag": "translate_v3_generated_TranslationService_DeleteGlossary_async", + "segments": [ + { + "end": 48, + "start": 27, + "type": "FULL" + }, + { + "end": 48, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 38, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 45, + "start": 39, + "type": "REQUEST_EXECUTION" + }, + { + "end": 49, + "start": 46, + "type": "RESPONSE_HANDLING" + } + ] + }, + { + "clientMethod": { + "method": { + "service": { + "shortName": "TranslationService" + }, + "shortName": "DeleteGlossary" + } + }, + "file": "translate_v3_generated_translation_service_delete_glossary_sync.py", + "regionTag": "translate_v3_generated_TranslationService_DeleteGlossary_sync", + "segments": [ + { + "end": 48, + "start": 27, + "type": "FULL" + }, + { + "end": 48, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 38, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 45, + "start": 39, + "type": "REQUEST_EXECUTION" + }, + { + "end": 49, + "start": 46, + "type": "RESPONSE_HANDLING" + } + ] + }, + { + "clientMethod": { + "async": true, + "method": { + "service": { + "shortName": "TranslationService" + }, + "shortName": "DetectLanguage" + } + }, + "file": "translate_v3_generated_translation_service_detect_language_async.py", + "regionTag": "translate_v3_generated_TranslationService_DetectLanguage_async", + "segments": [ + { + "end": 45, + "start": 27, + "type": "FULL" + }, + { + "end": 45, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 39, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 42, + "start": 40, + "type": "REQUEST_EXECUTION" + }, + { + "end": 46, + "start": 43, + "type": "RESPONSE_HANDLING" + } + ] + }, + { + "clientMethod": { + "method": { + "service": { + "shortName": "TranslationService" + }, + "shortName": "DetectLanguage" + } + }, + "file": "translate_v3_generated_translation_service_detect_language_sync.py", + "regionTag": "translate_v3_generated_TranslationService_DetectLanguage_sync", + "segments": [ + { + "end": 45, + "start": 27, + "type": "FULL" + }, + { + "end": 45, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 39, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 42, + "start": 40, + "type": "REQUEST_EXECUTION" + }, + { + "end": 46, + "start": 43, + "type": "RESPONSE_HANDLING" + } + ] + }, + { + "clientMethod": { + "async": true, + "method": { + "service": { + "shortName": "TranslationService" + }, + "shortName": "GetGlossary" + } + }, + "file": "translate_v3_generated_translation_service_get_glossary_async.py", + "regionTag": "translate_v3_generated_TranslationService_GetGlossary_async", + "segments": [ + { + "end": 44, + "start": 27, + "type": "FULL" + }, + { + "end": 44, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 38, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 41, + "start": 39, + "type": "REQUEST_EXECUTION" + }, + { + "end": 45, + "start": 42, + "type": "RESPONSE_HANDLING" + } + ] + }, + { + "clientMethod": { + "method": { + "service": { + "shortName": "TranslationService" + }, + "shortName": "GetGlossary" + } + }, + "file": "translate_v3_generated_translation_service_get_glossary_sync.py", + "regionTag": "translate_v3_generated_TranslationService_GetGlossary_sync", + "segments": [ + { + "end": 44, + "start": 27, + "type": "FULL" + }, + { + "end": 44, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 38, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 41, + "start": 39, + "type": "REQUEST_EXECUTION" + }, + { + "end": 45, + "start": 42, + "type": "RESPONSE_HANDLING" + } + ] + }, + { + "clientMethod": { + "async": true, + "method": { + "service": { + "shortName": "TranslationService" + }, + "shortName": "GetSupportedLanguages" + } + }, + "file": "translate_v3_generated_translation_service_get_supported_languages_async.py", + "regionTag": "translate_v3_generated_TranslationService_GetSupportedLanguages_async", + "segments": [ + { + "end": 44, + "start": 27, + "type": "FULL" + }, + { + "end": 44, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 38, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 41, + "start": 39, + "type": "REQUEST_EXECUTION" + }, + { + "end": 45, + "start": 42, + "type": "RESPONSE_HANDLING" + } + ] + }, + { + "clientMethod": { + "method": { + "service": { + "shortName": "TranslationService" + }, + "shortName": "GetSupportedLanguages" + } + }, + "file": "translate_v3_generated_translation_service_get_supported_languages_sync.py", + "regionTag": "translate_v3_generated_TranslationService_GetSupportedLanguages_sync", + "segments": [ + { + "end": 44, + "start": 27, + "type": "FULL" + }, + { + "end": 44, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 38, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 41, + "start": 39, + "type": "REQUEST_EXECUTION" + }, + { + "end": 45, + "start": 42, + "type": "RESPONSE_HANDLING" + } + ] + }, + { + "clientMethod": { + "async": true, + "method": { + "service": { + "shortName": "TranslationService" + }, + "shortName": "ListGlossaries" + } + }, + "file": "translate_v3_generated_translation_service_list_glossaries_async.py", + "regionTag": "translate_v3_generated_TranslationService_ListGlossaries_async", + "segments": [ + { + "end": 45, + "start": 27, + "type": "FULL" + }, + { + "end": 45, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 38, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 41, + "start": 39, + "type": "REQUEST_EXECUTION" + }, + { + "end": 46, + "start": 42, + "type": "RESPONSE_HANDLING" + } + ] + }, + { + "clientMethod": { + "method": { + "service": { + "shortName": "TranslationService" + }, + "shortName": "ListGlossaries" + } + }, + "file": "translate_v3_generated_translation_service_list_glossaries_sync.py", + "regionTag": "translate_v3_generated_TranslationService_ListGlossaries_sync", + "segments": [ + { + "end": 45, + "start": 27, + "type": "FULL" + }, + { + "end": 45, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 38, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 41, + "start": 39, + "type": "REQUEST_EXECUTION" + }, + { + "end": 46, + "start": 42, + "type": "RESPONSE_HANDLING" + } + ] + }, + { + "clientMethod": { + "async": true, + "method": { + "service": { + "shortName": "TranslationService" + }, + "shortName": "TranslateDocument" + } + }, + "file": "translate_v3_generated_translation_service_translate_document_async.py", + "regionTag": "translate_v3_generated_TranslationService_TranslateDocument_async", + "segments": [ + { + "end": 49, + "start": 27, + "type": "FULL" + }, + { + "end": 49, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 43, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 46, + "start": 44, + "type": "REQUEST_EXECUTION" + }, + { + "end": 50, + "start": 47, + "type": "RESPONSE_HANDLING" + } + ] + }, + { + "clientMethod": { + "method": { + "service": { + "shortName": "TranslationService" + }, + "shortName": "TranslateDocument" + } + }, + "file": "translate_v3_generated_translation_service_translate_document_sync.py", + "regionTag": "translate_v3_generated_TranslationService_TranslateDocument_sync", + "segments": [ + { + "end": 49, + "start": 27, + "type": "FULL" + }, + { + "end": 49, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 43, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 46, + "start": 44, + "type": "REQUEST_EXECUTION" + }, + { + "end": 50, + "start": 47, + "type": "RESPONSE_HANDLING" + } + ] + }, + { + "clientMethod": { + "async": true, + "method": { + "service": { + "shortName": "TranslationService" + }, + "shortName": "TranslateText" + } + }, + "file": "translate_v3_generated_translation_service_translate_text_async.py", + "regionTag": "translate_v3_generated_TranslationService_TranslateText_async", + "segments": [ + { + "end": 46, + "start": 27, + "type": "FULL" + }, + { + "end": 46, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 40, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 43, + "start": 41, + "type": "REQUEST_EXECUTION" + }, + { + "end": 47, + "start": 44, + "type": "RESPONSE_HANDLING" + } + ] + }, + { + "clientMethod": { + "method": { + "service": { + "shortName": "TranslationService" + }, + "shortName": "TranslateText" + } + }, + "file": "translate_v3_generated_translation_service_translate_text_sync.py", + "regionTag": "translate_v3_generated_TranslationService_TranslateText_sync", + "segments": [ + { + "end": 46, + "start": 27, + "type": "FULL" + }, + { + "end": 46, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 40, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 43, + "start": 41, + "type": "REQUEST_EXECUTION" + }, + { + "end": 47, + "start": 44, + "type": "RESPONSE_HANDLING" + } + ] + } + ] +} diff --git a/translation/samples/generated_samples/snippet_metadata_translate_v3beta1.json b/translation/samples/generated_samples/snippet_metadata_translate_v3beta1.json new file mode 100644 index 000000000000..537673e5f759 --- /dev/null +++ b/translation/samples/generated_samples/snippet_metadata_translate_v3beta1.json @@ -0,0 +1,894 @@ +{ + "snippets": [ + { + "clientMethod": { + "async": true, + "method": { + "service": { + "shortName": "TranslationService" + }, + "shortName": "BatchTranslateDocument" + } + }, + "file": "translate_v3beta1_generated_translation_service_batch_translate_document_async.py", + "regionTag": "translate_v3beta1_generated_TranslationService_BatchTranslateDocument_async", + "segments": [ + { + "end": 58, + "start": 27, + "type": "FULL" + }, + { + "end": 58, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 48, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 55, + "start": 49, + "type": "REQUEST_EXECUTION" + }, + { + "end": 59, + "start": 56, + "type": "RESPONSE_HANDLING" + } + ] + }, + { + "clientMethod": { + "method": { + "service": { + "shortName": "TranslationService" + }, + "shortName": "BatchTranslateDocument" + } + }, + "file": "translate_v3beta1_generated_translation_service_batch_translate_document_sync.py", + "regionTag": "translate_v3beta1_generated_TranslationService_BatchTranslateDocument_sync", + "segments": [ + { + "end": 58, + "start": 27, + "type": "FULL" + }, + { + "end": 58, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 48, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 55, + "start": 49, + "type": "REQUEST_EXECUTION" + }, + { + "end": 59, + "start": 56, + "type": "RESPONSE_HANDLING" + } + ] + }, + { + "clientMethod": { + "async": true, + "method": { + "service": { + "shortName": "TranslationService" + }, + "shortName": "BatchTranslateText" + } + }, + "file": "translate_v3beta1_generated_translation_service_batch_translate_text_async.py", + "regionTag": "translate_v3beta1_generated_TranslationService_BatchTranslateText_async", + "segments": [ + { + "end": 58, + "start": 27, + "type": "FULL" + }, + { + "end": 58, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 48, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 55, + "start": 49, + "type": "REQUEST_EXECUTION" + }, + { + "end": 59, + "start": 56, + "type": "RESPONSE_HANDLING" + } + ] + }, + { + "clientMethod": { + "method": { + "service": { + "shortName": "TranslationService" + }, + "shortName": "BatchTranslateText" + } + }, + "file": "translate_v3beta1_generated_translation_service_batch_translate_text_sync.py", + "regionTag": "translate_v3beta1_generated_TranslationService_BatchTranslateText_sync", + "segments": [ + { + "end": 58, + "start": 27, + "type": "FULL" + }, + { + "end": 58, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 48, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 55, + "start": 49, + "type": "REQUEST_EXECUTION" + }, + { + "end": 59, + "start": 56, + "type": "RESPONSE_HANDLING" + } + ] + }, + { + "clientMethod": { + "async": true, + "method": { + "service": { + "shortName": "TranslationService" + }, + "shortName": "CreateGlossary" + } + }, + "file": "translate_v3beta1_generated_translation_service_create_glossary_async.py", + "regionTag": "translate_v3beta1_generated_TranslationService_CreateGlossary_async", + "segments": [ + { + "end": 52, + "start": 27, + "type": "FULL" + }, + { + "end": 52, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 42, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 49, + "start": 43, + "type": "REQUEST_EXECUTION" + }, + { + "end": 53, + "start": 50, + "type": "RESPONSE_HANDLING" + } + ] + }, + { + "clientMethod": { + "method": { + "service": { + "shortName": "TranslationService" + }, + "shortName": "CreateGlossary" + } + }, + "file": "translate_v3beta1_generated_translation_service_create_glossary_sync.py", + "regionTag": "translate_v3beta1_generated_TranslationService_CreateGlossary_sync", + "segments": [ + { + "end": 52, + "start": 27, + "type": "FULL" + }, + { + "end": 52, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 42, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 49, + "start": 43, + "type": "REQUEST_EXECUTION" + }, + { + "end": 53, + "start": 50, + "type": "RESPONSE_HANDLING" + } + ] + }, + { + "clientMethod": { + "async": true, + "method": { + "service": { + "shortName": "TranslationService" + }, + "shortName": "DeleteGlossary" + } + }, + "file": "translate_v3beta1_generated_translation_service_delete_glossary_async.py", + "regionTag": "translate_v3beta1_generated_TranslationService_DeleteGlossary_async", + "segments": [ + { + "end": 48, + "start": 27, + "type": "FULL" + }, + { + "end": 48, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 38, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 45, + "start": 39, + "type": "REQUEST_EXECUTION" + }, + { + "end": 49, + "start": 46, + "type": "RESPONSE_HANDLING" + } + ] + }, + { + "clientMethod": { + "method": { + "service": { + "shortName": "TranslationService" + }, + "shortName": "DeleteGlossary" + } + }, + "file": "translate_v3beta1_generated_translation_service_delete_glossary_sync.py", + "regionTag": "translate_v3beta1_generated_TranslationService_DeleteGlossary_sync", + "segments": [ + { + "end": 48, + "start": 27, + "type": "FULL" + }, + { + "end": 48, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 38, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 45, + "start": 39, + "type": "REQUEST_EXECUTION" + }, + { + "end": 49, + "start": 46, + "type": "RESPONSE_HANDLING" + } + ] + }, + { + "clientMethod": { + "async": true, + "method": { + "service": { + "shortName": "TranslationService" + }, + "shortName": "DetectLanguage" + } + }, + "file": "translate_v3beta1_generated_translation_service_detect_language_async.py", + "regionTag": "translate_v3beta1_generated_TranslationService_DetectLanguage_async", + "segments": [ + { + "end": 45, + "start": 27, + "type": "FULL" + }, + { + "end": 45, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 39, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 42, + "start": 40, + "type": "REQUEST_EXECUTION" + }, + { + "end": 46, + "start": 43, + "type": "RESPONSE_HANDLING" + } + ] + }, + { + "clientMethod": { + "method": { + "service": { + "shortName": "TranslationService" + }, + "shortName": "DetectLanguage" + } + }, + "file": "translate_v3beta1_generated_translation_service_detect_language_sync.py", + "regionTag": "translate_v3beta1_generated_TranslationService_DetectLanguage_sync", + "segments": [ + { + "end": 45, + "start": 27, + "type": "FULL" + }, + { + "end": 45, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 39, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 42, + "start": 40, + "type": "REQUEST_EXECUTION" + }, + { + "end": 46, + "start": 43, + "type": "RESPONSE_HANDLING" + } + ] + }, + { + "clientMethod": { + "async": true, + "method": { + "service": { + "shortName": "TranslationService" + }, + "shortName": "GetGlossary" + } + }, + "file": "translate_v3beta1_generated_translation_service_get_glossary_async.py", + "regionTag": "translate_v3beta1_generated_TranslationService_GetGlossary_async", + "segments": [ + { + "end": 44, + "start": 27, + "type": "FULL" + }, + { + "end": 44, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 38, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 41, + "start": 39, + "type": "REQUEST_EXECUTION" + }, + { + "end": 45, + "start": 42, + "type": "RESPONSE_HANDLING" + } + ] + }, + { + "clientMethod": { + "method": { + "service": { + "shortName": "TranslationService" + }, + "shortName": "GetGlossary" + } + }, + "file": "translate_v3beta1_generated_translation_service_get_glossary_sync.py", + "regionTag": "translate_v3beta1_generated_TranslationService_GetGlossary_sync", + "segments": [ + { + "end": 44, + "start": 27, + "type": "FULL" + }, + { + "end": 44, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 38, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 41, + "start": 39, + "type": "REQUEST_EXECUTION" + }, + { + "end": 45, + "start": 42, + "type": "RESPONSE_HANDLING" + } + ] + }, + { + "clientMethod": { + "async": true, + "method": { + "service": { + "shortName": "TranslationService" + }, + "shortName": "GetSupportedLanguages" + } + }, + "file": "translate_v3beta1_generated_translation_service_get_supported_languages_async.py", + "regionTag": "translate_v3beta1_generated_TranslationService_GetSupportedLanguages_async", + "segments": [ + { + "end": 44, + "start": 27, + "type": "FULL" + }, + { + "end": 44, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 38, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 41, + "start": 39, + "type": "REQUEST_EXECUTION" + }, + { + "end": 45, + "start": 42, + "type": "RESPONSE_HANDLING" + } + ] + }, + { + "clientMethod": { + "method": { + "service": { + "shortName": "TranslationService" + }, + "shortName": "GetSupportedLanguages" + } + }, + "file": "translate_v3beta1_generated_translation_service_get_supported_languages_sync.py", + "regionTag": "translate_v3beta1_generated_TranslationService_GetSupportedLanguages_sync", + "segments": [ + { + "end": 44, + "start": 27, + "type": "FULL" + }, + { + "end": 44, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 38, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 41, + "start": 39, + "type": "REQUEST_EXECUTION" + }, + { + "end": 45, + "start": 42, + "type": "RESPONSE_HANDLING" + } + ] + }, + { + "clientMethod": { + "async": true, + "method": { + "service": { + "shortName": "TranslationService" + }, + "shortName": "ListGlossaries" + } + }, + "file": "translate_v3beta1_generated_translation_service_list_glossaries_async.py", + "regionTag": "translate_v3beta1_generated_TranslationService_ListGlossaries_async", + "segments": [ + { + "end": 45, + "start": 27, + "type": "FULL" + }, + { + "end": 45, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 38, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 41, + "start": 39, + "type": "REQUEST_EXECUTION" + }, + { + "end": 46, + "start": 42, + "type": "RESPONSE_HANDLING" + } + ] + }, + { + "clientMethod": { + "method": { + "service": { + "shortName": "TranslationService" + }, + "shortName": "ListGlossaries" + } + }, + "file": "translate_v3beta1_generated_translation_service_list_glossaries_sync.py", + "regionTag": "translate_v3beta1_generated_TranslationService_ListGlossaries_sync", + "segments": [ + { + "end": 45, + "start": 27, + "type": "FULL" + }, + { + "end": 45, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 38, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 41, + "start": 39, + "type": "REQUEST_EXECUTION" + }, + { + "end": 46, + "start": 42, + "type": "RESPONSE_HANDLING" + } + ] + }, + { + "clientMethod": { + "async": true, + "method": { + "service": { + "shortName": "TranslationService" + }, + "shortName": "TranslateDocument" + } + }, + "file": "translate_v3beta1_generated_translation_service_translate_document_async.py", + "regionTag": "translate_v3beta1_generated_TranslationService_TranslateDocument_async", + "segments": [ + { + "end": 49, + "start": 27, + "type": "FULL" + }, + { + "end": 49, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 43, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 46, + "start": 44, + "type": "REQUEST_EXECUTION" + }, + { + "end": 50, + "start": 47, + "type": "RESPONSE_HANDLING" + } + ] + }, + { + "clientMethod": { + "method": { + "service": { + "shortName": "TranslationService" + }, + "shortName": "TranslateDocument" + } + }, + "file": "translate_v3beta1_generated_translation_service_translate_document_sync.py", + "regionTag": "translate_v3beta1_generated_TranslationService_TranslateDocument_sync", + "segments": [ + { + "end": 49, + "start": 27, + "type": "FULL" + }, + { + "end": 49, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 43, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 46, + "start": 44, + "type": "REQUEST_EXECUTION" + }, + { + "end": 50, + "start": 47, + "type": "RESPONSE_HANDLING" + } + ] + }, + { + "clientMethod": { + "async": true, + "method": { + "service": { + "shortName": "TranslationService" + }, + "shortName": "TranslateText" + } + }, + "file": "translate_v3beta1_generated_translation_service_translate_text_async.py", + "regionTag": "translate_v3beta1_generated_TranslationService_TranslateText_async", + "segments": [ + { + "end": 46, + "start": 27, + "type": "FULL" + }, + { + "end": 46, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 40, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 43, + "start": 41, + "type": "REQUEST_EXECUTION" + }, + { + "end": 47, + "start": 44, + "type": "RESPONSE_HANDLING" + } + ] + }, + { + "clientMethod": { + "method": { + "service": { + "shortName": "TranslationService" + }, + "shortName": "TranslateText" + } + }, + "file": "translate_v3beta1_generated_translation_service_translate_text_sync.py", + "regionTag": "translate_v3beta1_generated_TranslationService_TranslateText_sync", + "segments": [ + { + "end": 46, + "start": 27, + "type": "FULL" + }, + { + "end": 46, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 40, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 43, + "start": 41, + "type": "REQUEST_EXECUTION" + }, + { + "end": 47, + "start": 44, + "type": "RESPONSE_HANDLING" + } + ] + } + ] +} diff --git a/translation/samples/generated_samples/translate_generated_translate_v3_translation_service_batch_translate_document_async.py b/translation/samples/generated_samples/translate_generated_translate_v3_translation_service_batch_translate_document_async.py new file mode 100644 index 000000000000..a43e5e4ebe75 --- /dev/null +++ b/translation/samples/generated_samples/translate_generated_translate_v3_translation_service_batch_translate_document_async.py @@ -0,0 +1,59 @@ +# -*- coding: utf-8 -*- +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for BatchTranslateDocument +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-translate + + +# [START translate_generated_translate_v3_TranslationService_BatchTranslateDocument_async] +from google.cloud import translate_v3 + + +async def sample_batch_translate_document(): + # Create a client + client = translate_v3.TranslationServiceAsyncClient() + + # Initialize request argument(s) + input_configs = translate_v3.BatchDocumentInputConfig() + input_configs.gcs_source.input_uri = "input_uri_value" + + output_config = translate_v3.BatchDocumentOutputConfig() + output_config.gcs_destination.output_uri_prefix = "output_uri_prefix_value" + + request = translate_v3.BatchTranslateDocumentRequest( + parent="parent_value", + source_language_code="source_language_code_value", + target_language_codes=['target_language_codes_value_1', 'target_language_codes_value_2'], + input_configs=input_configs, + output_config=output_config, + ) + + # Make the request + operation = client.batch_translate_document(request=request) + + print("Waiting for operation to complete...") + + response = await operation.result() + + # Handle the response + print(response) + +# [END translate_generated_translate_v3_TranslationService_BatchTranslateDocument_async] diff --git a/translation/samples/generated_samples/translate_generated_translate_v3_translation_service_batch_translate_document_sync.py b/translation/samples/generated_samples/translate_generated_translate_v3_translation_service_batch_translate_document_sync.py new file mode 100644 index 000000000000..bf3588562be6 --- /dev/null +++ b/translation/samples/generated_samples/translate_generated_translate_v3_translation_service_batch_translate_document_sync.py @@ -0,0 +1,59 @@ +# -*- coding: utf-8 -*- +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for BatchTranslateDocument +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-translate + + +# [START translate_generated_translate_v3_TranslationService_BatchTranslateDocument_sync] +from google.cloud import translate_v3 + + +def sample_batch_translate_document(): + # Create a client + client = translate_v3.TranslationServiceClient() + + # Initialize request argument(s) + input_configs = translate_v3.BatchDocumentInputConfig() + input_configs.gcs_source.input_uri = "input_uri_value" + + output_config = translate_v3.BatchDocumentOutputConfig() + output_config.gcs_destination.output_uri_prefix = "output_uri_prefix_value" + + request = translate_v3.BatchTranslateDocumentRequest( + parent="parent_value", + source_language_code="source_language_code_value", + target_language_codes=['target_language_codes_value_1', 'target_language_codes_value_2'], + input_configs=input_configs, + output_config=output_config, + ) + + # Make the request + operation = client.batch_translate_document(request=request) + + print("Waiting for operation to complete...") + + response = operation.result() + + # Handle the response + print(response) + +# [END translate_generated_translate_v3_TranslationService_BatchTranslateDocument_sync] diff --git a/translation/samples/generated_samples/translate_generated_translate_v3_translation_service_batch_translate_text_async.py b/translation/samples/generated_samples/translate_generated_translate_v3_translation_service_batch_translate_text_async.py new file mode 100644 index 000000000000..431f7edfd975 --- /dev/null +++ b/translation/samples/generated_samples/translate_generated_translate_v3_translation_service_batch_translate_text_async.py @@ -0,0 +1,59 @@ +# -*- coding: utf-8 -*- +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for BatchTranslateText +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-translate + + +# [START translate_generated_translate_v3_TranslationService_BatchTranslateText_async] +from google.cloud import translate_v3 + + +async def sample_batch_translate_text(): + # Create a client + client = translate_v3.TranslationServiceAsyncClient() + + # Initialize request argument(s) + input_configs = translate_v3.InputConfig() + input_configs.gcs_source.input_uri = "input_uri_value" + + output_config = translate_v3.OutputConfig() + output_config.gcs_destination.output_uri_prefix = "output_uri_prefix_value" + + request = translate_v3.BatchTranslateTextRequest( + parent="parent_value", + source_language_code="source_language_code_value", + target_language_codes=['target_language_codes_value_1', 'target_language_codes_value_2'], + input_configs=input_configs, + output_config=output_config, + ) + + # Make the request + operation = client.batch_translate_text(request=request) + + print("Waiting for operation to complete...") + + response = await operation.result() + + # Handle the response + print(response) + +# [END translate_generated_translate_v3_TranslationService_BatchTranslateText_async] diff --git a/translation/samples/generated_samples/translate_generated_translate_v3_translation_service_batch_translate_text_sync.py b/translation/samples/generated_samples/translate_generated_translate_v3_translation_service_batch_translate_text_sync.py new file mode 100644 index 000000000000..68f8b1ff2e81 --- /dev/null +++ b/translation/samples/generated_samples/translate_generated_translate_v3_translation_service_batch_translate_text_sync.py @@ -0,0 +1,59 @@ +# -*- coding: utf-8 -*- +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for BatchTranslateText +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-translate + + +# [START translate_generated_translate_v3_TranslationService_BatchTranslateText_sync] +from google.cloud import translate_v3 + + +def sample_batch_translate_text(): + # Create a client + client = translate_v3.TranslationServiceClient() + + # Initialize request argument(s) + input_configs = translate_v3.InputConfig() + input_configs.gcs_source.input_uri = "input_uri_value" + + output_config = translate_v3.OutputConfig() + output_config.gcs_destination.output_uri_prefix = "output_uri_prefix_value" + + request = translate_v3.BatchTranslateTextRequest( + parent="parent_value", + source_language_code="source_language_code_value", + target_language_codes=['target_language_codes_value_1', 'target_language_codes_value_2'], + input_configs=input_configs, + output_config=output_config, + ) + + # Make the request + operation = client.batch_translate_text(request=request) + + print("Waiting for operation to complete...") + + response = operation.result() + + # Handle the response + print(response) + +# [END translate_generated_translate_v3_TranslationService_BatchTranslateText_sync] diff --git a/translation/samples/generated_samples/translate_generated_translate_v3_translation_service_create_glossary_async.py b/translation/samples/generated_samples/translate_generated_translate_v3_translation_service_create_glossary_async.py new file mode 100644 index 000000000000..a407ed4613ad --- /dev/null +++ b/translation/samples/generated_samples/translate_generated_translate_v3_translation_service_create_glossary_async.py @@ -0,0 +1,53 @@ +# -*- coding: utf-8 -*- +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for CreateGlossary +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-translate + + +# [START translate_generated_translate_v3_TranslationService_CreateGlossary_async] +from google.cloud import translate_v3 + + +async def sample_create_glossary(): + # Create a client + client = translate_v3.TranslationServiceAsyncClient() + + # Initialize request argument(s) + glossary = translate_v3.Glossary() + glossary.name = "name_value" + + request = translate_v3.CreateGlossaryRequest( + parent="parent_value", + glossary=glossary, + ) + + # Make the request + operation = client.create_glossary(request=request) + + print("Waiting for operation to complete...") + + response = await operation.result() + + # Handle the response + print(response) + +# [END translate_generated_translate_v3_TranslationService_CreateGlossary_async] diff --git a/translation/samples/generated_samples/translate_generated_translate_v3_translation_service_create_glossary_sync.py b/translation/samples/generated_samples/translate_generated_translate_v3_translation_service_create_glossary_sync.py new file mode 100644 index 000000000000..68fcc191eeb9 --- /dev/null +++ b/translation/samples/generated_samples/translate_generated_translate_v3_translation_service_create_glossary_sync.py @@ -0,0 +1,53 @@ +# -*- coding: utf-8 -*- +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for CreateGlossary +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-translate + + +# [START translate_generated_translate_v3_TranslationService_CreateGlossary_sync] +from google.cloud import translate_v3 + + +def sample_create_glossary(): + # Create a client + client = translate_v3.TranslationServiceClient() + + # Initialize request argument(s) + glossary = translate_v3.Glossary() + glossary.name = "name_value" + + request = translate_v3.CreateGlossaryRequest( + parent="parent_value", + glossary=glossary, + ) + + # Make the request + operation = client.create_glossary(request=request) + + print("Waiting for operation to complete...") + + response = operation.result() + + # Handle the response + print(response) + +# [END translate_generated_translate_v3_TranslationService_CreateGlossary_sync] diff --git a/translation/samples/generated_samples/translate_generated_translate_v3_translation_service_delete_glossary_async.py b/translation/samples/generated_samples/translate_generated_translate_v3_translation_service_delete_glossary_async.py new file mode 100644 index 000000000000..9e859d687091 --- /dev/null +++ b/translation/samples/generated_samples/translate_generated_translate_v3_translation_service_delete_glossary_async.py @@ -0,0 +1,49 @@ +# -*- coding: utf-8 -*- +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for DeleteGlossary +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-translate + + +# [START translate_generated_translate_v3_TranslationService_DeleteGlossary_async] +from google.cloud import translate_v3 + + +async def sample_delete_glossary(): + # Create a client + client = translate_v3.TranslationServiceAsyncClient() + + # Initialize request argument(s) + request = translate_v3.DeleteGlossaryRequest( + name="name_value", + ) + + # Make the request + operation = client.delete_glossary(request=request) + + print("Waiting for operation to complete...") + + response = await operation.result() + + # Handle the response + print(response) + +# [END translate_generated_translate_v3_TranslationService_DeleteGlossary_async] diff --git a/translation/samples/generated_samples/translate_generated_translate_v3_translation_service_delete_glossary_sync.py b/translation/samples/generated_samples/translate_generated_translate_v3_translation_service_delete_glossary_sync.py new file mode 100644 index 000000000000..e397a1bda26c --- /dev/null +++ b/translation/samples/generated_samples/translate_generated_translate_v3_translation_service_delete_glossary_sync.py @@ -0,0 +1,49 @@ +# -*- coding: utf-8 -*- +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for DeleteGlossary +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-translate + + +# [START translate_generated_translate_v3_TranslationService_DeleteGlossary_sync] +from google.cloud import translate_v3 + + +def sample_delete_glossary(): + # Create a client + client = translate_v3.TranslationServiceClient() + + # Initialize request argument(s) + request = translate_v3.DeleteGlossaryRequest( + name="name_value", + ) + + # Make the request + operation = client.delete_glossary(request=request) + + print("Waiting for operation to complete...") + + response = operation.result() + + # Handle the response + print(response) + +# [END translate_generated_translate_v3_TranslationService_DeleteGlossary_sync] diff --git a/translation/samples/generated_samples/translate_generated_translate_v3_translation_service_detect_language_async.py b/translation/samples/generated_samples/translate_generated_translate_v3_translation_service_detect_language_async.py new file mode 100644 index 000000000000..3539d116af08 --- /dev/null +++ b/translation/samples/generated_samples/translate_generated_translate_v3_translation_service_detect_language_async.py @@ -0,0 +1,46 @@ +# -*- coding: utf-8 -*- +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for DetectLanguage +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-translate + + +# [START translate_generated_translate_v3_TranslationService_DetectLanguage_async] +from google.cloud import translate_v3 + + +async def sample_detect_language(): + # Create a client + client = translate_v3.TranslationServiceAsyncClient() + + # Initialize request argument(s) + request = translate_v3.DetectLanguageRequest( + content="content_value", + parent="parent_value", + ) + + # Make the request + response = await client.detect_language(request=request) + + # Handle the response + print(response) + +# [END translate_generated_translate_v3_TranslationService_DetectLanguage_async] diff --git a/translation/samples/generated_samples/translate_generated_translate_v3_translation_service_detect_language_sync.py b/translation/samples/generated_samples/translate_generated_translate_v3_translation_service_detect_language_sync.py new file mode 100644 index 000000000000..5f76924c8d7d --- /dev/null +++ b/translation/samples/generated_samples/translate_generated_translate_v3_translation_service_detect_language_sync.py @@ -0,0 +1,46 @@ +# -*- coding: utf-8 -*- +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for DetectLanguage +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-translate + + +# [START translate_generated_translate_v3_TranslationService_DetectLanguage_sync] +from google.cloud import translate_v3 + + +def sample_detect_language(): + # Create a client + client = translate_v3.TranslationServiceClient() + + # Initialize request argument(s) + request = translate_v3.DetectLanguageRequest( + content="content_value", + parent="parent_value", + ) + + # Make the request + response = client.detect_language(request=request) + + # Handle the response + print(response) + +# [END translate_generated_translate_v3_TranslationService_DetectLanguage_sync] diff --git a/translation/samples/generated_samples/translate_generated_translate_v3_translation_service_get_glossary_async.py b/translation/samples/generated_samples/translate_generated_translate_v3_translation_service_get_glossary_async.py new file mode 100644 index 000000000000..ffd2fd34e3f1 --- /dev/null +++ b/translation/samples/generated_samples/translate_generated_translate_v3_translation_service_get_glossary_async.py @@ -0,0 +1,45 @@ +# -*- coding: utf-8 -*- +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for GetGlossary +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-translate + + +# [START translate_generated_translate_v3_TranslationService_GetGlossary_async] +from google.cloud import translate_v3 + + +async def sample_get_glossary(): + # Create a client + client = translate_v3.TranslationServiceAsyncClient() + + # Initialize request argument(s) + request = translate_v3.GetGlossaryRequest( + name="name_value", + ) + + # Make the request + response = await client.get_glossary(request=request) + + # Handle the response + print(response) + +# [END translate_generated_translate_v3_TranslationService_GetGlossary_async] diff --git a/translation/samples/generated_samples/translate_generated_translate_v3_translation_service_get_glossary_sync.py b/translation/samples/generated_samples/translate_generated_translate_v3_translation_service_get_glossary_sync.py new file mode 100644 index 000000000000..751b4dad21b6 --- /dev/null +++ b/translation/samples/generated_samples/translate_generated_translate_v3_translation_service_get_glossary_sync.py @@ -0,0 +1,45 @@ +# -*- coding: utf-8 -*- +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for GetGlossary +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-translate + + +# [START translate_generated_translate_v3_TranslationService_GetGlossary_sync] +from google.cloud import translate_v3 + + +def sample_get_glossary(): + # Create a client + client = translate_v3.TranslationServiceClient() + + # Initialize request argument(s) + request = translate_v3.GetGlossaryRequest( + name="name_value", + ) + + # Make the request + response = client.get_glossary(request=request) + + # Handle the response + print(response) + +# [END translate_generated_translate_v3_TranslationService_GetGlossary_sync] diff --git a/translation/samples/generated_samples/translate_generated_translate_v3_translation_service_get_supported_languages_async.py b/translation/samples/generated_samples/translate_generated_translate_v3_translation_service_get_supported_languages_async.py new file mode 100644 index 000000000000..279fe4fd3868 --- /dev/null +++ b/translation/samples/generated_samples/translate_generated_translate_v3_translation_service_get_supported_languages_async.py @@ -0,0 +1,45 @@ +# -*- coding: utf-8 -*- +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for GetSupportedLanguages +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-translate + + +# [START translate_generated_translate_v3_TranslationService_GetSupportedLanguages_async] +from google.cloud import translate_v3 + + +async def sample_get_supported_languages(): + # Create a client + client = translate_v3.TranslationServiceAsyncClient() + + # Initialize request argument(s) + request = translate_v3.GetSupportedLanguagesRequest( + parent="parent_value", + ) + + # Make the request + response = await client.get_supported_languages(request=request) + + # Handle the response + print(response) + +# [END translate_generated_translate_v3_TranslationService_GetSupportedLanguages_async] diff --git a/translation/samples/generated_samples/translate_generated_translate_v3_translation_service_get_supported_languages_sync.py b/translation/samples/generated_samples/translate_generated_translate_v3_translation_service_get_supported_languages_sync.py new file mode 100644 index 000000000000..378d3328bf9b --- /dev/null +++ b/translation/samples/generated_samples/translate_generated_translate_v3_translation_service_get_supported_languages_sync.py @@ -0,0 +1,45 @@ +# -*- coding: utf-8 -*- +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for GetSupportedLanguages +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-translate + + +# [START translate_generated_translate_v3_TranslationService_GetSupportedLanguages_sync] +from google.cloud import translate_v3 + + +def sample_get_supported_languages(): + # Create a client + client = translate_v3.TranslationServiceClient() + + # Initialize request argument(s) + request = translate_v3.GetSupportedLanguagesRequest( + parent="parent_value", + ) + + # Make the request + response = client.get_supported_languages(request=request) + + # Handle the response + print(response) + +# [END translate_generated_translate_v3_TranslationService_GetSupportedLanguages_sync] diff --git a/translation/samples/generated_samples/translate_generated_translate_v3_translation_service_list_glossaries_async.py b/translation/samples/generated_samples/translate_generated_translate_v3_translation_service_list_glossaries_async.py new file mode 100644 index 000000000000..30ea3da67b8d --- /dev/null +++ b/translation/samples/generated_samples/translate_generated_translate_v3_translation_service_list_glossaries_async.py @@ -0,0 +1,46 @@ +# -*- coding: utf-8 -*- +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for ListGlossaries +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-translate + + +# [START translate_generated_translate_v3_TranslationService_ListGlossaries_async] +from google.cloud import translate_v3 + + +async def sample_list_glossaries(): + # Create a client + client = translate_v3.TranslationServiceAsyncClient() + + # Initialize request argument(s) + request = translate_v3.ListGlossariesRequest( + parent="parent_value", + ) + + # Make the request + page_result = client.list_glossaries(request=request) + + # Handle the response + async for response in page_result: + print(response) + +# [END translate_generated_translate_v3_TranslationService_ListGlossaries_async] diff --git a/translation/samples/generated_samples/translate_generated_translate_v3_translation_service_list_glossaries_sync.py b/translation/samples/generated_samples/translate_generated_translate_v3_translation_service_list_glossaries_sync.py new file mode 100644 index 000000000000..3b67db9b1e42 --- /dev/null +++ b/translation/samples/generated_samples/translate_generated_translate_v3_translation_service_list_glossaries_sync.py @@ -0,0 +1,46 @@ +# -*- coding: utf-8 -*- +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for ListGlossaries +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-translate + + +# [START translate_generated_translate_v3_TranslationService_ListGlossaries_sync] +from google.cloud import translate_v3 + + +def sample_list_glossaries(): + # Create a client + client = translate_v3.TranslationServiceClient() + + # Initialize request argument(s) + request = translate_v3.ListGlossariesRequest( + parent="parent_value", + ) + + # Make the request + page_result = client.list_glossaries(request=request) + + # Handle the response + for response in page_result: + print(response) + +# [END translate_generated_translate_v3_TranslationService_ListGlossaries_sync] diff --git a/translation/samples/generated_samples/translate_generated_translate_v3_translation_service_translate_document_async.py b/translation/samples/generated_samples/translate_generated_translate_v3_translation_service_translate_document_async.py new file mode 100644 index 000000000000..533078a965fd --- /dev/null +++ b/translation/samples/generated_samples/translate_generated_translate_v3_translation_service_translate_document_async.py @@ -0,0 +1,50 @@ +# -*- coding: utf-8 -*- +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for TranslateDocument +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-translate + + +# [START translate_generated_translate_v3_TranslationService_TranslateDocument_async] +from google.cloud import translate_v3 + + +async def sample_translate_document(): + # Create a client + client = translate_v3.TranslationServiceAsyncClient() + + # Initialize request argument(s) + document_input_config = translate_v3.DocumentInputConfig() + document_input_config.content = b'content_blob' + + request = translate_v3.TranslateDocumentRequest( + parent="parent_value", + target_language_code="target_language_code_value", + document_input_config=document_input_config, + ) + + # Make the request + response = await client.translate_document(request=request) + + # Handle the response + print(response) + +# [END translate_generated_translate_v3_TranslationService_TranslateDocument_async] diff --git a/translation/samples/generated_samples/translate_generated_translate_v3_translation_service_translate_document_sync.py b/translation/samples/generated_samples/translate_generated_translate_v3_translation_service_translate_document_sync.py new file mode 100644 index 000000000000..b6f4c1a95310 --- /dev/null +++ b/translation/samples/generated_samples/translate_generated_translate_v3_translation_service_translate_document_sync.py @@ -0,0 +1,50 @@ +# -*- coding: utf-8 -*- +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for TranslateDocument +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-translate + + +# [START translate_generated_translate_v3_TranslationService_TranslateDocument_sync] +from google.cloud import translate_v3 + + +def sample_translate_document(): + # Create a client + client = translate_v3.TranslationServiceClient() + + # Initialize request argument(s) + document_input_config = translate_v3.DocumentInputConfig() + document_input_config.content = b'content_blob' + + request = translate_v3.TranslateDocumentRequest( + parent="parent_value", + target_language_code="target_language_code_value", + document_input_config=document_input_config, + ) + + # Make the request + response = client.translate_document(request=request) + + # Handle the response + print(response) + +# [END translate_generated_translate_v3_TranslationService_TranslateDocument_sync] diff --git a/translation/samples/generated_samples/translate_generated_translate_v3_translation_service_translate_text_async.py b/translation/samples/generated_samples/translate_generated_translate_v3_translation_service_translate_text_async.py new file mode 100644 index 000000000000..8d20de786862 --- /dev/null +++ b/translation/samples/generated_samples/translate_generated_translate_v3_translation_service_translate_text_async.py @@ -0,0 +1,47 @@ +# -*- coding: utf-8 -*- +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for TranslateText +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-translate + + +# [START translate_generated_translate_v3_TranslationService_TranslateText_async] +from google.cloud import translate_v3 + + +async def sample_translate_text(): + # Create a client + client = translate_v3.TranslationServiceAsyncClient() + + # Initialize request argument(s) + request = translate_v3.TranslateTextRequest( + contents=['contents_value_1', 'contents_value_2'], + target_language_code="target_language_code_value", + parent="parent_value", + ) + + # Make the request + response = await client.translate_text(request=request) + + # Handle the response + print(response) + +# [END translate_generated_translate_v3_TranslationService_TranslateText_async] diff --git a/translation/samples/generated_samples/translate_generated_translate_v3_translation_service_translate_text_sync.py b/translation/samples/generated_samples/translate_generated_translate_v3_translation_service_translate_text_sync.py new file mode 100644 index 000000000000..458d11cd71d1 --- /dev/null +++ b/translation/samples/generated_samples/translate_generated_translate_v3_translation_service_translate_text_sync.py @@ -0,0 +1,47 @@ +# -*- coding: utf-8 -*- +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for TranslateText +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-translate + + +# [START translate_generated_translate_v3_TranslationService_TranslateText_sync] +from google.cloud import translate_v3 + + +def sample_translate_text(): + # Create a client + client = translate_v3.TranslationServiceClient() + + # Initialize request argument(s) + request = translate_v3.TranslateTextRequest( + contents=['contents_value_1', 'contents_value_2'], + target_language_code="target_language_code_value", + parent="parent_value", + ) + + # Make the request + response = client.translate_text(request=request) + + # Handle the response + print(response) + +# [END translate_generated_translate_v3_TranslationService_TranslateText_sync] diff --git a/translation/samples/generated_samples/translate_generated_translate_v3beta1_translation_service_batch_translate_document_async.py b/translation/samples/generated_samples/translate_generated_translate_v3beta1_translation_service_batch_translate_document_async.py new file mode 100644 index 000000000000..60bb5b44459e --- /dev/null +++ b/translation/samples/generated_samples/translate_generated_translate_v3beta1_translation_service_batch_translate_document_async.py @@ -0,0 +1,59 @@ +# -*- coding: utf-8 -*- +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for BatchTranslateDocument +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-translate + + +# [START translate_generated_translate_v3beta1_TranslationService_BatchTranslateDocument_async] +from google.cloud import translate_v3beta1 + + +async def sample_batch_translate_document(): + # Create a client + client = translate_v3beta1.TranslationServiceAsyncClient() + + # Initialize request argument(s) + input_configs = translate_v3beta1.BatchDocumentInputConfig() + input_configs.gcs_source.input_uri = "input_uri_value" + + output_config = translate_v3beta1.BatchDocumentOutputConfig() + output_config.gcs_destination.output_uri_prefix = "output_uri_prefix_value" + + request = translate_v3beta1.BatchTranslateDocumentRequest( + parent="parent_value", + source_language_code="source_language_code_value", + target_language_codes=['target_language_codes_value_1', 'target_language_codes_value_2'], + input_configs=input_configs, + output_config=output_config, + ) + + # Make the request + operation = client.batch_translate_document(request=request) + + print("Waiting for operation to complete...") + + response = await operation.result() + + # Handle the response + print(response) + +# [END translate_generated_translate_v3beta1_TranslationService_BatchTranslateDocument_async] diff --git a/translation/samples/generated_samples/translate_generated_translate_v3beta1_translation_service_batch_translate_document_sync.py b/translation/samples/generated_samples/translate_generated_translate_v3beta1_translation_service_batch_translate_document_sync.py new file mode 100644 index 000000000000..c8095f5734b8 --- /dev/null +++ b/translation/samples/generated_samples/translate_generated_translate_v3beta1_translation_service_batch_translate_document_sync.py @@ -0,0 +1,59 @@ +# -*- coding: utf-8 -*- +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for BatchTranslateDocument +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-translate + + +# [START translate_generated_translate_v3beta1_TranslationService_BatchTranslateDocument_sync] +from google.cloud import translate_v3beta1 + + +def sample_batch_translate_document(): + # Create a client + client = translate_v3beta1.TranslationServiceClient() + + # Initialize request argument(s) + input_configs = translate_v3beta1.BatchDocumentInputConfig() + input_configs.gcs_source.input_uri = "input_uri_value" + + output_config = translate_v3beta1.BatchDocumentOutputConfig() + output_config.gcs_destination.output_uri_prefix = "output_uri_prefix_value" + + request = translate_v3beta1.BatchTranslateDocumentRequest( + parent="parent_value", + source_language_code="source_language_code_value", + target_language_codes=['target_language_codes_value_1', 'target_language_codes_value_2'], + input_configs=input_configs, + output_config=output_config, + ) + + # Make the request + operation = client.batch_translate_document(request=request) + + print("Waiting for operation to complete...") + + response = operation.result() + + # Handle the response + print(response) + +# [END translate_generated_translate_v3beta1_TranslationService_BatchTranslateDocument_sync] diff --git a/translation/samples/generated_samples/translate_generated_translate_v3beta1_translation_service_batch_translate_text_async.py b/translation/samples/generated_samples/translate_generated_translate_v3beta1_translation_service_batch_translate_text_async.py new file mode 100644 index 000000000000..b3406405f01c --- /dev/null +++ b/translation/samples/generated_samples/translate_generated_translate_v3beta1_translation_service_batch_translate_text_async.py @@ -0,0 +1,59 @@ +# -*- coding: utf-8 -*- +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for BatchTranslateText +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-translate + + +# [START translate_generated_translate_v3beta1_TranslationService_BatchTranslateText_async] +from google.cloud import translate_v3beta1 + + +async def sample_batch_translate_text(): + # Create a client + client = translate_v3beta1.TranslationServiceAsyncClient() + + # Initialize request argument(s) + input_configs = translate_v3beta1.InputConfig() + input_configs.gcs_source.input_uri = "input_uri_value" + + output_config = translate_v3beta1.OutputConfig() + output_config.gcs_destination.output_uri_prefix = "output_uri_prefix_value" + + request = translate_v3beta1.BatchTranslateTextRequest( + parent="parent_value", + source_language_code="source_language_code_value", + target_language_codes=['target_language_codes_value_1', 'target_language_codes_value_2'], + input_configs=input_configs, + output_config=output_config, + ) + + # Make the request + operation = client.batch_translate_text(request=request) + + print("Waiting for operation to complete...") + + response = await operation.result() + + # Handle the response + print(response) + +# [END translate_generated_translate_v3beta1_TranslationService_BatchTranslateText_async] diff --git a/translation/samples/generated_samples/translate_generated_translate_v3beta1_translation_service_batch_translate_text_sync.py b/translation/samples/generated_samples/translate_generated_translate_v3beta1_translation_service_batch_translate_text_sync.py new file mode 100644 index 000000000000..ab674d3d4ab7 --- /dev/null +++ b/translation/samples/generated_samples/translate_generated_translate_v3beta1_translation_service_batch_translate_text_sync.py @@ -0,0 +1,59 @@ +# -*- coding: utf-8 -*- +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for BatchTranslateText +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-translate + + +# [START translate_generated_translate_v3beta1_TranslationService_BatchTranslateText_sync] +from google.cloud import translate_v3beta1 + + +def sample_batch_translate_text(): + # Create a client + client = translate_v3beta1.TranslationServiceClient() + + # Initialize request argument(s) + input_configs = translate_v3beta1.InputConfig() + input_configs.gcs_source.input_uri = "input_uri_value" + + output_config = translate_v3beta1.OutputConfig() + output_config.gcs_destination.output_uri_prefix = "output_uri_prefix_value" + + request = translate_v3beta1.BatchTranslateTextRequest( + parent="parent_value", + source_language_code="source_language_code_value", + target_language_codes=['target_language_codes_value_1', 'target_language_codes_value_2'], + input_configs=input_configs, + output_config=output_config, + ) + + # Make the request + operation = client.batch_translate_text(request=request) + + print("Waiting for operation to complete...") + + response = operation.result() + + # Handle the response + print(response) + +# [END translate_generated_translate_v3beta1_TranslationService_BatchTranslateText_sync] diff --git a/translation/samples/generated_samples/translate_generated_translate_v3beta1_translation_service_create_glossary_async.py b/translation/samples/generated_samples/translate_generated_translate_v3beta1_translation_service_create_glossary_async.py new file mode 100644 index 000000000000..548c6439ae7d --- /dev/null +++ b/translation/samples/generated_samples/translate_generated_translate_v3beta1_translation_service_create_glossary_async.py @@ -0,0 +1,53 @@ +# -*- coding: utf-8 -*- +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for CreateGlossary +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-translate + + +# [START translate_generated_translate_v3beta1_TranslationService_CreateGlossary_async] +from google.cloud import translate_v3beta1 + + +async def sample_create_glossary(): + # Create a client + client = translate_v3beta1.TranslationServiceAsyncClient() + + # Initialize request argument(s) + glossary = translate_v3beta1.Glossary() + glossary.name = "name_value" + + request = translate_v3beta1.CreateGlossaryRequest( + parent="parent_value", + glossary=glossary, + ) + + # Make the request + operation = client.create_glossary(request=request) + + print("Waiting for operation to complete...") + + response = await operation.result() + + # Handle the response + print(response) + +# [END translate_generated_translate_v3beta1_TranslationService_CreateGlossary_async] diff --git a/translation/samples/generated_samples/translate_generated_translate_v3beta1_translation_service_create_glossary_sync.py b/translation/samples/generated_samples/translate_generated_translate_v3beta1_translation_service_create_glossary_sync.py new file mode 100644 index 000000000000..9898c15e1db3 --- /dev/null +++ b/translation/samples/generated_samples/translate_generated_translate_v3beta1_translation_service_create_glossary_sync.py @@ -0,0 +1,53 @@ +# -*- coding: utf-8 -*- +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for CreateGlossary +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-translate + + +# [START translate_generated_translate_v3beta1_TranslationService_CreateGlossary_sync] +from google.cloud import translate_v3beta1 + + +def sample_create_glossary(): + # Create a client + client = translate_v3beta1.TranslationServiceClient() + + # Initialize request argument(s) + glossary = translate_v3beta1.Glossary() + glossary.name = "name_value" + + request = translate_v3beta1.CreateGlossaryRequest( + parent="parent_value", + glossary=glossary, + ) + + # Make the request + operation = client.create_glossary(request=request) + + print("Waiting for operation to complete...") + + response = operation.result() + + # Handle the response + print(response) + +# [END translate_generated_translate_v3beta1_TranslationService_CreateGlossary_sync] diff --git a/translation/samples/generated_samples/translate_generated_translate_v3beta1_translation_service_delete_glossary_async.py b/translation/samples/generated_samples/translate_generated_translate_v3beta1_translation_service_delete_glossary_async.py new file mode 100644 index 000000000000..09de10c89209 --- /dev/null +++ b/translation/samples/generated_samples/translate_generated_translate_v3beta1_translation_service_delete_glossary_async.py @@ -0,0 +1,49 @@ +# -*- coding: utf-8 -*- +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for DeleteGlossary +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-translate + + +# [START translate_generated_translate_v3beta1_TranslationService_DeleteGlossary_async] +from google.cloud import translate_v3beta1 + + +async def sample_delete_glossary(): + # Create a client + client = translate_v3beta1.TranslationServiceAsyncClient() + + # Initialize request argument(s) + request = translate_v3beta1.DeleteGlossaryRequest( + name="name_value", + ) + + # Make the request + operation = client.delete_glossary(request=request) + + print("Waiting for operation to complete...") + + response = await operation.result() + + # Handle the response + print(response) + +# [END translate_generated_translate_v3beta1_TranslationService_DeleteGlossary_async] diff --git a/translation/samples/generated_samples/translate_generated_translate_v3beta1_translation_service_delete_glossary_sync.py b/translation/samples/generated_samples/translate_generated_translate_v3beta1_translation_service_delete_glossary_sync.py new file mode 100644 index 000000000000..fca8fca28bf2 --- /dev/null +++ b/translation/samples/generated_samples/translate_generated_translate_v3beta1_translation_service_delete_glossary_sync.py @@ -0,0 +1,49 @@ +# -*- coding: utf-8 -*- +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for DeleteGlossary +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-translate + + +# [START translate_generated_translate_v3beta1_TranslationService_DeleteGlossary_sync] +from google.cloud import translate_v3beta1 + + +def sample_delete_glossary(): + # Create a client + client = translate_v3beta1.TranslationServiceClient() + + # Initialize request argument(s) + request = translate_v3beta1.DeleteGlossaryRequest( + name="name_value", + ) + + # Make the request + operation = client.delete_glossary(request=request) + + print("Waiting for operation to complete...") + + response = operation.result() + + # Handle the response + print(response) + +# [END translate_generated_translate_v3beta1_TranslationService_DeleteGlossary_sync] diff --git a/translation/samples/generated_samples/translate_generated_translate_v3beta1_translation_service_detect_language_async.py b/translation/samples/generated_samples/translate_generated_translate_v3beta1_translation_service_detect_language_async.py new file mode 100644 index 000000000000..021bde2e2455 --- /dev/null +++ b/translation/samples/generated_samples/translate_generated_translate_v3beta1_translation_service_detect_language_async.py @@ -0,0 +1,46 @@ +# -*- coding: utf-8 -*- +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for DetectLanguage +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-translate + + +# [START translate_generated_translate_v3beta1_TranslationService_DetectLanguage_async] +from google.cloud import translate_v3beta1 + + +async def sample_detect_language(): + # Create a client + client = translate_v3beta1.TranslationServiceAsyncClient() + + # Initialize request argument(s) + request = translate_v3beta1.DetectLanguageRequest( + content="content_value", + parent="parent_value", + ) + + # Make the request + response = await client.detect_language(request=request) + + # Handle the response + print(response) + +# [END translate_generated_translate_v3beta1_TranslationService_DetectLanguage_async] diff --git a/translation/samples/generated_samples/translate_generated_translate_v3beta1_translation_service_detect_language_sync.py b/translation/samples/generated_samples/translate_generated_translate_v3beta1_translation_service_detect_language_sync.py new file mode 100644 index 000000000000..5d88e95b2580 --- /dev/null +++ b/translation/samples/generated_samples/translate_generated_translate_v3beta1_translation_service_detect_language_sync.py @@ -0,0 +1,46 @@ +# -*- coding: utf-8 -*- +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for DetectLanguage +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-translate + + +# [START translate_generated_translate_v3beta1_TranslationService_DetectLanguage_sync] +from google.cloud import translate_v3beta1 + + +def sample_detect_language(): + # Create a client + client = translate_v3beta1.TranslationServiceClient() + + # Initialize request argument(s) + request = translate_v3beta1.DetectLanguageRequest( + content="content_value", + parent="parent_value", + ) + + # Make the request + response = client.detect_language(request=request) + + # Handle the response + print(response) + +# [END translate_generated_translate_v3beta1_TranslationService_DetectLanguage_sync] diff --git a/translation/samples/generated_samples/translate_generated_translate_v3beta1_translation_service_get_glossary_async.py b/translation/samples/generated_samples/translate_generated_translate_v3beta1_translation_service_get_glossary_async.py new file mode 100644 index 000000000000..503639563786 --- /dev/null +++ b/translation/samples/generated_samples/translate_generated_translate_v3beta1_translation_service_get_glossary_async.py @@ -0,0 +1,45 @@ +# -*- coding: utf-8 -*- +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for GetGlossary +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-translate + + +# [START translate_generated_translate_v3beta1_TranslationService_GetGlossary_async] +from google.cloud import translate_v3beta1 + + +async def sample_get_glossary(): + # Create a client + client = translate_v3beta1.TranslationServiceAsyncClient() + + # Initialize request argument(s) + request = translate_v3beta1.GetGlossaryRequest( + name="name_value", + ) + + # Make the request + response = await client.get_glossary(request=request) + + # Handle the response + print(response) + +# [END translate_generated_translate_v3beta1_TranslationService_GetGlossary_async] diff --git a/translation/samples/generated_samples/translate_generated_translate_v3beta1_translation_service_get_glossary_sync.py b/translation/samples/generated_samples/translate_generated_translate_v3beta1_translation_service_get_glossary_sync.py new file mode 100644 index 000000000000..8160d982e7bd --- /dev/null +++ b/translation/samples/generated_samples/translate_generated_translate_v3beta1_translation_service_get_glossary_sync.py @@ -0,0 +1,45 @@ +# -*- coding: utf-8 -*- +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for GetGlossary +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-translate + + +# [START translate_generated_translate_v3beta1_TranslationService_GetGlossary_sync] +from google.cloud import translate_v3beta1 + + +def sample_get_glossary(): + # Create a client + client = translate_v3beta1.TranslationServiceClient() + + # Initialize request argument(s) + request = translate_v3beta1.GetGlossaryRequest( + name="name_value", + ) + + # Make the request + response = client.get_glossary(request=request) + + # Handle the response + print(response) + +# [END translate_generated_translate_v3beta1_TranslationService_GetGlossary_sync] diff --git a/translation/samples/generated_samples/translate_generated_translate_v3beta1_translation_service_get_supported_languages_async.py b/translation/samples/generated_samples/translate_generated_translate_v3beta1_translation_service_get_supported_languages_async.py new file mode 100644 index 000000000000..641f6bedabe0 --- /dev/null +++ b/translation/samples/generated_samples/translate_generated_translate_v3beta1_translation_service_get_supported_languages_async.py @@ -0,0 +1,45 @@ +# -*- coding: utf-8 -*- +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for GetSupportedLanguages +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-translate + + +# [START translate_generated_translate_v3beta1_TranslationService_GetSupportedLanguages_async] +from google.cloud import translate_v3beta1 + + +async def sample_get_supported_languages(): + # Create a client + client = translate_v3beta1.TranslationServiceAsyncClient() + + # Initialize request argument(s) + request = translate_v3beta1.GetSupportedLanguagesRequest( + parent="parent_value", + ) + + # Make the request + response = await client.get_supported_languages(request=request) + + # Handle the response + print(response) + +# [END translate_generated_translate_v3beta1_TranslationService_GetSupportedLanguages_async] diff --git a/translation/samples/generated_samples/translate_generated_translate_v3beta1_translation_service_get_supported_languages_sync.py b/translation/samples/generated_samples/translate_generated_translate_v3beta1_translation_service_get_supported_languages_sync.py new file mode 100644 index 000000000000..4f5aef8f2198 --- /dev/null +++ b/translation/samples/generated_samples/translate_generated_translate_v3beta1_translation_service_get_supported_languages_sync.py @@ -0,0 +1,45 @@ +# -*- coding: utf-8 -*- +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for GetSupportedLanguages +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-translate + + +# [START translate_generated_translate_v3beta1_TranslationService_GetSupportedLanguages_sync] +from google.cloud import translate_v3beta1 + + +def sample_get_supported_languages(): + # Create a client + client = translate_v3beta1.TranslationServiceClient() + + # Initialize request argument(s) + request = translate_v3beta1.GetSupportedLanguagesRequest( + parent="parent_value", + ) + + # Make the request + response = client.get_supported_languages(request=request) + + # Handle the response + print(response) + +# [END translate_generated_translate_v3beta1_TranslationService_GetSupportedLanguages_sync] diff --git a/translation/samples/generated_samples/translate_generated_translate_v3beta1_translation_service_list_glossaries_async.py b/translation/samples/generated_samples/translate_generated_translate_v3beta1_translation_service_list_glossaries_async.py new file mode 100644 index 000000000000..f1a9688c202a --- /dev/null +++ b/translation/samples/generated_samples/translate_generated_translate_v3beta1_translation_service_list_glossaries_async.py @@ -0,0 +1,46 @@ +# -*- coding: utf-8 -*- +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for ListGlossaries +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-translate + + +# [START translate_generated_translate_v3beta1_TranslationService_ListGlossaries_async] +from google.cloud import translate_v3beta1 + + +async def sample_list_glossaries(): + # Create a client + client = translate_v3beta1.TranslationServiceAsyncClient() + + # Initialize request argument(s) + request = translate_v3beta1.ListGlossariesRequest( + parent="parent_value", + ) + + # Make the request + page_result = client.list_glossaries(request=request) + + # Handle the response + async for response in page_result: + print(response) + +# [END translate_generated_translate_v3beta1_TranslationService_ListGlossaries_async] diff --git a/translation/samples/generated_samples/translate_generated_translate_v3beta1_translation_service_list_glossaries_sync.py b/translation/samples/generated_samples/translate_generated_translate_v3beta1_translation_service_list_glossaries_sync.py new file mode 100644 index 000000000000..d2a81deee156 --- /dev/null +++ b/translation/samples/generated_samples/translate_generated_translate_v3beta1_translation_service_list_glossaries_sync.py @@ -0,0 +1,46 @@ +# -*- coding: utf-8 -*- +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for ListGlossaries +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-translate + + +# [START translate_generated_translate_v3beta1_TranslationService_ListGlossaries_sync] +from google.cloud import translate_v3beta1 + + +def sample_list_glossaries(): + # Create a client + client = translate_v3beta1.TranslationServiceClient() + + # Initialize request argument(s) + request = translate_v3beta1.ListGlossariesRequest( + parent="parent_value", + ) + + # Make the request + page_result = client.list_glossaries(request=request) + + # Handle the response + for response in page_result: + print(response) + +# [END translate_generated_translate_v3beta1_TranslationService_ListGlossaries_sync] diff --git a/translation/samples/generated_samples/translate_generated_translate_v3beta1_translation_service_translate_document_async.py b/translation/samples/generated_samples/translate_generated_translate_v3beta1_translation_service_translate_document_async.py new file mode 100644 index 000000000000..0593c6dafc61 --- /dev/null +++ b/translation/samples/generated_samples/translate_generated_translate_v3beta1_translation_service_translate_document_async.py @@ -0,0 +1,50 @@ +# -*- coding: utf-8 -*- +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for TranslateDocument +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-translate + + +# [START translate_generated_translate_v3beta1_TranslationService_TranslateDocument_async] +from google.cloud import translate_v3beta1 + + +async def sample_translate_document(): + # Create a client + client = translate_v3beta1.TranslationServiceAsyncClient() + + # Initialize request argument(s) + document_input_config = translate_v3beta1.DocumentInputConfig() + document_input_config.content = b'content_blob' + + request = translate_v3beta1.TranslateDocumentRequest( + parent="parent_value", + target_language_code="target_language_code_value", + document_input_config=document_input_config, + ) + + # Make the request + response = await client.translate_document(request=request) + + # Handle the response + print(response) + +# [END translate_generated_translate_v3beta1_TranslationService_TranslateDocument_async] diff --git a/translation/samples/generated_samples/translate_generated_translate_v3beta1_translation_service_translate_document_sync.py b/translation/samples/generated_samples/translate_generated_translate_v3beta1_translation_service_translate_document_sync.py new file mode 100644 index 000000000000..2deac12ae49c --- /dev/null +++ b/translation/samples/generated_samples/translate_generated_translate_v3beta1_translation_service_translate_document_sync.py @@ -0,0 +1,50 @@ +# -*- coding: utf-8 -*- +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for TranslateDocument +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-translate + + +# [START translate_generated_translate_v3beta1_TranslationService_TranslateDocument_sync] +from google.cloud import translate_v3beta1 + + +def sample_translate_document(): + # Create a client + client = translate_v3beta1.TranslationServiceClient() + + # Initialize request argument(s) + document_input_config = translate_v3beta1.DocumentInputConfig() + document_input_config.content = b'content_blob' + + request = translate_v3beta1.TranslateDocumentRequest( + parent="parent_value", + target_language_code="target_language_code_value", + document_input_config=document_input_config, + ) + + # Make the request + response = client.translate_document(request=request) + + # Handle the response + print(response) + +# [END translate_generated_translate_v3beta1_TranslationService_TranslateDocument_sync] diff --git a/translation/samples/generated_samples/translate_generated_translate_v3beta1_translation_service_translate_text_async.py b/translation/samples/generated_samples/translate_generated_translate_v3beta1_translation_service_translate_text_async.py new file mode 100644 index 000000000000..5228dc9a7180 --- /dev/null +++ b/translation/samples/generated_samples/translate_generated_translate_v3beta1_translation_service_translate_text_async.py @@ -0,0 +1,47 @@ +# -*- coding: utf-8 -*- +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for TranslateText +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-translate + + +# [START translate_generated_translate_v3beta1_TranslationService_TranslateText_async] +from google.cloud import translate_v3beta1 + + +async def sample_translate_text(): + # Create a client + client = translate_v3beta1.TranslationServiceAsyncClient() + + # Initialize request argument(s) + request = translate_v3beta1.TranslateTextRequest( + contents=['contents_value_1', 'contents_value_2'], + target_language_code="target_language_code_value", + parent="parent_value", + ) + + # Make the request + response = await client.translate_text(request=request) + + # Handle the response + print(response) + +# [END translate_generated_translate_v3beta1_TranslationService_TranslateText_async] diff --git a/translation/samples/generated_samples/translate_generated_translate_v3beta1_translation_service_translate_text_sync.py b/translation/samples/generated_samples/translate_generated_translate_v3beta1_translation_service_translate_text_sync.py new file mode 100644 index 000000000000..d24cc2f2769a --- /dev/null +++ b/translation/samples/generated_samples/translate_generated_translate_v3beta1_translation_service_translate_text_sync.py @@ -0,0 +1,47 @@ +# -*- coding: utf-8 -*- +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for TranslateText +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-translate + + +# [START translate_generated_translate_v3beta1_TranslationService_TranslateText_sync] +from google.cloud import translate_v3beta1 + + +def sample_translate_text(): + # Create a client + client = translate_v3beta1.TranslationServiceClient() + + # Initialize request argument(s) + request = translate_v3beta1.TranslateTextRequest( + contents=['contents_value_1', 'contents_value_2'], + target_language_code="target_language_code_value", + parent="parent_value", + ) + + # Make the request + response = client.translate_text(request=request) + + # Handle the response + print(response) + +# [END translate_generated_translate_v3beta1_TranslationService_TranslateText_sync] diff --git a/translation/samples/generated_samples/translate_v3_generated_translation_service_batch_translate_document_async.py b/translation/samples/generated_samples/translate_v3_generated_translation_service_batch_translate_document_async.py new file mode 100644 index 000000000000..61d5255af15e --- /dev/null +++ b/translation/samples/generated_samples/translate_v3_generated_translation_service_batch_translate_document_async.py @@ -0,0 +1,59 @@ +# -*- coding: utf-8 -*- +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for BatchTranslateDocument +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-translate + + +# [START translate_v3_generated_TranslationService_BatchTranslateDocument_async] +from google.cloud import translate_v3 + + +async def sample_batch_translate_document(): + # Create a client + client = translate_v3.TranslationServiceAsyncClient() + + # Initialize request argument(s) + input_configs = translate_v3.BatchDocumentInputConfig() + input_configs.gcs_source.input_uri = "input_uri_value" + + output_config = translate_v3.BatchDocumentOutputConfig() + output_config.gcs_destination.output_uri_prefix = "output_uri_prefix_value" + + request = translate_v3.BatchTranslateDocumentRequest( + parent="parent_value", + source_language_code="source_language_code_value", + target_language_codes=['target_language_codes_value_1', 'target_language_codes_value_2'], + input_configs=input_configs, + output_config=output_config, + ) + + # Make the request + operation = client.batch_translate_document(request=request) + + print("Waiting for operation to complete...") + + response = await operation.result() + + # Handle the response + print(response) + +# [END translate_v3_generated_TranslationService_BatchTranslateDocument_async] diff --git a/translation/samples/generated_samples/translate_v3_generated_translation_service_batch_translate_document_sync.py b/translation/samples/generated_samples/translate_v3_generated_translation_service_batch_translate_document_sync.py new file mode 100644 index 000000000000..fe994910e84e --- /dev/null +++ b/translation/samples/generated_samples/translate_v3_generated_translation_service_batch_translate_document_sync.py @@ -0,0 +1,59 @@ +# -*- coding: utf-8 -*- +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for BatchTranslateDocument +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-translate + + +# [START translate_v3_generated_TranslationService_BatchTranslateDocument_sync] +from google.cloud import translate_v3 + + +def sample_batch_translate_document(): + # Create a client + client = translate_v3.TranslationServiceClient() + + # Initialize request argument(s) + input_configs = translate_v3.BatchDocumentInputConfig() + input_configs.gcs_source.input_uri = "input_uri_value" + + output_config = translate_v3.BatchDocumentOutputConfig() + output_config.gcs_destination.output_uri_prefix = "output_uri_prefix_value" + + request = translate_v3.BatchTranslateDocumentRequest( + parent="parent_value", + source_language_code="source_language_code_value", + target_language_codes=['target_language_codes_value_1', 'target_language_codes_value_2'], + input_configs=input_configs, + output_config=output_config, + ) + + # Make the request + operation = client.batch_translate_document(request=request) + + print("Waiting for operation to complete...") + + response = operation.result() + + # Handle the response + print(response) + +# [END translate_v3_generated_TranslationService_BatchTranslateDocument_sync] diff --git a/translation/samples/generated_samples/translate_v3_generated_translation_service_batch_translate_text_async.py b/translation/samples/generated_samples/translate_v3_generated_translation_service_batch_translate_text_async.py new file mode 100644 index 000000000000..79b23f339af7 --- /dev/null +++ b/translation/samples/generated_samples/translate_v3_generated_translation_service_batch_translate_text_async.py @@ -0,0 +1,59 @@ +# -*- coding: utf-8 -*- +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for BatchTranslateText +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-translate + + +# [START translate_v3_generated_TranslationService_BatchTranslateText_async] +from google.cloud import translate_v3 + + +async def sample_batch_translate_text(): + # Create a client + client = translate_v3.TranslationServiceAsyncClient() + + # Initialize request argument(s) + input_configs = translate_v3.InputConfig() + input_configs.gcs_source.input_uri = "input_uri_value" + + output_config = translate_v3.OutputConfig() + output_config.gcs_destination.output_uri_prefix = "output_uri_prefix_value" + + request = translate_v3.BatchTranslateTextRequest( + parent="parent_value", + source_language_code="source_language_code_value", + target_language_codes=['target_language_codes_value_1', 'target_language_codes_value_2'], + input_configs=input_configs, + output_config=output_config, + ) + + # Make the request + operation = client.batch_translate_text(request=request) + + print("Waiting for operation to complete...") + + response = await operation.result() + + # Handle the response + print(response) + +# [END translate_v3_generated_TranslationService_BatchTranslateText_async] diff --git a/translation/samples/generated_samples/translate_v3_generated_translation_service_batch_translate_text_sync.py b/translation/samples/generated_samples/translate_v3_generated_translation_service_batch_translate_text_sync.py new file mode 100644 index 000000000000..99a45b93bb7e --- /dev/null +++ b/translation/samples/generated_samples/translate_v3_generated_translation_service_batch_translate_text_sync.py @@ -0,0 +1,59 @@ +# -*- coding: utf-8 -*- +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for BatchTranslateText +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-translate + + +# [START translate_v3_generated_TranslationService_BatchTranslateText_sync] +from google.cloud import translate_v3 + + +def sample_batch_translate_text(): + # Create a client + client = translate_v3.TranslationServiceClient() + + # Initialize request argument(s) + input_configs = translate_v3.InputConfig() + input_configs.gcs_source.input_uri = "input_uri_value" + + output_config = translate_v3.OutputConfig() + output_config.gcs_destination.output_uri_prefix = "output_uri_prefix_value" + + request = translate_v3.BatchTranslateTextRequest( + parent="parent_value", + source_language_code="source_language_code_value", + target_language_codes=['target_language_codes_value_1', 'target_language_codes_value_2'], + input_configs=input_configs, + output_config=output_config, + ) + + # Make the request + operation = client.batch_translate_text(request=request) + + print("Waiting for operation to complete...") + + response = operation.result() + + # Handle the response + print(response) + +# [END translate_v3_generated_TranslationService_BatchTranslateText_sync] diff --git a/translation/samples/generated_samples/translate_v3_generated_translation_service_create_glossary_async.py b/translation/samples/generated_samples/translate_v3_generated_translation_service_create_glossary_async.py new file mode 100644 index 000000000000..bb1958164e99 --- /dev/null +++ b/translation/samples/generated_samples/translate_v3_generated_translation_service_create_glossary_async.py @@ -0,0 +1,53 @@ +# -*- coding: utf-8 -*- +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for CreateGlossary +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-translate + + +# [START translate_v3_generated_TranslationService_CreateGlossary_async] +from google.cloud import translate_v3 + + +async def sample_create_glossary(): + # Create a client + client = translate_v3.TranslationServiceAsyncClient() + + # Initialize request argument(s) + glossary = translate_v3.Glossary() + glossary.name = "name_value" + + request = translate_v3.CreateGlossaryRequest( + parent="parent_value", + glossary=glossary, + ) + + # Make the request + operation = client.create_glossary(request=request) + + print("Waiting for operation to complete...") + + response = await operation.result() + + # Handle the response + print(response) + +# [END translate_v3_generated_TranslationService_CreateGlossary_async] diff --git a/translation/samples/generated_samples/translate_v3_generated_translation_service_create_glossary_sync.py b/translation/samples/generated_samples/translate_v3_generated_translation_service_create_glossary_sync.py new file mode 100644 index 000000000000..e99fca043cfa --- /dev/null +++ b/translation/samples/generated_samples/translate_v3_generated_translation_service_create_glossary_sync.py @@ -0,0 +1,53 @@ +# -*- coding: utf-8 -*- +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for CreateGlossary +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-translate + + +# [START translate_v3_generated_TranslationService_CreateGlossary_sync] +from google.cloud import translate_v3 + + +def sample_create_glossary(): + # Create a client + client = translate_v3.TranslationServiceClient() + + # Initialize request argument(s) + glossary = translate_v3.Glossary() + glossary.name = "name_value" + + request = translate_v3.CreateGlossaryRequest( + parent="parent_value", + glossary=glossary, + ) + + # Make the request + operation = client.create_glossary(request=request) + + print("Waiting for operation to complete...") + + response = operation.result() + + # Handle the response + print(response) + +# [END translate_v3_generated_TranslationService_CreateGlossary_sync] diff --git a/translation/samples/generated_samples/translate_v3_generated_translation_service_delete_glossary_async.py b/translation/samples/generated_samples/translate_v3_generated_translation_service_delete_glossary_async.py new file mode 100644 index 000000000000..99b02b8e2eaf --- /dev/null +++ b/translation/samples/generated_samples/translate_v3_generated_translation_service_delete_glossary_async.py @@ -0,0 +1,49 @@ +# -*- coding: utf-8 -*- +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for DeleteGlossary +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-translate + + +# [START translate_v3_generated_TranslationService_DeleteGlossary_async] +from google.cloud import translate_v3 + + +async def sample_delete_glossary(): + # Create a client + client = translate_v3.TranslationServiceAsyncClient() + + # Initialize request argument(s) + request = translate_v3.DeleteGlossaryRequest( + name="name_value", + ) + + # Make the request + operation = client.delete_glossary(request=request) + + print("Waiting for operation to complete...") + + response = await operation.result() + + # Handle the response + print(response) + +# [END translate_v3_generated_TranslationService_DeleteGlossary_async] diff --git a/translation/samples/generated_samples/translate_v3_generated_translation_service_delete_glossary_sync.py b/translation/samples/generated_samples/translate_v3_generated_translation_service_delete_glossary_sync.py new file mode 100644 index 000000000000..8691e1b030d9 --- /dev/null +++ b/translation/samples/generated_samples/translate_v3_generated_translation_service_delete_glossary_sync.py @@ -0,0 +1,49 @@ +# -*- coding: utf-8 -*- +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for DeleteGlossary +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-translate + + +# [START translate_v3_generated_TranslationService_DeleteGlossary_sync] +from google.cloud import translate_v3 + + +def sample_delete_glossary(): + # Create a client + client = translate_v3.TranslationServiceClient() + + # Initialize request argument(s) + request = translate_v3.DeleteGlossaryRequest( + name="name_value", + ) + + # Make the request + operation = client.delete_glossary(request=request) + + print("Waiting for operation to complete...") + + response = operation.result() + + # Handle the response + print(response) + +# [END translate_v3_generated_TranslationService_DeleteGlossary_sync] diff --git a/translation/samples/generated_samples/translate_v3_generated_translation_service_detect_language_async.py b/translation/samples/generated_samples/translate_v3_generated_translation_service_detect_language_async.py new file mode 100644 index 000000000000..3eff2228a3a4 --- /dev/null +++ b/translation/samples/generated_samples/translate_v3_generated_translation_service_detect_language_async.py @@ -0,0 +1,46 @@ +# -*- coding: utf-8 -*- +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for DetectLanguage +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-translate + + +# [START translate_v3_generated_TranslationService_DetectLanguage_async] +from google.cloud import translate_v3 + + +async def sample_detect_language(): + # Create a client + client = translate_v3.TranslationServiceAsyncClient() + + # Initialize request argument(s) + request = translate_v3.DetectLanguageRequest( + content="content_value", + parent="parent_value", + ) + + # Make the request + response = await client.detect_language(request=request) + + # Handle the response + print(response) + +# [END translate_v3_generated_TranslationService_DetectLanguage_async] diff --git a/translation/samples/generated_samples/translate_v3_generated_translation_service_detect_language_sync.py b/translation/samples/generated_samples/translate_v3_generated_translation_service_detect_language_sync.py new file mode 100644 index 000000000000..fd1b85e201ca --- /dev/null +++ b/translation/samples/generated_samples/translate_v3_generated_translation_service_detect_language_sync.py @@ -0,0 +1,46 @@ +# -*- coding: utf-8 -*- +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for DetectLanguage +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-translate + + +# [START translate_v3_generated_TranslationService_DetectLanguage_sync] +from google.cloud import translate_v3 + + +def sample_detect_language(): + # Create a client + client = translate_v3.TranslationServiceClient() + + # Initialize request argument(s) + request = translate_v3.DetectLanguageRequest( + content="content_value", + parent="parent_value", + ) + + # Make the request + response = client.detect_language(request=request) + + # Handle the response + print(response) + +# [END translate_v3_generated_TranslationService_DetectLanguage_sync] diff --git a/translation/samples/generated_samples/translate_v3_generated_translation_service_get_glossary_async.py b/translation/samples/generated_samples/translate_v3_generated_translation_service_get_glossary_async.py new file mode 100644 index 000000000000..2274c719210c --- /dev/null +++ b/translation/samples/generated_samples/translate_v3_generated_translation_service_get_glossary_async.py @@ -0,0 +1,45 @@ +# -*- coding: utf-8 -*- +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for GetGlossary +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-translate + + +# [START translate_v3_generated_TranslationService_GetGlossary_async] +from google.cloud import translate_v3 + + +async def sample_get_glossary(): + # Create a client + client = translate_v3.TranslationServiceAsyncClient() + + # Initialize request argument(s) + request = translate_v3.GetGlossaryRequest( + name="name_value", + ) + + # Make the request + response = await client.get_glossary(request=request) + + # Handle the response + print(response) + +# [END translate_v3_generated_TranslationService_GetGlossary_async] diff --git a/translation/samples/generated_samples/translate_v3_generated_translation_service_get_glossary_sync.py b/translation/samples/generated_samples/translate_v3_generated_translation_service_get_glossary_sync.py new file mode 100644 index 000000000000..e11c7ed7b73f --- /dev/null +++ b/translation/samples/generated_samples/translate_v3_generated_translation_service_get_glossary_sync.py @@ -0,0 +1,45 @@ +# -*- coding: utf-8 -*- +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for GetGlossary +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-translate + + +# [START translate_v3_generated_TranslationService_GetGlossary_sync] +from google.cloud import translate_v3 + + +def sample_get_glossary(): + # Create a client + client = translate_v3.TranslationServiceClient() + + # Initialize request argument(s) + request = translate_v3.GetGlossaryRequest( + name="name_value", + ) + + # Make the request + response = client.get_glossary(request=request) + + # Handle the response + print(response) + +# [END translate_v3_generated_TranslationService_GetGlossary_sync] diff --git a/translation/samples/generated_samples/translate_v3_generated_translation_service_get_supported_languages_async.py b/translation/samples/generated_samples/translate_v3_generated_translation_service_get_supported_languages_async.py new file mode 100644 index 000000000000..2bf9d68808a6 --- /dev/null +++ b/translation/samples/generated_samples/translate_v3_generated_translation_service_get_supported_languages_async.py @@ -0,0 +1,45 @@ +# -*- coding: utf-8 -*- +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for GetSupportedLanguages +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-translate + + +# [START translate_v3_generated_TranslationService_GetSupportedLanguages_async] +from google.cloud import translate_v3 + + +async def sample_get_supported_languages(): + # Create a client + client = translate_v3.TranslationServiceAsyncClient() + + # Initialize request argument(s) + request = translate_v3.GetSupportedLanguagesRequest( + parent="parent_value", + ) + + # Make the request + response = await client.get_supported_languages(request=request) + + # Handle the response + print(response) + +# [END translate_v3_generated_TranslationService_GetSupportedLanguages_async] diff --git a/translation/samples/generated_samples/translate_v3_generated_translation_service_get_supported_languages_sync.py b/translation/samples/generated_samples/translate_v3_generated_translation_service_get_supported_languages_sync.py new file mode 100644 index 000000000000..d23a8aca1206 --- /dev/null +++ b/translation/samples/generated_samples/translate_v3_generated_translation_service_get_supported_languages_sync.py @@ -0,0 +1,45 @@ +# -*- coding: utf-8 -*- +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for GetSupportedLanguages +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-translate + + +# [START translate_v3_generated_TranslationService_GetSupportedLanguages_sync] +from google.cloud import translate_v3 + + +def sample_get_supported_languages(): + # Create a client + client = translate_v3.TranslationServiceClient() + + # Initialize request argument(s) + request = translate_v3.GetSupportedLanguagesRequest( + parent="parent_value", + ) + + # Make the request + response = client.get_supported_languages(request=request) + + # Handle the response + print(response) + +# [END translate_v3_generated_TranslationService_GetSupportedLanguages_sync] diff --git a/translation/samples/generated_samples/translate_v3_generated_translation_service_list_glossaries_async.py b/translation/samples/generated_samples/translate_v3_generated_translation_service_list_glossaries_async.py new file mode 100644 index 000000000000..d3616f0fcf51 --- /dev/null +++ b/translation/samples/generated_samples/translate_v3_generated_translation_service_list_glossaries_async.py @@ -0,0 +1,46 @@ +# -*- coding: utf-8 -*- +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for ListGlossaries +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-translate + + +# [START translate_v3_generated_TranslationService_ListGlossaries_async] +from google.cloud import translate_v3 + + +async def sample_list_glossaries(): + # Create a client + client = translate_v3.TranslationServiceAsyncClient() + + # Initialize request argument(s) + request = translate_v3.ListGlossariesRequest( + parent="parent_value", + ) + + # Make the request + page_result = client.list_glossaries(request=request) + + # Handle the response + async for response in page_result: + print(response) + +# [END translate_v3_generated_TranslationService_ListGlossaries_async] diff --git a/translation/samples/generated_samples/translate_v3_generated_translation_service_list_glossaries_sync.py b/translation/samples/generated_samples/translate_v3_generated_translation_service_list_glossaries_sync.py new file mode 100644 index 000000000000..4e3dfa7b950c --- /dev/null +++ b/translation/samples/generated_samples/translate_v3_generated_translation_service_list_glossaries_sync.py @@ -0,0 +1,46 @@ +# -*- coding: utf-8 -*- +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for ListGlossaries +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-translate + + +# [START translate_v3_generated_TranslationService_ListGlossaries_sync] +from google.cloud import translate_v3 + + +def sample_list_glossaries(): + # Create a client + client = translate_v3.TranslationServiceClient() + + # Initialize request argument(s) + request = translate_v3.ListGlossariesRequest( + parent="parent_value", + ) + + # Make the request + page_result = client.list_glossaries(request=request) + + # Handle the response + for response in page_result: + print(response) + +# [END translate_v3_generated_TranslationService_ListGlossaries_sync] diff --git a/translation/samples/generated_samples/translate_v3_generated_translation_service_translate_document_async.py b/translation/samples/generated_samples/translate_v3_generated_translation_service_translate_document_async.py new file mode 100644 index 000000000000..9c1902a802a2 --- /dev/null +++ b/translation/samples/generated_samples/translate_v3_generated_translation_service_translate_document_async.py @@ -0,0 +1,50 @@ +# -*- coding: utf-8 -*- +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for TranslateDocument +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-translate + + +# [START translate_v3_generated_TranslationService_TranslateDocument_async] +from google.cloud import translate_v3 + + +async def sample_translate_document(): + # Create a client + client = translate_v3.TranslationServiceAsyncClient() + + # Initialize request argument(s) + document_input_config = translate_v3.DocumentInputConfig() + document_input_config.content = b'content_blob' + + request = translate_v3.TranslateDocumentRequest( + parent="parent_value", + target_language_code="target_language_code_value", + document_input_config=document_input_config, + ) + + # Make the request + response = await client.translate_document(request=request) + + # Handle the response + print(response) + +# [END translate_v3_generated_TranslationService_TranslateDocument_async] diff --git a/translation/samples/generated_samples/translate_v3_generated_translation_service_translate_document_sync.py b/translation/samples/generated_samples/translate_v3_generated_translation_service_translate_document_sync.py new file mode 100644 index 000000000000..f5a301d3b432 --- /dev/null +++ b/translation/samples/generated_samples/translate_v3_generated_translation_service_translate_document_sync.py @@ -0,0 +1,50 @@ +# -*- coding: utf-8 -*- +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for TranslateDocument +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-translate + + +# [START translate_v3_generated_TranslationService_TranslateDocument_sync] +from google.cloud import translate_v3 + + +def sample_translate_document(): + # Create a client + client = translate_v3.TranslationServiceClient() + + # Initialize request argument(s) + document_input_config = translate_v3.DocumentInputConfig() + document_input_config.content = b'content_blob' + + request = translate_v3.TranslateDocumentRequest( + parent="parent_value", + target_language_code="target_language_code_value", + document_input_config=document_input_config, + ) + + # Make the request + response = client.translate_document(request=request) + + # Handle the response + print(response) + +# [END translate_v3_generated_TranslationService_TranslateDocument_sync] diff --git a/translation/samples/generated_samples/translate_v3_generated_translation_service_translate_text_async.py b/translation/samples/generated_samples/translate_v3_generated_translation_service_translate_text_async.py new file mode 100644 index 000000000000..afe0e2536c0a --- /dev/null +++ b/translation/samples/generated_samples/translate_v3_generated_translation_service_translate_text_async.py @@ -0,0 +1,47 @@ +# -*- coding: utf-8 -*- +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for TranslateText +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-translate + + +# [START translate_v3_generated_TranslationService_TranslateText_async] +from google.cloud import translate_v3 + + +async def sample_translate_text(): + # Create a client + client = translate_v3.TranslationServiceAsyncClient() + + # Initialize request argument(s) + request = translate_v3.TranslateTextRequest( + contents=['contents_value_1', 'contents_value_2'], + target_language_code="target_language_code_value", + parent="parent_value", + ) + + # Make the request + response = await client.translate_text(request=request) + + # Handle the response + print(response) + +# [END translate_v3_generated_TranslationService_TranslateText_async] diff --git a/translation/samples/generated_samples/translate_v3_generated_translation_service_translate_text_sync.py b/translation/samples/generated_samples/translate_v3_generated_translation_service_translate_text_sync.py new file mode 100644 index 000000000000..45fc51c52896 --- /dev/null +++ b/translation/samples/generated_samples/translate_v3_generated_translation_service_translate_text_sync.py @@ -0,0 +1,47 @@ +# -*- coding: utf-8 -*- +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for TranslateText +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-translate + + +# [START translate_v3_generated_TranslationService_TranslateText_sync] +from google.cloud import translate_v3 + + +def sample_translate_text(): + # Create a client + client = translate_v3.TranslationServiceClient() + + # Initialize request argument(s) + request = translate_v3.TranslateTextRequest( + contents=['contents_value_1', 'contents_value_2'], + target_language_code="target_language_code_value", + parent="parent_value", + ) + + # Make the request + response = client.translate_text(request=request) + + # Handle the response + print(response) + +# [END translate_v3_generated_TranslationService_TranslateText_sync] diff --git a/translation/samples/generated_samples/translate_v3beta1_generated_translation_service_batch_translate_document_async.py b/translation/samples/generated_samples/translate_v3beta1_generated_translation_service_batch_translate_document_async.py new file mode 100644 index 000000000000..b062bac5e2cd --- /dev/null +++ b/translation/samples/generated_samples/translate_v3beta1_generated_translation_service_batch_translate_document_async.py @@ -0,0 +1,59 @@ +# -*- coding: utf-8 -*- +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for BatchTranslateDocument +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-translate + + +# [START translate_v3beta1_generated_TranslationService_BatchTranslateDocument_async] +from google.cloud import translate_v3beta1 + + +async def sample_batch_translate_document(): + # Create a client + client = translate_v3beta1.TranslationServiceAsyncClient() + + # Initialize request argument(s) + input_configs = translate_v3beta1.BatchDocumentInputConfig() + input_configs.gcs_source.input_uri = "input_uri_value" + + output_config = translate_v3beta1.BatchDocumentOutputConfig() + output_config.gcs_destination.output_uri_prefix = "output_uri_prefix_value" + + request = translate_v3beta1.BatchTranslateDocumentRequest( + parent="parent_value", + source_language_code="source_language_code_value", + target_language_codes=['target_language_codes_value_1', 'target_language_codes_value_2'], + input_configs=input_configs, + output_config=output_config, + ) + + # Make the request + operation = client.batch_translate_document(request=request) + + print("Waiting for operation to complete...") + + response = await operation.result() + + # Handle the response + print(response) + +# [END translate_v3beta1_generated_TranslationService_BatchTranslateDocument_async] diff --git a/translation/samples/generated_samples/translate_v3beta1_generated_translation_service_batch_translate_document_sync.py b/translation/samples/generated_samples/translate_v3beta1_generated_translation_service_batch_translate_document_sync.py new file mode 100644 index 000000000000..0bc01520009d --- /dev/null +++ b/translation/samples/generated_samples/translate_v3beta1_generated_translation_service_batch_translate_document_sync.py @@ -0,0 +1,59 @@ +# -*- coding: utf-8 -*- +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for BatchTranslateDocument +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-translate + + +# [START translate_v3beta1_generated_TranslationService_BatchTranslateDocument_sync] +from google.cloud import translate_v3beta1 + + +def sample_batch_translate_document(): + # Create a client + client = translate_v3beta1.TranslationServiceClient() + + # Initialize request argument(s) + input_configs = translate_v3beta1.BatchDocumentInputConfig() + input_configs.gcs_source.input_uri = "input_uri_value" + + output_config = translate_v3beta1.BatchDocumentOutputConfig() + output_config.gcs_destination.output_uri_prefix = "output_uri_prefix_value" + + request = translate_v3beta1.BatchTranslateDocumentRequest( + parent="parent_value", + source_language_code="source_language_code_value", + target_language_codes=['target_language_codes_value_1', 'target_language_codes_value_2'], + input_configs=input_configs, + output_config=output_config, + ) + + # Make the request + operation = client.batch_translate_document(request=request) + + print("Waiting for operation to complete...") + + response = operation.result() + + # Handle the response + print(response) + +# [END translate_v3beta1_generated_TranslationService_BatchTranslateDocument_sync] diff --git a/translation/samples/generated_samples/translate_v3beta1_generated_translation_service_batch_translate_text_async.py b/translation/samples/generated_samples/translate_v3beta1_generated_translation_service_batch_translate_text_async.py new file mode 100644 index 000000000000..fb29a3c82232 --- /dev/null +++ b/translation/samples/generated_samples/translate_v3beta1_generated_translation_service_batch_translate_text_async.py @@ -0,0 +1,59 @@ +# -*- coding: utf-8 -*- +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for BatchTranslateText +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-translate + + +# [START translate_v3beta1_generated_TranslationService_BatchTranslateText_async] +from google.cloud import translate_v3beta1 + + +async def sample_batch_translate_text(): + # Create a client + client = translate_v3beta1.TranslationServiceAsyncClient() + + # Initialize request argument(s) + input_configs = translate_v3beta1.InputConfig() + input_configs.gcs_source.input_uri = "input_uri_value" + + output_config = translate_v3beta1.OutputConfig() + output_config.gcs_destination.output_uri_prefix = "output_uri_prefix_value" + + request = translate_v3beta1.BatchTranslateTextRequest( + parent="parent_value", + source_language_code="source_language_code_value", + target_language_codes=['target_language_codes_value_1', 'target_language_codes_value_2'], + input_configs=input_configs, + output_config=output_config, + ) + + # Make the request + operation = client.batch_translate_text(request=request) + + print("Waiting for operation to complete...") + + response = await operation.result() + + # Handle the response + print(response) + +# [END translate_v3beta1_generated_TranslationService_BatchTranslateText_async] diff --git a/translation/samples/generated_samples/translate_v3beta1_generated_translation_service_batch_translate_text_sync.py b/translation/samples/generated_samples/translate_v3beta1_generated_translation_service_batch_translate_text_sync.py new file mode 100644 index 000000000000..abfb2f2fb2d8 --- /dev/null +++ b/translation/samples/generated_samples/translate_v3beta1_generated_translation_service_batch_translate_text_sync.py @@ -0,0 +1,59 @@ +# -*- coding: utf-8 -*- +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for BatchTranslateText +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-translate + + +# [START translate_v3beta1_generated_TranslationService_BatchTranslateText_sync] +from google.cloud import translate_v3beta1 + + +def sample_batch_translate_text(): + # Create a client + client = translate_v3beta1.TranslationServiceClient() + + # Initialize request argument(s) + input_configs = translate_v3beta1.InputConfig() + input_configs.gcs_source.input_uri = "input_uri_value" + + output_config = translate_v3beta1.OutputConfig() + output_config.gcs_destination.output_uri_prefix = "output_uri_prefix_value" + + request = translate_v3beta1.BatchTranslateTextRequest( + parent="parent_value", + source_language_code="source_language_code_value", + target_language_codes=['target_language_codes_value_1', 'target_language_codes_value_2'], + input_configs=input_configs, + output_config=output_config, + ) + + # Make the request + operation = client.batch_translate_text(request=request) + + print("Waiting for operation to complete...") + + response = operation.result() + + # Handle the response + print(response) + +# [END translate_v3beta1_generated_TranslationService_BatchTranslateText_sync] diff --git a/translation/samples/generated_samples/translate_v3beta1_generated_translation_service_create_glossary_async.py b/translation/samples/generated_samples/translate_v3beta1_generated_translation_service_create_glossary_async.py new file mode 100644 index 000000000000..89493d7b6b7b --- /dev/null +++ b/translation/samples/generated_samples/translate_v3beta1_generated_translation_service_create_glossary_async.py @@ -0,0 +1,53 @@ +# -*- coding: utf-8 -*- +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for CreateGlossary +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-translate + + +# [START translate_v3beta1_generated_TranslationService_CreateGlossary_async] +from google.cloud import translate_v3beta1 + + +async def sample_create_glossary(): + # Create a client + client = translate_v3beta1.TranslationServiceAsyncClient() + + # Initialize request argument(s) + glossary = translate_v3beta1.Glossary() + glossary.name = "name_value" + + request = translate_v3beta1.CreateGlossaryRequest( + parent="parent_value", + glossary=glossary, + ) + + # Make the request + operation = client.create_glossary(request=request) + + print("Waiting for operation to complete...") + + response = await operation.result() + + # Handle the response + print(response) + +# [END translate_v3beta1_generated_TranslationService_CreateGlossary_async] diff --git a/translation/samples/generated_samples/translate_v3beta1_generated_translation_service_create_glossary_sync.py b/translation/samples/generated_samples/translate_v3beta1_generated_translation_service_create_glossary_sync.py new file mode 100644 index 000000000000..5d77d67965c0 --- /dev/null +++ b/translation/samples/generated_samples/translate_v3beta1_generated_translation_service_create_glossary_sync.py @@ -0,0 +1,53 @@ +# -*- coding: utf-8 -*- +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for CreateGlossary +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-translate + + +# [START translate_v3beta1_generated_TranslationService_CreateGlossary_sync] +from google.cloud import translate_v3beta1 + + +def sample_create_glossary(): + # Create a client + client = translate_v3beta1.TranslationServiceClient() + + # Initialize request argument(s) + glossary = translate_v3beta1.Glossary() + glossary.name = "name_value" + + request = translate_v3beta1.CreateGlossaryRequest( + parent="parent_value", + glossary=glossary, + ) + + # Make the request + operation = client.create_glossary(request=request) + + print("Waiting for operation to complete...") + + response = operation.result() + + # Handle the response + print(response) + +# [END translate_v3beta1_generated_TranslationService_CreateGlossary_sync] diff --git a/translation/samples/generated_samples/translate_v3beta1_generated_translation_service_delete_glossary_async.py b/translation/samples/generated_samples/translate_v3beta1_generated_translation_service_delete_glossary_async.py new file mode 100644 index 000000000000..29b4b0586e88 --- /dev/null +++ b/translation/samples/generated_samples/translate_v3beta1_generated_translation_service_delete_glossary_async.py @@ -0,0 +1,49 @@ +# -*- coding: utf-8 -*- +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for DeleteGlossary +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-translate + + +# [START translate_v3beta1_generated_TranslationService_DeleteGlossary_async] +from google.cloud import translate_v3beta1 + + +async def sample_delete_glossary(): + # Create a client + client = translate_v3beta1.TranslationServiceAsyncClient() + + # Initialize request argument(s) + request = translate_v3beta1.DeleteGlossaryRequest( + name="name_value", + ) + + # Make the request + operation = client.delete_glossary(request=request) + + print("Waiting for operation to complete...") + + response = await operation.result() + + # Handle the response + print(response) + +# [END translate_v3beta1_generated_TranslationService_DeleteGlossary_async] diff --git a/translation/samples/generated_samples/translate_v3beta1_generated_translation_service_delete_glossary_sync.py b/translation/samples/generated_samples/translate_v3beta1_generated_translation_service_delete_glossary_sync.py new file mode 100644 index 000000000000..5be4849812c1 --- /dev/null +++ b/translation/samples/generated_samples/translate_v3beta1_generated_translation_service_delete_glossary_sync.py @@ -0,0 +1,49 @@ +# -*- coding: utf-8 -*- +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for DeleteGlossary +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-translate + + +# [START translate_v3beta1_generated_TranslationService_DeleteGlossary_sync] +from google.cloud import translate_v3beta1 + + +def sample_delete_glossary(): + # Create a client + client = translate_v3beta1.TranslationServiceClient() + + # Initialize request argument(s) + request = translate_v3beta1.DeleteGlossaryRequest( + name="name_value", + ) + + # Make the request + operation = client.delete_glossary(request=request) + + print("Waiting for operation to complete...") + + response = operation.result() + + # Handle the response + print(response) + +# [END translate_v3beta1_generated_TranslationService_DeleteGlossary_sync] diff --git a/translation/samples/generated_samples/translate_v3beta1_generated_translation_service_detect_language_async.py b/translation/samples/generated_samples/translate_v3beta1_generated_translation_service_detect_language_async.py new file mode 100644 index 000000000000..186db7fd8501 --- /dev/null +++ b/translation/samples/generated_samples/translate_v3beta1_generated_translation_service_detect_language_async.py @@ -0,0 +1,46 @@ +# -*- coding: utf-8 -*- +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for DetectLanguage +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-translate + + +# [START translate_v3beta1_generated_TranslationService_DetectLanguage_async] +from google.cloud import translate_v3beta1 + + +async def sample_detect_language(): + # Create a client + client = translate_v3beta1.TranslationServiceAsyncClient() + + # Initialize request argument(s) + request = translate_v3beta1.DetectLanguageRequest( + content="content_value", + parent="parent_value", + ) + + # Make the request + response = await client.detect_language(request=request) + + # Handle the response + print(response) + +# [END translate_v3beta1_generated_TranslationService_DetectLanguage_async] diff --git a/translation/samples/generated_samples/translate_v3beta1_generated_translation_service_detect_language_sync.py b/translation/samples/generated_samples/translate_v3beta1_generated_translation_service_detect_language_sync.py new file mode 100644 index 000000000000..20e973fc33b3 --- /dev/null +++ b/translation/samples/generated_samples/translate_v3beta1_generated_translation_service_detect_language_sync.py @@ -0,0 +1,46 @@ +# -*- coding: utf-8 -*- +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for DetectLanguage +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-translate + + +# [START translate_v3beta1_generated_TranslationService_DetectLanguage_sync] +from google.cloud import translate_v3beta1 + + +def sample_detect_language(): + # Create a client + client = translate_v3beta1.TranslationServiceClient() + + # Initialize request argument(s) + request = translate_v3beta1.DetectLanguageRequest( + content="content_value", + parent="parent_value", + ) + + # Make the request + response = client.detect_language(request=request) + + # Handle the response + print(response) + +# [END translate_v3beta1_generated_TranslationService_DetectLanguage_sync] diff --git a/translation/samples/generated_samples/translate_v3beta1_generated_translation_service_get_glossary_async.py b/translation/samples/generated_samples/translate_v3beta1_generated_translation_service_get_glossary_async.py new file mode 100644 index 000000000000..8622506f8962 --- /dev/null +++ b/translation/samples/generated_samples/translate_v3beta1_generated_translation_service_get_glossary_async.py @@ -0,0 +1,45 @@ +# -*- coding: utf-8 -*- +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for GetGlossary +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-translate + + +# [START translate_v3beta1_generated_TranslationService_GetGlossary_async] +from google.cloud import translate_v3beta1 + + +async def sample_get_glossary(): + # Create a client + client = translate_v3beta1.TranslationServiceAsyncClient() + + # Initialize request argument(s) + request = translate_v3beta1.GetGlossaryRequest( + name="name_value", + ) + + # Make the request + response = await client.get_glossary(request=request) + + # Handle the response + print(response) + +# [END translate_v3beta1_generated_TranslationService_GetGlossary_async] diff --git a/translation/samples/generated_samples/translate_v3beta1_generated_translation_service_get_glossary_sync.py b/translation/samples/generated_samples/translate_v3beta1_generated_translation_service_get_glossary_sync.py new file mode 100644 index 000000000000..44146f48fb1f --- /dev/null +++ b/translation/samples/generated_samples/translate_v3beta1_generated_translation_service_get_glossary_sync.py @@ -0,0 +1,45 @@ +# -*- coding: utf-8 -*- +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for GetGlossary +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-translate + + +# [START translate_v3beta1_generated_TranslationService_GetGlossary_sync] +from google.cloud import translate_v3beta1 + + +def sample_get_glossary(): + # Create a client + client = translate_v3beta1.TranslationServiceClient() + + # Initialize request argument(s) + request = translate_v3beta1.GetGlossaryRequest( + name="name_value", + ) + + # Make the request + response = client.get_glossary(request=request) + + # Handle the response + print(response) + +# [END translate_v3beta1_generated_TranslationService_GetGlossary_sync] diff --git a/translation/samples/generated_samples/translate_v3beta1_generated_translation_service_get_supported_languages_async.py b/translation/samples/generated_samples/translate_v3beta1_generated_translation_service_get_supported_languages_async.py new file mode 100644 index 000000000000..db1d922d9152 --- /dev/null +++ b/translation/samples/generated_samples/translate_v3beta1_generated_translation_service_get_supported_languages_async.py @@ -0,0 +1,45 @@ +# -*- coding: utf-8 -*- +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for GetSupportedLanguages +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-translate + + +# [START translate_v3beta1_generated_TranslationService_GetSupportedLanguages_async] +from google.cloud import translate_v3beta1 + + +async def sample_get_supported_languages(): + # Create a client + client = translate_v3beta1.TranslationServiceAsyncClient() + + # Initialize request argument(s) + request = translate_v3beta1.GetSupportedLanguagesRequest( + parent="parent_value", + ) + + # Make the request + response = await client.get_supported_languages(request=request) + + # Handle the response + print(response) + +# [END translate_v3beta1_generated_TranslationService_GetSupportedLanguages_async] diff --git a/translation/samples/generated_samples/translate_v3beta1_generated_translation_service_get_supported_languages_sync.py b/translation/samples/generated_samples/translate_v3beta1_generated_translation_service_get_supported_languages_sync.py new file mode 100644 index 000000000000..788bab5ee842 --- /dev/null +++ b/translation/samples/generated_samples/translate_v3beta1_generated_translation_service_get_supported_languages_sync.py @@ -0,0 +1,45 @@ +# -*- coding: utf-8 -*- +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for GetSupportedLanguages +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-translate + + +# [START translate_v3beta1_generated_TranslationService_GetSupportedLanguages_sync] +from google.cloud import translate_v3beta1 + + +def sample_get_supported_languages(): + # Create a client + client = translate_v3beta1.TranslationServiceClient() + + # Initialize request argument(s) + request = translate_v3beta1.GetSupportedLanguagesRequest( + parent="parent_value", + ) + + # Make the request + response = client.get_supported_languages(request=request) + + # Handle the response + print(response) + +# [END translate_v3beta1_generated_TranslationService_GetSupportedLanguages_sync] diff --git a/translation/samples/generated_samples/translate_v3beta1_generated_translation_service_list_glossaries_async.py b/translation/samples/generated_samples/translate_v3beta1_generated_translation_service_list_glossaries_async.py new file mode 100644 index 000000000000..db19a5678fae --- /dev/null +++ b/translation/samples/generated_samples/translate_v3beta1_generated_translation_service_list_glossaries_async.py @@ -0,0 +1,46 @@ +# -*- coding: utf-8 -*- +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for ListGlossaries +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-translate + + +# [START translate_v3beta1_generated_TranslationService_ListGlossaries_async] +from google.cloud import translate_v3beta1 + + +async def sample_list_glossaries(): + # Create a client + client = translate_v3beta1.TranslationServiceAsyncClient() + + # Initialize request argument(s) + request = translate_v3beta1.ListGlossariesRequest( + parent="parent_value", + ) + + # Make the request + page_result = client.list_glossaries(request=request) + + # Handle the response + async for response in page_result: + print(response) + +# [END translate_v3beta1_generated_TranslationService_ListGlossaries_async] diff --git a/translation/samples/generated_samples/translate_v3beta1_generated_translation_service_list_glossaries_sync.py b/translation/samples/generated_samples/translate_v3beta1_generated_translation_service_list_glossaries_sync.py new file mode 100644 index 000000000000..7d5525023a4b --- /dev/null +++ b/translation/samples/generated_samples/translate_v3beta1_generated_translation_service_list_glossaries_sync.py @@ -0,0 +1,46 @@ +# -*- coding: utf-8 -*- +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for ListGlossaries +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-translate + + +# [START translate_v3beta1_generated_TranslationService_ListGlossaries_sync] +from google.cloud import translate_v3beta1 + + +def sample_list_glossaries(): + # Create a client + client = translate_v3beta1.TranslationServiceClient() + + # Initialize request argument(s) + request = translate_v3beta1.ListGlossariesRequest( + parent="parent_value", + ) + + # Make the request + page_result = client.list_glossaries(request=request) + + # Handle the response + for response in page_result: + print(response) + +# [END translate_v3beta1_generated_TranslationService_ListGlossaries_sync] diff --git a/translation/samples/generated_samples/translate_v3beta1_generated_translation_service_translate_document_async.py b/translation/samples/generated_samples/translate_v3beta1_generated_translation_service_translate_document_async.py new file mode 100644 index 000000000000..4c96d229aa89 --- /dev/null +++ b/translation/samples/generated_samples/translate_v3beta1_generated_translation_service_translate_document_async.py @@ -0,0 +1,50 @@ +# -*- coding: utf-8 -*- +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for TranslateDocument +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-translate + + +# [START translate_v3beta1_generated_TranslationService_TranslateDocument_async] +from google.cloud import translate_v3beta1 + + +async def sample_translate_document(): + # Create a client + client = translate_v3beta1.TranslationServiceAsyncClient() + + # Initialize request argument(s) + document_input_config = translate_v3beta1.DocumentInputConfig() + document_input_config.content = b'content_blob' + + request = translate_v3beta1.TranslateDocumentRequest( + parent="parent_value", + target_language_code="target_language_code_value", + document_input_config=document_input_config, + ) + + # Make the request + response = await client.translate_document(request=request) + + # Handle the response + print(response) + +# [END translate_v3beta1_generated_TranslationService_TranslateDocument_async] diff --git a/translation/samples/generated_samples/translate_v3beta1_generated_translation_service_translate_document_sync.py b/translation/samples/generated_samples/translate_v3beta1_generated_translation_service_translate_document_sync.py new file mode 100644 index 000000000000..2c1ff501caa0 --- /dev/null +++ b/translation/samples/generated_samples/translate_v3beta1_generated_translation_service_translate_document_sync.py @@ -0,0 +1,50 @@ +# -*- coding: utf-8 -*- +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for TranslateDocument +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-translate + + +# [START translate_v3beta1_generated_TranslationService_TranslateDocument_sync] +from google.cloud import translate_v3beta1 + + +def sample_translate_document(): + # Create a client + client = translate_v3beta1.TranslationServiceClient() + + # Initialize request argument(s) + document_input_config = translate_v3beta1.DocumentInputConfig() + document_input_config.content = b'content_blob' + + request = translate_v3beta1.TranslateDocumentRequest( + parent="parent_value", + target_language_code="target_language_code_value", + document_input_config=document_input_config, + ) + + # Make the request + response = client.translate_document(request=request) + + # Handle the response + print(response) + +# [END translate_v3beta1_generated_TranslationService_TranslateDocument_sync] diff --git a/translation/samples/generated_samples/translate_v3beta1_generated_translation_service_translate_text_async.py b/translation/samples/generated_samples/translate_v3beta1_generated_translation_service_translate_text_async.py new file mode 100644 index 000000000000..83b22d702a34 --- /dev/null +++ b/translation/samples/generated_samples/translate_v3beta1_generated_translation_service_translate_text_async.py @@ -0,0 +1,47 @@ +# -*- coding: utf-8 -*- +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for TranslateText +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-translate + + +# [START translate_v3beta1_generated_TranslationService_TranslateText_async] +from google.cloud import translate_v3beta1 + + +async def sample_translate_text(): + # Create a client + client = translate_v3beta1.TranslationServiceAsyncClient() + + # Initialize request argument(s) + request = translate_v3beta1.TranslateTextRequest( + contents=['contents_value_1', 'contents_value_2'], + target_language_code="target_language_code_value", + parent="parent_value", + ) + + # Make the request + response = await client.translate_text(request=request) + + # Handle the response + print(response) + +# [END translate_v3beta1_generated_TranslationService_TranslateText_async] diff --git a/translation/samples/generated_samples/translate_v3beta1_generated_translation_service_translate_text_sync.py b/translation/samples/generated_samples/translate_v3beta1_generated_translation_service_translate_text_sync.py new file mode 100644 index 000000000000..2d082aabbfde --- /dev/null +++ b/translation/samples/generated_samples/translate_v3beta1_generated_translation_service_translate_text_sync.py @@ -0,0 +1,47 @@ +# -*- coding: utf-8 -*- +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for TranslateText +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-translate + + +# [START translate_v3beta1_generated_TranslationService_TranslateText_sync] +from google.cloud import translate_v3beta1 + + +def sample_translate_text(): + # Create a client + client = translate_v3beta1.TranslationServiceClient() + + # Initialize request argument(s) + request = translate_v3beta1.TranslateTextRequest( + contents=['contents_value_1', 'contents_value_2'], + target_language_code="target_language_code_value", + parent="parent_value", + ) + + # Make the request + response = client.translate_text(request=request) + + # Handle the response + print(response) + +# [END translate_v3beta1_generated_TranslationService_TranslateText_sync]