Constructor

EntityTypesClient

new EntityTypesClient(options)

Construct an instance of EntityTypesClient.

Parameter

options

Optional

object

The configuration object. See the subsequent parameters for more details.

Values in options have the following properties:

Parameter

credentials

Optional

object

Credentials object.

credentials.client_email

Optional

string

credentials.private_key

Optional

string

email

Optional

string

Account email address. Required when using a .pem or .p12 keyFilename.

keyFilename

Optional

string

Full path to the a .json, .pem, or .p12 key downloaded from the Google Developers Console. If you provide a path to a JSON file, the projectId option below is not necessary. NOTE: .pem and .p12 require you to specify options.email as well.

port

Optional

number

The port on which to connect to the remote host.

projectId

Optional

string

The project ID from the Google Developer's Console, e.g. 'grape-spaceship-123'. We will also check the environment variable GCLOUD_PROJECT for your project ID. If your app is running in an environment which supports Application Default Credentials, your project ID will be detected automatically.

promise

Optional

function()

Custom promise module to use instead of native Promises.

servicePath

Optional

string

The domain name of the API remote host.

Properties

port

static

The port for this API service.

scopes

static

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

servicePath

static

The DNS address for this API service.

Methods

batchCreateEntities

batchCreateEntities(request, options, callback) returns Promise

Creates multiple new entities in the specified entity type (extends the existing collection of entries).

Operation <response: google.protobuf.Empty>

Parameter

request

Object

The request object that will be sent.

Values in request have the following properties:

Parameter

parent

string

Required. The name of the entity type to create entities in. Format: projects/<Project ID>/agent/entityTypes/<Entity Type ID>.

entities

Array of Object

Required. The collection of entities to create.

This object should have the same structure as Entity

languageCode

Optional

string

Optional. The language of entity synonyms defined in entities. If not specified, the agent's default language is used. More than a dozen languages are supported. Note: languages must be enabled in the agent, before they can be used.

options

Optional

Object

Optional parameters. You can override the default settings for this call, e.g, timeout, retries, paginations, etc. See gax.CallOptions for the details.

callback

Optional

function(nullable Error, nullable Object)

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

The second parameter to the callback is a gax.Operation object.

Returns

Promise 

  • The promise which resolves to an array. The first element of the array is a gax.Operation object. The promise has a method named "cancel" which cancels the ongoing API call.

Example

const dialogflow = require('dialogflow');

const client = new dialogflow.v2.EntityTypesClient({
  // optional auth parameters.
});

const formattedParent = client.entityTypePath('[PROJECT]', '[ENTITY_TYPE]');
const entities = [];
const request = {
  parent: formattedParent,
  entities: entities,
};

// Handle the operation using the promise pattern.
client.batchCreateEntities(request)
  .then(responses => {
    const [operation, initialApiResponse] = responses;

    // Operation#promise starts polling for the completion of the LRO.
    return operation.promise();
  })
  .then(responses => {
    const result = responses[0];
    const metadata = responses[1];
    const finalApiResponse = responses[2];
  })
  .catch(err => {
    console.error(err);
  });

const formattedParent = client.entityTypePath('[PROJECT]', '[ENTITY_TYPE]');
const entities = [];
const request = {
  parent: formattedParent,
  entities: entities,
};

// Handle the operation using the event emitter pattern.
client.batchCreateEntities(request)
  .then(responses => {
    const [operation, initialApiResponse] = responses;

    // Adding a listener for the "complete" event starts polling for the
    // completion of the operation.
    operation.on('complete', (result, metadata, finalApiResponse) => {
      // doSomethingWith(result);
    });

    // Adding a listener for the "progress" event causes the callback to be
    // called on any change in metadata when the operation is polled.
    operation.on('progress', (metadata, apiResponse) => {
      // doSomethingWith(metadata)
    });

    // Adding a listener for the "error" event handles any errors found during polling.
    operation.on('error', err => {
      // throw(err);
    });
  })
  .catch(err => {
    console.error(err);
  });

