Class v1beta.DocumentServiceClient (0.2.0)

Stay organized with collections Save and categorize content based on your preferences.

Service for ingesting information of the customer's website. v1beta

Package

@google-cloud/discoveryengine

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 gax.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: 'rest'}, gax); ```

Properties

apiEndpoint

static get apiEndpoint(): string;

The DNS address for this API service - same as servicePath(), exists for compatibility reasons.

auth

auth: gax.GoogleAuth;

descriptors

descriptors: Descriptors;

documentServiceStub

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

innerApiCalls

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

operationsClient

operationsClient: gax.OperationsClient;

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.

warn

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

Methods

branchPath(project, location, dataStore, branch)

branchPath(project: string, location: string, dataStore: string, branch: string): string;

Return a fully-qualified branch resource name string.

Parameters
NameDescription
project string
location string
dataStore string
branch string
Returns
TypeDescription
string

{string} Resource name string.

cancelOperation(request, options, callback)

cancelOperation(request: protos.google.longrunning.CancelOperationRequest, options?: gax.CallOptions | Callback<protos.google.protobuf.Empty, protos.google.longrunning.CancelOperationRequest, {} | undefined | null>, callback?: Callback<protos.google.longrunning.CancelOperationRequest, protos.google.protobuf.Empty, {} | undefined | null>): Promise<protos.google.protobuf.Empty>;

Starts asynchronous cancellation on a long-running operation. The server makes a best effort to cancel the operation, but success is not guaranteed. If the server doesn't support this method, it returns google.rpc.Code.UNIMPLEMENTED. Clients can use or other methods to check whether the cancellation succeeded or whether the operation completed despite cancellation. On successful cancellation, the operation is not deleted; instead, it becomes an operation with an value with a of 1, corresponding to Code.CANCELLED.

Parameters
NameDescription
request protos.google.longrunning.CancelOperationRequest

The request object that will be sent.

options gax.CallOptions | Callback<protos.google.protobuf.Empty, protos.google.longrunning.CancelOperationRequest, {} | undefined | null>

Optional parameters. You can override the default settings for this call, e.g, timeout, retries, paginations, etc. See [gax.CallOptions]https://googleapis.github.io/gax-nodejs/global.html#CallOptions for the details.

callback Callback<protos.google.longrunning.CancelOperationRequest, protos.google.protobuf.Empty, {} | undefined | null>

The function which will be called with the result of the API call. {Promise} - The promise which resolves when API call finishes. The promise has a method named "cancel" which cancels the ongoing API call.

Returns
TypeDescription
Promise<protos.google.protobuf.Empty>
Example

const client = longrunning.operationsClient();
await client.cancelOperation({name: ''});

checkImportDocumentsProgress(name)

checkImportDocumentsProgress(name: string): Promise<LROperation<protos.google.cloud.discoveryengine.v1beta.ImportDocumentsResponse, protos.google.cloud.discoveryengine.v1beta.ImportDocumentsMetadata>>;

Check the status of the long running operation returned by importDocuments().

Parameter
NameDescription
name string

The operation name that will be passed.

Returns
TypeDescription
Promise<LROperation<protos.google.cloud.discoveryengine.v1beta.ImportDocumentsResponse, protos.google.cloud.discoveryengine.v1beta.ImportDocumentsMetadata>>

{Promise} - The promise which resolves to an object. The decoded operation object has result and metadata field to get information from. Please see the [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) 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.
   */
  /**
   *  The Inline source for the input content for documents.
   */
  // const inlineSource = {}
  /**
   *  Google Cloud Storage location for the input content.
   */
  // const gcsSource = {}
  /**
   *  BigQuery input source.
   */
  // const bigquerySource = {}
  /**
   *  Required. The parent branch resource name, such as
   *  `projects/{project}/locations/{location}/dataStores/{data_store}/branches/{branch}`.
   *  Requires create/update permission.
   */
  // const parent = 'abc123'
  /**
   *  The desired location of errors incurred during the Import.
   */
  // const errorConfig = {}
  /**
   *  The mode of reconciliation between existing documents and the documents to
   *  be imported. Defaults to
   *  ReconciliationMode.INCREMENTAL google.cloud.discoveryengine.v1beta.ImportDocumentsRequest.ReconciliationMode.INCREMENTAL.
   */
  // const reconciliationMode = {}

  // Imports the Discoveryengine library
  const {DocumentServiceClient} = require('@google-cloud/discoveryengine').v1beta;

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

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

    // Run request
    const [operation] = await discoveryengineClient.importDocuments(request);
    const [response] = await operation.promise();
    console.log(response);
  }

  callImportDocuments();

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.discoveryengine.v1beta.ICreateDocumentRequest, options?: CallOptions): Promise<[
        protos.google.cloud.discoveryengine.v1beta.IDocument,
        (protos.google.cloud.discoveryengine.v1beta.ICreateDocumentRequest | undefined),
        {} | undefined
    ]>;

Creates a .

Parameters
NameDescription
request protos.google.cloud.discoveryengine.v1beta.ICreateDocumentRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
TypeDescription
Promise<[ protos.google.cloud.discoveryengine.v1beta.IDocument, (protos.google.cloud.discoveryengine.v1beta.ICreateDocumentRequest | 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](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) 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 resource name, such as
   *  `projects/{project}/locations/{location}/dataStores/{data_store}/branches/{branch}`.
   */
  // const parent = 'abc123'
  /**
   *  Required. The Document google.cloud.discoveryengine.v1beta.Document  to
   *  create.
   */
  // const document = {}
  /**
   *  Required. The ID to use for the
   *  Document google.cloud.discoveryengine.v1beta.Document, which will become
   *  the final component of the
   *  Document.name google.cloud.discoveryengine.v1beta.Document.name.
   *  If the caller does not have permission to create the
   *  Document google.cloud.discoveryengine.v1beta.Document, regardless of
   *  whether or not it exists, a PERMISSION_DENIED error is returned.
   *  This field must be unique among all
   *  Document google.cloud.discoveryengine.v1beta.Document s with the same
   *  parent google.cloud.discoveryengine.v1beta.CreateDocumentRequest.parent.
   *  Otherwise, an ALREADY_EXISTS error is returned.
   *  This field must conform to RFC-1034 (https://tools.ietf.org/html/rfc1034)
   *  standard with a length limit of 63 characters. Otherwise, an
   *  INVALID_ARGUMENT error is returned.
   */
  // const documentId = 'abc123'

  // Imports the Discoveryengine library
  const {DocumentServiceClient} = require('@google-cloud/discoveryengine').v1beta;

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

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

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

  callCreateDocument();

createDocument(request, options, callback)

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

createDocument(request, callback)

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

deleteDocument(request, options)

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

Deletes a .

Parameters
NameDescription
request protos.google.cloud.discoveryengine.v1beta.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.discoveryengine.v1beta.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](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) 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. Full resource name of
   *  Document google.cloud.discoveryengine.v1beta.Document, such as
   *  `projects/{project}/locations/{location}/dataStores/{data_store}/branches/{branch}/documents/{document}`.
   *  If the caller does not have permission to delete the
   *  Document google.cloud.discoveryengine.v1beta.Document, regardless of
   *  whether or not it exists, a PERMISSION_DENIED error is returned.
   *  If the Document google.cloud.discoveryengine.v1beta.Document  to delete
   *  does not exist, a NOT_FOUND error is returned.
   */
  // const name = 'abc123'

  // Imports the Discoveryengine library
  const {DocumentServiceClient} = require('@google-cloud/discoveryengine').v1beta;

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

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

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

  callDeleteDocument();

deleteDocument(request, options, callback)

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

deleteDocument(request, callback)

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

deleteOperation(request, options, callback)

deleteOperation(request: protos.google.longrunning.DeleteOperationRequest, options?: gax.CallOptions | Callback<protos.google.protobuf.Empty, protos.google.longrunning.DeleteOperationRequest, {} | null | undefined>, callback?: Callback<protos.google.protobuf.Empty, protos.google.longrunning.DeleteOperationRequest, {} | null | undefined>): Promise<protos.google.protobuf.Empty>;

Deletes a long-running operation. This method indicates that the client is no longer interested in the operation result. It does not cancel the operation. If the server doesn't support this method, it returns google.rpc.Code.UNIMPLEMENTED.

Parameters
NameDescription
request protos.google.longrunning.DeleteOperationRequest

The request object that will be sent.

options gax.CallOptions | Callback<protos.google.protobuf.Empty, protos.google.longrunning.DeleteOperationRequest, {} | null | undefined>

Optional parameters. You can override the default settings for this call, e.g, timeout, retries, paginations, etc. See [gax.CallOptions]https://googleapis.github.io/gax-nodejs/global.html#CallOptions for the details.

callback Callback<protos.google.protobuf.Empty, protos.google.longrunning.DeleteOperationRequest, {} | null | undefined>

The function which will be called with the result of the API call. {Promise} - The promise which resolves when API call finishes. The promise has a method named "cancel" which cancels the ongoing API call.

Returns
TypeDescription
Promise<protos.google.protobuf.Empty>
Example

const client = longrunning.operationsClient();
await client.deleteOperation({name: ''});

documentPath(project, location, dataStore, branch, document)

documentPath(project: string, location: string, dataStore: string, branch: string, document: string): string;

Return a fully-qualified document resource name string.

Parameters
NameDescription
project string
location string
dataStore string
branch string
document string
Returns
TypeDescription
string

{string} Resource name string.

getDocument(request, options)

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

Gets a .

Parameters
NameDescription
request protos.google.cloud.discoveryengine.v1beta.IGetDocumentRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
TypeDescription
Promise<[ protos.google.cloud.discoveryengine.v1beta.IDocument, (protos.google.cloud.discoveryengine.v1beta.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](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) 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. Full resource name of
   *  Document google.cloud.discoveryengine.v1beta.Document, such as
   *  `projects/{project}/locations/{location}/dataStores/{data_store}/branches/{branch}/documents/{document}`.
   *  If the caller does not have permission to access the
   *  Document google.cloud.discoveryengine.v1beta.Document, regardless of
   *  whether or not it exists, a PERMISSION_DENIED error is returned.
   *  If the requested Document google.cloud.discoveryengine.v1beta.Document 
   *  does not exist, a NOT_FOUND error is returned.
   */
  // const name = 'abc123'

  // Imports the Discoveryengine library
  const {DocumentServiceClient} = require('@google-cloud/discoveryengine').v1beta;

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

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

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

  callGetDocument();

getDocument(request, options, callback)

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

getDocument(request, callback)

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

getOperation(request, options, callback)

getOperation(request: protos.google.longrunning.GetOperationRequest, options?: gax.CallOptions | Callback<protos.google.longrunning.Operation, protos.google.longrunning.GetOperationRequest, {} | null | undefined>, callback?: Callback<protos.google.longrunning.Operation, protos.google.longrunning.GetOperationRequest, {} | null | undefined>): Promise<[protos.google.longrunning.Operation]>;

Gets the latest state of a long-running operation. Clients can use this method to poll the operation result at intervals as recommended by the API service.

Parameters
NameDescription
request protos.google.longrunning.GetOperationRequest

The request object that will be sent.

options gax.CallOptions | Callback<protos.google.longrunning.Operation, protos.google.longrunning.GetOperationRequest, {} | null | undefined>

Optional parameters. You can override the default settings for this call, e.g, timeout, retries, paginations, etc. See [gax.CallOptions]https://googleapis.github.io/gax-nodejs/global.html#CallOptions for the details.

callback Callback<protos.google.longrunning.Operation, protos.google.longrunning.GetOperationRequest, {} | null | undefined>

The function which will be called with the result of the API call.

The second parameter to the callback is an object representing [google.longrunning.Operation]. {Promise} - The promise which resolves to an array. The first element of the array is an object representing [google.longrunning.Operation]. The promise has a method named "cancel" which cancels the ongoing API call.

Returns
TypeDescription
Promise<[protos.google.longrunning.Operation]>
Example

const client = longrunning.operationsClient();
const name = '';
const [response] = await client.getOperation({name});
// doThingsWith(response)

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

importDocuments(request, options)

importDocuments(request?: protos.google.cloud.discoveryengine.v1beta.IImportDocumentsRequest, options?: CallOptions): Promise<[
        LROperation<protos.google.cloud.discoveryengine.v1beta.IImportDocumentsResponse, protos.google.cloud.discoveryengine.v1beta.IImportDocumentsMetadata>,
        protos.google.longrunning.IOperation | undefined,
        {} | undefined
    ]>;

Bulk import of multiple s. Request processing may be synchronous. Non-existing items will be created.

Note: It is possible for a subset of the s to be successfully updated.

Parameters
NameDescription
request protos.google.cloud.discoveryengine.v1beta.IImportDocumentsRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
TypeDescription
Promise<[ LROperation<protos.google.cloud.discoveryengine.v1beta.IImportDocumentsResponse, protos.google.cloud.discoveryengine.v1beta.IImportDocumentsMetadata>, protos.google.longrunning.IOperation | undefined, {} | undefined ]>

{Promise} - The promise which resolves to an array. The first element of the array is an object representing a long running operation. Its promise() method returns a promise you can await for. Please see the [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) 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.
   */
  /**
   *  The Inline source for the input content for documents.
   */
  // const inlineSource = {}
  /**
   *  Google Cloud Storage location for the input content.
   */
  // const gcsSource = {}
  /**
   *  BigQuery input source.
   */
  // const bigquerySource = {}
  /**
   *  Required. The parent branch resource name, such as
   *  `projects/{project}/locations/{location}/dataStores/{data_store}/branches/{branch}`.
   *  Requires create/update permission.
   */
  // const parent = 'abc123'
  /**
   *  The desired location of errors incurred during the Import.
   */
  // const errorConfig = {}
  /**
   *  The mode of reconciliation between existing documents and the documents to
   *  be imported. Defaults to
   *  ReconciliationMode.INCREMENTAL google.cloud.discoveryengine.v1beta.ImportDocumentsRequest.ReconciliationMode.INCREMENTAL.
   */
  // const reconciliationMode = {}

  // Imports the Discoveryengine library
  const {DocumentServiceClient} = require('@google-cloud/discoveryengine').v1beta;

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

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

    // Run request
    const [operation] = await discoveryengineClient.importDocuments(request);
    const [response] = await operation.promise();
    console.log(response);
  }

  callImportDocuments();

importDocuments(request, options, callback)

importDocuments(request: protos.google.cloud.discoveryengine.v1beta.IImportDocumentsRequest, options: CallOptions, callback: Callback<LROperation<protos.google.cloud.discoveryengine.v1beta.IImportDocumentsResponse, protos.google.cloud.discoveryengine.v1beta.IImportDocumentsMetadata>, protos.google.longrunning.IOperation | null | undefined, {} | null | undefined>): void;
Parameters
NameDescription
request protos.google.cloud.discoveryengine.v1beta.IImportDocumentsRequest
options CallOptions
callback Callback<LROperation<protos.google.cloud.discoveryengine.v1beta.IImportDocumentsResponse, protos.google.cloud.discoveryengine.v1beta.IImportDocumentsMetadata>, protos.google.longrunning.IOperation | null | undefined, {} | null | undefined>
Returns
TypeDescription
void

importDocuments(request, callback)

importDocuments(request: protos.google.cloud.discoveryengine.v1beta.IImportDocumentsRequest, callback: Callback<LROperation<protos.google.cloud.discoveryengine.v1beta.IImportDocumentsResponse, protos.google.cloud.discoveryengine.v1beta.IImportDocumentsMetadata>, protos.google.longrunning.IOperation | null | undefined, {} | null | undefined>): void;
Parameters
NameDescription
request protos.google.cloud.discoveryengine.v1beta.IImportDocumentsRequest
callback Callback<LROperation<protos.google.cloud.discoveryengine.v1beta.IImportDocumentsResponse, protos.google.cloud.discoveryengine.v1beta.IImportDocumentsMetadata>, protos.google.longrunning.IOperation | null | undefined, {} | null | 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.

listDocuments(request, options)

listDocuments(request?: protos.google.cloud.discoveryengine.v1beta.IListDocumentsRequest, options?: CallOptions): Promise<[
        protos.google.cloud.discoveryengine.v1beta.IDocument[],
        protos.google.cloud.discoveryengine.v1beta.IListDocumentsRequest | null,
        protos.google.cloud.discoveryengine.v1beta.IListDocumentsResponse
    ]>;

Gets a list of s.

Parameters
NameDescription
request protos.google.cloud.discoveryengine.v1beta.IListDocumentsRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
TypeDescription
Promise<[ protos.google.cloud.discoveryengine.v1beta.IDocument[], protos.google.cloud.discoveryengine.v1beta.IListDocumentsRequest | null, protos.google.cloud.discoveryengine.v1beta.IListDocumentsResponse ]>

{Promise} - The promise which resolves to an array. The first element of the array is Array of [Document]. 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 listDocumentsAsync() method described below for async iteration which you can stop as needed. Please see the [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) for more details and examples.

listDocuments(request, options, callback)

listDocuments(request: protos.google.cloud.discoveryengine.v1beta.IListDocumentsRequest, options: CallOptions, callback: PaginationCallback<protos.google.cloud.discoveryengine.v1beta.IListDocumentsRequest, protos.google.cloud.discoveryengine.v1beta.IListDocumentsResponse | null | undefined, protos.google.cloud.discoveryengine.v1beta.IDocument>): void;
Parameters
NameDescription
request protos.google.cloud.discoveryengine.v1beta.IListDocumentsRequest
options CallOptions
callback PaginationCallback<protos.google.cloud.discoveryengine.v1beta.IListDocumentsRequest, protos.google.cloud.discoveryengine.v1beta.IListDocumentsResponse | null | undefined, protos.google.cloud.discoveryengine.v1beta.IDocument>
Returns
TypeDescription
void

listDocuments(request, callback)

listDocuments(request: protos.google.cloud.discoveryengine.v1beta.IListDocumentsRequest, callback: PaginationCallback<protos.google.cloud.discoveryengine.v1beta.IListDocumentsRequest, protos.google.cloud.discoveryengine.v1beta.IListDocumentsResponse | null | undefined, protos.google.cloud.discoveryengine.v1beta.IDocument>): void;
Parameters
NameDescription
request protos.google.cloud.discoveryengine.v1beta.IListDocumentsRequest
callback PaginationCallback<protos.google.cloud.discoveryengine.v1beta.IListDocumentsRequest, protos.google.cloud.discoveryengine.v1beta.IListDocumentsResponse | null | undefined, protos.google.cloud.discoveryengine.v1beta.IDocument>
Returns
TypeDescription
void

listDocumentsAsync(request, options)

listDocumentsAsync(request?: protos.google.cloud.discoveryengine.v1beta.IListDocumentsRequest, options?: CallOptions): AsyncIterable<protos.google.cloud.discoveryengine.v1beta.IDocument>;

Equivalent to listDocuments, but returns an iterable object.

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

Parameters
NameDescription
request protos.google.cloud.discoveryengine.v1beta.IListDocumentsRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
TypeDescription
AsyncIterable<protos.google.cloud.discoveryengine.v1beta.IDocument>

{Object} An iterable Object that allows [async iteration](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols). When you iterate the returned iterable, each element will be an object representing [Document]. 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](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) 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 branch resource name, such as
   *  `projects/{project}/locations/{location}/dataStores/{data_store}/branches/{branch}`.
   *  Use `default_branch` as the branch ID, to list documents under the default
   *  branch.
   *  If the caller does not have permission to list Documents  s under this
   *  branch, regardless of whether or not this branch exists, a
   *  PERMISSION_DENIED error is returned.
   */
  // const parent = 'abc123'
  /**
   *  Maximum number of Document google.cloud.discoveryengine.v1beta.Document s
   *  to return. If unspecified, defaults to 100. The maximum allowed value is
   *  1000. Values above 1000 will be coerced to 1000.
   *  If this field is negative, an INVALID_ARGUMENT error is returned.
   */
  // const pageSize = 1234
  /**
   *  A page token
   *  ListDocumentsResponse.next_page_token google.cloud.discoveryengine.v1beta.ListDocumentsResponse.next_page_token,
   *  received from a previous
   *  DocumentService.ListDocuments google.cloud.discoveryengine.v1beta.DocumentService.ListDocuments 
   *  call. Provide this to retrieve the subsequent page.
   *  When paginating, all other parameters provided to
   *  DocumentService.ListDocuments google.cloud.discoveryengine.v1beta.DocumentService.ListDocuments 
   *  must match the call that provided the page token. Otherwise, an
   *  INVALID_ARGUMENT error is returned.
   */
  // const pageToken = 'abc123'

  // Imports the Discoveryengine library
  const {DocumentServiceClient} = require('@google-cloud/discoveryengine').v1beta;

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

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

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

  callListDocuments();

listDocumentsStream(request, options)

listDocumentsStream(request?: protos.google.cloud.discoveryengine.v1beta.IListDocumentsRequest, options?: CallOptions): Transform;

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

Parameters
NameDescription
request protos.google.cloud.discoveryengine.v1beta.IListDocumentsRequest

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 [Document] 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 listDocumentsAsync() method described below for async iteration which you can stop as needed. Please see the [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) for more details and examples.

listOperationsAsync(request, options)

listOperationsAsync(request: protos.google.longrunning.ListOperationsRequest, options?: gax.CallOptions): AsyncIterable<protos.google.longrunning.ListOperationsResponse>;

Lists operations that match the specified filter in the request. If the server doesn't support this method, it returns UNIMPLEMENTED. Returns an iterable object.

For-await-of syntax is used with the iterable to recursively get response element on-demand.

Parameters
NameDescription
request protos.google.longrunning.ListOperationsRequest

The request object that will be sent.

options gax.CallOptions

Optional parameters. You can override the default settings for this call, e.g, timeout, retries, paginations, etc. See [gax.CallOptions]https://googleapis.github.io/gax-nodejs/global.html#CallOptions for the details.

Returns
TypeDescription
AsyncIterable<protos.google.longrunning.ListOperationsResponse>

{Object} An iterable Object that conforms to https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols.

Example

const client = longrunning.operationsClient();
for await (const response of client.listOperationsAsync(request));
// doThingsWith(response)

matchBranchFromBranchName(branchName)

matchBranchFromBranchName(branchName: string): string | number;

Parse the branch from Branch resource.

Parameter
NameDescription
branchName string

A fully-qualified path representing Branch resource.

Returns
TypeDescription
string | number

{string} A string representing the branch.

matchBranchFromDocumentName(documentName)

matchBranchFromDocumentName(documentName: string): string | number;

Parse the branch from Document resource.

Parameter
NameDescription
documentName string

A fully-qualified path representing Document resource.

Returns
TypeDescription
string | number

{string} A string representing the branch.

matchDataStoreFromBranchName(branchName)

matchDataStoreFromBranchName(branchName: string): string | number;

Parse the data_store from Branch resource.

Parameter
NameDescription
branchName string

A fully-qualified path representing Branch resource.

Returns
TypeDescription
string | number

{string} A string representing the data_store.

matchDataStoreFromDocumentName(documentName)

matchDataStoreFromDocumentName(documentName: string): string | number;

Parse the data_store from Document resource.

Parameter
NameDescription
documentName string

A fully-qualified path representing Document resource.

Returns
TypeDescription
string | number

{string} A string representing the data_store.

matchDocumentFromDocumentName(documentName)

matchDocumentFromDocumentName(documentName: string): string | number;

Parse the document from Document resource.

Parameter
NameDescription
documentName string

A fully-qualified path representing Document resource.

Returns
TypeDescription
string | number

{string} A string representing the document.

matchLocationFromBranchName(branchName)

matchLocationFromBranchName(branchName: string): string | number;

Parse the location from Branch resource.

Parameter
NameDescription
branchName string

A fully-qualified path representing Branch resource.

Returns
TypeDescription
string | number

{string} A string representing the location.

matchLocationFromDocumentName(documentName)

matchLocationFromDocumentName(documentName: string): string | number;

Parse the location from Document resource.

Parameter
NameDescription
documentName string

A fully-qualified path representing Document resource.

Returns
TypeDescription
string | number

{string} A string representing the location.

matchProjectFromBranchName(branchName)

matchProjectFromBranchName(branchName: string): string | number;

Parse the project from Branch resource.

Parameter
NameDescription
branchName string

A fully-qualified path representing Branch resource.

Returns
TypeDescription
string | number

{string} A string representing the project.

matchProjectFromDocumentName(documentName)

matchProjectFromDocumentName(documentName: string): string | number;

Parse the project from Document resource.

Parameter
NameDescription
documentName string

A fully-qualified path representing Document resource.

Returns
TypeDescription
string | number

{string} A string representing the project.

updateDocument(request, options)

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

Updates a .

Parameters
NameDescription
request protos.google.cloud.discoveryengine.v1beta.IUpdateDocumentRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
TypeDescription
Promise<[ protos.google.cloud.discoveryengine.v1beta.IDocument, (protos.google.cloud.discoveryengine.v1beta.IUpdateDocumentRequest | 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](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) 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 document to update/create.
   *  If the caller does not have permission to update the
   *  Document google.cloud.discoveryengine.v1beta.Document, regardless of
   *  whether or not it exists, a PERMISSION_DENIED error is returned.
   *  If the Document google.cloud.discoveryengine.v1beta.Document  to update
   *  does not exist and
   *  allow_missing google.cloud.discoveryengine.v1beta.UpdateDocumentRequest.allow_missing 
   *  is not set, a NOT_FOUND error is returned.
   */
  // const document = {}
  /**
   *  If set to true, and the
   *  Document google.cloud.discoveryengine.v1beta.Document  is not found, a
   *  new Document google.cloud.discoveryengine.v1beta.Document  will be
   *  created.
   */
  // const allowMissing = true

  // Imports the Discoveryengine library
  const {DocumentServiceClient} = require('@google-cloud/discoveryengine').v1beta;

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

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

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

  callUpdateDocument();

updateDocument(request, options, callback)

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

updateDocument(request, callback)

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