Class v1.DocumentServiceClient (1.7.0)

This service lets you manage document. v1

Package

@google-cloud/contentwarehouse

Constructors

(constructor)(opts, gaxInstance)

constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback);

Construct an instance of DocumentServiceClient.

Parameters
NameDescription
opts ClientOptions
gaxInstance typeof gax | typeof fallback

: loaded instance of google-gax. Useful if you need to avoid loading the default gRPC version and want to use the fallback HTTP implementation. Load only fallback version and pass it to the constructor: ``` const gax = require('google-gax/build/src/fallback'); // avoids loading google-gax with gRPC const client = new DocumentServiceClient({fallback: true}, gax); ```

Properties

apiEndpoint

get apiEndpoint(): string;

The DNS address for this API service.

apiEndpoint

static get apiEndpoint(): string;

The DNS address for this API service - same as servicePath.

auth

auth: gax.GoogleAuth;

descriptors

descriptors: Descriptors;

documentServiceStub

documentServiceStub?: Promise<{
        [name: string]: Function;
    }>;

innerApiCalls

innerApiCalls: {
        [name: string]: Function;
    };

pathTemplates

pathTemplates: {
        [name: string]: gax.PathTemplate;
    };

port

static get port(): number;

The port for this API service.

scopes

static get scopes(): string[];

The scopes needed to make gRPC calls for every method defined in this service.

servicePath

static get servicePath(): string;

The DNS address for this API service.

universeDomain

get universeDomain(): string;

warn

warn: (code: string, message: string, warnType?: string) => void;

Methods

close()

close(): Promise<void>;

Terminate the gRPC channel and close the client.

The client will no longer be usable and all future behavior is undefined.

Returns
TypeDescription
Promise<void>

{Promise} A promise that resolves when the client is closed.

createDocument(request, options)

createDocument(request?: protos.google.cloud.contentwarehouse.v1.ICreateDocumentRequest, options?: CallOptions): Promise<[
        protos.google.cloud.contentwarehouse.v1.ICreateDocumentResponse,
        (protos.google.cloud.contentwarehouse.v1.ICreateDocumentRequest | undefined),
        {} | undefined
    ]>;

Creates a document.

Parameters
NameDescription
request ICreateDocumentRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
TypeDescription
Promise<[ protos.google.cloud.contentwarehouse.v1.ICreateDocumentResponse, (protos.google.cloud.contentwarehouse.v1.ICreateDocumentRequest | undefined), {} | undefined ]>

{Promise} - The promise which resolves to an array. The first element of the array is an object representing CreateDocumentResponse. Please see the documentation for more details and examples.

Example

  /**
   * This snippet has been automatically generated and should be regarded as a code template only.
   * It will require modifications to work.
   * It may require correct/in-range values for request initialization.
   * TODO(developer): Uncomment these variables before running the sample.
   */
  /**
   *  Required. The parent name.
   *  Format: projects/{project_number}/locations/{location}.
   */
  // const parent = 'abc123'
  /**
   *  Required. The document to create.
   */
  // const document = {}
  /**
   *  The meta information collected about the end user, used to enforce access
   *  control for the service.
   */
  // const requestMetadata = {}
  /**
   *  Default document policy during creation.
   *  This refers to an Identity and Access (IAM) policy, which specifies access
   *  controls for the Document.
   *  Conditions defined in the policy will be ignored.
   */
  // const policy = {}
  /**
   *  Request Option for processing Cloud AI Document in Document Warehouse.
   *  This field offers limited support for mapping entities from Cloud AI
   *  Document to Warehouse Document. Please consult with product team before
   *  using this field and other available options.
   */
  // const cloudAiDocumentOption = {}
  /**
   *  Field mask for creating Document fields. If mask path is empty,
   *  it means all fields are masked.
   *  For the `FieldMask` definition,
   *  see
   *  https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#fieldmask.
   */
  // const createMask = {}

  // Imports the Contentwarehouse library
  const {DocumentServiceClient} = require('@google-cloud/contentwarehouse').v1;

  // Instantiates a client
  const contentwarehouseClient = new DocumentServiceClient();

  async function callCreateDocument() {
    // Construct request
    const request = {
      parent,
      document,
    };

    // Run request
    const response = await contentwarehouseClient.createDocument(request);
    console.log(response);
  }

  callCreateDocument();

createDocument(request, options, callback)

createDocument(request: protos.google.cloud.contentwarehouse.v1.ICreateDocumentRequest, options: CallOptions, callback: Callback<protos.google.cloud.contentwarehouse.v1.ICreateDocumentResponse, protos.google.cloud.contentwarehouse.v1.ICreateDocumentRequest | null | undefined, {} | null | undefined>): void;
Parameters
NameDescription
request ICreateDocumentRequest
options CallOptions
callback Callback<protos.google.cloud.contentwarehouse.v1.ICreateDocumentResponse, protos.google.cloud.contentwarehouse.v1.ICreateDocumentRequest | null | undefined, {} | null | undefined>
Returns
TypeDescription
void

createDocument(request, callback)

createDocument(request: protos.google.cloud.contentwarehouse.v1.ICreateDocumentRequest, callback: Callback<protos.google.cloud.contentwarehouse.v1.ICreateDocumentResponse, protos.google.cloud.contentwarehouse.v1.ICreateDocumentRequest | null | undefined, {} | null | undefined>): void;
Parameters
NameDescription
request ICreateDocumentRequest
callback Callback<protos.google.cloud.contentwarehouse.v1.ICreateDocumentResponse, protos.google.cloud.contentwarehouse.v1.ICreateDocumentRequest | null | undefined, {} | null | undefined>
Returns
TypeDescription
void

deleteDocument(request, options)