const formattedParent = client.entityTypePath('[PROJECT]', '[ENTITY_TYPE]');
const entities = [];
const request = {
  parent: formattedParent,
  entities: entities,
};

// Handle the operation using the await pattern.
const [operation] = await client.batchCreateEntities(request);

const [response] = await operation.promise();

batchDeleteEntities

batchDeleteEntities(request, options, callback) returns Promise

Deletes entities in the specified entity type.

Operation <response: google.protobuf.Empty, metadata: google.protobuf.Struct>

Parameter

request

Object

The request object that will be sent.

Values in request have the following properties:

Parameter

parent

string

Required. The name of the entity type to delete entries for. Format: projects/<Project ID>/agent/entityTypes/<Entity Type ID>.

entityValues

Array of string

Required. The canonical values of the entities to delete. Note that these are not fully-qualified names, i.e. they don't start with projects/<Project ID>.

languageCode

Optional

string

Optional. The language of entity synonyms defined in entities. If not specified, the agent's default language is used. More than a dozen languages are supported. Note: languages must be enabled in the agent, before they can be used.

options

Optional

Object

Optional parameters. You can override the default settings for this call, e.g, timeout, retries, paginations, etc. See gax.CallOptions for the details.

callback

Optional

function(nullable Error, nullable Object)

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

The second parameter to the callback is a gax.Operation object.

Returns

Promise 

  • The promise which resolves to an array. The first element of the array is a gax.Operation object. The promise has a method named "cancel" which cancels the ongoing API call.

Example

const dialogflow = require('dialogflow');

const client = new dialogflow.v2.EntityTypesClient({
  // optional auth parameters.
});

const formattedParent = client.entityTypePath('[PROJECT]', '[ENTITY_TYPE]');
const entityValues = [];
const request = {
  parent: formattedParent,
  entityValues: entityValues,
};

// Handle the operation using the promise pattern.
client.batchDeleteEntities(request)
  .then(responses => {
    const [operation, initialApiResponse] = responses;

    // Operation#promise starts polling for the completion of the LRO.
    return operation.promise();
  })
  .then(responses => {
    const result = responses[0];
    const metadata = responses[1];
    const finalApiResponse = responses[2];
  })
  .catch(err => {
    console.error(err);
  });

const formattedParent = client.entityTypePath('[PROJECT]', '[ENTITY_TYPE]');
const entityValues = [];
const request = {
  parent: formattedParent,
  entityValues: entityValues,
};

// Handle the operation using the event emitter pattern.
client.batchDeleteEntities(request)
  .then(responses => {
    const [operation, initialApiResponse] = responses;

    // Adding a listener for the "complete" event starts polling for the
    // completion of the operation.
    operation.on('complete', (result, metadata, finalApiResponse) => {
      // doSomethingWith(result);
    });

    // Adding a listener for the "progress" event causes the callback to be
    // called on any change in metadata when the operation is polled.
    operation.on('progress', (metadata, apiResponse) => {
      // doSomethingWith(metadata)
    });

    // Adding a listener for the "error" event handles any errors found during polling.
    operation.on('error', err => {
      // throw(err);
    });
  })
  .catch(err => {
    console.error(err);
  });

const formattedParent = client.entityTypePath('[PROJECT]', '[ENTITY_TYPE]');
const entityValues = [];
const request = {
  parent: formattedParent,
  entityValues: entityValues,
};

// Handle the operation using the await pattern.
const [operation] = await client.batchDeleteEntities(request);

const [response] = await operation.promise();

batchDeleteEntityTypes

batchDeleteEntityTypes(request, options, callback) returns Promise

Deletes entity types in the specified agent.

Operation <response: google.protobuf.Empty, metadata: google.protobuf.Struct>

Parameter

request

Object

The request object that will be sent.

Values in request have the following properties:

Parameter

parent

string

Required. The name of the agent to delete all entities types for. Format: projects/<Project ID>/agent.

