Packages

Google Cloud Vision API client library.

Current section

Files

Jump to
googly_cloud_vision lib googly cloud_vision projects files.ex
Raw

lib/googly/cloud_vision/projects/files.ex

# NOTE: This file is auto generated by googly. Do not edit it manually.
defmodule Googly.CloudVision.Projects.Files do
@moduledoc """
Endpoints for the `Projects.Files` resource.
"""
alias Googly.CloudVision.Request
@doc """
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.
## Parameters
* `parent` (*type:* `String.t()`) - 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`.
* `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.BatchAnnotateFilesRequest.t()`) -
## Returns
* `{:ok, %Googly.CloudVision.Model.BatchAnnotateFilesResponse{}}` on success
* `{:error, %Googly.CloudVision.Error{}}` on failure
"""
@spec annotate(String.t(), keyword()) ::
{:ok, Googly.CloudVision.Model.BatchAnnotateFilesResponse.t()} | {:error, term()}
def annotate(parent, opts \\ []) do
Request.run(
method: :post,
url: "/v1/{+parent}/files:annotate",
path_params: %{"parent" => URI.encode(parent, &(URI.char_unreserved?(&1) or &1 == ?/))},
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.BatchAnnotateFilesResponse,
opts: opts
)
end
@doc """
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).
## Parameters
* `parent` (*type:* `String.t()`) - 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`.
* `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.AsyncBatchAnnotateFilesRequest.t()`) -
## Returns
* `{:ok, %Googly.CloudVision.Model.Operation{}}` on success
* `{:error, %Googly.CloudVision.Error{}}` on failure
"""
@spec async_batch_annotate(String.t(), keyword()) ::
{:ok, Googly.CloudVision.Model.Operation.t()} | {:error, term()}
def async_batch_annotate(parent, opts \\ []) do
Request.run(
method: :post,
url: "/v1/{+parent}/files:asyncBatchAnnotate",
path_params: %{"parent" => URI.encode(parent, &(URI.char_unreserved?(&1) or &1 == ?/))},
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