Packages

Google Cloud Document AI API client library.

Current section

Files

Jump to
googly_document_ai lib googly document_ai projects locations processors.ex
Raw

lib/googly/document_ai/projects/locations/processors.ex

# NOTE: This file is auto generated by googly. Do not edit it manually.
defmodule Googly.DocumentAI.Projects.Locations.Processors do
@moduledoc """
Endpoints for the `Projects.Locations.Processors` resource.
"""
alias Googly.DocumentAI.Request
@doc """
LRO endpoint to batch process many documents. The output is written to Cloud Storage as JSON in the [Document] format.
## Parameters
* `name` (*type:* `String.t()`) - Required. The resource name of Processor or ProcessorVersion. Format: `projects/{project}/locations/{location}/processors/{processor}`, or `projects/{project}/locations/{location}/processors/{processor}/processorVersions/{processorVersion}`
* `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.DocumentAI.Model.GoogleCloudDocumentaiV1BatchProcessRequest.t()`) -
## Returns
* `{:ok, %Googly.DocumentAI.Model.GoogleLongrunningOperation{}}` on success
* `{:error, %Googly.DocumentAI.Error{}}` on failure
"""
@spec batch_process(String.t(), keyword()) ::
{:ok, Googly.DocumentAI.Model.GoogleLongrunningOperation.t()} | {:error, term()}
def batch_process(name, opts \\ []) do
Request.run(
method: :post,
url: "/v1/{+name}:batchProcess",
path_params: %{"name" => URI.encode(name, &(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.DocumentAI.Model.GoogleLongrunningOperation,
opts: opts
)
end
@doc """
Creates a processor from the ProcessorType provided. The processor will be at `ENABLED` state by default after its creation. Note that this method requires the `documentai.processors.create` permission on the project, which is highly privileged. A user or service account with this permission can create new processors that can interact with any gcs bucket in your project.
## Parameters
* `parent` (*type:* `String.t()`) - Required. The parent (project and location) under which to create the processor. Format: `projects/{project}/locations/{location}`
* `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.DocumentAI.Model.GoogleCloudDocumentaiV1Processor.t()`) -
## Returns
* `{:ok, %Googly.DocumentAI.Model.GoogleCloudDocumentaiV1Processor{}}` on success
* `{:error, %Googly.DocumentAI.Error{}}` on failure
"""
@spec create(String.t(), keyword()) ::
{:ok, Googly.DocumentAI.Model.GoogleCloudDocumentaiV1Processor.t()} | {:error, term()}
def create(parent, opts \\ []) do
Request.run(
method: :post,
url: "/v1/{+parent}/processors",
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.DocumentAI.Model.GoogleCloudDocumentaiV1Processor,
opts: opts
)
end
@doc """
Deletes the processor, unloads all deployed model artifacts if it was enabled and then deletes all artifacts associated with this processor.
## Parameters
* `name` (*type:* `String.t()`) - Required. The processor resource name to be deleted.
* `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.
## Returns
* `{:ok, %Googly.DocumentAI.Model.GoogleLongrunningOperation{}}` on success
* `{:error, %Googly.DocumentAI.Error{}}` on failure
"""
@spec delete(String.t(), keyword()) ::
{:ok, Googly.DocumentAI.Model.GoogleLongrunningOperation.t()} | {:error, term()}
def delete(name, opts \\ []) do
Request.run(
method: :delete,
url: "/v1/{+name}",
path_params: %{"name" => URI.encode(name, &(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"}
},
decode: Googly.DocumentAI.Model.GoogleLongrunningOperation,
opts: opts
)
end
@doc """
Disables a processor
## Parameters
* `name` (*type:* `String.t()`) - Required. The processor resource name to be disabled.
* `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.DocumentAI.Model.GoogleCloudDocumentaiV1DisableProcessorRequest.t()`) -
## Returns
* `{:ok, %Googly.DocumentAI.Model.GoogleLongrunningOperation{}}` on success
* `{:error, %Googly.DocumentAI.Error{}}` on failure
"""
@spec disable(String.t(), keyword()) ::
{:ok, Googly.DocumentAI.Model.GoogleLongrunningOperation.t()} | {:error, term()}
def disable(name, opts \\ []) do
Request.run(
method: :post,
url: "/v1/{+name}:disable",
path_params: %{"name" => URI.encode(name, &(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.DocumentAI.Model.GoogleLongrunningOperation,
opts: opts
)
end
@doc """
Enables a processor
## Parameters
* `name` (*type:* `String.t()`) - Required. The processor resource name to be enabled.
* `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.DocumentAI.Model.GoogleCloudDocumentaiV1EnableProcessorRequest.t()`) -
## Returns
* `{:ok, %Googly.DocumentAI.Model.GoogleLongrunningOperation{}}` on success
* `{:error, %Googly.DocumentAI.Error{}}` on failure
"""
@spec enable(String.t(), keyword()) ::
{:ok, Googly.DocumentAI.Model.GoogleLongrunningOperation.t()} | {:error, term()}
def enable(name, opts \\ []) do
Request.run(
method: :post,
url: "/v1/{+name}:enable",
path_params: %{"name" => URI.encode(name, &(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.DocumentAI.Model.GoogleLongrunningOperation,
opts: opts
)
end
@doc """
Gets a processor detail.
## Parameters
* `name` (*type:* `String.t()`) - Required. The processor resource name.
* `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.
## Returns
* `{:ok, %Googly.DocumentAI.Model.GoogleCloudDocumentaiV1Processor{}}` on success
* `{:error, %Googly.DocumentAI.Error{}}` on failure
"""
@spec get(String.t(), keyword()) ::
{:ok, Googly.DocumentAI.Model.GoogleCloudDocumentaiV1Processor.t()} | {:error, term()}
def get(name, opts \\ []) do
Request.run(
method: :get,
url: "/v1/{+name}",
path_params: %{"name" => URI.encode(name, &(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"}
},
decode: Googly.DocumentAI.Model.GoogleCloudDocumentaiV1Processor,
opts: opts
)
end
@doc """
Lists all processors which belong to this project.
## Parameters
* `parent` (*type:* `String.t()`) - Required. The parent (project and location) which owns this collection of Processors. Format: `projects/{project}/locations/{location}`
* `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.
* `page_size` (*type:* `integer()`) - The maximum number of processors to return. If unspecified, at most `50` processors will be returned. The maximum value is `100`. Values above `100` will be coerced to `100`.
* `page_token` (*type:* `String.t()`) - We will return the processors sorted by creation time. The page token will point to the next processor.
## Returns
* `{:ok, %Googly.DocumentAI.Model.GoogleCloudDocumentaiV1ListProcessorsResponse{}}` on success
* `{:error, %Googly.DocumentAI.Error{}}` on failure
"""
@spec list(String.t(), keyword()) ::
{:ok, Googly.DocumentAI.Model.GoogleCloudDocumentaiV1ListProcessorsResponse.t()}
| {:error, term()}
def list(parent, opts \\ []) do
Request.run(
method: :get,
url: "/v1/{+parent}/processors",
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"},
page_size: {:query, "pageSize"},
page_token: {:query, "pageToken"}
},
decode: Googly.DocumentAI.Model.GoogleCloudDocumentaiV1ListProcessorsResponse,
opts: opts
)
end
@doc """
Processes a single document.
## Parameters
* `name` (*type:* `String.t()`) - Required. The resource name of the Processor or ProcessorVersion to use for processing. If a Processor is specified, the server will use its default version. Format: `projects/{project}/locations/{location}/processors/{processor}`, or `projects/{project}/locations/{location}/processors/{processor}/processorVersions/{processorVersion}`
* `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.DocumentAI.Model.GoogleCloudDocumentaiV1ProcessRequest.t()`) -
## Returns
* `{:ok, %Googly.DocumentAI.Model.GoogleCloudDocumentaiV1ProcessResponse{}}` on success
* `{:error, %Googly.DocumentAI.Error{}}` on failure
"""
@spec process(String.t(), keyword()) ::
{:ok, Googly.DocumentAI.Model.GoogleCloudDocumentaiV1ProcessResponse.t()}
| {:error, term()}
def process(name, opts \\ []) do
Request.run(
method: :post,
url: "/v1/{+name}:process",
path_params: %{"name" => URI.encode(name, &(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.DocumentAI.Model.GoogleCloudDocumentaiV1ProcessResponse,
opts: opts
)
end
@doc """
Set the default (active) version of a Processor that will be used in ProcessDocument and BatchProcessDocuments.
## Parameters
* `processor` (*type:* `String.t()`) - Required. The resource name of the Processor to change default version.
* `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.DocumentAI.Model.GoogleCloudDocumentaiV1SetDefaultProcessorVersionRequest.t()`) -
## Returns
* `{:ok, %Googly.DocumentAI.Model.GoogleLongrunningOperation{}}` on success
* `{:error, %Googly.DocumentAI.Error{}}` on failure
"""
@spec set_default_processor_version(String.t(), keyword()) ::
{:ok, Googly.DocumentAI.Model.GoogleLongrunningOperation.t()} | {:error, term()}
def set_default_processor_version(processor, opts \\ []) do
Request.run(
method: :post,
url: "/v1/{+processor}:setDefaultProcessorVersion",
path_params: %{
"processor" => URI.encode(processor, &(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.DocumentAI.Model.GoogleLongrunningOperation,
opts: opts
)
end
end