entityTypeNames

Array of string

Required. The names entity types to delete. All names must point to the same agent as parent.

options

Optional

Object

Optional parameters. You can override the default settings for this call, e.g, timeout, retries, paginations, etc. See gax.CallOptions for the details.

callback

Optional

function(nullable Error, nullable Object)

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

The second parameter to the callback is a gax.Operation object.

Returns

Promise 

  • The promise which resolves to an array. The first element of the array is a gax.Operation object. The promise has a method named "cancel" which cancels the ongoing API call.

Example

const dialogflow = require('dialogflow');

const client = new dialogflow.v2.EntityTypesClient({
  // optional auth parameters.
});

const formattedParent = client.projectAgentPath('[PROJECT]');
const entityTypeNames = [];
const request = {
  parent: formattedParent,
  entityTypeNames: entityTypeNames,
};

// Handle the operation using the promise pattern.
client.batchDeleteEntityTypes(request)
  .then(responses => {
    const [operation, initialApiResponse] = responses;

    // Operation#promise starts polling for the completion of the LRO.
    return operation.promise();
  })
  .then(responses => {
    const result = responses[0];
    const metadata = responses[1];
    const finalApiResponse = responses[2];
  })
  .catch(err => {
    console.error(err);
  });

const formattedParent = client.projectAgentPath('[PROJECT]');
const entityTypeNames = [];
const request = {
  parent: formattedParent,
  entityTypeNames: entityTypeNames,
};

// Handle the operation using the event emitter pattern.
client.batchDeleteEntityTypes(request)
  .then(responses => {
    const [operation, initialApiResponse] = responses;

    // Adding a listener for the "complete" event starts polling for the
    // completion of the operation.
    operation.on('complete', (result, metadata, finalApiResponse) => {
      // doSomethingWith(result);
    });

    // Adding a listener for the "progress" event causes the callback to be
    // called on any change in metadata when the operation is polled.
    operation.on('progress', (metadata, apiResponse) => {
      // doSomethingWith(metadata)
    });

    // Adding a listener for the "error" event handles any errors found during polling.
    operation.on('error', err => {
      // throw(err);
    });
  })
  .catch(err => {
    console.error(err);
  });

const formattedParent = client.projectAgentPath('[PROJECT]');
const entityTypeNames = [];
const request = {
  parent: formattedParent,
  entityTypeNames: entityTypeNames,
};

// Handle the operation using the await pattern.
const [operation] = await client.batchDeleteEntityTypes(request);

const [response] = await operation.promise();

batchUpdateEntities

batchUpdateEntities(request, options, callback) returns Promise

Updates entities in the specified entity type (replaces the existing collection of entries).

Operation <response: google.protobuf.Empty, metadata: google.protobuf.Struct>

Parameter

request

Object

The request object that will be sent.

Values in request have the following properties:

Parameter

parent

string

Required. The name of the entity type to update the entities in. Format: projects/<Project ID>/agent/entityTypes/<Entity Type ID>.

entities

Array of Object

Required. The collection of new entities to replace the existing entities.

This object should have the same structure as Entity

languageCode

Optional

string

Optional. The language of entity synonyms defined in entities. If not specified, the agent's default language is used. More than a dozen languages are supported. Note: languages must be enabled in the agent, before they can be used.

updateMask

Optional

Object

Optional. The mask to control which fields get updated.

This object should have the same structure as FieldMask

options

Optional

Object

Optional parameters. You can override the default settings for this call, e.g, timeout, retries, paginations, etc. See gax.CallOptions for the details.

callback

Optional

function(nullable Error, nullable Object)

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

The second parameter to the callback is a gax.Operation object.

Returns

Promise 

  • The promise which resolves to an array. The first element of the array is a gax.Operation object. The promise has a method named "cancel" which cancels the ongoing API call.

Example

const dialogflow = require('dialogflow');

const client = new dialogflow.v2.EntityTypesClient({
  // optional auth parameters.
});

