Skip to content
This repository has been archived by the owner on Feb 13, 2024. It is now read-only.

Commit

Permalink
Integrate Python GAPIC Microgenerator in googleapis. This PR uses usi…
Browse files Browse the repository at this point in the history
…ng documentai as an example. Depends on googleapis/gapic-generator-python#402

PiperOrigin-RevId: 309824146

Source-Author: Google APIs <[email protected]>
Source-Date: Mon May 4 15:06:44 2020 -0700
Source-Repo: googleapis/googleapis
Source-Sha: e0f9d9e1f9de890db765be46f45ca8490723e3eb
Source-Link: googleapis/googleapis@e0f9d9e
  • Loading branch information
yoshi-automation committed Jun 25, 2020
1 parent b33fa88 commit e8d00a5
Show file tree
Hide file tree
Showing 51 changed files with 5,461 additions and 5,158 deletions.
6 changes: 3 additions & 3 deletions google/cloud/vision_v1/gapic/enums.py
Original file line number Diff line number Diff line change
Expand Up @@ -181,9 +181,9 @@ class Type(enum.IntEnum):
LANDMARK_DETECTION (int): Run landmark detection.
LOGO_DETECTION (int): Run logo detection.
LABEL_DETECTION (int): Run label detection.
TEXT_DETECTION (int): Run text detection / optical character recognition (OCR). Text detection
is optimized for areas of text within a larger image; if the image is a
document, use ``DOCUMENT_TEXT_DETECTION`` instead.
TEXT_DETECTION (int): Run text detection / optical character recognition (OCR). Text
detection is optimized for areas of text within a larger image; if the
image is a document, use ``DOCUMENT_TEXT_DETECTION`` instead.
DOCUMENT_TEXT_DETECTION (int): Run dense text document OCR. Takes precedence when both
``DOCUMENT_TEXT_DETECTION`` and ``TEXT_DETECTION`` are present.
SAFE_SEARCH_DETECTION (int): Run Safe Search to detect potentially unsafe
Expand Down
11 changes: 6 additions & 5 deletions google/cloud/vision_v1/gapic/image_annotator_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -381,7 +381,8 @@ def async_batch_annotate_images(
metadata=None,
):
"""
Run asynchronous image detection and annotation for a list of images.
Run asynchronous image detection and annotation for a list of
images.
Progress and results can be retrieved through the
``google.longrunning.Operations`` interface. ``Operation.metadata``
Expand Down Expand Up @@ -500,10 +501,10 @@ def async_batch_annotate_files(
metadata=None,
):
"""
Run asynchronous image detection and annotation for a list of generic
files, such as PDF files, which may contain multiple pages and multiple
images per page. Progress and results can be retrieved through the
``google.longrunning.Operations`` interface. ``Operation.metadata``
Run asynchronous image detection and annotation for a list of
generic files, such as PDF files, which may contain multiple pages and
multiple images per page. Progress and results can be retrieved through
the ``google.longrunning.Operations`` interface. ``Operation.metadata``
contains ``OperationMetadata`` (metadata). ``Operation.response``
contains ``AsyncBatchAnnotateFilesResponse`` (results).
Expand Down
114 changes: 58 additions & 56 deletions google/cloud/vision_v1/gapic/product_search_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,8 @@

