Reference documentation and code samples for the Cloud Vision V1 API class Google::Cloud::Vision::V1::ImageAnnotator::Rest::Client.
REST client for the ImageAnnotator service.
Service that performs Google Cloud Vision API detection tasks over client images, such as face, landmark, logo, label, and text detection. The ImageAnnotator service returns detected entities from the images.
Inherits
- Object
Methods
.configure
def self.configure() { |config| ... } -> Client::Configuration
Configure the ImageAnnotator Client class.
See Configuration for a description of the configuration fields.
- (config) — Configure the Client client.
- config (Client::Configuration)
# Modify the configuration for all ImageAnnotator clients ::Google::Cloud::Vision::V1::ImageAnnotator::Rest::Client.configure do |config| config.timeout = 10.0 end
#async_batch_annotate_files
def async_batch_annotate_files(request, options = nil) -> ::Gapic::Operation
def async_batch_annotate_files(requests: nil, parent: nil) -> ::Gapic::Operation
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).
def async_batch_annotate_files(request, options = nil) -> ::Gapic::Operation
async_batch_annotate_files
via a request object, either of type
AsyncBatchAnnotateFilesRequest or an equivalent Hash.
- request (::Google::Cloud::Vision::V1::AsyncBatchAnnotateFilesRequest, ::Hash) — A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.
- options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
def async_batch_annotate_files(requests: nil, parent: nil) -> ::Gapic::Operation
async_batch_annotate_files
via keyword arguments. Note that at
least one keyword argument is required. To specify no parameters, or to keep all
the default parameter values, pass an empty Hash as a request object (see above).
- requests (::Array<::Google::Cloud::Vision::V1::AsyncAnnotateFileRequest, ::Hash>) — Required. Individual async file annotation requests for this batch.
-
parent (::String) — 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
.
- (result, operation) — Access the result along with the TransportOperation object
- result (::Gapic::Operation)
- operation (::Gapic::Rest::TransportOperation)
- (::Gapic::Operation)
- (::Google::Cloud::Error) — if the REST call is aborted.
Basic example
require "google/cloud/vision/v1" # Create a client object. The client can be reused for multiple calls. client = Google::Cloud::Vision::V1::ImageAnnotator::Rest::Client.new # Create a request. To set request fields, pass in keyword arguments. request = Google::Cloud::Vision::V1::AsyncBatchAnnotateFilesRequest.new # Call the async_batch_annotate_files method. result = client.async_batch_annotate_files request # The returned object is of type Gapic::Operation. You can use it to # check the status of an operation, cancel it, or wait for results. # Here is how to wait for a response. result.wait_until_done! timeout: 60 if result.response? p result.response else puts "No response received." end
#async_batch_annotate_images
def async_batch_annotate_images(request, options = nil) -> ::Gapic::Operation
def async_batch_annotate_images(requests: nil, output_config: nil, parent: nil) -> ::Gapic::Operation
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.
def async_batch_annotate_images(request, options = nil) -> ::Gapic::Operation
async_batch_annotate_images
via a request object, either of type
AsyncBatchAnnotateImagesRequest or an equivalent Hash.
- request (::Google::Cloud::Vision::V1::AsyncBatchAnnotateImagesRequest, ::Hash) — A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.
- options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
def async_batch_annotate_images(requests: nil, output_config: nil, parent: nil) -> ::Gapic::Operation
async_batch_annotate_images
via keyword arguments. Note that at
least one keyword argument is required. To specify no parameters, or to keep all
the default parameter values, pass an empty Hash as a request object (see above).
- requests (::Array<::Google::Cloud::Vision::V1::AnnotateImageRequest, ::Hash>) — Required. Individual image annotation requests for this batch.
- output_config (::Google::Cloud::Vision::V1::OutputConfig, ::Hash) — Required. The desired output location and metadata (e.g. format).
-
parent (::String) — 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
.
- (result, operation) — Access the result along with the TransportOperation object
- result (::Gapic::Operation)
- operation (::Gapic::Rest::TransportOperation)
- (::Gapic::Operation)
- (::Google::Cloud::Error) — if the REST call is aborted.
Basic example
require "google/cloud/vision/v1" # Create a client object. The client can be reused for multiple calls. client = Google::Cloud::Vision::V1::ImageAnnotator::Rest::Client.new # Create a request. To set request fields, pass in keyword arguments. request = Google::Cloud::Vision::V1::AsyncBatchAnnotateImagesRequest.new # Call the async_batch_annotate_images method. result = client.async_batch_annotate_images request # The returned object is of type Gapic::Operation. You can use it to # check the status of an operation, cancel it, or wait for results. # Here is how to wait for a response. result.wait_until_done! timeout: 60 if result.response? p result.response else puts "No response received." end
#batch_annotate_files
def batch_annotate_files(request, options = nil) -> ::Google::Cloud::Vision::V1::BatchAnnotateFilesResponse
def batch_annotate_files(requests: nil, parent: nil) -> ::Google::Cloud::Vision::V1::BatchAnnotateFilesResponse
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.
def batch_annotate_files(request, options = nil) -> ::Google::Cloud::Vision::V1::BatchAnnotateFilesResponse
batch_annotate_files
via a request object, either of type
BatchAnnotateFilesRequest or an equivalent Hash.
- request (::Google::Cloud::Vision::V1::BatchAnnotateFilesRequest, ::Hash) — A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.
- options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
def batch_annotate_files(requests: nil, parent: nil) -> ::Google::Cloud::Vision::V1::BatchAnnotateFilesResponse
batch_annotate_files
via keyword arguments. Note that at
least one keyword argument is required. To specify no parameters, or to keep all
the default parameter values, pass an empty Hash as a request object (see above).
- requests (::Array<::Google::Cloud::Vision::V1::AnnotateFileRequest, ::Hash>) — Required. The list of file annotation requests. Right now we support only one AnnotateFileRequest in BatchAnnotateFilesRequest.
-
parent (::String) — 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
.
- (result, operation) — Access the result along with the TransportOperation object
- result (::Google::Cloud::Vision::V1::BatchAnnotateFilesResponse)
- operation (::Gapic::Rest::TransportOperation)
- (::Google::Cloud::Error) — if the REST call is aborted.
Basic example
require "google/cloud/vision/v1" # Create a client object. The client can be reused for multiple calls. client = Google::Cloud::Vision::V1::ImageAnnotator::Rest::Client.new # Create a request. To set request fields, pass in keyword arguments. request = Google::Cloud::Vision::V1::BatchAnnotateFilesRequest.new # Call the batch_annotate_files method. result = client.batch_annotate_files request # The returned object is of type Google::Cloud::Vision::V1::BatchAnnotateFilesResponse. p result
#batch_annotate_images
def batch_annotate_images(request, options = nil) -> ::Google::Cloud::Vision::V1::BatchAnnotateImagesResponse
def batch_annotate_images(requests: nil, parent: nil) -> ::Google::Cloud::Vision::V1::BatchAnnotateImagesResponse
Run image detection and annotation for a batch of images.
def batch_annotate_images(request, options = nil) -> ::Google::Cloud::Vision::V1::BatchAnnotateImagesResponse
batch_annotate_images
via a request object, either of type
BatchAnnotateImagesRequest or an equivalent Hash.
- request (::Google::Cloud::Vision::V1::BatchAnnotateImagesRequest, ::Hash) — A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.
- options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
def batch_annotate_images(requests: nil, parent: nil) -> ::Google::Cloud::Vision::V1::BatchAnnotateImagesResponse
batch_annotate_images
via keyword arguments. Note that at
least one keyword argument is required. To specify no parameters, or to keep all
the default parameter values, pass an empty Hash as a request object (see above).
- requests (::Array<::Google::Cloud::Vision::V1::AnnotateImageRequest, ::Hash>) — Required. Individual image annotation requests for this batch.
-
parent (::String) — 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
.
- (result, operation) — Access the result along with the TransportOperation object
- result (::Google::Cloud::Vision::V1::BatchAnnotateImagesResponse)
- operation (::Gapic::Rest::TransportOperation)
- (::Google::Cloud::Error) — if the REST call is aborted.
Basic example
require "google/cloud/vision/v1" # Create a client object. The client can be reused for multiple calls. client = Google::Cloud::Vision::V1::ImageAnnotator::Rest::Client.new # Create a request. To set request fields, pass in keyword arguments. request = Google::Cloud::Vision::V1::BatchAnnotateImagesRequest.new # Call the batch_annotate_images method. result = client.batch_annotate_images request # The returned object is of type Google::Cloud::Vision::V1::BatchAnnotateImagesResponse. p result
#configure
def configure() { |config| ... } -> Client::Configuration
Configure the ImageAnnotator Client instance.
The configuration is set to the derived mode, meaning that values can be changed, but structural changes (adding new fields, etc.) are not allowed. Structural changes should be made on Client.configure.
See Configuration for a description of the configuration fields.
- (config) — Configure the Client client.
- config (Client::Configuration)
#initialize
def initialize() { |config| ... } -> Client
Create a new ImageAnnotator REST client object.
- (config) — Configure the ImageAnnotator client.
- config (Client::Configuration)
- (Client) — a new instance of Client
# Create a client using the default configuration client = ::Google::Cloud::Vision::V1::ImageAnnotator::Rest::Client.new # Create a client using a custom configuration client = ::Google::Cloud::Vision::V1::ImageAnnotator::Rest::Client.new do |config| config.timeout = 10.0 end
#operations_client
def operations_client() -> ::Google::Cloud::Vision::V1::ImageAnnotator::Rest::Operations
Get the associated client for long-running operations.
#universe_domain
def universe_domain() -> String
The effective universe domain
- (String)