deleteDocument(request?: protos.google.cloud.contentwarehouse.v1.IDeleteDocumentRequest, options?: CallOptions): Promise<[
        protos.google.protobuf.IEmpty,
        (protos.google.cloud.contentwarehouse.v1.IDeleteDocumentRequest | undefined),
        {} | undefined
    ]>;

Deletes a document. Returns NOT_FOUND if the document does not exist.

Parameters
NameDescription
request IDeleteDocumentRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
TypeDescription
Promise<[ protos.google.protobuf.IEmpty, (protos.google.cloud.contentwarehouse.v1.IDeleteDocumentRequest | undefined), {} | undefined ]>

{Promise} - The promise which resolves to an array. The first element of the array is an object representing Empty. Please see the documentation for more details and examples.

Example

  /**
   * This snippet has been automatically generated and should be regarded as a code template only.
   * It will require modifications to work.
   * It may require correct/in-range values for request initialization.
   * TODO(developer): Uncomment these variables before running the sample.
   */
  /**
   *  Required. The name of the document to delete.
   *  Format:
   *  projects/{project_number}/locations/{location}/documents/{document_id}
   *  or
   *  projects/{project_number}/locations/{location}/documents/referenceId/{reference_id}.
   */
  // const name = 'abc123'
  /**
   *  The meta information collected about the end user, used to enforce access
   *  control for the service.
   */
  // const requestMetadata = {}

  // Imports the Contentwarehouse library
  const {DocumentServiceClient} = require('@google-cloud/contentwarehouse').v1;

  // Instantiates a client
  const contentwarehouseClient = new DocumentServiceClient();

  async function callDeleteDocument() {
    // Construct request
    const request = {
      name,
    };

    // Run request
    const response = await contentwarehouseClient.deleteDocument(request);
    console.log(response);
  }

  callDeleteDocument();

deleteDocument(request, options, callback)

deleteDocument(request: protos.google.cloud.contentwarehouse.v1.IDeleteDocumentRequest, options: CallOptions, callback: Callback<protos.google.protobuf.IEmpty, protos.google.cloud.contentwarehouse.v1.IDeleteDocumentRequest | null | undefined, {} | null | undefined>): void;
Parameters
NameDescription
request IDeleteDocumentRequest
options CallOptions
callback Callback<protos.google.protobuf.IEmpty, protos.google.cloud.contentwarehouse.v1.IDeleteDocumentRequest | null | undefined, {} | null | undefined>
Returns
TypeDescription
void

deleteDocument(request, callback)

deleteDocument(request: protos.google.cloud.contentwarehouse.v1.IDeleteDocumentRequest, callback: Callback<protos.google.protobuf.IEmpty, protos.google.cloud.contentwarehouse.v1.IDeleteDocumentRequest | null | undefined, {} | null | undefined>): void;
Parameters
NameDescription
request IDeleteDocumentRequest
callback Callback<protos.google.protobuf.IEmpty, protos.google.cloud.contentwarehouse.v1.IDeleteDocumentRequest | null | undefined, {} | null | undefined>
Returns
TypeDescription
void

documentLinkPath(project, location, document, documentLink)

documentLinkPath(project: string, location: string, document: string, documentLink: string): string;

Return a fully-qualified documentLink resource name string.

Parameters
NameDescription
project string
location string
document string
documentLink string
Returns
TypeDescription
string

{string} Resource name string.

documentSchemaPath(project, location, documentSchema)

documentSchemaPath(project: string, location: string, documentSchema: string): string;

Return a fully-qualified documentSchema resource name string.

Parameters
NameDescription
project string
location string
documentSchema string
Returns
TypeDescription
string

{string} Resource name string.

fetchAcl(request, options)

fetchAcl(request?: protos.google.cloud.contentwarehouse.v1.IFetchAclRequest, options?: CallOptions): Promise<[
        protos.google.cloud.contentwarehouse.v1.IFetchAclResponse,
        protos.google.cloud.contentwarehouse.v1.IFetchAclRequest | undefined,
        {} | undefined
    ]>;

Gets the access control policy for a resource. Returns NOT_FOUND error if the resource does not exist. Returns an empty policy if the resource exists but does not have a policy set.

Parameters
NameDescription
request IFetchAclRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
TypeDescription
Promise<[ protos.google.cloud.contentwarehouse.v1.IFetchAclResponse, protos.google.cloud.contentwarehouse.v1.IFetchAclRequest | undefined, {} | undefined ]>

{Promise} - The promise which resolves to an array. The first element of the array is an object representing FetchAclResponse. Please see the documentation for more details and examples.

Example

  /**
   * This snippet has been automatically generated and should be regarded as a code template only.
   * It will require modifications to work.
   * It may require correct/in-range values for request initialization.
   * TODO(developer): Uncomment these variables before running the sample.
   */
  /**
   *  Required. REQUIRED: The resource for which the policy is being requested.
   *  Format for document:
   *  projects/{project_number}/locations/{location}/documents/{document_id}.
   *  Format for collection:
   *  projects/{project_number}/locations/{location}/collections/{collection_id}.
   *  Format for project: projects/{project_number}.
   */
  // const resource = 'abc123'
  /**
   *  The meta information collected about the end user, used to enforce access
   *  control for the service.
   */
  // const requestMetadata = {}
  /**
   *  For Get Project ACL only. Authorization check for end user will be ignored
   *  when project_owner=true.
   */
  // const projectOwner = true

  // Imports the Contentwarehouse library
  const {DocumentServiceClient} = require('@google-cloud/contentwarehouse').v1;

  // Instantiates a client
  const contentwarehouseClient = new DocumentServiceClient();

  async function callFetchAcl() {
    // Construct request
    const request = {
      resource,
    };

    // Run request
    const response = await contentwarehouseClient.fetchAcl(request);
    console.log(response);
  }

  callFetchAcl();