const formattedParent = client.entityTypePath('[PROJECT]', '[ENTITY_TYPE]');
const entities = [];
const request = {
  parent: formattedParent,
  entities: entities,
};

// Handle the operation using the promise pattern.
client.batchUpdateEntities(request)
  .then(responses => {
    const [operation, initialApiResponse] = responses;

    // Operation#promise starts polling for the completion of the LRO.
    return operation.promise();
  })
  .then(responses => {
    const result = responses[0];
    const metadata = responses[1];
    const finalApiResponse = responses[2];
  })
  .catch(err => {
    console.error(err);
  });

const formattedParent = client.entityTypePath('[PROJECT]', '[ENTITY_TYPE]');
const entities = [];
const request = {
  parent: formattedParent,
  entities: entities,
};

// Handle the operation using the event emitter pattern.
client.batchUpdateEntities(request)
  .then(responses => {
    const [operation, initialApiResponse] = responses;

    // Adding a listener for the "complete" event starts polling for the
    // completion of the operation.
    operation.on('complete', (result, metadata, finalApiResponse) => {
      // doSomethingWith(result);
    });

    // Adding a listener for the "progress" event causes the callback to be
    // called on any change in metadata when the operation is polled.
    operation.on('progress', (metadata, apiResponse) => {
      // doSomethingWith(metadata)
    });

    // Adding a listener for the "error" event handles any errors found during polling.
    operation.on('error', err => {
      // throw(err);
    });
  })
  .catch(err => {
    console.error(err);
  });

const formattedParent = client.entityTypePath('[PROJECT]', '[ENTITY_TYPE]');
const entities = [];
const request = {
  parent: formattedParent,
  entities: entities,
};

// Handle the operation using the await pattern.
const [operation] = await client.batchUpdateEntities(request);

const [response] = await operation.promise();

batchUpdateEntityTypes

batchUpdateEntityTypes(request, options, callback) returns Promise

Updates/Creates multiple entity types in the specified agent.

Operation <response: BatchUpdateEntityTypesResponse, metadata: google.protobuf.Struct>

Parameter

request

Object

The request object that will be sent.

Values in request have the following properties:

Parameter

parent

string

Required. The name of the agent to update or create entity types in. Format: projects/<Project ID>/agent.

entityTypeBatchUri

Optional

string

The URI to a Google Cloud Storage file containing entity types to update or create. The file format can either be a serialized proto (of EntityBatch type) or a JSON object. Note: The URI must start with "gs://".

entityTypeBatchInline

Optional

Object

The collection of entity type to update or create.

This object should have the same structure as EntityTypeBatch

languageCode

Optional

string

Optional. The language of entity synonyms defined in entity_types. If not specified, the agent's default language is used. More than a dozen languages are supported. Note: languages must be enabled in the agent, before they can be used.

updateMask

Optional

Object

Optional. The mask to control which fields get updated.

This object should have the same structure as FieldMask

options

Optional

Object

Optional parameters. You can override the default settings for this call, e.g, timeout, retries, paginations, etc. See gax.CallOptions for the details.

callback

Optional

function(nullable Error, nullable Object)

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

The second parameter to the callback is a gax.Operation object.

Returns

Promise 

  • The promise which resolves to an array. The first element of the array is a gax.Operation object. The promise has a method named "cancel" which cancels the ongoing API call.

Example

const dialogflow = require('dialogflow');

const client = new dialogflow.v2.EntityTypesClient({
  // optional auth parameters.
});

const formattedParent = client.projectAgentPath('[PROJECT]');

// Handle the operation using the promise pattern.
client.batchUpdateEntityTypes({parent: formattedParent})
  .then(responses => {
    const [operation, initialApiResponse] = responses;

    // Operation#promise starts polling for the completion of the LRO.
    return operation.promise();
  })
  .then(responses => {
    const result = responses[0];
    const metadata = responses[1];
    const finalApiResponse = responses[2];
  })
  .catch(err => {
    console.error(err);
  });

