Skip to content

Commit 981d420

Browse files
docs: add generated snippets (#273)
* 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 Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
1 parent 532ff31 commit 981d420

29 files changed

Lines changed: 1460 additions & 0 deletions

File tree

packages/google-cloud-videointelligence/google/cloud/videointelligence_v1/services/video_intelligence_service/async_client.py

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -222,6 +222,30 @@ async def annotate_video(
222222
``AnnotateVideoProgress`` (progress). ``Operation.response``
223223
contains ``AnnotateVideoResponse`` (results).
224224
225+
226+
.. code-block::
227+
228+
from google.cloud import videointelligence_v1
229+
230+
def sample_annotate_video():
231+
# Create a client
232+
client = videointelligence_v1.VideoIntelligenceServiceClient()
233+
234+
# Initialize request argument(s)
235+
request = videointelligence_v1.AnnotateVideoRequest(
236+
features="PERSON_DETECTION",
237+
)
238+
239+
# Make the request
240+
operation = client.annotate_video(request=request)
241+
242+
print("Waiting for operation to complete...")
243+
244+
response = operation.result()
245+
246+
# Handle the response
247+
print(response)
248+
225249
Args:
226250
request (Union[google.cloud.videointelligence_v1.types.AnnotateVideoRequest, dict]):
227251
The request object. Video annotation request.

packages/google-cloud-videointelligence/google/cloud/videointelligence_v1/services/video_intelligence_service/client.py

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -402,6 +402,31 @@ def annotate_video(
402402
``AnnotateVideoProgress`` (progress). ``Operation.response``
403403
contains ``AnnotateVideoResponse`` (results).
404404
405+
406+
407+
.. code-block::
408+
409+
from google.cloud import videointelligence_v1
410+
411+
def sample_annotate_video():
412+
# Create a client
413+
client = videointelligence_v1.VideoIntelligenceServiceClient()
414+
415+
# Initialize request argument(s)
416+
request = videointelligence_v1.AnnotateVideoRequest(
417+
features="PERSON_DETECTION",
418+
)
419+
420+
# Make the request
421+
operation = client.annotate_video(request=request)
422+
423+
print("Waiting for operation to complete...")
424+
425+
response = operation.result()
426+
427+
# Handle the response
428+
print(response)
429+
405430
Args:
406431
request (Union[google.cloud.videointelligence_v1.types.AnnotateVideoRequest, dict]):
407432
The request object. Video annotation request.

packages/google-cloud-videointelligence/google/cloud/videointelligence_v1beta2/services/video_intelligence_service/async_client.py

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -222,6 +222,30 @@ async def annotate_video(
222222
``AnnotateVideoProgress`` (progress). ``Operation.response``
223223
contains ``AnnotateVideoResponse`` (results).
224224
225+
226+
.. code-block::
227+
228+
from google.cloud import videointelligence_v1beta2
229+
230+
def sample_annotate_video():
231+
# Create a client
232+
client = videointelligence_v1beta2.VideoIntelligenceServiceClient()
233+
234+
# Initialize request argument(s)
235+
request = videointelligence_v1beta2.AnnotateVideoRequest(
236+
features="FACE_DETECTION",
237+
)
238+
239+
# Make the request
240+
operation = client.annotate_video(request=request)
241+
242+
print("Waiting for operation to complete...")
243+
244+
response = operation.result()
245+
246+
# Handle the response
247+
print(response)
248+
225249
Args:
226250
request (Union[google.cloud.videointelligence_v1beta2.types.AnnotateVideoRequest, dict]):
227251
The request object. Video annotation request.

packages/google-cloud-videointelligence/google/cloud/videointelligence_v1beta2/services/video_intelligence_service/client.py

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -402,6 +402,31 @@ def annotate_video(
402402
``AnnotateVideoProgress`` (progress). ``Operation.response``
403403
contains ``AnnotateVideoResponse`` (results).
404404
405+
406+
407+
.. code-block::
408+
409+
from google.cloud import videointelligence_v1beta2
410+
411+
def sample_annotate_video():
412+
# Create a client
413+
client = videointelligence_v1beta2.VideoIntelligenceServiceClient()
414+
415+
# Initialize request argument(s)
416+
request = videointelligence_v1beta2.AnnotateVideoRequest(
417+
features="FACE_DETECTION",
418+
)
419+
420+
# Make the request
421+
operation = client.annotate_video(request=request)
422+
423+
print("Waiting for operation to complete...")
424+
425+
response = operation.result()
426+
427+
# Handle the response
428+
print(response)
429+
405430
Args:
406431
request (Union[google.cloud.videointelligence_v1beta2.types.AnnotateVideoRequest, dict]):
407432
The request object. Video annotation request.

packages/google-cloud-videointelligence/google/cloud/videointelligence_v1p1beta1/services/video_intelligence_service/async_client.py

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -222,6 +222,30 @@ async def annotate_video(
222222
``AnnotateVideoProgress`` (progress). ``Operation.response``
223223
contains ``AnnotateVideoResponse`` (results).
224224
225+
226+
.. code-block::
227+
228+
from google.cloud import videointelligence_v1p1beta1
229+
230+
def sample_annotate_video():
231+
# Create a client
232+
client = videointelligence_v1p1beta1.VideoIntelligenceServiceClient()
233+
234+
# Initialize request argument(s)
235+
request = videointelligence_v1p1beta1.AnnotateVideoRequest(
236+
features="SPEECH_TRANSCRIPTION",
237+
)
238+
239+
# Make the request
240+
operation = client.annotate_video(request=request)
241+
242+
print("Waiting for operation to complete...")
243+
244+
response = operation.result()
245+
246+
# Handle the response
247+
print(response)
248+
225249
Args:
226250
request (Union[google.cloud.videointelligence_v1p1beta1.types.AnnotateVideoRequest, dict]):
227251
The request object. Video annotation request.

packages/google-cloud-videointelligence/google/cloud/videointelligence_v1p1beta1/services/video_intelligence_service/client.py

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -402,6 +402,31 @@ def annotate_video(
402402
``AnnotateVideoProgress`` (progress). ``Operation.response``
403403
contains ``AnnotateVideoResponse`` (results).
404404
405+
406+
407+
.. code-block::
408+
409+
from google.cloud import videointelligence_v1p1beta1
410+
411+
def sample_annotate_video():
412+
# Create a client
413+
client = videointelligence_v1p1beta1.VideoIntelligenceServiceClient()
414+
415+
# Initialize request argument(s)
416+
request = videointelligence_v1p1beta1.AnnotateVideoRequest(
417+
features="SPEECH_TRANSCRIPTION",
418+
)
419+
420+
# Make the request
421+
operation = client.annotate_video(request=request)
422+
423+
print("Waiting for operation to complete...")
424+
425+
response = operation.result()
426+
427+
# Handle the response
428+
print(response)
429+
405430
Args:
406431
request (Union[google.cloud.videointelligence_v1p1beta1.types.AnnotateVideoRequest, dict]):
407432
The request object. Video annotation request.

packages/google-cloud-videointelligence/google/cloud/videointelligence_v1p2beta1/services/video_intelligence_service/async_client.py

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -222,6 +222,30 @@ async def annotate_video(
222222
``AnnotateVideoProgress`` (progress). ``Operation.response``
223223
contains ``AnnotateVideoResponse`` (results).
224224
225+
226+
.. code-block::
227+
228+
from google.cloud import videointelligence_v1p2beta1
229+
230+
def sample_annotate_video():
231+
# Create a client
232+
client = videointelligence_v1p2beta1.VideoIntelligenceServiceClient()
233+
234+
# Initialize request argument(s)
235+
request = videointelligence_v1p2beta1.AnnotateVideoRequest(
236+
features="OBJECT_TRACKING",
237+
)
238+
239+
# Make the request
240+
operation = client.annotate_video(request=request)
241+
242+
print("Waiting for operation to complete...")
243+
244+
response = operation.result()
245+
246+
# Handle the response
247+
print(response)
248+
225249
Args:
226250
request (Union[google.cloud.videointelligence_v1p2beta1.types.AnnotateVideoRequest, dict]):
227251
The request object. Video annotation request.

packages/google-cloud-videointelligence/google/cloud/videointelligence_v1p2beta1/services/video_intelligence_service/client.py

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -402,6 +402,31 @@ def annotate_video(
402402
``AnnotateVideoProgress`` (progress). ``Operation.response``
403403
contains ``AnnotateVideoResponse`` (results).
404404
405+
406+
407+
.. code-block::
408+
409+
from google.cloud import videointelligence_v1p2beta1
410+
411+
def sample_annotate_video():
412+
# Create a client
413+
client = videointelligence_v1p2beta1.VideoIntelligenceServiceClient()
414+
415+
# Initialize request argument(s)
416+
request = videointelligence_v1p2beta1.AnnotateVideoRequest(
417+
features="OBJECT_TRACKING",
418+
)
419+
420+
# Make the request
421+
operation = client.annotate_video(request=request)
422+
423+
print("Waiting for operation to complete...")
424+
425+
response = operation.result()
426+
427+
# Handle the response
428+
print(response)
429+
405430
Args:
406431
request (Union[google.cloud.videointelligence_v1p2beta1.types.AnnotateVideoRequest, dict]):
407432
The request object. Video annotation request.

packages/google-cloud-videointelligence/google/cloud/videointelligence_v1p3beta1/services/streaming_video_intelligence_service/async_client.py

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -241,6 +241,36 @@ def streaming_annotate_video(
241241
bytes. This method is only available via the gRPC API
242242
(not REST).
243243
244+
245+
.. code-block::
246+
247+
from google.cloud import videointelligence_v1p3beta1
248+
249+
def sample_streaming_annotate_video():
250+
# Create a client
251+
client = videointelligence_v1p3beta1.StreamingVideoIntelligenceServiceClient()
252+
253+
# Initialize request argument(s)
254+
request = videointelligence_v1p3beta1.StreamingAnnotateVideoRequest(
255+
)
256+
257+
# This method expects an iterator which contains
258+
# 'videointelligence_v1p3beta1.StreamingAnnotateVideoRequest' objects
259+
# Here we create a generator that yields a single `request` for
260+
# demonstrative purposes.
261+
requests = [request]
262+
263+
def request_generator():
264+
for request in requests:
265+
yield request
266+
267+
# Make the request
268+
stream = client.streaming_annotate_video(requests=request_generator())
269+
270+
# Handle the response
271+
for response in stream:
272+
print(response)
273+
244274
Args:
245275
requests (AsyncIterator[`google.cloud.videointelligence_v1p3beta1.types.StreamingAnnotateVideoRequest`]):
246276
The request object AsyncIterator. The top-level message sent by the

packages/google-cloud-videointelligence/google/cloud/videointelligence_v1p3beta1/services/streaming_video_intelligence_service/client.py

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -407,6 +407,37 @@ def streaming_annotate_video(
407407
bytes. This method is only available via the gRPC API
408408
(not REST).
409409
410+
411+
412+
.. code-block::
413+
414+
from google.cloud import videointelligence_v1p3beta1
415+
416+
def sample_streaming_annotate_video():
417+
# Create a client
418+
client = videointelligence_v1p3beta1.StreamingVideoIntelligenceServiceClient()
419+
420+
# Initialize request argument(s)
421+
request = videointelligence_v1p3beta1.StreamingAnnotateVideoRequest(
422+
)
423+
424+
# This method expects an iterator which contains
425+
# 'videointelligence_v1p3beta1.StreamingAnnotateVideoRequest' objects
426+
# Here we create a generator that yields a single `request` for
427+
# demonstrative purposes.
428+
requests = [request]
429+
430+
def request_generator():
431+
for request in requests:
432+
yield request
433+
434+
# Make the request
435+
stream = client.streaming_annotate_video(requests=request_generator())
436+
437+
# Handle the response
438+
for response in stream:
439+
print(response)
440+
410441
Args:
411442
requests (Iterator[google.cloud.videointelligence_v1p3beta1.types.StreamingAnnotateVideoRequest]):
412443
The request object iterator. The top-level message sent by the

0 commit comments

Comments
 (0)