Skip to content

Commit 529dc70

Browse files
gcf-owl-bot[bot]busunkim96
authored andcommitted
docs: add generated snippets (#336)
* 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 <[email protected]>
1 parent c8f1a63 commit 529dc70

File tree

82 files changed

+5780
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

82 files changed

+5780
-0
lines changed

translation/samples/generated_samples/snippet_metadata_translate_v3.json

Lines changed: 894 additions & 0 deletions
Large diffs are not rendered by default.

translation/samples/generated_samples/snippet_metadata_translate_v3beta1.json

Lines changed: 894 additions & 0 deletions
Large diffs are not rendered by default.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
# -*- coding: utf-8 -*-
2+
# Copyright 2020 Google LLC
3+
#
4+
# Licensed under the Apache License, Version 2.0 (the "License");
5+
# you may not use this file except in compliance with the License.
6+
# You may obtain a copy of the License at
7+
#
8+
# http://www.apache.org/licenses/LICENSE-2.0
9+
#
10+
# Unless required by applicable law or agreed to in writing, software
11+
# distributed under the License is distributed on an "AS IS" BASIS,
12+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
# See the License for the specific language governing permissions and
14+
# limitations under the License.
15+
#
16+
# Generated code. DO NOT EDIT!
17+
#
18+
# Snippet for BatchTranslateDocument
19+
# NOTE: This snippet has been automatically generated for illustrative purposes only.
20+
# It may require modifications to work in your environment.
21+
22+
# To install the latest published package dependency, execute the following:
23+
# python3 -m pip install google-cloud-translate
24+
25+
26+
# [START translate_generated_translate_v3_TranslationService_BatchTranslateDocument_async]
27+
from google.cloud import translate_v3
28+
29+
30+
async def sample_batch_translate_document():
31+
# Create a client
32+
client = translate_v3.TranslationServiceAsyncClient()
33+
34+
# Initialize request argument(s)
35+
input_configs = translate_v3.BatchDocumentInputConfig()
36+
input_configs.gcs_source.input_uri = "input_uri_value"
37+
38+
output_config = translate_v3.BatchDocumentOutputConfig()
39+
output_config.gcs_destination.output_uri_prefix = "output_uri_prefix_value"
40+
41+
request = translate_v3.BatchTranslateDocumentRequest(
42+
parent="parent_value",
43+
source_language_code="source_language_code_value",
44+
target_language_codes=['target_language_codes_value_1', 'target_language_codes_value_2'],
45+
input_configs=input_configs,
46+
output_config=output_config,
47+
)
48+
49+
# Make the request
50+
operation = client.batch_translate_document(request=request)
51+
52+
print("Waiting for operation to complete...")
53+
54+
response = await operation.result()
55+
56+
# Handle the response
57+
print(response)
58+
59+
# [END translate_generated_translate_v3_TranslationService_BatchTranslateDocument_async]
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
# -*- coding: utf-8 -*-
2+
# Copyright 2020 Google LLC
3+
#
4+
# Licensed under the Apache License, Version 2.0 (the "License");
5+
# you may not use this file except in compliance with the License.
6+
# You may obtain a copy of the License at
7+
#
8+
# http://www.apache.org/licenses/LICENSE-2.0
9+
#
10+
# Unless required by applicable law or agreed to in writing, software
11+
# distributed under the License is distributed on an "AS IS" BASIS,
12+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
# See the License for the specific language governing permissions and
14+
# limitations under the License.
15+
#
16+
# Generated code. DO NOT EDIT!
17+
#
18+
# Snippet for BatchTranslateDocument
19+
# NOTE: This snippet has been automatically generated for illustrative purposes only.
20+
# It may require modifications to work in your environment.
21+
22+
# To install the latest published package dependency, execute the following:
23+
# python3 -m pip install google-cloud-translate
24+
25+
26+
# [START translate_generated_translate_v3_TranslationService_BatchTranslateDocument_sync]
27+
from google.cloud import translate_v3
28+
29+
30+
def sample_batch_translate_document():
31+
# Create a client
32+
client = translate_v3.TranslationServiceClient()
33+
34+
# Initialize request argument(s)
35+
input_configs = translate_v3.BatchDocumentInputConfig()
36+
input_configs.gcs_source.input_uri = "input_uri_value"
37+
38+
output_config = translate_v3.BatchDocumentOutputConfig()
39+
output_config.gcs_destination.output_uri_prefix = "output_uri_prefix_value"
40+
41+
request = translate_v3.BatchTranslateDocumentRequest(
42+
parent="parent_value",
43+
source_language_code="source_language_code_value",
44+
target_language_codes=['target_language_codes_value_1', 'target_language_codes_value_2'],
45+
input_configs=input_configs,
46+
output_config=output_config,
47+
)
48+
49+
# Make the request
50+
operation = client.batch_translate_document(request=request)
51+
52+
print("Waiting for operation to complete...")
53+
54+
response = operation.result()
55+
56+
# Handle the response
57+
print(response)
58+
59+
# [END translate_generated_translate_v3_TranslationService_BatchTranslateDocument_sync]
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
# -*- coding: utf-8 -*-
2+
# Copyright 2020 Google LLC
3+
#
4+
# Licensed under the Apache License, Version 2.0 (the "License");
5+
# you may not use this file except in compliance with the License.
6+
# You may obtain a copy of the License at
7+
#
8+
# http://www.apache.org/licenses/LICENSE-2.0
9+
#
10+
# Unless required by applicable law or agreed to in writing, software
11+
# distributed under the License is distributed on an "AS IS" BASIS,
12+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
# See the License for the specific language governing permissions and
14+
# limitations under the License.
15+
#
16+
# Generated code. DO NOT EDIT!
17+
#
18+
# Snippet for BatchTranslateText
19+
# NOTE: This snippet has been automatically generated for illustrative purposes only.
20+
# It may require modifications to work in your environment.
21+
22+
# To install the latest published package dependency, execute the following:
23+
# python3 -m pip install google-cloud-translate
24+
25+
26+
# [START translate_generated_translate_v3_TranslationService_BatchTranslateText_async]
27+
from google.cloud import translate_v3
28+
29+
30+
async def sample_batch_translate_text():
31+
# Create a client
32+
client = translate_v3.TranslationServiceAsyncClient()
33+
34+
# Initialize request argument(s)
35+
input_configs = translate_v3.InputConfig()
36+
input_configs.gcs_source.input_uri = "input_uri_value"
37+
38+
output_config = translate_v3.OutputConfig()
39+
output_config.gcs_destination.output_uri_prefix = "output_uri_prefix_value"
40+
41+
request = translate_v3.BatchTranslateTextRequest(
42+
parent="parent_value",
43+
source_language_code="source_language_code_value",
44+
target_language_codes=['target_language_codes_value_1', 'target_language_codes_value_2'],
45+
input_configs=input_configs,
46+
output_config=output_config,
47+
)
48+
49+
# Make the request
50+
operation = client.batch_translate_text(request=request)
51+
52+
print("Waiting for operation to complete...")
53+
54+
response = await operation.result()
55+
56+
# Handle the response
57+
print(response)
58+
59+
# [END translate_generated_translate_v3_TranslationService_BatchTranslateText_async]
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
# -*- coding: utf-8 -*-
2+
# Copyright 2020 Google LLC
3+
#
4+
# Licensed under the Apache License, Version 2.0 (the "License");
5+
# you may not use this file except in compliance with the License.
6+
# You may obtain a copy of the License at
7+
#
8+
# http://www.apache.org/licenses/LICENSE-2.0
9+
#
10+
# Unless required by applicable law or agreed to in writing, software
11+
# distributed under the License is distributed on an "AS IS" BASIS,
12+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
# See the License for the specific language governing permissions and
14+
# limitations under the License.
15+
#
16+
# Generated code. DO NOT EDIT!
17+
#
18+
# Snippet for BatchTranslateText
19+
# NOTE: This snippet has been automatically generated for illustrative purposes only.
20+
# It may require modifications to work in your environment.
21+
22+
# To install the latest published package dependency, execute the following:
23+
# python3 -m pip install google-cloud-translate
24+
25+
26+
# [START translate_generated_translate_v3_TranslationService_BatchTranslateText_sync]
27+
from google.cloud import translate_v3
28+
29+
30+
def sample_batch_translate_text():
31+
# Create a client
32+
client = translate_v3.TranslationServiceClient()
33+
34+
# Initialize request argument(s)
35+
input_configs = translate_v3.InputConfig()
36+
input_configs.gcs_source.input_uri = "input_uri_value"
37+
38+
output_config = translate_v3.OutputConfig()
39+
output_config.gcs_destination.output_uri_prefix = "output_uri_prefix_value"
40+
41+
request = translate_v3.BatchTranslateTextRequest(
42+
parent="parent_value",
43+
source_language_code="source_language_code_value",
44+
target_language_codes=['target_language_codes_value_1', 'target_language_codes_value_2'],
45+
input_configs=input_configs,
46+
output_config=output_config,
47+
)
48+
49+
# Make the request
50+
operation = client.batch_translate_text(request=request)
51+
52+
print("Waiting for operation to complete...")
53+
54+
response = operation.result()
55+
56+
# Handle the response
57+
print(response)
58+
59+
# [END translate_generated_translate_v3_TranslationService_BatchTranslateText_sync]
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
# -*- coding: utf-8 -*-
2+
# Copyright 2020 Google LLC
3+
#
4+
# Licensed under the Apache License, Version 2.0 (the "License");
5+
# you may not use this file except in compliance with the License.
6+
# You may obtain a copy of the License at
7+
#
8+
# http://www.apache.org/licenses/LICENSE-2.0
9+
#
10+
# Unless required by applicable law or agreed to in writing, software
11+
# distributed under the License is distributed on an "AS IS" BASIS,
12+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
# See the License for the specific language governing permissions and
14+
# limitations under the License.
15+
#
16+
# Generated code. DO NOT EDIT!
17+
#
18+
# Snippet for CreateGlossary
19+
# NOTE: This snippet has been automatically generated for illustrative purposes only.
20+
# It may require modifications to work in your environment.
21+
22+
# To install the latest published package dependency, execute the following:
23+
# python3 -m pip install google-cloud-translate
24+
25+
26+
# [START translate_generated_translate_v3_TranslationService_CreateGlossary_async]
27+
from google.cloud import translate_v3
28+
29+
30+
async def sample_create_glossary():
31+
# Create a client
32+
client = translate_v3.TranslationServiceAsyncClient()
33+
34+
# Initialize request argument(s)
35+
glossary = translate_v3.Glossary()
36+
glossary.name = "name_value"
37+
38+
request = translate_v3.CreateGlossaryRequest(
39+
parent="parent_value",
40+
glossary=glossary,
41+
)
42+
43+
# Make the request
44+
operation = client.create_glossary(request=request)
45+
46+
print("Waiting for operation to complete...")
47+
48+
response = await operation.result()
49+
50+
# Handle the response
51+
print(response)
52+
53+
# [END translate_generated_translate_v3_TranslationService_CreateGlossary_async]
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
# -*- coding: utf-8 -*-
2+
# Copyright 2020 Google LLC
3+
#
4+
# Licensed under the Apache License, Version 2.0 (the "License");
5+
# you may not use this file except in compliance with the License.
6+
# You may obtain a copy of the License at
7+
#
8+
# http://www.apache.org/licenses/LICENSE-2.0
9+
#
10+
# Unless required by applicable law or agreed to in writing, software
11+
# distributed under the License is distributed on an "AS IS" BASIS,
12+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
# See the License for the specific language governing permissions and
14+
# limitations under the License.
15+
#
16+
# Generated code. DO NOT EDIT!
17+
#
18+
# Snippet for CreateGlossary
19+
# NOTE: This snippet has been automatically generated for illustrative purposes only.
20+
# It may require modifications to work in your environment.
21+
22+
# To install the latest published package dependency, execute the following:
23+
# python3 -m pip install google-cloud-translate
24+
25+
26+
# [START translate_generated_translate_v3_TranslationService_CreateGlossary_sync]
27+
from google.cloud import translate_v3
28+
29+
30+
def sample_create_glossary():
31+
# Create a client
32+
client = translate_v3.TranslationServiceClient()
33+
34+
# Initialize request argument(s)
35+
glossary = translate_v3.Glossary()
36+
glossary.name = "name_value"
37+
38+
request = translate_v3.CreateGlossaryRequest(
39+
parent="parent_value",
40+
glossary=glossary,
41+
)
42+
43+
# Make the request
44+
operation = client.create_glossary(request=request)
45+
46+
print("Waiting for operation to complete...")
47+
48+
response = operation.result()
49+
50+
# Handle the response
51+
print(response)
52+
53+
# [END translate_generated_translate_v3_TranslationService_CreateGlossary_sync]
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
# -*- coding: utf-8 -*-
2+
# Copyright 2020 Google LLC
3+
#
4+
# Licensed under the Apache License, Version 2.0 (the "License");
5+
# you may not use this file except in compliance with the License.
6+
# You may obtain a copy of the License at
7+
#
8+
# http://www.apache.org/licenses/LICENSE-2.0
9+
#
10+
# Unless required by applicable law or agreed to in writing, software
11+
# distributed under the License is distributed on an "AS IS" BASIS,
12+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
# See the License for the specific language governing permissions and
14+
# limitations under the License.
15+
#
16+
# Generated code. DO NOT EDIT!
17+
#
18+
# Snippet for DeleteGlossary
19+
# NOTE: This snippet has been automatically generated for illustrative purposes only.
20+
# It may require modifications to work in your environment.
21+
22+
# To install the latest published package dependency, execute the following:
23+
# python3 -m pip install google-cloud-translate
24+
25+
26+
# [START translate_generated_translate_v3_TranslationService_DeleteGlossary_async]
27+
from google.cloud import translate_v3
28+
29+
30+
async def sample_delete_glossary():
31+
# Create a client
32+
client = translate_v3.TranslationServiceAsyncClient()
33+
34+
# Initialize request argument(s)
35+
request = translate_v3.DeleteGlossaryRequest(
36+
name="name_value",
37+
)
38+
39+
# Make the request
40+
operation = client.delete_glossary(request=request)
41+
42+
print("Waiting for operation to complete...")
43+
44+
response = await operation.result()
45+
46+
# Handle the response
47+
print(response)
48+
49+
# [END translate_generated_translate_v3_TranslationService_DeleteGlossary_async]

0 commit comments

Comments
 (0)