-
Notifications
You must be signed in to change notification settings - Fork 6.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* chore: use gapic-generator-python 0.63.2 docs: add generated snippets PiperOrigin-RevId: 427792504 Source-Link: googleapis/googleapis@55b9e1e Source-Link: googleapis/googleapis-gen@bf4e86b Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiYmY0ZTg2Yjc1M2Y0MmNiMGVkYjFmZDUxZmJlODQwZDdkYTBhMWNkZSJ9 * 🦉 Updates from OwlBot See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md * 🦉 Updates from OwlBot See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md * 🦉 Updates from OwlBot See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md * 🦉 Updates from OwlBot See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md * chore: use gapic-generator-python 0.63.4 chore: fix snippet region tag format chore: fix docstring code block formatting PiperOrigin-RevId: 430730865 Source-Link: googleapis/googleapis@ea58002 Source-Link: googleapis/googleapis-gen@ca893ff Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiY2E4OTNmZjhhZjI1ZmM3ZmUwMDFkZTE0MDVhNTE3ZDgwNDQ2ZWNjYSJ9 * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com> Co-authored-by: Bu Sun Kim <8822365+busunkim96@users.noreply.github.com>
- Loading branch information
Showing
82 changed files
with
5,780 additions
and
0 deletions.
There are no files selected for viewing
894 changes: 894 additions & 0 deletions
894
translation/samples/generated_samples/snippet_metadata_translate_v3.json
Large diffs are not rendered by default.
Oops, something went wrong.
894 changes: 894 additions & 0 deletions
894
translation/samples/generated_samples/snippet_metadata_translate_v3beta1.json
Large diffs are not rendered by default.
Oops, something went wrong.
59 changes: 59 additions & 0 deletions
59
...es/translate_generated_translate_v3_translation_service_batch_translate_document_async.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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] |
59 changes: 59 additions & 0 deletions
59
...les/translate_generated_translate_v3_translation_service_batch_translate_document_sync.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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] |
59 changes: 59 additions & 0 deletions
59
...amples/translate_generated_translate_v3_translation_service_batch_translate_text_async.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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] |
59 changes: 59 additions & 0 deletions
59
...samples/translate_generated_translate_v3_translation_service_batch_translate_text_sync.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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] |
53 changes: 53 additions & 0 deletions
53
...ted_samples/translate_generated_translate_v3_translation_service_create_glossary_async.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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] |
53 changes: 53 additions & 0 deletions
53
...ated_samples/translate_generated_translate_v3_translation_service_create_glossary_sync.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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] |
49 changes: 49 additions & 0 deletions
49
...ted_samples/translate_generated_translate_v3_translation_service_delete_glossary_async.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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] |
Oops, something went wrong.