diff --git a/.repo-metadata.json b/.repo-metadata.json index 58ab0eba..acc1eb81 100644 --- a/.repo-metadata.json +++ b/.repo-metadata.json @@ -1,5 +1,5 @@ { - "name": "translation", + "name": "translate", "name_pretty": "Cloud Translation", "product_documentation": "https://cloud.google.com/translate/docs/", "client_documentation": "https://cloud.google.com/python/docs/reference/translation/latest", diff --git a/CHANGELOG.md b/CHANGELOG.md index 887411b2..eee0695d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,13 @@ [1]: https://pypi.org/project/google-cloud-translate/#history +### [3.7.1](https://github.com/googleapis/python-translate/compare/v3.7.0...v3.7.1) (2022-02-26) + + +### Documentation + +* add generated snippets ([#336](https://github.com/googleapis/python-translate/issues/336)) ([36c4483](https://github.com/googleapis/python-translate/commit/36c4483e9fac4933fc024fcae24ae8fbbdb470a0)) + ## [3.7.0](https://github.com/googleapis/python-translate/compare/v3.6.1...v3.7.0) (2022-02-03) diff --git a/google/cloud/translate/__init__.py b/google/cloud/translate/__init__.py index 4e2bdb63..3d7f3154 100644 --- a/google/cloud/translate/__init__.py +++ b/google/cloud/translate/__init__.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2020 Google LLC +# Copyright 2022 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/translate_v3/__init__.py b/google/cloud/translate_v3/__init__.py index 0bd85463..e542fe05 100644 --- a/google/cloud/translate_v3/__init__.py +++ b/google/cloud/translate_v3/__init__.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2020 Google LLC +# Copyright 2022 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/translate_v3/services/__init__.py b/google/cloud/translate_v3/services/__init__.py index 4de65971..e8e1c384 100644 --- a/google/cloud/translate_v3/services/__init__.py +++ b/google/cloud/translate_v3/services/__init__.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2020 Google LLC +# Copyright 2022 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/translate_v3/services/translation_service/__init__.py b/google/cloud/translate_v3/services/translation_service/__init__.py index 6d42bf0e..7fa9efeb 100644 --- a/google/cloud/translate_v3/services/translation_service/__init__.py +++ b/google/cloud/translate_v3/services/translation_service/__init__.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2020 Google LLC +# Copyright 2022 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. 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..ef7e26e5 100644 --- a/google/cloud/translate_v3/services/translation_service/async_client.py +++ b/google/cloud/translate_v3/services/translation_service/async_client.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2020 Google LLC +# Copyright 2022 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -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..76aeee39 100644 --- a/google/cloud/translate_v3/services/translation_service/client.py +++ b/google/cloud/translate_v3/services/translation_service/client.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2020 Google LLC +# Copyright 2022 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -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_v3/services/translation_service/pagers.py b/google/cloud/translate_v3/services/translation_service/pagers.py index 08e0dfe7..acfb02c7 100644 --- a/google/cloud/translate_v3/services/translation_service/pagers.py +++ b/google/cloud/translate_v3/services/translation_service/pagers.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2020 Google LLC +# Copyright 2022 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/translate_v3/services/translation_service/transports/__init__.py b/google/cloud/translate_v3/services/translation_service/transports/__init__.py index 11cb0a7d..32fa3072 100644 --- a/google/cloud/translate_v3/services/translation_service/transports/__init__.py +++ b/google/cloud/translate_v3/services/translation_service/transports/__init__.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2020 Google LLC +# Copyright 2022 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/translate_v3/services/translation_service/transports/base.py b/google/cloud/translate_v3/services/translation_service/transports/base.py index 2ab577dc..fe187985 100644 --- a/google/cloud/translate_v3/services/translation_service/transports/base.py +++ b/google/cloud/translate_v3/services/translation_service/transports/base.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2020 Google LLC +# Copyright 2022 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/translate_v3/services/translation_service/transports/grpc.py b/google/cloud/translate_v3/services/translation_service/transports/grpc.py index 9beb6d58..2e278381 100644 --- a/google/cloud/translate_v3/services/translation_service/transports/grpc.py +++ b/google/cloud/translate_v3/services/translation_service/transports/grpc.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2020 Google LLC +# Copyright 2022 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/translate_v3/services/translation_service/transports/grpc_asyncio.py b/google/cloud/translate_v3/services/translation_service/transports/grpc_asyncio.py index c875f91f..ad354cf6 100644 --- a/google/cloud/translate_v3/services/translation_service/transports/grpc_asyncio.py +++ b/google/cloud/translate_v3/services/translation_service/transports/grpc_asyncio.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2020 Google LLC +# Copyright 2022 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/translate_v3/types/__init__.py b/google/cloud/translate_v3/types/__init__.py index 38820580..ca265522 100644 --- a/google/cloud/translate_v3/types/__init__.py +++ b/google/cloud/translate_v3/types/__init__.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2020 Google LLC +# Copyright 2022 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/translate_v3/types/translation_service.py b/google/cloud/translate_v3/types/translation_service.py index 8e52d14a..fc4fcf5a 100644 --- a/google/cloud/translate_v3/types/translation_service.py +++ b/google/cloud/translate_v3/types/translation_service.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2020 Google LLC +# Copyright 2022 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/translate_v3beta1/__init__.py b/google/cloud/translate_v3beta1/__init__.py index 0bd85463..e542fe05 100644 --- a/google/cloud/translate_v3beta1/__init__.py +++ b/google/cloud/translate_v3beta1/__init__.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2020 Google LLC +# Copyright 2022 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/translate_v3beta1/services/__init__.py b/google/cloud/translate_v3beta1/services/__init__.py index 4de65971..e8e1c384 100644 --- a/google/cloud/translate_v3beta1/services/__init__.py +++ b/google/cloud/translate_v3beta1/services/__init__.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2020 Google LLC +# Copyright 2022 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/translate_v3beta1/services/translation_service/__init__.py b/google/cloud/translate_v3beta1/services/translation_service/__init__.py index 6d42bf0e..7fa9efeb 100644 --- a/google/cloud/translate_v3beta1/services/translation_service/__init__.py +++ b/google/cloud/translate_v3beta1/services/translation_service/__init__.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2020 Google LLC +# Copyright 2022 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. 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..328bd486 100644 --- a/google/cloud/translate_v3beta1/services/translation_service/async_client.py +++ b/google/cloud/translate_v3beta1/services/translation_service/async_client.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2020 Google LLC +# Copyright 2022 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -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..7c3124c4 100644 --- a/google/cloud/translate_v3beta1/services/translation_service/client.py +++ b/google/cloud/translate_v3beta1/services/translation_service/client.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2020 Google LLC +# Copyright 2022 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -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/google/cloud/translate_v3beta1/services/translation_service/pagers.py b/google/cloud/translate_v3beta1/services/translation_service/pagers.py index 812c4152..e32a937a 100644 --- a/google/cloud/translate_v3beta1/services/translation_service/pagers.py +++ b/google/cloud/translate_v3beta1/services/translation_service/pagers.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2020 Google LLC +# Copyright 2022 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/translate_v3beta1/services/translation_service/transports/__init__.py b/google/cloud/translate_v3beta1/services/translation_service/transports/__init__.py index 11cb0a7d..32fa3072 100644 --- a/google/cloud/translate_v3beta1/services/translation_service/transports/__init__.py +++ b/google/cloud/translate_v3beta1/services/translation_service/transports/__init__.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2020 Google LLC +# Copyright 2022 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/translate_v3beta1/services/translation_service/transports/base.py b/google/cloud/translate_v3beta1/services/translation_service/transports/base.py index 214105b0..2b22a574 100644 --- a/google/cloud/translate_v3beta1/services/translation_service/transports/base.py +++ b/google/cloud/translate_v3beta1/services/translation_service/transports/base.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2020 Google LLC +# Copyright 2022 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/translate_v3beta1/services/translation_service/transports/grpc.py b/google/cloud/translate_v3beta1/services/translation_service/transports/grpc.py index d11df630..f138fb82 100644 --- a/google/cloud/translate_v3beta1/services/translation_service/transports/grpc.py +++ b/google/cloud/translate_v3beta1/services/translation_service/transports/grpc.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2020 Google LLC +# Copyright 2022 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/translate_v3beta1/services/translation_service/transports/grpc_asyncio.py b/google/cloud/translate_v3beta1/services/translation_service/transports/grpc_asyncio.py index 3aec3e8b..cbec7772 100644 --- a/google/cloud/translate_v3beta1/services/translation_service/transports/grpc_asyncio.py +++ b/google/cloud/translate_v3beta1/services/translation_service/transports/grpc_asyncio.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2020 Google LLC +# Copyright 2022 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/translate_v3beta1/types/__init__.py b/google/cloud/translate_v3beta1/types/__init__.py index 38820580..ca265522 100644 --- a/google/cloud/translate_v3beta1/types/__init__.py +++ b/google/cloud/translate_v3beta1/types/__init__.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2020 Google LLC +# Copyright 2022 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/translate_v3beta1/types/translation_service.py b/google/cloud/translate_v3beta1/types/translation_service.py index ac51e013..ad78b95e 100644 --- a/google/cloud/translate_v3beta1/types/translation_service.py +++ b/google/cloud/translate_v3beta1/types/translation_service.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2020 Google LLC +# Copyright 2022 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/noxfile.py b/noxfile.py index de41c6bf..2a2001c4 100644 --- a/noxfile.py +++ b/noxfile.py @@ -175,7 +175,7 @@ def cover(session): test runs (not system test runs), and then erases coverage data. """ session.install("coverage", "pytest-cov") - session.run("coverage", "report", "--show-missing", "--fail-under=99") + session.run("coverage", "report", "--show-missing", "--fail-under=100") session.run("coverage", "erase") diff --git a/owlbot.py b/owlbot.py index 5114aaf7..d3ef7ea0 100644 --- a/owlbot.py +++ b/owlbot.py @@ -41,26 +41,22 @@ "translation.py", ] + s.replace(library / ".coveragerc", + """google/cloud/translate/__init__.py""", + """google/__init__.py + google/cloud/__init__.py + google/cloud/translate/__init__.py""", + ) s.move(library, excludes=excludes) s.remove_staging_dirs() -s.replace(".coveragerc", - """omit = - google/cloud/translate/__init__.py""", - """omit = - google/__init__.py - google/cloud/__init__.py - google/cloud/translate/__init__.py""", -) - # ---------------------------------------------------------------------------- # Add templated files # ---------------------------------------------------------------------------- templated_files = common.py_library( samples=True, microgenerator=True, - cov_level=99, ) s.move(templated_files, excludes=[".coveragerc"]) # microgenerator has a good .coveragerc file 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..9c2370f1 --- /dev/null +++ b/samples/generated_samples/translate_v3_generated_translation_service_batch_translate_document_async.py @@ -0,0 +1,59 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 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..71148ff6 --- /dev/null +++ b/samples/generated_samples/translate_v3_generated_translation_service_batch_translate_document_sync.py @@ -0,0 +1,59 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 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..031a248d --- /dev/null +++ b/samples/generated_samples/translate_v3_generated_translation_service_batch_translate_text_async.py @@ -0,0 +1,59 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 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..b761dcc1 --- /dev/null +++ b/samples/generated_samples/translate_v3_generated_translation_service_batch_translate_text_sync.py @@ -0,0 +1,59 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 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..aa0f4757 --- /dev/null +++ b/samples/generated_samples/translate_v3_generated_translation_service_create_glossary_async.py @@ -0,0 +1,53 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 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..1112c5dc --- /dev/null +++ b/samples/generated_samples/translate_v3_generated_translation_service_create_glossary_sync.py @@ -0,0 +1,53 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 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..abc94843 --- /dev/null +++ b/samples/generated_samples/translate_v3_generated_translation_service_delete_glossary_async.py @@ -0,0 +1,49 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 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..7d6a8c6f --- /dev/null +++ b/samples/generated_samples/translate_v3_generated_translation_service_delete_glossary_sync.py @@ -0,0 +1,49 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 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..cd36e299 --- /dev/null +++ b/samples/generated_samples/translate_v3_generated_translation_service_detect_language_async.py @@ -0,0 +1,46 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 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..f1181fdb --- /dev/null +++ b/samples/generated_samples/translate_v3_generated_translation_service_detect_language_sync.py @@ -0,0 +1,46 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 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..9f2181ab --- /dev/null +++ b/samples/generated_samples/translate_v3_generated_translation_service_get_glossary_async.py @@ -0,0 +1,45 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 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..95279e14 --- /dev/null +++ b/samples/generated_samples/translate_v3_generated_translation_service_get_glossary_sync.py @@ -0,0 +1,45 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 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..8b00aba3 --- /dev/null +++ b/samples/generated_samples/translate_v3_generated_translation_service_get_supported_languages_async.py @@ -0,0 +1,45 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 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..e9c5d2ae --- /dev/null +++ b/samples/generated_samples/translate_v3_generated_translation_service_get_supported_languages_sync.py @@ -0,0 +1,45 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 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..828220d5 --- /dev/null +++ b/samples/generated_samples/translate_v3_generated_translation_service_list_glossaries_async.py @@ -0,0 +1,46 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 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..3e312463 --- /dev/null +++ b/samples/generated_samples/translate_v3_generated_translation_service_list_glossaries_sync.py @@ -0,0 +1,46 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 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..5b14a9f0 --- /dev/null +++ b/samples/generated_samples/translate_v3_generated_translation_service_translate_document_async.py @@ -0,0 +1,50 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 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..850c6bd2 --- /dev/null +++ b/samples/generated_samples/translate_v3_generated_translation_service_translate_document_sync.py @@ -0,0 +1,50 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 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..4f5332d1 --- /dev/null +++ b/samples/generated_samples/translate_v3_generated_translation_service_translate_text_async.py @@ -0,0 +1,47 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 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..7d3b71e7 --- /dev/null +++ b/samples/generated_samples/translate_v3_generated_translation_service_translate_text_sync.py @@ -0,0 +1,47 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 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..f7c9db2c --- /dev/null +++ b/samples/generated_samples/translate_v3beta1_generated_translation_service_batch_translate_document_async.py @@ -0,0 +1,59 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 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..13002abb --- /dev/null +++ b/samples/generated_samples/translate_v3beta1_generated_translation_service_batch_translate_document_sync.py @@ -0,0 +1,59 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 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..b8420e65 --- /dev/null +++ b/samples/generated_samples/translate_v3beta1_generated_translation_service_batch_translate_text_async.py @@ -0,0 +1,59 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 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..c9a05c3f --- /dev/null +++ b/samples/generated_samples/translate_v3beta1_generated_translation_service_batch_translate_text_sync.py @@ -0,0 +1,59 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 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..bd7ccfbc --- /dev/null +++ b/samples/generated_samples/translate_v3beta1_generated_translation_service_create_glossary_async.py @@ -0,0 +1,53 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 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..0482c4a3 --- /dev/null +++ b/samples/generated_samples/translate_v3beta1_generated_translation_service_create_glossary_sync.py @@ -0,0 +1,53 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 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..37e6cbd4 --- /dev/null +++ b/samples/generated_samples/translate_v3beta1_generated_translation_service_delete_glossary_async.py @@ -0,0 +1,49 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 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..85c5d1a7 --- /dev/null +++ b/samples/generated_samples/translate_v3beta1_generated_translation_service_delete_glossary_sync.py @@ -0,0 +1,49 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 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..60b84ae7 --- /dev/null +++ b/samples/generated_samples/translate_v3beta1_generated_translation_service_detect_language_async.py @@ -0,0 +1,46 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 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..41b613ab --- /dev/null +++ b/samples/generated_samples/translate_v3beta1_generated_translation_service_detect_language_sync.py @@ -0,0 +1,46 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 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..ca21ec9b --- /dev/null +++ b/samples/generated_samples/translate_v3beta1_generated_translation_service_get_glossary_async.py @@ -0,0 +1,45 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 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..05b6150a --- /dev/null +++ b/samples/generated_samples/translate_v3beta1_generated_translation_service_get_glossary_sync.py @@ -0,0 +1,45 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 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..ad778d7e --- /dev/null +++ b/samples/generated_samples/translate_v3beta1_generated_translation_service_get_supported_languages_async.py @@ -0,0 +1,45 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 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..e876c505 --- /dev/null +++ b/samples/generated_samples/translate_v3beta1_generated_translation_service_get_supported_languages_sync.py @@ -0,0 +1,45 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 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..3861889f --- /dev/null +++ b/samples/generated_samples/translate_v3beta1_generated_translation_service_list_glossaries_async.py @@ -0,0 +1,46 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 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..45a9bbf3 --- /dev/null +++ b/samples/generated_samples/translate_v3beta1_generated_translation_service_list_glossaries_sync.py @@ -0,0 +1,46 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 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..48d36f87 --- /dev/null +++ b/samples/generated_samples/translate_v3beta1_generated_translation_service_translate_document_async.py @@ -0,0 +1,50 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 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..17e11f0a --- /dev/null +++ b/samples/generated_samples/translate_v3beta1_generated_translation_service_translate_document_sync.py @@ -0,0 +1,50 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 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..13b945fc --- /dev/null +++ b/samples/generated_samples/translate_v3beta1_generated_translation_service_translate_text_async.py @@ -0,0 +1,47 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 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..ce4a042a --- /dev/null +++ b/samples/generated_samples/translate_v3beta1_generated_translation_service_translate_text_sync.py @@ -0,0 +1,47 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 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] diff --git a/samples/snippets/hybrid_glossaries/requirements-test.txt b/samples/snippets/hybrid_glossaries/requirements-test.txt index 92709451..c2845bff 100644 --- a/samples/snippets/hybrid_glossaries/requirements-test.txt +++ b/samples/snippets/hybrid_glossaries/requirements-test.txt @@ -1 +1 @@ -pytest==6.2.5 +pytest==7.0.1 diff --git a/samples/snippets/hybrid_glossaries/requirements.txt b/samples/snippets/hybrid_glossaries/requirements.txt index c6718477..a03674b3 100644 --- a/samples/snippets/hybrid_glossaries/requirements.txt +++ b/samples/snippets/hybrid_glossaries/requirements.txt @@ -1,3 +1,3 @@ -google-cloud-translate==3.6.1 +google-cloud-translate==3.7.0 google-cloud-vision==2.6.3 google-cloud-texttospeech==2.10.0 diff --git a/samples/snippets/requirements-test.txt b/samples/snippets/requirements-test.txt index 23bba2f0..c4bb1f1c 100644 --- a/samples/snippets/requirements-test.txt +++ b/samples/snippets/requirements-test.txt @@ -1,3 +1,3 @@ backoff==1.11.1 flaky==3.7.0 -pytest==6.2.5 +pytest==7.0.1 diff --git a/samples/snippets/requirements.txt b/samples/snippets/requirements.txt index 8c51bb99..4e66f260 100644 --- a/samples/snippets/requirements.txt +++ b/samples/snippets/requirements.txt @@ -1,3 +1,3 @@ -google-cloud-translate==3.6.1 +google-cloud-translate==3.7.0 google-cloud-storage==2.1.0 -google-cloud-automl==2.6.0 +google-cloud-automl==2.7.0 diff --git a/scripts/fixup_translate_v3_keywords.py b/scripts/fixup_translate_v3_keywords.py index f05cb305..8045640a 100644 --- a/scripts/fixup_translate_v3_keywords.py +++ b/scripts/fixup_translate_v3_keywords.py @@ -1,6 +1,6 @@ #! /usr/bin/env python3 # -*- coding: utf-8 -*- -# Copyright 2020 Google LLC +# Copyright 2022 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/scripts/fixup_translate_v3beta1_keywords.py b/scripts/fixup_translate_v3beta1_keywords.py index f05cb305..8045640a 100644 --- a/scripts/fixup_translate_v3beta1_keywords.py +++ b/scripts/fixup_translate_v3beta1_keywords.py @@ -1,6 +1,6 @@ #! /usr/bin/env python3 # -*- coding: utf-8 -*- -# Copyright 2020 Google LLC +# Copyright 2022 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/setup.py b/setup.py index 3c1e1432..88767b3e 100644 --- a/setup.py +++ b/setup.py @@ -22,7 +22,7 @@ name = "google-cloud-translate" description = "Google Cloud Translation API client library" -version = "3.7.0" +version = "3.7.1" # Should be one of: # 'Development Status :: 3 - Alpha' # 'Development Status :: 4 - Beta' diff --git a/tests/__init__.py b/tests/__init__.py index 4de65971..e8e1c384 100644 --- a/tests/__init__.py +++ b/tests/__init__.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2020 Google LLC +# Copyright 2022 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/tests/unit/__init__.py b/tests/unit/__init__.py index 4de65971..e8e1c384 100644 --- a/tests/unit/__init__.py +++ b/tests/unit/__init__.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2020 Google LLC +# Copyright 2022 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/tests/unit/gapic/__init__.py b/tests/unit/gapic/__init__.py index 4de65971..e8e1c384 100644 --- a/tests/unit/gapic/__init__.py +++ b/tests/unit/gapic/__init__.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2020 Google LLC +# Copyright 2022 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/tests/unit/gapic/translate_v3/__init__.py b/tests/unit/gapic/translate_v3/__init__.py index 4de65971..e8e1c384 100644 --- a/tests/unit/gapic/translate_v3/__init__.py +++ b/tests/unit/gapic/translate_v3/__init__.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2020 Google LLC +# Copyright 2022 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/tests/unit/gapic/translate_v3/test_translation_service.py b/tests/unit/gapic/translate_v3/test_translation_service.py index b82ff411..ddd53ba5 100644 --- a/tests/unit/gapic/translate_v3/test_translation_service.py +++ b/tests/unit/gapic/translate_v3/test_translation_service.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2020 Google LLC +# Copyright 2022 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/tests/unit/gapic/translate_v3beta1/__init__.py b/tests/unit/gapic/translate_v3beta1/__init__.py index 4de65971..e8e1c384 100644 --- a/tests/unit/gapic/translate_v3beta1/__init__.py +++ b/tests/unit/gapic/translate_v3beta1/__init__.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2020 Google LLC +# Copyright 2022 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/tests/unit/gapic/translate_v3beta1/test_translation_service.py b/tests/unit/gapic/translate_v3beta1/test_translation_service.py index ec260dcd..b81843ad 100644 --- a/tests/unit/gapic/translate_v3beta1/test_translation_service.py +++ b/tests/unit/gapic/translate_v3beta1/test_translation_service.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2020 Google LLC +# Copyright 2022 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License.