fetchAcl(request, options, callback)

fetchAcl(request: protos.google.cloud.contentwarehouse.v1.IFetchAclRequest, options: CallOptions, callback: Callback<protos.google.cloud.contentwarehouse.v1.IFetchAclResponse, protos.google.cloud.contentwarehouse.v1.IFetchAclRequest | null | undefined, {} | null | undefined>): void;
Parameters
NameDescription
request IFetchAclRequest
options CallOptions
callback Callback<protos.google.cloud.contentwarehouse.v1.IFetchAclResponse, protos.google.cloud.contentwarehouse.v1.IFetchAclRequest | null | undefined, {} | null | undefined>
Returns
TypeDescription
void

fetchAcl(request, callback)

fetchAcl(request: protos.google.cloud.contentwarehouse.v1.IFetchAclRequest, callback: Callback<protos.google.cloud.contentwarehouse.v1.IFetchAclResponse, protos.google.cloud.contentwarehouse.v1.IFetchAclRequest | null | undefined, {} | null | undefined>): void;
Parameters
NameDescription
request IFetchAclRequest
callback Callback<protos.google.cloud.contentwarehouse.v1.IFetchAclResponse, protos.google.cloud.contentwarehouse.v1.IFetchAclRequest | null | undefined, {} | null | undefined>
Returns
TypeDescription
void

getDocument(request, options)

getDocument(request?: protos.google.cloud.contentwarehouse.v1.IGetDocumentRequest, options?: CallOptions): Promise<[
        protos.google.cloud.contentwarehouse.v1.IDocument,
        protos.google.cloud.contentwarehouse.v1.IGetDocumentRequest | undefined,
        {} | undefined
    ]>;

Gets a document. Returns NOT_FOUND if the document does not exist.

Parameters
NameDescription
request IGetDocumentRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
TypeDescription
Promise<[ protos.google.cloud.contentwarehouse.v1.IDocument, protos.google.cloud.contentwarehouse.v1.IGetDocumentRequest | undefined, {} | undefined ]>

{Promise} - The promise which resolves to an array. The first element of the array is an object representing Document. Please see the documentation for more details and examples.

Example

  /**
   * This snippet has been automatically generated and should be regarded as a code template only.
   * It will require modifications to work.
   * It may require correct/in-range values for request initialization.
   * TODO(developer): Uncomment these variables before running the sample.
   */
  /**
   *  Required. The name of the document to retrieve.
   *  Format:
   *  projects/{project_number}/locations/{location}/documents/{document_id} or
   *  projects/{project_number}/locations/{location}/documents/referenceId/{reference_id}.
   */
  // const name = 'abc123'
  /**
   *  The meta information collected about the end user, used to enforce access
   *  control for the service.
   */
  // const requestMetadata = {}

  // Imports the Contentwarehouse library
  const {DocumentServiceClient} = require('@google-cloud/contentwarehouse').v1;

  // Instantiates a client
  const contentwarehouseClient = new DocumentServiceClient();

  async function callGetDocument() {
    // Construct request
    const request = {
      name,
    };

    // Run request
    const response = await contentwarehouseClient.getDocument(request);
    console.log(response);
  }

  callGetDocument();

getDocument(request, options, callback)

getDocument(request: protos.google.cloud.contentwarehouse.v1.IGetDocumentRequest, options: CallOptions, callback: Callback<protos.google.cloud.contentwarehouse.v1.IDocument, protos.google.cloud.contentwarehouse.v1.IGetDocumentRequest | null | undefined, {} | null | undefined>): void;
Parameters
NameDescription
request IGetDocumentRequest
options CallOptions
callback Callback<protos.google.cloud.contentwarehouse.v1.IDocument, protos.google.cloud.contentwarehouse.v1.IGetDocumentRequest | null | undefined, {} | null | undefined>
Returns
TypeDescription
void

getDocument(request, callback)

getDocument(request: protos.google.cloud.contentwarehouse.v1.IGetDocumentRequest, callback: Callback<protos.google.cloud.contentwarehouse.v1.IDocument, protos.google.cloud.contentwarehouse.v1.IGetDocumentRequest | null | undefined, {} | null | undefined>): void;
Parameters
NameDescription
request IGetDocumentRequest
callback Callback<protos.google.cloud.contentwarehouse.v1.IDocument, protos.google.cloud.contentwarehouse.v1.IGetDocumentRequest | null | undefined, {} | null | undefined>
Returns
TypeDescription
void

getProjectId()

getProjectId(): Promise<string>;
Returns
TypeDescription
Promise<string>

getProjectId(callback)

getProjectId(callback: Callback<string, undefined, undefined>): void;
Parameter
NameDescription
callback Callback<string, undefined, undefined>
Returns
TypeDescription
void

initialize()

initialize(): Promise<{
        [name: string]: Function;
    }>;

Initialize the client. Performs asynchronous operations (such as authentication) and prepares the client. This function will be called automatically when any class method is called for the first time, but if you need to initialize it before calling an actual method, feel free to call initialize() directly.

You can await on this method if you want to make sure the client is initialized.

Returns
TypeDescription
Promise<{ [name: string]: Function; }>

{Promise} A promise that resolves to an authenticated service stub.

lockDocument(request, options)

lockDocument(request?: protos.google.cloud.contentwarehouse.v1.ILockDocumentRequest, options?: CallOptions): Promise<[
        protos.google.cloud.contentwarehouse.v1.IDocument,
        protos.google.cloud.contentwarehouse.v1.ILockDocumentRequest | undefined,
        {} | undefined
    ]>;

Lock the document so the document cannot be updated by other users.

Parameters
NameDescription
request ILockDocumentRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
TypeDescription
Promise<[ protos.google.cloud.contentwarehouse.v1.IDocument, protos.google.cloud.contentwarehouse.v1.ILockDocumentRequest | undefined, {} | undefined ]>