const formattedParent = client.projectAgentPath('[PROJECT]');

// Handle the operation using the event emitter pattern.
client.batchUpdateEntityTypes({parent: formattedParent})
  .then(responses => {
    const [operation, initialApiResponse] = responses;

    // Adding a listener for the "complete" event starts polling for the
    // completion of the operation.
    operation.on('complete', (result, metadata, finalApiResponse) => {
      // doSomethingWith(result);
    });

    // Adding a listener for the "progress" event causes the callback to be
    // called on any change in metadata when the operation is polled.
    operation.on('progress', (metadata, apiResponse) => {
      // doSomethingWith(metadata)
    });

    // Adding a listener for the "error" event handles any errors found during polling.
    operation.on('error', err => {
      // throw(err);
    });
  })
  .catch(err => {
    console.error(err);
  });

const formattedParent = client.projectAgentPath('[PROJECT]');

// Handle the operation using the await pattern.
const [operation] = await client.batchUpdateEntityTypes({parent: formattedParent});

const [response] = await operation.promise();

createEntityType

createEntityType(request, options, callback) returns Promise

Creates an entity type in the specified agent.

Parameter

request

Object

The request object that will be sent.

Values in request have the following properties:

Parameter

parent

string

Required. The agent to create a entity type for. Format: projects/<Project ID>/agent.

entityType

Object

Required. The entity type to create.

This object should have the same structure as EntityType

languageCode

Optional

string

Optional. The language of entity synonyms defined in entity_type. If not specified, the agent's default language is used. More than a dozen languages are supported. Note: languages must be enabled in the agent, before they can be used.

options

Optional

Object

Optional parameters. You can override the default settings for this call, e.g, timeout, retries, paginations, etc. See gax.CallOptions for the details.

callback

Optional

function(nullable Error, nullable Object)

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

The second parameter to the callback is an object representing EntityType.

Returns

Promise 

  • The promise which resolves to an array. The first element of the array is an object representing EntityType. The promise has a method named "cancel" which cancels the ongoing API call.

Example

const dialogflow = require('dialogflow');

const client = new dialogflow.v2.EntityTypesClient({
  // optional auth parameters.
});

const formattedParent = client.projectAgentPath('[PROJECT]');
const entityType = {};
const request = {
  parent: formattedParent,
  entityType: entityType,
};
client.createEntityType(request)
  .then(responses => {
    const response = responses[0];
    // doThingsWith(response)
  })
  .catch(err => {
    console.error(err);
  });

deleteEntityType

deleteEntityType(request, options, callback) returns Promise

Deletes the specified entity type.

Parameter

request

Object

The request object that will be sent.

Values in request have the following properties:

Parameter

name

string

Required. The name of the entity type to delete. Format: projects/<Project ID>/agent/entityTypes/<EntityType ID>.

options

Optional

Object

Optional parameters. You can override the default settings for this call, e.g, timeout, retries, paginations, etc. See gax.CallOptions for the details.

callback

Optional

function(nullable Error)

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

Returns

Promise 

  • The promise which resolves when API call finishes. The promise has a method named "cancel" which cancels the ongoing API call.

Example

const dialogflow = require('dialogflow');

const client = new dialogflow.v2.EntityTypesClient({
  // optional auth parameters.
});

const formattedName = client.entityTypePath('[PROJECT]', '[ENTITY_TYPE]');
client.deleteEntityType({name: formattedName}).catch(err => {
  console.error(err);
});

entityTypePath

entityTypePath(project, entityType) returns String

Return a fully-qualified entity_type resource name string.

Parameter

project

String

entityType

String

Returns

String 

getEntityType

getEntityType(request, options, callback) returns Promise

Retrieves the specified entity type.

Parameter

request

Object

The request object that will be sent.

Values in request have the following properties:

Parameter

name

string

Required. The name of the entity type. Format: projects/<Project ID>/agent/entityTypes/<EntityType ID>.

