Hi there! Are you looking for the official Deno documentation? Try docs.deno.com for all your Deno learning needs.

Vision

import { Vision } from "https://googleapis.deno.dev/v1/vision:v1.ts";

Integrates Google Vision features, including image labeling, face, logo, and landmark detection, optical character recognition (OCR), and detection of explicit content, into applications.

class Vision {
constructor(client?: CredentialsClient, baseUrl?: string);
async filesAnnotate(req: BatchAnnotateFilesRequest): Promise<BatchAnnotateFilesResponse>;
async filesAsyncBatchAnnotate(req: AsyncBatchAnnotateFilesRequest): Promise<Operation>;
async imagesAnnotate(req: BatchAnnotateImagesRequest): Promise<BatchAnnotateImagesResponse>;
async imagesAsyncBatchAnnotate(req: AsyncBatchAnnotateImagesRequest): Promise<Operation>;
async locationsOperationsGet(name: string): Promise<Operation>;
async operationsCancel(name: string, req: CancelOperationRequest): Promise<Empty>;
async operationsDelete(name: string): Promise<Empty>;
async operationsGet(name: string): Promise<Operation>;
async operationsList(name: string, opts?: OperationsListOptions): Promise<ListOperationsResponse>;
async projectsFilesAnnotate(parent: string, req: BatchAnnotateFilesRequest): Promise<BatchAnnotateFilesResponse>;
async projectsFilesAsyncBatchAnnotate(parent: string, req: AsyncBatchAnnotateFilesRequest): Promise<Operation>;
async projectsImagesAnnotate(parent: string, req: BatchAnnotateImagesRequest): Promise<BatchAnnotateImagesResponse>;
async projectsImagesAsyncBatchAnnotate(parent: string, req: AsyncBatchAnnotateImagesRequest): Promise<Operation>;
async projectsLocationsFilesAnnotate(parent: string, req: BatchAnnotateFilesRequest): Promise<BatchAnnotateFilesResponse>;
async projectsLocationsFilesAsyncBatchAnnotate(parent: string, req: AsyncBatchAnnotateFilesRequest): Promise<Operation>;
async projectsLocationsImagesAnnotate(parent: string, req: BatchAnnotateImagesRequest): Promise<BatchAnnotateImagesResponse>;
async projectsLocationsImagesAsyncBatchAnnotate(parent: string, req: AsyncBatchAnnotateImagesRequest): Promise<Operation>;
async projectsLocationsOperationsGet(name: string): Promise<Operation>;
async projectsLocationsProductsCreate(
parent: string,
req: Product,
): Promise<Product>;
async projectsLocationsProductsDelete(name: string): Promise<Empty>;
async projectsLocationsProductSetsAddProduct(name: string, req: AddProductToProductSetRequest): Promise<Empty>;
async projectsLocationsProductSetsCreate(
parent: string,
): Promise<ProductSet>;
async projectsLocationsProductSetsDelete(name: string): Promise<Empty>;
async projectsLocationsProductSetsGet(name: string): Promise<ProductSet>;
async projectsLocationsProductSetsImport(parent: string, req: ImportProductSetsRequest): Promise<Operation>;
async projectsLocationsProductSetsList(parent: string, opts?: ProjectsLocationsProductSetsListOptions): Promise<ListProductSetsResponse>;
async projectsLocationsProductSetsPatch(
name: string,
): Promise<ProductSet>;
async projectsLocationsProductSetsProductsList(name: string, opts?: ProjectsLocationsProductSetsProductsListOptions): Promise<ListProductsInProductSetResponse>;
async projectsLocationsProductSetsRemoveProduct(name: string, req: RemoveProductFromProductSetRequest): Promise<Empty>;
async projectsLocationsProductsGet(name: string): Promise<Product>;
async projectsLocationsProductsList(parent: string, opts?: ProjectsLocationsProductsListOptions): Promise<ListProductsResponse>;
async projectsLocationsProductsPatch(
name: string,
req: Product,
): Promise<Product>;
async projectsLocationsProductsPurge(parent: string, req: PurgeProductsRequest): Promise<Operation>;
async projectsLocationsProductsReferenceImagesCreate(
parent: string,
): Promise<ReferenceImage>;
async projectsLocationsProductsReferenceImagesDelete(name: string): Promise<Empty>;
async projectsLocationsProductsReferenceImagesGet(name: string): Promise<ReferenceImage>;
async projectsLocationsProductsReferenceImagesList(parent: string, opts?: ProjectsLocationsProductsReferenceImagesListOptions): Promise<ListReferenceImagesResponse>;
async projectsOperationsGet(name: string): Promise<Operation>;
}