{Promise} - The promise which resolves to an array. The first element of the array is an object representing Document. Please see the documentation for more details and examples.

Example

  /**
   * This snippet has been automatically generated and should be regarded as a code template only.
   * It will require modifications to work.
   * It may require correct/in-range values for request initialization.
   * TODO(developer): Uncomment these variables before running the sample.
   */
  /**
   *  Required. The name of the document to lock.
   *  Format:
   *  projects/{project_number}/locations/{location}/documents/{document}.
   */
  // const name = 'abc123'
  /**
   *  The collection the document connects to.
   */
  // const collectionId = 'abc123'
  /**
   *  The user information who locks the document.
   */
  // const lockingUser = {}

  // Imports the Contentwarehouse library
  const {DocumentServiceClient} = require('@google-cloud/contentwarehouse').v1;

  // Instantiates a client
  const contentwarehouseClient = new DocumentServiceClient();

  async function callLockDocument() {
    // Construct request
    const request = {
      name,
    };

    // Run request
    const response = await contentwarehouseClient.lockDocument(request);
    console.log(response);
  }

  callLockDocument();

lockDocument(request, options, callback)

lockDocument(request: protos.google.cloud.contentwarehouse.v1.ILockDocumentRequest, options: CallOptions, callback: Callback<protos.google.cloud.contentwarehouse.v1.IDocument, protos.google.cloud.contentwarehouse.v1.ILockDocumentRequest | null | undefined, {} | null | undefined>): void;
Parameters
NameDescription
request ILockDocumentRequest
options CallOptions
callback Callback<protos.google.cloud.contentwarehouse.v1.IDocument, protos.google.cloud.contentwarehouse.v1.ILockDocumentRequest | null | undefined, {} | null | undefined>
Returns
TypeDescription
void

lockDocument(request, callback)

lockDocument(request: protos.google.cloud.contentwarehouse.v1.ILockDocumentRequest, callback: Callback<protos.google.cloud.contentwarehouse.v1.IDocument, protos.google.cloud.contentwarehouse.v1.ILockDocumentRequest | null | undefined, {} | null | undefined>): void;
Parameters
NameDescription
request ILockDocumentRequest
callback Callback<protos.google.cloud.contentwarehouse.v1.IDocument, protos.google.cloud.contentwarehouse.v1.ILockDocumentRequest | null | undefined, {} | null | undefined>
Returns
TypeDescription
void

matchContextFromSynonymSetName(synonymSetName)

matchContextFromSynonymSetName(synonymSetName: string): string | number;

Parse the context from SynonymSet resource.

Parameter
NameDescription
synonymSetName string

A fully-qualified path representing SynonymSet resource.

Returns
TypeDescription
string | number

{string} A string representing the context.

matchDocumentFromDocumentLinkName(documentLinkName)

matchDocumentFromDocumentLinkName(documentLinkName: string): string | number;

Parse the document from DocumentLink resource.

Parameter
NameDescription
documentLinkName string

A fully-qualified path representing DocumentLink resource.

Returns
TypeDescription
string | number

{string} A string representing the document.

matchDocumentFromProjectLocationDocumentName(projectLocationDocumentName)

matchDocumentFromProjectLocationDocumentName(projectLocationDocumentName: string): string | number;

Parse the document from ProjectLocationDocument resource.

Parameter
NameDescription
projectLocationDocumentName string

A fully-qualified path representing project_location_document resource.

Returns
TypeDescription
string | number

{string} A string representing the document.

matchDocumentLinkFromDocumentLinkName(documentLinkName)

matchDocumentLinkFromDocumentLinkName(documentLinkName: string): string | number;

Parse the document_link from DocumentLink resource.

Parameter
NameDescription
documentLinkName string

A fully-qualified path representing DocumentLink resource.

Returns
TypeDescription
string | number

{string} A string representing the document_link.

matchDocumentSchemaFromDocumentSchemaName(documentSchemaName)

matchDocumentSchemaFromDocumentSchemaName(documentSchemaName: string): string | number;

Parse the document_schema from DocumentSchema resource.

Parameter
NameDescription
documentSchemaName string

A fully-qualified path representing DocumentSchema resource.

Returns
TypeDescription
string | number

{string} A string representing the document_schema.

matchLocationFromDocumentLinkName(documentLinkName)

matchLocationFromDocumentLinkName(documentLinkName: string): string | number;

Parse the location from DocumentLink resource.

Parameter
NameDescription
documentLinkName string

A fully-qualified path representing DocumentLink resource.

Returns
TypeDescription
string | number

{string} A string representing the location.

matchLocationFromDocumentSchemaName(documentSchemaName)

matchLocationFromDocumentSchemaName(documentSchemaName: string): string | number;

Parse the location from DocumentSchema resource.

Parameter
NameDescription
documentSchemaName string

A fully-qualified path representing DocumentSchema resource.

Returns
TypeDescription
string | number

{string} A string representing the location.

matchLocationFromProjectLocationDocumentName(projectLocationDocumentName)

matchLocationFromProjectLocationDocumentName(projectLocationDocumentName: string): string | number;

Parse the location from ProjectLocationDocument resource.

Parameter
NameDescription
projectLocationDocumentName string

A fully-qualified path representing project_location_document resource.

Returns
TypeDescription
string | number

{string} A string representing the location.

matchLocationFromProjectLocationDocumentsReferenceIdName(projectLocationDocumentsReferenceIdName)

matchLocationFromProjectLocationDocumentsReferenceIdName(projectLocationDocumentsReferenceIdName: string): string | number;

Parse the location from ProjectLocationDocumentsReferenceId resource.

Parameter
NameDescription
projectLocationDocumentsReferenceIdName string