languageCode

Optional

string

Optional. The language to retrieve entity synonyms for. If not specified, the agent's default language is used. More than a dozen languages are supported. Note: languages must be enabled in the agent, before they can be used.

options

Optional

Object

Optional parameters. You can override the default settings for this call, e.g, timeout, retries, paginations, etc. See gax.CallOptions for the details.

callback

Optional

function(nullable Error, nullable Object)

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

The second parameter to the callback is an object representing EntityType.

Returns

Promise 

  • The promise which resolves to an array. The first element of the array is an object representing EntityType. The promise has a method named "cancel" which cancels the ongoing API call.

Example

const dialogflow = require('dialogflow');

const client = new dialogflow.v2.EntityTypesClient({
  // optional auth parameters.
});

const formattedName = client.entityTypePath('[PROJECT]', '[ENTITY_TYPE]');
client.getEntityType({name: formattedName})
  .then(responses => {
    const response = responses[0];
    // doThingsWith(response)
  })
  .catch(err => {
    console.error(err);
  });

getProjectId

getProjectId(callback)

Return the project ID used by this class.

Parameter

callback

function(Error, string)

the callback to be called with the current project Id.

listEntityTypes

listEntityTypes(request, options, callback) returns Promise

Returns the list of all entity types in the specified agent.

Parameter

request

Object

The request object that will be sent.

Values in request have the following properties:

Parameter

parent

string

Required. The agent to list all entity types from. Format: projects/<Project ID>/agent.

languageCode

Optional

string

Optional. The language to list entity synonyms for. If not specified, the agent's default language is used. More than a dozen languages are supported. Note: languages must be enabled in the agent, before they can be used.

pageSize

Optional

number

The maximum number of resources contained in the underlying API response. If page streaming is performed per-resource, this parameter does not affect the return value. If page streaming is performed per-page, this determines the maximum number of resources in a page.

options

Optional

Object

Optional parameters. You can override the default settings for this call, e.g, timeout, retries, paginations, etc. See gax.CallOptions for the details.

callback

Optional

function(nullable Error, nullable Array, nullable Object, nullable Object)

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

The second parameter to the callback is Array of EntityType.

When autoPaginate: false is specified through options, it contains the result in a single response. If the response indicates the next page exists, the third parameter is set to be used for the next request object. The fourth parameter keeps the raw response object of an object representing ListEntityTypesResponse.

Returns

Promise 

  • The promise which resolves to an array. The first element of the array is Array of EntityType.

    When autoPaginate: false is specified through options, the array has three elements. The first element is Array of EntityType in a single response. The second element is the next request object if the response indicates the next page exists, or null. The third element is an object representing ListEntityTypesResponse.

    The promise has a method named "cancel" which cancels the ongoing API call.

Example

const dialogflow = require('dialogflow');

const client = new dialogflow.v2.EntityTypesClient({
  // optional auth parameters.
});

// Iterate over all elements.
const formattedParent = client.projectAgentPath('[PROJECT]');

client.listEntityTypes({parent: formattedParent})
  .then(responses => {
    const resources = responses[0];
    for (const resource of resources) {
      // doThingsWith(resource)
    }
  })
  .catch(err => {
    console.error(err);
  });

// Or obtain the paged response.
const formattedParent = client.projectAgentPath('[PROJECT]');


const options = {autoPaginate: false};
const callback = responses => {
  // The actual resources in a response.
  const resources = responses[0];
  // The next request if the response shows that there are more responses.
  const nextRequest = responses[1];
  // The actual response object, if necessary.
  // const rawResponse = responses[2];
  for (const resource of resources) {
    // doThingsWith(resource);
  }
  if (nextRequest) {
    // Fetch the next page.
    return client.listEntityTypes(nextRequest, options).then(callback);
  }
}
client.listEntityTypes({parent: formattedParent}, options)
  .then(callback)
  .catch(err => {
    console.error(err);
  });

listEntityTypesStream

