Packages

Google Cloud Vision API client library.

Current section

Files

Jump to
googly_cloud_vision lib googly cloud_vision images.ex
Raw

lib/googly/cloud_vision/images.ex

# NOTE: This file is auto generated by googly. Do not edit it manually.
defmodule Googly.CloudVision.Images do
@moduledoc """
Endpoints for the `Images` resource.
"""
alias Googly.CloudVision.Request
@doc """
Run image detection and annotation for a batch of images.
## Parameters
* `opts` (*type:* `keyword()`) - Query and call options (`:token`, plus any of the below)
* `access_token` (*type:* `String.t()`) - OAuth access token.
* `alt` (*type:* `String.t()`) - Data format for response.
* `callback` (*type:* `String.t()`) - JSONP
* `fields` (*type:* `String.t()`) - Selector specifying which fields to include in a partial response.
* `key` (*type:* `String.t()`) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
* `oauth_token` (*type:* `String.t()`) - OAuth 2.0 token for the current user.
* `pretty_print` (*type:* `boolean()`) - Returns response with indentations and line breaks.
* `quota_user` (*type:* `String.t()`) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
* `upload_protocol` (*type:* `String.t()`) - Upload protocol for media (e.g. "raw", "multipart").
* `upload_type` (*type:* `String.t()`) - Legacy upload protocol for media (e.g. "media", "multipart").
* `xgafv` (*type:* `String.t()`) - V1 error format.
* `body` (*type:* `Googly.CloudVision.Model.BatchAnnotateImagesRequest.t()`) -
## Returns
* `{:ok, %Googly.CloudVision.Model.BatchAnnotateImagesResponse{}}` on success
* `{:error, %Googly.CloudVision.Error{}}` on failure
"""
@spec annotate(keyword()) ::
{:ok, Googly.CloudVision.Model.BatchAnnotateImagesResponse.t()} | {:error, term()}
def annotate(opts \\ []) do
Request.run(
method: :post,
url: "/v1/images:annotate",
path_params: %{},
query: [],
params: %{
access_token: {:query, "access_token"},
alt: {:query, "alt"},
callback: {:query, "callback"},
fields: {:query, "fields"},
key: {:query, "key"},
oauth_token: {:query, "oauth_token"},
pretty_print: {:query, "prettyPrint"},
quota_user: {:query, "quotaUser"},
upload_protocol: {:query, "upload_protocol"},
upload_type: {:query, "uploadType"},
xgafv: {:query, "$.xgafv"},
body: {:body, nil}
},
decode: Googly.CloudVision.Model.BatchAnnotateImagesResponse,
opts: opts
)
end
@doc """
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.
## Parameters
* `opts` (*type:* `keyword()`) - Query and call options (`:token`, plus any of the below)
* `access_token` (*type:* `String.t()`) - OAuth access token.
* `alt` (*type:* `String.t()`) - Data format for response.
* `callback` (*type:* `String.t()`) - JSONP
* `fields` (*type:* `String.t()`) - Selector specifying which fields to include in a partial response.
* `key` (*type:* `String.t()`) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
* `oauth_token` (*type:* `String.t()`) - OAuth 2.0 token for the current user.
* `pretty_print` (*type:* `boolean()`) - Returns response with indentations and line breaks.
* `quota_user` (*type:* `String.t()`) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
* `upload_protocol` (*type:* `String.t()`) - Upload protocol for media (e.g. "raw", "multipart").
* `upload_type` (*type:* `String.t()`) - Legacy upload protocol for media (e.g. "media", "multipart").
* `xgafv` (*type:* `String.t()`) - V1 error format.
* `body` (*type:* `Googly.CloudVision.Model.AsyncBatchAnnotateImagesRequest.t()`) -
## Returns
* `{:ok, %Googly.CloudVision.Model.Operation{}}` on success
* `{:error, %Googly.CloudVision.Error{}}` on failure
"""
@spec async_batch_annotate(keyword()) ::
{:ok, Googly.CloudVision.Model.Operation.t()} | {:error, term()}
def async_batch_annotate(opts \\ []) do
Request.run(
method: :post,
url: "/v1/images:asyncBatchAnnotate",
path_params: %{},
query: [],
params: %{
access_token: {:query, "access_token"},
alt: {:query, "alt"},
callback: {:query, "callback"},
fields: {:query, "fields"},
key: {:query, "key"},
oauth_token: {:query, "oauth_token"},
pretty_print: {:query, "prettyPrint"},
quota_user: {:query, "quotaUser"},
upload_protocol: {:query, "upload_protocol"},
upload_type: {:query, "uploadType"},
xgafv: {:query, "$.xgafv"},
body: {:body, nil}
},
decode: Googly.CloudVision.Model.Operation,
opts: opts
)
end
end