A fully-qualified path representing project_location_documents_reference_id resource.

Returns
TypeDescription
string | number

{string} A string representing the location.

matchLocationFromRuleSetName(ruleSetName)

matchLocationFromRuleSetName(ruleSetName: string): string | number;

Parse the location from RuleSet resource.

Parameter
NameDescription
ruleSetName string

A fully-qualified path representing RuleSet resource.

Returns
TypeDescription
string | number

{string} A string representing the location.

matchLocationFromSynonymSetName(synonymSetName)

matchLocationFromSynonymSetName(synonymSetName: string): string | number;

Parse the location from SynonymSet resource.

Parameter
NameDescription
synonymSetName string

A fully-qualified path representing SynonymSet resource.

Returns
TypeDescription
string | number

{string} A string representing the location.

matchProjectFromDocumentLinkName(documentLinkName)

matchProjectFromDocumentLinkName(documentLinkName: string): string | number;

Parse the project from DocumentLink resource.

Parameter
NameDescription
documentLinkName string

A fully-qualified path representing DocumentLink resource.

Returns
TypeDescription
string | number

{string} A string representing the project.

matchProjectFromDocumentSchemaName(documentSchemaName)

matchProjectFromDocumentSchemaName(documentSchemaName: string): string | number;

Parse the project from DocumentSchema resource.

Parameter
NameDescription
documentSchemaName string

A fully-qualified path representing DocumentSchema resource.

Returns
TypeDescription
string | number

{string} A string representing the project.

matchProjectFromProjectLocationDocumentName(projectLocationDocumentName)

matchProjectFromProjectLocationDocumentName(projectLocationDocumentName: string): string | number;

Parse the project from ProjectLocationDocument resource.

Parameter
NameDescription
projectLocationDocumentName string

A fully-qualified path representing project_location_document resource.

Returns
TypeDescription
string | number

{string} A string representing the project.

matchProjectFromProjectLocationDocumentsReferenceIdName(projectLocationDocumentsReferenceIdName)

matchProjectFromProjectLocationDocumentsReferenceIdName(projectLocationDocumentsReferenceIdName: string): string | number;

Parse the project from ProjectLocationDocumentsReferenceId resource.

Parameter
NameDescription
projectLocationDocumentsReferenceIdName string

A fully-qualified path representing project_location_documents_reference_id resource.

Returns
TypeDescription
string | number

{string} A string representing the project.

matchProjectFromRuleSetName(ruleSetName)

matchProjectFromRuleSetName(ruleSetName: string): string | number;

Parse the project from RuleSet resource.

Parameter
NameDescription
ruleSetName string

A fully-qualified path representing RuleSet resource.

Returns
TypeDescription
string | number

{string} A string representing the project.

matchProjectFromSynonymSetName(synonymSetName)

matchProjectFromSynonymSetName(synonymSetName: string): string | number;

Parse the project from SynonymSet resource.

Parameter
NameDescription
synonymSetName string

A fully-qualified path representing SynonymSet resource.

Returns
TypeDescription
string | number

{string} A string representing the project.

matchReferenceIdFromProjectLocationDocumentsReferenceIdName(projectLocationDocumentsReferenceIdName)

matchReferenceIdFromProjectLocationDocumentsReferenceIdName(projectLocationDocumentsReferenceIdName: string): string | number;

Parse the reference_id from ProjectLocationDocumentsReferenceId resource.

Parameter
NameDescription
projectLocationDocumentsReferenceIdName string

A fully-qualified path representing project_location_documents_reference_id resource.

Returns
TypeDescription
string | number

{string} A string representing the reference_id.

matchRuleSetFromRuleSetName(ruleSetName)

matchRuleSetFromRuleSetName(ruleSetName: string): string | number;

Parse the rule_set from RuleSet resource.

Parameter
NameDescription
ruleSetName string

A fully-qualified path representing RuleSet resource.

Returns
TypeDescription
string | number

{string} A string representing the rule_set.

projectLocationDocumentPath(project, location, document)

projectLocationDocumentPath(project: string, location: string, document: string): string;

Return a fully-qualified projectLocationDocument resource name string.

Parameters
NameDescription
project string
location string
document string
Returns
TypeDescription
string

{string} Resource name string.

projectLocationDocumentsReferenceIdPath(project, location, referenceId)

projectLocationDocumentsReferenceIdPath(project: string, location: string, referenceId: string): string;

Return a fully-qualified projectLocationDocumentsReferenceId resource name string.

Parameters
NameDescription
project string
location string
referenceId string
Returns
TypeDescription
string

{string} Resource name string.

ruleSetPath(project, location, ruleSet)

ruleSetPath(project: string, location: string, ruleSet: string): string;

Return a fully-qualified ruleSet resource name string.

Parameters
NameDescription
project string
location string
ruleSet string
Returns
TypeDescription
string

{string} Resource name string.

searchDocuments(request, options)

searchDocuments(request?: protos.google.cloud.contentwarehouse.v1.ISearchDocumentsRequest, options?: CallOptions): Promise<[
        protos.google.cloud.contentwarehouse.v1.SearchDocumentsResponse.IMatchingDocument[],
        protos.google.cloud.contentwarehouse.v1.ISearchDocumentsRequest | null,
        protos.google.cloud.contentwarehouse.v1.ISearchDocumentsResponse
    ]>;

Searches for documents using provided . This call only returns documents that the caller has permission to search against.

Parameters
NameDescription
request ISearchDocumentsRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
TypeDescription
Promise<[ protos.google.cloud.contentwarehouse.v1.SearchDocumentsResponse.IMatchingDocument[], protos.google.cloud.contentwarehouse.v1.ISearchDocumentsRequest | null, protos.google.cloud.contentwarehouse.v1.ISearchDocumentsResponse ]>