listEntityTypesStream(request, options) returns Stream

Equivalent to listEntityTypes, but returns a NodeJS Stream object.

This fetches the paged responses for listEntityTypes continuously and invokes the callback registered for 'data' event for each element in the responses.

The returned object has 'end' method when no more elements are required.

autoPaginate option will be ignored.

Parameter

request

Object

The request object that will be sent.

Values in request have the following properties:

Parameter

parent

string

Required. The agent to list all entity types from. Format: projects/<Project ID>/agent.

languageCode

Optional

string

Optional. The language to list entity synonyms for. If not specified, the agent's default language is used. More than a dozen languages are supported. Note: languages must be enabled in the agent, before they can be used.

pageSize

Optional

number

The maximum number of resources contained in the underlying API response. If page streaming is performed per-resource, this parameter does not affect the return value. If page streaming is performed per-page, this determines the maximum number of resources in a page.

options

Optional

Object

Optional parameters. You can override the default settings for this call, e.g, timeout, retries, paginations, etc. See gax.CallOptions for the details.

See also
https://nodejs.org/api/stream.html
Returns

Stream 

An object stream which emits an object representing EntityType on 'data' event.

Example

const dialogflow = require('dialogflow');

const client = new dialogflow.v2.EntityTypesClient({
  // optional auth parameters.
});

const formattedParent = client.projectAgentPath('[PROJECT]');
client.listEntityTypesStream({parent: formattedParent})
  .on('data', element => {
    // doThingsWith(element)
  }).on('error', err => {
    console.log(err);
  });

matchEntityTypeFromEntityTypeName

matchEntityTypeFromEntityTypeName(entityTypeName) returns String

Parse the entityTypeName from a entity_type resource.

Parameter

entityTypeName

String

A fully-qualified path representing a entity_type resources.

Returns

String 

  • A string representing the entity_type.

matchProjectFromEntityTypeName

matchProjectFromEntityTypeName(entityTypeName) returns String

Parse the entityTypeName from a entity_type resource.

Parameter

entityTypeName

String

A fully-qualified path representing a entity_type resources.

Returns

String 

  • A string representing the project.

matchProjectFromProjectAgentName

matchProjectFromProjectAgentName(projectAgentName) returns String

Parse the projectAgentName from a project_agent resource.

Parameter

projectAgentName

String

A fully-qualified path representing a project_agent resources.

Returns

String 

  • A string representing the project.

projectAgentPath

projectAgentPath(project) returns String

Return a fully-qualified project_agent resource name string.

Parameter

project

String

Returns

String 

updateEntityType

updateEntityType(request, options, callback) returns Promise

Updates the specified entity type.

Parameter

request

Object

The request object that will be sent.

Values in request have the following properties:

Parameter

entityType

Object

Required. The entity type to update. Format: projects/<Project ID>/agent/entityTypes/<EntityType ID>.

This object should have the same structure as EntityType

languageCode

Optional

string

Optional. The language of entity synonyms defined in entity_type. If not specified, the agent's default language is used. More than a dozen languages are supported. Note: languages must be enabled in the agent, before they can be used.

updateMask

Optional

Object

Optional. The mask to control which fields get updated.

This object should have the same structure as FieldMask

options

Optional

Object

Optional parameters. You can override the default settings for this call, e.g, timeout, retries, paginations, etc. See gax.CallOptions for the details.

callback

Optional

function(nullable Error, nullable Object)

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

The second parameter to the callback is an object representing EntityType.

Returns

Promise 

  • The promise which resolves to an array. The first element of the array is an object representing EntityType. The promise has a method named "cancel" which cancels the ongoing API call.

Example

const dialogflow = require('dialogflow');

const client = new dialogflow.v2.EntityTypesClient({
  // optional auth parameters.
});

const entityType = {};
client.updateEntityType({entityType: entityType})
  .then(responses => {
    const response = responses[0];
    // doThingsWith(response)
  })
  .catch(err => {
    console.error(err);
  });