- 0.116.0 (latest)
- 0.115.1
- 0.114.0
- 0.113.0
- 0.112.2
- 0.111.0
- 0.110.10
- 0.109.0
- 0.108.0
- 0.107.0
- 0.106.0
- 0.105.0
- 0.104.0
- 0.103.0
- 0.102.1
- 0.101.1
- 0.100.2
- 0.99.0
- 0.98.0
- 0.97.0
- 0.96.0
- 0.95.0
- 0.94.1
- 0.93.3
- 0.92.3
- 0.91.1
- 0.90.0
- 0.89.0
- 0.88.0
- 0.87.0
- 0.86.0
- 0.85.0
- 0.84.0
- 0.83.0
- 0.82.0
- 0.81.0
- 0.80.0
- 0.79.0
- 0.78.0
- 0.77.0
- 0.76.0
- 0.75.0
Package documentai is an auto-generated package for the Cloud Document AI API.
Service to parse structured information from unstructured or semi-structured documents using state-of-the-art Google AI such as natural language, computer vision, translation, and AutoML.
NOTE: This package is in beta. It is not stable, and may be subject to changes.
Use of Context
The ctx passed to NewClient is used for authentication requests and for creating the underlying connection, but is not used for subsequent calls. Individual methods on the client use the ctx given to them.
To close the open connection, use the Close() method.
For information about setting deadlines, reusing contexts, and more please visit https://pkg.go.dev/cloud.google.com/go.
Functions
func DefaultAuthScopes
func DefaultAuthScopes() []string
DefaultAuthScopes reports the default set of authentication scopes to use with this package.
BatchProcessDocumentsOperation
type BatchProcessDocumentsOperation struct {
// contains filtered or unexported fields
}
BatchProcessDocumentsOperation manages a long-running operation from BatchProcessDocuments.
func (*BatchProcessDocumentsOperation) Done
func (op *BatchProcessDocumentsOperation) Done() bool
Done reports whether the long-running operation has completed.
func (*BatchProcessDocumentsOperation) Metadata
func (op *BatchProcessDocumentsOperation) Metadata() (*documentaipb.BatchProcessMetadata, error)
Metadata returns metadata associated with the long-running operation. Metadata itself does not contact the server, but Poll does. To get the latest metadata, call this method after a successful call to Poll. If the metadata is not available, the returned metadata and error are both nil.
func (*BatchProcessDocumentsOperation) Name
func (op *BatchProcessDocumentsOperation) Name() string
Name returns the name of the long-running operation. The name is assigned by the server and is unique within the service from which the operation is created.
func (*BatchProcessDocumentsOperation) Poll
func (op *BatchProcessDocumentsOperation) Poll(ctx context.Context, opts ...gax.CallOption) (*documentaipb.BatchProcessResponse, error)
Poll fetches the latest state of the long-running operation.
Poll also fetches the latest metadata, which can be retrieved by Metadata.
If Poll fails, the error is returned and op is unmodified. If Poll succeeds and the operation has completed with failure, the error is returned and op.Done will return true. If Poll succeeds and the operation has completed successfully, op.Done will return true, and the response of the operation is returned. If Poll succeeds and the operation has not completed, the returned response and error are both nil.
func (*BatchProcessDocumentsOperation) Wait
func (op *BatchProcessDocumentsOperation) Wait(ctx context.Context, opts ...gax.CallOption) (*documentaipb.BatchProcessResponse, error)
Wait blocks until the long-running operation is completed, returning the response and any errors encountered.
See documentation of Poll for error-handling information.
DeleteProcessorOperation
type DeleteProcessorOperation struct {
// contains filtered or unexported fields
}
DeleteProcessorOperation manages a long-running operation from DeleteProcessor.
func (*DeleteProcessorOperation) Done
func (op *DeleteProcessorOperation) Done() bool
Done reports whether the long-running operation has completed.
func (*DeleteProcessorOperation) Metadata
func (op *DeleteProcessorOperation) Metadata() (*documentaipb.DeleteProcessorMetadata, error)
Metadata returns metadata associated with the long-running operation. Metadata itself does not contact the server, but Poll does. To get the latest metadata, call this method after a successful call to Poll. If the metadata is not available, the returned metadata and error are both nil.
func (*DeleteProcessorOperation) Name
func (op *DeleteProcessorOperation) Name() string
Name returns the name of the long-running operation. The name is assigned by the server and is unique within the service from which the operation is created.
func (*DeleteProcessorOperation) Poll
func (op *DeleteProcessorOperation) Poll(ctx context.Context, opts ...gax.CallOption) error
Poll fetches the latest state of the long-running operation.
Poll also fetches the latest metadata, which can be retrieved by Metadata.
If Poll fails, the error is returned and op is unmodified. If Poll succeeds and the operation has completed with failure, the error is returned and op.Done will return true. If Poll succeeds and the operation has completed successfully, op.Done will return true, and the response of the operation is returned. If Poll succeeds and the operation has not completed, the returned response and error are both nil.
func (*DeleteProcessorOperation) Wait
func (op *DeleteProcessorOperation) Wait(ctx context.Context, opts ...gax.CallOption) error
Wait blocks until the long-running operation is completed, returning the response and any errors encountered.
See documentation of Poll for error-handling information.
DisableProcessorOperation
type DisableProcessorOperation struct {
// contains filtered or unexported fields
}
DisableProcessorOperation manages a long-running operation from DisableProcessor.
func (*DisableProcessorOperation) Done
func (op *DisableProcessorOperation) Done() bool
Done reports whether the long-running operation has completed.
func (*DisableProcessorOperation) Metadata
func (op *DisableProcessorOperation) Metadata() (*documentaipb.DisableProcessorMetadata, error)
Metadata returns metadata associated with the long-running operation. Metadata itself does not contact the server, but Poll does. To get the latest metadata, call this method after a successful call to Poll. If the metadata is not available, the returned metadata and error are both nil.
func (*DisableProcessorOperation) Name
func (op *DisableProcessorOperation) Name() string
Name returns the name of the long-running operation. The name is assigned by the server and is unique within the service from which the operation is created.
func (*DisableProcessorOperation) Poll
func (op *DisableProcessorOperation) Poll(ctx context.Context, opts ...gax.CallOption) (*documentaipb.DisableProcessorResponse, error)
Poll fetches the latest state of the long-running operation.
Poll also fetches the latest metadata, which can be retrieved by Metadata.
If Poll fails, the error is returned and op is unmodified. If Poll succeeds and the operation has completed with failure, the error is returned and op.Done will return true. If Poll succeeds and the operation has completed successfully, op.Done will return true, and the response of the operation is returned. If Poll succeeds and the operation has not completed, the returned response and error are both nil.
func (*DisableProcessorOperation) Wait
func (op *DisableProcessorOperation) Wait(ctx context.Context, opts ...gax.CallOption) (*documentaipb.DisableProcessorResponse, error)
Wait blocks until the long-running operation is completed, returning the response and any errors encountered.
See documentation of Poll for error-handling information.
DocumentProcessorCallOptions
type DocumentProcessorCallOptions struct {
ProcessDocument []gax.CallOption
BatchProcessDocuments []gax.CallOption
FetchProcessorTypes []gax.CallOption
ListProcessors []gax.CallOption
CreateProcessor []gax.CallOption
DeleteProcessor []gax.CallOption
EnableProcessor []gax.CallOption
DisableProcessor []gax.CallOption
ReviewDocument []gax.CallOption
}
DocumentProcessorCallOptions contains the retry settings for each method of DocumentProcessorClient.
DocumentProcessorClient
type DocumentProcessorClient struct {
// The call options for this service.
CallOptions *DocumentProcessorCallOptions
// LROClient is used internally to handle long-running operations.
// It is exposed so that its CallOptions can be modified if required.
// Users should not Close this client.
LROClient *lroauto.OperationsClient
// contains filtered or unexported fields
}
DocumentProcessorClient is a client for interacting with Cloud Document AI API. Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.
Service to call Cloud DocumentAI to process documents according to the processor’s definition. Processors are built using state-of-the-art Google AI such as natural language, computer vision, and translation to extract structured information from unstructured or semi-structured documents.
func NewDocumentProcessorClient
func NewDocumentProcessorClient(ctx context.Context, opts ...option.ClientOption) (*DocumentProcessorClient, error)
NewDocumentProcessorClient creates a new document processor service client based on gRPC. The returned client must be Closed when it is done being used to clean up its underlying connections.
Service to call Cloud DocumentAI to process documents according to the processor’s definition. Processors are built using state-of-the-art Google AI such as natural language, computer vision, and translation to extract structured information from unstructured or semi-structured documents.
Example
package main
import (
"context"
documentai "cloud.google.com/go/documentai/apiv1beta3"
)
func main() {
ctx := context.Background()
c, err := documentai.NewDocumentProcessorClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
// TODO: Use client.
_ = c
}
func (*DocumentProcessorClient) BatchProcessDocuments
func (c *DocumentProcessorClient) BatchProcessDocuments(ctx context.Context, req *documentaipb.BatchProcessRequest, opts ...gax.CallOption) (*BatchProcessDocumentsOperation, error)
BatchProcessDocuments lRO endpoint to batch process many documents. The output is written to Cloud Storage as JSON in the [Document] format.
Example
package main
import (
"context"
documentai "cloud.google.com/go/documentai/apiv1beta3"
documentaipb "google.golang.org/genproto/googleapis/cloud/documentai/v1beta3"
)
func main() {
ctx := context.Background()
c, err := documentai.NewDocumentProcessorClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &documentaipb.BatchProcessRequest{
// TODO: Fill request struct fields.
}
op, err := c.BatchProcessDocuments(ctx, req)
if err != nil {
// TODO: Handle error.
}
resp, err := op.Wait(ctx)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*DocumentProcessorClient) BatchProcessDocumentsOperation
func (c *DocumentProcessorClient) BatchProcessDocumentsOperation(name string) *BatchProcessDocumentsOperation
BatchProcessDocumentsOperation returns a new BatchProcessDocumentsOperation from a given name. The name must be that of a previously created BatchProcessDocumentsOperation, possibly from a different process.
func (*DocumentProcessorClient) Close
func (c *DocumentProcessorClient) Close() error
Close closes the connection to the API service. The user should invoke this when the client is no longer required.
func (*DocumentProcessorClient) Connection
func (c *DocumentProcessorClient) Connection() *grpc.ClientConn
Connection returns a connection to the API service.
Deprecated.
func (*DocumentProcessorClient) CreateProcessor
func (c *DocumentProcessorClient) CreateProcessor(ctx context.Context, req *documentaipb.CreateProcessorRequest, opts ...gax.CallOption) (*documentaipb.Processor, error)
CreateProcessor creates a processor from the type processor that the user chose. The processor will be at “ENABLED” state by default after its creation.
Example
package main
import (
"context"
documentai "cloud.google.com/go/documentai/apiv1beta3"
documentaipb "google.golang.org/genproto/googleapis/cloud/documentai/v1beta3"
)
func main() {
ctx := context.Background()
c, err := documentai.NewDocumentProcessorClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &documentaipb.CreateProcessorRequest{
// TODO: Fill request struct fields.
}
resp, err := c.CreateProcessor(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*DocumentProcessorClient) DeleteProcessor
func (c *DocumentProcessorClient) DeleteProcessor(ctx context.Context, req *documentaipb.DeleteProcessorRequest, opts ...gax.CallOption) (*DeleteProcessorOperation, error)
DeleteProcessor deletes the processor, unloads all deployed model artifacts if it was enabled and then deletes all artifacts associated with this processor.
Example
package main
import (
"context"
documentai "cloud.google.com/go/documentai/apiv1beta3"
documentaipb "google.golang.org/genproto/googleapis/cloud/documentai/v1beta3"
)
func main() {
ctx := context.Background()
c, err := documentai.NewDocumentProcessorClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &documentaipb.DeleteProcessorRequest{
// TODO: Fill request struct fields.
}
op, err := c.DeleteProcessor(ctx, req)
if err != nil {
// TODO: Handle error.
}
err = op.Wait(ctx)
if err != nil {
// TODO: Handle error.
}
}
func (*DocumentProcessorClient) DeleteProcessorOperation
func (c *DocumentProcessorClient) DeleteProcessorOperation(name string) *DeleteProcessorOperation
DeleteProcessorOperation returns a new DeleteProcessorOperation from a given name. The name must be that of a previously created DeleteProcessorOperation, possibly from a different process.
func (*DocumentProcessorClient) DisableProcessor
func (c *DocumentProcessorClient) DisableProcessor(ctx context.Context, req *documentaipb.DisableProcessorRequest, opts ...gax.CallOption) (*DisableProcessorOperation, error)
DisableProcessor disables a processor
Example
package main
import (
"context"
documentai "cloud.google.com/go/documentai/apiv1beta3"
documentaipb "google.golang.org/genproto/googleapis/cloud/documentai/v1beta3"
)
func main() {
ctx := context.Background()
c, err := documentai.NewDocumentProcessorClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &documentaipb.DisableProcessorRequest{
// TODO: Fill request struct fields.
}
op, err := c.DisableProcessor(ctx, req)
if err != nil {
// TODO: Handle error.
}
resp, err := op.Wait(ctx)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*DocumentProcessorClient) DisableProcessorOperation
func (c *DocumentProcessorClient) DisableProcessorOperation(name string) *DisableProcessorOperation
DisableProcessorOperation returns a new DisableProcessorOperation from a given name. The name must be that of a previously created DisableProcessorOperation, possibly from a different process.
func (*DocumentProcessorClient) EnableProcessor
func (c *DocumentProcessorClient) EnableProcessor(ctx context.Context, req *documentaipb.EnableProcessorRequest, opts ...gax.CallOption) (*EnableProcessorOperation, error)
EnableProcessor enables a processor
Example
package main
import (
"context"
documentai "cloud.google.com/go/documentai/apiv1beta3"
documentaipb "google.golang.org/genproto/googleapis/cloud/documentai/v1beta3"
)
func main() {
ctx := context.Background()
c, err := documentai.NewDocumentProcessorClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &documentaipb.EnableProcessorRequest{
// TODO: Fill request struct fields.
}
op, err := c.EnableProcessor(ctx, req)
if err != nil {
// TODO: Handle error.
}
resp, err := op.Wait(ctx)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*DocumentProcessorClient) EnableProcessorOperation
func (c *DocumentProcessorClient) EnableProcessorOperation(name string) *EnableProcessorOperation
EnableProcessorOperation returns a new EnableProcessorOperation from a given name. The name must be that of a previously created EnableProcessorOperation, possibly from a different process.
func (*DocumentProcessorClient) FetchProcessorTypes
func (c *DocumentProcessorClient) FetchProcessorTypes(ctx context.Context, req *documentaipb.FetchProcessorTypesRequest, opts ...gax.CallOption) (*documentaipb.FetchProcessorTypesResponse, error)
FetchProcessorTypes fetches processor types.
Example
package main
import (
"context"
documentai "cloud.google.com/go/documentai/apiv1beta3"
documentaipb "google.golang.org/genproto/googleapis/cloud/documentai/v1beta3"
)
func main() {
ctx := context.Background()
c, err := documentai.NewDocumentProcessorClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &documentaipb.FetchProcessorTypesRequest{
// TODO: Fill request struct fields.
}
resp, err := c.FetchProcessorTypes(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*DocumentProcessorClient) ListProcessors
func (c *DocumentProcessorClient) ListProcessors(ctx context.Context, req *documentaipb.ListProcessorsRequest, opts ...gax.CallOption) *ProcessorIterator
ListProcessors lists all processors which belong to this project.
Example
package main
import (
"context"
documentai "cloud.google.com/go/documentai/apiv1beta3"
"google.golang.org/api/iterator"
documentaipb "google.golang.org/genproto/googleapis/cloud/documentai/v1beta3"
)
func main() {
ctx := context.Background()
c, err := documentai.NewDocumentProcessorClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &documentaipb.ListProcessorsRequest{
// TODO: Fill request struct fields.
}
it := c.ListProcessors(ctx, req)
for {
resp, err := it.Next()
if err == iterator.Done {
break
}
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
}
func (*DocumentProcessorClient) ProcessDocument
func (c *DocumentProcessorClient) ProcessDocument(ctx context.Context, req *documentaipb.ProcessRequest, opts ...gax.CallOption) (*documentaipb.ProcessResponse, error)
ProcessDocument processes a single document.
Example
package main
import (
"context"
documentai "cloud.google.com/go/documentai/apiv1beta3"
documentaipb "google.golang.org/genproto/googleapis/cloud/documentai/v1beta3"
)
func main() {
ctx := context.Background()
c, err := documentai.NewDocumentProcessorClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &documentaipb.ProcessRequest{
// TODO: Fill request struct fields.
}
resp, err := c.ProcessDocument(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*DocumentProcessorClient) ReviewDocument
func (c *DocumentProcessorClient) ReviewDocument(ctx context.Context, req *documentaipb.ReviewDocumentRequest, opts ...gax.CallOption) (*ReviewDocumentOperation, error)
ReviewDocument send a document for Human Review. The input document should be processed by the specified processor.
Example
package main
import (
"context"
documentai "cloud.google.com/go/documentai/apiv1beta3"
documentaipb "google.golang.org/genproto/googleapis/cloud/documentai/v1beta3"
)
func main() {
ctx := context.Background()
c, err := documentai.NewDocumentProcessorClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &documentaipb.ReviewDocumentRequest{
// TODO: Fill request struct fields.
}
op, err := c.ReviewDocument(ctx, req)
if err != nil {
// TODO: Handle error.
}
resp, err := op.Wait(ctx)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*DocumentProcessorClient) ReviewDocumentOperation
func (c *DocumentProcessorClient) ReviewDocumentOperation(name string) *ReviewDocumentOperation
ReviewDocumentOperation returns a new ReviewDocumentOperation from a given name. The name must be that of a previously created ReviewDocumentOperation, possibly from a different process.
EnableProcessorOperation
type EnableProcessorOperation struct {
// contains filtered or unexported fields
}
EnableProcessorOperation manages a long-running operation from EnableProcessor.
func (*EnableProcessorOperation) Done
func (op *EnableProcessorOperation) Done() bool
Done reports whether the long-running operation has completed.
func (*EnableProcessorOperation) Metadata
func (op *EnableProcessorOperation) Metadata() (*documentaipb.EnableProcessorMetadata, error)
Metadata returns metadata associated with the long-running operation. Metadata itself does not contact the server, but Poll does. To get the latest metadata, call this method after a successful call to Poll. If the metadata is not available, the returned metadata and error are both nil.
func (*EnableProcessorOperation) Name
func (op *EnableProcessorOperation) Name() string
Name returns the name of the long-running operation. The name is assigned by the server and is unique within the service from which the operation is created.
func (*EnableProcessorOperation) Poll
func (op *EnableProcessorOperation) Poll(ctx context.Context, opts ...gax.CallOption) (*documentaipb.EnableProcessorResponse, error)
Poll fetches the latest state of the long-running operation.
Poll also fetches the latest metadata, which can be retrieved by Metadata.
If Poll fails, the error is returned and op is unmodified. If Poll succeeds and the operation has completed with failure, the error is returned and op.Done will return true. If Poll succeeds and the operation has completed successfully, op.Done will return true, and the response of the operation is returned. If Poll succeeds and the operation has not completed, the returned response and error are both nil.
func (*EnableProcessorOperation) Wait
func (op *EnableProcessorOperation) Wait(ctx context.Context, opts ...gax.CallOption) (*documentaipb.EnableProcessorResponse, error)
Wait blocks until the long-running operation is completed, returning the response and any errors encountered.
See documentation of Poll for error-handling information.
ProcessorIterator
type ProcessorIterator struct {
// Response is the raw response for the current page.
// It must be cast to the RPC response type.
// Calling Next() or InternalFetch() updates this value.
Response interface{}
// InternalFetch is for use by the Google Cloud Libraries only.
// It is not part of the stable interface of this package.
//
// InternalFetch returns results from a single call to the underlying RPC.
// The number of results is no greater than pageSize.
// If there are no more results, nextPageToken is empty and err is nil.
InternalFetch func(pageSize int, pageToken string) (results []*documentaipb.Processor, nextPageToken string, err error)
// contains filtered or unexported fields
}
ProcessorIterator manages a stream of *documentaipb.Processor.
func (*ProcessorIterator) Next
func (it *ProcessorIterator) Next() (*documentaipb.Processor, error)
Next returns the next result. Its second return value is iterator.Done if there are no more results. Once Next returns Done, all subsequent calls will return Done.
func (*ProcessorIterator) PageInfo
func (it *ProcessorIterator) PageInfo() *iterator.PageInfo
PageInfo supports pagination. See the google.golang.org/api/iterator package for details.
ReviewDocumentOperation
type ReviewDocumentOperation struct {
// contains filtered or unexported fields
}
ReviewDocumentOperation manages a long-running operation from ReviewDocument.
func (*ReviewDocumentOperation) Done
func (op *ReviewDocumentOperation) Done() bool
Done reports whether the long-running operation has completed.
func (*ReviewDocumentOperation) Metadata
func (op *ReviewDocumentOperation) Metadata() (*documentaipb.ReviewDocumentOperationMetadata, error)
Metadata returns metadata associated with the long-running operation. Metadata itself does not contact the server, but Poll does. To get the latest metadata, call this method after a successful call to Poll. If the metadata is not available, the returned metadata and error are both nil.
func (*ReviewDocumentOperation) Name
func (op *ReviewDocumentOperation) Name() string
Name returns the name of the long-running operation. The name is assigned by the server and is unique within the service from which the operation is created.
func (*ReviewDocumentOperation) Poll
func (op *ReviewDocumentOperation) Poll(ctx context.Context, opts ...gax.CallOption) (*documentaipb.ReviewDocumentResponse, error)
Poll fetches the latest state of the long-running operation.
Poll also fetches the latest metadata, which can be retrieved by Metadata.
If Poll fails, the error is returned and op is unmodified. If Poll succeeds and the operation has completed with failure, the error is returned and op.Done will return true. If Poll succeeds and the operation has completed successfully, op.Done will return true, and the response of the operation is returned. If Poll succeeds and the operation has not completed, the returned response and error are both nil.
func (*ReviewDocumentOperation) Wait
func (op *ReviewDocumentOperation) Wait(ctx context.Context, opts ...gax.CallOption) (*documentaipb.ReviewDocumentResponse, error)
Wait blocks until the long-running operation is completed, returning the response and any errors encountered.
See documentation of Poll for error-handling information.