{Promise} - The promise which resolves to an array. The first element of the array is Array of . The client library will perform auto-pagination by default: it will call the API as many times as needed and will merge results from all the pages into this array. Note that it can affect your quota. We recommend using searchDocumentsAsync() method described below for async iteration which you can stop as needed. Please see the documentation for more details and examples.

searchDocuments(request, options, callback)

searchDocuments(request: protos.google.cloud.contentwarehouse.v1.ISearchDocumentsRequest, options: CallOptions, callback: PaginationCallback<protos.google.cloud.contentwarehouse.v1.ISearchDocumentsRequest, protos.google.cloud.contentwarehouse.v1.ISearchDocumentsResponse | null | undefined, protos.google.cloud.contentwarehouse.v1.SearchDocumentsResponse.IMatchingDocument>): void;
Parameters
NameDescription
request ISearchDocumentsRequest
options CallOptions
callback PaginationCallback<protos.google.cloud.contentwarehouse.v1.ISearchDocumentsRequest, protos.google.cloud.contentwarehouse.v1.ISearchDocumentsResponse | null | undefined, protos.google.cloud.contentwarehouse.v1.SearchDocumentsResponse.IMatchingDocument>
Returns
TypeDescription
void

searchDocuments(request, callback)

searchDocuments(request: protos.google.cloud.contentwarehouse.v1.ISearchDocumentsRequest, callback: PaginationCallback<protos.google.cloud.contentwarehouse.v1.ISearchDocumentsRequest, protos.google.cloud.contentwarehouse.v1.ISearchDocumentsResponse | null | undefined, protos.google.cloud.contentwarehouse.v1.SearchDocumentsResponse.IMatchingDocument>): void;
Parameters
NameDescription
request ISearchDocumentsRequest
callback PaginationCallback<protos.google.cloud.contentwarehouse.v1.ISearchDocumentsRequest, protos.google.cloud.contentwarehouse.v1.ISearchDocumentsResponse | null | undefined, protos.google.cloud.contentwarehouse.v1.SearchDocumentsResponse.IMatchingDocument>
Returns
TypeDescription
void

searchDocumentsAsync(request, options)

searchDocumentsAsync(request?: protos.google.cloud.contentwarehouse.v1.ISearchDocumentsRequest, options?: CallOptions): AsyncIterable<protos.google.cloud.contentwarehouse.v1.SearchDocumentsResponse.IMatchingDocument>;

Equivalent to searchDocuments, but returns an iterable object.

for-await-of syntax is used with the iterable to get response elements on-demand.

Parameters
NameDescription
request ISearchDocumentsRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
TypeDescription
AsyncIterable<protos.google.cloud.contentwarehouse.v1.SearchDocumentsResponse.IMatchingDocument>

{Object} An iterable Object that allows async iteration. When you iterate the returned iterable, each element will be an object representing . The API will be called under the hood as needed, once per the page, so you can stop the iteration when you don't need more results. Please see the documentation for more details and examples.

Example

  /**
   * This snippet has been automatically generated and should be regarded as a code template only.
   * It will require modifications to work.
   * It may require correct/in-range values for request initialization.
   * TODO(developer): Uncomment these variables before running the sample.
   */
  /**
   *  Required. The parent, which owns this collection of documents.
   *  Format: projects/{project_number}/locations/{location}.
   */
  // const parent = 'abc123'
  /**
   *  The meta information collected about the end user, used to enforce access
   *  control and improve the search quality of the service.
   */
  // const requestMetadata = {}
  /**
   *  Query used to search against documents (keyword, filters, etc.).
   */
  // const documentQuery = {}
  /**
   *  An integer that specifies the current offset (that is, starting result
   *  location, amongst the documents deemed by the API as relevant) in search
   *  results. This field is only considered if
   *  page_token google.cloud.contentwarehouse.v1.SearchDocumentsRequest.page_token 
   *  is unset.
   *  The maximum allowed value is 5000. Otherwise an error is thrown.
   *  For example, 0 means to  return results starting from the first matching
   *  document, and 10 means to return from the 11th document. This can be used
   *  for pagination, (for example, pageSize = 10 and offset = 10 means to return
   *  from the second page).
   */
  // const offset = 1234
  /**
   *  A limit on the number of documents returned in the search results.
   *  Increasing this value above the default value of 10 can increase search
   *  response time. The value can be between 1 and 100.
   */
  // const pageSize = 1234
  /**
   *  The token specifying the current offset within search results.
   *  See
   *  SearchDocumentsResponse.next_page_token google.cloud.contentwarehouse.v1.SearchDocumentsResponse.next_page_token 
   *  for an explanation of how to obtain the next set of query results.
   */
  // const pageToken = 'abc123'
  /**
   *  The criteria determining how search results are sorted. For non-empty
   *  query, default is `"relevance desc"`. For empty query, default is
   *  `"upload_date desc"`.
   *  Supported options are:
   *  * `"relevance desc"`: By relevance descending, as determined by the API
   *    algorithms.
   *  * `"upload_date desc"`: By upload date descending.
   *  * `"upload_date"`: By upload date ascending.
   *  * `"update_date desc"`: By last updated date descending.
   *  * `"update_date"`: By last updated date ascending.
   *  * `"retrieval_importance desc"`: By retrieval importance of properties
   *    descending. This feature is still under development, please do not use
   *    unless otherwise instructed to do so.
   */
  // const orderBy = 'abc123'
  /**
   *  An expression specifying a histogram request against matching
   *  documents. Expression syntax is an aggregation function call with
   *  histogram facets and other options.
   *  The following aggregation functions are supported:
   *  * `count(string_histogram_facet)`: Count the number of matching entities
   *  for each distinct attribute value.
   *  Data types:
   *  * Histogram facet (aka filterable properties): Facet names with format
   *  <schema id>.<facet>. Facets will have the
   *  format of: `[a-zA-Z][a-zA-Z0-9_:/-.]`. If the facet is a child
   *  facet, then the parent hierarchy needs to be specified separated by
   *  dots in the prefix after the schema id. Thus, the format for a multi-
   *  level facet is: <schema id>.<parent facet name>.
   *  <child facet name>. Example:
   *  schema123.root_parent_facet.middle_facet.child_facet
   *  * DocumentSchemaId: (with no schema id prefix) to get
   *  histograms for each document type (returns the schema id path, e.g.
   *  projects/12345/locations/us-west/documentSchemas/abc123).
   *  Example expression:
   *  * Document type counts:
   *    count('DocumentSchemaId')
   *  * For schema id, abc123, get the counts for MORTGAGE_TYPE:
   *    count('abc123.MORTGAGE_TYPE')
   */
  // const histogramQueries = [1,2,3,4]
  /**
   *  Controls if the search document request requires the return of a total size
   *  of matched documents. See
   *  SearchDocumentsResponse.total_size google.cloud.contentwarehouse.v1.SearchDocumentsResponse.total_size.
   *  Enabling this flag may adversely impact performance. Hint: If this is
   *  used with pagination, set this flag on the initial query but set this
   *  to false on subsequent page calls (keep the total count locally).
   *  Defaults to false.
   */
  // const requireTotalSize = true
  /**
   *  Controls if the search document request requires the return of a total size
   *  of matched documents. See
   *  SearchDocumentsResponse.total_size google.cloud.contentwarehouse.v1.SearchDocumentsResponse.total_size.
   */
  // const totalResultSize = {}
  /**
   *  Experimental, do not use.
   *  The limit on the number of documents returned for the question-answering
   *  feature. To enable the question-answering feature, set
   *  DocumentQuery.is_nl_query  to true.
   */
  // const qaSizeLimit = 1234

  // Imports the Contentwarehouse library
  const {DocumentServiceClient} = require('@google-cloud/contentwarehouse').v1;

  // Instantiates a client
  const contentwarehouseClient = new DocumentServiceClient();

  async function callSearchDocuments() {
    // Construct request
    const request = {
      parent,
    };

    // Run request
    const iterable = contentwarehouseClient.searchDocumentsAsync(request);
    for await (const response of iterable) {
        console.log(response);
    }
  }

  callSearchDocuments();