§Constructors

§
new Vision(client?: CredentialsClient, baseUrl?: string)
[src]

§Methods

§

Service that performs image detection and annotation for a batch of files. Now only "application/pdf", "image/tiff" and "image/gif" are supported. This service will extract at most 5 (customers can specify which 5 in AnnotateFileRequest.pages) frames (gif) or pages (pdf or tiff) from each file provided and perform detection and annotation for each image extracted.

§
filesAsyncBatchAnnotate(req: AsyncBatchAnnotateFilesRequest): Promise<Operation>
[src]

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).

§

Run image detection and annotation for a batch of images.

§
imagesAsyncBatchAnnotate(req: AsyncBatchAnnotateImagesRequest): Promise<Operation>
[src]

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 contains OperationMetadata (metadata). Operation.response contains AsyncBatchAnnotateImagesResponse (results). This service will write image annotation outputs to json files in customer GCS bucket, each json file containing BatchAnnotateImagesResponse proto.

§
locationsOperationsGet(name: string): Promise<Operation>
[src]

Gets the latest state of a long-running operation. Clients can use this method to poll the operation result at intervals as recommended by the API service.

@param name

The name of the operation resource.

§
operationsCancel(name: string, req: CancelOperationRequest): Promise<Empty>
[src]

Starts asynchronous cancellation on a long-running operation. The server makes a best effort to cancel the operation, but success is not guaranteed. If the server doesn't support this method, it returns google.rpc.Code.UNIMPLEMENTED. Clients can use Operations.GetOperation or other methods to check whether the cancellation succeeded or whether the operation completed despite cancellation. On successful cancellation, the operation is not deleted; instead, it becomes an operation with an Operation.error value with a google.rpc.Status.code of 1, corresponding to Code.CANCELLED.

@param name

The name of the operation resource to be cancelled.

§
operationsDelete(name: string): Promise<Empty>
[src]

Deletes a long-running operation. This method indicates that the client is no longer interested in the operation result. It does not cancel the operation. If the server doesn't support this method, it returns google.rpc.Code.UNIMPLEMENTED.

@param name

The name of the operation resource to be deleted.

§
operationsGet(name: string): Promise<Operation>
[src]

Gets the latest state of a long-running operation. Clients can use this method to poll the operation result at intervals as recommended by the API service.

@param name

The name of the operation resource.

§
operationsList(name: string, opts?: OperationsListOptions): Promise<ListOperationsResponse>
[src]

Lists operations that match the specified filter in the request. If the server doesn't support this method, it returns UNIMPLEMENTED.

@param name

The name of the operation's parent resource.

§
projectsFilesAnnotate(parent: string, req: BatchAnnotateFilesRequest): Promise<BatchAnnotateFilesResponse>
[src]

Service that performs image detection and annotation for a batch of files. Now only "application/pdf", "image/tiff" and "image/gif" are supported. This service will extract at most 5 (customers can specify which 5 in AnnotateFileRequest.pages) frames (gif) or pages (pdf or tiff) from each file provided and perform detection and annotation for each image extracted.

@param parent

Optional. Target project and location to make a call. Format: projects/{project-id}/locations/{location-id}. If no parent is specified, a region will be chosen automatically. Supported location-ids: us: USA country only, asia: East asia areas, like Japan, Taiwan, eu: The European Union. Example: projects/project-A/locations/eu.

§
projectsFilesAsyncBatchAnnotate(parent: string, req: AsyncBatchAnnotateFilesRequest): Promise<Operation>
[src]

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).

