From 36c4483e9fac4933fc024fcae24ae8fbbdb470a0 Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Fri, 25 Feb 2022 19:42:20 -0500 Subject: [PATCH] docs: add generated snippets (#336) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * chore: use gapic-generator-python 0.63.2 docs: add generated snippets PiperOrigin-RevId: 427792504 Source-Link: https://github.com/googleapis/googleapis/commit/55b9e1e0b3106c850d13958352bc0751147b6b15 Source-Link: https://github.com/googleapis/googleapis-gen/commit/bf4e86b753f42cb0edb1fd51fbe840d7da0a1cde Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiYmY0ZTg2Yjc1M2Y0MmNiMGVkYjFmZDUxZmJlODQwZDdkYTBhMWNkZSJ9 * 🦉 Updates from OwlBot See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md * 🦉 Updates from OwlBot See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md * 🦉 Updates from OwlBot See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md * 🦉 Updates from OwlBot See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md * chore: use gapic-generator-python 0.63.4 chore: fix snippet region tag format chore: fix docstring code block formatting PiperOrigin-RevId: 430730865 Source-Link: https://github.com/googleapis/googleapis/commit/ea5800229f73f94fd7204915a86ed09dcddf429a Source-Link: https://github.com/googleapis/googleapis-gen/commit/ca893ff8af25fc7fe001de1405a517d80446ecca Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiY2E4OTNmZjhhZjI1ZmM3ZmUwMDFkZTE0MDVhNTE3ZDgwNDQ2ZWNjYSJ9 * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md Co-authored-by: Owl Bot Co-authored-by: Bu Sun Kim <8822365+busunkim96@users.noreply.github.com> --- .../translation_service/async_client.py | 246 +++++ .../services/translation_service/client.py | 246 +++++ .../translation_service/async_client.py | 246 +++++ .../services/translation_service/client.py | 246 +++++ .../snippet_metadata_translate_v3.json | 894 ++++++++++++++++++ .../snippet_metadata_translate_v3beta1.json | 894 ++++++++++++++++++ ..._service_batch_translate_document_async.py | 59 ++ ...n_service_batch_translate_document_sync.py | 59 ++ ...tion_service_batch_translate_text_async.py | 59 ++ ...ation_service_batch_translate_text_sync.py | 59 ++ ...anslation_service_create_glossary_async.py | 53 ++ ...ranslation_service_create_glossary_sync.py | 53 ++ ...anslation_service_delete_glossary_async.py | 49 + ...ranslation_service_delete_glossary_sync.py | 49 + ...anslation_service_detect_language_async.py | 46 + ...ranslation_service_detect_language_sync.py | 46 + ..._translation_service_get_glossary_async.py | 45 + ...3_translation_service_get_glossary_sync.py | 45 + ...n_service_get_supported_languages_async.py | 45 + ...on_service_get_supported_languages_sync.py | 45 + ...anslation_service_list_glossaries_async.py | 46 + ...ranslation_service_list_glossaries_sync.py | 46 + ...lation_service_translate_document_async.py | 50 + ...slation_service_translate_document_sync.py | 50 + ...ranslation_service_translate_text_async.py | 47 + ...translation_service_translate_text_sync.py | 47 + ..._service_batch_translate_document_async.py | 59 ++ ...n_service_batch_translate_document_sync.py | 59 ++ ...tion_service_batch_translate_text_async.py | 59 ++ ...ation_service_batch_translate_text_sync.py | 59 ++ ...anslation_service_create_glossary_async.py | 53 ++ ...ranslation_service_create_glossary_sync.py | 53 ++ ...anslation_service_delete_glossary_async.py | 49 + ...ranslation_service_delete_glossary_sync.py | 49 + ...anslation_service_detect_language_async.py | 46 + ...ranslation_service_detect_language_sync.py | 46 + ..._translation_service_get_glossary_async.py | 45 + ...1_translation_service_get_glossary_sync.py | 45 + ...n_service_get_supported_languages_async.py | 45 + ...on_service_get_supported_languages_sync.py | 45 + ...anslation_service_list_glossaries_async.py | 46 + ...ranslation_service_list_glossaries_sync.py | 46 + ...lation_service_translate_document_async.py | 50 + ...slation_service_translate_document_sync.py | 50 + ...ranslation_service_translate_text_async.py | 47 + ...translation_service_translate_text_sync.py | 47 + ..._service_batch_translate_document_async.py | 59 ++ ...n_service_batch_translate_document_sync.py | 59 ++ ...tion_service_batch_translate_text_async.py | 59 ++ ...ation_service_batch_translate_text_sync.py | 59 ++ ...anslation_service_create_glossary_async.py | 53 ++ ...ranslation_service_create_glossary_sync.py | 53 ++ ...anslation_service_delete_glossary_async.py | 49 + ...ranslation_service_delete_glossary_sync.py | 49 + ...anslation_service_detect_language_async.py | 46 + ...ranslation_service_detect_language_sync.py | 46 + ..._translation_service_get_glossary_async.py | 45 + ...d_translation_service_get_glossary_sync.py | 45 + ...n_service_get_supported_languages_async.py | 45 + ...on_service_get_supported_languages_sync.py | 45 + ...anslation_service_list_glossaries_async.py | 46 + ...ranslation_service_list_glossaries_sync.py | 46 + ...lation_service_translate_document_async.py | 50 + ...slation_service_translate_document_sync.py | 50 + ...ranslation_service_translate_text_async.py | 47 + ...translation_service_translate_text_sync.py | 47 + ..._service_batch_translate_document_async.py | 59 ++ ...n_service_batch_translate_document_sync.py | 59 ++ ...tion_service_batch_translate_text_async.py | 59 ++ ...ation_service_batch_translate_text_sync.py | 59 ++ ...anslation_service_create_glossary_async.py | 53 ++ ...ranslation_service_create_glossary_sync.py | 53 ++ ...anslation_service_delete_glossary_async.py | 49 + ...ranslation_service_delete_glossary_sync.py | 49 + ...anslation_service_detect_language_async.py | 46 + ...ranslation_service_detect_language_sync.py | 46 + ..._translation_service_get_glossary_async.py | 45 + ...d_translation_service_get_glossary_sync.py | 45 + ...n_service_get_supported_languages_async.py | 45 + ...on_service_get_supported_languages_sync.py | 45 + ...anslation_service_list_glossaries_async.py | 46 + ...ranslation_service_list_glossaries_sync.py | 46 + ...lation_service_translate_document_async.py | 50 + ...slation_service_translate_document_sync.py | 50 + ...ranslation_service_translate_text_async.py | 47 + ...translation_service_translate_text_sync.py | 47 + 86 files changed, 6764 insertions(+) create mode 100644 samples/generated_samples/snippet_metadata_translate_v3.json create mode 100644 samples/generated_samples/snippet_metadata_translate_v3beta1.json create mode 100644 samples/generated_samples/translate_generated_translate_v3_translation_service_batch_translate_document_async.py create mode 100644 samples/generated_samples/translate_generated_translate_v3_translation_service_batch_translate_document_sync.py create mode 100644 samples/generated_samples/translate_generated_translate_v3_translation_service_batch_translate_text_async.py create mode 100644 samples/generated_samples/translate_generated_translate_v3_translation_service_batch_translate_text_sync.py create mode 100644 samples/generated_samples/translate_generated_translate_v3_translation_service_create_glossary_async.py create mode 100644 samples/generated_samples/translate_generated_translate_v3_translation_service_create_glossary_sync.py create mode 100644 samples/generated_samples/translate_generated_translate_v3_translation_service_delete_glossary_async.py create mode 100644 samples/generated_samples/translate_generated_translate_v3_translation_service_delete_glossary_sync.py create mode 100644 samples/generated_samples/translate_generated_translate_v3_translation_service_detect_language_async.py create mode 100644 samples/generated_samples/translate_generated_translate_v3_translation_service_detect_language_sync.py create mode 100644 samples/generated_samples/translate_generated_translate_v3_translation_service_get_glossary_async.py create mode 100644 samples/generated_samples/translate_generated_translate_v3_translation_service_get_glossary_sync.py create mode 100644 samples/generated_samples/translate_generated_translate_v3_translation_service_get_supported_languages_async.py create mode 100644 samples/generated_samples/translate_generated_translate_v3_translation_service_get_supported_languages_sync.py create mode 100644 samples/generated_samples/translate_generated_translate_v3_translation_service_list_glossaries_async.py create mode 100644 samples/generated_samples/translate_generated_translate_v3_translation_service_list_glossaries_sync.py create mode 100644 samples/generated_samples/translate_generated_translate_v3_translation_service_translate_document_async.py create mode 100644 samples/generated_samples/translate_generated_translate_v3_translation_service_translate_document_sync.py create mode 100644 samples/generated_samples/translate_generated_translate_v3_translation_service_translate_text_async.py create mode 100644 samples/generated_samples/translate_generated_translate_v3_translation_service_translate_text_sync.py create mode 100644 samples/generated_samples/translate_generated_translate_v3beta1_translation_service_batch_translate_document_async.py create mode 100644 samples/generated_samples/translate_generated_translate_v3beta1_translation_service_batch_translate_document_sync.py create mode 100644 samples/generated_samples/translate_generated_translate_v3beta1_translation_service_batch_translate_text_async.py create mode 100644 samples/generated_samples/translate_generated_translate_v3beta1_translation_service_batch_translate_text_sync.py create mode 100644 samples/generated_samples/translate_generated_translate_v3beta1_translation_service_create_glossary_async.py create mode 100644 samples/generated_samples/translate_generated_translate_v3beta1_translation_service_create_glossary_sync.py create mode 100644 samples/generated_samples/translate_generated_translate_v3beta1_translation_service_delete_glossary_async.py create mode 100644 samples/generated_samples/translate_generated_translate_v3beta1_translation_service_delete_glossary_sync.py create mode 100644 samples/generated_samples/translate_generated_translate_v3beta1_translation_service_detect_language_async.py create mode 100644 samples/generated_samples/translate_generated_translate_v3beta1_translation_service_detect_language_sync.py create mode 100644 samples/generated_samples/translate_generated_translate_v3beta1_translation_service_get_glossary_async.py create mode 100644 samples/generated_samples/translate_generated_translate_v3beta1_translation_service_get_glossary_sync.py create mode 100644 samples/generated_samples/translate_generated_translate_v3beta1_translation_service_get_supported_languages_async.py create mode 100644 samples/generated_samples/translate_generated_translate_v3beta1_translation_service_get_supported_languages_sync.py create mode 100644 samples/generated_samples/translate_generated_translate_v3beta1_translation_service_list_glossaries_async.py create mode 100644 samples/generated_samples/translate_generated_translate_v3beta1_translation_service_list_glossaries_sync.py create mode 100644 samples/generated_samples/translate_generated_translate_v3beta1_translation_service_translate_document_async.py create mode 100644 samples/generated_samples/translate_generated_translate_v3beta1_translation_service_translate_document_sync.py create mode 100644 samples/generated_samples/translate_generated_translate_v3beta1_translation_service_translate_text_async.py create mode 100644 samples/generated_samples/translate_generated_translate_v3beta1_translation_service_translate_text_sync.py create mode 100644 samples/generated_samples/translate_v3_generated_translation_service_batch_translate_document_async.py create mode 100644 samples/generated_samples/translate_v3_generated_translation_service_batch_translate_document_sync.py create mode 100644 samples/generated_samples/translate_v3_generated_translation_service_batch_translate_text_async.py create mode 100644 samples/generated_samples/translate_v3_generated_translation_service_batch_translate_text_sync.py create mode 100644 samples/generated_samples/translate_v3_generated_translation_service_create_glossary_async.py create mode 100644 samples/generated_samples/translate_v3_generated_translation_service_create_glossary_sync.py create mode 100644 samples/generated_samples/translate_v3_generated_translation_service_delete_glossary_async.py create mode 100644 samples/generated_samples/translate_v3_generated_translation_service_delete_glossary_sync.py create mode 100644 samples/generated_samples/translate_v3_generated_translation_service_detect_language_async.py create mode 100644 samples/generated_samples/translate_v3_generated_translation_service_detect_language_sync.py create mode 100644 samples/generated_samples/translate_v3_generated_translation_service_get_glossary_async.py create mode 100644 samples/generated_samples/translate_v3_generated_translation_service_get_glossary_sync.py create mode 100644 samples/generated_samples/translate_v3_generated_translation_service_get_supported_languages_async.py create mode 100644 samples/generated_samples/translate_v3_generated_translation_service_get_supported_languages_sync.py create mode 100644 samples/generated_samples/translate_v3_generated_translation_service_list_glossaries_async.py create mode 100644 samples/generated_samples/translate_v3_generated_translation_service_list_glossaries_sync.py create mode 100644 samples/generated_samples/translate_v3_generated_translation_service_translate_document_async.py create mode 100644 samples/generated_samples/translate_v3_generated_translation_service_translate_document_sync.py create mode 100644 samples/generated_samples/translate_v3_generated_translation_service_translate_text_async.py create mode 100644 samples/generated_samples/translate_v3_generated_translation_service_translate_text_sync.py create mode 100644 samples/generated_samples/translate_v3beta1_generated_translation_service_batch_translate_document_async.py create mode 100644 samples/generated_samples/translate_v3beta1_generated_translation_service_batch_translate_document_sync.py create mode 100644 samples/generated_samples/translate_v3beta1_generated_translation_service_batch_translate_text_async.py create mode 100644 samples/generated_samples/translate_v3beta1_generated_translation_service_batch_translate_text_sync.py create mode 100644 samples/generated_samples/translate_v3beta1_generated_translation_service_create_glossary_async.py create mode 100644 samples/generated_samples/translate_v3beta1_generated_translation_service_create_glossary_sync.py create mode 100644 samples/generated_samples/translate_v3beta1_generated_translation_service_delete_glossary_async.py create mode 100644 samples/generated_samples/translate_v3beta1_generated_translation_service_delete_glossary_sync.py create mode 100644 samples/generated_samples/translate_v3beta1_generated_translation_service_detect_language_async.py create mode 100644 samples/generated_samples/translate_v3beta1_generated_translation_service_detect_language_sync.py create mode 100644 samples/generated_samples/translate_v3beta1_generated_translation_service_get_glossary_async.py create mode 100644 samples/generated_samples/translate_v3beta1_generated_translation_service_get_glossary_sync.py create mode 100644 samples/generated_samples/translate_v3beta1_generated_translation_service_get_supported_languages_async.py create mode 100644 samples/generated_samples/translate_v3beta1_generated_translation_service_get_supported_languages_sync.py create mode 100644 samples/generated_samples/translate_v3beta1_generated_translation_service_list_glossaries_async.py create mode 100644 samples/generated_samples/translate_v3beta1_generated_translation_service_list_glossaries_sync.py create mode 100644 samples/generated_samples/translate_v3beta1_generated_translation_service_translate_document_async.py create mode 100644 samples/generated_samples/translate_v3beta1_generated_translation_service_translate_document_sync.py create mode 100644 samples/generated_samples/translate_v3beta1_generated_translation_service_translate_text_async.py create mode 100644 samples/generated_samples/translate_v3beta1_generated_translation_service_translate_text_sync.py diff --git a/google/cloud/translate_v3/services/translation_service/async_client.py b/google/cloud/translate_v3/services/translation_service/async_client.py index f1fa93b9..c3651e91 100644 --- a/google/cloud/translate_v3/services/translation_service/async_client.py +++ b/google/cloud/translate_v3/services/translation_service/async_client.py @@ -222,6 +222,27 @@ async def translate_text( ) -> translation_service.TranslateTextResponse: r"""Translates input text and returns translated text. + .. code-block:: python + + 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) + Args: request (Union[google.cloud.translate_v3.types.TranslateTextRequest, dict]): The request object. The request message for synchronous @@ -390,6 +411,26 @@ async def detect_language( ) -> translation_service.DetectLanguageResponse: r"""Detects the language of text within a request. + .. code-block:: python + + 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) + Args: request (Union[google.cloud.translate_v3.types.DetectLanguageRequest, dict]): The request object. The request message for language @@ -513,6 +554,26 @@ async def get_supported_languages( r"""Returns a list of supported languages for translation. + + .. code-block:: python + + 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) + Args: request (Union[google.cloud.translate_v3.types.GetSupportedLanguagesRequest, dict]): The request object. The request message for discovering @@ -638,6 +699,30 @@ async def translate_document( ) -> translation_service.TranslateDocumentResponse: r"""Translates documents in synchronous mode. + .. code-block:: python + + 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) + Args: request (Union[google.cloud.translate_v3.types.TranslateDocumentRequest, dict]): The request object. A document translation request. @@ -694,6 +779,40 @@ async def batch_translate_text( use google.longrunning.Operation.name to poll the status of the call. + + .. code-block:: python + + 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) + Args: request (Union[google.cloud.translate_v3.types.BatchTranslateTextRequest, dict]): The request object. The batch translation request. @@ -767,6 +886,40 @@ async def batch_translate_document( google.longrunning.Operation.name to poll the status of the call. + + .. code-block:: python + + 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) + Args: request (Union[google.cloud.translate_v3.types.BatchTranslateDocumentRequest, dict]): The request object. The BatchTranslateDocument request. @@ -917,6 +1070,34 @@ async def create_glossary( r"""Creates a glossary and returns the long-running operation. Returns NOT_FOUND, if the project doesn't exist. + + .. code-block:: python + + 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) + Args: request (Union[google.cloud.translate_v3.types.CreateGlossaryRequest, dict]): The request object. Request message for CreateGlossary. @@ -1004,6 +1185,27 @@ async def list_glossaries( r"""Lists glossaries in a project. Returns NOT_FOUND, if the project doesn't exist. + + .. code-block:: python + + 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) + Args: request (Union[google.cloud.translate_v3.types.ListGlossariesRequest, dict]): The request object. Request message for ListGlossaries. @@ -1094,6 +1296,26 @@ async def get_glossary( r"""Gets a glossary. Returns NOT_FOUND, if the glossary doesn't exist. + + .. code-block:: python + + 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) + Args: request (Union[google.cloud.translate_v3.types.GetGlossaryRequest, dict]): The request object. Request message for GetGlossary. @@ -1176,6 +1398,30 @@ async def delete_glossary( glossary isn't created yet. Returns NOT_FOUND, if the glossary doesn't exist. + + .. code-block:: python + + 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) + Args: request (Union[google.cloud.translate_v3.types.DeleteGlossaryRequest, dict]): The request object. Request message for DeleteGlossary. diff --git a/google/cloud/translate_v3/services/translation_service/client.py b/google/cloud/translate_v3/services/translation_service/client.py index 420622d7..ec0eff50 100644 --- a/google/cloud/translate_v3/services/translation_service/client.py +++ b/google/cloud/translate_v3/services/translation_service/client.py @@ -420,6 +420,27 @@ def translate_text( ) -> translation_service.TranslateTextResponse: r"""Translates input text and returns translated text. + .. code-block:: python + + 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) + Args: request (Union[google.cloud.translate_v3.types.TranslateTextRequest, dict]): The request object. The request message for synchronous @@ -588,6 +609,26 @@ def detect_language( ) -> translation_service.DetectLanguageResponse: r"""Detects the language of text within a request. + .. code-block:: python + + 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) + Args: request (Union[google.cloud.translate_v3.types.DetectLanguageRequest, dict]): The request object. The request message for language @@ -711,6 +752,26 @@ def get_supported_languages( r"""Returns a list of supported languages for translation. + + .. code-block:: python + + 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) + Args: request (Union[google.cloud.translate_v3.types.GetSupportedLanguagesRequest, dict]): The request object. The request message for discovering @@ -826,6 +887,30 @@ def translate_document( ) -> translation_service.TranslateDocumentResponse: r"""Translates documents in synchronous mode. + .. code-block:: python + + 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) + Args: request (Union[google.cloud.translate_v3.types.TranslateDocumentRequest, dict]): The request object. A document translation request. @@ -883,6 +968,40 @@ def batch_translate_text( use google.longrunning.Operation.name to poll the status of the call. + + .. code-block:: python + + 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) + Args: request (Union[google.cloud.translate_v3.types.BatchTranslateTextRequest, dict]): The request object. The batch translation request. @@ -957,6 +1076,40 @@ def batch_translate_document( google.longrunning.Operation.name to poll the status of the call. + + .. code-block:: python + + 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) + Args: request (Union[google.cloud.translate_v3.types.BatchTranslateDocumentRequest, dict]): The request object. The BatchTranslateDocument request. @@ -1107,6 +1260,34 @@ def create_glossary( r"""Creates a glossary and returns the long-running operation. Returns NOT_FOUND, if the project doesn't exist. + + .. code-block:: python + + 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) + Args: request (Union[google.cloud.translate_v3.types.CreateGlossaryRequest, dict]): The request object. Request message for CreateGlossary. @@ -1194,6 +1375,27 @@ def list_glossaries( r"""Lists glossaries in a project. Returns NOT_FOUND, if the project doesn't exist. + + .. code-block:: python + + 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) + Args: request (Union[google.cloud.translate_v3.types.ListGlossariesRequest, dict]): The request object. Request message for ListGlossaries. @@ -1274,6 +1476,26 @@ def get_glossary( r"""Gets a glossary. Returns NOT_FOUND, if the glossary doesn't exist. + + .. code-block:: python + + 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) + Args: request (Union[google.cloud.translate_v3.types.GetGlossaryRequest, dict]): The request object. Request message for GetGlossary. @@ -1346,6 +1568,30 @@ def delete_glossary( glossary isn't created yet. Returns NOT_FOUND, if the glossary doesn't exist. + + .. code-block:: python + + 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) + Args: request (Union[google.cloud.translate_v3.types.DeleteGlossaryRequest, dict]): The request object. Request message for DeleteGlossary. diff --git a/google/cloud/translate_v3beta1/services/translation_service/async_client.py b/google/cloud/translate_v3beta1/services/translation_service/async_client.py index 8c8c2eeb..49c9cb95 100644 --- a/google/cloud/translate_v3beta1/services/translation_service/async_client.py +++ b/google/cloud/translate_v3beta1/services/translation_service/async_client.py @@ -216,6 +216,27 @@ async def translate_text( ) -> translation_service.TranslateTextResponse: r"""Translates input text and returns translated text. + .. code-block:: python + + 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) + Args: request (Union[google.cloud.translate_v3beta1.types.TranslateTextRequest, dict]): The request object. The request message for synchronous @@ -266,6 +287,26 @@ async def detect_language( ) -> translation_service.DetectLanguageResponse: r"""Detects the language of text within a request. + .. code-block:: python + + 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) + Args: request (Union[google.cloud.translate_v3beta1.types.DetectLanguageRequest, dict]): The request object. The request message for language @@ -380,6 +421,26 @@ async def get_supported_languages( r"""Returns a list of supported languages for translation. + + .. code-block:: python + + 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) + Args: request (Union[google.cloud.translate_v3beta1.types.GetSupportedLanguagesRequest, dict]): The request object. The request message for discovering @@ -505,6 +566,30 @@ async def translate_document( ) -> translation_service.TranslateDocumentResponse: r"""Translates documents in synchronous mode. + .. code-block:: python + + 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) + Args: request (Union[google.cloud.translate_v3beta1.types.TranslateDocumentRequest, dict]): The request object. A document translation request. @@ -561,6 +646,40 @@ async def batch_translate_text( use google.longrunning.Operation.name to poll the status of the call. + + .. code-block:: python + + 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) + Args: request (Union[google.cloud.translate_v3beta1.types.BatchTranslateTextRequest, dict]): The request object. The batch translation request. @@ -634,6 +753,40 @@ async def batch_translate_document( google.longrunning.Operation.name to poll the status of the call. + + .. code-block:: python + + 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) + Args: request (Union[google.cloud.translate_v3beta1.types.BatchTranslateDocumentRequest, dict]): The request object. The BatchTranslateDocument request. @@ -784,6 +937,34 @@ async def create_glossary( r"""Creates a glossary and returns the long-running operation. Returns NOT_FOUND, if the project doesn't exist. + + .. code-block:: python + + 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) + Args: request (Union[google.cloud.translate_v3beta1.types.CreateGlossaryRequest, dict]): The request object. Request message for CreateGlossary. @@ -872,6 +1053,27 @@ async def list_glossaries( r"""Lists glossaries in a project. Returns NOT_FOUND, if the project doesn't exist. + + .. code-block:: python + + 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) + Args: request (Union[google.cloud.translate_v3beta1.types.ListGlossariesRequest, dict]): The request object. Request message for ListGlossaries. @@ -998,6 +1200,26 @@ async def get_glossary( r"""Gets a glossary. Returns NOT_FOUND, if the glossary doesn't exist. + + .. code-block:: python + + 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) + Args: request (Union[google.cloud.translate_v3beta1.types.GetGlossaryRequest, dict]): The request object. Request message for GetGlossary. @@ -1080,6 +1302,30 @@ async def delete_glossary( glossary isn't created yet. Returns NOT_FOUND, if the glossary doesn't exist. + + .. code-block:: python + + 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) + Args: request (Union[google.cloud.translate_v3beta1.types.DeleteGlossaryRequest, dict]): The request object. Request message for DeleteGlossary. diff --git a/google/cloud/translate_v3beta1/services/translation_service/client.py b/google/cloud/translate_v3beta1/services/translation_service/client.py index 2fb395cb..32d4024c 100644 --- a/google/cloud/translate_v3beta1/services/translation_service/client.py +++ b/google/cloud/translate_v3beta1/services/translation_service/client.py @@ -414,6 +414,27 @@ def translate_text( ) -> translation_service.TranslateTextResponse: r"""Translates input text and returns translated text. + .. code-block:: python + + 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) + Args: request (Union[google.cloud.translate_v3beta1.types.TranslateTextRequest, dict]): The request object. The request message for synchronous @@ -465,6 +486,26 @@ def detect_language( ) -> translation_service.DetectLanguageResponse: r"""Detects the language of text within a request. + .. code-block:: python + + 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) + Args: request (Union[google.cloud.translate_v3beta1.types.DetectLanguageRequest, dict]): The request object. The request message for language @@ -579,6 +620,26 @@ def get_supported_languages( r"""Returns a list of supported languages for translation. + + .. code-block:: python + + 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) + Args: request (Union[google.cloud.translate_v3beta1.types.GetSupportedLanguagesRequest, dict]): The request object. The request message for discovering @@ -694,6 +755,30 @@ def translate_document( ) -> translation_service.TranslateDocumentResponse: r"""Translates documents in synchronous mode. + .. code-block:: python + + 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) + Args: request (Union[google.cloud.translate_v3beta1.types.TranslateDocumentRequest, dict]): The request object. A document translation request. @@ -751,6 +836,40 @@ def batch_translate_text( use google.longrunning.Operation.name to poll the status of the call. + + .. code-block:: python + + 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) + Args: request (Union[google.cloud.translate_v3beta1.types.BatchTranslateTextRequest, dict]): The request object. The batch translation request. @@ -825,6 +944,40 @@ def batch_translate_document( google.longrunning.Operation.name to poll the status of the call. + + .. code-block:: python + + 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) + Args: request (Union[google.cloud.translate_v3beta1.types.BatchTranslateDocumentRequest, dict]): The request object. The BatchTranslateDocument request. @@ -975,6 +1128,34 @@ def create_glossary( r"""Creates a glossary and returns the long-running operation. Returns NOT_FOUND, if the project doesn't exist. + + .. code-block:: python + + 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) + Args: request (Union[google.cloud.translate_v3beta1.types.CreateGlossaryRequest, dict]): The request object. Request message for CreateGlossary. @@ -1063,6 +1244,27 @@ def list_glossaries( r"""Lists glossaries in a project. Returns NOT_FOUND, if the project doesn't exist. + + .. code-block:: python + + 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) + Args: request (Union[google.cloud.translate_v3beta1.types.ListGlossariesRequest, dict]): The request object. Request message for ListGlossaries. @@ -1179,6 +1381,26 @@ def get_glossary( r"""Gets a glossary. Returns NOT_FOUND, if the glossary doesn't exist. + + .. code-block:: python + + 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) + Args: request (Union[google.cloud.translate_v3beta1.types.GetGlossaryRequest, dict]): The request object. Request message for GetGlossary. @@ -1251,6 +1473,30 @@ def delete_glossary( glossary isn't created yet. Returns NOT_FOUND, if the glossary doesn't exist. + + .. code-block:: python + + 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) + Args: request (Union[google.cloud.translate_v3beta1.types.DeleteGlossaryRequest, dict]): The request object. Request message for DeleteGlossary. diff --git a/samples/generated_samples/snippet_metadata_translate_v3.json b/samples/generated_samples/snippet_metadata_translate_v3.json new file mode 100644 index 00000000..32c166f1 --- /dev/null +++ b/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/samples/generated_samples/snippet_metadata_translate_v3beta1.json b/samples/generated_samples/snippet_metadata_translate_v3beta1.json new file mode 100644 index 00000000..537673e5 --- /dev/null +++ b/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/samples/generated_samples/translate_generated_translate_v3_translation_service_batch_translate_document_async.py b/samples/generated_samples/translate_generated_translate_v3_translation_service_batch_translate_document_async.py new file mode 100644 index 00000000..a43e5e4e --- /dev/null +++ b/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/samples/generated_samples/translate_generated_translate_v3_translation_service_batch_translate_document_sync.py b/samples/generated_samples/translate_generated_translate_v3_translation_service_batch_translate_document_sync.py new file mode 100644 index 00000000..bf358856 --- /dev/null +++ b/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/samples/generated_samples/translate_generated_translate_v3_translation_service_batch_translate_text_async.py b/samples/generated_samples/translate_generated_translate_v3_translation_service_batch_translate_text_async.py new file mode 100644 index 00000000..431f7edf --- /dev/null +++ b/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/samples/generated_samples/translate_generated_translate_v3_translation_service_batch_translate_text_sync.py b/samples/generated_samples/translate_generated_translate_v3_translation_service_batch_translate_text_sync.py new file mode 100644 index 00000000..68f8b1ff --- /dev/null +++ b/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/samples/generated_samples/translate_generated_translate_v3_translation_service_create_glossary_async.py b/samples/generated_samples/translate_generated_translate_v3_translation_service_create_glossary_async.py new file mode 100644 index 00000000..a407ed46 --- /dev/null +++ b/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/samples/generated_samples/translate_generated_translate_v3_translation_service_create_glossary_sync.py b/samples/generated_samples/translate_generated_translate_v3_translation_service_create_glossary_sync.py new file mode 100644 index 00000000..68fcc191 --- /dev/null +++ b/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/samples/generated_samples/translate_generated_translate_v3_translation_service_delete_glossary_async.py b/samples/generated_samples/translate_generated_translate_v3_translation_service_delete_glossary_async.py new file mode 100644 index 00000000..9e859d68 --- /dev/null +++ b/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/samples/generated_samples/translate_generated_translate_v3_translation_service_delete_glossary_sync.py b/samples/generated_samples/translate_generated_translate_v3_translation_service_delete_glossary_sync.py new file mode 100644 index 00000000..e397a1bd --- /dev/null +++ b/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/samples/generated_samples/translate_generated_translate_v3_translation_service_detect_language_async.py b/samples/generated_samples/translate_generated_translate_v3_translation_service_detect_language_async.py new file mode 100644 index 00000000..3539d116 --- /dev/null +++ b/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/samples/generated_samples/translate_generated_translate_v3_translation_service_detect_language_sync.py b/samples/generated_samples/translate_generated_translate_v3_translation_service_detect_language_sync.py new file mode 100644 index 00000000..5f76924c --- /dev/null +++ b/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/samples/generated_samples/translate_generated_translate_v3_translation_service_get_glossary_async.py b/samples/generated_samples/translate_generated_translate_v3_translation_service_get_glossary_async.py new file mode 100644 index 00000000..ffd2fd34 --- /dev/null +++ b/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/samples/generated_samples/translate_generated_translate_v3_translation_service_get_glossary_sync.py b/samples/generated_samples/translate_generated_translate_v3_translation_service_get_glossary_sync.py new file mode 100644 index 00000000..751b4dad --- /dev/null +++ b/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/samples/generated_samples/translate_generated_translate_v3_translation_service_get_supported_languages_async.py b/samples/generated_samples/translate_generated_translate_v3_translation_service_get_supported_languages_async.py new file mode 100644 index 00000000..279fe4fd --- /dev/null +++ b/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/samples/generated_samples/translate_generated_translate_v3_translation_service_get_supported_languages_sync.py b/samples/generated_samples/translate_generated_translate_v3_translation_service_get_supported_languages_sync.py new file mode 100644 index 00000000..378d3328 --- /dev/null +++ b/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/samples/generated_samples/translate_generated_translate_v3_translation_service_list_glossaries_async.py b/samples/generated_samples/translate_generated_translate_v3_translation_service_list_glossaries_async.py new file mode 100644 index 00000000..30ea3da6 --- /dev/null +++ b/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/samples/generated_samples/translate_generated_translate_v3_translation_service_list_glossaries_sync.py b/samples/generated_samples/translate_generated_translate_v3_translation_service_list_glossaries_sync.py new file mode 100644 index 00000000..3b67db9b --- /dev/null +++ b/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/samples/generated_samples/translate_generated_translate_v3_translation_service_translate_document_async.py b/samples/generated_samples/translate_generated_translate_v3_translation_service_translate_document_async.py new file mode 100644 index 00000000..533078a9 --- /dev/null +++ b/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/samples/generated_samples/translate_generated_translate_v3_translation_service_translate_document_sync.py b/samples/generated_samples/translate_generated_translate_v3_translation_service_translate_document_sync.py new file mode 100644 index 00000000..b6f4c1a9 --- /dev/null +++ b/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/samples/generated_samples/translate_generated_translate_v3_translation_service_translate_text_async.py b/samples/generated_samples/translate_generated_translate_v3_translation_service_translate_text_async.py new file mode 100644 index 00000000..8d20de78 --- /dev/null +++ b/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/samples/generated_samples/translate_generated_translate_v3_translation_service_translate_text_sync.py b/samples/generated_samples/translate_generated_translate_v3_translation_service_translate_text_sync.py new file mode 100644 index 00000000..458d11cd --- /dev/null +++ b/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/samples/generated_samples/translate_generated_translate_v3beta1_translation_service_batch_translate_document_async.py b/samples/generated_samples/translate_generated_translate_v3beta1_translation_service_batch_translate_document_async.py new file mode 100644 index 00000000..60bb5b44 --- /dev/null +++ b/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/samples/generated_samples/translate_generated_translate_v3beta1_translation_service_batch_translate_document_sync.py b/samples/generated_samples/translate_generated_translate_v3beta1_translation_service_batch_translate_document_sync.py new file mode 100644 index 00000000..c8095f57 --- /dev/null +++ b/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/samples/generated_samples/translate_generated_translate_v3beta1_translation_service_batch_translate_text_async.py b/samples/generated_samples/translate_generated_translate_v3beta1_translation_service_batch_translate_text_async.py new file mode 100644 index 00000000..b3406405 --- /dev/null +++ b/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/samples/generated_samples/translate_generated_translate_v3beta1_translation_service_batch_translate_text_sync.py b/samples/generated_samples/translate_generated_translate_v3beta1_translation_service_batch_translate_text_sync.py new file mode 100644 index 00000000..ab674d3d --- /dev/null +++ b/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/samples/generated_samples/translate_generated_translate_v3beta1_translation_service_create_glossary_async.py b/samples/generated_samples/translate_generated_translate_v3beta1_translation_service_create_glossary_async.py new file mode 100644 index 00000000..548c6439 --- /dev/null +++ b/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/samples/generated_samples/translate_generated_translate_v3beta1_translation_service_create_glossary_sync.py b/samples/generated_samples/translate_generated_translate_v3beta1_translation_service_create_glossary_sync.py new file mode 100644 index 00000000..9898c15e --- /dev/null +++ b/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/samples/generated_samples/translate_generated_translate_v3beta1_translation_service_delete_glossary_async.py b/samples/generated_samples/translate_generated_translate_v3beta1_translation_service_delete_glossary_async.py new file mode 100644 index 00000000..09de10c8 --- /dev/null +++ b/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/samples/generated_samples/translate_generated_translate_v3beta1_translation_service_delete_glossary_sync.py b/samples/generated_samples/translate_generated_translate_v3beta1_translation_service_delete_glossary_sync.py new file mode 100644 index 00000000..fca8fca2 --- /dev/null +++ b/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/samples/generated_samples/translate_generated_translate_v3beta1_translation_service_detect_language_async.py b/samples/generated_samples/translate_generated_translate_v3beta1_translation_service_detect_language_async.py new file mode 100644 index 00000000..021bde2e --- /dev/null +++ b/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/samples/generated_samples/translate_generated_translate_v3beta1_translation_service_detect_language_sync.py b/samples/generated_samples/translate_generated_translate_v3beta1_translation_service_detect_language_sync.py new file mode 100644 index 00000000..5d88e95b --- /dev/null +++ b/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/samples/generated_samples/translate_generated_translate_v3beta1_translation_service_get_glossary_async.py b/samples/generated_samples/translate_generated_translate_v3beta1_translation_service_get_glossary_async.py new file mode 100644 index 00000000..50363956 --- /dev/null +++ b/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/samples/generated_samples/translate_generated_translate_v3beta1_translation_service_get_glossary_sync.py b/samples/generated_samples/translate_generated_translate_v3beta1_translation_service_get_glossary_sync.py new file mode 100644 index 00000000..8160d982 --- /dev/null +++ b/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/samples/generated_samples/translate_generated_translate_v3beta1_translation_service_get_supported_languages_async.py b/samples/generated_samples/translate_generated_translate_v3beta1_translation_service_get_supported_languages_async.py new file mode 100644 index 00000000..641f6bed --- /dev/null +++ b/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/samples/generated_samples/translate_generated_translate_v3beta1_translation_service_get_supported_languages_sync.py b/samples/generated_samples/translate_generated_translate_v3beta1_translation_service_get_supported_languages_sync.py new file mode 100644 index 00000000..4f5aef8f --- /dev/null +++ b/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/samples/generated_samples/translate_generated_translate_v3beta1_translation_service_list_glossaries_async.py b/samples/generated_samples/translate_generated_translate_v3beta1_translation_service_list_glossaries_async.py new file mode 100644 index 00000000..f1a9688c --- /dev/null +++ b/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/samples/generated_samples/translate_generated_translate_v3beta1_translation_service_list_glossaries_sync.py b/samples/generated_samples/translate_generated_translate_v3beta1_translation_service_list_glossaries_sync.py new file mode 100644 index 00000000..d2a81dee --- /dev/null +++ b/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/samples/generated_samples/translate_generated_translate_v3beta1_translation_service_translate_document_async.py b/samples/generated_samples/translate_generated_translate_v3beta1_translation_service_translate_document_async.py new file mode 100644 index 00000000..0593c6da --- /dev/null +++ b/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/samples/generated_samples/translate_generated_translate_v3beta1_translation_service_translate_document_sync.py b/samples/generated_samples/translate_generated_translate_v3beta1_translation_service_translate_document_sync.py new file mode 100644 index 00000000..2deac12a --- /dev/null +++ b/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/samples/generated_samples/translate_generated_translate_v3beta1_translation_service_translate_text_async.py b/samples/generated_samples/translate_generated_translate_v3beta1_translation_service_translate_text_async.py new file mode 100644 index 00000000..5228dc9a --- /dev/null +++ b/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/samples/generated_samples/translate_generated_translate_v3beta1_translation_service_translate_text_sync.py b/samples/generated_samples/translate_generated_translate_v3beta1_translation_service_translate_text_sync.py new file mode 100644 index 00000000..d24cc2f2 --- /dev/null +++ b/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/samples/generated_samples/translate_v3_generated_translation_service_batch_translate_document_async.py b/samples/generated_samples/translate_v3_generated_translation_service_batch_translate_document_async.py new file mode 100644 index 00000000..61d5255a --- /dev/null +++ b/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/samples/generated_samples/translate_v3_generated_translation_service_batch_translate_document_sync.py b/samples/generated_samples/translate_v3_generated_translation_service_batch_translate_document_sync.py new file mode 100644 index 00000000..fe994910 --- /dev/null +++ b/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/samples/generated_samples/translate_v3_generated_translation_service_batch_translate_text_async.py b/samples/generated_samples/translate_v3_generated_translation_service_batch_translate_text_async.py new file mode 100644 index 00000000..79b23f33 --- /dev/null +++ b/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/samples/generated_samples/translate_v3_generated_translation_service_batch_translate_text_sync.py b/samples/generated_samples/translate_v3_generated_translation_service_batch_translate_text_sync.py new file mode 100644 index 00000000..99a45b93 --- /dev/null +++ b/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/samples/generated_samples/translate_v3_generated_translation_service_create_glossary_async.py b/samples/generated_samples/translate_v3_generated_translation_service_create_glossary_async.py new file mode 100644 index 00000000..bb195816 --- /dev/null +++ b/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/samples/generated_samples/translate_v3_generated_translation_service_create_glossary_sync.py b/samples/generated_samples/translate_v3_generated_translation_service_create_glossary_sync.py new file mode 100644 index 00000000..e99fca04 --- /dev/null +++ b/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/samples/generated_samples/translate_v3_generated_translation_service_delete_glossary_async.py b/samples/generated_samples/translate_v3_generated_translation_service_delete_glossary_async.py new file mode 100644 index 00000000..99b02b8e --- /dev/null +++ b/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/samples/generated_samples/translate_v3_generated_translation_service_delete_glossary_sync.py b/samples/generated_samples/translate_v3_generated_translation_service_delete_glossary_sync.py new file mode 100644 index 00000000..8691e1b0 --- /dev/null +++ b/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/samples/generated_samples/translate_v3_generated_translation_service_detect_language_async.py b/samples/generated_samples/translate_v3_generated_translation_service_detect_language_async.py new file mode 100644 index 00000000..3eff2228 --- /dev/null +++ b/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/samples/generated_samples/translate_v3_generated_translation_service_detect_language_sync.py b/samples/generated_samples/translate_v3_generated_translation_service_detect_language_sync.py new file mode 100644 index 00000000..fd1b85e2 --- /dev/null +++ b/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/samples/generated_samples/translate_v3_generated_translation_service_get_glossary_async.py b/samples/generated_samples/translate_v3_generated_translation_service_get_glossary_async.py new file mode 100644 index 00000000..2274c719 --- /dev/null +++ b/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/samples/generated_samples/translate_v3_generated_translation_service_get_glossary_sync.py b/samples/generated_samples/translate_v3_generated_translation_service_get_glossary_sync.py new file mode 100644 index 00000000..e11c7ed7 --- /dev/null +++ b/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/samples/generated_samples/translate_v3_generated_translation_service_get_supported_languages_async.py b/samples/generated_samples/translate_v3_generated_translation_service_get_supported_languages_async.py new file mode 100644 index 00000000..2bf9d688 --- /dev/null +++ b/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/samples/generated_samples/translate_v3_generated_translation_service_get_supported_languages_sync.py b/samples/generated_samples/translate_v3_generated_translation_service_get_supported_languages_sync.py new file mode 100644 index 00000000..d23a8aca --- /dev/null +++ b/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/samples/generated_samples/translate_v3_generated_translation_service_list_glossaries_async.py b/samples/generated_samples/translate_v3_generated_translation_service_list_glossaries_async.py new file mode 100644 index 00000000..d3616f0f --- /dev/null +++ b/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/samples/generated_samples/translate_v3_generated_translation_service_list_glossaries_sync.py b/samples/generated_samples/translate_v3_generated_translation_service_list_glossaries_sync.py new file mode 100644 index 00000000..4e3dfa7b --- /dev/null +++ b/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/samples/generated_samples/translate_v3_generated_translation_service_translate_document_async.py b/samples/generated_samples/translate_v3_generated_translation_service_translate_document_async.py new file mode 100644 index 00000000..9c1902a8 --- /dev/null +++ b/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/samples/generated_samples/translate_v3_generated_translation_service_translate_document_sync.py b/samples/generated_samples/translate_v3_generated_translation_service_translate_document_sync.py new file mode 100644 index 00000000..f5a301d3 --- /dev/null +++ b/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/samples/generated_samples/translate_v3_generated_translation_service_translate_text_async.py b/samples/generated_samples/translate_v3_generated_translation_service_translate_text_async.py new file mode 100644 index 00000000..afe0e253 --- /dev/null +++ b/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/samples/generated_samples/translate_v3_generated_translation_service_translate_text_sync.py b/samples/generated_samples/translate_v3_generated_translation_service_translate_text_sync.py new file mode 100644 index 00000000..45fc51c5 --- /dev/null +++ b/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/samples/generated_samples/translate_v3beta1_generated_translation_service_batch_translate_document_async.py b/samples/generated_samples/translate_v3beta1_generated_translation_service_batch_translate_document_async.py new file mode 100644 index 00000000..b062bac5 --- /dev/null +++ b/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/samples/generated_samples/translate_v3beta1_generated_translation_service_batch_translate_document_sync.py b/samples/generated_samples/translate_v3beta1_generated_translation_service_batch_translate_document_sync.py new file mode 100644 index 00000000..0bc01520 --- /dev/null +++ b/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/samples/generated_samples/translate_v3beta1_generated_translation_service_batch_translate_text_async.py b/samples/generated_samples/translate_v3beta1_generated_translation_service_batch_translate_text_async.py new file mode 100644 index 00000000..fb29a3c8 --- /dev/null +++ b/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/samples/generated_samples/translate_v3beta1_generated_translation_service_batch_translate_text_sync.py b/samples/generated_samples/translate_v3beta1_generated_translation_service_batch_translate_text_sync.py new file mode 100644 index 00000000..abfb2f2f --- /dev/null +++ b/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/samples/generated_samples/translate_v3beta1_generated_translation_service_create_glossary_async.py b/samples/generated_samples/translate_v3beta1_generated_translation_service_create_glossary_async.py new file mode 100644 index 00000000..89493d7b --- /dev/null +++ b/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/samples/generated_samples/translate_v3beta1_generated_translation_service_create_glossary_sync.py b/samples/generated_samples/translate_v3beta1_generated_translation_service_create_glossary_sync.py new file mode 100644 index 00000000..5d77d679 --- /dev/null +++ b/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/samples/generated_samples/translate_v3beta1_generated_translation_service_delete_glossary_async.py b/samples/generated_samples/translate_v3beta1_generated_translation_service_delete_glossary_async.py new file mode 100644 index 00000000..29b4b058 --- /dev/null +++ b/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/samples/generated_samples/translate_v3beta1_generated_translation_service_delete_glossary_sync.py b/samples/generated_samples/translate_v3beta1_generated_translation_service_delete_glossary_sync.py new file mode 100644 index 00000000..5be48498 --- /dev/null +++ b/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/samples/generated_samples/translate_v3beta1_generated_translation_service_detect_language_async.py b/samples/generated_samples/translate_v3beta1_generated_translation_service_detect_language_async.py new file mode 100644 index 00000000..186db7fd --- /dev/null +++ b/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/samples/generated_samples/translate_v3beta1_generated_translation_service_detect_language_sync.py b/samples/generated_samples/translate_v3beta1_generated_translation_service_detect_language_sync.py new file mode 100644 index 00000000..20e973fc --- /dev/null +++ b/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/samples/generated_samples/translate_v3beta1_generated_translation_service_get_glossary_async.py b/samples/generated_samples/translate_v3beta1_generated_translation_service_get_glossary_async.py new file mode 100644 index 00000000..8622506f --- /dev/null +++ b/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/samples/generated_samples/translate_v3beta1_generated_translation_service_get_glossary_sync.py b/samples/generated_samples/translate_v3beta1_generated_translation_service_get_glossary_sync.py new file mode 100644 index 00000000..44146f48 --- /dev/null +++ b/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/samples/generated_samples/translate_v3beta1_generated_translation_service_get_supported_languages_async.py b/samples/generated_samples/translate_v3beta1_generated_translation_service_get_supported_languages_async.py new file mode 100644 index 00000000..db1d922d --- /dev/null +++ b/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/samples/generated_samples/translate_v3beta1_generated_translation_service_get_supported_languages_sync.py b/samples/generated_samples/translate_v3beta1_generated_translation_service_get_supported_languages_sync.py new file mode 100644 index 00000000..788bab5e --- /dev/null +++ b/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/samples/generated_samples/translate_v3beta1_generated_translation_service_list_glossaries_async.py b/samples/generated_samples/translate_v3beta1_generated_translation_service_list_glossaries_async.py new file mode 100644 index 00000000..db19a567 --- /dev/null +++ b/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/samples/generated_samples/translate_v3beta1_generated_translation_service_list_glossaries_sync.py b/samples/generated_samples/translate_v3beta1_generated_translation_service_list_glossaries_sync.py new file mode 100644 index 00000000..7d552502 --- /dev/null +++ b/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/samples/generated_samples/translate_v3beta1_generated_translation_service_translate_document_async.py b/samples/generated_samples/translate_v3beta1_generated_translation_service_translate_document_async.py new file mode 100644 index 00000000..4c96d229 --- /dev/null +++ b/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/samples/generated_samples/translate_v3beta1_generated_translation_service_translate_document_sync.py b/samples/generated_samples/translate_v3beta1_generated_translation_service_translate_document_sync.py new file mode 100644 index 00000000..2c1ff501 --- /dev/null +++ b/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/samples/generated_samples/translate_v3beta1_generated_translation_service_translate_text_async.py b/samples/generated_samples/translate_v3beta1_generated_translation_service_translate_text_async.py new file mode 100644 index 00000000..83b22d70 --- /dev/null +++ b/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/samples/generated_samples/translate_v3beta1_generated_translation_service_translate_text_sync.py b/samples/generated_samples/translate_v3beta1_generated_translation_service_translate_text_sync.py new file mode 100644 index 00000000..2d082aab --- /dev/null +++ b/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]