searchDocumentsStream(request, options)

searchDocumentsStream(request?: protos.google.cloud.contentwarehouse.v1.ISearchDocumentsRequest, options?: CallOptions): Transform;

Equivalent to method.name.toCamelCase(), but returns a NodeJS Stream object.

Parameters
NameDescription
request ISearchDocumentsRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
TypeDescription
Transform

{Stream} An object stream which emits an object representing on 'data' event. The client library will perform auto-pagination by default: it will call the API as many times as needed. Note that it can affect your quota. We recommend using searchDocumentsAsync() method described below for async iteration which you can stop as needed. Please see the documentation for more details and examples.

setAcl(request, options)

setAcl(request?: protos.google.cloud.contentwarehouse.v1.ISetAclRequest, options?: CallOptions): Promise<[
        protos.google.cloud.contentwarehouse.v1.ISetAclResponse,
        protos.google.cloud.contentwarehouse.v1.ISetAclRequest | undefined,
        {} | undefined
    ]>;

Sets the access control policy for a resource. Replaces any existing policy.

Parameters
NameDescription
request ISetAclRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
TypeDescription
Promise<[ protos.google.cloud.contentwarehouse.v1.ISetAclResponse, protos.google.cloud.contentwarehouse.v1.ISetAclRequest | undefined, {} | undefined ]>

{Promise} - The promise which resolves to an array. The first element of the array is an object representing SetAclResponse. Please see the documentation for more details and examples.

Example

  /**
   * This snippet has been automatically generated and should be regarded as a code template only.
   * It will require modifications to work.
   * It may require correct/in-range values for request initialization.
   * TODO(developer): Uncomment these variables before running the sample.
   */
  /**
   *  Required. REQUIRED: The resource for which the policy is being requested.
   *  Format for document:
   *  projects/{project_number}/locations/{location}/documents/{document_id}.
   *  Format for collection:
   *  projects/{project_number}/locations/{location}/collections/{collection_id}.
   *  Format for project: projects/{project_number}.
   */
  // const resource = 'abc123'
  /**
   *  Required. REQUIRED: The complete policy to be applied to the `resource`.
   *  The size of the policy is limited to a few 10s of KB. This refers to an
   *  Identity and Access (IAM) policy, which specifies access controls for the
   *  Document.
   *  You can set ACL with condition for projects only.
   *  Supported operators are: `=`, `!=`, `<`,><=`, `="">`, and `>=` where
   *  the left of the operator is `DocumentSchemaId` or property name and the
   *  right of the operator is a number or a quoted string. You must escape
   *  backslash (\\) and quote (\") characters.
   *  Boolean expressions (AND/OR) are supported up to 3 levels of nesting (for
   *  example, "((A AND B AND C) OR D) AND E"), a maximum of 10 comparisons are
   *  allowed in the expression. The expression must be < 6000="" bytes="" in="" length.="" *="" sample="" condition:="" *="" `"documentschemaid="\" some"="" schema="" id\"="" or="" schemaid.floatpropertyname="" *="">= 10"`
   */
  // const policy = {}
  /**
   *  The meta information collected about the end user, used to enforce access
   *  control for the service.
   */
  // const requestMetadata = {}
  /**
   *  For Set Project ACL only. Authorization check for end user will be ignored
   *  when project_owner=true.
   */
  // const projectOwner = true

  // Imports the Contentwarehouse library
  const {DocumentServiceClient} = require('@google-cloud/contentwarehouse').v1;

  // Instantiates a client
  const contentwarehouseClient = new DocumentServiceClient();

  async function callSetAcl() {
    // Construct request
    const request = {
      resource,
      policy,
    };

    // Run request
    const response = await contentwarehouseClient.setAcl(request);
    console.log(response);
  }

  callSetAcl();