@param parent

Optional. Target project and location to make a call. Format: projects/{project-id}/locations/{location-id}. If no parent is specified, a region will be chosen automatically. Supported location-ids: us: USA country only, asia: East asia areas, like Japan, Taiwan, eu: The European Union. Example: projects/project-A/locations/eu.

§
projectsImagesAnnotate(parent: string, req: BatchAnnotateImagesRequest): Promise<BatchAnnotateImagesResponse>
[src]

Run image detection and annotation for a batch of images.

@param parent

Optional. Target project and location to make a call. Format: projects/{project-id}/locations/{location-id}. If no parent is specified, a region will be chosen automatically. Supported location-ids: us: USA country only, asia: East asia areas, like Japan, Taiwan, eu: The European Union. Example: projects/project-A/locations/eu.

§
projectsImagesAsyncBatchAnnotate(parent: string, req: AsyncBatchAnnotateImagesRequest): Promise<Operation>
[src]

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 contains OperationMetadata (metadata). Operation.response contains AsyncBatchAnnotateImagesResponse (results). This service will write image annotation outputs to json files in customer GCS bucket, each json file containing BatchAnnotateImagesResponse proto.

@param parent

Optional. Target project and location to make a call. Format: projects/{project-id}/locations/{location-id}. If no parent is specified, a region will be chosen automatically. Supported location-ids: us: USA country only, asia: East asia areas, like Japan, Taiwan, eu: The European Union. Example: projects/project-A/locations/eu.

§
projectsLocationsFilesAnnotate(parent: string, req: BatchAnnotateFilesRequest): Promise<BatchAnnotateFilesResponse>
[src]

Service that performs image detection and annotation for a batch of files. Now only "application/pdf", "image/tiff" and "image/gif" are supported. This service will extract at most 5 (customers can specify which 5 in AnnotateFileRequest.pages) frames (gif) or pages (pdf or tiff) from each file provided and perform detection and annotation for each image extracted.

@param parent

Optional. Target project and location to make a call. Format: projects/{project-id}/locations/{location-id}. If no parent is specified, a region will be chosen automatically. Supported location-ids: us: USA country only, asia: East asia areas, like Japan, Taiwan, eu: The European Union. Example: projects/project-A/locations/eu.

§
projectsLocationsFilesAsyncBatchAnnotate(parent: string, req: AsyncBatchAnnotateFilesRequest): Promise<Operation>
[src]

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).

@param parent

Optional. Target project and location to make a call. Format: projects/{project-id}/locations/{location-id}. If no parent is specified, a region will be chosen automatically. Supported location-ids: us: USA country only, asia: East asia areas, like Japan, Taiwan, eu: The European Union. Example: projects/project-A/locations/eu.

§
projectsLocationsImagesAnnotate(parent: string, req: BatchAnnotateImagesRequest): Promise<BatchAnnotateImagesResponse>
[src]

Run image detection and annotation for a batch of images.

@param parent

Optional. Target project and location to make a call. Format: projects/{project-id}/locations/{location-id}. If no parent is specified, a region will be chosen automatically. Supported location-ids: us: USA country only, asia: East asia areas, like Japan, Taiwan, eu: The European Union. Example: projects/project-A/locations/eu.

§
projectsLocationsImagesAsyncBatchAnnotate(parent: string, req: AsyncBatchAnnotateImagesRequest): Promise<Operation>
[src]

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 contains OperationMetadata (metadata). Operation.response contains AsyncBatchAnnotateImagesResponse (results). This service will write image annotation outputs to json files in customer GCS bucket, each json file containing BatchAnnotateImagesResponse proto.

@param parent

Optional. Target project and location to make a call. Format: projects/{project-id}/locations/{location-id}. If no parent is specified, a region will be chosen automatically. Supported location-ids: us: USA country only, asia: East asia areas, like Japan, Taiwan, eu: The European Union. Example: projects/project-A/locations/eu.

§
projectsLocationsOperationsGet(name: string): Promise<Operation>
[src]

Gets the latest state of a long-running operation. Clients can use this method to poll the operation result at intervals as recommended by the API service.