class ProductSearchClient(object):
"""
Manages Products and ProductSets of reference images for use in product
search. It uses the following resource model:
Manages Products and ProductSets of reference images for use in
product search. It uses the following resource model:
- The API has a collection of ``ProductSet`` resources, named
``projects/*/locations/*/productSets/*``, which acts as a way to put
Expand Down Expand Up @@ -259,7 +259,7 @@ def create_product_set(
Possible errors:
- Returns INVALID\_ARGUMENT if display\_name is missing, or is longer
- Returns INVALID_ARGUMENT if display_name is missing, or is longer
than 4096 characters.
Example:
Expand All @@ -282,9 +282,9 @@ def create_product_set(
If a dict is provided, it must be of the same form as the protobuf
message :class:`~google.cloud.vision_v1.types.ProductSet`
product_set_id (str): A user-supplied resource id for this ProductSet. If set, the server will
attempt to use this value as the resource id. If it is already in use,
an error is returned with code ALREADY\_EXISTS. Must be at most 128
product_set_id (str): A user-supplied resource id for this ProductSet. If set, the server
will attempt to use this value as the resource id. If it is already in
use, an error is returned with code ALREADY_EXISTS. Must be at most 128
characters long. It cannot contain the character ``/``.
retry (Optional[google.api_core.retry.Retry]): A retry object used
to retry requests. If ``None`` is specified, requests will
Expand Down Expand Up @@ -349,7 +349,7 @@ def list_product_sets(
Possible errors:
- Returns INVALID\_ARGUMENT if page\_size is greater than 100, or less
- Returns INVALID_ARGUMENT if page_size is greater than 100, or less
than 1.
Example:
Expand Down Expand Up @@ -458,7 +458,7 @@ def get_product_set(
Possible errors:
- Returns NOT\_FOUND if the ProductSet does not exist.
- Returns NOT_FOUND if the ProductSet does not exist.
Example:
>>> from google.cloud import vision_v1
Expand Down Expand Up @@ -531,13 +531,13 @@ def update_product_set(
metadata=None,
):
"""
Makes changes to a ProductSet resource. Only display\_name can be
Makes changes to a ProductSet resource. Only display_name can be
updated currently.
Possible errors:
- Returns NOT\_FOUND if the ProductSet does not exist.
- Returns INVALID\_ARGUMENT if display\_name is present in update\_mask
- Returns NOT_FOUND if the ProductSet does not exist.
- Returns INVALID_ARGUMENT if display_name is present in update_mask
but missing from the request or longer than 4096 characters.
Example:
Expand All @@ -555,9 +555,9 @@ def update_product_set(
If a dict is provided, it must be of the same form as the protobuf
message :class:`~google.cloud.vision_v1.types.ProductSet`
update_mask (Union[dict, ~google.cloud.vision_v1.types.FieldMask]): The ``FieldMask`` that specifies which fields to update. If update\_mask
isn't specified, all mutable fields are to be updated. Valid mask path
is ``display_name``.
update_mask (Union[dict, ~google.cloud.vision_v1.types.FieldMask]): The ``FieldMask`` that specifies which fields to update. If
update_mask isn't specified, all mutable fields are to be updated. Valid
mask path is ``display_name``.
If a dict is provided, it must be of the same form as the protobuf
message :class:`~google.cloud.vision_v1.types.FieldMask`
Expand Down Expand Up @@ -697,11 +697,11 @@ def create_product(
Possible errors:
- Returns INVALID\_ARGUMENT if display\_name is missing or longer than
- Returns INVALID_ARGUMENT if display_name is missing or longer than
4096 characters.
- Returns INVALID\_ARGUMENT if description is longer than 4096
- Returns INVALID_ARGUMENT if description is longer than 4096
characters.
- Returns INVALID\_ARGUMENT if product\_category is missing or invalid.
- Returns INVALID_ARGUMENT if product_category is missing or invalid.
Example:
>>> from google.cloud import vision_v1
Expand All @@ -723,9 +723,9 @@ def create_product(
If a dict is provided, it must be of the same form as the protobuf
message :class:`~google.cloud.vision_v1.types.Product`
product_id (str): A user-supplied resource id for this Product. If set, the server will
attempt to use this value as the resource id. If it is already in use,
an error is returned with code ALREADY\_EXISTS. Must be at most 128
product_id (str): A user-supplied resource id for this Product. If set, the server
will attempt to use this value as the resource id. If it is already in
use, an error is returned with code ALREADY_EXISTS. Must be at most 128
characters long. It cannot contain the character ``/``.
retry (Optional[google.api_core.retry.Retry]): A retry object used
to retry requests. If ``None`` is specified, requests will
Expand Down Expand Up @@ -790,7 +790,7 @@ def list_products(
Possible errors:
- Returns INVALID\_ARGUMENT if page\_size is greater than 100 or less
- Returns INVALID_ARGUMENT if page_size is greater than 100 or less
than 1.
Example:
Expand Down Expand Up @@ -900,7 +900,7 @@ def get_product(
Possible errors:
- Returns NOT\_FOUND if the Product does not exist.
- Returns NOT_FOUND if the Product does not exist.
Example:
>>> from google.cloud import vision_v1
Expand Down Expand Up @@ -980,13 +980,13 @@ def update_product(
Possible errors:
- Returns NOT\_FOUND if the Product does not exist.
- Returns INVALID\_ARGUMENT if display\_name is present in update\_mask
- Returns NOT_FOUND if the Product does not exist.
- Returns INVALID_ARGUMENT if display_name is present in update_mask
but is missing from the request or longer than 4096 characters.
- Returns INVALID\_ARGUMENT if description is present in update\_mask
but is longer than 4096 characters.
- Returns INVALID\_ARGUMENT if product\_category is present in
update\_mask.
- Returns INVALID_ARGUMENT if description is present in update_mask but
is longer than 4096 characters.
- Returns INVALID_ARGUMENT if product_category is present in
update_mask.
Example:
>>> from google.cloud import vision_v1
Expand All @@ -1004,9 +1004,10 @@ def update_product(
If a dict is provided, it must be of the same form as the protobuf
message :class:`~google.cloud.vision_v1.types.Product`
update_mask (Union[dict, ~google.cloud.vision_v1.types.FieldMask]): The ``FieldMask`` that specifies which fields to update. If update\_mask
isn't specified, all mutable fields are to be updated. Valid mask paths
include ``product_labels``, ``display_name``, and ``description``.
update_mask (Union[dict, ~google.cloud.vision_v1.types.FieldMask]): The ``FieldMask`` that specifies which fields to update. If
update_mask isn't specified, all mutable fields are to be updated. Valid
mask paths include ``product_labels``, ``display_name``, and
``description``.
If a dict is provided, it must be of the same form as the protobuf
message :class:`~google.cloud.vision_v1.types.FieldMask`
Expand Down Expand Up @@ -1146,7 +1147,7 @@ def create_reference_image(
The ``bounding_poly`` field is optional. If ``bounding_poly`` is not
specified, the system will try to detect regions of interest in the
image that are compatible with the product\_category on the parent
image that are compatible with the product_category on the parent
product. If it is specified, detection is ALWAYS skipped. The system
converts polygons into non-rotated rectangles.
Expand All @@ -1155,13 +1156,13 @@ def create_reference_image(
Possible errors:
- Returns INVALID\_ARGUMENT if the image\_uri is missing or longer than
- Returns INVALID_ARGUMENT if the image_uri is missing or longer than
4096 characters.
- Returns INVALID\_ARGUMENT if the product does not exist.
- Returns INVALID\_ARGUMENT if bounding\_poly is not provided, and
nothing compatible with the parent product's product\_category is
- Returns INVALID_ARGUMENT if the product does not exist.
- Returns INVALID_ARGUMENT if bounding_poly is not provided, and
nothing compatible with the parent product's product_category is
detected.
- Returns INVALID\_ARGUMENT if bounding\_poly contains more than 10
- Returns INVALID_ARGUMENT if bounding_poly contains more than 10
polygons.
Example:
Expand All @@ -1177,19 +1178,19 @@ def create_reference_image(
>>> response = client.create_reference_image(parent, reference_image)
Args:
parent (str): Required. Resource name of the product in which to create the reference
image.
parent (str): Required. Resource name of the product in which to create the
reference image.
Format is ``projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID``.
reference_image (Union[dict, ~google.cloud.vision_v1.types.ReferenceImage]): Required. The reference image to create.
If an image ID is specified, it is ignored.
If a dict is provided, it must be of the same form as the protobuf
message :class:`~google.cloud.vision_v1.types.ReferenceImage`
reference_image_id (str): A user-supplied resource id for the ReferenceImage to be added. If set,
the server will attempt to use this value as the resource id. If it is
already in use, an error is returned with code ALREADY\_EXISTS. Must be
at most 128 characters long. It cannot contain the character ``/``.
reference_image_id (str): A user-supplied resource id for the ReferenceImage to be added. If
set, the server will attempt to use this value as the resource id. If it
is already in use, an error is returned with code ALREADY_EXISTS. Must
be at most 128 characters long. It cannot contain the character ``/``.
retry (Optional[google.api_core.retry.Retry]): A retry object used
to retry requests. If ``None`` is specified, requests will
be retried using a default configuration.
Expand Down Expand Up @@ -1331,8 +1332,8 @@ def list_reference_images(
Possible errors:
- Returns NOT\_FOUND if the parent product does not exist.
- Returns INVALID\_ARGUMENT if the page\_size is greater than 100, or
- Returns NOT_FOUND if the parent product does not exist.
- Returns INVALID_ARGUMENT if the page_size is greater than 100, or
less than 1.
Example:
Expand All @@ -1357,7 +1358,8 @@ def list_reference_images(
... pass
Args:
parent (str): Required. Resource name of the product containing the reference images.
parent (str): Required. Resource name of the product containing the reference
images.
Format is ``projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID``.
page_size (int): The maximum number of resources contained in the
Expand Down Expand Up @@ -1441,7 +1443,7 @@ def get_reference_image(
Possible errors:
- Returns NOT\_FOUND if the specified image does not exist.
- Returns NOT_FOUND if the specified image does not exist.
Example:
>>> from google.cloud import vision_v1
Expand Down Expand Up @@ -1515,14 +1517,14 @@ def add_product_to_product_set(
metadata=None,
):
"""
Adds a Product to the specified ProductSet. If the Product is already
present, no change is made.
Adds a Product to the specified ProductSet. If the Product is
already present, no change is made.
One Product can be added to at most 100 ProductSets.
Possible errors:
- Returns NOT\_FOUND if the Product or the ProductSet doesn't exist.
- Returns NOT_FOUND if the Product or the ProductSet doesn't exist.
Example:
>>> from google.cloud import vision_v1
Expand Down Expand Up @@ -1684,7 +1686,7 @@ def list_products_in_product_set(
Possible errors:
- Returns INVALID\_ARGUMENT if page\_size is greater than 100 or less
- Returns INVALID_ARGUMENT if page_size is greater than 100 or less
than 1.
Example:
Expand Down Expand Up @@ -1793,8 +1795,8 @@ def import_product_sets(
metadata=None,
):
"""
Asynchronous API that imports a list of reference images to specified
product sets based on a list of image information.
Asynchronous API that imports a list of reference images to
specified product sets based on a list of image information.
The ``google.longrunning.Operation`` API can be used to keep track of
the progress and results of the request. ``Operation.metadata`` contains
Expand Down Expand Up @@ -1901,8 +1903,8 @@ def purge_products(
metadata=None,
):
"""
Asynchronous API to delete all Products in a ProductSet or all Products
that are in no ProductSet.
Asynchronous API to delete all Products in a ProductSet or all
Products that are in no ProductSet.
If a Product is a member of the specified ProductSet in addition to
other ProductSets, the Product will still be deleted.
Expand Down Expand Up @@ -1953,7 +1955,7 @@ def purge_products(
If a dict is provided, it must be of the same form as the protobuf
message :class:`~google.cloud.vision_v1.types.ProductSetPurgeConfig`
delete_orphan_products (bool): If delete\_orphan\_products is true, all Products that are not in any
delete_orphan_products (bool): If delete_orphan_products is true, all Products that are not in any
ProductSet will be deleted.
force (bool): The default value is false. Override this value to true to actually perform
the purge.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,8 @@ def batch_annotate_files(self):
def async_batch_annotate_images(self):
"""Return the gRPC stub for :meth:`ImageAnnotatorClient.async_batch_annotate_images`.
Run asynchronous image detection and annotation for a list of images.
Run asynchronous image detection and annotation for a list of
images.
Progress and results can be retrieved through the
``google.longrunning.Operations`` interface. ``Operation.metadata``
Expand All @@ -176,10 +177,10 @@ def async_batch_annotate_images(self):
def async_batch_annotate_files(self):
"""Return the gRPC stub for :meth:`ImageAnnotatorClient.async_batch_annotate_files`.
Run asynchronous image detection and annotation for a list of generic
files, such as PDF files, which may contain multiple pages and multiple
images per page. Progress and results can be retrieved through the
``google.longrunning.Operations`` interface. ``Operation.metadata``
Run asynchronous image detection and annotation for a list of
generic files, such as PDF files, which may contain multiple pages and
multiple images per page. Progress and results can be retrieved through
the ``google.longrunning.Operations`` interface. ``Operation.metadata``
contains ``OperationMetadata`` (metadata). ``Operation.response``
contains ``AsyncBatchAnnotateFilesResponse`` (results).
Expand Down
Loading

0 comments on commit e8d00a5

Please sign in to comment.