setAcl(request, options, callback)

setAcl(request: protos.google.cloud.contentwarehouse.v1.ISetAclRequest, options: CallOptions, callback: Callback<protos.google.cloud.contentwarehouse.v1.ISetAclResponse, protos.google.cloud.contentwarehouse.v1.ISetAclRequest | null | undefined, {} | null | undefined>): void;
Parameters
NameDescription
request ISetAclRequest
options CallOptions
callback Callback<protos.google.cloud.contentwarehouse.v1.ISetAclResponse, protos.google.cloud.contentwarehouse.v1.ISetAclRequest | null | undefined, {} | null | undefined>
Returns
TypeDescription
void

setAcl(request, callback)

setAcl(request: protos.google.cloud.contentwarehouse.v1.ISetAclRequest, callback: Callback<protos.google.cloud.contentwarehouse.v1.ISetAclResponse, protos.google.cloud.contentwarehouse.v1.ISetAclRequest | null | undefined, {} | null | undefined>): void;
Parameters
NameDescription
request ISetAclRequest
callback Callback<protos.google.cloud.contentwarehouse.v1.ISetAclResponse, protos.google.cloud.contentwarehouse.v1.ISetAclRequest | null | undefined, {} | null | undefined>
Returns
TypeDescription
void

synonymSetPath(project, location, context)

synonymSetPath(project: string, location: string, context: string): string;

Return a fully-qualified synonymSet resource name string.

Parameters
NameDescription
project string
location string
context string
Returns
TypeDescription
string

{string} Resource name string.

updateDocument(request, options)

updateDocument(request?: protos.google.cloud.contentwarehouse.v1.IUpdateDocumentRequest, options?: CallOptions): Promise<[
        protos.google.cloud.contentwarehouse.v1.IUpdateDocumentResponse,
        (protos.google.cloud.contentwarehouse.v1.IUpdateDocumentRequest | undefined),
        {} | undefined
    ]>;

Updates a document. Returns INVALID_ARGUMENT if the name of the document is non-empty and does not equal the existing name.

Parameters
NameDescription
request IUpdateDocumentRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
TypeDescription
Promise<[ protos.google.cloud.contentwarehouse.v1.IUpdateDocumentResponse, (protos.google.cloud.contentwarehouse.v1.IUpdateDocumentRequest | undefined), {} | undefined ]>

{Promise} - The promise which resolves to an array. The first element of the array is an object representing UpdateDocumentResponse. Please see the documentation for more details and examples.

Example

  /**
   * This snippet has been automatically generated and should be regarded as a code template only.
   * It will require modifications to work.
   * It may require correct/in-range values for request initialization.
   * TODO(developer): Uncomment these variables before running the sample.
   */
  /**
   *  Required. The name of the document to update.
   *  Format:
   *  projects/{project_number}/locations/{location}/documents/{document_id}
   *  or
   *  projects/{project_number}/locations/{location}/documents/referenceId/{reference_id}.
   */
  // const name = 'abc123'
  /**
   *  Required. The document to update.
   */
  // const document = {}
  /**
   *  The meta information collected about the end user, used to enforce access
   *  control for the service.
   */
  // const requestMetadata = {}
  /**
   *  Request Option for processing Cloud AI Document in Document Warehouse.
   *  This field offers limited support for mapping entities from Cloud AI
   *  Document to Warehouse Document. Please consult with product team before
   *  using this field and other available options.
   */
  // const cloudAiDocumentOption = {}
  /**
   *  Options for the update operation.
   */
  // const updateOptions = {}

  // Imports the Contentwarehouse library
  const {DocumentServiceClient} = require('@google-cloud/contentwarehouse').v1;

  // Instantiates a client
  const contentwarehouseClient = new DocumentServiceClient();

  async function callUpdateDocument() {
    // Construct request
    const request = {
      name,
      document,
    };

    // Run request
    const response = await contentwarehouseClient.updateDocument(request);
    console.log(response);
  }

  callUpdateDocument();

updateDocument(request, options, callback)

updateDocument(request: protos.google.cloud.contentwarehouse.v1.IUpdateDocumentRequest, options: CallOptions, callback: Callback<protos.google.cloud.contentwarehouse.v1.IUpdateDocumentResponse, protos.google.cloud.contentwarehouse.v1.IUpdateDocumentRequest | null | undefined, {} | null | undefined>): void;
Parameters
NameDescription
request IUpdateDocumentRequest
options CallOptions
callback Callback<protos.google.cloud.contentwarehouse.v1.IUpdateDocumentResponse, protos.google.cloud.contentwarehouse.v1.IUpdateDocumentRequest | null | undefined, {} | null | undefined>
Returns
TypeDescription
void

updateDocument(request, callback)

updateDocument(request: protos.google.cloud.contentwarehouse.v1.IUpdateDocumentRequest, callback: Callback<protos.google.cloud.contentwarehouse.v1.IUpdateDocumentResponse, protos.google.cloud.contentwarehouse.v1.IUpdateDocumentRequest | null | undefined, {} | null | undefined>): void;
Parameters
NameDescription
request IUpdateDocumentRequest
callback Callback<protos.google.cloud.contentwarehouse.v1.IUpdateDocumentResponse, protos.google.cloud.contentwarehouse.v1.IUpdateDocumentRequest | null | undefined, {} | null | undefined>
Returns
TypeDescription
void