@param name

The name of the operation resource.

§
projectsLocationsProductsCreate(parent: string, req: Product, opts?: ProjectsLocationsProductsCreateOptions): Promise<Product>
[src]

Creates and returns a new product resource. Possible errors: * Returns INVALID_ARGUMENT if display_name is missing or longer than 4096 characters.

  • Returns INVALID_ARGUMENT if description is longer than 4096 characters. * Returns INVALID_ARGUMENT if product_category is missing or invalid.
@param parent

Required. The project in which the Product should be created. Format is projects/PROJECT_ID/locations/LOC_ID.

§
projectsLocationsProductsDelete(name: string): Promise<Empty>
[src]

Permanently deletes a product and its reference images. Metadata of the product and all its images will be deleted right away, but search queries against ProductSets containing the product may still work until all related caches are refreshed.

@param name

Required. Resource name of product to delete. Format is: projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID

§
projectsLocationsProductSetsAddProduct(name: string, req: AddProductToProductSetRequest): Promise<Empty>
[src]

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.

@param name

Required. The resource name for the ProductSet to modify. Format is: projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID

§
projectsLocationsProductSetsCreate(parent: string, req: ProductSet, opts?: ProjectsLocationsProductSetsCreateOptions): Promise<ProductSet>
[src]

Creates and returns a new ProductSet resource. Possible errors: * Returns INVALID_ARGUMENT if display_name is missing, or is longer than 4096 characters.

@param parent

Required. The project in which the ProductSet should be created. Format is projects/PROJECT_ID/locations/LOC_ID.

§
projectsLocationsProductSetsDelete(name: string): Promise<Empty>
[src]

Permanently deletes a ProductSet. Products and ReferenceImages in the ProductSet are not deleted. The actual image files are not deleted from Google Cloud Storage.

@param name

Required. Resource name of the ProductSet to delete. Format is: projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID

§
projectsLocationsProductSetsGet(name: string): Promise<ProductSet>
[src]

Gets information associated with a ProductSet. Possible errors: * Returns NOT_FOUND if the ProductSet does not exist.

@param name

Required. Resource name of the ProductSet to get. Format is: projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID

§
projectsLocationsProductSetsImport(parent: string, req: ImportProductSetsRequest): Promise<Operation>
[src]

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 BatchOperationMetadata. (progress) Operation.response contains ImportProductSetsResponse. (results) The input source of this method is a csv file on Google Cloud Storage. For the format of the csv file please see ImportProductSetsGcsSource.csv_file_uri.

@param parent

Required. The project in which the ProductSets should be imported. Format is projects/PROJECT_ID/locations/LOC_ID.

§
projectsLocationsProductSetsList(parent: string, opts?: ProjectsLocationsProductSetsListOptions): Promise<ListProductSetsResponse>
[src]

Lists ProductSets in an unspecified order. Possible errors: * Returns INVALID_ARGUMENT if page_size is greater than 100, or less than 1.

@param parent

Required. The project from which ProductSets should be listed. Format is projects/PROJECT_ID/locations/LOC_ID.

§
projectsLocationsProductSetsPatch(name: string, req: ProductSet, opts?: ProjectsLocationsProductSetsPatchOptions): Promise<ProductSet>
[src]

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 but missing from the request or longer than 4096 characters.

@param name

The resource name of the ProductSet. Format is: projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID. This field is ignored when creating a ProductSet.

§
projectsLocationsProductSetsProductsList(name: string, opts?: ProjectsLocationsProductSetsProductsListOptions): Promise<ListProductsInProductSetResponse>
[src]

Lists the Products in a ProductSet, in an unspecified order. If the ProductSet does not exist, the products field of the response will be empty. Possible errors: * Returns INVALID_ARGUMENT if page_size is greater than 100 or less than 1.

@param name

Required. The ProductSet resource for which to retrieve Products. Format is: projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID

§
projectsLocationsProductSetsRemoveProduct(name: string, req: RemoveProductFromProductSetRequest): Promise<Empty>
[src]

