49
49
50
50
class ProductSearchClient (object ):
51
51
"""
52
- Manages Products and ProductSets of reference images for use in product
53
- search. It uses the following resource model:
52
+ Manages Products and ProductSets of reference images for use in
53
+ product search. It uses the following resource model:
54
54
55
55
- The API has a collection of ``ProductSet`` resources, named
56
56
``projects/*/locations/*/productSets/*``, which acts as a way to put
@@ -259,7 +259,7 @@ def create_product_set(
259
259
260
260
Possible errors:
261
261
262
- - Returns INVALID\_ARGUMENT if display\_name is missing, or is longer
262
+ - Returns INVALID_ARGUMENT if display_name is missing, or is longer
263
263
than 4096 characters.
264
264
265
265
Example:
@@ -282,9 +282,9 @@ def create_product_set(
282
282
283
283
If a dict is provided, it must be of the same form as the protobuf
284
284
message :class:`~google.cloud.vision_v1.types.ProductSet`
285
- product_set_id (str): A user-supplied resource id for this ProductSet. If set, the server will
286
- attempt to use this value as the resource id. If it is already in use,
287
- an error is returned with code ALREADY\_EXISTS . Must be at most 128
285
+ product_set_id (str): A user-supplied resource id for this ProductSet. If set, the server
286
+ will attempt to use this value as the resource id. If it is already in
287
+ use, an error is returned with code ALREADY_EXISTS . Must be at most 128
288
288
characters long. It cannot contain the character ``/``.
289
289
retry (Optional[google.api_core.retry.Retry]): A retry object used
290
290
to retry requests. If ``None`` is specified, requests will
@@ -349,7 +349,7 @@ def list_product_sets(
349
349
350
350
Possible errors:
351
351
352
- - Returns INVALID\_ARGUMENT if page\_size is greater than 100, or less
352
+ - Returns INVALID_ARGUMENT if page_size is greater than 100, or less
353
353
than 1.
354
354
355
355
Example:
@@ -458,7 +458,7 @@ def get_product_set(
458
458
459
459
Possible errors:
460
460
461
- - Returns NOT\_FOUND if the ProductSet does not exist.
461
+ - Returns NOT_FOUND if the ProductSet does not exist.
462
462
463
463
Example:
464
464
>>> from google.cloud import vision_v1
@@ -531,13 +531,13 @@ def update_product_set(
531
531
metadata = None ,
532
532
):
533
533
"""
534
- Makes changes to a ProductSet resource. Only display\_name can be
534
+ Makes changes to a ProductSet resource. Only display_name can be
535
535
updated currently.
536
536
537
537
Possible errors:
538
538
539
- - Returns NOT\_FOUND if the ProductSet does not exist.
540
- - Returns INVALID\_ARGUMENT if display\_name is present in update\_mask
539
+ - Returns NOT_FOUND if the ProductSet does not exist.
540
+ - Returns INVALID_ARGUMENT if display_name is present in update_mask
541
541
but missing from the request or longer than 4096 characters.
542
542
543
543
Example:
@@ -555,9 +555,9 @@ def update_product_set(
555
555
556
556
If a dict is provided, it must be of the same form as the protobuf
557
557
message :class:`~google.cloud.vision_v1.types.ProductSet`
558
- update_mask (Union[dict, ~google.cloud.vision_v1.types.FieldMask]): The ``FieldMask`` that specifies which fields to update. If update\_mask
559
- isn't specified, all mutable fields are to be updated. Valid mask path
560
- is ``display_name``.
558
+ update_mask (Union[dict, ~google.cloud.vision_v1.types.FieldMask]): The ``FieldMask`` that specifies which fields to update. If
559
+ update_mask isn't specified, all mutable fields are to be updated. Valid
560
+ mask path is ``display_name``.
561
561
562
562
If a dict is provided, it must be of the same form as the protobuf
563
563
message :class:`~google.cloud.vision_v1.types.FieldMask`
@@ -697,11 +697,11 @@ def create_product(
697
697
698
698
Possible errors:
699
699
700
- - Returns INVALID\_ARGUMENT if display\_name is missing or longer than
700
+ - Returns INVALID_ARGUMENT if display_name is missing or longer than
701
701
4096 characters.
702
- - Returns INVALID\_ARGUMENT if description is longer than 4096
702
+ - Returns INVALID_ARGUMENT if description is longer than 4096
703
703
characters.
704
- - Returns INVALID\_ARGUMENT if product\_category is missing or invalid.
704
+ - Returns INVALID_ARGUMENT if product_category is missing or invalid.
705
705
706
706
Example:
707
707
>>> from google.cloud import vision_v1
@@ -723,9 +723,9 @@ def create_product(
723
723
724
724
If a dict is provided, it must be of the same form as the protobuf
725
725
message :class:`~google.cloud.vision_v1.types.Product`
726
- product_id (str): A user-supplied resource id for this Product. If set, the server will
727
- attempt to use this value as the resource id. If it is already in use,
728
- an error is returned with code ALREADY\_EXISTS . Must be at most 128
726
+ product_id (str): A user-supplied resource id for this Product. If set, the server
727
+ will attempt to use this value as the resource id. If it is already in
728
+ use, an error is returned with code ALREADY_EXISTS . Must be at most 128
729
729
characters long. It cannot contain the character ``/``.
730
730
retry (Optional[google.api_core.retry.Retry]): A retry object used
731
731
to retry requests. If ``None`` is specified, requests will
@@ -790,7 +790,7 @@ def list_products(
790
790
791
791
Possible errors:
792
792
793
- - Returns INVALID\_ARGUMENT if page\_size is greater than 100 or less
793
+ - Returns INVALID_ARGUMENT if page_size is greater than 100 or less
794
794
than 1.
795
795
796
796
Example:
@@ -900,7 +900,7 @@ def get_product(
900
900
901
901
Possible errors:
902
902
903
- - Returns NOT\_FOUND if the Product does not exist.
903
+ - Returns NOT_FOUND if the Product does not exist.
904
904
905
905
Example:
906
906
>>> from google.cloud import vision_v1
@@ -980,13 +980,13 @@ def update_product(
980
980
981
981
Possible errors:
982
982
983
- - Returns NOT\_FOUND if the Product does not exist.
984
- - Returns INVALID\_ARGUMENT if display\_name is present in update\_mask
983
+ - Returns NOT_FOUND if the Product does not exist.
984
+ - Returns INVALID_ARGUMENT if display_name is present in update_mask
985
985
but is missing from the request or longer than 4096 characters.
986
- - Returns INVALID\_ARGUMENT if description is present in update\_mask
987
- but is longer than 4096 characters.
988
- - Returns INVALID\_ARGUMENT if product\_category is present in
989
- update\_mask .
986
+ - Returns INVALID_ARGUMENT if description is present in update_mask but
987
+ is longer than 4096 characters.
988
+ - Returns INVALID_ARGUMENT if product_category is present in
989
+ update_mask .
990
990
991
991
Example:
992
992
>>> from google.cloud import vision_v1
@@ -1004,9 +1004,10 @@ def update_product(
1004
1004
1005
1005
If a dict is provided, it must be of the same form as the protobuf
1006
1006
message :class:`~google.cloud.vision_v1.types.Product`
1007
- update_mask (Union[dict, ~google.cloud.vision_v1.types.FieldMask]): The ``FieldMask`` that specifies which fields to update. If update\_mask
1008
- isn't specified, all mutable fields are to be updated. Valid mask paths
1009
- include ``product_labels``, ``display_name``, and ``description``.
1007
+ update_mask (Union[dict, ~google.cloud.vision_v1.types.FieldMask]): The ``FieldMask`` that specifies which fields to update. If
1008
+ update_mask isn't specified, all mutable fields are to be updated. Valid
1009
+ mask paths include ``product_labels``, ``display_name``, and
1010
+ ``description``.
1010
1011
1011
1012
If a dict is provided, it must be of the same form as the protobuf
1012
1013
message :class:`~google.cloud.vision_v1.types.FieldMask`
@@ -1146,7 +1147,7 @@ def create_reference_image(
1146
1147
1147
1148
The ``bounding_poly`` field is optional. If ``bounding_poly`` is not
1148
1149
specified, the system will try to detect regions of interest in the
1149
- image that are compatible with the product\_category on the parent
1150
+ image that are compatible with the product_category on the parent
1150
1151
product. If it is specified, detection is ALWAYS skipped. The system
1151
1152
converts polygons into non-rotated rectangles.
1152
1153
@@ -1155,13 +1156,13 @@ def create_reference_image(
1155
1156
1156
1157
Possible errors:
1157
1158
1158
- - Returns INVALID\_ARGUMENT if the image\_uri is missing or longer than
1159
+ - Returns INVALID_ARGUMENT if the image_uri is missing or longer than
1159
1160
4096 characters.
1160
- - Returns INVALID\_ARGUMENT if the product does not exist.
1161
- - Returns INVALID\_ARGUMENT if bounding\_poly is not provided, and
1162
- nothing compatible with the parent product's product\_category is
1161
+ - Returns INVALID_ARGUMENT if the product does not exist.
1162
+ - Returns INVALID_ARGUMENT if bounding_poly is not provided, and
1163
+ nothing compatible with the parent product's product_category is
1163
1164
detected.
1164
- - Returns INVALID\_ARGUMENT if bounding\_poly contains more than 10
1165
+ - Returns INVALID_ARGUMENT if bounding_poly contains more than 10
1165
1166
polygons.
1166
1167
1167
1168
Example:
@@ -1177,19 +1178,19 @@ def create_reference_image(
1177
1178
>>> response = client.create_reference_image(parent, reference_image)
1178
1179
1179
1180
Args:
1180
- parent (str): Required. Resource name of the product in which to create the reference
1181
- image.
1181
+ parent (str): Required. Resource name of the product in which to create the
1182
+ reference image.
1182
1183
1183
1184
Format is ``projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID``.
1184
1185
reference_image (Union[dict, ~google.cloud.vision_v1.types.ReferenceImage]): Required. The reference image to create.
1185
1186
If an image ID is specified, it is ignored.
1186
1187
1187
1188
If a dict is provided, it must be of the same form as the protobuf
1188
1189
message :class:`~google.cloud.vision_v1.types.ReferenceImage`
1189
- reference_image_id (str): A user-supplied resource id for the ReferenceImage to be added. If set,
1190
- the server will attempt to use this value as the resource id. If it is
1191
- already in use, an error is returned with code ALREADY\_EXISTS . Must be
1192
- at most 128 characters long. It cannot contain the character ``/``.
1190
+ reference_image_id (str): A user-supplied resource id for the ReferenceImage to be added. If
1191
+ set, the server will attempt to use this value as the resource id. If it
1192
+ is already in use, an error is returned with code ALREADY_EXISTS . Must
1193
+ be at most 128 characters long. It cannot contain the character ``/``.
1193
1194
retry (Optional[google.api_core.retry.Retry]): A retry object used
1194
1195
to retry requests. If ``None`` is specified, requests will
1195
1196
be retried using a default configuration.
@@ -1331,8 +1332,8 @@ def list_reference_images(
1331
1332
1332
1333
Possible errors:
1333
1334
1334
- - Returns NOT\_FOUND if the parent product does not exist.
1335
- - Returns INVALID\_ARGUMENT if the page\_size is greater than 100, or
1335
+ - Returns NOT_FOUND if the parent product does not exist.
1336
+ - Returns INVALID_ARGUMENT if the page_size is greater than 100, or
1336
1337
less than 1.
1337
1338
1338
1339
Example:
@@ -1357,7 +1358,8 @@ def list_reference_images(
1357
1358
... pass
1358
1359
1359
1360
Args:
1360
- parent (str): Required. Resource name of the product containing the reference images.
1361
+ parent (str): Required. Resource name of the product containing the reference
1362
+ images.
1361
1363
1362
1364
Format is ``projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID``.
1363
1365
page_size (int): The maximum number of resources contained in the
@@ -1441,7 +1443,7 @@ def get_reference_image(
1441
1443
1442
1444
Possible errors:
1443
1445
1444
- - Returns NOT\_FOUND if the specified image does not exist.
1446
+ - Returns NOT_FOUND if the specified image does not exist.
1445
1447
1446
1448
Example:
1447
1449
>>> from google.cloud import vision_v1
@@ -1515,14 +1517,14 @@ def add_product_to_product_set(
1515
1517
metadata = None ,
1516
1518
):
1517
1519
"""
1518
- Adds a Product to the specified ProductSet. If the Product is already
1519
- present, no change is made.
1520
+ Adds a Product to the specified ProductSet. If the Product is
1521
+ already present, no change is made.
1520
1522
1521
1523
One Product can be added to at most 100 ProductSets.
1522
1524
1523
1525
Possible errors:
1524
1526
1525
- - Returns NOT\_FOUND if the Product or the ProductSet doesn't exist.
1527
+ - Returns NOT_FOUND if the Product or the ProductSet doesn't exist.
1526
1528
1527
1529
Example:
1528
1530
>>> from google.cloud import vision_v1
@@ -1684,7 +1686,7 @@ def list_products_in_product_set(
1684
1686
1685
1687
Possible errors:
1686
1688
1687
- - Returns INVALID\_ARGUMENT if page\_size is greater than 100 or less
1689
+ - Returns INVALID_ARGUMENT if page_size is greater than 100 or less
1688
1690
than 1.
1689
1691
1690
1692
Example:
@@ -1793,8 +1795,8 @@ def import_product_sets(
1793
1795
metadata = None ,
1794
1796
):
1795
1797
"""
1796
- Asynchronous API that imports a list of reference images to specified
1797
- product sets based on a list of image information.
1798
+ Asynchronous API that imports a list of reference images to
1799
+ specified product sets based on a list of image information.
1798
1800
1799
1801
The ``google.longrunning.Operation`` API can be used to keep track of
1800
1802
the progress and results of the request. ``Operation.metadata`` contains
@@ -1901,8 +1903,8 @@ def purge_products(
1901
1903
metadata = None ,
1902
1904
):
1903
1905
"""
1904
- Asynchronous API to delete all Products in a ProductSet or all Products
1905
- that are in no ProductSet.
1906
+ Asynchronous API to delete all Products in a ProductSet or all
1907
+ Products that are in no ProductSet.
1906
1908
1907
1909
If a Product is a member of the specified ProductSet in addition to
1908
1910
other ProductSets, the Product will still be deleted.
@@ -1953,7 +1955,7 @@ def purge_products(
1953
1955
1954
1956
If a dict is provided, it must be of the same form as the protobuf
1955
1957
message :class:`~google.cloud.vision_v1.types.ProductSetPurgeConfig`
1956
- delete_orphan_products (bool): If delete\_orphan\_products is true, all Products that are not in any
1958
+ delete_orphan_products (bool): If delete_orphan_products is true, all Products that are not in any
1957
1959
ProductSet will be deleted.
1958
1960
force (bool): The default value is false. Override this value to true to actually perform
1959
1961
the purge.
0 commit comments