Skip to content

Commit

Permalink
Videointelligence: Add v1p2beta1 to synth.py (#6004)
Browse files Browse the repository at this point in the history
  • Loading branch information
danoscarmike authored and tseaver committed Sep 18, 2018
1 parent 389a828 commit 07a29bf
Show file tree
Hide file tree
Showing 15 changed files with 2,530 additions and 7 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
Client for Cloud Video Intelligence API
=======================================

.. automodule:: google.cloud.videointelligence_v1p2beta1
:members:
:inherited-members:
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Types for Cloud Video Intelligence API Client
=============================================

.. automodule:: google.cloud.videointelligence_v1p2beta1.types
:members:
15 changes: 9 additions & 6 deletions packages/google-cloud-videointelligence/docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ API. By default, you will get ``v1``, the latest stable version.
gapic/v1/types

A new beta release with additional features over the current stable version,
spelled ``v1p1beta1``, is provided to allow you to use these new features.
spelled ``v1p2beta1``, is provided to allow you to use these new features.
These are expected to move into the stable release soon; until then, the
usual beta admonishment (changes are possible, etc.) applies.

Expand All @@ -103,19 +103,22 @@ An API and type reference is provided for this beta:
.. toctree::
:maxdepth: 2

gapic/v1p1beta1/api
gapic/v1p1beta1/types
gapic/v1p2beta1/api
gapic/v1p2beta1/types

The previous beta releases, spelled ``v1beta1`` and ``v1beta2``, are provided to
continue to support code previously written against them. In order to use this,
you will want to import from ``google.cloud.videointelligence_v1beta2`` in lieu of
The previous beta releases, spelled ``v1p1beta1``, ``v1beta1``, and
``v1beta2``, are provided to continue to support code previously written
against them. In order to use ththem, you will want to import from e.g.
``google.cloud.videointelligence_v1beta2`` in lieu of
``google.cloud.videointelligence_v1``.

An API and type reference is provided the these betas also:

.. toctree::
:maxdepth: 2

gapic/v1p1beta1/api
gapic/v1p1beta1/types
gapic/v1beta1/api
gapic/v1beta1/types
gapic/v1beta2/api
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# -*- coding: utf-8 -*-
#
# Copyright 2018 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
#
# https://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.

from __future__ import absolute_import

from google.cloud.videointelligence_v1p2beta1 import types
from google.cloud.videointelligence_v1p2beta1.gapic import enums
from google.cloud.videointelligence_v1p2beta1.gapic import video_intelligence_service_client


class VideoIntelligenceServiceClient(
video_intelligence_service_client.VideoIntelligenceServiceClient):
__doc__ = video_intelligence_service_client.VideoIntelligenceServiceClient.__doc__
enums = enums


__all__ = (
'enums',
'types',
'VideoIntelligenceServiceClient',
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
# -*- coding: utf-8 -*-
#
# Copyright 2018 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
#
# https://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.
"""Wrappers for protocol buffer enum types."""

import enum


class Feature(enum.IntEnum):
"""
Video annotation feature.
Attributes:
FEATURE_UNSPECIFIED (int): Unspecified.
LABEL_DETECTION (int): Label detection. Detect objects, such as dog or flower.
SHOT_CHANGE_DETECTION (int): Shot change detection.
EXPLICIT_CONTENT_DETECTION (int): Explicit content detection.
TEXT_DETECTION (int): OCR text detection and tracking.
OBJECT_TRACKING (int): Object detection and tracking.
"""
FEATURE_UNSPECIFIED = 0
LABEL_DETECTION = 1
SHOT_CHANGE_DETECTION = 2
EXPLICIT_CONTENT_DETECTION = 3
TEXT_DETECTION = 7
OBJECT_TRACKING = 9


class LabelDetectionMode(enum.IntEnum):
"""
Label detection mode.
Attributes:
LABEL_DETECTION_MODE_UNSPECIFIED (int): Unspecified.
SHOT_MODE (int): Detect shot-level labels.
FRAME_MODE (int): Detect frame-level labels.
SHOT_AND_FRAME_MODE (int): Detect both shot-level and frame-level labels.
"""
LABEL_DETECTION_MODE_UNSPECIFIED = 0
SHOT_MODE = 1
FRAME_MODE = 2
SHOT_AND_FRAME_MODE = 3


class Likelihood(enum.IntEnum):
"""
Bucketized representation of likelihood.
Attributes:
LIKELIHOOD_UNSPECIFIED (int): Unspecified likelihood.
VERY_UNLIKELY (int): Very unlikely.
UNLIKELY (int): Unlikely.
POSSIBLE (int): Possible.
LIKELY (int): Likely.
VERY_LIKELY (int): Very likely.
"""
LIKELIHOOD_UNSPECIFIED = 0
VERY_UNLIKELY = 1
UNLIKELY = 2
POSSIBLE = 3
LIKELY = 4
VERY_LIKELY = 5
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
# -*- coding: utf-8 -*-
#
# Copyright 2018 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
#
# https://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.

import google.api_core.grpc_helpers
import google.api_core.operations_v1

from google.cloud.videointelligence_v1p2beta1.proto import video_intelligence_pb2_grpc


class VideoIntelligenceServiceGrpcTransport(object):
"""gRPC transport class providing stubs for
google.cloud.videointelligence.v1p2beta1 VideoIntelligenceService API.
The transport provides access to the raw gRPC stubs,
which can be used to take advantage of advanced
features of gRPC.
"""
# The scopes needed to make gRPC calls to all of the methods defined
# in this service.
_OAUTH_SCOPES = ('https://www.googleapis.com/auth/cloud-platform', )

def __init__(self,
channel=None,
credentials=None,
address='videointelligence.googleapis.com:443'):
"""Instantiate the transport class.
Args:
channel (grpc.Channel): A ``Channel`` instance through
which to make calls. This argument is mutually exclusive
with ``credentials``; providing both will raise an exception.
credentials (google.auth.credentials.Credentials): The
authorization credentials to attach to requests. These
credentials identify this application to the service. If none
are specified, the client will attempt to ascertain the
credentials from the environment.
address (str): The address where the service is hosted.
"""
# If both `channel` and `credentials` are specified, raise an
# exception (channels come with credentials baked in already).
if channel is not None and credentials is not None:
raise ValueError(
'The `channel` and `credentials` arguments are mutually '
'exclusive.', )

# Create the channel.
if channel is None:
channel = self.create_channel(
address=address,
credentials=credentials,
)

# gRPC uses objects called "stubs" that are bound to the
# channel and provide a basic method for each RPC.
self._stubs = {
'video_intelligence_service_stub':
video_intelligence_pb2_grpc.VideoIntelligenceServiceStub(channel),
}

# Because this API includes a method that returns a
# long-running operation (proto: google.longrunning.Operation),
# instantiate an LRO client.
self._operations_client = google.api_core.operations_v1.OperationsClient(
channel)

@classmethod
def create_channel(cls,
address='videointelligence.googleapis.com:443',
credentials=None):
"""Create and return a gRPC channel object.
Args:
address (str): The host for the channel to use.
credentials (~.Credentials): The
authorization credentials to attach to requests. These
credentials identify this application to the service. If
none are specified, the client will attempt to ascertain
the credentials from the environment.
Returns:
grpc.Channel: A gRPC channel object.
"""
return google.api_core.grpc_helpers.create_channel(
address,
credentials=credentials,
scopes=cls._OAUTH_SCOPES,
)

@property
def annotate_video(self):
"""Return the gRPC stub for {$apiMethod.name}.
Performs asynchronous video annotation. Progress and results can be
retrieved through the ``google.longrunning.Operations`` interface.
``Operation.metadata`` contains ``AnnotateVideoProgress`` (progress).
``Operation.response`` contains ``AnnotateVideoResponse`` (results).
Returns:
Callable: A callable which accepts the appropriate
deserialized request object and returns a
deserialized response object.
"""
return self._stubs['video_intelligence_service_stub'].AnnotateVideo
Loading

0 comments on commit 07a29bf

Please sign in to comment.