Removes a Product from the specified ProductSet.

@param name

Required. The resource name for the ProductSet to modify. Format is: projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID

§
projectsLocationsProductsGet(name: string): Promise<Product>
[src]

Gets information associated with a Product. Possible errors: * Returns NOT_FOUND if the Product does not exist.

@param name

Required. Resource name of the Product to get. Format is: projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID

§
projectsLocationsProductsList(parent: string, opts?: ProjectsLocationsProductsListOptions): Promise<ListProductsResponse>
[src]

Lists products in an unspecified order. Possible errors: * Returns INVALID_ARGUMENT if page_size is greater than 100 or less than 1.

@param parent

Required. The project OR ProductSet from which Products should be listed. Format: projects/PROJECT_ID/locations/LOC_ID

§
projectsLocationsProductsPatch(name: string, req: Product, opts?: ProjectsLocationsProductsPatchOptions): Promise<Product>
[src]

Makes changes to a Product resource. Only the display_name, description, and labels fields can be updated right now. If labels are updated, the change will not be reflected in queries until the next index time. Possible errors: * 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.

@param name

The resource name of the product. Format is: projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID. This field is ignored when creating a product.

§
projectsLocationsProductsPurge(parent: string, req: PurgeProductsRequest): Promise<Operation>
[src]

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. It is recommended to not delete the specified ProductSet until after this operation has completed. It is also recommended to not add any of the Products involved in the batch delete to a new ProductSet while this operation is running because those Products may still end up deleted. It's not possible to undo the PurgeProducts operation. Therefore, it is recommended to keep the csv files used in ImportProductSets (if that was how you originally built the Product Set) before starting PurgeProducts, in case you need to re-import the data after deletion. If the plan is to purge all of the Products from a ProductSet and then re-use the empty ProductSet to re-import new Products into the empty ProductSet, you must wait until the PurgeProducts operation has finished for that ProductSet. The google.longrunning.Operation API can be used to keep track of the progress and results of the request. Operation.metadata contains BatchOperationMetadata. (progress)

@param parent

Required. The project and location in which the Products should be deleted. Format is projects/PROJECT_ID/locations/LOC_ID.

§
projectsLocationsProductsReferenceImagesCreate(parent: string, req: ReferenceImage, opts?: ProjectsLocationsProductsReferenceImagesCreateOptions): Promise<ReferenceImage>
[src]

Creates and returns a new ReferenceImage resource. 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 product. If it is specified, detection is ALWAYS skipped. The system converts polygons into non-rotated rectangles. Note that the pipeline will resize the image if the image resolution is too large to process (above 50MP). Possible errors: * 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 detected. * Returns INVALID_ARGUMENT if bounding_poly contains more than 10 polygons.

@param parent

Required. Resource name of the product in which to create the reference image. Format is projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID.

§
projectsLocationsProductsReferenceImagesDelete(name: string): Promise<Empty>
[src]

Permanently deletes a reference image. The image metadata will be deleted right away, but search queries against ProductSets containing the image may still work until all related caches are refreshed. The actual image files are not deleted from Google Cloud Storage.

@param name

Required. The resource name of the reference image to delete. Format is: projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID/referenceImages/IMAGE_ID

§
projectsLocationsProductsReferenceImagesGet(name: string): Promise<ReferenceImage>
[src]

Gets information associated with a ReferenceImage. Possible errors: * Returns NOT_FOUND if the specified image does not exist.

@param name

Required. The resource name of the ReferenceImage to get. Format is: projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID/referenceImages/IMAGE_ID.

§
projectsLocationsProductsReferenceImagesList(parent: string, opts?: ProjectsLocationsProductsReferenceImagesListOptions): Promise<ListReferenceImagesResponse>
[src]

Lists 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 less than 1.

@param parent

Required. Resource name of the product containing the reference images. Format is projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID.

§
projectsOperationsGet(name: string): Promise<Operation>
[src]

Gets the latest state of a long-running operation. Clients can use this method to poll the operation result at intervals as recommended by the API service.

@param name

The name of the operation resource.