Initial commit
This commit is contained in:
202
node_modules/dialogflow/LICENSE
generated
vendored
Normal file
202
node_modules/dialogflow/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,202 @@
|
||||
|
||||
Apache License
|
||||
Version 2.0, January 2004
|
||||
http://www.apache.org/licenses/
|
||||
|
||||
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||
|
||||
1. Definitions.
|
||||
|
||||
"License" shall mean the terms and conditions for use, reproduction,
|
||||
and distribution as defined by Sections 1 through 9 of this document.
|
||||
|
||||
"Licensor" shall mean the copyright owner or entity authorized by
|
||||
the copyright owner that is granting the License.
|
||||
|
||||
"Legal Entity" shall mean the union of the acting entity and all
|
||||
other entities that control, are controlled by, or are under common
|
||||
control with that entity. For the purposes of this definition,
|
||||
"control" means (i) the power, direct or indirect, to cause the
|
||||
direction or management of such entity, whether by contract or
|
||||
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
||||
outstanding shares, or (iii) beneficial ownership of such entity.
|
||||
|
||||
"You" (or "Your") shall mean an individual or Legal Entity
|
||||
exercising permissions granted by this License.
|
||||
|
||||
"Source" form shall mean the preferred form for making modifications,
|
||||
including but not limited to software source code, documentation
|
||||
source, and configuration files.
|
||||
|
||||
"Object" form shall mean any form resulting from mechanical
|
||||
transformation or translation of a Source form, including but
|
||||
not limited to compiled object code, generated documentation,
|
||||
and conversions to other media types.
|
||||
|
||||
"Work" shall mean the work of authorship, whether in Source or
|
||||
Object form, made available under the License, as indicated by a
|
||||
copyright notice that is included in or attached to the work
|
||||
(an example is provided in the Appendix below).
|
||||
|
||||
"Derivative Works" shall mean any work, whether in Source or Object
|
||||
form, that is based on (or derived from) the Work and for which the
|
||||
editorial revisions, annotations, elaborations, or other modifications
|
||||
represent, as a whole, an original work of authorship. For the purposes
|
||||
of this License, Derivative Works shall not include works that remain
|
||||
separable from, or merely link (or bind by name) to the interfaces of,
|
||||
the Work and Derivative Works thereof.
|
||||
|
||||
"Contribution" shall mean any work of authorship, including
|
||||
the original version of the Work and any modifications or additions
|
||||
to that Work or Derivative Works thereof, that is intentionally
|
||||
submitted to Licensor for inclusion in the Work by the copyright owner
|
||||
or by an individual or Legal Entity authorized to submit on behalf of
|
||||
the copyright owner. For the purposes of this definition, "submitted"
|
||||
means any form of electronic, verbal, or written communication sent
|
||||
to the Licensor or its representatives, including but not limited to
|
||||
communication on electronic mailing lists, source code control systems,
|
||||
and issue tracking systems that are managed by, or on behalf of, the
|
||||
Licensor for the purpose of discussing and improving the Work, but
|
||||
excluding communication that is conspicuously marked or otherwise
|
||||
designated in writing by the copyright owner as "Not a Contribution."
|
||||
|
||||
"Contributor" shall mean Licensor and any individual or Legal Entity
|
||||
on behalf of whom a Contribution has been received by Licensor and
|
||||
subsequently incorporated within the Work.
|
||||
|
||||
2. Grant of Copyright License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
copyright license to reproduce, prepare Derivative Works of,
|
||||
publicly display, publicly perform, sublicense, and distribute the
|
||||
Work and such Derivative Works in Source or Object form.
|
||||
|
||||
3. Grant of Patent License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
(except as stated in this section) patent license to make, have made,
|
||||
use, offer to sell, sell, import, and otherwise transfer the Work,
|
||||
where such license applies only to those patent claims licensable
|
||||
by such Contributor that are necessarily infringed by their
|
||||
Contribution(s) alone or by combination of their Contribution(s)
|
||||
with the Work to which such Contribution(s) was submitted. If You
|
||||
institute patent litigation against any entity (including a
|
||||
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
||||
or a Contribution incorporated within the Work constitutes direct
|
||||
or contributory patent infringement, then any patent licenses
|
||||
granted to You under this License for that Work shall terminate
|
||||
as of the date such litigation is filed.
|
||||
|
||||
4. Redistribution. You may reproduce and distribute copies of the
|
||||
Work or Derivative Works thereof in any medium, with or without
|
||||
modifications, and in Source or Object form, provided that You
|
||||
meet the following conditions:
|
||||
|
||||
(a) You must give any other recipients of the Work or
|
||||
Derivative Works a copy of this License; and
|
||||
|
||||
(b) You must cause any modified files to carry prominent notices
|
||||
stating that You changed the files; and
|
||||
|
||||
(c) You must retain, in the Source form of any Derivative Works
|
||||
that You distribute, all copyright, patent, trademark, and
|
||||
attribution notices from the Source form of the Work,
|
||||
excluding those notices that do not pertain to any part of
|
||||
the Derivative Works; and
|
||||
|
||||
(d) If the Work includes a "NOTICE" text file as part of its
|
||||
distribution, then any Derivative Works that You distribute must
|
||||
include a readable copy of the attribution notices contained
|
||||
within such NOTICE file, excluding those notices that do not
|
||||
pertain to any part of the Derivative Works, in at least one
|
||||
of the following places: within a NOTICE text file distributed
|
||||
as part of the Derivative Works; within the Source form or
|
||||
documentation, if provided along with the Derivative Works; or,
|
||||
within a display generated by the Derivative Works, if and
|
||||
wherever such third-party notices normally appear. The contents
|
||||
of the NOTICE file are for informational purposes only and
|
||||
do not modify the License. You may add Your own attribution
|
||||
notices within Derivative Works that You distribute, alongside
|
||||
or as an addendum to the NOTICE text from the Work, provided
|
||||
that such additional attribution notices cannot be construed
|
||||
as modifying the License.
|
||||
|
||||
You may add Your own copyright statement to Your modifications and
|
||||
may provide additional or different license terms and conditions
|
||||
for use, reproduction, or distribution of Your modifications, or
|
||||
for any such Derivative Works as a whole, provided Your use,
|
||||
reproduction, and distribution of the Work otherwise complies with
|
||||
the conditions stated in this License.
|
||||
|
||||
5. Submission of Contributions. Unless You explicitly state otherwise,
|
||||
any Contribution intentionally submitted for inclusion in the Work
|
||||
by You to the Licensor shall be under the terms and conditions of
|
||||
this License, without any additional terms or conditions.
|
||||
Notwithstanding the above, nothing herein shall supersede or modify
|
||||
the terms of any separate license agreement you may have executed
|
||||
with Licensor regarding such Contributions.
|
||||
|
||||
6. Trademarks. This License does not grant permission to use the trade
|
||||
names, trademarks, service marks, or product names of the Licensor,
|
||||
except as required for reasonable and customary use in describing the
|
||||
origin of the Work and reproducing the content of the NOTICE file.
|
||||
|
||||
7. Disclaimer of Warranty. Unless required by applicable law or
|
||||
agreed to in writing, Licensor provides the Work (and each
|
||||
Contributor provides its Contributions) on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
implied, including, without limitation, any warranties or conditions
|
||||
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
||||
PARTICULAR PURPOSE. You are solely responsible for determining the
|
||||
appropriateness of using or redistributing the Work and assume any
|
||||
risks associated with Your exercise of permissions under this License.
|
||||
|
||||
8. Limitation of Liability. In no event and under no legal theory,
|
||||
whether in tort (including negligence), contract, or otherwise,
|
||||
unless required by applicable law (such as deliberate and grossly
|
||||
negligent acts) or agreed to in writing, shall any Contributor be
|
||||
liable to You for damages, including any direct, indirect, special,
|
||||
incidental, or consequential damages of any character arising as a
|
||||
result of this License or out of the use or inability to use the
|
||||
Work (including but not limited to damages for loss of goodwill,
|
||||
work stoppage, computer failure or malfunction, or any and all
|
||||
other commercial damages or losses), even if such Contributor
|
||||
has been advised of the possibility of such damages.
|
||||
|
||||
9. Accepting Warranty or Additional Liability. While redistributing
|
||||
the Work or Derivative Works thereof, You may choose to offer,
|
||||
and charge a fee for, acceptance of support, warranty, indemnity,
|
||||
or other liability obligations and/or rights consistent with this
|
||||
License. However, in accepting such obligations, You may act only
|
||||
on Your own behalf and on Your sole responsibility, not on behalf
|
||||
of any other Contributor, and only if You agree to indemnify,
|
||||
defend, and hold each Contributor harmless for any liability
|
||||
incurred by, or claims asserted against, such Contributor by reason
|
||||
of your accepting any such warranty or additional liability.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
APPENDIX: How to apply the Apache License to your work.
|
||||
|
||||
To apply the Apache License to your work, attach the following
|
||||
boilerplate notice, with the fields enclosed by brackets "[]"
|
||||
replaced with your own identifying information. (Don't include
|
||||
the brackets!) The text should be enclosed in the appropriate
|
||||
comment syntax for the file format. We also recommend that a
|
||||
file or class name and description of purpose be included on the
|
||||
same "printed page" as the copyright notice for easier
|
||||
identification within third-party archives.
|
||||
|
||||
Copyright [yyyy] [name of copyright owner]
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
43
node_modules/dialogflow/package.json
generated
vendored
Normal file
43
node_modules/dialogflow/package.json
generated
vendored
Normal file
@@ -0,0 +1,43 @@
|
||||
{
|
||||
"name": "dialogflow",
|
||||
"description": "Dialogflow API client for Node.js",
|
||||
"version": "0.5.0",
|
||||
"license": "Apache-2.0",
|
||||
"author": "Google LLC",
|
||||
"engines": {
|
||||
"node": ">=4.0.0"
|
||||
},
|
||||
"repository": "dialogflow/dialogflow-nodejs-client-v2",
|
||||
"main": "src/index.js",
|
||||
"files": [
|
||||
"protos",
|
||||
"src",
|
||||
"AUTHORS",
|
||||
"COPYING"
|
||||
],
|
||||
"dependencies": {
|
||||
"google-gax": "^0.16.0",
|
||||
"lodash.merge": "^4.6.0",
|
||||
"lodash.union": "^4.6.0",
|
||||
"protobufjs": "^6.8.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@google-cloud/common": "^0.18.0",
|
||||
"@google-cloud/nodejs-repo-tools": "^2.1.1",
|
||||
"async": "^2.6.0",
|
||||
"codecov": "^3.0.0",
|
||||
"eslint": "^4.9.0",
|
||||
"eslint-config-prettier": "^2.6.0",
|
||||
"eslint-plugin-node": "^6.0.0",
|
||||
"eslint-plugin-prettier": "^2.3.1",
|
||||
"extend": "^3.0.1",
|
||||
"ink-docstrap": "^1.3.0",
|
||||
"intelli-espower-loader": "^1.0.1",
|
||||
"jsdoc": "^3.5.5",
|
||||
"mocha": "^5.0.0",
|
||||
"nyc": "^11.3.0",
|
||||
"power-assert": "^1.4.4",
|
||||
"prettier": "^1.7.4",
|
||||
"through2": "^2.0.3"
|
||||
}
|
||||
}
|
||||
330
node_modules/dialogflow/protos/google/cloud/dialogflow/v2/agent.proto
generated
vendored
Normal file
330
node_modules/dialogflow/protos/google/cloud/dialogflow/v2/agent.proto
generated
vendored
Normal file
@@ -0,0 +1,330 @@
|
||||
// Copyright 2018 Google Inc.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
syntax = "proto3";
|
||||
|
||||
package google.cloud.dialogflow.v2;
|
||||
|
||||
import "google/api/annotations.proto";
|
||||
import "google/longrunning/operations.proto";
|
||||
import "google/protobuf/empty.proto";
|
||||
import "google/protobuf/field_mask.proto";
|
||||
import "google/protobuf/struct.proto";
|
||||
|
||||
option cc_enable_arenas = true;
|
||||
option csharp_namespace = "Google.Cloud.Dialogflow.V2";
|
||||
option go_package = "google.golang.org/genproto/googleapis/cloud/dialogflow/v2;dialogflow";
|
||||
option java_multiple_files = true;
|
||||
option java_outer_classname = "AgentProto";
|
||||
option java_package = "com.google.cloud.dialogflow.v2";
|
||||
option objc_class_prefix = "DF";
|
||||
|
||||
|
||||
// Agents are best described as Natural Language Understanding (NLU) modules
|
||||
// that transform user requests into actionable data. You can include agents
|
||||
// in your app, product, or service to determine user intent and respond to the
|
||||
// user in a natural way.
|
||||
//
|
||||
// After you create an agent, you can add [Intents][google.cloud.dialogflow.v2.Intents], [Contexts][google.cloud.dialogflow.v2.Contexts],
|
||||
// [Entity Types][google.cloud.dialogflow.v2.EntityTypes], [Webhooks][google.cloud.dialogflow.v2.WebhookRequest], and so on to
|
||||
// manage the flow of a conversation and match user input to predefined intents
|
||||
// and actions.
|
||||
//
|
||||
// You can create an agent using both Dialogflow Standard Edition and
|
||||
// Dialogflow Enterprise Edition. For details, see
|
||||
// [Dialogflow Editions](/dialogflow-enterprise/docs/editions).
|
||||
//
|
||||
// You can save your agent for backup or versioning by exporting the agent by
|
||||
// using the [ExportAgent][google.cloud.dialogflow.v2.Agents.ExportAgent] method. You can import a saved
|
||||
// agent by using the [ImportAgent][google.cloud.dialogflow.v2.Agents.ImportAgent] method.
|
||||
//
|
||||
// Dialogflow provides several
|
||||
// [prebuilt agents](https://dialogflow.com/docs/prebuilt-agents) for common
|
||||
// conversation scenarios such as determining a date and time, converting
|
||||
// currency, and so on.
|
||||
//
|
||||
// For more information about agents, see the
|
||||
// [Dialogflow documentation](https://dialogflow.com/docs/agents).
|
||||
service Agents {
|
||||
// Retrieves the specified agent.
|
||||
rpc GetAgent(GetAgentRequest) returns (Agent) {
|
||||
option (google.api.http) = {
|
||||
get: "/v2/{parent=projects/*}/agent"
|
||||
};
|
||||
}
|
||||
|
||||
// Returns the list of agents.
|
||||
//
|
||||
// Since there is at most one conversational agent per project, this method is
|
||||
// useful primarily for listing all agents across projects the caller has
|
||||
// access to. One can achieve that with a wildcard project collection id "-".
|
||||
// Refer to [List
|
||||
// Sub-Collections](https://cloud.google.com/apis/design/design_patterns#list_sub-collections).
|
||||
rpc SearchAgents(SearchAgentsRequest) returns (SearchAgentsResponse) {
|
||||
option (google.api.http) = {
|
||||
get: "/v2/{parent=projects/*}/agent:search"
|
||||
};
|
||||
}
|
||||
|
||||
// Trains the specified agent.
|
||||
//
|
||||
// Operation <response: [google.protobuf.Empty][google.protobuf.Empty],
|
||||
// metadata: [google.protobuf.Struct][google.protobuf.Struct]>
|
||||
rpc TrainAgent(TrainAgentRequest) returns (google.longrunning.Operation) {
|
||||
option (google.api.http) = {
|
||||
post: "/v2/{parent=projects/*}/agent:train"
|
||||
body: "*"
|
||||
};
|
||||
}
|
||||
|
||||
// Exports the specified agent to a ZIP file.
|
||||
//
|
||||
// Operation <response: [ExportAgentResponse][google.cloud.dialogflow.v2.ExportAgentResponse],
|
||||
// metadata: [google.protobuf.Struct][google.protobuf.Struct]>
|
||||
rpc ExportAgent(ExportAgentRequest) returns (google.longrunning.Operation) {
|
||||
option (google.api.http) = {
|
||||
post: "/v2/{parent=projects/*}/agent:export"
|
||||
body: "*"
|
||||
};
|
||||
}
|
||||
|
||||
// Imports the specified agent from a ZIP file.
|
||||
//
|
||||
// Uploads new intents and entity types without deleting the existing ones.
|
||||
// Intents and entity types with the same name are replaced with the new
|
||||
// versions from ImportAgentRequest.
|
||||
//
|
||||
// Operation <response: [google.protobuf.Empty][google.protobuf.Empty],
|
||||
// metadata: [google.protobuf.Struct][google.protobuf.Struct]>
|
||||
rpc ImportAgent(ImportAgentRequest) returns (google.longrunning.Operation) {
|
||||
option (google.api.http) = {
|
||||
post: "/v2/{parent=projects/*}/agent:import"
|
||||
body: "*"
|
||||
};
|
||||
}
|
||||
|
||||
// Restores the specified agent from a ZIP file.
|
||||
//
|
||||
// Replaces the current agent version with a new one. All the intents and
|
||||
// entity types in the older version are deleted.
|
||||
//
|
||||
// Operation <response: [google.protobuf.Empty][google.protobuf.Empty],
|
||||
// metadata: [google.protobuf.Struct][google.protobuf.Struct]>
|
||||
rpc RestoreAgent(RestoreAgentRequest) returns (google.longrunning.Operation) {
|
||||
option (google.api.http) = {
|
||||
post: "/v2/{parent=projects/*}/agent:restore"
|
||||
body: "*"
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
// Represents a conversational agent.
|
||||
message Agent {
|
||||
// Match mode determines how intents are detected from user queries.
|
||||
enum MatchMode {
|
||||
// Not specified.
|
||||
MATCH_MODE_UNSPECIFIED = 0;
|
||||
|
||||
// Best for agents with a small number of examples in intents and/or wide
|
||||
// use of templates syntax and composite entities.
|
||||
MATCH_MODE_HYBRID = 1;
|
||||
|
||||
// Can be used for agents with a large number of examples in intents,
|
||||
// especially the ones using @sys.any or very large developer entities.
|
||||
MATCH_MODE_ML_ONLY = 2;
|
||||
}
|
||||
|
||||
// Required. The project of this agent.
|
||||
// Format: `projects/<Project ID>`.
|
||||
string parent = 1;
|
||||
|
||||
// Required. The name of this agent.
|
||||
string display_name = 2;
|
||||
|
||||
// Required. The default language of the agent as a language tag. See
|
||||
// [Language Support](https://dialogflow.com/docs/reference/language) for a
|
||||
// list of the currently supported language codes.
|
||||
// This field cannot be set by the `Update` method.
|
||||
string default_language_code = 3;
|
||||
|
||||
// Optional. The list of all languages supported by this agent (except for the
|
||||
// `default_language_code`).
|
||||
repeated string supported_language_codes = 4;
|
||||
|
||||
// Required. The time zone of this agent from the
|
||||
// [time zone database](https://www.iana.org/time-zones), e.g.,
|
||||
// America/New_York, Europe/Paris.
|
||||
string time_zone = 5;
|
||||
|
||||
// Optional. The description of this agent.
|
||||
// The maximum length is 500 characters. If exceeded, the request is rejected.
|
||||
string description = 6;
|
||||
|
||||
// Optional. The URI of the agent's avatar.
|
||||
// Avatars are used throughout the Dialogflow console and in the self-hosted
|
||||
// [Web Demo](https://dialogflow.com/docs/integrations/web-demo) integration.
|
||||
string avatar_uri = 7;
|
||||
|
||||
// Optional. Determines whether this agent should log conversation queries.
|
||||
bool enable_logging = 8;
|
||||
|
||||
// Optional. Determines how intents are detected from user queries.
|
||||
MatchMode match_mode = 9;
|
||||
|
||||
// Optional. To filter out false positive results and still get variety in
|
||||
// matched natural language inputs for your agent, you can tune the machine
|
||||
// learning classification threshold. If the returned score value is less than
|
||||
// the threshold value, then a fallback intent is be triggered or, if there
|
||||
// are no fallback intents defined, no intent will be triggered. The score
|
||||
// values range from 0.0 (completely uncertain) to 1.0 (completely certain).
|
||||
// If set to 0.0, the default of 0.3 is used.
|
||||
float classification_threshold = 10;
|
||||
}
|
||||
|
||||
// The request message for [Agents.GetAgent][google.cloud.dialogflow.v2.Agents.GetAgent].
|
||||
message GetAgentRequest {
|
||||
// Required. The project that the agent to fetch is associated with.
|
||||
// Format: `projects/<Project ID>`.
|
||||
string parent = 1;
|
||||
}
|
||||
|
||||
// The request message for [Agents.SearchAgents][google.cloud.dialogflow.v2.Agents.SearchAgents].
|
||||
message SearchAgentsRequest {
|
||||
// Required. The project to list agents from.
|
||||
// Format: `projects/<Project ID or '-'>`.
|
||||
string parent = 1;
|
||||
|
||||
// Optional. The maximum number of items to return in a single page. By
|
||||
// default 100 and at most 1000.
|
||||
int32 page_size = 2;
|
||||
|
||||
// Optional. The next_page_token value returned from a previous list request.
|
||||
string page_token = 3;
|
||||
}
|
||||
|
||||
// The response message for [Agents.SearchAgents][google.cloud.dialogflow.v2.Agents.SearchAgents].
|
||||
message SearchAgentsResponse {
|
||||
// The list of agents. There will be a maximum number of items returned based
|
||||
// on the page_size field in the request.
|
||||
repeated Agent agents = 1;
|
||||
|
||||
// Token to retrieve the next page of results, or empty if there are no
|
||||
// more results in the list.
|
||||
string next_page_token = 2;
|
||||
}
|
||||
|
||||
// The request message for [Agents.TrainAgent][google.cloud.dialogflow.v2.Agents.TrainAgent].
|
||||
message TrainAgentRequest {
|
||||
// Required. The project that the agent to train is associated with.
|
||||
// Format: `projects/<Project ID>`.
|
||||
string parent = 1;
|
||||
}
|
||||
|
||||
// The request message for [Agents.ExportAgent][google.cloud.dialogflow.v2.Agents.ExportAgent].
|
||||
message ExportAgentRequest {
|
||||
// Required. The project that the agent to export is associated with.
|
||||
// Format: `projects/<Project ID>`.
|
||||
string parent = 1;
|
||||
|
||||
// Optional. The Google Cloud Storage URI to export the agent to.
|
||||
// Note: The URI must start with
|
||||
// "gs://". If left unspecified, the serialized agent is returned inline.
|
||||
string agent_uri = 2;
|
||||
}
|
||||
|
||||
// The response message for [Agents.ExportAgent][google.cloud.dialogflow.v2.Agents.ExportAgent].
|
||||
message ExportAgentResponse {
|
||||
// Required. The exported agent.
|
||||
oneof agent {
|
||||
// The URI to a file containing the exported agent. This field is populated
|
||||
// only if `agent_uri` is specified in `ExportAgentRequest`.
|
||||
string agent_uri = 1;
|
||||
|
||||
// The exported agent.
|
||||
//
|
||||
// Example for how to export an agent to a zip file via a command line:
|
||||
//
|
||||
// curl \
|
||||
// 'https://dialogflow.googleapis.com/v2/projects/<project_name>/agent:export'\
|
||||
// -X POST \
|
||||
// -H 'Authorization: Bearer '$(gcloud auth print-access-token) \
|
||||
// -H 'Accept: application/json' \
|
||||
// -H 'Content-Type: application/json' \
|
||||
// --compressed \
|
||||
// --data-binary '{}' \
|
||||
// | grep agentContent | sed -e 's/.*"agentContent": "\([^"]*\)".*/\1/' \
|
||||
// | base64 --decode > <agent zip file>
|
||||
bytes agent_content = 2;
|
||||
}
|
||||
}
|
||||
|
||||
// The request message for [Agents.ImportAgent][google.cloud.dialogflow.v2.Agents.ImportAgent].
|
||||
message ImportAgentRequest {
|
||||
// Required. The project that the agent to import is associated with.
|
||||
// Format: `projects/<Project ID>`.
|
||||
string parent = 1;
|
||||
|
||||
// Required. The agent to import.
|
||||
oneof agent {
|
||||
// The URI to a Google Cloud Storage file containing the agent to import.
|
||||
// Note: The URI must start with "gs://".
|
||||
string agent_uri = 2;
|
||||
|
||||
// The agent to import.
|
||||
//
|
||||
// Example for how to import an agent via the command line:
|
||||
//
|
||||
// curl \
|
||||
// 'https://dialogflow.googleapis.com/v2/projects/<project_name>/agent:import\
|
||||
// -X POST \
|
||||
// -H 'Authorization: Bearer '$(gcloud auth print-access-token) \
|
||||
// -H 'Accept: application/json' \
|
||||
// -H 'Content-Type: application/json' \
|
||||
// --compressed \
|
||||
// --data-binary "{
|
||||
// 'agentContent': '$(cat <agent zip file> | base64 -w 0)'
|
||||
// }"
|
||||
bytes agent_content = 3;
|
||||
}
|
||||
}
|
||||
|
||||
// The request message for [Agents.RestoreAgent][google.cloud.dialogflow.v2.Agents.RestoreAgent].
|
||||
message RestoreAgentRequest {
|
||||
// Required. The project that the agent to restore is associated with.
|
||||
// Format: `projects/<Project ID>`.
|
||||
string parent = 1;
|
||||
|
||||
// Required. The agent to restore.
|
||||
oneof agent {
|
||||
// The URI to a Google Cloud Storage file containing the agent to restore.
|
||||
// Note: The URI must start with "gs://".
|
||||
string agent_uri = 2;
|
||||
|
||||
// The agent to restore.
|
||||
//
|
||||
// Example for how to restore an agent via the command line:
|
||||
//
|
||||
// curl \
|
||||
// 'https://dialogflow.googleapis.com/v2/projects/<project_name>/agent:restore\
|
||||
// -X POST \
|
||||
// -H 'Authorization: Bearer '$(gcloud auth print-access-token) \
|
||||
// -H 'Accept: application/json' \
|
||||
// -H 'Content-Type: application/json' \
|
||||
// --compressed \
|
||||
// --data-binary "{
|
||||
// 'agentContent': '$(cat <agent zip file> | base64 -w 0)'
|
||||
// }" \
|
||||
bytes agent_content = 3;
|
||||
}
|
||||
}
|
||||
177
node_modules/dialogflow/protos/google/cloud/dialogflow/v2/context.proto
generated
vendored
Normal file
177
node_modules/dialogflow/protos/google/cloud/dialogflow/v2/context.proto
generated
vendored
Normal file
@@ -0,0 +1,177 @@
|
||||
// Copyright 2018 Google Inc.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
syntax = "proto3";
|
||||
|
||||
package google.cloud.dialogflow.v2;
|
||||
|
||||
import "google/api/annotations.proto";
|
||||
import "google/protobuf/empty.proto";
|
||||
import "google/protobuf/field_mask.proto";
|
||||
import "google/protobuf/struct.proto";
|
||||
|
||||
option cc_enable_arenas = true;
|
||||
option csharp_namespace = "Google.Cloud.Dialogflow.V2";
|
||||
option go_package = "google.golang.org/genproto/googleapis/cloud/dialogflow/v2;dialogflow";
|
||||
option java_multiple_files = true;
|
||||
option java_outer_classname = "ContextProto";
|
||||
option java_package = "com.google.cloud.dialogflow.v2";
|
||||
option objc_class_prefix = "DF";
|
||||
|
||||
|
||||
// A context represents additional information included with user input or with
|
||||
// an intent returned by the Dialogflow API. Contexts are helpful for
|
||||
// differentiating user input which may be vague or have a different meaning
|
||||
// depending on additional details from your application such as user setting
|
||||
// and preferences, previous user input, where the user is in your application,
|
||||
// geographic location, and so on.
|
||||
//
|
||||
// You can include contexts as input parameters of a
|
||||
// [DetectIntent][google.cloud.dialogflow.v2.Sessions.DetectIntent] (or
|
||||
// [StreamingDetectIntent][google.cloud.dialogflow.v2.Sessions.StreamingDetectIntent]) request,
|
||||
// or as output contexts included in the returned intent.
|
||||
// Contexts expire when an intent is matched, after the number of `DetectIntent`
|
||||
// requests specified by the `lifespan_count` parameter, or after 10 minutes
|
||||
// if no intents are matched for a `DetectIntent` request.
|
||||
//
|
||||
// For more information about contexts, see the
|
||||
// [Dialogflow documentation](https://dialogflow.com/docs/contexts).
|
||||
service Contexts {
|
||||
// Returns the list of all contexts in the specified session.
|
||||
rpc ListContexts(ListContextsRequest) returns (ListContextsResponse) {
|
||||
option (google.api.http) = {
|
||||
get: "/v2/{parent=projects/*/agent/sessions/*}/contexts"
|
||||
};
|
||||
}
|
||||
|
||||
// Retrieves the specified context.
|
||||
rpc GetContext(GetContextRequest) returns (Context) {
|
||||
option (google.api.http) = {
|
||||
get: "/v2/{name=projects/*/agent/sessions/*/contexts/*}"
|
||||
};
|
||||
}
|
||||
|
||||
// Creates a context.
|
||||
rpc CreateContext(CreateContextRequest) returns (Context) {
|
||||
option (google.api.http) = {
|
||||
post: "/v2/{parent=projects/*/agent/sessions/*}/contexts"
|
||||
body: "context"
|
||||
};
|
||||
}
|
||||
|
||||
// Updates the specified context.
|
||||
rpc UpdateContext(UpdateContextRequest) returns (Context) {
|
||||
option (google.api.http) = {
|
||||
patch: "/v2/{context.name=projects/*/agent/sessions/*/contexts/*}"
|
||||
body: "context"
|
||||
};
|
||||
}
|
||||
|
||||
// Deletes the specified context.
|
||||
rpc DeleteContext(DeleteContextRequest) returns (google.protobuf.Empty) {
|
||||
option (google.api.http) = {
|
||||
delete: "/v2/{name=projects/*/agent/sessions/*/contexts/*}"
|
||||
};
|
||||
}
|
||||
|
||||
// Deletes all active contexts in the specified session.
|
||||
rpc DeleteAllContexts(DeleteAllContextsRequest) returns (google.protobuf.Empty) {
|
||||
option (google.api.http) = {
|
||||
delete: "/v2/{parent=projects/*/agent/sessions/*}/contexts"
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
// Represents a context.
|
||||
message Context {
|
||||
// Required. The unique identifier of the context. Format:
|
||||
// `projects/<Project ID>/agent/sessions/<Session ID>/contexts/<Context ID>`.
|
||||
string name = 1;
|
||||
|
||||
// Optional. The number of conversational query requests after which the
|
||||
// context expires. If set to `0` (the default) the context expires
|
||||
// immediately. Contexts expire automatically after 10 minutes even if there
|
||||
// are no matching queries.
|
||||
int32 lifespan_count = 2;
|
||||
|
||||
// Optional. The collection of parameters associated with this context.
|
||||
// Refer to [this doc](https://dialogflow.com/docs/actions-and-parameters) for
|
||||
// syntax.
|
||||
google.protobuf.Struct parameters = 3;
|
||||
}
|
||||
|
||||
// The request message for [Contexts.ListContexts][google.cloud.dialogflow.v2.Contexts.ListContexts].
|
||||
message ListContextsRequest {
|
||||
// Required. The session to list all contexts from.
|
||||
// Format: `projects/<Project ID>/agent/sessions/<Session ID>`.
|
||||
string parent = 1;
|
||||
|
||||
// Optional. The maximum number of items to return in a single page. By
|
||||
// default 100 and at most 1000.
|
||||
int32 page_size = 2;
|
||||
|
||||
// Optional. The next_page_token value returned from a previous list request.
|
||||
string page_token = 3;
|
||||
}
|
||||
|
||||
// The response message for [Contexts.ListContexts][google.cloud.dialogflow.v2.Contexts.ListContexts].
|
||||
message ListContextsResponse {
|
||||
// The list of contexts. There will be a maximum number of items
|
||||
// returned based on the page_size field in the request.
|
||||
repeated Context contexts = 1;
|
||||
|
||||
// Token to retrieve the next page of results, or empty if there are no
|
||||
// more results in the list.
|
||||
string next_page_token = 2;
|
||||
}
|
||||
|
||||
// The request message for [Contexts.GetContext][google.cloud.dialogflow.v2.Contexts.GetContext].
|
||||
message GetContextRequest {
|
||||
// Required. The name of the context. Format:
|
||||
// `projects/<Project ID>/agent/sessions/<Session ID>/contexts/<Context ID>`.
|
||||
string name = 1;
|
||||
}
|
||||
|
||||
// The request message for [Contexts.CreateContext][google.cloud.dialogflow.v2.Contexts.CreateContext].
|
||||
message CreateContextRequest {
|
||||
// Required. The session to create a context for.
|
||||
// Format: `projects/<Project ID>/agent/sessions/<Session ID>`.
|
||||
string parent = 1;
|
||||
|
||||
// Required. The context to create.
|
||||
Context context = 2;
|
||||
}
|
||||
|
||||
// The request message for [Contexts.UpdateContext][google.cloud.dialogflow.v2.Contexts.UpdateContext].
|
||||
message UpdateContextRequest {
|
||||
// Required. The context to update.
|
||||
Context context = 1;
|
||||
|
||||
// Optional. The mask to control which fields get updated.
|
||||
google.protobuf.FieldMask update_mask = 2;
|
||||
}
|
||||
|
||||
// The request message for [Contexts.DeleteContext][google.cloud.dialogflow.v2.Contexts.DeleteContext].
|
||||
message DeleteContextRequest {
|
||||
// Required. The name of the context to delete. Format:
|
||||
// `projects/<Project ID>/agent/sessions/<Session ID>/contexts/<Context ID>`.
|
||||
string name = 1;
|
||||
}
|
||||
|
||||
// The request message for [Contexts.DeleteAllContexts][google.cloud.dialogflow.v2.Contexts.DeleteAllContexts].
|
||||
message DeleteAllContextsRequest {
|
||||
// Required. The name of the session to delete all contexts from. Format:
|
||||
// `projects/<Project ID>/agent/sessions/<Session ID>`.
|
||||
string parent = 1;
|
||||
}
|
||||
419
node_modules/dialogflow/protos/google/cloud/dialogflow/v2/entity_type.proto
generated
vendored
Normal file
419
node_modules/dialogflow/protos/google/cloud/dialogflow/v2/entity_type.proto
generated
vendored
Normal file
@@ -0,0 +1,419 @@
|
||||
// Copyright 2018 Google Inc.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
syntax = "proto3";
|
||||
|
||||
package google.cloud.dialogflow.v2;
|
||||
|
||||
import "google/api/annotations.proto";
|
||||
import "google/longrunning/operations.proto";
|
||||
import "google/protobuf/empty.proto";
|
||||
import "google/protobuf/field_mask.proto";
|
||||
import "google/protobuf/struct.proto";
|
||||
|
||||
option cc_enable_arenas = true;
|
||||
option csharp_namespace = "Google.Cloud.Dialogflow.V2";
|
||||
option go_package = "google.golang.org/genproto/googleapis/cloud/dialogflow/v2;dialogflow";
|
||||
option java_multiple_files = true;
|
||||
option java_outer_classname = "EntityTypeProto";
|
||||
option java_package = "com.google.cloud.dialogflow.v2";
|
||||
option objc_class_prefix = "DF";
|
||||
|
||||
|
||||
// Entities are extracted from user input and represent parameters that are
|
||||
// meaningful to your application. For example, a date range, a proper name
|
||||
// such as a geographic location or landmark, and so on. Entities represent
|
||||
// actionable data for your application.
|
||||
//
|
||||
// When you define an entity, you can also include synonyms that all map to
|
||||
// that entity. For example, "soft drink", "soda", "pop", and so on.
|
||||
//
|
||||
// There are three types of entities:
|
||||
//
|
||||
// * **System** - entities that are defined by the Dialogflow API for common
|
||||
// data types such as date, time, currency, and so on. A system entity is
|
||||
// represented by the `EntityType` type.
|
||||
//
|
||||
// * **Developer** - entities that are defined by you that represent
|
||||
// actionable data that is meaningful to your application. For example,
|
||||
// you could define a `pizza.sauce` entity for red or white pizza sauce,
|
||||
// a `pizza.cheese` entity for the different types of cheese on a pizza,
|
||||
// a `pizza.topping` entity for different toppings, and so on. A developer
|
||||
// entity is represented by the `EntityType` type.
|
||||
//
|
||||
// * **User** - entities that are built for an individual user such as
|
||||
// favorites, preferences, playlists, and so on. A user entity is
|
||||
// represented by the [SessionEntityType][google.cloud.dialogflow.v2.SessionEntityType] type.
|
||||
//
|
||||
// For more information about entity types, see the
|
||||
// [Dialogflow documentation](https://dialogflow.com/docs/entities).
|
||||
service EntityTypes {
|
||||
// Returns the list of all entity types in the specified agent.
|
||||
rpc ListEntityTypes(ListEntityTypesRequest) returns (ListEntityTypesResponse) {
|
||||
option (google.api.http) = {
|
||||
get: "/v2/{parent=projects/*/agent}/entityTypes"
|
||||
};
|
||||
}
|
||||
|
||||
// Retrieves the specified entity type.
|
||||
rpc GetEntityType(GetEntityTypeRequest) returns (EntityType) {
|
||||
option (google.api.http) = {
|
||||
get: "/v2/{name=projects/*/agent/entityTypes/*}"
|
||||
};
|
||||
}
|
||||
|
||||
// Creates an entity type in the specified agent.
|
||||
rpc CreateEntityType(CreateEntityTypeRequest) returns (EntityType) {
|
||||
option (google.api.http) = {
|
||||
post: "/v2/{parent=projects/*/agent}/entityTypes"
|
||||
body: "entity_type"
|
||||
};
|
||||
}
|
||||
|
||||
// Updates the specified entity type.
|
||||
rpc UpdateEntityType(UpdateEntityTypeRequest) returns (EntityType) {
|
||||
option (google.api.http) = {
|
||||
patch: "/v2/{entity_type.name=projects/*/agent/entityTypes/*}"
|
||||
body: "entity_type"
|
||||
};
|
||||
}
|
||||
|
||||
// Deletes the specified entity type.
|
||||
rpc DeleteEntityType(DeleteEntityTypeRequest) returns (google.protobuf.Empty) {
|
||||
option (google.api.http) = {
|
||||
delete: "/v2/{name=projects/*/agent/entityTypes/*}"
|
||||
};
|
||||
}
|
||||
|
||||
// Updates/Creates multiple entity types in the specified agent.
|
||||
//
|
||||
// Operation <response: [BatchUpdateEntityTypesResponse][google.cloud.dialogflow.v2.BatchUpdateEntityTypesResponse],
|
||||
// metadata: [google.protobuf.Struct][google.protobuf.Struct]>
|
||||
rpc BatchUpdateEntityTypes(BatchUpdateEntityTypesRequest) returns (google.longrunning.Operation) {
|
||||
option (google.api.http) = {
|
||||
post: "/v2/{parent=projects/*/agent}/entityTypes:batchUpdate"
|
||||
body: "*"
|
||||
};
|
||||
}
|
||||
|
||||
// Deletes entity types in the specified agent.
|
||||
//
|
||||
// Operation <response: [google.protobuf.Empty][google.protobuf.Empty],
|
||||
// metadata: [google.protobuf.Struct][google.protobuf.Struct]>
|
||||
rpc BatchDeleteEntityTypes(BatchDeleteEntityTypesRequest) returns (google.longrunning.Operation) {
|
||||
option (google.api.http) = {
|
||||
post: "/v2/{parent=projects/*/agent}/entityTypes:batchDelete"
|
||||
body: "*"
|
||||
};
|
||||
}
|
||||
|
||||
// Creates multiple new entities in the specified entity type (extends the
|
||||
// existing collection of entries).
|
||||
//
|
||||
// Operation <response: [google.protobuf.Empty][google.protobuf.Empty]>
|
||||
rpc BatchCreateEntities(BatchCreateEntitiesRequest) returns (google.longrunning.Operation) {
|
||||
option (google.api.http) = {
|
||||
post: "/v2/{parent=projects/*/agent/entityTypes/*}/entities:batchCreate"
|
||||
body: "*"
|
||||
};
|
||||
}
|
||||
|
||||
// Updates entities in the specified entity type (replaces the existing
|
||||
// collection of entries).
|
||||
//
|
||||
// Operation <response: [google.protobuf.Empty][google.protobuf.Empty],
|
||||
// metadata: [google.protobuf.Struct][google.protobuf.Struct]>
|
||||
rpc BatchUpdateEntities(BatchUpdateEntitiesRequest) returns (google.longrunning.Operation) {
|
||||
option (google.api.http) = {
|
||||
post: "/v2/{parent=projects/*/agent/entityTypes/*}/entities:batchUpdate"
|
||||
body: "*"
|
||||
};
|
||||
}
|
||||
|
||||
// Deletes entities in the specified entity type.
|
||||
//
|
||||
// Operation <response: [google.protobuf.Empty][google.protobuf.Empty],
|
||||
// metadata: [google.protobuf.Struct][google.protobuf.Struct]>
|
||||
rpc BatchDeleteEntities(BatchDeleteEntitiesRequest) returns (google.longrunning.Operation) {
|
||||
option (google.api.http) = {
|
||||
post: "/v2/{parent=projects/*/agent/entityTypes/*}/entities:batchDelete"
|
||||
body: "*"
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
// Represents an entity type.
|
||||
// Entity types serve as a tool for extracting parameter values from natural
|
||||
// language queries.
|
||||
message EntityType {
|
||||
// Optional. Represents an entity.
|
||||
message Entity {
|
||||
// Required.
|
||||
// For `KIND_MAP` entity types:
|
||||
// A canonical name to be used in place of synonyms.
|
||||
// For `KIND_LIST` entity types:
|
||||
// A string that can contain references to other entity types (with or
|
||||
// without aliases).
|
||||
string value = 1;
|
||||
|
||||
// Required. A collection of synonyms. For `KIND_LIST` entity types this
|
||||
// must contain exactly one synonym equal to `value`.
|
||||
repeated string synonyms = 2;
|
||||
}
|
||||
|
||||
// Represents kinds of entities.
|
||||
enum Kind {
|
||||
// Not specified. This value should be never used.
|
||||
KIND_UNSPECIFIED = 0;
|
||||
|
||||
// Map entity types allow mapping of a group of synonyms to a canonical
|
||||
// value.
|
||||
KIND_MAP = 1;
|
||||
|
||||
// List entity types contain a set of entries that do not map to canonical
|
||||
// values. However, list entity types can contain references to other entity
|
||||
// types (with or without aliases).
|
||||
KIND_LIST = 2;
|
||||
}
|
||||
|
||||
// Represents different entity type expansion modes. Automated expansion
|
||||
// allows an agent to recognize values that have not been explicitly listed in
|
||||
// the entity (for example, new kinds of shopping list items).
|
||||
enum AutoExpansionMode {
|
||||
// Auto expansion disabled for the entity.
|
||||
AUTO_EXPANSION_MODE_UNSPECIFIED = 0;
|
||||
|
||||
// Allows an agent to recognize values that have not been explicitly
|
||||
// listed in the entity.
|
||||
AUTO_EXPANSION_MODE_DEFAULT = 1;
|
||||
}
|
||||
|
||||
// Required for all methods except `create` (`create` populates the name
|
||||
// automatically.
|
||||
// The unique identifier of the entity type. Format:
|
||||
// `projects/<Project ID>/agent/entityTypes/<Entity Type ID>`.
|
||||
string name = 1;
|
||||
|
||||
// Required. The name of the entity.
|
||||
string display_name = 2;
|
||||
|
||||
// Required. Indicates the kind of entity type.
|
||||
Kind kind = 3;
|
||||
|
||||
// Optional. Indicates whether the entity type can be automatically
|
||||
// expanded.
|
||||
AutoExpansionMode auto_expansion_mode = 4;
|
||||
|
||||
// Optional. The collection of entities associated with the entity type.
|
||||
repeated Entity entities = 6;
|
||||
}
|
||||
|
||||
// The request message for [EntityTypes.ListEntityTypes][google.cloud.dialogflow.v2.EntityTypes.ListEntityTypes].
|
||||
message ListEntityTypesRequest {
|
||||
// Required. The agent to list all entity types from.
|
||||
// Format: `projects/<Project ID>/agent`.
|
||||
string parent = 1;
|
||||
|
||||
// Optional. The language to list entity synonyms for. If not specified,
|
||||
// the agent's default language is used.
|
||||
// [More than a dozen
|
||||
// languages](https://dialogflow.com/docs/reference/language) are supported.
|
||||
// Note: languages must be enabled in the agent, before they can be used.
|
||||
string language_code = 2;
|
||||
|
||||
// Optional. The maximum number of items to return in a single page. By
|
||||
// default 100 and at most 1000.
|
||||
int32 page_size = 3;
|
||||
|
||||
// Optional. The next_page_token value returned from a previous list request.
|
||||
string page_token = 4;
|
||||
}
|
||||
|
||||
// The response message for [EntityTypes.ListEntityTypes][google.cloud.dialogflow.v2.EntityTypes.ListEntityTypes].
|
||||
message ListEntityTypesResponse {
|
||||
// The list of agent entity types. There will be a maximum number of items
|
||||
// returned based on the page_size field in the request.
|
||||
repeated EntityType entity_types = 1;
|
||||
|
||||
// Token to retrieve the next page of results, or empty if there are no
|
||||
// more results in the list.
|
||||
string next_page_token = 2;
|
||||
}
|
||||
|
||||
// The request message for [EntityTypes.GetEntityType][google.cloud.dialogflow.v2.EntityTypes.GetEntityType].
|
||||
message GetEntityTypeRequest {
|
||||
// Required. The name of the entity type.
|
||||
// Format: `projects/<Project ID>/agent/entityTypes/<EntityType ID>`.
|
||||
string name = 1;
|
||||
|
||||
// Optional. The language to retrieve entity synonyms for. If not specified,
|
||||
// the agent's default language is used.
|
||||
// [More than a dozen
|
||||
// languages](https://dialogflow.com/docs/reference/language) are supported.
|
||||
// Note: languages must be enabled in the agent, before they can be used.
|
||||
string language_code = 2;
|
||||
}
|
||||
|
||||
// The request message for [EntityTypes.CreateEntityType][google.cloud.dialogflow.v2.EntityTypes.CreateEntityType].
|
||||
message CreateEntityTypeRequest {
|
||||
// Required. The agent to create a entity type for.
|
||||
// Format: `projects/<Project ID>/agent`.
|
||||
string parent = 1;
|
||||
|
||||
// Required. The entity type to create.
|
||||
EntityType entity_type = 2;
|
||||
|
||||
// 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](https://dialogflow.com/docs/reference/language) are supported.
|
||||
// Note: languages must be enabled in the agent, before they can be used.
|
||||
string language_code = 3;
|
||||
}
|
||||
|
||||
// The request message for [EntityTypes.UpdateEntityType][google.cloud.dialogflow.v2.EntityTypes.UpdateEntityType].
|
||||
message UpdateEntityTypeRequest {
|
||||
// Required. The entity type to update.
|
||||
// Format: `projects/<Project ID>/agent/entityTypes/<EntityType ID>`.
|
||||
EntityType entity_type = 1;
|
||||
|
||||
// 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](https://dialogflow.com/docs/reference/language) are supported.
|
||||
// Note: languages must be enabled in the agent, before they can be used.
|
||||
string language_code = 2;
|
||||
|
||||
// Optional. The mask to control which fields get updated.
|
||||
google.protobuf.FieldMask update_mask = 3;
|
||||
}
|
||||
|
||||
// The request message for [EntityTypes.DeleteEntityType][google.cloud.dialogflow.v2.EntityTypes.DeleteEntityType].
|
||||
message DeleteEntityTypeRequest {
|
||||
// Required. The name of the entity type to delete.
|
||||
// Format: `projects/<Project ID>/agent/entityTypes/<EntityType ID>`.
|
||||
string name = 1;
|
||||
}
|
||||
|
||||
// The request message for [EntityTypes.BatchUpdateEntityTypes][google.cloud.dialogflow.v2.EntityTypes.BatchUpdateEntityTypes].
|
||||
message BatchUpdateEntityTypesRequest {
|
||||
// Required. The name of the agent to update or create entity types in.
|
||||
// Format: `projects/<Project ID>/agent`.
|
||||
string parent = 1;
|
||||
|
||||
// Required. The source of the entity type batch.
|
||||
//
|
||||
// For each entity type in the batch:
|
||||
// * If `name` is specified, we update an existing entity type.
|
||||
// * If `name` is not specified, we create a new entity type.
|
||||
oneof entity_type_batch {
|
||||
// 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://".
|
||||
string entity_type_batch_uri = 2;
|
||||
|
||||
// The collection of entity type to update or create.
|
||||
EntityTypeBatch entity_type_batch_inline = 3;
|
||||
}
|
||||
|
||||
// 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](https://dialogflow.com/docs/reference/language) are supported.
|
||||
// Note: languages must be enabled in the agent, before they can be used.
|
||||
string language_code = 4;
|
||||
|
||||
// Optional. The mask to control which fields get updated.
|
||||
google.protobuf.FieldMask update_mask = 5;
|
||||
}
|
||||
|
||||
// The response message for [EntityTypes.BatchUpdateEntityTypes][google.cloud.dialogflow.v2.EntityTypes.BatchUpdateEntityTypes].
|
||||
message BatchUpdateEntityTypesResponse {
|
||||
// The collection of updated or created entity types.
|
||||
repeated EntityType entity_types = 1;
|
||||
}
|
||||
|
||||
// The request message for [EntityTypes.BatchDeleteEntityTypes][google.cloud.dialogflow.v2.EntityTypes.BatchDeleteEntityTypes].
|
||||
message BatchDeleteEntityTypesRequest {
|
||||
// Required. The name of the agent to delete all entities types for. Format:
|
||||
// `projects/<Project ID>/agent`.
|
||||
string parent = 1;
|
||||
|
||||
// Required. The names entity types to delete. All names must point to the
|
||||
// same agent as `parent`.
|
||||
repeated string entity_type_names = 2;
|
||||
}
|
||||
|
||||
// The request message for [EntityTypes.BatchCreateEntities][google.cloud.dialogflow.v2.EntityTypes.BatchCreateEntities].
|
||||
message BatchCreateEntitiesRequest {
|
||||
// Required. The name of the entity type to create entities in. Format:
|
||||
// `projects/<Project ID>/agent/entityTypes/<Entity Type ID>`.
|
||||
string parent = 1;
|
||||
|
||||
// Required. The collection of entities to create.
|
||||
repeated EntityType.Entity entities = 2;
|
||||
|
||||
// Optional. The language of entity synonyms defined in `entities`. If not
|
||||
// specified, the agent's default language is used.
|
||||
// [More than a dozen
|
||||
// languages](https://dialogflow.com/docs/reference/language) are supported.
|
||||
// Note: languages must be enabled in the agent, before they can be used.
|
||||
string language_code = 3;
|
||||
}
|
||||
|
||||
// The response message for [EntityTypes.BatchCreateEntities][google.cloud.dialogflow.v2.EntityTypes.BatchCreateEntities].
|
||||
message BatchUpdateEntitiesRequest {
|
||||
// Required. The name of the entity type to update the entities in. Format:
|
||||
// `projects/<Project ID>/agent/entityTypes/<Entity Type ID>`.
|
||||
string parent = 1;
|
||||
|
||||
// Required. The collection of new entities to replace the existing entities.
|
||||
repeated EntityType.Entity entities = 2;
|
||||
|
||||
// Optional. The language of entity synonyms defined in `entities`. If not
|
||||
// specified, the agent's default language is used.
|
||||
// [More than a dozen
|
||||
// languages](https://dialogflow.com/docs/reference/language) are supported.
|
||||
// Note: languages must be enabled in the agent, before they can be used.
|
||||
string language_code = 3;
|
||||
|
||||
// Optional. The mask to control which fields get updated.
|
||||
google.protobuf.FieldMask update_mask = 4;
|
||||
}
|
||||
|
||||
// The request message for [EntityTypes.BatchDeleteEntities][google.cloud.dialogflow.v2.EntityTypes.BatchDeleteEntities].
|
||||
message BatchDeleteEntitiesRequest {
|
||||
// Required. The name of the entity type to delete entries for. Format:
|
||||
// `projects/<Project ID>/agent/entityTypes/<Entity Type ID>`.
|
||||
string parent = 1;
|
||||
|
||||
// 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>`.
|
||||
repeated string entity_values = 2;
|
||||
|
||||
// Optional. The language of entity synonyms defined in `entities`. If not
|
||||
// specified, the agent's default language is used.
|
||||
// [More than a dozen
|
||||
// languages](https://dialogflow.com/docs/reference/language) are supported.
|
||||
// Note: languages must be enabled in the agent, before they can be used.
|
||||
string language_code = 3;
|
||||
}
|
||||
|
||||
// This message is a wrapper around a collection of entity types.
|
||||
message EntityTypeBatch {
|
||||
// A collection of entity types.
|
||||
repeated EntityType entity_types = 1;
|
||||
}
|
||||
811
node_modules/dialogflow/protos/google/cloud/dialogflow/v2/intent.proto
generated
vendored
Normal file
811
node_modules/dialogflow/protos/google/cloud/dialogflow/v2/intent.proto
generated
vendored
Normal file
@@ -0,0 +1,811 @@
|
||||
// Copyright 2018 Google Inc.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
syntax = "proto3";
|
||||
|
||||
package google.cloud.dialogflow.v2;
|
||||
|
||||
import "google/api/annotations.proto";
|
||||
import "google/cloud/dialogflow/v2/context.proto";
|
||||
import "google/longrunning/operations.proto";
|
||||
import "google/protobuf/empty.proto";
|
||||
import "google/protobuf/field_mask.proto";
|
||||
import "google/protobuf/struct.proto";
|
||||
|
||||
option cc_enable_arenas = true;
|
||||
option csharp_namespace = "Google.Cloud.Dialogflow.V2";
|
||||
option go_package = "google.golang.org/genproto/googleapis/cloud/dialogflow/v2;dialogflow";
|
||||
option java_multiple_files = true;
|
||||
option java_outer_classname = "IntentProto";
|
||||
option java_package = "com.google.cloud.dialogflow.v2";
|
||||
option objc_class_prefix = "DF";
|
||||
|
||||
|
||||
// An intent represents a mapping between input from a user and an action to
|
||||
// be taken by your application. When you pass user input to the
|
||||
// [DetectIntent][google.cloud.dialogflow.v2.Sessions.DetectIntent] (or
|
||||
// [StreamingDetectIntent][google.cloud.dialogflow.v2.Sessions.StreamingDetectIntent]) method, the
|
||||
// Dialogflow API analyzes the input and searches
|
||||
// for a matching intent. If no match is found, the Dialogflow API returns a
|
||||
// fallback intent (`is_fallback` = true).
|
||||
//
|
||||
// You can provide additional information for the Dialogflow API to use to
|
||||
// match user input to an intent by adding the following to your intent.
|
||||
//
|
||||
// * **Contexts** - provide additional context for intent analysis. For
|
||||
// example, if an intent is related to an object in your application that
|
||||
// plays music, you can provide a context to determine when to match the
|
||||
// intent if the user input is “turn it off”. You can include a context
|
||||
// that matches the intent when there is previous user input of
|
||||
// "play music", and not when there is previous user input of
|
||||
// "turn on the light".
|
||||
//
|
||||
// * **Events** - allow for matching an intent by using an event name
|
||||
// instead of user input. Your application can provide an event name and
|
||||
// related parameters to the Dialogflow API to match an intent. For
|
||||
// example, when your application starts, you can send a welcome event
|
||||
// with a user name parameter to the Dialogflow API to match an intent with
|
||||
// a personalized welcome message for the user.
|
||||
//
|
||||
// * **Training phrases** - provide examples of user input to train the
|
||||
// Dialogflow API agent to better match intents.
|
||||
//
|
||||
// For more information about intents, see the
|
||||
// [Dialogflow documentation](https://dialogflow.com/docs/intents).
|
||||
service Intents {
|
||||
// Returns the list of all intents in the specified agent.
|
||||
rpc ListIntents(ListIntentsRequest) returns (ListIntentsResponse) {
|
||||
option (google.api.http) = {
|
||||
get: "/v2/{parent=projects/*/agent}/intents"
|
||||
};
|
||||
}
|
||||
|
||||
// Retrieves the specified intent.
|
||||
rpc GetIntent(GetIntentRequest) returns (Intent) {
|
||||
option (google.api.http) = {
|
||||
get: "/v2/{name=projects/*/agent/intents/*}"
|
||||
};
|
||||
}
|
||||
|
||||
// Creates an intent in the specified agent.
|
||||
rpc CreateIntent(CreateIntentRequest) returns (Intent) {
|
||||
option (google.api.http) = {
|
||||
post: "/v2/{parent=projects/*/agent}/intents"
|
||||
body: "intent"
|
||||
};
|
||||
}
|
||||
|
||||
// Updates the specified intent.
|
||||
rpc UpdateIntent(UpdateIntentRequest) returns (Intent) {
|
||||
option (google.api.http) = {
|
||||
patch: "/v2/{intent.name=projects/*/agent/intents/*}"
|
||||
body: "intent"
|
||||
};
|
||||
}
|
||||
|
||||
// Deletes the specified intent.
|
||||
rpc DeleteIntent(DeleteIntentRequest) returns (google.protobuf.Empty) {
|
||||
option (google.api.http) = {
|
||||
delete: "/v2/{name=projects/*/agent/intents/*}"
|
||||
};
|
||||
}
|
||||
|
||||
// Updates/Creates multiple intents in the specified agent.
|
||||
//
|
||||
// Operation <response: [BatchUpdateIntentsResponse][google.cloud.dialogflow.v2.BatchUpdateIntentsResponse]>
|
||||
rpc BatchUpdateIntents(BatchUpdateIntentsRequest) returns (google.longrunning.Operation) {
|
||||
option (google.api.http) = {
|
||||
post: "/v2/{parent=projects/*/agent}/intents:batchUpdate"
|
||||
body: "*"
|
||||
};
|
||||
}
|
||||
|
||||
// Deletes intents in the specified agent.
|
||||
//
|
||||
// Operation <response: [google.protobuf.Empty][google.protobuf.Empty]>
|
||||
rpc BatchDeleteIntents(BatchDeleteIntentsRequest) returns (google.longrunning.Operation) {
|
||||
option (google.api.http) = {
|
||||
post: "/v2/{parent=projects/*/agent}/intents:batchDelete"
|
||||
body: "*"
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
// Represents an intent.
|
||||
// Intents convert a number of user expressions or patterns into an action. An
|
||||
// action is an extraction of a user command or sentence semantics.
|
||||
message Intent {
|
||||
// Represents an example or template that the agent is trained on.
|
||||
message TrainingPhrase {
|
||||
// Represents a part of a training phrase.
|
||||
message Part {
|
||||
// Required. The text corresponding to the example or template,
|
||||
// if there are no annotations. For
|
||||
// annotated examples, it is the text for one of the example's parts.
|
||||
string text = 1;
|
||||
|
||||
// Optional. The entity type name prefixed with `@`. This field is
|
||||
// required for the annotated part of the text and applies only to
|
||||
// examples.
|
||||
string entity_type = 2;
|
||||
|
||||
// Optional. The parameter name for the value extracted from the
|
||||
// annotated part of the example.
|
||||
string alias = 3;
|
||||
|
||||
// Optional. Indicates whether the text was manually annotated by the
|
||||
// developer.
|
||||
bool user_defined = 4;
|
||||
}
|
||||
|
||||
// Represents different types of training phrases.
|
||||
enum Type {
|
||||
// Not specified. This value should never be used.
|
||||
TYPE_UNSPECIFIED = 0;
|
||||
|
||||
// Examples do not contain @-prefixed entity type names, but example parts
|
||||
// can be annotated with entity types.
|
||||
EXAMPLE = 1;
|
||||
|
||||
// Templates are not annotated with entity types, but they can contain
|
||||
// @-prefixed entity type names as substrings.
|
||||
TEMPLATE = 2;
|
||||
}
|
||||
|
||||
// Required. The unique identifier of this training phrase.
|
||||
string name = 1;
|
||||
|
||||
// Required. The type of the training phrase.
|
||||
Type type = 2;
|
||||
|
||||
// Required. The collection of training phrase parts (can be annotated).
|
||||
// Fields: `entity_type`, `alias` and `user_defined` should be populated
|
||||
// only for the annotated parts of the training phrase.
|
||||
repeated Part parts = 3;
|
||||
|
||||
// Optional. Indicates how many times this example or template was added to
|
||||
// the intent. Each time a developer adds an existing sample by editing an
|
||||
// intent or training, this counter is increased.
|
||||
int32 times_added_count = 4;
|
||||
}
|
||||
|
||||
// Represents intent parameters.
|
||||
message Parameter {
|
||||
// The unique identifier of this parameter.
|
||||
string name = 1;
|
||||
|
||||
// Required. The name of the parameter.
|
||||
string display_name = 2;
|
||||
|
||||
// Optional. The definition of the parameter value. It can be:
|
||||
// - a constant string,
|
||||
// - a parameter value defined as `$parameter_name`,
|
||||
// - an original parameter value defined as `$parameter_name.original`,
|
||||
// - a parameter value from some context defined as
|
||||
// `#context_name.parameter_name`.
|
||||
string value = 3;
|
||||
|
||||
// Optional. The default value to use when the `value` yields an empty
|
||||
// result.
|
||||
// Default values can be extracted from contexts by using the following
|
||||
// syntax: `#context_name.parameter_name`.
|
||||
string default_value = 4;
|
||||
|
||||
// Optional. The name of the entity type, prefixed with `@`, that
|
||||
// describes values of the parameter. If the parameter is
|
||||
// required, this must be provided.
|
||||
string entity_type_display_name = 5;
|
||||
|
||||
// Optional. Indicates whether the parameter is required. That is,
|
||||
// whether the intent cannot be completed without collecting the parameter
|
||||
// value.
|
||||
bool mandatory = 6;
|
||||
|
||||
// Optional. The collection of prompts that the agent can present to the
|
||||
// user in order to collect value for the parameter.
|
||||
repeated string prompts = 7;
|
||||
|
||||
// Optional. Indicates whether the parameter represents a list of values.
|
||||
bool is_list = 8;
|
||||
}
|
||||
|
||||
// Corresponds to the `Response` field in the Dialogflow console.
|
||||
message Message {
|
||||
// The text response message.
|
||||
message Text {
|
||||
// Optional. The collection of the agent's responses.
|
||||
repeated string text = 1;
|
||||
}
|
||||
|
||||
// The image response message.
|
||||
message Image {
|
||||
// Optional. The public URI to an image file.
|
||||
string image_uri = 1;
|
||||
|
||||
// Optional. A text description of the image to be used for accessibility,
|
||||
// e.g., screen readers.
|
||||
string accessibility_text = 2;
|
||||
}
|
||||
|
||||
// The quick replies response message.
|
||||
message QuickReplies {
|
||||
// Optional. The title of the collection of quick replies.
|
||||
string title = 1;
|
||||
|
||||
// Optional. The collection of quick replies.
|
||||
repeated string quick_replies = 2;
|
||||
}
|
||||
|
||||
// The card response message.
|
||||
message Card {
|
||||
// Optional. Contains information about a button.
|
||||
message Button {
|
||||
// Optional. The text to show on the button.
|
||||
string text = 1;
|
||||
|
||||
// Optional. The text to send back to the Dialogflow API or a URI to
|
||||
// open.
|
||||
string postback = 2;
|
||||
}
|
||||
|
||||
// Optional. The title of the card.
|
||||
string title = 1;
|
||||
|
||||
// Optional. The subtitle of the card.
|
||||
string subtitle = 2;
|
||||
|
||||
// Optional. The public URI to an image file for the card.
|
||||
string image_uri = 3;
|
||||
|
||||
// Optional. The collection of card buttons.
|
||||
repeated Button buttons = 4;
|
||||
}
|
||||
|
||||
// The simple response message containing speech or text.
|
||||
message SimpleResponse {
|
||||
// One of text_to_speech or ssml must be provided. The plain text of the
|
||||
// speech output. Mutually exclusive with ssml.
|
||||
string text_to_speech = 1;
|
||||
|
||||
// One of text_to_speech or ssml must be provided. Structured spoken
|
||||
// response to the user in the SSML format. Mutually exclusive with
|
||||
// text_to_speech.
|
||||
string ssml = 2;
|
||||
|
||||
// Optional. The text to display.
|
||||
string display_text = 3;
|
||||
}
|
||||
|
||||
// The collection of simple response candidates.
|
||||
// This message in `QueryResult.fulfillment_messages` and
|
||||
// `WebhookResponse.fulfillment_messages` should contain only one
|
||||
// `SimpleResponse`.
|
||||
message SimpleResponses {
|
||||
// Required. The list of simple responses.
|
||||
repeated SimpleResponse simple_responses = 1;
|
||||
}
|
||||
|
||||
// The basic card message. Useful for displaying information.
|
||||
message BasicCard {
|
||||
// The button object that appears at the bottom of a card.
|
||||
message Button {
|
||||
// Opens the given URI.
|
||||
message OpenUriAction {
|
||||
// Required. The HTTP or HTTPS scheme URI.
|
||||
string uri = 1;
|
||||
}
|
||||
|
||||
// Required. The title of the button.
|
||||
string title = 1;
|
||||
|
||||
// Required. Action to take when a user taps on the button.
|
||||
OpenUriAction open_uri_action = 2;
|
||||
}
|
||||
|
||||
// Optional. The title of the card.
|
||||
string title = 1;
|
||||
|
||||
// Optional. The subtitle of the card.
|
||||
string subtitle = 2;
|
||||
|
||||
// Required, unless image is present. The body text of the card.
|
||||
string formatted_text = 3;
|
||||
|
||||
// Optional. The image for the card.
|
||||
Image image = 4;
|
||||
|
||||
// Optional. The collection of card buttons.
|
||||
repeated Button buttons = 5;
|
||||
}
|
||||
|
||||
// The suggestion chip message that the user can tap to quickly post a reply
|
||||
// to the conversation.
|
||||
message Suggestion {
|
||||
// Required. The text shown the in the suggestion chip.
|
||||
string title = 1;
|
||||
}
|
||||
|
||||
// The collection of suggestions.
|
||||
message Suggestions {
|
||||
// Required. The list of suggested replies.
|
||||
repeated Suggestion suggestions = 1;
|
||||
}
|
||||
|
||||
// The suggestion chip message that allows the user to jump out to the app
|
||||
// or website associated with this agent.
|
||||
message LinkOutSuggestion {
|
||||
// Required. The name of the app or site this chip is linking to.
|
||||
string destination_name = 1;
|
||||
|
||||
// Required. The URI of the app or site to open when the user taps the
|
||||
// suggestion chip.
|
||||
string uri = 2;
|
||||
}
|
||||
|
||||
// The card for presenting a list of options to select from.
|
||||
message ListSelect {
|
||||
// An item in the list.
|
||||
message Item {
|
||||
// Required. Additional information about this option.
|
||||
SelectItemInfo info = 1;
|
||||
|
||||
// Required. The title of the list item.
|
||||
string title = 2;
|
||||
|
||||
// Optional. The main text describing the item.
|
||||
string description = 3;
|
||||
|
||||
// Optional. The image to display.
|
||||
Image image = 4;
|
||||
}
|
||||
|
||||
// Optional. The overall title of the list.
|
||||
string title = 1;
|
||||
|
||||
// Required. List items.
|
||||
repeated Item items = 2;
|
||||
}
|
||||
|
||||
// The card for presenting a carousel of options to select from.
|
||||
message CarouselSelect {
|
||||
// An item in the carousel.
|
||||
message Item {
|
||||
// Required. Additional info about the option item.
|
||||
SelectItemInfo info = 1;
|
||||
|
||||
// Required. Title of the carousel item.
|
||||
string title = 2;
|
||||
|
||||
// Optional. The body text of the card.
|
||||
string description = 3;
|
||||
|
||||
// Optional. The image to display.
|
||||
Image image = 4;
|
||||
}
|
||||
|
||||
// Required. Carousel items.
|
||||
repeated Item items = 1;
|
||||
}
|
||||
|
||||
// Additional info about the select item for when it is triggered in a
|
||||
// dialog.
|
||||
message SelectItemInfo {
|
||||
// Required. A unique key that will be sent back to the agent if this
|
||||
// response is given.
|
||||
string key = 1;
|
||||
|
||||
// Optional. A list of synonyms that can also be used to trigger this
|
||||
// item in dialog.
|
||||
repeated string synonyms = 2;
|
||||
}
|
||||
|
||||
// Represents different platforms that a rich message can be intended for.
|
||||
enum Platform {
|
||||
// Not specified.
|
||||
PLATFORM_UNSPECIFIED = 0;
|
||||
|
||||
// Facebook.
|
||||
FACEBOOK = 1;
|
||||
|
||||
// Slack.
|
||||
SLACK = 2;
|
||||
|
||||
// Telegram.
|
||||
TELEGRAM = 3;
|
||||
|
||||
// Kik.
|
||||
KIK = 4;
|
||||
|
||||
// Skype.
|
||||
SKYPE = 5;
|
||||
|
||||
// Line.
|
||||
LINE = 6;
|
||||
|
||||
// Viber.
|
||||
VIBER = 7;
|
||||
|
||||
// Actions on Google.
|
||||
// When using Actions on Google, you can choose one of the specific
|
||||
// Intent.Message types that mention support for Actions on Google,
|
||||
// or you can use the advanced Intent.Message.payload field.
|
||||
// The payload field provides access to AoG features not available in the
|
||||
// specific message types.
|
||||
// If using the Intent.Message.payload field, it should have a structure
|
||||
// similar to the JSON message shown here. For more information, see
|
||||
// [Actions on Google Webhook
|
||||
// Format](https://developers.google.com/actions/dialogflow/webhook)
|
||||
// <pre>{
|
||||
// "expectUserResponse": true,
|
||||
// "isSsml": false,
|
||||
// "noInputPrompts": [],
|
||||
// "richResponse": {
|
||||
// "items": [
|
||||
// {
|
||||
// "simpleResponse": {
|
||||
// "displayText": "hi",
|
||||
// "textToSpeech": "hello"
|
||||
// }
|
||||
// }
|
||||
// ],
|
||||
// "suggestions": [
|
||||
// {
|
||||
// "title": "Say this"
|
||||
// },
|
||||
// {
|
||||
// "title": "or this"
|
||||
// }
|
||||
// ]
|
||||
// },
|
||||
// "systemIntent": {
|
||||
// "data": {
|
||||
// "@type": "type.googleapis.com/google.actions.v2.OptionValueSpec",
|
||||
// "listSelect": {
|
||||
// "items": [
|
||||
// {
|
||||
// "optionInfo": {
|
||||
// "key": "key1",
|
||||
// "synonyms": [
|
||||
// "key one"
|
||||
// ]
|
||||
// },
|
||||
// "title": "must not be empty, but unique"
|
||||
// },
|
||||
// {
|
||||
// "optionInfo": {
|
||||
// "key": "key2",
|
||||
// "synonyms": [
|
||||
// "key two"
|
||||
// ]
|
||||
// },
|
||||
// "title": "must not be empty, but unique"
|
||||
// }
|
||||
// ]
|
||||
// }
|
||||
// },
|
||||
// "intent": "actions.intent.OPTION"
|
||||
// }
|
||||
// }</pre>
|
||||
ACTIONS_ON_GOOGLE = 8;
|
||||
}
|
||||
|
||||
// Required. The rich response message.
|
||||
oneof message {
|
||||
// The text response.
|
||||
Text text = 1;
|
||||
|
||||
// The image response.
|
||||
Image image = 2;
|
||||
|
||||
// The quick replies response.
|
||||
QuickReplies quick_replies = 3;
|
||||
|
||||
// The card response.
|
||||
Card card = 4;
|
||||
|
||||
// Returns a response containing a custom, platform-specific payload.
|
||||
// See the Intent.Message.Platform type for a description of the
|
||||
// structure that may be required for your platform.
|
||||
google.protobuf.Struct payload = 5;
|
||||
|
||||
// The voice and text-only responses for Actions on Google.
|
||||
SimpleResponses simple_responses = 7;
|
||||
|
||||
// The basic card response for Actions on Google.
|
||||
BasicCard basic_card = 8;
|
||||
|
||||
// The suggestion chips for Actions on Google.
|
||||
Suggestions suggestions = 9;
|
||||
|
||||
// The link out suggestion chip for Actions on Google.
|
||||
LinkOutSuggestion link_out_suggestion = 10;
|
||||
|
||||
// The list card response for Actions on Google.
|
||||
ListSelect list_select = 11;
|
||||
|
||||
// The carousel card response for Actions on Google.
|
||||
CarouselSelect carousel_select = 12;
|
||||
}
|
||||
|
||||
// Optional. The platform that this message is intended for.
|
||||
Platform platform = 6;
|
||||
}
|
||||
|
||||
// Represents a single followup intent in the chain.
|
||||
message FollowupIntentInfo {
|
||||
// The unique identifier of the followup intent.
|
||||
// Format: `projects/<Project ID>/agent/intents/<Intent ID>`.
|
||||
string followup_intent_name = 1;
|
||||
|
||||
// The unique identifier of the followup intent parent.
|
||||
// Format: `projects/<Project ID>/agent/intents/<Intent ID>`.
|
||||
string parent_followup_intent_name = 2;
|
||||
}
|
||||
|
||||
// Represents the different states that webhooks can be in.
|
||||
enum WebhookState {
|
||||
// Webhook is disabled in the agent and in the intent.
|
||||
WEBHOOK_STATE_UNSPECIFIED = 0;
|
||||
|
||||
// Webhook is enabled in the agent and in the intent.
|
||||
WEBHOOK_STATE_ENABLED = 1;
|
||||
|
||||
// Webhook is enabled in the agent and in the intent. Also, each slot
|
||||
// filling prompt is forwarded to the webhook.
|
||||
WEBHOOK_STATE_ENABLED_FOR_SLOT_FILLING = 2;
|
||||
}
|
||||
|
||||
// Required for all methods except `create` (`create` populates the name
|
||||
// automatically.
|
||||
// The unique identifier of this intent.
|
||||
// Format: `projects/<Project ID>/agent/intents/<Intent ID>`.
|
||||
string name = 1;
|
||||
|
||||
// Required. The name of this intent.
|
||||
string display_name = 2;
|
||||
|
||||
// Required. Indicates whether webhooks are enabled for the intent.
|
||||
WebhookState webhook_state = 6;
|
||||
|
||||
// Optional. The priority of this intent. Higher numbers represent higher
|
||||
// priorities. Zero or negative numbers mean that the intent is disabled.
|
||||
int32 priority = 3;
|
||||
|
||||
// Optional. Indicates whether this is a fallback intent.
|
||||
bool is_fallback = 4;
|
||||
|
||||
// Optional. Indicates whether Machine Learning is disabled for the intent.
|
||||
// Note: If `ml_diabled` setting is set to true, then this intent is not
|
||||
// taken into account during inference in `ML ONLY` match mode. Also,
|
||||
// auto-markup in the UI is turned off.
|
||||
bool ml_disabled = 19;
|
||||
|
||||
// Optional. The list of context names required for this intent to be
|
||||
// triggered.
|
||||
// Format: `projects/<Project ID>/agent/sessions/-/contexts/<Context ID>`.
|
||||
repeated string input_context_names = 7;
|
||||
|
||||
// Optional. The collection of event names that trigger the intent.
|
||||
// If the collection of input contexts is not empty, all of the contexts must
|
||||
// be present in the active user session for an event to trigger this intent.
|
||||
repeated string events = 8;
|
||||
|
||||
// Optional. The collection of examples/templates that the agent is
|
||||
// trained on.
|
||||
repeated TrainingPhrase training_phrases = 9;
|
||||
|
||||
// Optional. The name of the action associated with the intent.
|
||||
string action = 10;
|
||||
|
||||
// Optional. The collection of contexts that are activated when the intent
|
||||
// is matched. Context messages in this collection should not set the
|
||||
// parameters field. Setting the `lifespan_count` to 0 will reset the context
|
||||
// when the intent is matched.
|
||||
// Format: `projects/<Project ID>/agent/sessions/-/contexts/<Context ID>`.
|
||||
repeated Context output_contexts = 11;
|
||||
|
||||
// Optional. Indicates whether to delete all contexts in the current
|
||||
// session when this intent is matched.
|
||||
bool reset_contexts = 12;
|
||||
|
||||
// Optional. The collection of parameters associated with the intent.
|
||||
repeated Parameter parameters = 13;
|
||||
|
||||
// Optional. The collection of rich messages corresponding to the
|
||||
// `Response` field in the Dialogflow console.
|
||||
repeated Message messages = 14;
|
||||
|
||||
// Optional. The list of platforms for which the first response will be
|
||||
// taken from among the messages assigned to the DEFAULT_PLATFORM.
|
||||
repeated Message.Platform default_response_platforms = 15;
|
||||
|
||||
// The unique identifier of the root intent in the chain of followup intents.
|
||||
// It identifies the correct followup intents chain for this intent.
|
||||
// Format: `projects/<Project ID>/agent/intents/<Intent ID>`.
|
||||
string root_followup_intent_name = 16;
|
||||
|
||||
// The unique identifier of the parent intent in the chain of followup
|
||||
// intents.
|
||||
// It identifies the parent followup intent.
|
||||
// Format: `projects/<Project ID>/agent/intents/<Intent ID>`.
|
||||
string parent_followup_intent_name = 17;
|
||||
|
||||
// Optional. Collection of information about all followup intents that have
|
||||
// name of this intent as a root_name.
|
||||
repeated FollowupIntentInfo followup_intent_info = 18;
|
||||
}
|
||||
|
||||
// The request message for [Intents.ListIntents][google.cloud.dialogflow.v2.Intents.ListIntents].
|
||||
message ListIntentsRequest {
|
||||
// Required. The agent to list all intents from.
|
||||
// Format: `projects/<Project ID>/agent`.
|
||||
string parent = 1;
|
||||
|
||||
// Optional. The language to list training phrases, parameters and rich
|
||||
// messages for. If not specified, the agent's default language is used.
|
||||
// [More than a dozen
|
||||
// languages](https://dialogflow.com/docs/reference/language) are supported.
|
||||
// Note: languages must be enabled in the agent before they can be used.
|
||||
string language_code = 2;
|
||||
|
||||
// Optional. The resource view to apply to the returned intent.
|
||||
IntentView intent_view = 3;
|
||||
|
||||
// Optional. The maximum number of items to return in a single page. By
|
||||
// default 100 and at most 1000.
|
||||
int32 page_size = 4;
|
||||
|
||||
// Optional. The next_page_token value returned from a previous list request.
|
||||
string page_token = 5;
|
||||
}
|
||||
|
||||
// The response message for [Intents.ListIntents][google.cloud.dialogflow.v2.Intents.ListIntents].
|
||||
message ListIntentsResponse {
|
||||
// The list of agent intents. There will be a maximum number of items
|
||||
// returned based on the page_size field in the request.
|
||||
repeated Intent intents = 1;
|
||||
|
||||
// Token to retrieve the next page of results, or empty if there are no
|
||||
// more results in the list.
|
||||
string next_page_token = 2;
|
||||
}
|
||||
|
||||
// The request message for [Intents.GetIntent][google.cloud.dialogflow.v2.Intents.GetIntent].
|
||||
message GetIntentRequest {
|
||||
// Required. The name of the intent.
|
||||
// Format: `projects/<Project ID>/agent/intents/<Intent ID>`.
|
||||
string name = 1;
|
||||
|
||||
// Optional. The language to retrieve training phrases, parameters and rich
|
||||
// messages for. If not specified, the agent's default language is used.
|
||||
// [More than a dozen
|
||||
// languages](https://dialogflow.com/docs/reference/language) are supported.
|
||||
// Note: languages must be enabled in the agent, before they can be used.
|
||||
string language_code = 2;
|
||||
|
||||
// Optional. The resource view to apply to the returned intent.
|
||||
IntentView intent_view = 3;
|
||||
}
|
||||
|
||||
// The request message for [Intents.CreateIntent][google.cloud.dialogflow.v2.Intents.CreateIntent].
|
||||
message CreateIntentRequest {
|
||||
// Required. The agent to create a intent for.
|
||||
// Format: `projects/<Project ID>/agent`.
|
||||
string parent = 1;
|
||||
|
||||
// Required. The intent to create.
|
||||
Intent intent = 2;
|
||||
|
||||
// Optional. The language of training phrases, parameters and rich messages
|
||||
// defined in `intent`. If not specified, the agent's default language is
|
||||
// used. [More than a dozen
|
||||
// languages](https://dialogflow.com/docs/reference/language) are supported.
|
||||
// Note: languages must be enabled in the agent, before they can be used.
|
||||
string language_code = 3;
|
||||
|
||||
// Optional. The resource view to apply to the returned intent.
|
||||
IntentView intent_view = 4;
|
||||
}
|
||||
|
||||
// The request message for [Intents.UpdateIntent][google.cloud.dialogflow.v2.Intents.UpdateIntent].
|
||||
message UpdateIntentRequest {
|
||||
// Required. The intent to update.
|
||||
// Format: `projects/<Project ID>/agent/intents/<Intent ID>`.
|
||||
Intent intent = 1;
|
||||
|
||||
// Optional. The language of training phrases, parameters and rich messages
|
||||
// defined in `intent`. If not specified, the agent's default language is
|
||||
// used. [More than a dozen
|
||||
// languages](https://dialogflow.com/docs/reference/language) are supported.
|
||||
// Note: languages must be enabled in the agent, before they can be used.
|
||||
string language_code = 2;
|
||||
|
||||
// Optional. The mask to control which fields get updated.
|
||||
google.protobuf.FieldMask update_mask = 3;
|
||||
|
||||
// Optional. The resource view to apply to the returned intent.
|
||||
IntentView intent_view = 4;
|
||||
}
|
||||
|
||||
// The request message for [Intents.DeleteIntent][google.cloud.dialogflow.v2.Intents.DeleteIntent].
|
||||
message DeleteIntentRequest {
|
||||
// Required. The name of the intent to delete.
|
||||
// Format: `projects/<Project ID>/agent/intents/<Intent ID>`.
|
||||
string name = 1;
|
||||
}
|
||||
|
||||
// The request message for [Intents.BatchUpdateIntents][google.cloud.dialogflow.v2.Intents.BatchUpdateIntents].
|
||||
message BatchUpdateIntentsRequest {
|
||||
// Required. The name of the agent to update or create intents in.
|
||||
// Format: `projects/<Project ID>/agent`.
|
||||
string parent = 1;
|
||||
|
||||
// Required. The source of the intent batch.
|
||||
oneof intent_batch {
|
||||
// The URI to a Google Cloud Storage file containing intents to update or
|
||||
// create. The file format can either be a serialized proto (of IntentBatch
|
||||
// type) or JSON object. Note: The URI must start with "gs://".
|
||||
string intent_batch_uri = 2;
|
||||
|
||||
// The collection of intents to update or create.
|
||||
IntentBatch intent_batch_inline = 3;
|
||||
}
|
||||
|
||||
// Optional. The language of training phrases, parameters and rich messages
|
||||
// defined in `intents`. If not specified, the agent's default language is
|
||||
// used. [More than a dozen
|
||||
// languages](https://dialogflow.com/docs/reference/language) are supported.
|
||||
// Note: languages must be enabled in the agent, before they can be used.
|
||||
string language_code = 4;
|
||||
|
||||
// Optional. The mask to control which fields get updated.
|
||||
google.protobuf.FieldMask update_mask = 5;
|
||||
|
||||
// Optional. The resource view to apply to the returned intent.
|
||||
IntentView intent_view = 6;
|
||||
}
|
||||
|
||||
// The response message for [Intents.BatchUpdateIntents][google.cloud.dialogflow.v2.Intents.BatchUpdateIntents].
|
||||
message BatchUpdateIntentsResponse {
|
||||
// The collection of updated or created intents.
|
||||
repeated Intent intents = 1;
|
||||
}
|
||||
|
||||
// The request message for [Intents.BatchDeleteIntents][google.cloud.dialogflow.v2.Intents.BatchDeleteIntents].
|
||||
message BatchDeleteIntentsRequest {
|
||||
// Required. The name of the agent to delete all entities types for. Format:
|
||||
// `projects/<Project ID>/agent`.
|
||||
string parent = 1;
|
||||
|
||||
// Required. The collection of intents to delete. Only intent `name` must be
|
||||
// filled in.
|
||||
repeated Intent intents = 2;
|
||||
}
|
||||
|
||||
// This message is a wrapper around a collection of intents.
|
||||
message IntentBatch {
|
||||
// A collection of intents.
|
||||
repeated Intent intents = 1;
|
||||
}
|
||||
|
||||
// Represents the options for views of an intent.
|
||||
// An intent can be a sizable object. Therefore, we provide a resource view that
|
||||
// does not return training phrases in the response by default.
|
||||
enum IntentView {
|
||||
// Training phrases field is not populated in the response.
|
||||
INTENT_VIEW_UNSPECIFIED = 0;
|
||||
|
||||
// All fields are populated.
|
||||
INTENT_VIEW_FULL = 1;
|
||||
}
|
||||
478
node_modules/dialogflow/protos/google/cloud/dialogflow/v2/session.proto
generated
vendored
Normal file
478
node_modules/dialogflow/protos/google/cloud/dialogflow/v2/session.proto
generated
vendored
Normal file
@@ -0,0 +1,478 @@
|
||||
// Copyright 2018 Google Inc.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
syntax = "proto3";
|
||||
|
||||
package google.cloud.dialogflow.v2;
|
||||
|
||||
import "google/api/annotations.proto";
|
||||
import "google/cloud/dialogflow/v2/context.proto";
|
||||
import "google/cloud/dialogflow/v2/intent.proto";
|
||||
import "google/cloud/dialogflow/v2/session_entity_type.proto";
|
||||
import "google/protobuf/struct.proto";
|
||||
import "google/rpc/status.proto";
|
||||
import "google/type/latlng.proto";
|
||||
|
||||
option cc_enable_arenas = true;
|
||||
option csharp_namespace = "Google.Cloud.Dialogflow.V2";
|
||||
option go_package = "google.golang.org/genproto/googleapis/cloud/dialogflow/v2;dialogflow";
|
||||
option java_multiple_files = true;
|
||||
option java_outer_classname = "SessionProto";
|
||||
option java_package = "com.google.cloud.dialogflow.v2";
|
||||
option objc_class_prefix = "DF";
|
||||
|
||||
|
||||
// A session represents an interaction with a user. You retrieve user input
|
||||
// and pass it to the [DetectIntent][google.cloud.dialogflow.v2.Sessions.DetectIntent] (or
|
||||
// [StreamingDetectIntent][google.cloud.dialogflow.v2.Sessions.StreamingDetectIntent]) method to determine
|
||||
// user intent and respond.
|
||||
service Sessions {
|
||||
// Processes a natural language query and returns structured, actionable data
|
||||
// as a result. This method is not idempotent, because it may cause contexts
|
||||
// and session entity types to be updated, which in turn might affect
|
||||
// results of future queries.
|
||||
rpc DetectIntent(DetectIntentRequest) returns (DetectIntentResponse) {
|
||||
option (google.api.http) = {
|
||||
post: "/v2/{session=projects/*/agent/sessions/*}:detectIntent"
|
||||
body: "*"
|
||||
};
|
||||
}
|
||||
|
||||
// Processes a natural language query in audio format in a streaming fashion
|
||||
// and returns structured, actionable data as a result. This method is only
|
||||
// available via the gRPC API (not REST).
|
||||
rpc StreamingDetectIntent(stream StreamingDetectIntentRequest) returns (stream StreamingDetectIntentResponse);
|
||||
}
|
||||
|
||||
// The request to detect user's intent.
|
||||
message DetectIntentRequest {
|
||||
// Required. The name of the session this query is sent to. Format:
|
||||
// `projects/<Project ID>/agent/sessions/<Session ID>`. It's up to the API
|
||||
// caller to choose an appropriate session ID. It can be a random number or
|
||||
// some type of user identifier (preferably hashed). The length of the session
|
||||
// ID must not exceed 36 bytes.
|
||||
string session = 1;
|
||||
|
||||
// Optional. The parameters of this query.
|
||||
QueryParameters query_params = 2;
|
||||
|
||||
// Required. The input specification. It can be set to:
|
||||
//
|
||||
// 1. an audio config
|
||||
// which instructs the speech recognizer how to process the speech audio,
|
||||
//
|
||||
// 2. a conversational query in the form of text, or
|
||||
//
|
||||
// 3. an event that specifies which intent to trigger.
|
||||
QueryInput query_input = 3;
|
||||
|
||||
// Optional. The natural language speech audio to be processed. This field
|
||||
// should be populated iff `query_input` is set to an input audio config.
|
||||
// A single request can contain up to 1 minute of speech audio data.
|
||||
bytes input_audio = 5;
|
||||
}
|
||||
|
||||
// The message returned from the DetectIntent method.
|
||||
message DetectIntentResponse {
|
||||
// The unique identifier of the response. It can be used to
|
||||
// locate a response in the training example set or for reporting issues.
|
||||
string response_id = 1;
|
||||
|
||||
// The results of the conversational query or event processing.
|
||||
QueryResult query_result = 2;
|
||||
|
||||
// Specifies the status of the webhook request. `webhook_status`
|
||||
// is never populated in webhook requests.
|
||||
google.rpc.Status webhook_status = 3;
|
||||
}
|
||||
|
||||
// Represents the parameters of the conversational query.
|
||||
message QueryParameters {
|
||||
// Optional. The time zone of this conversational query from the
|
||||
// [time zone database](https://www.iana.org/time-zones), e.g.,
|
||||
// America/New_York, Europe/Paris. If not provided, the time zone specified in
|
||||
// agent settings is used.
|
||||
string time_zone = 1;
|
||||
|
||||
// Optional. The geo location of this conversational query.
|
||||
google.type.LatLng geo_location = 2;
|
||||
|
||||
// Optional. The collection of contexts to be activated before this query is
|
||||
// executed.
|
||||
repeated Context contexts = 3;
|
||||
|
||||
// Optional. Specifies whether to delete all contexts in the current session
|
||||
// before the new ones are activated.
|
||||
bool reset_contexts = 4;
|
||||
|
||||
// Optional. The collection of session entity types to replace or extend
|
||||
// developer entities with for this query only. The entity synonyms apply
|
||||
// to all languages.
|
||||
repeated SessionEntityType session_entity_types = 5;
|
||||
|
||||
// Optional. This field can be used to pass custom data into the webhook
|
||||
// associated with the agent. Arbitrary JSON objects are supported.
|
||||
google.protobuf.Struct payload = 6;
|
||||
}
|
||||
|
||||
// Represents the query input. It can contain either:
|
||||
//
|
||||
// 1. An audio config which
|
||||
// instructs the speech recognizer how to process the speech audio.
|
||||
//
|
||||
// 2. A conversational query in the form of text,.
|
||||
//
|
||||
// 3. An event that specifies which intent to trigger.
|
||||
message QueryInput {
|
||||
// Required. The input specification.
|
||||
oneof input {
|
||||
// Instructs the speech recognizer how to process the speech audio.
|
||||
InputAudioConfig audio_config = 1;
|
||||
|
||||
// The natural language text to be processed.
|
||||
TextInput text = 2;
|
||||
|
||||
// The event to be processed.
|
||||
EventInput event = 3;
|
||||
}
|
||||
}
|
||||
|
||||
// Represents the result of conversational query or event processing.
|
||||
message QueryResult {
|
||||
// The original conversational query text:
|
||||
// - If natural language text was provided as input, `query_text` contains
|
||||
// a copy of the input.
|
||||
// - If natural language speech audio was provided as input, `query_text`
|
||||
// contains the speech recognition result. If speech recognizer produced
|
||||
// multiple alternatives, a particular one is picked.
|
||||
// - If an event was provided as input, `query_text` is not set.
|
||||
string query_text = 1;
|
||||
|
||||
// The language that was triggered during intent detection.
|
||||
// See [Language Support](https://dialogflow.com/docs/reference/language)
|
||||
// for a list of the currently supported language codes.
|
||||
string language_code = 15;
|
||||
|
||||
// The Speech recognition confidence between 0.0 and 1.0. A higher number
|
||||
// indicates an estimated greater likelihood that the recognized words are
|
||||
// correct. The default of 0.0 is a sentinel value indicating that confidence
|
||||
// was not set.
|
||||
//
|
||||
// You should not rely on this field as it isn't guaranteed to be accurate, or
|
||||
// even set. In particular this field isn't set in Webhook calls and for
|
||||
// StreamingDetectIntent since the streaming endpoint has separate confidence
|
||||
// estimates per portion of the audio in StreamingRecognitionResult.
|
||||
float speech_recognition_confidence = 2;
|
||||
|
||||
// The action name from the matched intent.
|
||||
string action = 3;
|
||||
|
||||
// The collection of extracted parameters.
|
||||
google.protobuf.Struct parameters = 4;
|
||||
|
||||
// This field is set to:
|
||||
// - `false` if the matched intent has required parameters and not all of
|
||||
// the required parameter values have been collected.
|
||||
// - `true` if all required parameter values have been collected, or if the
|
||||
// matched intent doesn't contain any required parameters.
|
||||
bool all_required_params_present = 5;
|
||||
|
||||
// The text to be pronounced to the user or shown on the screen.
|
||||
string fulfillment_text = 6;
|
||||
|
||||
// The collection of rich messages to present to the user.
|
||||
repeated Intent.Message fulfillment_messages = 7;
|
||||
|
||||
// If the query was fulfilled by a webhook call, this field is set to the
|
||||
// value of the `source` field returned in the webhook response.
|
||||
string webhook_source = 8;
|
||||
|
||||
// If the query was fulfilled by a webhook call, this field is set to the
|
||||
// value of the `payload` field returned in the webhook response.
|
||||
google.protobuf.Struct webhook_payload = 9;
|
||||
|
||||
// The collection of output contexts. If applicable,
|
||||
// `output_contexts.parameters` contains entries with name
|
||||
// `<parameter name>.original` containing the original parameter values
|
||||
// before the query.
|
||||
repeated Context output_contexts = 10;
|
||||
|
||||
// The intent that matched the conversational query. Some, not
|
||||
// all fields are filled in this message, including but not limited to:
|
||||
// `name`, `display_name` and `webhook_state`.
|
||||
Intent intent = 11;
|
||||
|
||||
// The intent detection confidence. Values range from 0.0
|
||||
// (completely uncertain) to 1.0 (completely certain).
|
||||
float intent_detection_confidence = 12;
|
||||
|
||||
// The free-form diagnostic info. For example, this field
|
||||
// could contain webhook call latency.
|
||||
google.protobuf.Struct diagnostic_info = 14;
|
||||
}
|
||||
|
||||
// The top-level message sent by the client to the
|
||||
// `StreamingDetectIntent` method.
|
||||
//
|
||||
// Multiple request messages should be sent in order:
|
||||
//
|
||||
// 1. The first message must contain `session`, `query_input` plus optionally
|
||||
// `query_params` and/or `single_utterance`. The message must not contain `input_audio`.
|
||||
//
|
||||
// 2. If `query_input` was set to a streaming input audio config,
|
||||
// all subsequent messages must contain only `input_audio`.
|
||||
// Otherwise, finish the request stream.
|
||||
message StreamingDetectIntentRequest {
|
||||
// Required. The name of the session the query is sent to.
|
||||
// Format of the session name:
|
||||
// `projects/<Project ID>/agent/sessions/<Session ID>`. It’s up to the API
|
||||
// caller to choose an appropriate <Session ID>. It can be a random number or
|
||||
// some type of user identifier (preferably hashed). The length of the session
|
||||
// ID must not exceed 36 characters.
|
||||
string session = 1;
|
||||
|
||||
// Optional. The parameters of this query.
|
||||
QueryParameters query_params = 2;
|
||||
|
||||
// Required. The input specification. It can be set to:
|
||||
//
|
||||
// 1. an audio config which instructs the speech recognizer how to process
|
||||
// the speech audio,
|
||||
//
|
||||
// 2. a conversational query in the form of text, or
|
||||
//
|
||||
// 3. an event that specifies which intent to trigger.
|
||||
QueryInput query_input = 3;
|
||||
|
||||
// Optional. If `false` (default), recognition does not cease until the
|
||||
// client closes the stream.
|
||||
// If `true`, the recognizer will detect a single spoken utterance in input
|
||||
// audio. Recognition ceases when it detects the audio's voice has
|
||||
// stopped or paused. In this case, once a detected intent is received, the
|
||||
// client should close the stream and start a new request with a new stream as
|
||||
// needed.
|
||||
// This setting is ignored when `query_input` is a piece of text or an event.
|
||||
bool single_utterance = 4;
|
||||
|
||||
// Optional. The input audio content to be recognized. Must be sent if
|
||||
// `query_input` was set to a streaming input audio config. The complete audio
|
||||
// over all streaming messages must not exceed 1 minute.
|
||||
bytes input_audio = 6;
|
||||
}
|
||||
|
||||
// The top-level message returned from the
|
||||
// `StreamingDetectIntent` method.
|
||||
//
|
||||
// Multiple response messages can be returned in order:
|
||||
//
|
||||
// 1. If the input was set to streaming audio, the first one or more messages
|
||||
// contain `recognition_result`. Each `recognition_result` represents a more
|
||||
// complete transcript of what the user said. The last `recognition_result`
|
||||
// has `is_final` set to `true`.
|
||||
//
|
||||
// 2. The next message contains `response_id`, `query_result`
|
||||
// and optionally `webhook_status` if a WebHook was called.
|
||||
message StreamingDetectIntentResponse {
|
||||
// The unique identifier of the response. It can be used to
|
||||
// locate a response in the training example set or for reporting issues.
|
||||
string response_id = 1;
|
||||
|
||||
// The result of speech recognition.
|
||||
StreamingRecognitionResult recognition_result = 2;
|
||||
|
||||
// The result of the conversational query or event processing.
|
||||
QueryResult query_result = 3;
|
||||
|
||||
// Specifies the status of the webhook request.
|
||||
google.rpc.Status webhook_status = 4;
|
||||
}
|
||||
|
||||
// Contains a speech recognition result corresponding to a portion of the audio
|
||||
// that is currently being processed or an indication that this is the end
|
||||
// of the single requested utterance.
|
||||
//
|
||||
// Example:
|
||||
//
|
||||
// 1. transcript: "tube"
|
||||
//
|
||||
// 2. transcript: "to be a"
|
||||
//
|
||||
// 3. transcript: "to be"
|
||||
//
|
||||
// 4. transcript: "to be or not to be"
|
||||
// is_final: true
|
||||
//
|
||||
// 5. transcript: " that's"
|
||||
//
|
||||
// 6. transcript: " that is"
|
||||
//
|
||||
// 7. recognition_event_type: `RECOGNITION_EVENT_END_OF_SINGLE_UTTERANCE`
|
||||
//
|
||||
// 8. transcript: " that is the question"
|
||||
// is_final: true
|
||||
//
|
||||
// Only two of the responses contain final results (#4 and #8 indicated by
|
||||
// `is_final: true`). Concatenating these generates the full transcript: "to be
|
||||
// or not to be that is the question".
|
||||
//
|
||||
// In each response we populate:
|
||||
//
|
||||
// * for `MESSAGE_TYPE_TRANSCRIPT`: `transcript` and possibly `is_final`.
|
||||
//
|
||||
// * for `MESSAGE_TYPE_END_OF_SINGLE_UTTERANCE`: only `event_type`.
|
||||
message StreamingRecognitionResult {
|
||||
// Type of the response message.
|
||||
enum MessageType {
|
||||
// Not specified. Should never be used.
|
||||
MESSAGE_TYPE_UNSPECIFIED = 0;
|
||||
|
||||
// Message contains a (possibly partial) transcript.
|
||||
TRANSCRIPT = 1;
|
||||
|
||||
// Event indicates that the server has detected the end of the user's speech
|
||||
// utterance and expects no additional speech. Therefore, the server will
|
||||
// not process additional audio (although it may subsequently return
|
||||
// additional results). The client should stop sending additional audio
|
||||
// data, half-close the gRPC connection, and wait for any additional results
|
||||
// until the server closes the gRPC connection. This message is only sent if
|
||||
// `single_utterance` was set to `true`, and is not used otherwise.
|
||||
END_OF_SINGLE_UTTERANCE = 2;
|
||||
}
|
||||
|
||||
// Type of the result message.
|
||||
MessageType message_type = 1;
|
||||
|
||||
// Transcript text representing the words that the user spoke.
|
||||
// Populated if and only if `event_type` = `RECOGNITION_EVENT_TRANSCRIPT`.
|
||||
string transcript = 2;
|
||||
|
||||
// The default of 0.0 is a sentinel value indicating `confidence` was not set.
|
||||
// If `false`, the `StreamingRecognitionResult` represents an
|
||||
// interim result that may change. If `true`, the recognizer will not return
|
||||
// any further hypotheses about this piece of the audio. May only be populated
|
||||
// for `event_type` = `RECOGNITION_EVENT_TRANSCRIPT`.
|
||||
bool is_final = 3;
|
||||
|
||||
// The Speech confidence between 0.0 and 1.0 for the current portion of audio.
|
||||
// A higher number indicates an estimated greater likelihood that the
|
||||
// recognized words are correct. The default of 0.0 is a sentinel value
|
||||
// indicating that confidence was not set.
|
||||
//
|
||||
// This field is typically only provided if `is_final` is true and you should
|
||||
// not rely on it being accurate or even set.
|
||||
float confidence = 4;
|
||||
}
|
||||
|
||||
// Instructs the speech recognizer how to process the audio content.
|
||||
message InputAudioConfig {
|
||||
// Required. Audio encoding of the audio content to process.
|
||||
AudioEncoding audio_encoding = 1;
|
||||
|
||||
// Required. Sample rate (in Hertz) of the audio content sent in the query.
|
||||
// Refer to [Cloud Speech API documentation](/speech/docs/basics) for more
|
||||
// details.
|
||||
int32 sample_rate_hertz = 2;
|
||||
|
||||
// Required. The language of the supplied audio. Dialogflow does not do
|
||||
// translations. See [Language
|
||||
// Support](https://dialogflow.com/docs/languages) for a list of the
|
||||
// currently supported language codes. Note that queries in the same session
|
||||
// do not necessarily need to specify the same language.
|
||||
string language_code = 3;
|
||||
|
||||
// Optional. The collection of phrase hints which are used to boost accuracy
|
||||
// of speech recognition.
|
||||
// Refer to [Cloud Speech API documentation](/speech/docs/basics#phrase-hints)
|
||||
// for more details.
|
||||
repeated string phrase_hints = 4;
|
||||
}
|
||||
|
||||
// Represents the natural language text to be processed.
|
||||
message TextInput {
|
||||
// Required. The UTF-8 encoded natural language text to be processed.
|
||||
// Text length must not exceed 256 bytes.
|
||||
string text = 1;
|
||||
|
||||
// Required. The language of this conversational query. See [Language
|
||||
// Support](https://dialogflow.com/docs/languages) for a list of the
|
||||
// currently supported language codes. Note that queries in the same session
|
||||
// do not necessarily need to specify the same language.
|
||||
string language_code = 2;
|
||||
}
|
||||
|
||||
// Events allow for matching intents by event name instead of the natural
|
||||
// language input. For instance, input `<event: { name: “welcome_event”,
|
||||
// parameters: { name: “Sam” } }>` can trigger a personalized welcome response.
|
||||
// The parameter `name` may be used by the agent in the response:
|
||||
// `“Hello #welcome_event.name! What can I do for you today?”`.
|
||||
message EventInput {
|
||||
// Required. The unique identifier of the event.
|
||||
string name = 1;
|
||||
|
||||
// Optional. The collection of parameters associated with the event.
|
||||
google.protobuf.Struct parameters = 2;
|
||||
|
||||
// Required. The language of this query. See [Language
|
||||
// Support](https://dialogflow.com/docs/languages) for a list of the
|
||||
// currently supported language codes. Note that queries in the same session
|
||||
// do not necessarily need to specify the same language.
|
||||
string language_code = 3;
|
||||
}
|
||||
|
||||
// Audio encoding of the audio content sent in the conversational query request.
|
||||
// Refer to the [Cloud Speech API documentation](/speech/docs/basics) for more
|
||||
// details.
|
||||
enum AudioEncoding {
|
||||
// Not specified.
|
||||
AUDIO_ENCODING_UNSPECIFIED = 0;
|
||||
|
||||
// Uncompressed 16-bit signed little-endian samples (Linear PCM).
|
||||
AUDIO_ENCODING_LINEAR_16 = 1;
|
||||
|
||||
// [`FLAC`](https://xiph.org/flac/documentation.html) (Free Lossless Audio
|
||||
// Codec) is the recommended encoding because it is lossless (therefore
|
||||
// recognition is not compromised) and requires only about half the
|
||||
// bandwidth of `LINEAR16`. `FLAC` stream encoding supports 16-bit and
|
||||
// 24-bit samples, however, not all fields in `STREAMINFO` are supported.
|
||||
AUDIO_ENCODING_FLAC = 2;
|
||||
|
||||
// 8-bit samples that compand 14-bit audio samples using G.711 PCMU/mu-law.
|
||||
AUDIO_ENCODING_MULAW = 3;
|
||||
|
||||
// Adaptive Multi-Rate Narrowband codec. `sample_rate_hertz` must be 8000.
|
||||
AUDIO_ENCODING_AMR = 4;
|
||||
|
||||
// Adaptive Multi-Rate Wideband codec. `sample_rate_hertz` must be 16000.
|
||||
AUDIO_ENCODING_AMR_WB = 5;
|
||||
|
||||
// Opus encoded audio frames in Ogg container
|
||||
// ([OggOpus](https://wiki.xiph.org/OggOpus)).
|
||||
// `sample_rate_hertz` must be 16000.
|
||||
AUDIO_ENCODING_OGG_OPUS = 6;
|
||||
|
||||
// Although the use of lossy encodings is not recommended, if a very low
|
||||
// bitrate encoding is required, `OGG_OPUS` is highly preferred over
|
||||
// Speex encoding. The [Speex](https://speex.org/) encoding supported by
|
||||
// Dialogflow API has a header byte in each block, as in MIME type
|
||||
// `audio/x-speex-with-header-byte`.
|
||||
// It is a variant of the RTP Speex encoding defined in
|
||||
// [RFC 5574](https://tools.ietf.org/html/rfc5574).
|
||||
// The stream is a sequence of blocks, one block per RTP packet. Each block
|
||||
// starts with a byte containing the length of the block, in bytes, followed
|
||||
// by one or more frames of Speex data, padded to an integral number of
|
||||
// bytes (octets) as specified in RFC 5574. In other words, each RTP header
|
||||
// is replaced with a single byte containing the block length. Only Speex
|
||||
// wideband is supported. `sample_rate_hertz` must be 16000.
|
||||
AUDIO_ENCODING_SPEEX_WITH_HEADER_BYTE = 7;
|
||||
}
|
||||
184
node_modules/dialogflow/protos/google/cloud/dialogflow/v2/session_entity_type.proto
generated
vendored
Normal file
184
node_modules/dialogflow/protos/google/cloud/dialogflow/v2/session_entity_type.proto
generated
vendored
Normal file
@@ -0,0 +1,184 @@
|
||||
// Copyright 2018 Google Inc.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
syntax = "proto3";
|
||||
|
||||
package google.cloud.dialogflow.v2;
|
||||
|
||||
import "google/api/annotations.proto";
|
||||
import "google/cloud/dialogflow/v2/entity_type.proto";
|
||||
import "google/protobuf/empty.proto";
|
||||
import "google/protobuf/field_mask.proto";
|
||||
|
||||
option cc_enable_arenas = true;
|
||||
option csharp_namespace = "Google.Cloud.Dialogflow.V2";
|
||||
option go_package = "google.golang.org/genproto/googleapis/cloud/dialogflow/v2;dialogflow";
|
||||
option java_multiple_files = true;
|
||||
option java_outer_classname = "SessionEntityTypeProto";
|
||||
option java_package = "com.google.cloud.dialogflow.v2";
|
||||
option objc_class_prefix = "DF";
|
||||
|
||||
|
||||
// Entities are extracted from user input and represent parameters that are
|
||||
// meaningful to your application. For example, a date range, a proper name
|
||||
// such as a geographic location or landmark, and so on. Entities represent
|
||||
// actionable data for your application.
|
||||
//
|
||||
// Session entity types are referred to as **User** entity types and are
|
||||
// entities that are built for an individual user such as
|
||||
// favorites, preferences, playlists, and so on. You can redefine a session
|
||||
// entity type at the session level.
|
||||
//
|
||||
// For more information about entity types, see the
|
||||
// [Dialogflow documentation](https://dialogflow.com/docs/entities).
|
||||
service SessionEntityTypes {
|
||||
// Returns the list of all session entity types in the specified session.
|
||||
rpc ListSessionEntityTypes(ListSessionEntityTypesRequest) returns (ListSessionEntityTypesResponse) {
|
||||
option (google.api.http) = {
|
||||
get: "/v2/{parent=projects/*/agent/sessions/*}/entityTypes"
|
||||
};
|
||||
}
|
||||
|
||||
// Retrieves the specified session entity type.
|
||||
rpc GetSessionEntityType(GetSessionEntityTypeRequest) returns (SessionEntityType) {
|
||||
option (google.api.http) = {
|
||||
get: "/v2/{name=projects/*/agent/sessions/*/entityTypes/*}"
|
||||
};
|
||||
}
|
||||
|
||||
// Creates a session entity type.
|
||||
rpc CreateSessionEntityType(CreateSessionEntityTypeRequest) returns (SessionEntityType) {
|
||||
option (google.api.http) = {
|
||||
post: "/v2/{parent=projects/*/agent/sessions/*}/entityTypes"
|
||||
body: "session_entity_type"
|
||||
};
|
||||
}
|
||||
|
||||
// Updates the specified session entity type.
|
||||
rpc UpdateSessionEntityType(UpdateSessionEntityTypeRequest) returns (SessionEntityType) {
|
||||
option (google.api.http) = {
|
||||
patch: "/v2/{session_entity_type.name=projects/*/agent/sessions/*/entityTypes/*}"
|
||||
body: "session_entity_type"
|
||||
};
|
||||
}
|
||||
|
||||
// Deletes the specified session entity type.
|
||||
rpc DeleteSessionEntityType(DeleteSessionEntityTypeRequest) returns (google.protobuf.Empty) {
|
||||
option (google.api.http) = {
|
||||
delete: "/v2/{name=projects/*/agent/sessions/*/entityTypes/*}"
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
// Represents a session entity type.
|
||||
//
|
||||
// Extends or replaces a developer entity type at the user session level (we
|
||||
// refer to the entity types defined at the agent level as "developer entity
|
||||
// types").
|
||||
//
|
||||
// Note: session entity types apply to all queries, regardless of the language.
|
||||
message SessionEntityType {
|
||||
// The types of modifications for a session entity type.
|
||||
enum EntityOverrideMode {
|
||||
// Not specified. This value should be never used.
|
||||
ENTITY_OVERRIDE_MODE_UNSPECIFIED = 0;
|
||||
|
||||
// The collection of session entities overrides the collection of entities
|
||||
// in the corresponding developer entity type.
|
||||
ENTITY_OVERRIDE_MODE_OVERRIDE = 1;
|
||||
|
||||
// The collection of session entities extends the collection of entities in
|
||||
// the corresponding developer entity type.
|
||||
// Calls to `ListSessionEntityTypes`, `GetSessionEntityType`,
|
||||
// `CreateSessionEntityType` and `UpdateSessionEntityType` return the full
|
||||
// collection of entities from the developer entity type in the agent's
|
||||
// default language and the session entity type.
|
||||
ENTITY_OVERRIDE_MODE_SUPPLEMENT = 2;
|
||||
}
|
||||
|
||||
// Required. The unique identifier of this session entity type. Format:
|
||||
// `projects/<Project ID>/agent/sessions/<Session ID>/entityTypes/<Entity Type
|
||||
// Display Name>`.
|
||||
string name = 1;
|
||||
|
||||
// Required. Indicates whether the additional data should override or
|
||||
// supplement the developer entity type definition.
|
||||
EntityOverrideMode entity_override_mode = 2;
|
||||
|
||||
// Required. The collection of entities associated with this session entity
|
||||
// type.
|
||||
repeated EntityType.Entity entities = 3;
|
||||
}
|
||||
|
||||
// The request message for [SessionEntityTypes.ListSessionEntityTypes][google.cloud.dialogflow.v2.SessionEntityTypes.ListSessionEntityTypes].
|
||||
message ListSessionEntityTypesRequest {
|
||||
// Required. The session to list all session entity types from.
|
||||
// Format: `projects/<Project ID>/agent/sessions/<Session ID>`.
|
||||
string parent = 1;
|
||||
|
||||
// Optional. The maximum number of items to return in a single page. By
|
||||
// default 100 and at most 1000.
|
||||
int32 page_size = 2;
|
||||
|
||||
// Optional. The next_page_token value returned from a previous list request.
|
||||
string page_token = 3;
|
||||
}
|
||||
|
||||
// The response message for [SessionEntityTypes.ListSessionEntityTypes][google.cloud.dialogflow.v2.SessionEntityTypes.ListSessionEntityTypes].
|
||||
message ListSessionEntityTypesResponse {
|
||||
// The list of session entity types. There will be a maximum number of items
|
||||
// returned based on the page_size field in the request.
|
||||
repeated SessionEntityType session_entity_types = 1;
|
||||
|
||||
// Token to retrieve the next page of results, or empty if there are no
|
||||
// more results in the list.
|
||||
string next_page_token = 2;
|
||||
}
|
||||
|
||||
// The request message for [SessionEntityTypes.GetSessionEntityType][google.cloud.dialogflow.v2.SessionEntityTypes.GetSessionEntityType].
|
||||
message GetSessionEntityTypeRequest {
|
||||
// Required. The name of the session entity type. Format:
|
||||
// `projects/<Project ID>/agent/sessions/<Session ID>/entityTypes/<Entity Type
|
||||
// Display Name>`.
|
||||
string name = 1;
|
||||
}
|
||||
|
||||
// The request message for [SessionEntityTypes.CreateSessionEntityType][google.cloud.dialogflow.v2.SessionEntityTypes.CreateSessionEntityType].
|
||||
message CreateSessionEntityTypeRequest {
|
||||
// Required. The session to create a session entity type for.
|
||||
// Format: `projects/<Project ID>/agent/sessions/<Session ID>`.
|
||||
string parent = 1;
|
||||
|
||||
// Required. The session entity type to create.
|
||||
SessionEntityType session_entity_type = 2;
|
||||
}
|
||||
|
||||
// The request message for [SessionEntityTypes.UpdateSessionEntityType][google.cloud.dialogflow.v2.SessionEntityTypes.UpdateSessionEntityType].
|
||||
message UpdateSessionEntityTypeRequest {
|
||||
// Required. The entity type to update. Format:
|
||||
// `projects/<Project ID>/agent/sessions/<Session ID>/entityTypes/<Entity Type
|
||||
// Display Name>`.
|
||||
SessionEntityType session_entity_type = 1;
|
||||
|
||||
// Optional. The mask to control which fields get updated.
|
||||
google.protobuf.FieldMask update_mask = 2;
|
||||
}
|
||||
|
||||
// The request message for [SessionEntityTypes.DeleteSessionEntityType][google.cloud.dialogflow.v2.SessionEntityTypes.DeleteSessionEntityType].
|
||||
message DeleteSessionEntityTypeRequest {
|
||||
// Required. The name of the entity type to delete. Format:
|
||||
// `projects/<Project ID>/agent/sessions/<Session ID>/entityTypes/<Entity Type
|
||||
// Display Name>`.
|
||||
string name = 1;
|
||||
}
|
||||
111
node_modules/dialogflow/protos/google/cloud/dialogflow/v2/webhook.proto
generated
vendored
Normal file
111
node_modules/dialogflow/protos/google/cloud/dialogflow/v2/webhook.proto
generated
vendored
Normal file
@@ -0,0 +1,111 @@
|
||||
// Copyright 2018 Google Inc.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
syntax = "proto3";
|
||||
|
||||
package google.cloud.dialogflow.v2;
|
||||
|
||||
import "google/api/annotations.proto";
|
||||
import "google/cloud/dialogflow/v2/context.proto";
|
||||
import "google/cloud/dialogflow/v2/intent.proto";
|
||||
import "google/cloud/dialogflow/v2/session.proto";
|
||||
import "google/protobuf/struct.proto";
|
||||
|
||||
option cc_enable_arenas = true;
|
||||
option csharp_namespace = "Google.Cloud.Dialogflow.V2";
|
||||
option go_package = "google.golang.org/genproto/googleapis/cloud/dialogflow/v2;dialogflow";
|
||||
option java_multiple_files = true;
|
||||
option java_outer_classname = "WebhookProto";
|
||||
option java_package = "com.google.cloud.dialogflow.v2";
|
||||
option objc_class_prefix = "DF";
|
||||
|
||||
|
||||
// The request message for a webhook call.
|
||||
message WebhookRequest {
|
||||
// The unique identifier of detectIntent request session.
|
||||
// Can be used to identify end-user inside webhook implementation.
|
||||
// Format: `projects/<Project ID>/agent/sessions/<Session ID>`.
|
||||
string session = 4;
|
||||
|
||||
// The unique identifier of the response. Contains the same value as
|
||||
// `[Streaming]DetectIntentResponse.response_id`.
|
||||
string response_id = 1;
|
||||
|
||||
// The result of the conversational query or event processing. Contains the
|
||||
// same value as `[Streaming]DetectIntentResponse.query_result`.
|
||||
QueryResult query_result = 2;
|
||||
|
||||
// Optional. The contents of the original request that was passed to
|
||||
// `[Streaming]DetectIntent` call.
|
||||
OriginalDetectIntentRequest original_detect_intent_request = 3;
|
||||
}
|
||||
|
||||
// The response message for a webhook call.
|
||||
message WebhookResponse {
|
||||
// Optional. The text to be shown on the screen. This value is passed directly
|
||||
// to `QueryResult.fulfillment_text`.
|
||||
string fulfillment_text = 1;
|
||||
|
||||
// Optional. The collection of rich messages to present to the user. This
|
||||
// value is passed directly to `QueryResult.fulfillment_messages`.
|
||||
repeated Intent.Message fulfillment_messages = 2;
|
||||
|
||||
// Optional. This value is passed directly to `QueryResult.webhook_source`.
|
||||
string source = 3;
|
||||
|
||||
// Optional. This value is passed directly to `QueryResult.webhook_payload`.
|
||||
// See the related `fulfillment_messages[i].payload field`, which may be used
|
||||
// as an alternative to this field.
|
||||
//
|
||||
// This field can be used for Actions on Google responses.
|
||||
// It should have a structure similar to the JSON message shown here. For more
|
||||
// information, see
|
||||
// [Actions on Google Webhook
|
||||
// Format](https://developers.google.com/actions/dialogflow/webhook)
|
||||
// <pre>{
|
||||
// "google": {
|
||||
// "expectUserResponse": true,
|
||||
// "richResponse": {
|
||||
// "items": [
|
||||
// {
|
||||
// "simpleResponse": {
|
||||
// "textToSpeech": "this is a simple response"
|
||||
// }
|
||||
// }
|
||||
// ]
|
||||
// }
|
||||
// }
|
||||
// }</pre>
|
||||
google.protobuf.Struct payload = 4;
|
||||
|
||||
// Optional. The collection of output contexts. This value is passed directly
|
||||
// to `QueryResult.output_contexts`.
|
||||
repeated Context output_contexts = 5;
|
||||
|
||||
// Optional. Makes the platform immediately invoke another `DetectIntent` call
|
||||
// internally with the specified event as input.
|
||||
EventInput followup_event_input = 6;
|
||||
}
|
||||
|
||||
// Represents the contents of the original request that was passed to
|
||||
// the `[Streaming]DetectIntent` call.
|
||||
message OriginalDetectIntentRequest {
|
||||
// The source of this request, e.g., `google`, `facebook`, `slack`. It is set
|
||||
// by Dialogflow-owned servers.
|
||||
string source = 1;
|
||||
|
||||
// Optional. This field is set to the value of `QueryParameters.payload` field
|
||||
// passed in the request.
|
||||
google.protobuf.Struct payload = 3;
|
||||
}
|
||||
334
node_modules/dialogflow/protos/google/cloud/dialogflow/v2beta1/agent.proto
generated
vendored
Normal file
334
node_modules/dialogflow/protos/google/cloud/dialogflow/v2beta1/agent.proto
generated
vendored
Normal file
@@ -0,0 +1,334 @@
|
||||
// Copyright 2018 Google Inc.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
syntax = "proto3";
|
||||
|
||||
package google.cloud.dialogflow.v2beta1;
|
||||
|
||||
import "google/api/annotations.proto";
|
||||
import "google/longrunning/operations.proto";
|
||||
import "google/protobuf/empty.proto";
|
||||
import "google/protobuf/field_mask.proto";
|
||||
import "google/protobuf/struct.proto";
|
||||
|
||||
option cc_enable_arenas = true;
|
||||
option csharp_namespace = "Google.Cloud.Dialogflow.V2beta1";
|
||||
option go_package = "google.golang.org/genproto/googleapis/cloud/dialogflow/v2beta1;dialogflow";
|
||||
option java_multiple_files = true;
|
||||
option java_outer_classname = "AgentProto";
|
||||
option java_package = "com.google.cloud.dialogflow.v2beta1";
|
||||
option objc_class_prefix = "DF";
|
||||
|
||||
|
||||
// Agents are best described as Natural Language Understanding (NLU) modules
|
||||
// that transform user requests into actionable data. You can include agents
|
||||
// in your app, product, or service to determine user intent and respond to the
|
||||
// user in a natural way.
|
||||
//
|
||||
// After you create an agent, you can add [Intents][google.cloud.dialogflow.v2beta1.Intents], [Contexts][google.cloud.dialogflow.v2beta1.Contexts],
|
||||
// [Entity Types][google.cloud.dialogflow.v2beta1.EntityTypes], [Webhooks][google.cloud.dialogflow.v2beta1.WebhookRequest], and so on to
|
||||
// manage the flow of a conversation and match user input to predefined intents
|
||||
// and actions.
|
||||
//
|
||||
// You can create an agent using both Dialogflow Standard Edition and
|
||||
// Dialogflow Enterprise Edition. For details, see
|
||||
// [Dialogflow Editions](/dialogflow-enterprise/docs/editions).
|
||||
//
|
||||
// You can save your agent for backup or versioning by exporting the agent by
|
||||
// using the [ExportAgent][google.cloud.dialogflow.v2beta1.Agents.ExportAgent] method. You can import a saved
|
||||
// agent by using the [ImportAgent][google.cloud.dialogflow.v2beta1.Agents.ImportAgent] method.
|
||||
//
|
||||
// Dialogflow provides several
|
||||
// [prebuilt agents](https://dialogflow.com/docs/prebuilt-agents) for common
|
||||
// conversation scenarios such as determining a date and time, converting
|
||||
// currency, and so on.
|
||||
//
|
||||
// For more information about agents, see the
|
||||
// [Dialogflow documentation](https://dialogflow.com/docs/agents).
|
||||
service Agents {
|
||||
// Retrieves the specified agent.
|
||||
rpc GetAgent(GetAgentRequest) returns (Agent) {
|
||||
option (google.api.http) = {
|
||||
get: "/v2beta1/{parent=projects/*}/agent"
|
||||
};
|
||||
}
|
||||
|
||||
// Returns the list of agents.
|
||||
//
|
||||
// Since there is at most one conversational agent per project, this method is
|
||||
// useful primarily for listing all agents across projects the caller has
|
||||
// access to. One can achieve that with a wildcard project collection id "-".
|
||||
// Refer to [List
|
||||
// Sub-Collections](https://cloud.google.com/apis/design/design_patterns#list_sub-collections).
|
||||
rpc SearchAgents(SearchAgentsRequest) returns (SearchAgentsResponse) {
|
||||
option (google.api.http) = {
|
||||
get: "/v2beta1/{parent=projects/*}/agent:search"
|
||||
};
|
||||
}
|
||||
|
||||
// Trains the specified agent.
|
||||
//
|
||||
//
|
||||
// Operation <response: [google.protobuf.Empty][google.protobuf.Empty],
|
||||
// metadata: [google.protobuf.Struct][google.protobuf.Struct]>
|
||||
rpc TrainAgent(TrainAgentRequest) returns (google.longrunning.Operation) {
|
||||
option (google.api.http) = {
|
||||
post: "/v2beta1/{parent=projects/*}/agent:train"
|
||||
body: "*"
|
||||
};
|
||||
}
|
||||
|
||||
// Exports the specified agent to a ZIP file.
|
||||
//
|
||||
//
|
||||
// Operation <response: [ExportAgentResponse][google.cloud.dialogflow.v2beta1.ExportAgentResponse],
|
||||
// metadata: [google.protobuf.Struct][google.protobuf.Struct]>
|
||||
rpc ExportAgent(ExportAgentRequest) returns (google.longrunning.Operation) {
|
||||
option (google.api.http) = {
|
||||
post: "/v2beta1/{parent=projects/*}/agent:export"
|
||||
body: "*"
|
||||
};
|
||||
}
|
||||
|
||||
// Imports the specified agent from a ZIP file.
|
||||
//
|
||||
// Uploads new intents and entity types without deleting the existing ones.
|
||||
// Intents and entity types with the same name are replaced with the new
|
||||
// versions from ImportAgentRequest.
|
||||
//
|
||||
//
|
||||
// Operation <response: [google.protobuf.Empty][google.protobuf.Empty],
|
||||
// metadata: [google.protobuf.Struct][google.protobuf.Struct]>
|
||||
rpc ImportAgent(ImportAgentRequest) returns (google.longrunning.Operation) {
|
||||
option (google.api.http) = {
|
||||
post: "/v2beta1/{parent=projects/*}/agent:import"
|
||||
body: "*"
|
||||
};
|
||||
}
|
||||
|
||||
// Restores the specified agent from a ZIP file.
|
||||
//
|
||||
// Replaces the current agent version with a new one. All the intents and
|
||||
// entity types in the older version are deleted.
|
||||
//
|
||||
//
|
||||
// Operation <response: [google.protobuf.Empty][google.protobuf.Empty],
|
||||
// metadata: [google.protobuf.Struct][google.protobuf.Struct]>
|
||||
rpc RestoreAgent(RestoreAgentRequest) returns (google.longrunning.Operation) {
|
||||
option (google.api.http) = {
|
||||
post: "/v2beta1/{parent=projects/*}/agent:restore"
|
||||
body: "*"
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
// Represents a conversational agent.
|
||||
message Agent {
|
||||
// Match mode determines how intents are detected from user queries.
|
||||
enum MatchMode {
|
||||
// Not specified.
|
||||
MATCH_MODE_UNSPECIFIED = 0;
|
||||
|
||||
// Best for agents with a small number of examples in intents and/or wide
|
||||
// use of templates syntax and composite entities.
|
||||
MATCH_MODE_HYBRID = 1;
|
||||
|
||||
// Can be used for agents with a large number of examples in intents,
|
||||
// especially the ones using @sys.any or very large developer entities.
|
||||
MATCH_MODE_ML_ONLY = 2;
|
||||
}
|
||||
|
||||
// Required. The project of this agent.
|
||||
// Format: `projects/<Project ID>`.
|
||||
string parent = 1;
|
||||
|
||||
// Required. The name of this agent.
|
||||
string display_name = 2;
|
||||
|
||||
// Required. The default language of the agent as a language tag. See
|
||||
// [Language Support](https://dialogflow.com/docs/reference/language) for a
|
||||
// list of the currently supported language codes.
|
||||
// This field cannot be set by the `Update` method.
|
||||
string default_language_code = 3;
|
||||
|
||||
// Optional. The list of all languages supported by this agent (except for the
|
||||
// `default_language_code`).
|
||||
repeated string supported_language_codes = 4;
|
||||
|
||||
// Required. The time zone of this agent from the
|
||||
// [time zone database](https://www.iana.org/time-zones), e.g.,
|
||||
// America/New_York, Europe/Paris.
|
||||
string time_zone = 5;
|
||||
|
||||
// Optional. The description of this agent.
|
||||
// The maximum length is 500 characters. If exceeded, the request is rejected.
|
||||
string description = 6;
|
||||
|
||||
// Optional. The URI of the agent's avatar.
|
||||
// Avatars are used throughout the Dialogflow console and in the self-hosted
|
||||
// [Web Demo](https://dialogflow.com/docs/integrations/web-demo) integration.
|
||||
string avatar_uri = 7;
|
||||
|
||||
// Optional. Determines whether this agent should log conversation queries.
|
||||
bool enable_logging = 8;
|
||||
|
||||
// Optional. Determines how intents are detected from user queries.
|
||||
MatchMode match_mode = 9;
|
||||
|
||||
// Optional. To filter out false positive results and still get variety in
|
||||
// matched natural language inputs for your agent, you can tune the machine
|
||||
// learning classification threshold. If the returned score value is less than
|
||||
// the threshold value, then a fallback intent is be triggered or, if there
|
||||
// are no fallback intents defined, no intent will be triggered. The score
|
||||
// values range from 0.0 (completely uncertain) to 1.0 (completely certain).
|
||||
// If set to 0.0, the default of 0.3 is used.
|
||||
float classification_threshold = 10;
|
||||
}
|
||||
|
||||
// The request message for [Agents.GetAgent][google.cloud.dialogflow.v2beta1.Agents.GetAgent].
|
||||
message GetAgentRequest {
|
||||
// Required. The project that the agent to fetch is associated with.
|
||||
// Format: `projects/<Project ID>`.
|
||||
string parent = 1;
|
||||
}
|
||||
|
||||
// The request message for [Agents.SearchAgents][google.cloud.dialogflow.v2beta1.Agents.SearchAgents].
|
||||
message SearchAgentsRequest {
|
||||
// Required. The project to list agents from.
|
||||
// Format: `projects/<Project ID or '-'>`.
|
||||
string parent = 1;
|
||||
|
||||
// Optional. The maximum number of items to return in a single page. By
|
||||
// default 100 and at most 1000.
|
||||
int32 page_size = 2;
|
||||
|
||||
// Optional. The next_page_token value returned from a previous list request.
|
||||
string page_token = 3;
|
||||
}
|
||||
|
||||
// The response message for [Agents.SearchAgents][google.cloud.dialogflow.v2beta1.Agents.SearchAgents].
|
||||
message SearchAgentsResponse {
|
||||
// The list of agents. There will be a maximum number of items returned based
|
||||
// on the page_size field in the request.
|
||||
repeated Agent agents = 1;
|
||||
|
||||
// Token to retrieve the next page of results, or empty if there are no
|
||||
// more results in the list.
|
||||
string next_page_token = 2;
|
||||
}
|
||||
|
||||
// The request message for [Agents.TrainAgent][google.cloud.dialogflow.v2beta1.Agents.TrainAgent].
|
||||
message TrainAgentRequest {
|
||||
// Required. The project that the agent to train is associated with.
|
||||
// Format: `projects/<Project ID>`.
|
||||
string parent = 1;
|
||||
}
|
||||
|
||||
// The request message for [Agents.ExportAgent][google.cloud.dialogflow.v2beta1.Agents.ExportAgent].
|
||||
message ExportAgentRequest {
|
||||
// Required. The project that the agent to export is associated with.
|
||||
// Format: `projects/<Project ID>`.
|
||||
string parent = 1;
|
||||
|
||||
// Optional. The Google Cloud Storage URI to export the agent to.
|
||||
// Note: The URI must start with
|
||||
// "gs://". If left unspecified, the serialized agent is returned inline.
|
||||
string agent_uri = 2;
|
||||
}
|
||||
|
||||
// The response message for [Agents.ExportAgent][google.cloud.dialogflow.v2beta1.Agents.ExportAgent].
|
||||
message ExportAgentResponse {
|
||||
// Required. The exported agent.
|
||||
oneof agent {
|
||||
// The URI to a file containing the exported agent. This field is populated
|
||||
// only if `agent_uri` is specified in `ExportAgentRequest`.
|
||||
string agent_uri = 1;
|
||||
|
||||
// The exported agent.
|
||||
//
|
||||
// Example for how to export an agent to a zip file via a command line:
|
||||
//
|
||||
// curl \
|
||||
// 'https://dialogflow.googleapis.com/v2beta1/projects/<project_name>/agent:export'\
|
||||
// -X POST \
|
||||
// -H 'Authorization: Bearer '$(gcloud auth print-access-token) \
|
||||
// -H 'Accept: application/json' \
|
||||
// -H 'Content-Type: application/json' \
|
||||
// --compressed \
|
||||
// --data-binary '{}' \
|
||||
// | grep agentContent | sed -e 's/.*"agentContent": "\([^"]*\)".*/\1/' \
|
||||
// | base64 --decode > <agent zip file>
|
||||
bytes agent_content = 2;
|
||||
}
|
||||
}
|
||||
|
||||
// The request message for [Agents.ImportAgent][google.cloud.dialogflow.v2beta1.Agents.ImportAgent].
|
||||
message ImportAgentRequest {
|
||||
// Required. The project that the agent to import is associated with.
|
||||
// Format: `projects/<Project ID>`.
|
||||
string parent = 1;
|
||||
|
||||
// Required. The agent to import.
|
||||
oneof agent {
|
||||
// The URI to a Google Cloud Storage file containing the agent to import.
|
||||
// Note: The URI must start with "gs://".
|
||||
string agent_uri = 2;
|
||||
|
||||
// The agent to import.
|
||||
//
|
||||
// Example for how to import an agent via the command line:
|
||||
//
|
||||
// curl \
|
||||
// 'https://dialogflow.googleapis.com/v2beta1/projects/<project_name>/agent:import\
|
||||
// -X POST \
|
||||
// -H 'Authorization: Bearer '$(gcloud auth print-access-token) \
|
||||
// -H 'Accept: application/json' \
|
||||
// -H 'Content-Type: application/json' \
|
||||
// --compressed \
|
||||
// --data-binary "{
|
||||
// 'agentContent': '$(cat <agent zip file> | base64 -w 0)'
|
||||
// }"
|
||||
bytes agent_content = 3;
|
||||
}
|
||||
}
|
||||
|
||||
// The request message for [Agents.RestoreAgent][google.cloud.dialogflow.v2beta1.Agents.RestoreAgent].
|
||||
message RestoreAgentRequest {
|
||||
// Required. The project that the agent to restore is associated with.
|
||||
// Format: `projects/<Project ID>`.
|
||||
string parent = 1;
|
||||
|
||||
// Required. The agent to restore.
|
||||
oneof agent {
|
||||
// The URI to a Google Cloud Storage file containing the agent to restore.
|
||||
// Note: The URI must start with "gs://".
|
||||
string agent_uri = 2;
|
||||
|
||||
// The agent to restore.
|
||||
//
|
||||
// Example for how to restore an agent via the command line:
|
||||
//
|
||||
// curl \
|
||||
// 'https://dialogflow.googleapis.com/v2beta1/projects/<project_name>/agent:restore\
|
||||
// -X POST \
|
||||
// -H 'Authorization: Bearer '$(gcloud auth print-access-token) \
|
||||
// -H 'Accept: application/json' \
|
||||
// -H 'Content-Type: application/json' \
|
||||
// --compressed \
|
||||
// --data-binary "{
|
||||
// 'agentContent': '$(cat <agent zip file> | base64 -w 0)'
|
||||
// }" \
|
||||
bytes agent_content = 3;
|
||||
}
|
||||
}
|
||||
230
node_modules/dialogflow/protos/google/cloud/dialogflow/v2beta1/context.proto
generated
vendored
Normal file
230
node_modules/dialogflow/protos/google/cloud/dialogflow/v2beta1/context.proto
generated
vendored
Normal file
@@ -0,0 +1,230 @@
|
||||
// Copyright 2018 Google Inc.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
syntax = "proto3";
|
||||
|
||||
package google.cloud.dialogflow.v2beta1;
|
||||
|
||||
import "google/api/annotations.proto";
|
||||
import "google/protobuf/empty.proto";
|
||||
import "google/protobuf/field_mask.proto";
|
||||
import "google/protobuf/struct.proto";
|
||||
|
||||
option cc_enable_arenas = true;
|
||||
option csharp_namespace = "Google.Cloud.Dialogflow.V2beta1";
|
||||
option go_package = "google.golang.org/genproto/googleapis/cloud/dialogflow/v2beta1;dialogflow";
|
||||
option java_multiple_files = true;
|
||||
option java_outer_classname = "ContextProto";
|
||||
option java_package = "com.google.cloud.dialogflow.v2beta1";
|
||||
option objc_class_prefix = "DF";
|
||||
|
||||
|
||||
// A context represents additional information included with user input or with
|
||||
// an intent returned by the Dialogflow API. Contexts are helpful for
|
||||
// differentiating user input which may be vague or have a different meaning
|
||||
// depending on additional details from your application such as user setting
|
||||
// and preferences, previous user input, where the user is in your application,
|
||||
// geographic location, and so on.
|
||||
//
|
||||
// You can include contexts as input parameters of a
|
||||
// [DetectIntent][google.cloud.dialogflow.v2beta1.Sessions.DetectIntent] (or
|
||||
// [StreamingDetectIntent][google.cloud.dialogflow.v2beta1.Sessions.StreamingDetectIntent]) request,
|
||||
// or as output contexts included in the returned intent.
|
||||
// Contexts expire when an intent is matched, after the number of `DetectIntent`
|
||||
// requests specified by the `lifespan_count` parameter, or after 10 minutes
|
||||
// if no intents are matched for a `DetectIntent` request.
|
||||
//
|
||||
// For more information about contexts, see the
|
||||
// [Dialogflow documentation](https://dialogflow.com/docs/contexts).
|
||||
service Contexts {
|
||||
// Returns the list of all contexts in the specified session.
|
||||
rpc ListContexts(ListContextsRequest) returns (ListContextsResponse) {
|
||||
option (google.api.http) = {
|
||||
get: "/v2beta1/{parent=projects/*/agent/sessions/*}/contexts"
|
||||
additional_bindings {
|
||||
get: "/v2beta1/{parent=projects/*/agent/environments/*/users/*/sessions/*}/contexts"
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
// Retrieves the specified context.
|
||||
rpc GetContext(GetContextRequest) returns (Context) {
|
||||
option (google.api.http) = {
|
||||
get: "/v2beta1/{name=projects/*/agent/sessions/*/contexts/*}"
|
||||
additional_bindings {
|
||||
get: "/v2beta1/{name=projects/*/agent/environments/*/users/*/sessions/*/contexts/*}"
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
// Creates a context.
|
||||
rpc CreateContext(CreateContextRequest) returns (Context) {
|
||||
option (google.api.http) = {
|
||||
post: "/v2beta1/{parent=projects/*/agent/sessions/*}/contexts"
|
||||
body: "context"
|
||||
additional_bindings {
|
||||
post: "/v2beta1/{parent=projects/*/agent/environments/*/users/*/sessions/*}/contexts"
|
||||
body: "context"
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
// Updates the specified context.
|
||||
rpc UpdateContext(UpdateContextRequest) returns (Context) {
|
||||
option (google.api.http) = {
|
||||
patch: "/v2beta1/{context.name=projects/*/agent/sessions/*/contexts/*}"
|
||||
body: "context"
|
||||
additional_bindings {
|
||||
patch: "/v2beta1/{context.name=projects/*/agent/environments/*/users/*/sessions/*/contexts/*}"
|
||||
body: "context"
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
// Deletes the specified context.
|
||||
rpc DeleteContext(DeleteContextRequest) returns (google.protobuf.Empty) {
|
||||
option (google.api.http) = {
|
||||
delete: "/v2beta1/{name=projects/*/agent/sessions/*/contexts/*}"
|
||||
additional_bindings {
|
||||
delete: "/v2beta1/{name=projects/*/agent/environments/*/users/*/sessions/*/contexts/*}"
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
// Deletes all active contexts in the specified session.
|
||||
rpc DeleteAllContexts(DeleteAllContextsRequest) returns (google.protobuf.Empty) {
|
||||
option (google.api.http) = {
|
||||
delete: "/v2beta1/{parent=projects/*/agent/sessions/*}/contexts"
|
||||
additional_bindings {
|
||||
delete: "/v2beta1/{parent=projects/*/agent/environments/*/users/*/sessions/*}/contexts"
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
// Represents a context.
|
||||
message Context {
|
||||
// Required. The unique identifier of the context. Format:
|
||||
// `projects/<Project ID>/agent/sessions/<Session ID>/contexts/<Context ID>`,
|
||||
// or
|
||||
// `projects/<Project ID>/agent/environments/<Environment ID>/users/<User
|
||||
// ID>/sessions/<Session ID>/contexts/<Context ID>`. Note: Environments and
|
||||
// users are under construction and will be available soon. The Context ID is
|
||||
// always converted to lowercase. If <Environment ID> is not specified, we
|
||||
// assume default 'draft' environment. If <User ID> is not specified, we
|
||||
// assume default '-' user.
|
||||
string name = 1;
|
||||
|
||||
// Optional. The number of conversational query requests after which the
|
||||
// context expires. If set to `0` (the default) the context expires
|
||||
// immediately. Contexts expire automatically after 10 minutes even if there
|
||||
// are no matching queries.
|
||||
int32 lifespan_count = 2;
|
||||
|
||||
// Optional. The collection of parameters associated with this context.
|
||||
// Refer to [this doc](https://dialogflow.com/docs/actions-and-parameters) for
|
||||
// syntax.
|
||||
google.protobuf.Struct parameters = 3;
|
||||
}
|
||||
|
||||
// The request message for [Contexts.ListContexts][google.cloud.dialogflow.v2beta1.Contexts.ListContexts].
|
||||
message ListContextsRequest {
|
||||
// Required. The session to list all contexts from.
|
||||
// Format: `projects/<Project ID>/agent/sessions/<Session ID>` or
|
||||
// `projects/<Project ID>/agent/environments/<Environment ID>/users/<User
|
||||
// ID>/sessions/<Session ID>`. Note: Environments and users are under
|
||||
// construction and will be available soon. If <Environment ID> is not
|
||||
// specified, we assume default 'draft' environment. If <User ID> is not
|
||||
// specified, we assume default '-' user.
|
||||
string parent = 1;
|
||||
|
||||
// Optional. The maximum number of items to return in a single page. By
|
||||
// default 100 and at most 1000.
|
||||
int32 page_size = 2;
|
||||
|
||||
// Optional. The next_page_token value returned from a previous list request.
|
||||
string page_token = 3;
|
||||
}
|
||||
|
||||
// The response message for [Contexts.ListContexts][google.cloud.dialogflow.v2beta1.Contexts.ListContexts].
|
||||
message ListContextsResponse {
|
||||
// The list of contexts. There will be a maximum number of items
|
||||
// returned based on the page_size field in the request.
|
||||
repeated Context contexts = 1;
|
||||
|
||||
// Token to retrieve the next page of results, or empty if there are no
|
||||
// more results in the list.
|
||||
string next_page_token = 2;
|
||||
}
|
||||
|
||||
// The request message for [Contexts.GetContext][google.cloud.dialogflow.v2beta1.Contexts.GetContext].
|
||||
message GetContextRequest {
|
||||
// Required. The name of the context. Format:
|
||||
// `projects/<Project ID>/agent/sessions/<Session ID>/contexts/<Context ID>`
|
||||
// or `projects/<Project ID>/agent/environments/<Environment ID>/users/<User
|
||||
// ID>/sessions/<Session ID>/contexts/<Context ID>`. Note: Environments and
|
||||
// users are under construction and will be available soon. If <Environment
|
||||
// ID> is not specified, we assume default 'draft' environment. If <User ID>
|
||||
// is not specified, we assume default '-' user.
|
||||
string name = 1;
|
||||
}
|
||||
|
||||
// The request message for [Contexts.CreateContext][google.cloud.dialogflow.v2beta1.Contexts.CreateContext].
|
||||
message CreateContextRequest {
|
||||
// Required. The session to create a context for.
|
||||
// Format: `projects/<Project ID>/agent/sessions/<Session ID>` or
|
||||
// `projects/<Project ID>/agent/environments/<Environment ID>/users/<User
|
||||
// ID>/sessions/<Session ID>`. Note: Environments and users are under
|
||||
// construction and will be available soon. If <Environment ID> is not
|
||||
// specified, we assume default 'draft' environment. If <User ID> is not
|
||||
// specified, we assume default '-' user.
|
||||
string parent = 1;
|
||||
|
||||
// Required. The context to create.
|
||||
Context context = 2;
|
||||
}
|
||||
|
||||
// The request message for [Contexts.UpdateContext][google.cloud.dialogflow.v2beta1.Contexts.UpdateContext].
|
||||
message UpdateContextRequest {
|
||||
// Required. The context to update.
|
||||
Context context = 1;
|
||||
|
||||
// Optional. The mask to control which fields get updated.
|
||||
google.protobuf.FieldMask update_mask = 2;
|
||||
}
|
||||
|
||||
// The request message for [Contexts.DeleteContext][google.cloud.dialogflow.v2beta1.Contexts.DeleteContext].
|
||||
message DeleteContextRequest {
|
||||
// Required. The name of the context to delete. Format:
|
||||
// `projects/<Project ID>/agent/sessions/<Session ID>/contexts/<Context ID>`
|
||||
// or `projects/<Project ID>/agent/environments/<Environment ID>/users/<User
|
||||
// ID>/sessions/<Session ID>/contexts/<Context ID>`. Note: Environments and
|
||||
// users are under construction and will be available soon. If <Environment
|
||||
// ID> is not specified, we assume default 'draft' environment. If <User ID>
|
||||
// is not specified, we assume default
|
||||
// '-' user.
|
||||
string name = 1;
|
||||
}
|
||||
|
||||
// The request message for [Contexts.DeleteAllContexts][google.cloud.dialogflow.v2beta1.Contexts.DeleteAllContexts].
|
||||
message DeleteAllContextsRequest {
|
||||
// Required. The name of the session to delete all contexts from. Format:
|
||||
// `projects/<Project ID>/agent/sessions/<Session ID>` or `projects/<Project
|
||||
// ID>/agent/environments/<Environment ID>/users/<User ID>/sessions/<Session
|
||||
// ID>`. Note: Environments and users are under construction and will be
|
||||
// available soon. If <Environment ID> is not specified we assume default
|
||||
// 'draft' environment. If <User ID> is not specified, we assume default
|
||||
// '-' user.
|
||||
string parent = 1;
|
||||
}
|
||||
419
node_modules/dialogflow/protos/google/cloud/dialogflow/v2beta1/entity_type.proto
generated
vendored
Normal file
419
node_modules/dialogflow/protos/google/cloud/dialogflow/v2beta1/entity_type.proto
generated
vendored
Normal file
@@ -0,0 +1,419 @@
|
||||
// Copyright 2018 Google Inc.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
syntax = "proto3";
|
||||
|
||||
package google.cloud.dialogflow.v2beta1;
|
||||
|
||||
import "google/api/annotations.proto";
|
||||
import "google/longrunning/operations.proto";
|
||||
import "google/protobuf/empty.proto";
|
||||
import "google/protobuf/field_mask.proto";
|
||||
import "google/protobuf/struct.proto";
|
||||
|
||||
option cc_enable_arenas = true;
|
||||
option csharp_namespace = "Google.Cloud.Dialogflow.V2beta1";
|
||||
option go_package = "google.golang.org/genproto/googleapis/cloud/dialogflow/v2beta1;dialogflow";
|
||||
option java_multiple_files = true;
|
||||
option java_outer_classname = "EntityTypeProto";
|
||||
option java_package = "com.google.cloud.dialogflow.v2beta1";
|
||||
option objc_class_prefix = "DF";
|
||||
|
||||
|
||||
// Entities are extracted from user input and represent parameters that are
|
||||
// meaningful to your application. For example, a date range, a proper name
|
||||
// such as a geographic location or landmark, and so on. Entities represent
|
||||
// actionable data for your application.
|
||||
//
|
||||
// When you define an entity, you can also include synonyms that all map to
|
||||
// that entity. For example, "soft drink", "soda", "pop", and so on.
|
||||
//
|
||||
// There are three types of entities:
|
||||
//
|
||||
// * **System** - entities that are defined by the Dialogflow API for common
|
||||
// data types such as date, time, currency, and so on. A system entity is
|
||||
// represented by the `EntityType` type.
|
||||
//
|
||||
// * **Developer** - entities that are defined by you that represent
|
||||
// actionable data that is meaningful to your application. For example,
|
||||
// you could define a `pizza.sauce` entity for red or white pizza sauce,
|
||||
// a `pizza.cheese` entity for the different types of cheese on a pizza,
|
||||
// a `pizza.topping` entity for different toppings, and so on. A developer
|
||||
// entity is represented by the `EntityType` type.
|
||||
//
|
||||
// * **User** - entities that are built for an individual user such as
|
||||
// favorites, preferences, playlists, and so on. A user entity is
|
||||
// represented by the [SessionEntityType][google.cloud.dialogflow.v2beta1.SessionEntityType] type.
|
||||
//
|
||||
// For more information about entity types, see the
|
||||
// [Dialogflow documentation](https://dialogflow.com/docs/entities).
|
||||
service EntityTypes {
|
||||
// Returns the list of all entity types in the specified agent.
|
||||
rpc ListEntityTypes(ListEntityTypesRequest) returns (ListEntityTypesResponse) {
|
||||
option (google.api.http) = {
|
||||
get: "/v2beta1/{parent=projects/*/agent}/entityTypes"
|
||||
};
|
||||
}
|
||||
|
||||
// Retrieves the specified entity type.
|
||||
rpc GetEntityType(GetEntityTypeRequest) returns (EntityType) {
|
||||
option (google.api.http) = {
|
||||
get: "/v2beta1/{name=projects/*/agent/entityTypes/*}"
|
||||
};
|
||||
}
|
||||
|
||||
// Creates an entity type in the specified agent.
|
||||
rpc CreateEntityType(CreateEntityTypeRequest) returns (EntityType) {
|
||||
option (google.api.http) = {
|
||||
post: "/v2beta1/{parent=projects/*/agent}/entityTypes"
|
||||
body: "entity_type"
|
||||
};
|
||||
}
|
||||
|
||||
// Updates the specified entity type.
|
||||
rpc UpdateEntityType(UpdateEntityTypeRequest) returns (EntityType) {
|
||||
option (google.api.http) = {
|
||||
patch: "/v2beta1/{entity_type.name=projects/*/agent/entityTypes/*}"
|
||||
body: "entity_type"
|
||||
};
|
||||
}
|
||||
|
||||
// Deletes the specified entity type.
|
||||
rpc DeleteEntityType(DeleteEntityTypeRequest) returns (google.protobuf.Empty) {
|
||||
option (google.api.http) = {
|
||||
delete: "/v2beta1/{name=projects/*/agent/entityTypes/*}"
|
||||
};
|
||||
}
|
||||
|
||||
// Updates/Creates multiple entity types in the specified agent.
|
||||
//
|
||||
// Operation <response: [BatchUpdateEntityTypesResponse][google.cloud.dialogflow.v2beta1.BatchUpdateEntityTypesResponse],
|
||||
// metadata: [google.protobuf.Struct][google.protobuf.Struct]>
|
||||
rpc BatchUpdateEntityTypes(BatchUpdateEntityTypesRequest) returns (google.longrunning.Operation) {
|
||||
option (google.api.http) = {
|
||||
post: "/v2beta1/{parent=projects/*/agent}/entityTypes:batchUpdate"
|
||||
body: "*"
|
||||
};
|
||||
}
|
||||
|
||||
// Deletes entity types in the specified agent.
|
||||
//
|
||||
// Operation <response: [google.protobuf.Empty][google.protobuf.Empty],
|
||||
// metadata: [google.protobuf.Struct][google.protobuf.Struct]>
|
||||
rpc BatchDeleteEntityTypes(BatchDeleteEntityTypesRequest) returns (google.longrunning.Operation) {
|
||||
option (google.api.http) = {
|
||||
post: "/v2beta1/{parent=projects/*/agent}/entityTypes:batchDelete"
|
||||
body: "*"
|
||||
};
|
||||
}
|
||||
|
||||
// Creates multiple new entities in the specified entity type (extends the
|
||||
// existing collection of entries).
|
||||
//
|
||||
// Operation <response: [google.protobuf.Empty][google.protobuf.Empty]>
|
||||
rpc BatchCreateEntities(BatchCreateEntitiesRequest) returns (google.longrunning.Operation) {
|
||||
option (google.api.http) = {
|
||||
post: "/v2beta1/{parent=projects/*/agent/entityTypes/*}/entities:batchCreate"
|
||||
body: "*"
|
||||
};
|
||||
}
|
||||
|
||||
// Updates entities in the specified entity type (replaces the existing
|
||||
// collection of entries).
|
||||
//
|
||||
// Operation <response: [google.protobuf.Empty][google.protobuf.Empty],
|
||||
// metadata: [google.protobuf.Struct][google.protobuf.Struct]>
|
||||
rpc BatchUpdateEntities(BatchUpdateEntitiesRequest) returns (google.longrunning.Operation) {
|
||||
option (google.api.http) = {
|
||||
post: "/v2beta1/{parent=projects/*/agent/entityTypes/*}/entities:batchUpdate"
|
||||
body: "*"
|
||||
};
|
||||
}
|
||||
|
||||
// Deletes entities in the specified entity type.
|
||||
//
|
||||
// Operation <response: [google.protobuf.Empty][google.protobuf.Empty],
|
||||
// metadata: [google.protobuf.Struct][google.protobuf.Struct]>
|
||||
rpc BatchDeleteEntities(BatchDeleteEntitiesRequest) returns (google.longrunning.Operation) {
|
||||
option (google.api.http) = {
|
||||
post: "/v2beta1/{parent=projects/*/agent/entityTypes/*}/entities:batchDelete"
|
||||
body: "*"
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
// Represents an entity type.
|
||||
// Entity types serve as a tool for extracting parameter values from natural
|
||||
// language queries.
|
||||
message EntityType {
|
||||
// Optional. Represents an entity.
|
||||
message Entity {
|
||||
// Required.
|
||||
// For `KIND_MAP` entity types:
|
||||
// A canonical name to be used in place of synonyms.
|
||||
// For `KIND_LIST` entity types:
|
||||
// A string that can contain references to other entity types (with or
|
||||
// without aliases).
|
||||
string value = 1;
|
||||
|
||||
// Required. A collection of synonyms. For `KIND_LIST` entity types this
|
||||
// must contain exactly one synonym equal to `value`.
|
||||
repeated string synonyms = 2;
|
||||
}
|
||||
|
||||
// Represents kinds of entities.
|
||||
enum Kind {
|
||||
// Not specified. This value should be never used.
|
||||
KIND_UNSPECIFIED = 0;
|
||||
|
||||
// Map entity types allow mapping of a group of synonyms to a canonical
|
||||
// value.
|
||||
KIND_MAP = 1;
|
||||
|
||||
// List entity types contain a set of entries that do not map to canonical
|
||||
// values. However, list entity types can contain references to other entity
|
||||
// types (with or without aliases).
|
||||
KIND_LIST = 2;
|
||||
}
|
||||
|
||||
// Represents different entity type expansion modes. Automated expansion
|
||||
// allows an agent to recognize values that have not been explicitly listed in
|
||||
// the entity (for example, new kinds of shopping list items).
|
||||
enum AutoExpansionMode {
|
||||
// Auto expansion disabled for the entity.
|
||||
AUTO_EXPANSION_MODE_UNSPECIFIED = 0;
|
||||
|
||||
// Allows an agent to recognize values that have not been explicitly
|
||||
// listed in the entity.
|
||||
AUTO_EXPANSION_MODE_DEFAULT = 1;
|
||||
}
|
||||
|
||||
// Required for all methods except `create` (`create` populates the name
|
||||
// automatically.
|
||||
// The unique identifier of the entity type. Format:
|
||||
// `projects/<Project ID>/agent/entityTypes/<Entity Type ID>`.
|
||||
string name = 1;
|
||||
|
||||
// Required. The name of the entity.
|
||||
string display_name = 2;
|
||||
|
||||
// Required. Indicates the kind of entity type.
|
||||
Kind kind = 3;
|
||||
|
||||
// Optional. Indicates whether the entity type can be automatically
|
||||
// expanded.
|
||||
AutoExpansionMode auto_expansion_mode = 4;
|
||||
|
||||
// Optional. The collection of entities associated with the entity type.
|
||||
repeated Entity entities = 6;
|
||||
}
|
||||
|
||||
// The request message for [EntityTypes.ListEntityTypes][google.cloud.dialogflow.v2beta1.EntityTypes.ListEntityTypes].
|
||||
message ListEntityTypesRequest {
|
||||
// Required. The agent to list all entity types from.
|
||||
// Format: `projects/<Project ID>/agent`.
|
||||
string parent = 1;
|
||||
|
||||
// Optional. The language to list entity synonyms for. If not specified,
|
||||
// the agent's default language is used.
|
||||
// [More than a dozen
|
||||
// languages](https://dialogflow.com/docs/reference/language) are supported.
|
||||
// Note: languages must be enabled in the agent, before they can be used.
|
||||
string language_code = 2;
|
||||
|
||||
// Optional. The maximum number of items to return in a single page. By
|
||||
// default 100 and at most 1000.
|
||||
int32 page_size = 3;
|
||||
|
||||
// Optional. The next_page_token value returned from a previous list request.
|
||||
string page_token = 4;
|
||||
}
|
||||
|
||||
// The response message for [EntityTypes.ListEntityTypes][google.cloud.dialogflow.v2beta1.EntityTypes.ListEntityTypes].
|
||||
message ListEntityTypesResponse {
|
||||
// The list of agent entity types. There will be a maximum number of items
|
||||
// returned based on the page_size field in the request.
|
||||
repeated EntityType entity_types = 1;
|
||||
|
||||
// Token to retrieve the next page of results, or empty if there are no
|
||||
// more results in the list.
|
||||
string next_page_token = 2;
|
||||
}
|
||||
|
||||
// The request message for [EntityTypes.GetEntityType][google.cloud.dialogflow.v2beta1.EntityTypes.GetEntityType].
|
||||
message GetEntityTypeRequest {
|
||||
// Required. The name of the entity type.
|
||||
// Format: `projects/<Project ID>/agent/entityTypes/<EntityType ID>`.
|
||||
string name = 1;
|
||||
|
||||
// Optional. The language to retrieve entity synonyms for. If not specified,
|
||||
// the agent's default language is used.
|
||||
// [More than a dozen
|
||||
// languages](https://dialogflow.com/docs/reference/language) are supported.
|
||||
// Note: languages must be enabled in the agent, before they can be used.
|
||||
string language_code = 2;
|
||||
}
|
||||
|
||||
// The request message for [EntityTypes.CreateEntityType][google.cloud.dialogflow.v2beta1.EntityTypes.CreateEntityType].
|
||||
message CreateEntityTypeRequest {
|
||||
// Required. The agent to create a entity type for.
|
||||
// Format: `projects/<Project ID>/agent`.
|
||||
string parent = 1;
|
||||
|
||||
// Required. The entity type to create.
|
||||
EntityType entity_type = 2;
|
||||
|
||||
// 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](https://dialogflow.com/docs/reference/language) are supported.
|
||||
// Note: languages must be enabled in the agent, before they can be used.
|
||||
string language_code = 3;
|
||||
}
|
||||
|
||||
// The request message for [EntityTypes.UpdateEntityType][google.cloud.dialogflow.v2beta1.EntityTypes.UpdateEntityType].
|
||||
message UpdateEntityTypeRequest {
|
||||
// Required. The entity type to update.
|
||||
// Format: `projects/<Project ID>/agent/entityTypes/<EntityType ID>`.
|
||||
EntityType entity_type = 1;
|
||||
|
||||
// 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](https://dialogflow.com/docs/reference/language) are supported.
|
||||
// Note: languages must be enabled in the agent, before they can be used.
|
||||
string language_code = 2;
|
||||
|
||||
// Optional. The mask to control which fields get updated.
|
||||
google.protobuf.FieldMask update_mask = 3;
|
||||
}
|
||||
|
||||
// The request message for [EntityTypes.DeleteEntityType][google.cloud.dialogflow.v2beta1.EntityTypes.DeleteEntityType].
|
||||
message DeleteEntityTypeRequest {
|
||||
// Required. The name of the entity type to delete.
|
||||
// Format: `projects/<Project ID>/agent/entityTypes/<EntityType ID>`.
|
||||
string name = 1;
|
||||
}
|
||||
|
||||
// The request message for [EntityTypes.BatchUpdateEntityTypes][google.cloud.dialogflow.v2beta1.EntityTypes.BatchUpdateEntityTypes].
|
||||
message BatchUpdateEntityTypesRequest {
|
||||
// Required. The name of the agent to update or create entity types in.
|
||||
// Format: `projects/<Project ID>/agent`.
|
||||
string parent = 1;
|
||||
|
||||
// Required. The source of the entity type batch.
|
||||
//
|
||||
// For each entity type in the batch:
|
||||
// * If `name` is specified, we update an existing entity type.
|
||||
// * If `name` is not specified, we create a new entity type.
|
||||
oneof entity_type_batch {
|
||||
// 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://".
|
||||
string entity_type_batch_uri = 2;
|
||||
|
||||
// The collection of entity type to update or create.
|
||||
EntityTypeBatch entity_type_batch_inline = 3;
|
||||
}
|
||||
|
||||
// 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](https://dialogflow.com/docs/reference/language) are supported.
|
||||
// Note: languages must be enabled in the agent, before they can be used.
|
||||
string language_code = 4;
|
||||
|
||||
// Optional. The mask to control which fields get updated.
|
||||
google.protobuf.FieldMask update_mask = 5;
|
||||
}
|
||||
|
||||
// The response message for [EntityTypes.BatchUpdateEntityTypes][google.cloud.dialogflow.v2beta1.EntityTypes.BatchUpdateEntityTypes].
|
||||
message BatchUpdateEntityTypesResponse {
|
||||
// The collection of updated or created entity types.
|
||||
repeated EntityType entity_types = 1;
|
||||
}
|
||||
|
||||
// The request message for [EntityTypes.BatchDeleteEntityTypes][google.cloud.dialogflow.v2beta1.EntityTypes.BatchDeleteEntityTypes].
|
||||
message BatchDeleteEntityTypesRequest {
|
||||
// Required. The name of the agent to delete all entities types for. Format:
|
||||
// `projects/<Project ID>/agent`.
|
||||
string parent = 1;
|
||||
|
||||
// Required. The names entity types to delete. All names must point to the
|
||||
// same agent as `parent`.
|
||||
repeated string entity_type_names = 2;
|
||||
}
|
||||
|
||||
// The request message for [EntityTypes.BatchCreateEntities][google.cloud.dialogflow.v2beta1.EntityTypes.BatchCreateEntities].
|
||||
message BatchCreateEntitiesRequest {
|
||||
// Required. The name of the entity type to create entities in. Format:
|
||||
// `projects/<Project ID>/agent/entityTypes/<Entity Type ID>`.
|
||||
string parent = 1;
|
||||
|
||||
// Required. The collection of entities to create.
|
||||
repeated EntityType.Entity entities = 2;
|
||||
|
||||
// Optional. The language of entity synonyms defined in `entities`. If not
|
||||
// specified, the agent's default language is used.
|
||||
// [More than a dozen
|
||||
// languages](https://dialogflow.com/docs/reference/language) are supported.
|
||||
// Note: languages must be enabled in the agent, before they can be used.
|
||||
string language_code = 3;
|
||||
}
|
||||
|
||||
// The response message for [EntityTypes.BatchCreateEntities][google.cloud.dialogflow.v2beta1.EntityTypes.BatchCreateEntities].
|
||||
message BatchUpdateEntitiesRequest {
|
||||
// Required. The name of the entity type to update the entities in. Format:
|
||||
// `projects/<Project ID>/agent/entityTypes/<Entity Type ID>`.
|
||||
string parent = 1;
|
||||
|
||||
// Required. The collection of new entities to replace the existing entities.
|
||||
repeated EntityType.Entity entities = 2;
|
||||
|
||||
// Optional. The language of entity synonyms defined in `entities`. If not
|
||||
// specified, the agent's default language is used.
|
||||
// [More than a dozen
|
||||
// languages](https://dialogflow.com/docs/reference/language) are supported.
|
||||
// Note: languages must be enabled in the agent, before they can be used.
|
||||
string language_code = 3;
|
||||
|
||||
// Optional. The mask to control which fields get updated.
|
||||
google.protobuf.FieldMask update_mask = 4;
|
||||
}
|
||||
|
||||
// The request message for [EntityTypes.BatchDeleteEntities][google.cloud.dialogflow.v2beta1.EntityTypes.BatchDeleteEntities].
|
||||
message BatchDeleteEntitiesRequest {
|
||||
// Required. The name of the entity type to delete entries for. Format:
|
||||
// `projects/<Project ID>/agent/entityTypes/<Entity Type ID>`.
|
||||
string parent = 1;
|
||||
|
||||
// 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>`.
|
||||
repeated string entity_values = 2;
|
||||
|
||||
// Optional. The language of entity synonyms defined in `entities`. If not
|
||||
// specified, the agent's default language is used.
|
||||
// [More than a dozen
|
||||
// languages](https://dialogflow.com/docs/reference/language) are supported.
|
||||
// Note: languages must be enabled in the agent, before they can be used.
|
||||
string language_code = 3;
|
||||
}
|
||||
|
||||
// This message is a wrapper around a collection of entity types.
|
||||
message EntityTypeBatch {
|
||||
// A collection of entity types.
|
||||
repeated EntityType entity_types = 1;
|
||||
}
|
||||
824
node_modules/dialogflow/protos/google/cloud/dialogflow/v2beta1/intent.proto
generated
vendored
Normal file
824
node_modules/dialogflow/protos/google/cloud/dialogflow/v2beta1/intent.proto
generated
vendored
Normal file
@@ -0,0 +1,824 @@
|
||||
// Copyright 2018 Google Inc.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
syntax = "proto3";
|
||||
|
||||
package google.cloud.dialogflow.v2beta1;
|
||||
|
||||
import "google/api/annotations.proto";
|
||||
import "google/cloud/dialogflow/v2beta1/context.proto";
|
||||
import "google/longrunning/operations.proto";
|
||||
import "google/protobuf/empty.proto";
|
||||
import "google/protobuf/field_mask.proto";
|
||||
import "google/protobuf/struct.proto";
|
||||
|
||||
option cc_enable_arenas = true;
|
||||
option csharp_namespace = "Google.Cloud.Dialogflow.V2beta1";
|
||||
option go_package = "google.golang.org/genproto/googleapis/cloud/dialogflow/v2beta1;dialogflow";
|
||||
option java_multiple_files = true;
|
||||
option java_outer_classname = "IntentProto";
|
||||
option java_package = "com.google.cloud.dialogflow.v2beta1";
|
||||
option objc_class_prefix = "DF";
|
||||
|
||||
|
||||
// An intent represents a mapping between input from a user and an action to
|
||||
// be taken by your application. When you pass user input to the
|
||||
// [DetectIntent][google.cloud.dialogflow.v2beta1.Sessions.DetectIntent] (or
|
||||
// [StreamingDetectIntent][google.cloud.dialogflow.v2beta1.Sessions.StreamingDetectIntent]) method, the
|
||||
// Dialogflow API analyzes the input and searches
|
||||
// for a matching intent. If no match is found, the Dialogflow API returns a
|
||||
// fallback intent (`is_fallback` = true).
|
||||
//
|
||||
// You can provide additional information for the Dialogflow API to use to
|
||||
// match user input to an intent by adding the following to your intent.
|
||||
//
|
||||
// * **Contexts** - provide additional context for intent analysis. For
|
||||
// example, if an intent is related to an object in your application that
|
||||
// plays music, you can provide a context to determine when to match the
|
||||
// intent if the user input is “turn it off”. You can include a context
|
||||
// that matches the intent when there is previous user input of
|
||||
// "play music", and not when there is previous user input of
|
||||
// "turn on the light".
|
||||
//
|
||||
// * **Events** - allow for matching an intent by using an event name
|
||||
// instead of user input. Your application can provide an event name and
|
||||
// related parameters to the Dialogflow API to match an intent. For
|
||||
// example, when your application starts, you can send a welcome event
|
||||
// with a user name parameter to the Dialogflow API to match an intent with
|
||||
// a personalized welcome message for the user.
|
||||
//
|
||||
// * **Training phrases** - provide examples of user input to train the
|
||||
// Dialogflow API agent to better match intents.
|
||||
//
|
||||
// For more information about intents, see the
|
||||
// [Dialogflow documentation](https://dialogflow.com/docs/intents).
|
||||
service Intents {
|
||||
// Returns the list of all intents in the specified agent.
|
||||
rpc ListIntents(ListIntentsRequest) returns (ListIntentsResponse) {
|
||||
option (google.api.http) = {
|
||||
get: "/v2beta1/{parent=projects/*/agent}/intents"
|
||||
};
|
||||
}
|
||||
|
||||
// Retrieves the specified intent.
|
||||
rpc GetIntent(GetIntentRequest) returns (Intent) {
|
||||
option (google.api.http) = {
|
||||
get: "/v2beta1/{name=projects/*/agent/intents/*}"
|
||||
};
|
||||
}
|
||||
|
||||
// Creates an intent in the specified agent.
|
||||
rpc CreateIntent(CreateIntentRequest) returns (Intent) {
|
||||
option (google.api.http) = {
|
||||
post: "/v2beta1/{parent=projects/*/agent}/intents"
|
||||
body: "intent"
|
||||
};
|
||||
}
|
||||
|
||||
// Updates the specified intent.
|
||||
rpc UpdateIntent(UpdateIntentRequest) returns (Intent) {
|
||||
option (google.api.http) = {
|
||||
patch: "/v2beta1/{intent.name=projects/*/agent/intents/*}"
|
||||
body: "intent"
|
||||
};
|
||||
}
|
||||
|
||||
// Deletes the specified intent.
|
||||
rpc DeleteIntent(DeleteIntentRequest) returns (google.protobuf.Empty) {
|
||||
option (google.api.http) = {
|
||||
delete: "/v2beta1/{name=projects/*/agent/intents/*}"
|
||||
};
|
||||
}
|
||||
|
||||
// Updates/Creates multiple intents in the specified agent.
|
||||
//
|
||||
// Operation <response: [BatchUpdateIntentsResponse][google.cloud.dialogflow.v2beta1.BatchUpdateIntentsResponse]>
|
||||
rpc BatchUpdateIntents(BatchUpdateIntentsRequest) returns (google.longrunning.Operation) {
|
||||
option (google.api.http) = {
|
||||
post: "/v2beta1/{parent=projects/*/agent}/intents:batchUpdate"
|
||||
body: "*"
|
||||
};
|
||||
}
|
||||
|
||||
// Deletes intents in the specified agent.
|
||||
//
|
||||
// Operation <response: [google.protobuf.Empty][google.protobuf.Empty]>
|
||||
rpc BatchDeleteIntents(BatchDeleteIntentsRequest) returns (google.longrunning.Operation) {
|
||||
option (google.api.http) = {
|
||||
post: "/v2beta1/{parent=projects/*/agent}/intents:batchDelete"
|
||||
body: "*"
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
// Represents an intent.
|
||||
// Intents convert a number of user expressions or patterns into an action. An
|
||||
// action is an extraction of a user command or sentence semantics.
|
||||
message Intent {
|
||||
// Represents an example or template that the agent is trained on.
|
||||
message TrainingPhrase {
|
||||
// Represents a part of a training phrase.
|
||||
message Part {
|
||||
// Required. The text corresponding to the example or template,
|
||||
// if there are no annotations. For
|
||||
// annotated examples, it is the text for one of the example's parts.
|
||||
string text = 1;
|
||||
|
||||
// Optional. The entity type name prefixed with `@`. This field is
|
||||
// required for the annotated part of the text and applies only to
|
||||
// examples.
|
||||
string entity_type = 2;
|
||||
|
||||
// Optional. The parameter name for the value extracted from the
|
||||
// annotated part of the example.
|
||||
string alias = 3;
|
||||
|
||||
// Optional. Indicates whether the text was manually annotated by the
|
||||
// developer.
|
||||
bool user_defined = 4;
|
||||
}
|
||||
|
||||
// Represents different types of training phrases.
|
||||
enum Type {
|
||||
// Not specified. This value should never be used.
|
||||
TYPE_UNSPECIFIED = 0;
|
||||
|
||||
// Examples do not contain @-prefixed entity type names, but example parts
|
||||
// can be annotated with entity types.
|
||||
EXAMPLE = 1;
|
||||
|
||||
// Templates are not annotated with entity types, but they can contain
|
||||
// @-prefixed entity type names as substrings.
|
||||
TEMPLATE = 2;
|
||||
}
|
||||
|
||||
// Required. The unique identifier of this training phrase.
|
||||
string name = 1;
|
||||
|
||||
// Required. The type of the training phrase.
|
||||
Type type = 2;
|
||||
|
||||
// Required. The collection of training phrase parts (can be annotated).
|
||||
// Fields: `entity_type`, `alias` and `user_defined` should be populated
|
||||
// only for the annotated parts of the training phrase.
|
||||
repeated Part parts = 3;
|
||||
|
||||
// Optional. Indicates how many times this example or template was added to
|
||||
// the intent. Each time a developer adds an existing sample by editing an
|
||||
// intent or training, this counter is increased.
|
||||
int32 times_added_count = 4;
|
||||
}
|
||||
|
||||
// Represents intent parameters.
|
||||
message Parameter {
|
||||
// The unique identifier of this parameter.
|
||||
string name = 1;
|
||||
|
||||
// Required. The name of the parameter.
|
||||
string display_name = 2;
|
||||
|
||||
// Optional. The definition of the parameter value. It can be:
|
||||
// - a constant string,
|
||||
// - a parameter value defined as `$parameter_name`,
|
||||
// - an original parameter value defined as `$parameter_name.original`,
|
||||
// - a parameter value from some context defined as
|
||||
// `#context_name.parameter_name`.
|
||||
string value = 3;
|
||||
|
||||
// Optional. The default value to use when the `value` yields an empty
|
||||
// result.
|
||||
// Default values can be extracted from contexts by using the following
|
||||
// syntax: `#context_name.parameter_name`.
|
||||
string default_value = 4;
|
||||
|
||||
// Optional. The name of the entity type, prefixed with `@`, that
|
||||
// describes values of the parameter. If the parameter is
|
||||
// required, this must be provided.
|
||||
string entity_type_display_name = 5;
|
||||
|
||||
// Optional. Indicates whether the parameter is required. That is,
|
||||
// whether the intent cannot be completed without collecting the parameter
|
||||
// value.
|
||||
bool mandatory = 6;
|
||||
|
||||
// Optional. The collection of prompts that the agent can present to the
|
||||
// user in order to collect value for the parameter.
|
||||
repeated string prompts = 7;
|
||||
|
||||
// Optional. Indicates whether the parameter represents a list of values.
|
||||
bool is_list = 8;
|
||||
}
|
||||
|
||||
// Corresponds to the `Response` field in the Dialogflow console.
|
||||
message Message {
|
||||
// The text response message.
|
||||
message Text {
|
||||
// Optional. The collection of the agent's responses.
|
||||
repeated string text = 1;
|
||||
}
|
||||
|
||||
// The image response message.
|
||||
message Image {
|
||||
// Optional. The public URI to an image file.
|
||||
string image_uri = 1;
|
||||
|
||||
// Optional. A text description of the image to be used for accessibility,
|
||||
// e.g., screen readers.
|
||||
string accessibility_text = 2;
|
||||
}
|
||||
|
||||
// The quick replies response message.
|
||||
message QuickReplies {
|
||||
// Optional. The title of the collection of quick replies.
|
||||
string title = 1;
|
||||
|
||||
// Optional. The collection of quick replies.
|
||||
repeated string quick_replies = 2;
|
||||
}
|
||||
|
||||
// The card response message.
|
||||
message Card {
|
||||
// Optional. Contains information about a button.
|
||||
message Button {
|
||||
// Optional. The text to show on the button.
|
||||
string text = 1;
|
||||
|
||||
// Optional. The text to send back to the Dialogflow API or a URI to
|
||||
// open.
|
||||
string postback = 2;
|
||||
}
|
||||
|
||||
// Optional. The title of the card.
|
||||
string title = 1;
|
||||
|
||||
// Optional. The subtitle of the card.
|
||||
string subtitle = 2;
|
||||
|
||||
// Optional. The public URI to an image file for the card.
|
||||
string image_uri = 3;
|
||||
|
||||
// Optional. The collection of card buttons.
|
||||
repeated Button buttons = 4;
|
||||
}
|
||||
|
||||
// The simple response message containing speech or text.
|
||||
message SimpleResponse {
|
||||
// One of text_to_speech or ssml must be provided. The plain text of the
|
||||
// speech output. Mutually exclusive with ssml.
|
||||
string text_to_speech = 1;
|
||||
|
||||
// One of text_to_speech or ssml must be provided. Structured spoken
|
||||
// response to the user in the SSML format. Mutually exclusive with
|
||||
// text_to_speech.
|
||||
string ssml = 2;
|
||||
|
||||
// Optional. The text to display.
|
||||
string display_text = 3;
|
||||
}
|
||||
|
||||
// The collection of simple response candidates.
|
||||
// This message in `QueryResult.fulfillment_messages` and
|
||||
// `WebhookResponse.fulfillment_messages` should contain only one
|
||||
// `SimpleResponse`.
|
||||
message SimpleResponses {
|
||||
// Required. The list of simple responses.
|
||||
repeated SimpleResponse simple_responses = 1;
|
||||
}
|
||||
|
||||
// The basic card message. Useful for displaying information.
|
||||
message BasicCard {
|
||||
// The button object that appears at the bottom of a card.
|
||||
message Button {
|
||||
// Opens the given URI.
|
||||
message OpenUriAction {
|
||||
// Required. The HTTP or HTTPS scheme URI.
|
||||
string uri = 1;
|
||||
}
|
||||
|
||||
// Required. The title of the button.
|
||||
string title = 1;
|
||||
|
||||
// Required. Action to take when a user taps on the button.
|
||||
OpenUriAction open_uri_action = 2;
|
||||
}
|
||||
|
||||
// Optional. The title of the card.
|
||||
string title = 1;
|
||||
|
||||
// Optional. The subtitle of the card.
|
||||
string subtitle = 2;
|
||||
|
||||
// Required, unless image is present. The body text of the card.
|
||||
string formatted_text = 3;
|
||||
|
||||
// Optional. The image for the card.
|
||||
Image image = 4;
|
||||
|
||||
// Optional. The collection of card buttons.
|
||||
repeated Button buttons = 5;
|
||||
}
|
||||
|
||||
// The suggestion chip message that the user can tap to quickly post a reply
|
||||
// to the conversation.
|
||||
message Suggestion {
|
||||
// Required. The text shown the in the suggestion chip.
|
||||
string title = 1;
|
||||
}
|
||||
|
||||
// The collection of suggestions.
|
||||
message Suggestions {
|
||||
// Required. The list of suggested replies.
|
||||
repeated Suggestion suggestions = 1;
|
||||
}
|
||||
|
||||
// The suggestion chip message that allows the user to jump out to the app
|
||||
// or website associated with this agent.
|
||||
message LinkOutSuggestion {
|
||||
// Required. The name of the app or site this chip is linking to.
|
||||
string destination_name = 1;
|
||||
|
||||
// Required. The URI of the app or site to open when the user taps the
|
||||
// suggestion chip.
|
||||
string uri = 2;
|
||||
}
|
||||
|
||||
// The card for presenting a list of options to select from.
|
||||
message ListSelect {
|
||||
// An item in the list.
|
||||
message Item {
|
||||
// Required. Additional information about this option.
|
||||
SelectItemInfo info = 1;
|
||||
|
||||
// Required. The title of the list item.
|
||||
string title = 2;
|
||||
|
||||
// Optional. The main text describing the item.
|
||||
string description = 3;
|
||||
|
||||
// Optional. The image to display.
|
||||
Image image = 4;
|
||||
}
|
||||
|
||||
// Optional. The overall title of the list.
|
||||
string title = 1;
|
||||
|
||||
// Required. List items.
|
||||
repeated Item items = 2;
|
||||
}
|
||||
|
||||
// The card for presenting a carousel of options to select from.
|
||||
message CarouselSelect {
|
||||
// An item in the carousel.
|
||||
message Item {
|
||||
// Required. Additional info about the option item.
|
||||
SelectItemInfo info = 1;
|
||||
|
||||
// Required. Title of the carousel item.
|
||||
string title = 2;
|
||||
|
||||
// Optional. The body text of the card.
|
||||
string description = 3;
|
||||
|
||||
// Optional. The image to display.
|
||||
Image image = 4;
|
||||
}
|
||||
|
||||
// Required. Carousel items.
|
||||
repeated Item items = 1;
|
||||
}
|
||||
|
||||
// Additional info about the select item for when it is triggered in a
|
||||
// dialog.
|
||||
message SelectItemInfo {
|
||||
// Required. A unique key that will be sent back to the agent if this
|
||||
// response is given.
|
||||
string key = 1;
|
||||
|
||||
// Optional. A list of synonyms that can also be used to trigger this
|
||||
// item in dialog.
|
||||
repeated string synonyms = 2;
|
||||
}
|
||||
|
||||
// Represents different platforms that a rich message can be intended for.
|
||||
enum Platform {
|
||||
// Not specified.
|
||||
PLATFORM_UNSPECIFIED = 0;
|
||||
|
||||
// Facebook.
|
||||
FACEBOOK = 1;
|
||||
|
||||
// Slack.
|
||||
SLACK = 2;
|
||||
|
||||
// Telegram.
|
||||
TELEGRAM = 3;
|
||||
|
||||
// Kik.
|
||||
KIK = 4;
|
||||
|
||||
// Skype.
|
||||
SKYPE = 5;
|
||||
|
||||
// Line.
|
||||
LINE = 6;
|
||||
|
||||
// Viber.
|
||||
VIBER = 7;
|
||||
|
||||
// Actions on Google.
|
||||
// When using Actions on Google, you can choose one of the specific
|
||||
// Intent.Message types that mention support for Actions on Google,
|
||||
// or you can use the advanced Intent.Message.payload field.
|
||||
// The payload field provides access to AoG features not available in the
|
||||
// specific message types.
|
||||
// If using the Intent.Message.payload field, it should have a structure
|
||||
// similar to the JSON message shown here. For more information, see
|
||||
// [Actions on Google Webhook
|
||||
// Format](https://developers.google.com/actions/dialogflow/webhook)
|
||||
// <pre>{
|
||||
// "expectUserResponse": true,
|
||||
// "isSsml": false,
|
||||
// "noInputPrompts": [],
|
||||
// "richResponse": {
|
||||
// "items": [
|
||||
// {
|
||||
// "simpleResponse": {
|
||||
// "displayText": "hi",
|
||||
// "textToSpeech": "hello"
|
||||
// }
|
||||
// }
|
||||
// ],
|
||||
// "suggestions": [
|
||||
// {
|
||||
// "title": "Say this"
|
||||
// },
|
||||
// {
|
||||
// "title": "or this"
|
||||
// }
|
||||
// ]
|
||||
// },
|
||||
// "systemIntent": {
|
||||
// "data": {
|
||||
// "@type": "type.googleapis.com/google.actions.v2.OptionValueSpec",
|
||||
// "listSelect": {
|
||||
// "items": [
|
||||
// {
|
||||
// "optionInfo": {
|
||||
// "key": "key1",
|
||||
// "synonyms": [
|
||||
// "key one"
|
||||
// ]
|
||||
// },
|
||||
// "title": "must not be empty, but unique"
|
||||
// },
|
||||
// {
|
||||
// "optionInfo": {
|
||||
// "key": "key2",
|
||||
// "synonyms": [
|
||||
// "key two"
|
||||
// ]
|
||||
// },
|
||||
// "title": "must not be empty, but unique"
|
||||
// }
|
||||
// ]
|
||||
// }
|
||||
// },
|
||||
// "intent": "actions.intent.OPTION"
|
||||
// }
|
||||
// }</pre>
|
||||
ACTIONS_ON_GOOGLE = 8;
|
||||
}
|
||||
|
||||
// Required. The rich response message.
|
||||
oneof message {
|
||||
// Returns a text response.
|
||||
Text text = 1;
|
||||
|
||||
// Displays an image.
|
||||
Image image = 2;
|
||||
|
||||
// Displays quick replies.
|
||||
QuickReplies quick_replies = 3;
|
||||
|
||||
// Displays a card.
|
||||
Card card = 4;
|
||||
|
||||
// Returns a response containing a custom, platform-specific payload.
|
||||
// See the Intent.Message.Platform type for a description of the
|
||||
// structure that may be required for your platform.
|
||||
google.protobuf.Struct payload = 5;
|
||||
|
||||
// Returns a voice or text-only response for Actions on Google.
|
||||
SimpleResponses simple_responses = 7;
|
||||
|
||||
// Displays a basic card for Actions on Google.
|
||||
BasicCard basic_card = 8;
|
||||
|
||||
// Displays suggestion chips for Actions on Google.
|
||||
Suggestions suggestions = 9;
|
||||
|
||||
// Displays a link out suggestion chip for Actions on Google.
|
||||
LinkOutSuggestion link_out_suggestion = 10;
|
||||
|
||||
// Displays a list card for Actions on Google.
|
||||
ListSelect list_select = 11;
|
||||
|
||||
// Displays a carousel card for Actions on Google.
|
||||
CarouselSelect carousel_select = 12;
|
||||
}
|
||||
|
||||
// Optional. The platform that this message is intended for.
|
||||
Platform platform = 6;
|
||||
}
|
||||
|
||||
// Represents a single followup intent in the chain.
|
||||
message FollowupIntentInfo {
|
||||
// The unique identifier of the followup intent.
|
||||
// Format: `projects/<Project ID>/agent/intents/<Intent ID>`.
|
||||
string followup_intent_name = 1;
|
||||
|
||||
// The unique identifier of the followup intent parent.
|
||||
// Format: `projects/<Project ID>/agent/intents/<Intent ID>`.
|
||||
string parent_followup_intent_name = 2;
|
||||
}
|
||||
|
||||
// Represents the different states that webhooks can be in.
|
||||
enum WebhookState {
|
||||
// Webhook is disabled in the agent and in the intent.
|
||||
WEBHOOK_STATE_UNSPECIFIED = 0;
|
||||
|
||||
// Webhook is enabled in the agent and in the intent.
|
||||
WEBHOOK_STATE_ENABLED = 1;
|
||||
|
||||
// Webhook is enabled in the agent and in the intent. Also, each slot
|
||||
// filling prompt is forwarded to the webhook.
|
||||
WEBHOOK_STATE_ENABLED_FOR_SLOT_FILLING = 2;
|
||||
}
|
||||
|
||||
// Required for all methods except `create` (`create` populates the name
|
||||
// automatically.
|
||||
// The unique identifier of this intent.
|
||||
// Format: `projects/<Project ID>/agent/intents/<Intent ID>`.
|
||||
string name = 1;
|
||||
|
||||
// Required. The name of this intent.
|
||||
string display_name = 2;
|
||||
|
||||
// Required. Indicates whether webhooks are enabled for the intent.
|
||||
WebhookState webhook_state = 6;
|
||||
|
||||
// Optional. The priority of this intent. Higher numbers represent higher
|
||||
// priorities. Zero or negative numbers mean that the intent is disabled.
|
||||
int32 priority = 3;
|
||||
|
||||
// Optional. Indicates whether this is a fallback intent.
|
||||
bool is_fallback = 4;
|
||||
|
||||
// Optional. Indicates whether Machine Learning is enabled for the intent.
|
||||
// Note: If `ml_enabled` setting is set to false, then this intent is not
|
||||
// taken into account during inference in `ML ONLY` match mode. Also,
|
||||
// auto-markup in the UI is turned off.
|
||||
// DEPRECATED! Please use `ml_disabled` field instead.
|
||||
// NOTE: If neither `ml_enabled` nor `ml_disabled` field is set, then the
|
||||
// default value is determined as follows:
|
||||
// - Before April 15th, 2018 the default is:
|
||||
// ml_enabled = false / ml_disabled = true.
|
||||
// - After April 15th, 2018 the default is:
|
||||
// ml_enabled = true / ml_disabled = false.
|
||||
bool ml_enabled = 5;
|
||||
|
||||
// Optional. Indicates whether Machine Learning is disabled for the intent.
|
||||
// Note: If `ml_disabled` setting is set to true, then this intent is not
|
||||
// taken into account during inference in `ML ONLY` match mode. Also,
|
||||
// auto-markup in the UI is turned off.
|
||||
bool ml_disabled = 19;
|
||||
|
||||
// Optional. The list of context names required for this intent to be
|
||||
// triggered.
|
||||
// Format: `projects/<Project ID>/agent/sessions/-/contexts/<Context ID>`.
|
||||
repeated string input_context_names = 7;
|
||||
|
||||
// Optional. The collection of event names that trigger the intent.
|
||||
// If the collection of input contexts is not empty, all of the contexts must
|
||||
// be present in the active user session for an event to trigger this intent.
|
||||
repeated string events = 8;
|
||||
|
||||
// Optional. The collection of examples/templates that the agent is
|
||||
// trained on.
|
||||
repeated TrainingPhrase training_phrases = 9;
|
||||
|
||||
// Optional. The name of the action associated with the intent.
|
||||
string action = 10;
|
||||
|
||||
// Optional. The collection of contexts that are activated when the intent
|
||||
// is matched. Context messages in this collection should not set the
|
||||
// parameters field. Setting the `lifespan_count` to 0 will reset the context
|
||||
// when the intent is matched.
|
||||
// Format: `projects/<Project ID>/agent/sessions/-/contexts/<Context ID>`.
|
||||
repeated Context output_contexts = 11;
|
||||
|
||||
// Optional. Indicates whether to delete all contexts in the current
|
||||
// session when this intent is matched.
|
||||
bool reset_contexts = 12;
|
||||
|
||||
// Optional. The collection of parameters associated with the intent.
|
||||
repeated Parameter parameters = 13;
|
||||
|
||||
// Optional. The collection of rich messages corresponding to the
|
||||
// `Response` field in the Dialogflow console.
|
||||
repeated Message messages = 14;
|
||||
|
||||
// Optional. The list of platforms for which the first response will be
|
||||
// taken from among the messages assigned to the DEFAULT_PLATFORM.
|
||||
repeated Message.Platform default_response_platforms = 15;
|
||||
|
||||
// The unique identifier of the root intent in the chain of followup intents.
|
||||
// It identifies the correct followup intents chain for this intent.
|
||||
// Format: `projects/<Project ID>/agent/intents/<Intent ID>`.
|
||||
string root_followup_intent_name = 16;
|
||||
|
||||
// The unique identifier of the parent intent in the chain of followup
|
||||
// intents.
|
||||
// It identifies the parent followup intent.
|
||||
// Format: `projects/<Project ID>/agent/intents/<Intent ID>`.
|
||||
string parent_followup_intent_name = 17;
|
||||
|
||||
// Optional. Collection of information about all followup intents that have
|
||||
// name of this intent as a root_name.
|
||||
repeated FollowupIntentInfo followup_intent_info = 18;
|
||||
}
|
||||
|
||||
// The request message for [Intents.ListIntents][google.cloud.dialogflow.v2beta1.Intents.ListIntents].
|
||||
message ListIntentsRequest {
|
||||
// Required. The agent to list all intents from.
|
||||
// Format: `projects/<Project ID>/agent`.
|
||||
string parent = 1;
|
||||
|
||||
// Optional. The language to list training phrases, parameters and rich
|
||||
// messages for. If not specified, the agent's default language is used.
|
||||
// [More than a dozen
|
||||
// languages](https://dialogflow.com/docs/reference/language) are supported.
|
||||
// Note: languages must be enabled in the agent before they can be used.
|
||||
string language_code = 2;
|
||||
|
||||
// Optional. The resource view to apply to the returned intent.
|
||||
IntentView intent_view = 3;
|
||||
|
||||
// Optional. The maximum number of items to return in a single page. By
|
||||
// default 100 and at most 1000.
|
||||
int32 page_size = 4;
|
||||
|
||||
// Optional. The next_page_token value returned from a previous list request.
|
||||
string page_token = 5;
|
||||
}
|
||||
|
||||
// The response message for [Intents.ListIntents][google.cloud.dialogflow.v2beta1.Intents.ListIntents].
|
||||
message ListIntentsResponse {
|
||||
// The list of agent intents. There will be a maximum number of items
|
||||
// returned based on the page_size field in the request.
|
||||
repeated Intent intents = 1;
|
||||
|
||||
// Token to retrieve the next page of results, or empty if there are no
|
||||
// more results in the list.
|
||||
string next_page_token = 2;
|
||||
}
|
||||
|
||||
// The request message for [Intents.GetIntent][google.cloud.dialogflow.v2beta1.Intents.GetIntent].
|
||||
message GetIntentRequest {
|
||||
// Required. The name of the intent.
|
||||
// Format: `projects/<Project ID>/agent/intents/<Intent ID>`.
|
||||
string name = 1;
|
||||
|
||||
// Optional. The language to retrieve training phrases, parameters and rich
|
||||
// messages for. If not specified, the agent's default language is used.
|
||||
// [More than a dozen
|
||||
// languages](https://dialogflow.com/docs/reference/language) are supported.
|
||||
// Note: languages must be enabled in the agent, before they can be used.
|
||||
string language_code = 2;
|
||||
|
||||
// Optional. The resource view to apply to the returned intent.
|
||||
IntentView intent_view = 3;
|
||||
}
|
||||
|
||||
// The request message for [Intents.CreateIntent][google.cloud.dialogflow.v2beta1.Intents.CreateIntent].
|
||||
message CreateIntentRequest {
|
||||
// Required. The agent to create a intent for.
|
||||
// Format: `projects/<Project ID>/agent`.
|
||||
string parent = 1;
|
||||
|
||||
// Required. The intent to create.
|
||||
Intent intent = 2;
|
||||
|
||||
// Optional. The language of training phrases, parameters and rich messages
|
||||
// defined in `intent`. If not specified, the agent's default language is
|
||||
// used. [More than a dozen
|
||||
// languages](https://dialogflow.com/docs/reference/language) are supported.
|
||||
// Note: languages must be enabled in the agent, before they can be used.
|
||||
string language_code = 3;
|
||||
|
||||
// Optional. The resource view to apply to the returned intent.
|
||||
IntentView intent_view = 4;
|
||||
}
|
||||
|
||||
// The request message for [Intents.UpdateIntent][google.cloud.dialogflow.v2beta1.Intents.UpdateIntent].
|
||||
message UpdateIntentRequest {
|
||||
// Required. The intent to update.
|
||||
// Format: `projects/<Project ID>/agent/intents/<Intent ID>`.
|
||||
Intent intent = 1;
|
||||
|
||||
// Optional. The language of training phrases, parameters and rich messages
|
||||
// defined in `intent`. If not specified, the agent's default language is
|
||||
// used. [More than a dozen
|
||||
// languages](https://dialogflow.com/docs/reference/language) are supported.
|
||||
// Note: languages must be enabled in the agent, before they can be used.
|
||||
string language_code = 2;
|
||||
|
||||
// Optional. The mask to control which fields get updated.
|
||||
google.protobuf.FieldMask update_mask = 3;
|
||||
|
||||
// Optional. The resource view to apply to the returned intent.
|
||||
IntentView intent_view = 4;
|
||||
}
|
||||
|
||||
// The request message for [Intents.DeleteIntent][google.cloud.dialogflow.v2beta1.Intents.DeleteIntent].
|
||||
message DeleteIntentRequest {
|
||||
// Required. The name of the intent to delete.
|
||||
// Format: `projects/<Project ID>/agent/intents/<Intent ID>`.
|
||||
string name = 1;
|
||||
}
|
||||
|
||||
// The request message for [Intents.BatchUpdateIntents][google.cloud.dialogflow.v2beta1.Intents.BatchUpdateIntents].
|
||||
message BatchUpdateIntentsRequest {
|
||||
// Required. The name of the agent to update or create intents in.
|
||||
// Format: `projects/<Project ID>/agent`.
|
||||
string parent = 1;
|
||||
|
||||
// Required. The source of the intent batch.
|
||||
oneof intent_batch {
|
||||
// The URI to a Google Cloud Storage file containing intents to update or
|
||||
// create. The file format can either be a serialized proto (of IntentBatch
|
||||
// type) or JSON object. Note: The URI must start with "gs://".
|
||||
string intent_batch_uri = 2;
|
||||
|
||||
// The collection of intents to update or create.
|
||||
IntentBatch intent_batch_inline = 3;
|
||||
}
|
||||
|
||||
// Optional. The language of training phrases, parameters and rich messages
|
||||
// defined in `intents`. If not specified, the agent's default language is
|
||||
// used. [More than a dozen
|
||||
// languages](https://dialogflow.com/docs/reference/language) are supported.
|
||||
// Note: languages must be enabled in the agent, before they can be used.
|
||||
string language_code = 4;
|
||||
|
||||
// Optional. The mask to control which fields get updated.
|
||||
google.protobuf.FieldMask update_mask = 5;
|
||||
|
||||
// Optional. The resource view to apply to the returned intent.
|
||||
IntentView intent_view = 6;
|
||||
}
|
||||
|
||||
// The response message for [Intents.BatchUpdateIntents][google.cloud.dialogflow.v2beta1.Intents.BatchUpdateIntents].
|
||||
message BatchUpdateIntentsResponse {
|
||||
// The collection of updated or created intents.
|
||||
repeated Intent intents = 1;
|
||||
}
|
||||
|
||||
// The request message for [Intents.BatchDeleteIntents][google.cloud.dialogflow.v2beta1.Intents.BatchDeleteIntents].
|
||||
message BatchDeleteIntentsRequest {
|
||||
// Required. The name of the agent to delete all entities types for. Format:
|
||||
// `projects/<Project ID>/agent`.
|
||||
string parent = 1;
|
||||
|
||||
// Required. The collection of intents to delete. Only intent `name` must be
|
||||
// filled in.
|
||||
repeated Intent intents = 2;
|
||||
}
|
||||
|
||||
// This message is a wrapper around a collection of intents.
|
||||
message IntentBatch {
|
||||
// A collection of intents.
|
||||
repeated Intent intents = 1;
|
||||
}
|
||||
|
||||
// Represents the options for views of an intent.
|
||||
// An intent can be a sizable object. Therefore, we provide a resource view that
|
||||
// does not return training phrases in the response by default.
|
||||
enum IntentView {
|
||||
// Training phrases field is not populated in the response.
|
||||
INTENT_VIEW_UNSPECIFIED = 0;
|
||||
|
||||
// All fields are populated.
|
||||
INTENT_VIEW_FULL = 1;
|
||||
}
|
||||
492
node_modules/dialogflow/protos/google/cloud/dialogflow/v2beta1/session.proto
generated
vendored
Normal file
492
node_modules/dialogflow/protos/google/cloud/dialogflow/v2beta1/session.proto
generated
vendored
Normal file
@@ -0,0 +1,492 @@
|
||||
// Copyright 2018 Google Inc.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
syntax = "proto3";
|
||||
|
||||
package google.cloud.dialogflow.v2beta1;
|
||||
|
||||
import "google/api/annotations.proto";
|
||||
import "google/cloud/dialogflow/v2beta1/context.proto";
|
||||
import "google/cloud/dialogflow/v2beta1/intent.proto";
|
||||
import "google/cloud/dialogflow/v2beta1/session_entity_type.proto";
|
||||
import "google/protobuf/struct.proto";
|
||||
import "google/rpc/status.proto";
|
||||
import "google/type/latlng.proto";
|
||||
|
||||
option cc_enable_arenas = true;
|
||||
option csharp_namespace = "Google.Cloud.Dialogflow.V2beta1";
|
||||
option go_package = "google.golang.org/genproto/googleapis/cloud/dialogflow/v2beta1;dialogflow";
|
||||
option java_multiple_files = true;
|
||||
option java_outer_classname = "SessionProto";
|
||||
option java_package = "com.google.cloud.dialogflow.v2beta1";
|
||||
option objc_class_prefix = "DF";
|
||||
|
||||
|
||||
// A session represents an interaction with a user. You retrieve user input
|
||||
// and pass it to the [DetectIntent][google.cloud.dialogflow.v2beta1.Sessions.DetectIntent] (or
|
||||
// [StreamingDetectIntent][google.cloud.dialogflow.v2beta1.Sessions.StreamingDetectIntent]) method to determine
|
||||
// user intent and respond.
|
||||
service Sessions {
|
||||
// Processes a natural language query and returns structured, actionable data
|
||||
// as a result. This method is not idempotent, because it may cause contexts
|
||||
// and session entity types to be updated, which in turn might affect
|
||||
// results of future queries.
|
||||
rpc DetectIntent(DetectIntentRequest) returns (DetectIntentResponse) {
|
||||
option (google.api.http) = {
|
||||
post: "/v2beta1/{session=projects/*/agent/sessions/*}:detectIntent"
|
||||
body: "*"
|
||||
additional_bindings {
|
||||
post: "/v2beta1/{session=projects/*/agent/environments/*/users/*/sessions/*}:detectIntent"
|
||||
body: "*"
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
// Processes a natural language query in audio format in a streaming fashion
|
||||
// and returns structured, actionable data as a result. This method is only
|
||||
// available via the gRPC API (not REST).
|
||||
rpc StreamingDetectIntent(stream StreamingDetectIntentRequest) returns (stream StreamingDetectIntentResponse);
|
||||
}
|
||||
|
||||
// The request to detect user's intent.
|
||||
message DetectIntentRequest {
|
||||
// Required. The name of the session this query is sent to. Format:
|
||||
// `projects/<Project ID>/agent/sessions/<Session ID>`, or
|
||||
// `projects/<Project ID>/agent/environments/<Environment ID>/users/<User
|
||||
// ID>/sessions/<Session ID>`. Note: Environments and users are under
|
||||
// construction and will be available soon. If <Environment ID> is not
|
||||
// specified, we assume default 'draft' environment. If <User ID> is not
|
||||
// specified, we are using "-". It’s up to the API caller to choose an
|
||||
// appropriate <Session ID>. and <User Id>. They can be a random numbers or
|
||||
// some type of user and session identifiers (preferably hashed). The length
|
||||
// of the <Session ID> and <User ID> must not exceed 36 characters.
|
||||
string session = 1;
|
||||
|
||||
// Optional. The parameters of this query.
|
||||
QueryParameters query_params = 2;
|
||||
|
||||
// Required. The input specification. It can be set to:
|
||||
//
|
||||
// 1. an audio config
|
||||
// which instructs the speech recognizer how to process the speech audio,
|
||||
//
|
||||
// 2. a conversational query in the form of text, or
|
||||
//
|
||||
// 3. an event that specifies which intent to trigger.
|
||||
QueryInput query_input = 3;
|
||||
|
||||
// Optional. The natural language speech audio to be processed. This field
|
||||
// should be populated iff `query_input` is set to an input audio config.
|
||||
// A single request can contain up to 1 minute of speech audio data.
|
||||
bytes input_audio = 5;
|
||||
}
|
||||
|
||||
// The message returned from the DetectIntent method.
|
||||
message DetectIntentResponse {
|
||||
// The unique identifier of the response. It can be used to
|
||||
// locate a response in the training example set or for reporting issues.
|
||||
string response_id = 1;
|
||||
|
||||
// The results of the conversational query or event processing.
|
||||
QueryResult query_result = 2;
|
||||
|
||||
// Specifies the status of the webhook request. `webhook_status`
|
||||
// is never populated in webhook requests.
|
||||
google.rpc.Status webhook_status = 3;
|
||||
}
|
||||
|
||||
// Represents the parameters of the conversational query.
|
||||
message QueryParameters {
|
||||
// Optional. The time zone of this conversational query from the
|
||||
// [time zone database](https://www.iana.org/time-zones), e.g.,
|
||||
// America/New_York, Europe/Paris. If not provided, the time zone specified in
|
||||
// agent settings is used.
|
||||
string time_zone = 1;
|
||||
|
||||
// Optional. The geo location of this conversational query.
|
||||
google.type.LatLng geo_location = 2;
|
||||
|
||||
// Optional. The collection of contexts to be activated before this query is
|
||||
// executed.
|
||||
repeated Context contexts = 3;
|
||||
|
||||
// Optional. Specifies whether to delete all contexts in the current session
|
||||
// before the new ones are activated.
|
||||
bool reset_contexts = 4;
|
||||
|
||||
// Optional. The collection of session entity types to replace or extend
|
||||
// developer entities with for this query only. The entity synonyms apply
|
||||
// to all languages.
|
||||
repeated SessionEntityType session_entity_types = 5;
|
||||
|
||||
// Optional. This field can be used to pass custom data into the webhook
|
||||
// associated with the agent. Arbitrary JSON objects are supported.
|
||||
google.protobuf.Struct payload = 6;
|
||||
}
|
||||
|
||||
// Represents the query input. It can contain either:
|
||||
//
|
||||
// 1. An audio config which
|
||||
// instructs the speech recognizer how to process the speech audio.
|
||||
//
|
||||
// 2. A conversational query in the form of text,.
|
||||
//
|
||||
// 3. An event that specifies which intent to trigger.
|
||||
message QueryInput {
|
||||
// Required. The input specification.
|
||||
oneof input {
|
||||
// Instructs the speech recognizer how to process the speech audio.
|
||||
InputAudioConfig audio_config = 1;
|
||||
|
||||
// The natural language text to be processed.
|
||||
TextInput text = 2;
|
||||
|
||||
// The event to be processed.
|
||||
EventInput event = 3;
|
||||
}
|
||||
}
|
||||
|
||||
// Represents the result of conversational query or event processing.
|
||||
message QueryResult {
|
||||
// The original conversational query text:
|
||||
// - If natural language text was provided as input, `query_text` contains
|
||||
// a copy of the input.
|
||||
// - If natural language speech audio was provided as input, `query_text`
|
||||
// contains the speech recognition result. If speech recognizer produced
|
||||
// multiple alternatives, a particular one is picked.
|
||||
// - If an event was provided as input, `query_text` is not set.
|
||||
string query_text = 1;
|
||||
|
||||
// The language that was triggered during intent detection.
|
||||
// See [Language Support](https://dialogflow.com/docs/reference/language)
|
||||
// for a list of the currently supported language codes.
|
||||
string language_code = 15;
|
||||
|
||||
// The Speech recognition confidence between 0.0 and 1.0. A higher number
|
||||
// indicates an estimated greater likelihood that the recognized words are
|
||||
// correct. The default of 0.0 is a sentinel value indicating that confidence
|
||||
// was not set.
|
||||
//
|
||||
// You should not rely on this field as it isn't guaranteed to be accurate, or
|
||||
// even set. In particular this field isn't set in Webhook calls and for
|
||||
// StreamingDetectIntent since the streaming endpoint has separate confidence
|
||||
// estimates per portion of the audio in StreamingRecognitionResult.
|
||||
float speech_recognition_confidence = 2;
|
||||
|
||||
// The action name from the matched intent.
|
||||
string action = 3;
|
||||
|
||||
// The collection of extracted parameters.
|
||||
google.protobuf.Struct parameters = 4;
|
||||
|
||||
// This field is set to:
|
||||
// - `false` if the matched intent has required parameters and not all of
|
||||
// the required parameter values have been collected.
|
||||
// - `true` if all required parameter values have been collected, or if the
|
||||
// matched intent doesn't contain any required parameters.
|
||||
bool all_required_params_present = 5;
|
||||
|
||||
// The text to be pronounced to the user or shown on the screen.
|
||||
string fulfillment_text = 6;
|
||||
|
||||
// The collection of rich messages to present to the user.
|
||||
repeated Intent.Message fulfillment_messages = 7;
|
||||
|
||||
// If the query was fulfilled by a webhook call, this field is set to the
|
||||
// value of the `source` field returned in the webhook response.
|
||||
string webhook_source = 8;
|
||||
|
||||
// If the query was fulfilled by a webhook call, this field is set to the
|
||||
// value of the `payload` field returned in the webhook response.
|
||||
google.protobuf.Struct webhook_payload = 9;
|
||||
|
||||
// The collection of output contexts. If applicable,
|
||||
// `output_contexts.parameters` contains entries with name
|
||||
// `<parameter name>.original` containing the original parameter values
|
||||
// before the query.
|
||||
repeated Context output_contexts = 10;
|
||||
|
||||
// The intent that matched the conversational query. Some, not
|
||||
// all fields are filled in this message, including but not limited to:
|
||||
// `name`, `display_name` and `webhook_state`.
|
||||
Intent intent = 11;
|
||||
|
||||
// The intent detection confidence. Values range from 0.0
|
||||
// (completely uncertain) to 1.0 (completely certain).
|
||||
float intent_detection_confidence = 12;
|
||||
|
||||
// The free-form diagnostic info. For example, this field
|
||||
// could contain webhook call latency.
|
||||
google.protobuf.Struct diagnostic_info = 14;
|
||||
}
|
||||
|
||||
// The top-level message sent by the client to the
|
||||
// `StreamingDetectIntent` method.
|
||||
//
|
||||
// Multiple request messages should be sent in order:
|
||||
//
|
||||
// 1. The first message must contain `session`, `query_input` plus optionally
|
||||
// `query_params` and/or `single_utterance`. The message must not contain `input_audio`.
|
||||
//
|
||||
// 2. If `query_input` was set to a streaming input audio config,
|
||||
// all subsequent messages must contain only `input_audio`.
|
||||
// Otherwise, finish the request stream.
|
||||
message StreamingDetectIntentRequest {
|
||||
// Required. The name of the session the query is sent to.
|
||||
// Format of the session name:
|
||||
// `projects/<Project ID>/agent/sessions/<Session ID>`, or
|
||||
// `projects/<Project ID>/agent/environments/<Environment ID>/users/<User
|
||||
// ID>/sessions/<Session ID>`. Note: Environments and users are under
|
||||
// construction and will be available soon. If <Environment ID> is not
|
||||
// specified, we assume default 'draft' environment. If <User ID> is not
|
||||
// specified, we are using "-". It’s up to the API caller to choose an
|
||||
// appropriate <Session ID>. and <User Id>. They can be a random numbers or
|
||||
// some type of user and session identifiers (preferably hashed). The length
|
||||
// of the <Session ID> and <User ID> must not exceed 36 characters.
|
||||
string session = 1;
|
||||
|
||||
// Optional. The parameters of this query.
|
||||
QueryParameters query_params = 2;
|
||||
|
||||
// Required. The input specification. It can be set to:
|
||||
//
|
||||
// 1. an audio config which instructs the speech recognizer how to process
|
||||
// the speech audio,
|
||||
//
|
||||
// 2. a conversational query in the form of text, or
|
||||
//
|
||||
// 3. an event that specifies which intent to trigger.
|
||||
QueryInput query_input = 3;
|
||||
|
||||
// Optional. If `false` (default), recognition does not cease until the
|
||||
// client closes the stream.
|
||||
// If `true`, the recognizer will detect a single spoken utterance in input
|
||||
// audio. Recognition ceases when it detects the audio's voice has
|
||||
// stopped or paused. In this case, once a detected intent is received, the
|
||||
// client should close the stream and start a new request with a new stream as
|
||||
// needed.
|
||||
// This setting is ignored when `query_input` is a piece of text or an event.
|
||||
bool single_utterance = 4;
|
||||
|
||||
// Optional. The input audio content to be recognized. Must be sent if
|
||||
// `query_input` was set to a streaming input audio config. The complete audio
|
||||
// over all streaming messages must not exceed 1 minute.
|
||||
bytes input_audio = 6;
|
||||
}
|
||||
|
||||
// The top-level message returned from the
|
||||
// `StreamingDetectIntent` method.
|
||||
//
|
||||
// Multiple response messages can be returned in order:
|
||||
//
|
||||
// 1. If the input was set to streaming audio, the first one or more messages
|
||||
// contain `recognition_result`. Each `recognition_result` represents a more
|
||||
// complete transcript of what the user said. The last `recognition_result`
|
||||
// has `is_final` set to `true`.
|
||||
//
|
||||
// 2. The next message contains `response_id`, `query_result`
|
||||
// and optionally `webhook_status` if a WebHook was called.
|
||||
message StreamingDetectIntentResponse {
|
||||
// The unique identifier of the response. It can be used to
|
||||
// locate a response in the training example set or for reporting issues.
|
||||
string response_id = 1;
|
||||
|
||||
// The result of speech recognition.
|
||||
StreamingRecognitionResult recognition_result = 2;
|
||||
|
||||
// The result of the conversational query or event processing.
|
||||
QueryResult query_result = 3;
|
||||
|
||||
// Specifies the status of the webhook request.
|
||||
google.rpc.Status webhook_status = 4;
|
||||
}
|
||||
|
||||
// Contains a speech recognition result corresponding to a portion of the audio
|
||||
// that is currently being processed or an indication that this is the end
|
||||
// of the single requested utterance.
|
||||
//
|
||||
// Example:
|
||||
//
|
||||
// 1. transcript: "tube"
|
||||
//
|
||||
// 2. transcript: "to be a"
|
||||
//
|
||||
// 3. transcript: "to be"
|
||||
//
|
||||
// 4. transcript: "to be or not to be"
|
||||
// is_final: true
|
||||
//
|
||||
// 5. transcript: " that's"
|
||||
//
|
||||
// 6. transcript: " that is"
|
||||
//
|
||||
// 7. recognition_event_type: `RECOGNITION_EVENT_END_OF_SINGLE_UTTERANCE`
|
||||
//
|
||||
// 8. transcript: " that is the question"
|
||||
// is_final: true
|
||||
//
|
||||
// Only two of the responses contain final results (#4 and #8 indicated by
|
||||
// `is_final: true`). Concatenating these generates the full transcript: "to be
|
||||
// or not to be that is the question".
|
||||
//
|
||||
// In each response we populate:
|
||||
//
|
||||
// * for `MESSAGE_TYPE_TRANSCRIPT`: `transcript` and possibly `is_final`.
|
||||
//
|
||||
// * for `MESSAGE_TYPE_END_OF_SINGLE_UTTERANCE`: only `event_type`.
|
||||
message StreamingRecognitionResult {
|
||||
// Type of the response message.
|
||||
enum MessageType {
|
||||
// Not specified. Should never be used.
|
||||
MESSAGE_TYPE_UNSPECIFIED = 0;
|
||||
|
||||
// Message contains a (possibly partial) transcript.
|
||||
TRANSCRIPT = 1;
|
||||
|
||||
// Event indicates that the server has detected the end of the user's speech
|
||||
// utterance and expects no additional speech. Therefore, the server will
|
||||
// not process additional audio (although it may subsequently return
|
||||
// additional results). The client should stop sending additional audio
|
||||
// data, half-close the gRPC connection, and wait for any additional results
|
||||
// until the server closes the gRPC connection. This message is only sent if
|
||||
// `single_utterance` was set to `true`, and is not used otherwise.
|
||||
END_OF_SINGLE_UTTERANCE = 2;
|
||||
}
|
||||
|
||||
// Type of the result message.
|
||||
MessageType message_type = 1;
|
||||
|
||||
// Transcript text representing the words that the user spoke.
|
||||
// Populated if and only if `event_type` = `RECOGNITION_EVENT_TRANSCRIPT`.
|
||||
string transcript = 2;
|
||||
|
||||
// The default of 0.0 is a sentinel value indicating `confidence` was not set.
|
||||
// If `false`, the `StreamingRecognitionResult` represents an
|
||||
// interim result that may change. If `true`, the recognizer will not return
|
||||
// any further hypotheses about this piece of the audio. May only be populated
|
||||
// for `event_type` = `RECOGNITION_EVENT_TRANSCRIPT`.
|
||||
bool is_final = 3;
|
||||
|
||||
// The Speech confidence between 0.0 and 1.0 for the current portion of audio.
|
||||
// A higher number indicates an estimated greater likelihood that the
|
||||
// recognized words are correct. The default of 0.0 is a sentinel value
|
||||
// indicating that confidence was not set.
|
||||
//
|
||||
// This field is typically only provided if `is_final` is true and you should
|
||||
// not rely on it being accurate or even set.
|
||||
float confidence = 4;
|
||||
}
|
||||
|
||||
// Instructs the speech recognizer how to process the audio content.
|
||||
message InputAudioConfig {
|
||||
// Required. Audio encoding of the audio content to process.
|
||||
AudioEncoding audio_encoding = 1;
|
||||
|
||||
// Required. Sample rate (in Hertz) of the audio content sent in the query.
|
||||
// Refer to [Cloud Speech API documentation](/speech/docs/basics) for more
|
||||
// details.
|
||||
int32 sample_rate_hertz = 2;
|
||||
|
||||
// Required. The language of the supplied audio. Dialogflow does not do
|
||||
// translations. See [Language
|
||||
// Support](https://dialogflow.com/docs/languages) for a list of the
|
||||
// currently supported language codes. Note that queries in the same session
|
||||
// do not necessarily need to specify the same language.
|
||||
string language_code = 3;
|
||||
|
||||
// Optional. The collection of phrase hints which are used to boost accuracy
|
||||
// of speech recognition.
|
||||
// Refer to [Cloud Speech API documentation](/speech/docs/basics#phrase-hints)
|
||||
// for more details.
|
||||
repeated string phrase_hints = 4;
|
||||
}
|
||||
|
||||
// Represents the natural language text to be processed.
|
||||
message TextInput {
|
||||
// Required. The UTF-8 encoded natural language text to be processed.
|
||||
// Text length must not exceed 256 bytes.
|
||||
string text = 1;
|
||||
|
||||
// Required. The language of this conversational query. See [Language
|
||||
// Support](https://dialogflow.com/docs/languages) for a list of the
|
||||
// currently supported language codes. Note that queries in the same session
|
||||
// do not necessarily need to specify the same language.
|
||||
string language_code = 2;
|
||||
}
|
||||
|
||||
// Events allow for matching intents by event name instead of the natural
|
||||
// language input. For instance, input `<event: { name: “welcome_event”,
|
||||
// parameters: { name: “Sam” } }>` can trigger a personalized welcome response.
|
||||
// The parameter `name` may be used by the agent in the response:
|
||||
// `“Hello #welcome_event.name! What can I do for you today?”`.
|
||||
message EventInput {
|
||||
// Required. The unique identifier of the event.
|
||||
string name = 1;
|
||||
|
||||
// Optional. The collection of parameters associated with the event.
|
||||
google.protobuf.Struct parameters = 2;
|
||||
|
||||
// Required. The language of this query. See [Language
|
||||
// Support](https://dialogflow.com/docs/languages) for a list of the
|
||||
// currently supported language codes. Note that queries in the same session
|
||||
// do not necessarily need to specify the same language.
|
||||
string language_code = 3;
|
||||
}
|
||||
|
||||
// Audio encoding of the audio content sent in the conversational query request.
|
||||
// Refer to the [Cloud Speech API documentation](/speech/docs/basics) for more
|
||||
// details.
|
||||
enum AudioEncoding {
|
||||
// Not specified.
|
||||
AUDIO_ENCODING_UNSPECIFIED = 0;
|
||||
|
||||
// Uncompressed 16-bit signed little-endian samples (Linear PCM).
|
||||
AUDIO_ENCODING_LINEAR_16 = 1;
|
||||
|
||||
// [`FLAC`](https://xiph.org/flac/documentation.html) (Free Lossless Audio
|
||||
// Codec) is the recommended encoding because it is lossless (therefore
|
||||
// recognition is not compromised) and requires only about half the
|
||||
// bandwidth of `LINEAR16`. `FLAC` stream encoding supports 16-bit and
|
||||
// 24-bit samples, however, not all fields in `STREAMINFO` are supported.
|
||||
AUDIO_ENCODING_FLAC = 2;
|
||||
|
||||
// 8-bit samples that compand 14-bit audio samples using G.711 PCMU/mu-law.
|
||||
AUDIO_ENCODING_MULAW = 3;
|
||||
|
||||
// Adaptive Multi-Rate Narrowband codec. `sample_rate_hertz` must be 8000.
|
||||
AUDIO_ENCODING_AMR = 4;
|
||||
|
||||
// Adaptive Multi-Rate Wideband codec. `sample_rate_hertz` must be 16000.
|
||||
AUDIO_ENCODING_AMR_WB = 5;
|
||||
|
||||
// Opus encoded audio frames in Ogg container
|
||||
// ([OggOpus](https://wiki.xiph.org/OggOpus)).
|
||||
// `sample_rate_hertz` must be 16000.
|
||||
AUDIO_ENCODING_OGG_OPUS = 6;
|
||||
|
||||
// Although the use of lossy encodings is not recommended, if a very low
|
||||
// bitrate encoding is required, `OGG_OPUS` is highly preferred over
|
||||
// Speex encoding. The [Speex](https://speex.org/) encoding supported by
|
||||
// Dialogflow API has a header byte in each block, as in MIME type
|
||||
// `audio/x-speex-with-header-byte`.
|
||||
// It is a variant of the RTP Speex encoding defined in
|
||||
// [RFC 5574](https://tools.ietf.org/html/rfc5574).
|
||||
// The stream is a sequence of blocks, one block per RTP packet. Each block
|
||||
// starts with a byte containing the length of the block, in bytes, followed
|
||||
// by one or more frames of Speex data, padded to an integral number of
|
||||
// bytes (octets) as specified in RFC 5574. In other words, each RTP header
|
||||
// is replaced with a single byte containing the block length. Only Speex
|
||||
// wideband is supported. `sample_rate_hertz` must be 16000.
|
||||
AUDIO_ENCODING_SPEEX_WITH_HEADER_BYTE = 7;
|
||||
}
|
||||
232
node_modules/dialogflow/protos/google/cloud/dialogflow/v2beta1/session_entity_type.proto
generated
vendored
Normal file
232
node_modules/dialogflow/protos/google/cloud/dialogflow/v2beta1/session_entity_type.proto
generated
vendored
Normal file
@@ -0,0 +1,232 @@
|
||||
// Copyright 2018 Google Inc.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
syntax = "proto3";
|
||||
|
||||
package google.cloud.dialogflow.v2beta1;
|
||||
|
||||
import "google/api/annotations.proto";
|
||||
import "google/cloud/dialogflow/v2beta1/entity_type.proto";
|
||||
import "google/protobuf/empty.proto";
|
||||
import "google/protobuf/field_mask.proto";
|
||||
|
||||
option cc_enable_arenas = true;
|
||||
option csharp_namespace = "Google.Cloud.Dialogflow.V2beta1";
|
||||
option go_package = "google.golang.org/genproto/googleapis/cloud/dialogflow/v2beta1;dialogflow";
|
||||
option java_multiple_files = true;
|
||||
option java_outer_classname = "SessionEntityTypeProto";
|
||||
option java_package = "com.google.cloud.dialogflow.v2beta1";
|
||||
option objc_class_prefix = "DF";
|
||||
|
||||
|
||||
// Entities are extracted from user input and represent parameters that are
|
||||
// meaningful to your application. For example, a date range, a proper name
|
||||
// such as a geographic location or landmark, and so on. Entities represent
|
||||
// actionable data for your application.
|
||||
//
|
||||
// Session entity types are referred to as **User** entity types and are
|
||||
// entities that are built for an individual user such as
|
||||
// favorites, preferences, playlists, and so on. You can redefine a session
|
||||
// entity type at the session level.
|
||||
//
|
||||
// For more information about entity types, see the
|
||||
// [Dialogflow documentation](https://dialogflow.com/docs/entities).
|
||||
service SessionEntityTypes {
|
||||
// Returns the list of all session entity types in the specified session.
|
||||
rpc ListSessionEntityTypes(ListSessionEntityTypesRequest) returns (ListSessionEntityTypesResponse) {
|
||||
option (google.api.http) = {
|
||||
get: "/v2beta1/{parent=projects/*/agent/sessions/*}/entityTypes"
|
||||
additional_bindings {
|
||||
get: "/v2beta1/{parent=projects/*/agent/environments/*/users/*/sessions/*}/entityTypes"
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
// Retrieves the specified session entity type.
|
||||
rpc GetSessionEntityType(GetSessionEntityTypeRequest) returns (SessionEntityType) {
|
||||
option (google.api.http) = {
|
||||
get: "/v2beta1/{name=projects/*/agent/sessions/*/entityTypes/*}"
|
||||
additional_bindings {
|
||||
get: "/v2beta1/{name=projects/*/agent/environments/*/users/*/sessions/*/entityTypes/*}"
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
// Creates a session entity type.
|
||||
rpc CreateSessionEntityType(CreateSessionEntityTypeRequest) returns (SessionEntityType) {
|
||||
option (google.api.http) = {
|
||||
post: "/v2beta1/{parent=projects/*/agent/sessions/*}/entityTypes"
|
||||
body: "session_entity_type"
|
||||
additional_bindings {
|
||||
post: "/v2beta1/{parent=projects/*/agent/environments/*/users/*/sessions/*}/entityTypes"
|
||||
body: "session_entity_type"
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
// Updates the specified session entity type.
|
||||
rpc UpdateSessionEntityType(UpdateSessionEntityTypeRequest) returns (SessionEntityType) {
|
||||
option (google.api.http) = {
|
||||
patch: "/v2beta1/{session_entity_type.name=projects/*/agent/sessions/*/entityTypes/*}"
|
||||
body: "session_entity_type"
|
||||
additional_bindings {
|
||||
patch: "/v2beta1/{session_entity_type.name=projects/*/agent/environments/*/users/*/sessions/*/entityTypes/*}"
|
||||
body: "session_entity_type"
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
// Deletes the specified session entity type.
|
||||
rpc DeleteSessionEntityType(DeleteSessionEntityTypeRequest) returns (google.protobuf.Empty) {
|
||||
option (google.api.http) = {
|
||||
delete: "/v2beta1/{name=projects/*/agent/sessions/*/entityTypes/*}"
|
||||
additional_bindings {
|
||||
delete: "/v2beta1/{name=projects/*/agent/environments/*/users/*/sessions/*/entityTypes/*}"
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
// Represents a session entity type.
|
||||
//
|
||||
// Extends or replaces a developer entity type at the user session level (we
|
||||
// refer to the entity types defined at the agent level as "developer entity
|
||||
// types").
|
||||
//
|
||||
// Note: session entity types apply to all queries, regardless of the language.
|
||||
message SessionEntityType {
|
||||
// The types of modifications for a session entity type.
|
||||
enum EntityOverrideMode {
|
||||
// Not specified. This value should be never used.
|
||||
ENTITY_OVERRIDE_MODE_UNSPECIFIED = 0;
|
||||
|
||||
// The collection of session entities overrides the collection of entities
|
||||
// in the corresponding developer entity type.
|
||||
ENTITY_OVERRIDE_MODE_OVERRIDE = 1;
|
||||
|
||||
// The collection of session entities extends the collection of entities in
|
||||
// the corresponding developer entity type.
|
||||
// Calls to `ListSessionEntityTypes`, `GetSessionEntityType`,
|
||||
// `CreateSessionEntityType` and `UpdateSessionEntityType` return the full
|
||||
// collection of entities from the developer entity type in the agent's
|
||||
// default language and the session entity type.
|
||||
ENTITY_OVERRIDE_MODE_SUPPLEMENT = 2;
|
||||
}
|
||||
|
||||
// Required. The unique identifier of this session entity type. Format:
|
||||
// `projects/<Project ID>/agent/sessions/<Session ID>/entityTypes/<Entity Type
|
||||
// Display Name>`, or
|
||||
// `projects/<Project ID>/agent/environments/<Environment ID>/users/<User
|
||||
// ID>/sessions
|
||||
// /<Session ID>/entityTypes/<Entity Type Display Name>`.
|
||||
// Note: Environments and users are under construction and will be available
|
||||
// soon. If <Environment ID> is not specified, we assume default 'draft'
|
||||
// environment. If <User ID> is not specified, we assume default '-' user.
|
||||
string name = 1;
|
||||
|
||||
// Required. Indicates whether the additional data should override or
|
||||
// supplement the developer entity type definition.
|
||||
EntityOverrideMode entity_override_mode = 2;
|
||||
|
||||
// Required. The collection of entities associated with this session entity
|
||||
// type.
|
||||
repeated EntityType.Entity entities = 3;
|
||||
}
|
||||
|
||||
// The request message for [SessionEntityTypes.ListSessionEntityTypes][google.cloud.dialogflow.v2beta1.SessionEntityTypes.ListSessionEntityTypes].
|
||||
message ListSessionEntityTypesRequest {
|
||||
// Required. The session to list all session entity types from.
|
||||
// Format: `projects/<Project ID>/agent/sessions/<Session ID>` or
|
||||
// `projects/<Project ID>/agent/environments/<Environment ID>/users/<User ID>/
|
||||
// sessions/<Session ID>`.
|
||||
// Note: Environments and users are under construction and will be available
|
||||
// soon. If <Environment ID> is not specified, we assume default 'draft'
|
||||
// environment. If <User ID> is not specified, we assume default '-' user.
|
||||
string parent = 1;
|
||||
|
||||
// Optional. The maximum number of items to return in a single page. By
|
||||
// default 100 and at most 1000.
|
||||
int32 page_size = 2;
|
||||
|
||||
// Optional. The next_page_token value returned from a previous list request.
|
||||
string page_token = 3;
|
||||
}
|
||||
|
||||
// The response message for [SessionEntityTypes.ListSessionEntityTypes][google.cloud.dialogflow.v2beta1.SessionEntityTypes.ListSessionEntityTypes].
|
||||
message ListSessionEntityTypesResponse {
|
||||
// The list of session entity types. There will be a maximum number of items
|
||||
// returned based on the page_size field in the request.
|
||||
repeated SessionEntityType session_entity_types = 1;
|
||||
|
||||
// Token to retrieve the next page of results, or empty if there are no
|
||||
// more results in the list.
|
||||
string next_page_token = 2;
|
||||
}
|
||||
|
||||
// The request message for [SessionEntityTypes.GetSessionEntityType][google.cloud.dialogflow.v2beta1.SessionEntityTypes.GetSessionEntityType].
|
||||
message GetSessionEntityTypeRequest {
|
||||
// Required. The name of the session entity type. Format:
|
||||
// `projects/<Project ID>/agent/sessions/<Session ID>/entityTypes/<Entity Type
|
||||
// Display Name>` or `projects/<Project ID>/agent/environments/<Environment
|
||||
// ID>/users/<User ID>/sessions/<Session ID>/
|
||||
// entityTypes/<Entity Type Display Name>`.
|
||||
// Note: Environments and users re under construction and will be available
|
||||
// soon. If <Environment ID> is not specified, we assume default 'draft'
|
||||
// environment. If <User ID> is not specified, we assume default '-' user.
|
||||
string name = 1;
|
||||
}
|
||||
|
||||
// The request message for [SessionEntityTypes.CreateSessionEntityType][google.cloud.dialogflow.v2beta1.SessionEntityTypes.CreateSessionEntityType].
|
||||
message CreateSessionEntityTypeRequest {
|
||||
// Required. The session to create a session entity type for.
|
||||
// Format: `projects/<Project ID>/agent/sessions/<Session ID>` or
|
||||
// `projects/<Project ID>/agent/environments/<Environment ID>/users/<User ID>/
|
||||
// sessions/<Session ID>`.
|
||||
// Note: Environments and users are under construction and will be available
|
||||
// soon. If <Environment ID> is not specified, we assume default 'draft'
|
||||
// environment. If <User ID> is not specified, we assume default '-' user.
|
||||
string parent = 1;
|
||||
|
||||
// Required. The session entity type to create.
|
||||
SessionEntityType session_entity_type = 2;
|
||||
}
|
||||
|
||||
// The request message for [SessionEntityTypes.UpdateSessionEntityType][google.cloud.dialogflow.v2beta1.SessionEntityTypes.UpdateSessionEntityType].
|
||||
message UpdateSessionEntityTypeRequest {
|
||||
// Required. The entity type to update. Format:
|
||||
// `projects/<Project ID>/agent/sessions/<Session ID>/entityTypes/<Entity Type
|
||||
// Display Name>` or `projects/<Project ID>/agent/environments/<Environment
|
||||
// ID>/users/<User ID>/sessions/<Session ID>/entityTypes/<Entity Type Display
|
||||
// Name>`.
|
||||
// Note: Environments and users are under construction and will be available
|
||||
// soon. If <Environment ID> is not specified, we assume default 'draft'
|
||||
// environment. If <User ID> is not specified, we assume default '-' user.
|
||||
SessionEntityType session_entity_type = 1;
|
||||
|
||||
// Optional. The mask to control which fields get updated.
|
||||
google.protobuf.FieldMask update_mask = 2;
|
||||
}
|
||||
|
||||
// The request message for [SessionEntityTypes.DeleteSessionEntityType][google.cloud.dialogflow.v2beta1.SessionEntityTypes.DeleteSessionEntityType].
|
||||
message DeleteSessionEntityTypeRequest {
|
||||
// Required. The name of the entity type to delete. Format:
|
||||
// `projects/<Project ID>/agent/sessions/<Session ID>/entityTypes/<Entity Type
|
||||
// Display Name>` or `projects/<Project ID>/agent/environments/<Environment
|
||||
// ID>/users/<User ID>/sessions/<Session ID>/entityTypes/<Entity Type Display
|
||||
// Name>`.
|
||||
// Note: Environments and users are under construction and will be available
|
||||
// soon. If <Environment ID> is not specified, we assume default 'draft'
|
||||
// environment. If <User ID> is not specified, we assume default '-' user.
|
||||
string name = 1;
|
||||
}
|
||||
111
node_modules/dialogflow/protos/google/cloud/dialogflow/v2beta1/webhook.proto
generated
vendored
Normal file
111
node_modules/dialogflow/protos/google/cloud/dialogflow/v2beta1/webhook.proto
generated
vendored
Normal file
@@ -0,0 +1,111 @@
|
||||
// Copyright 2018 Google Inc.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
syntax = "proto3";
|
||||
|
||||
package google.cloud.dialogflow.v2beta1;
|
||||
|
||||
import "google/api/annotations.proto";
|
||||
import "google/cloud/dialogflow/v2beta1/context.proto";
|
||||
import "google/cloud/dialogflow/v2beta1/intent.proto";
|
||||
import "google/cloud/dialogflow/v2beta1/session.proto";
|
||||
import "google/protobuf/struct.proto";
|
||||
|
||||
option cc_enable_arenas = true;
|
||||
option csharp_namespace = "Google.Cloud.Dialogflow.V2beta1";
|
||||
option go_package = "google.golang.org/genproto/googleapis/cloud/dialogflow/v2beta1;dialogflow";
|
||||
option java_multiple_files = true;
|
||||
option java_outer_classname = "WebhookProto";
|
||||
option java_package = "com.google.cloud.dialogflow.v2beta1";
|
||||
option objc_class_prefix = "DF";
|
||||
|
||||
|
||||
// The request message for a webhook call.
|
||||
message WebhookRequest {
|
||||
// The unique identifier of detectIntent request session.
|
||||
// Can be used to identify end-user inside webhook implementation.
|
||||
// Format: `projects/<Project ID>/agent/sessions/<Session ID>`.
|
||||
string session = 4;
|
||||
|
||||
// The unique identifier of the response. Contains the same value as
|
||||
// `[Streaming]DetectIntentResponse.response_id`.
|
||||
string response_id = 1;
|
||||
|
||||
// The result of the conversational query or event processing. Contains the
|
||||
// same value as `[Streaming]DetectIntentResponse.query_result`.
|
||||
QueryResult query_result = 2;
|
||||
|
||||
// Optional. The contents of the original request that was passed to
|
||||
// `[Streaming]DetectIntent` call.
|
||||
OriginalDetectIntentRequest original_detect_intent_request = 3;
|
||||
}
|
||||
|
||||
// The response message for a webhook call.
|
||||
message WebhookResponse {
|
||||
// Optional. The text to be shown on the screen. This value is passed directly
|
||||
// to `QueryResult.fulfillment_text`.
|
||||
string fulfillment_text = 1;
|
||||
|
||||
// Optional. The collection of rich messages to present to the user. This
|
||||
// value is passed directly to `QueryResult.fulfillment_messages`.
|
||||
repeated Intent.Message fulfillment_messages = 2;
|
||||
|
||||
// Optional. This value is passed directly to `QueryResult.webhook_source`.
|
||||
string source = 3;
|
||||
|
||||
// Optional. This value is passed directly to `QueryResult.webhook_payload`.
|
||||
// See the related `fulfillment_messages[i].payload field`, which may be used
|
||||
// as an alternative to this field.
|
||||
//
|
||||
// This field can be used for Actions on Google responses.
|
||||
// It should have a structure similar to the JSON message shown here. For more
|
||||
// information, see
|
||||
// [Actions on Google Webhook
|
||||
// Format](https://developers.google.com/actions/dialogflow/webhook)
|
||||
// <pre>{
|
||||
// "google": {
|
||||
// "expectUserResponse": true,
|
||||
// "richResponse": {
|
||||
// "items": [
|
||||
// {
|
||||
// "simpleResponse": {
|
||||
// "textToSpeech": "this is a simple response"
|
||||
// }
|
||||
// }
|
||||
// ]
|
||||
// }
|
||||
// }
|
||||
// }</pre>
|
||||
google.protobuf.Struct payload = 4;
|
||||
|
||||
// Optional. The collection of output contexts. This value is passed directly
|
||||
// to `QueryResult.output_contexts`.
|
||||
repeated Context output_contexts = 5;
|
||||
|
||||
// Optional. Makes the platform immediately invoke another `DetectIntent` call
|
||||
// internally with the specified event as input.
|
||||
EventInput followup_event_input = 6;
|
||||
}
|
||||
|
||||
// Represents the contents of the original request that was passed to
|
||||
// the `[Streaming]DetectIntent` call.
|
||||
message OriginalDetectIntentRequest {
|
||||
// The source of this request, e.g., `google`, `facebook`, `slack`. It is set
|
||||
// by Dialogflow-owned servers.
|
||||
string source = 1;
|
||||
|
||||
// Optional. This field is set to the value of `QueryParameters.payload` field
|
||||
// passed in the request.
|
||||
google.protobuf.Struct payload = 3;
|
||||
}
|
||||
189
node_modules/dialogflow/src/index.js
generated
vendored
Normal file
189
node_modules/dialogflow/src/index.js
generated
vendored
Normal file
@@ -0,0 +1,189 @@
|
||||
// Copyright 2018 Google LLC
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// https://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
/**
|
||||
* @namespace google
|
||||
*/
|
||||
/**
|
||||
* @namespace google.cloud
|
||||
*/
|
||||
/**
|
||||
* @namespace google.cloud.dialogflow
|
||||
*/
|
||||
/**
|
||||
* @namespace google.cloud.dialogflow.v2
|
||||
*/
|
||||
/**
|
||||
* @namespace google.cloud.dialogflow.v2beta1
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
|
||||
// Import the clients for each version supported by this package.
|
||||
const gapic = Object.freeze({
|
||||
v2: require('./v2'),
|
||||
v2beta1: require('./v2beta1'),
|
||||
});
|
||||
|
||||
/**
|
||||
* The `dialogflow` package has the following named exports:
|
||||
*
|
||||
* - `AgentsClient` - Reference to
|
||||
* {@link v2.AgentsClient}
|
||||
* - `ContextsClient` - Reference to
|
||||
* {@link v2.ContextsClient}
|
||||
* - `EntityTypesClient` - Reference to
|
||||
* {@link v2.EntityTypesClient}
|
||||
* - `IntentsClient` - Reference to
|
||||
* {@link v2.IntentsClient}
|
||||
* - `SessionEntityTypesClient` - Reference to
|
||||
* {@link v2.SessionEntityTypesClient}
|
||||
* - `SessionsClient` - Reference to
|
||||
* {@link v2.SessionsClient}
|
||||
* - `v2` - This is used for selecting or pinning a
|
||||
* particular backend service version. It exports:
|
||||
* - `AgentsClient` - Reference to
|
||||
* {@link v2.AgentsClient}
|
||||
* - `ContextsClient` - Reference to
|
||||
* {@link v2.ContextsClient}
|
||||
* - `EntityTypesClient` - Reference to
|
||||
* {@link v2.EntityTypesClient}
|
||||
* - `IntentsClient` - Reference to
|
||||
* {@link v2.IntentsClient}
|
||||
* - `SessionEntityTypesClient` - Reference to
|
||||
* {@link v2.SessionEntityTypesClient}
|
||||
* - `SessionsClient` - Reference to
|
||||
* {@link v2.SessionsClient}
|
||||
*
|
||||
* @module {object} dialogflow
|
||||
* @alias nodejs-dialogflow
|
||||
*
|
||||
* @example <caption>Install the client library with <a href="https://www.npmjs.com/">npm</a>:</caption>
|
||||
* npm install --save dialogflow
|
||||
*
|
||||
* @example <caption>Import the client library:</caption>
|
||||
* const dialogflow = require('dialogflow');
|
||||
*
|
||||
* @example <caption>Create a client that uses <a href="https://goo.gl/64dyYX">Application Default Credentials (ADC)</a>:</caption>
|
||||
* const client = new dialogflow.AgentsClient();
|
||||
*
|
||||
* @example <caption>Create a client with <a href="https://goo.gl/RXp6VL">explicit credentials</a>:</caption>
|
||||
* const client = new dialogflow.AgentsClient({
|
||||
* projectId: 'your-project-id',
|
||||
* keyFilename: '/path/to/keyfile.json',
|
||||
* });
|
||||
*/
|
||||
|
||||
/**
|
||||
* @type {object}
|
||||
* @property {constructor} AgentsClient
|
||||
* Reference to {@link v2.AgentsClient}
|
||||
* @property {constructor} ContextsClient
|
||||
* Reference to {@link v2.ContextsClient}
|
||||
* @property {constructor} EntityTypesClient
|
||||
* Reference to {@link v2.EntityTypesClient}
|
||||
* @property {constructor} IntentsClient
|
||||
* Reference to {@link v2.IntentsClient}
|
||||
* @property {constructor} SessionEntityTypesClient
|
||||
* Reference to {@link v2.SessionEntityTypesClient}
|
||||
* @property {constructor} SessionsClient
|
||||
* Reference to {@link v2.SessionsClient}
|
||||
*/
|
||||
module.exports = gapic.v2;
|
||||
|
||||
/**
|
||||
* @type {object}
|
||||
* @property {constructor} AgentsClient
|
||||
* Reference to {@link v2.AgentsClient}
|
||||
* @property {constructor} ContextsClient
|
||||
* Reference to {@link v2.ContextsClient}
|
||||
* @property {constructor} EntityTypesClient
|
||||
* Reference to {@link v2.EntityTypesClient}
|
||||
* @property {constructor} IntentsClient
|
||||
* Reference to {@link v2.IntentsClient}
|
||||
* @property {constructor} SessionEntityTypesClient
|
||||
* Reference to {@link v2.SessionEntityTypesClient}
|
||||
* @property {constructor} SessionsClient
|
||||
* Reference to {@link v2.SessionsClient}
|
||||
*/
|
||||
module.exports.v2 = gapic.v2;
|
||||
|
||||
/**
|
||||
* The `dialogflow` package has the following named exports:
|
||||
*
|
||||
* - `AgentsClient` - Reference to
|
||||
* {@link v2beta1.AgentsClient}
|
||||
* - `ContextsClient` - Reference to
|
||||
* {@link v2beta1.ContextsClient}
|
||||
* - `EntityTypesClient` - Reference to
|
||||
* {@link v2beta1.EntityTypesClient}
|
||||
* - `IntentsClient` - Reference to
|
||||
* {@link v2beta1.IntentsClient}
|
||||
* - `SessionEntityTypesClient` - Reference to
|
||||
* {@link v2beta1.SessionEntityTypesClient}
|
||||
* - `SessionsClient` - Reference to
|
||||
* {@link v2beta1.SessionsClient}
|
||||
* - `v2beta1` - This is used for selecting or pinning a
|
||||
* particular backend service version. It exports:
|
||||
* - `AgentsClient` - Reference to
|
||||
* {@link v2beta1.AgentsClient}
|
||||
* - `ContextsClient` - Reference to
|
||||
* {@link v2beta1.ContextsClient}
|
||||
* - `EntityTypesClient` - Reference to
|
||||
* {@link v2beta1.EntityTypesClient}
|
||||
* - `IntentsClient` - Reference to
|
||||
* {@link v2beta1.IntentsClient}
|
||||
* - `SessionEntityTypesClient` - Reference to
|
||||
* {@link v2beta1.SessionEntityTypesClient}
|
||||
* - `SessionsClient` - Reference to
|
||||
* {@link v2beta1.SessionsClient}
|
||||
*
|
||||
* @module {object} dialogflow
|
||||
* @alias nodejs-dialogflow
|
||||
*
|
||||
* @example <caption>Install the client library with <a href="https://www.npmjs.com/">npm</a>:</caption>
|
||||
* npm install --save dialogflow
|
||||
*
|
||||
* @example <caption>Import the client library:</caption>
|
||||
* const dialogflow = require('dialogflow');
|
||||
*
|
||||
* @example <caption>Create a client that uses <a href="https://goo.gl/64dyYX">Application Default Credentials (ADC)</a>:</caption>
|
||||
* const client = new dialogflow.AgentsClient();
|
||||
*
|
||||
* @example <caption>Create a client with <a href="https://goo.gl/RXp6VL">explicit credentials</a>:</caption>
|
||||
* const client = new dialogflow.AgentsClient({
|
||||
* projectId: 'your-project-id',
|
||||
* keyFilename: '/path/to/keyfile.json',
|
||||
* });
|
||||
*/
|
||||
|
||||
/**
|
||||
* @type {object}
|
||||
* @property {constructor} AgentsClient
|
||||
* Reference to {@link v2beta1.AgentsClient}
|
||||
* @property {constructor} ContextsClient
|
||||
* Reference to {@link v2beta1.ContextsClient}
|
||||
* @property {constructor} EntityTypesClient
|
||||
* Reference to {@link v2beta1.EntityTypesClient}
|
||||
* @property {constructor} IntentsClient
|
||||
* Reference to {@link v2beta1.IntentsClient}
|
||||
* @property {constructor} SessionEntityTypesClient
|
||||
* Reference to {@link v2beta1.SessionEntityTypesClient}
|
||||
* @property {constructor} SessionsClient
|
||||
* Reference to {@link v2beta1.SessionsClient}
|
||||
*/
|
||||
module.exports.v2beta1 = gapic.v2beta1;
|
||||
|
||||
// Alias `module.exports` as `module.exports.default`, for future-proofing.
|
||||
module.exports.default = Object.assign({}, module.exports);
|
||||
931
node_modules/dialogflow/src/v2/agents_client.js
generated
vendored
Normal file
931
node_modules/dialogflow/src/v2/agents_client.js
generated
vendored
Normal file
@@ -0,0 +1,931 @@
|
||||
// Copyright 2018 Google LLC
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// https://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
'use strict';
|
||||
|
||||
const gapicConfig = require('./agents_client_config');
|
||||
const gax = require('google-gax');
|
||||
const merge = require('lodash.merge');
|
||||
const path = require('path');
|
||||
const protobuf = require('protobufjs');
|
||||
|
||||
const VERSION = require('../../package.json').version;
|
||||
|
||||
/**
|
||||
* Agents are best described as Natural Language Understanding (NLU) modules
|
||||
* that transform user requests into actionable data. You can include agents
|
||||
* in your app, product, or service to determine user intent and respond to the
|
||||
* user in a natural way.
|
||||
*
|
||||
* After you create an agent, you can add Intents, Contexts,
|
||||
* Entity Types, Webhooks, and so on to
|
||||
* manage the flow of a conversation and match user input to predefined intents
|
||||
* and actions.
|
||||
*
|
||||
* You can create an agent using both Dialogflow Standard Edition and
|
||||
* Dialogflow Enterprise Edition. For details, see
|
||||
* [Dialogflow Editions](https://cloud.google.com/dialogflow-enterprise/docs/editions).
|
||||
*
|
||||
* You can save your agent for backup or versioning by exporting the agent by
|
||||
* using the ExportAgent method. You can import a saved
|
||||
* agent by using the ImportAgent method.
|
||||
*
|
||||
* Dialogflow provides several
|
||||
* [prebuilt agents](https://dialogflow.com/docs/prebuilt-agents) for common
|
||||
* conversation scenarios such as determining a date and time, converting
|
||||
* currency, and so on.
|
||||
*
|
||||
* For more information about agents, see the
|
||||
* [Dialogflow documentation](https://dialogflow.com/docs/agents).
|
||||
*
|
||||
* @class
|
||||
* @memberof v2
|
||||
*/
|
||||
class AgentsClient {
|
||||
/**
|
||||
* Construct an instance of AgentsClient.
|
||||
*
|
||||
* @param {object} [options] - The configuration object. See the subsequent
|
||||
* parameters for more details.
|
||||
* @param {object} [options.credentials] - Credentials object.
|
||||
* @param {string} [options.credentials.client_email]
|
||||
* @param {string} [options.credentials.private_key]
|
||||
* @param {string} [options.email] - Account email address. Required when
|
||||
* using a .pem or .p12 keyFilename.
|
||||
* @param {string} [options.keyFilename] - 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.
|
||||
* @param {number} [options.port] - The port on which to connect to
|
||||
* the remote host.
|
||||
* @param {string} [options.projectId] - 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
|
||||
* {@link https://developers.google.com/identity/protocols/application-default-credentials Application Default Credentials},
|
||||
* your project ID will be detected automatically.
|
||||
* @param {function} [options.promise] - Custom promise module to use instead
|
||||
* of native Promises.
|
||||
* @param {string} [options.servicePath] - The domain name of the
|
||||
* API remote host.
|
||||
*/
|
||||
constructor(opts) {
|
||||
this._descriptors = {};
|
||||
|
||||
// Ensure that options include the service address and port.
|
||||
opts = Object.assign(
|
||||
{
|
||||
clientConfig: {},
|
||||
port: this.constructor.port,
|
||||
servicePath: this.constructor.servicePath,
|
||||
},
|
||||
opts
|
||||
);
|
||||
|
||||
// Create a `gaxGrpc` object, with any grpc-specific options
|
||||
// sent to the client.
|
||||
opts.scopes = this.constructor.scopes;
|
||||
var gaxGrpc = gax.grpc(opts);
|
||||
|
||||
// Save the auth object to the client, for use by other methods.
|
||||
this.auth = gaxGrpc.auth;
|
||||
|
||||
// Determine the client header string.
|
||||
var clientHeader = [
|
||||
`gl-node/${process.version.node}`,
|
||||
`grpc/${gaxGrpc.grpcVersion}`,
|
||||
`gax/${gax.version}`,
|
||||
`gapic/${VERSION}`,
|
||||
];
|
||||
if (opts.libName && opts.libVersion) {
|
||||
clientHeader.push(`${opts.libName}/${opts.libVersion}`);
|
||||
}
|
||||
|
||||
// Load the applicable protos.
|
||||
var protos = merge(
|
||||
{},
|
||||
gaxGrpc.loadProto(
|
||||
path.join(__dirname, '..', '..', 'protos'),
|
||||
'google/cloud/dialogflow/v2/agent.proto'
|
||||
)
|
||||
);
|
||||
|
||||
// This API contains "path templates"; forward-slash-separated
|
||||
// identifiers to uniquely identify resources within the API.
|
||||
// Create useful helper objects for these.
|
||||
this._pathTemplates = {
|
||||
projectPathTemplate: new gax.PathTemplate('projects/{project}'),
|
||||
};
|
||||
|
||||
// Some of the methods on this service return "paged" results,
|
||||
// (e.g. 50 results at a time, with tokens to get subsequent
|
||||
// pages). Denote the keys used for pagination and results.
|
||||
this._descriptors.page = {
|
||||
searchAgents: new gax.PageDescriptor(
|
||||
'pageToken',
|
||||
'nextPageToken',
|
||||
'agents'
|
||||
),
|
||||
};
|
||||
var protoFilesRoot = new gax.grpc.GoogleProtoFilesRoot();
|
||||
protoFilesRoot = protobuf.loadSync(
|
||||
path.join(
|
||||
__dirname,
|
||||
'..',
|
||||
'..',
|
||||
'protos',
|
||||
'google/cloud/dialogflow/v2/agent.proto'
|
||||
),
|
||||
protoFilesRoot
|
||||
);
|
||||
|
||||
// This API contains "long-running operations", which return a
|
||||
// an Operation object that allows for tracking of the operation,
|
||||
// rather than holding a request open.
|
||||
this.operationsClient = new gax.lro({
|
||||
auth: gaxGrpc.auth,
|
||||
grpc: gaxGrpc.grpc,
|
||||
}).operationsClient(opts);
|
||||
|
||||
var trainAgentResponse = protoFilesRoot.lookup('google.protobuf.Empty');
|
||||
var trainAgentMetadata = protoFilesRoot.lookup('google.protobuf.Struct');
|
||||
var exportAgentResponse = protoFilesRoot.lookup(
|
||||
'google.cloud.dialogflow.v2.ExportAgentResponse'
|
||||
);
|
||||
var exportAgentMetadata = protoFilesRoot.lookup('google.protobuf.Struct');
|
||||
var importAgentResponse = protoFilesRoot.lookup('google.protobuf.Empty');
|
||||
var importAgentMetadata = protoFilesRoot.lookup('google.protobuf.Struct');
|
||||
var restoreAgentResponse = protoFilesRoot.lookup('google.protobuf.Empty');
|
||||
var restoreAgentMetadata = protoFilesRoot.lookup('google.protobuf.Struct');
|
||||
|
||||
this._descriptors.longrunning = {
|
||||
trainAgent: new gax.LongrunningDescriptor(
|
||||
this.operationsClient,
|
||||
trainAgentResponse.decode.bind(trainAgentResponse),
|
||||
trainAgentMetadata.decode.bind(trainAgentMetadata)
|
||||
),
|
||||
exportAgent: new gax.LongrunningDescriptor(
|
||||
this.operationsClient,
|
||||
exportAgentResponse.decode.bind(exportAgentResponse),
|
||||
exportAgentMetadata.decode.bind(exportAgentMetadata)
|
||||
),
|
||||
importAgent: new gax.LongrunningDescriptor(
|
||||
this.operationsClient,
|
||||
importAgentResponse.decode.bind(importAgentResponse),
|
||||
importAgentMetadata.decode.bind(importAgentMetadata)
|
||||
),
|
||||
restoreAgent: new gax.LongrunningDescriptor(
|
||||
this.operationsClient,
|
||||
restoreAgentResponse.decode.bind(restoreAgentResponse),
|
||||
restoreAgentMetadata.decode.bind(restoreAgentMetadata)
|
||||
),
|
||||
};
|
||||
|
||||
// Put together the default options sent with requests.
|
||||
var defaults = gaxGrpc.constructSettings(
|
||||
'google.cloud.dialogflow.v2.Agents',
|
||||
gapicConfig,
|
||||
opts.clientConfig,
|
||||
{'x-goog-api-client': clientHeader.join(' ')}
|
||||
);
|
||||
|
||||
// Set up a dictionary of "inner API calls"; the core implementation
|
||||
// of calling the API is handled in `google-gax`, with this code
|
||||
// merely providing the destination and request information.
|
||||
this._innerApiCalls = {};
|
||||
|
||||
// Put together the "service stub" for
|
||||
// google.cloud.dialogflow.v2.Agents.
|
||||
var agentsStub = gaxGrpc.createStub(
|
||||
protos.google.cloud.dialogflow.v2.Agents,
|
||||
opts
|
||||
);
|
||||
|
||||
// Iterate over each of the methods that the service provides
|
||||
// and create an API call method for each.
|
||||
var agentsStubMethods = [
|
||||
'getAgent',
|
||||
'searchAgents',
|
||||
'trainAgent',
|
||||
'exportAgent',
|
||||
'importAgent',
|
||||
'restoreAgent',
|
||||
];
|
||||
for (let methodName of agentsStubMethods) {
|
||||
this._innerApiCalls[methodName] = gax.createApiCall(
|
||||
agentsStub.then(
|
||||
stub =>
|
||||
function() {
|
||||
var args = Array.prototype.slice.call(arguments, 0);
|
||||
return stub[methodName].apply(stub, args);
|
||||
}
|
||||
),
|
||||
defaults[methodName],
|
||||
this._descriptors.page[methodName] ||
|
||||
this._descriptors.longrunning[methodName]
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* The DNS address for this API service.
|
||||
*/
|
||||
static get servicePath() {
|
||||
return 'dialogflow.googleapis.com';
|
||||
}
|
||||
|
||||
/**
|
||||
* The port for this API service.
|
||||
*/
|
||||
static get port() {
|
||||
return 443;
|
||||
}
|
||||
|
||||
/**
|
||||
* The scopes needed to make gRPC calls for every method defined
|
||||
* in this service.
|
||||
*/
|
||||
static get scopes() {
|
||||
return ['https://www.googleapis.com/auth/cloud-platform'];
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the project ID used by this class.
|
||||
* @param {function(Error, string)} callback - the callback to
|
||||
* be called with the current project Id.
|
||||
*/
|
||||
getProjectId(callback) {
|
||||
return this.auth.getProjectId(callback);
|
||||
}
|
||||
|
||||
// -------------------
|
||||
// -- Service calls --
|
||||
// -------------------
|
||||
|
||||
/**
|
||||
* Retrieves the specified agent.
|
||||
*
|
||||
* @param {Object} request
|
||||
* The request object that will be sent.
|
||||
* @param {string} request.parent
|
||||
* Required. The project that the agent to fetch is associated with.
|
||||
* Format: `projects/<Project ID>`.
|
||||
* @param {Object} [options]
|
||||
* Optional parameters. You can override the default settings for this call, e.g, timeout,
|
||||
* retries, paginations, etc. See [gax.CallOptions]{@link https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the details.
|
||||
* @param {function(?Error, ?Object)} [callback]
|
||||
* The function which will be called with the result of the API call.
|
||||
*
|
||||
* The second parameter to the callback is an object representing [Agent]{@link google.cloud.dialogflow.v2.Agent}.
|
||||
* @returns {Promise} - The promise which resolves to an array.
|
||||
* The first element of the array is an object representing [Agent]{@link google.cloud.dialogflow.v2.Agent}.
|
||||
* The promise has a method named "cancel" which cancels the ongoing API call.
|
||||
*
|
||||
* @example
|
||||
*
|
||||
* const dialogflow = require('dialogflow.v2');
|
||||
*
|
||||
* var client = new dialogflow.v2.AgentsClient({
|
||||
* // optional auth parameters.
|
||||
* });
|
||||
*
|
||||
* var formattedParent = client.projectPath('[PROJECT]');
|
||||
* client.getAgent({parent: formattedParent})
|
||||
* .then(responses => {
|
||||
* var response = responses[0];
|
||||
* // doThingsWith(response)
|
||||
* })
|
||||
* .catch(err => {
|
||||
* console.error(err);
|
||||
* });
|
||||
*/
|
||||
getAgent(request, options, callback) {
|
||||
if (options instanceof Function && callback === undefined) {
|
||||
callback = options;
|
||||
options = {};
|
||||
}
|
||||
options = options || {};
|
||||
|
||||
return this._innerApiCalls.getAgent(request, options, callback);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the list of agents.
|
||||
*
|
||||
* Since there is at most one conversational agent per project, this method is
|
||||
* useful primarily for listing all agents across projects the caller has
|
||||
* access to. One can achieve that with a wildcard project collection id "-".
|
||||
* Refer to [List
|
||||
* Sub-Collections](https://cloud.google.com/apis/design/design_patterns#list_sub-collections).
|
||||
*
|
||||
* @param {Object} request
|
||||
* The request object that will be sent.
|
||||
* @param {string} request.parent
|
||||
* Required. The project to list agents from.
|
||||
* Format: `projects/<Project ID or '-'>`.
|
||||
* @param {number} [request.pageSize]
|
||||
* 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.
|
||||
* @param {Object} [options]
|
||||
* Optional parameters. You can override the default settings for this call, e.g, timeout,
|
||||
* retries, paginations, etc. See [gax.CallOptions]{@link https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the details.
|
||||
* @param {function(?Error, ?Array, ?Object, ?Object)} [callback]
|
||||
* The function which will be called with the result of the API call.
|
||||
*
|
||||
* The second parameter to the callback is Array of [Agent]{@link google.cloud.dialogflow.v2.Agent}.
|
||||
*
|
||||
* 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 [SearchAgentsResponse]{@link google.cloud.dialogflow.v2.SearchAgentsResponse}.
|
||||
* @returns {Promise} - The promise which resolves to an array.
|
||||
* The first element of the array is Array of [Agent]{@link google.cloud.dialogflow.v2.Agent}.
|
||||
*
|
||||
* When autoPaginate: false is specified through options, the array has three elements.
|
||||
* The first element is Array of [Agent]{@link google.cloud.dialogflow.v2.Agent} 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 [SearchAgentsResponse]{@link google.cloud.dialogflow.v2.SearchAgentsResponse}.
|
||||
*
|
||||
* The promise has a method named "cancel" which cancels the ongoing API call.
|
||||
*
|
||||
* @example
|
||||
*
|
||||
* const dialogflow = require('dialogflow.v2');
|
||||
*
|
||||
* var client = new dialogflow.v2.AgentsClient({
|
||||
* // optional auth parameters.
|
||||
* });
|
||||
*
|
||||
* // Iterate over all elements.
|
||||
* var formattedParent = client.projectPath('[PROJECT]');
|
||||
*
|
||||
* client.searchAgents({parent: formattedParent})
|
||||
* .then(responses => {
|
||||
* var resources = responses[0];
|
||||
* for (let i = 0; i < resources.length; i += 1) {
|
||||
* // doThingsWith(resources[i])
|
||||
* }
|
||||
* })
|
||||
* .catch(err => {
|
||||
* console.error(err);
|
||||
* });
|
||||
*
|
||||
* // Or obtain the paged response.
|
||||
* var formattedParent = client.projectPath('[PROJECT]');
|
||||
*
|
||||
*
|
||||
* var options = {autoPaginate: false};
|
||||
* var callback = responses => {
|
||||
* // The actual resources in a response.
|
||||
* var resources = responses[0];
|
||||
* // The next request if the response shows that there are more responses.
|
||||
* var nextRequest = responses[1];
|
||||
* // The actual response object, if necessary.
|
||||
* // var rawResponse = responses[2];
|
||||
* for (let i = 0; i < resources.length; i += 1) {
|
||||
* // doThingsWith(resources[i]);
|
||||
* }
|
||||
* if (nextRequest) {
|
||||
* // Fetch the next page.
|
||||
* return client.searchAgents(nextRequest, options).then(callback);
|
||||
* }
|
||||
* }
|
||||
* client.searchAgents({parent: formattedParent}, options)
|
||||
* .then(callback)
|
||||
* .catch(err => {
|
||||
* console.error(err);
|
||||
* });
|
||||
*/
|
||||
searchAgents(request, options, callback) {
|
||||
if (options instanceof Function && callback === undefined) {
|
||||
callback = options;
|
||||
options = {};
|
||||
}
|
||||
options = options || {};
|
||||
|
||||
return this._innerApiCalls.searchAgents(request, options, callback);
|
||||
}
|
||||
|
||||
/**
|
||||
* Equivalent to {@link searchAgents}, but returns a NodeJS Stream object.
|
||||
*
|
||||
* This fetches the paged responses for {@link searchAgents} 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.
|
||||
*
|
||||
* @see {@link https://nodejs.org/api/stream.html}
|
||||
*
|
||||
* @param {Object} request
|
||||
* The request object that will be sent.
|
||||
* @param {string} request.parent
|
||||
* Required. The project to list agents from.
|
||||
* Format: `projects/<Project ID or '-'>`.
|
||||
* @param {number} [request.pageSize]
|
||||
* 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.
|
||||
* @param {Object} [options]
|
||||
* Optional parameters. You can override the default settings for this call, e.g, timeout,
|
||||
* retries, paginations, etc. See [gax.CallOptions]{@link https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the details.
|
||||
* @returns {Stream}
|
||||
* An object stream which emits an object representing [Agent]{@link google.cloud.dialogflow.v2.Agent} on 'data' event.
|
||||
*
|
||||
* @example
|
||||
*
|
||||
* const dialogflow = require('dialogflow.v2');
|
||||
*
|
||||
* var client = new dialogflow.v2.AgentsClient({
|
||||
* // optional auth parameters.
|
||||
* });
|
||||
*
|
||||
* var formattedParent = client.projectPath('[PROJECT]');
|
||||
* client.searchAgentsStream({parent: formattedParent})
|
||||
* .on('data', element => {
|
||||
* // doThingsWith(element)
|
||||
* }).on('error', err => {
|
||||
* console.log(err);
|
||||
* });
|
||||
*/
|
||||
searchAgentsStream(request, options) {
|
||||
options = options || {};
|
||||
|
||||
return this._descriptors.page.searchAgents.createStream(
|
||||
this._innerApiCalls.searchAgents,
|
||||
request,
|
||||
options
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Trains the specified agent.
|
||||
*
|
||||
* Operation <response: google.protobuf.Empty,
|
||||
* metadata: google.protobuf.Struct>
|
||||
*
|
||||
* @param {Object} request
|
||||
* The request object that will be sent.
|
||||
* @param {string} request.parent
|
||||
* Required. The project that the agent to train is associated with.
|
||||
* Format: `projects/<Project ID>`.
|
||||
* @param {Object} [options]
|
||||
* Optional parameters. You can override the default settings for this call, e.g, timeout,
|
||||
* retries, paginations, etc. See [gax.CallOptions]{@link https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the details.
|
||||
* @param {function(?Error, ?Object)} [callback]
|
||||
* The function which will be called with the result of the API call.
|
||||
*
|
||||
* The second parameter to the callback is a [gax.Operation]{@link https://googleapis.github.io/gax-nodejs/Operation} object.
|
||||
* @returns {Promise} - The promise which resolves to an array.
|
||||
* The first element of the array is a [gax.Operation]{@link https://googleapis.github.io/gax-nodejs/Operation} object.
|
||||
* The promise has a method named "cancel" which cancels the ongoing API call.
|
||||
*
|
||||
* @example
|
||||
*
|
||||
* const dialogflow = require('dialogflow.v2');
|
||||
*
|
||||
* var client = new dialogflow.v2.AgentsClient({
|
||||
* // optional auth parameters.
|
||||
* });
|
||||
*
|
||||
* var formattedParent = client.projectPath('[PROJECT]');
|
||||
*
|
||||
* // Handle the operation using the promise pattern.
|
||||
* client.trainAgent({parent: formattedParent})
|
||||
* .then(responses => {
|
||||
* var operation = responses[0];
|
||||
* var initialApiResponse = responses[1];
|
||||
*
|
||||
* // Operation#promise starts polling for the completion of the LRO.
|
||||
* return operation.promise();
|
||||
* })
|
||||
* .then(responses => {
|
||||
* // The final result of the operation.
|
||||
* var result = responses[0];
|
||||
*
|
||||
* // The metadata value of the completed operation.
|
||||
* var metadata = responses[1];
|
||||
*
|
||||
* // The response of the api call returning the complete operation.
|
||||
* var finalApiResponse = responses[2];
|
||||
* })
|
||||
* .catch(err => {
|
||||
* console.error(err);
|
||||
* });
|
||||
*
|
||||
* var formattedParent = client.projectPath('[PROJECT]');
|
||||
*
|
||||
* // Handle the operation using the event emitter pattern.
|
||||
* client.trainAgent({parent: formattedParent})
|
||||
* .then(responses => {
|
||||
* var operation = responses[0];
|
||||
* var initialApiResponse = responses[1];
|
||||
*
|
||||
* // 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);
|
||||
* });
|
||||
*/
|
||||
trainAgent(request, options, callback) {
|
||||
if (options instanceof Function && callback === undefined) {
|
||||
callback = options;
|
||||
options = {};
|
||||
}
|
||||
options = options || {};
|
||||
|
||||
return this._innerApiCalls.trainAgent(request, options, callback);
|
||||
}
|
||||
|
||||
/**
|
||||
* Exports the specified agent to a ZIP file.
|
||||
*
|
||||
* Operation <response: ExportAgentResponse,
|
||||
* metadata: google.protobuf.Struct>
|
||||
*
|
||||
* @param {Object} request
|
||||
* The request object that will be sent.
|
||||
* @param {string} request.parent
|
||||
* Required. The project that the agent to export is associated with.
|
||||
* Format: `projects/<Project ID>`.
|
||||
* @param {string} [request.agentUri]
|
||||
* Optional. The Google Cloud Storage URI to export the agent to.
|
||||
* Note: The URI must start with
|
||||
* "gs://". If left unspecified, the serialized agent is returned inline.
|
||||
* @param {Object} [options]
|
||||
* Optional parameters. You can override the default settings for this call, e.g, timeout,
|
||||
* retries, paginations, etc. See [gax.CallOptions]{@link https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the details.
|
||||
* @param {function(?Error, ?Object)} [callback]
|
||||
* The function which will be called with the result of the API call.
|
||||
*
|
||||
* The second parameter to the callback is a [gax.Operation]{@link https://googleapis.github.io/gax-nodejs/Operation} object.
|
||||
* @returns {Promise} - The promise which resolves to an array.
|
||||
* The first element of the array is a [gax.Operation]{@link https://googleapis.github.io/gax-nodejs/Operation} object.
|
||||
* The promise has a method named "cancel" which cancels the ongoing API call.
|
||||
*
|
||||
* @example
|
||||
*
|
||||
* const dialogflow = require('dialogflow.v2');
|
||||
*
|
||||
* var client = new dialogflow.v2.AgentsClient({
|
||||
* // optional auth parameters.
|
||||
* });
|
||||
*
|
||||
* var formattedParent = client.projectPath('[PROJECT]');
|
||||
*
|
||||
* // Handle the operation using the promise pattern.
|
||||
* client.exportAgent({parent: formattedParent})
|
||||
* .then(responses => {
|
||||
* var operation = responses[0];
|
||||
* var initialApiResponse = responses[1];
|
||||
*
|
||||
* // Operation#promise starts polling for the completion of the LRO.
|
||||
* return operation.promise();
|
||||
* })
|
||||
* .then(responses => {
|
||||
* // The final result of the operation.
|
||||
* var result = responses[0];
|
||||
*
|
||||
* // The metadata value of the completed operation.
|
||||
* var metadata = responses[1];
|
||||
*
|
||||
* // The response of the api call returning the complete operation.
|
||||
* var finalApiResponse = responses[2];
|
||||
* })
|
||||
* .catch(err => {
|
||||
* console.error(err);
|
||||
* });
|
||||
*
|
||||
* var formattedParent = client.projectPath('[PROJECT]');
|
||||
*
|
||||
* // Handle the operation using the event emitter pattern.
|
||||
* client.exportAgent({parent: formattedParent})
|
||||
* .then(responses => {
|
||||
* var operation = responses[0];
|
||||
* var initialApiResponse = responses[1];
|
||||
*
|
||||
* // 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);
|
||||
* });
|
||||
*/
|
||||
exportAgent(request, options, callback) {
|
||||
if (options instanceof Function && callback === undefined) {
|
||||
callback = options;
|
||||
options = {};
|
||||
}
|
||||
options = options || {};
|
||||
|
||||
return this._innerApiCalls.exportAgent(request, options, callback);
|
||||
}
|
||||
|
||||
/**
|
||||
* Imports the specified agent from a ZIP file.
|
||||
*
|
||||
* Uploads new intents and entity types without deleting the existing ones.
|
||||
* Intents and entity types with the same name are replaced with the new
|
||||
* versions from ImportAgentRequest.
|
||||
*
|
||||
* Operation <response: google.protobuf.Empty,
|
||||
* metadata: google.protobuf.Struct>
|
||||
*
|
||||
* @param {Object} request
|
||||
* The request object that will be sent.
|
||||
* @param {string} request.parent
|
||||
* Required. The project that the agent to import is associated with.
|
||||
* Format: `projects/<Project ID>`.
|
||||
* @param {string} [request.agentUri]
|
||||
* The URI to a Google Cloud Storage file containing the agent to import.
|
||||
* Note: The URI must start with "gs://".
|
||||
* @param {string} [request.agentContent]
|
||||
* The agent to import.
|
||||
*
|
||||
* Example for how to import an agent via the command line:
|
||||
*
|
||||
* curl \
|
||||
* 'https://dialogflow.googleapis.com/v2/projects/<project_name>/agent:import\
|
||||
* -X POST \
|
||||
* -H 'Authorization: Bearer '$(gcloud auth print-access-token) \
|
||||
* -H 'Accept: application/json' \
|
||||
* -H 'Content-Type: application/json' \
|
||||
* --compressed \
|
||||
* --data-binary "{
|
||||
* 'agentContent': '$(cat <agent zip file> | base64 -w 0)'
|
||||
* }"
|
||||
* @param {Object} [options]
|
||||
* Optional parameters. You can override the default settings for this call, e.g, timeout,
|
||||
* retries, paginations, etc. See [gax.CallOptions]{@link https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the details.
|
||||
* @param {function(?Error, ?Object)} [callback]
|
||||
* The function which will be called with the result of the API call.
|
||||
*
|
||||
* The second parameter to the callback is a [gax.Operation]{@link https://googleapis.github.io/gax-nodejs/Operation} object.
|
||||
* @returns {Promise} - The promise which resolves to an array.
|
||||
* The first element of the array is a [gax.Operation]{@link https://googleapis.github.io/gax-nodejs/Operation} object.
|
||||
* The promise has a method named "cancel" which cancels the ongoing API call.
|
||||
*
|
||||
* @example
|
||||
*
|
||||
* const dialogflow = require('dialogflow.v2');
|
||||
*
|
||||
* var client = new dialogflow.v2.AgentsClient({
|
||||
* // optional auth parameters.
|
||||
* });
|
||||
*
|
||||
* var formattedParent = client.projectPath('[PROJECT]');
|
||||
*
|
||||
* // Handle the operation using the promise pattern.
|
||||
* client.importAgent({parent: formattedParent})
|
||||
* .then(responses => {
|
||||
* var operation = responses[0];
|
||||
* var initialApiResponse = responses[1];
|
||||
*
|
||||
* // Operation#promise starts polling for the completion of the LRO.
|
||||
* return operation.promise();
|
||||
* })
|
||||
* .then(responses => {
|
||||
* // The final result of the operation.
|
||||
* var result = responses[0];
|
||||
*
|
||||
* // The metadata value of the completed operation.
|
||||
* var metadata = responses[1];
|
||||
*
|
||||
* // The response of the api call returning the complete operation.
|
||||
* var finalApiResponse = responses[2];
|
||||
* })
|
||||
* .catch(err => {
|
||||
* console.error(err);
|
||||
* });
|
||||
*
|
||||
* var formattedParent = client.projectPath('[PROJECT]');
|
||||
*
|
||||
* // Handle the operation using the event emitter pattern.
|
||||
* client.importAgent({parent: formattedParent})
|
||||
* .then(responses => {
|
||||
* var operation = responses[0];
|
||||
* var initialApiResponse = responses[1];
|
||||
*
|
||||
* // 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);
|
||||
* });
|
||||
*/
|
||||
importAgent(request, options, callback) {
|
||||
if (options instanceof Function && callback === undefined) {
|
||||
callback = options;
|
||||
options = {};
|
||||
}
|
||||
options = options || {};
|
||||
|
||||
return this._innerApiCalls.importAgent(request, options, callback);
|
||||
}
|
||||
|
||||
/**
|
||||
* Restores the specified agent from a ZIP file.
|
||||
*
|
||||
* Replaces the current agent version with a new one. All the intents and
|
||||
* entity types in the older version are deleted.
|
||||
*
|
||||
* Operation <response: google.protobuf.Empty,
|
||||
* metadata: google.protobuf.Struct>
|
||||
*
|
||||
* @param {Object} request
|
||||
* The request object that will be sent.
|
||||
* @param {string} request.parent
|
||||
* Required. The project that the agent to restore is associated with.
|
||||
* Format: `projects/<Project ID>`.
|
||||
* @param {string} [request.agentUri]
|
||||
* The URI to a Google Cloud Storage file containing the agent to restore.
|
||||
* Note: The URI must start with "gs://".
|
||||
* @param {string} [request.agentContent]
|
||||
* The agent to restore.
|
||||
*
|
||||
* Example for how to restore an agent via the command line:
|
||||
*
|
||||
* curl \
|
||||
* 'https://dialogflow.googleapis.com/v2/projects/<project_name>/agent:restore\
|
||||
* -X POST \
|
||||
* -H 'Authorization: Bearer '$(gcloud auth print-access-token) \
|
||||
* -H 'Accept: application/json' \
|
||||
* -H 'Content-Type: application/json' \
|
||||
* --compressed \
|
||||
* --data-binary "{
|
||||
* 'agentContent': '$(cat <agent zip file> | base64 -w 0)'
|
||||
* }" \
|
||||
* @param {Object} [options]
|
||||
* Optional parameters. You can override the default settings for this call, e.g, timeout,
|
||||
* retries, paginations, etc. See [gax.CallOptions]{@link https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the details.
|
||||
* @param {function(?Error, ?Object)} [callback]
|
||||
* The function which will be called with the result of the API call.
|
||||
*
|
||||
* The second parameter to the callback is a [gax.Operation]{@link https://googleapis.github.io/gax-nodejs/Operation} object.
|
||||
* @returns {Promise} - The promise which resolves to an array.
|
||||
* The first element of the array is a [gax.Operation]{@link https://googleapis.github.io/gax-nodejs/Operation} object.
|
||||
* The promise has a method named "cancel" which cancels the ongoing API call.
|
||||
*
|
||||
* @example
|
||||
*
|
||||
* const dialogflow = require('dialogflow.v2');
|
||||
*
|
||||
* var client = new dialogflow.v2.AgentsClient({
|
||||
* // optional auth parameters.
|
||||
* });
|
||||
*
|
||||
* var formattedParent = client.projectPath('[PROJECT]');
|
||||
*
|
||||
* // Handle the operation using the promise pattern.
|
||||
* client.restoreAgent({parent: formattedParent})
|
||||
* .then(responses => {
|
||||
* var operation = responses[0];
|
||||
* var initialApiResponse = responses[1];
|
||||
*
|
||||
* // Operation#promise starts polling for the completion of the LRO.
|
||||
* return operation.promise();
|
||||
* })
|
||||
* .then(responses => {
|
||||
* // The final result of the operation.
|
||||
* var result = responses[0];
|
||||
*
|
||||
* // The metadata value of the completed operation.
|
||||
* var metadata = responses[1];
|
||||
*
|
||||
* // The response of the api call returning the complete operation.
|
||||
* var finalApiResponse = responses[2];
|
||||
* })
|
||||
* .catch(err => {
|
||||
* console.error(err);
|
||||
* });
|
||||
*
|
||||
* var formattedParent = client.projectPath('[PROJECT]');
|
||||
*
|
||||
* // Handle the operation using the event emitter pattern.
|
||||
* client.restoreAgent({parent: formattedParent})
|
||||
* .then(responses => {
|
||||
* var operation = responses[0];
|
||||
* var initialApiResponse = responses[1];
|
||||
*
|
||||
* // 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);
|
||||
* });
|
||||
*/
|
||||
restoreAgent(request, options, callback) {
|
||||
if (options instanceof Function && callback === undefined) {
|
||||
callback = options;
|
||||
options = {};
|
||||
}
|
||||
options = options || {};
|
||||
|
||||
return this._innerApiCalls.restoreAgent(request, options, callback);
|
||||
}
|
||||
|
||||
// --------------------
|
||||
// -- Path templates --
|
||||
// --------------------
|
||||
|
||||
/**
|
||||
* Return a fully-qualified project resource name string.
|
||||
*
|
||||
* @param {String} project
|
||||
* @returns {String}
|
||||
*/
|
||||
projectPath(project) {
|
||||
return this._pathTemplates.projectPathTemplate.render({
|
||||
project: project,
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Parse the projectName from a project resource.
|
||||
*
|
||||
* @param {String} projectName
|
||||
* A fully-qualified path representing a project resources.
|
||||
* @returns {String} - A string representing the project.
|
||||
*/
|
||||
matchProjectFromProjectName(projectName) {
|
||||
return this._pathTemplates.projectPathTemplate.match(projectName).project;
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = AgentsClient;
|
||||
56
node_modules/dialogflow/src/v2/agents_client_config.json
generated
vendored
Normal file
56
node_modules/dialogflow/src/v2/agents_client_config.json
generated
vendored
Normal file
@@ -0,0 +1,56 @@
|
||||
{
|
||||
"interfaces": {
|
||||
"google.cloud.dialogflow.v2.Agents": {
|
||||
"retry_codes": {
|
||||
"idempotent": [
|
||||
"DEADLINE_EXCEEDED",
|
||||
"UNAVAILABLE"
|
||||
],
|
||||
"non_idempotent": []
|
||||
},
|
||||
"retry_params": {
|
||||
"default": {
|
||||
"initial_retry_delay_millis": 100,
|
||||
"retry_delay_multiplier": 1.3,
|
||||
"max_retry_delay_millis": 60000,
|
||||
"initial_rpc_timeout_millis": 20000,
|
||||
"rpc_timeout_multiplier": 1.0,
|
||||
"max_rpc_timeout_millis": 20000,
|
||||
"total_timeout_millis": 600000
|
||||
}
|
||||
},
|
||||
"methods": {
|
||||
"GetAgent": {
|
||||
"timeout_millis": 60000,
|
||||
"retry_codes_name": "idempotent",
|
||||
"retry_params_name": "default"
|
||||
},
|
||||
"SearchAgents": {
|
||||
"timeout_millis": 60000,
|
||||
"retry_codes_name": "idempotent",
|
||||
"retry_params_name": "default"
|
||||
},
|
||||
"TrainAgent": {
|
||||
"timeout_millis": 60000,
|
||||
"retry_codes_name": "idempotent",
|
||||
"retry_params_name": "default"
|
||||
},
|
||||
"ExportAgent": {
|
||||
"timeout_millis": 60000,
|
||||
"retry_codes_name": "idempotent",
|
||||
"retry_params_name": "default"
|
||||
},
|
||||
"ImportAgent": {
|
||||
"timeout_millis": 60000,
|
||||
"retry_codes_name": "non_idempotent",
|
||||
"retry_params_name": "default"
|
||||
},
|
||||
"RestoreAgent": {
|
||||
"timeout_millis": 60000,
|
||||
"retry_codes_name": "idempotent",
|
||||
"retry_params_name": "default"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
692
node_modules/dialogflow/src/v2/contexts_client.js
generated
vendored
Normal file
692
node_modules/dialogflow/src/v2/contexts_client.js
generated
vendored
Normal file
@@ -0,0 +1,692 @@
|
||||
// Copyright 2018 Google LLC
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// https://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
'use strict';
|
||||
|
||||
const gapicConfig = require('./contexts_client_config');
|
||||
const gax = require('google-gax');
|
||||
const merge = require('lodash.merge');
|
||||
const path = require('path');
|
||||
|
||||
const VERSION = require('../../package.json').version;
|
||||
|
||||
/**
|
||||
* A context represents additional information included with user input or with
|
||||
* an intent returned by the Dialogflow API. Contexts are helpful for
|
||||
* differentiating user input which may be vague or have a different meaning
|
||||
* depending on additional details from your application such as user setting
|
||||
* and preferences, previous user input, where the user is in your application,
|
||||
* geographic location, and so on.
|
||||
*
|
||||
* You can include contexts as input parameters of a
|
||||
* DetectIntent (or
|
||||
* StreamingDetectIntent) request,
|
||||
* or as output contexts included in the returned intent.
|
||||
* Contexts expire when an intent is matched, after the number of `DetectIntent`
|
||||
* requests specified by the `lifespan_count` parameter, or after 10 minutes
|
||||
* if no intents are matched for a `DetectIntent` request.
|
||||
*
|
||||
* For more information about contexts, see the
|
||||
* [Dialogflow documentation](https://dialogflow.com/docs/contexts).
|
||||
*
|
||||
* @class
|
||||
* @memberof v2
|
||||
*/
|
||||
class ContextsClient {
|
||||
/**
|
||||
* Construct an instance of ContextsClient.
|
||||
*
|
||||
* @param {object} [options] - The configuration object. See the subsequent
|
||||
* parameters for more details.
|
||||
* @param {object} [options.credentials] - Credentials object.
|
||||
* @param {string} [options.credentials.client_email]
|
||||
* @param {string} [options.credentials.private_key]
|
||||
* @param {string} [options.email] - Account email address. Required when
|
||||
* using a .pem or .p12 keyFilename.
|
||||
* @param {string} [options.keyFilename] - 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.
|
||||
* @param {number} [options.port] - The port on which to connect to
|
||||
* the remote host.
|
||||
* @param {string} [options.projectId] - 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
|
||||
* {@link https://developers.google.com/identity/protocols/application-default-credentials Application Default Credentials},
|
||||
* your project ID will be detected automatically.
|
||||
* @param {function} [options.promise] - Custom promise module to use instead
|
||||
* of native Promises.
|
||||
* @param {string} [options.servicePath] - The domain name of the
|
||||
* API remote host.
|
||||
*/
|
||||
constructor(opts) {
|
||||
this._descriptors = {};
|
||||
|
||||
// Ensure that options include the service address and port.
|
||||
opts = Object.assign(
|
||||
{
|
||||
clientConfig: {},
|
||||
port: this.constructor.port,
|
||||
servicePath: this.constructor.servicePath,
|
||||
},
|
||||
opts
|
||||
);
|
||||
|
||||
// Create a `gaxGrpc` object, with any grpc-specific options
|
||||
// sent to the client.
|
||||
opts.scopes = this.constructor.scopes;
|
||||
var gaxGrpc = gax.grpc(opts);
|
||||
|
||||
// Save the auth object to the client, for use by other methods.
|
||||
this.auth = gaxGrpc.auth;
|
||||
|
||||
// Determine the client header string.
|
||||
var clientHeader = [
|
||||
`gl-node/${process.version.node}`,
|
||||
`grpc/${gaxGrpc.grpcVersion}`,
|
||||
`gax/${gax.version}`,
|
||||
`gapic/${VERSION}`,
|
||||
];
|
||||
if (opts.libName && opts.libVersion) {
|
||||
clientHeader.push(`${opts.libName}/${opts.libVersion}`);
|
||||
}
|
||||
|
||||
// Load the applicable protos.
|
||||
var protos = merge(
|
||||
{},
|
||||
gaxGrpc.loadProto(
|
||||
path.join(__dirname, '..', '..', 'protos'),
|
||||
'google/cloud/dialogflow/v2/context.proto'
|
||||
)
|
||||
);
|
||||
|
||||
// This API contains "path templates"; forward-slash-separated
|
||||
// identifiers to uniquely identify resources within the API.
|
||||
// Create useful helper objects for these.
|
||||
this._pathTemplates = {
|
||||
sessionPathTemplate: new gax.PathTemplate(
|
||||
'projects/{project}/agent/sessions/{session}'
|
||||
),
|
||||
contextPathTemplate: new gax.PathTemplate(
|
||||
'projects/{project}/agent/sessions/{session}/contexts/{context}'
|
||||
),
|
||||
};
|
||||
|
||||
// Some of the methods on this service return "paged" results,
|
||||
// (e.g. 50 results at a time, with tokens to get subsequent
|
||||
// pages). Denote the keys used for pagination and results.
|
||||
this._descriptors.page = {
|
||||
listContexts: new gax.PageDescriptor(
|
||||
'pageToken',
|
||||
'nextPageToken',
|
||||
'contexts'
|
||||
),
|
||||
};
|
||||
|
||||
// Put together the default options sent with requests.
|
||||
var defaults = gaxGrpc.constructSettings(
|
||||
'google.cloud.dialogflow.v2.Contexts',
|
||||
gapicConfig,
|
||||
opts.clientConfig,
|
||||
{'x-goog-api-client': clientHeader.join(' ')}
|
||||
);
|
||||
|
||||
// Set up a dictionary of "inner API calls"; the core implementation
|
||||
// of calling the API is handled in `google-gax`, with this code
|
||||
// merely providing the destination and request information.
|
||||
this._innerApiCalls = {};
|
||||
|
||||
// Put together the "service stub" for
|
||||
// google.cloud.dialogflow.v2.Contexts.
|
||||
var contextsStub = gaxGrpc.createStub(
|
||||
protos.google.cloud.dialogflow.v2.Contexts,
|
||||
opts
|
||||
);
|
||||
|
||||
// Iterate over each of the methods that the service provides
|
||||
// and create an API call method for each.
|
||||
var contextsStubMethods = [
|
||||
'listContexts',
|
||||
'getContext',
|
||||
'createContext',
|
||||
'updateContext',
|
||||
'deleteContext',
|
||||
'deleteAllContexts',
|
||||
];
|
||||
for (let methodName of contextsStubMethods) {
|
||||
this._innerApiCalls[methodName] = gax.createApiCall(
|
||||
contextsStub.then(
|
||||
stub =>
|
||||
function() {
|
||||
var args = Array.prototype.slice.call(arguments, 0);
|
||||
return stub[methodName].apply(stub, args);
|
||||
}
|
||||
),
|
||||
defaults[methodName],
|
||||
this._descriptors.page[methodName]
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* The DNS address for this API service.
|
||||
*/
|
||||
static get servicePath() {
|
||||
return 'dialogflow.googleapis.com';
|
||||
}
|
||||
|
||||
/**
|
||||
* The port for this API service.
|
||||
*/
|
||||
static get port() {
|
||||
return 443;
|
||||
}
|
||||
|
||||
/**
|
||||
* The scopes needed to make gRPC calls for every method defined
|
||||
* in this service.
|
||||
*/
|
||||
static get scopes() {
|
||||
return ['https://www.googleapis.com/auth/cloud-platform'];
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the project ID used by this class.
|
||||
* @param {function(Error, string)} callback - the callback to
|
||||
* be called with the current project Id.
|
||||
*/
|
||||
getProjectId(callback) {
|
||||
return this.auth.getProjectId(callback);
|
||||
}
|
||||
|
||||
// -------------------
|
||||
// -- Service calls --
|
||||
// -------------------
|
||||
|
||||
/**
|
||||
* Returns the list of all contexts in the specified session.
|
||||
*
|
||||
* @param {Object} request
|
||||
* The request object that will be sent.
|
||||
* @param {string} request.parent
|
||||
* Required. The session to list all contexts from.
|
||||
* Format: `projects/<Project ID>/agent/sessions/<Session ID>`.
|
||||
* @param {number} [request.pageSize]
|
||||
* 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.
|
||||
* @param {Object} [options]
|
||||
* Optional parameters. You can override the default settings for this call, e.g, timeout,
|
||||
* retries, paginations, etc. See [gax.CallOptions]{@link https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the details.
|
||||
* @param {function(?Error, ?Array, ?Object, ?Object)} [callback]
|
||||
* The function which will be called with the result of the API call.
|
||||
*
|
||||
* The second parameter to the callback is Array of [Context]{@link google.cloud.dialogflow.v2.Context}.
|
||||
*
|
||||
* 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 [ListContextsResponse]{@link google.cloud.dialogflow.v2.ListContextsResponse}.
|
||||
* @returns {Promise} - The promise which resolves to an array.
|
||||
* The first element of the array is Array of [Context]{@link google.cloud.dialogflow.v2.Context}.
|
||||
*
|
||||
* When autoPaginate: false is specified through options, the array has three elements.
|
||||
* The first element is Array of [Context]{@link google.cloud.dialogflow.v2.Context} 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 [ListContextsResponse]{@link google.cloud.dialogflow.v2.ListContextsResponse}.
|
||||
*
|
||||
* The promise has a method named "cancel" which cancels the ongoing API call.
|
||||
*
|
||||
* @example
|
||||
*
|
||||
* const dialogflow = require('dialogflow.v2');
|
||||
*
|
||||
* var client = new dialogflow.v2.ContextsClient({
|
||||
* // optional auth parameters.
|
||||
* });
|
||||
*
|
||||
* // Iterate over all elements.
|
||||
* var formattedParent = client.sessionPath('[PROJECT]', '[SESSION]');
|
||||
*
|
||||
* client.listContexts({parent: formattedParent})
|
||||
* .then(responses => {
|
||||
* var resources = responses[0];
|
||||
* for (let i = 0; i < resources.length; i += 1) {
|
||||
* // doThingsWith(resources[i])
|
||||
* }
|
||||
* })
|
||||
* .catch(err => {
|
||||
* console.error(err);
|
||||
* });
|
||||
*
|
||||
* // Or obtain the paged response.
|
||||
* var formattedParent = client.sessionPath('[PROJECT]', '[SESSION]');
|
||||
*
|
||||
*
|
||||
* var options = {autoPaginate: false};
|
||||
* var callback = responses => {
|
||||
* // The actual resources in a response.
|
||||
* var resources = responses[0];
|
||||
* // The next request if the response shows that there are more responses.
|
||||
* var nextRequest = responses[1];
|
||||
* // The actual response object, if necessary.
|
||||
* // var rawResponse = responses[2];
|
||||
* for (let i = 0; i < resources.length; i += 1) {
|
||||
* // doThingsWith(resources[i]);
|
||||
* }
|
||||
* if (nextRequest) {
|
||||
* // Fetch the next page.
|
||||
* return client.listContexts(nextRequest, options).then(callback);
|
||||
* }
|
||||
* }
|
||||
* client.listContexts({parent: formattedParent}, options)
|
||||
* .then(callback)
|
||||
* .catch(err => {
|
||||
* console.error(err);
|
||||
* });
|
||||
*/
|
||||
listContexts(request, options, callback) {
|
||||
if (options instanceof Function && callback === undefined) {
|
||||
callback = options;
|
||||
options = {};
|
||||
}
|
||||
options = options || {};
|
||||
|
||||
return this._innerApiCalls.listContexts(request, options, callback);
|
||||
}
|
||||
|
||||
/**
|
||||
* Equivalent to {@link listContexts}, but returns a NodeJS Stream object.
|
||||
*
|
||||
* This fetches the paged responses for {@link listContexts} 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.
|
||||
*
|
||||
* @see {@link https://nodejs.org/api/stream.html}
|
||||
*
|
||||
* @param {Object} request
|
||||
* The request object that will be sent.
|
||||
* @param {string} request.parent
|
||||
* Required. The session to list all contexts from.
|
||||
* Format: `projects/<Project ID>/agent/sessions/<Session ID>`.
|
||||
* @param {number} [request.pageSize]
|
||||
* 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.
|
||||
* @param {Object} [options]
|
||||
* Optional parameters. You can override the default settings for this call, e.g, timeout,
|
||||
* retries, paginations, etc. See [gax.CallOptions]{@link https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the details.
|
||||
* @returns {Stream}
|
||||
* An object stream which emits an object representing [Context]{@link google.cloud.dialogflow.v2.Context} on 'data' event.
|
||||
*
|
||||
* @example
|
||||
*
|
||||
* const dialogflow = require('dialogflow.v2');
|
||||
*
|
||||
* var client = new dialogflow.v2.ContextsClient({
|
||||
* // optional auth parameters.
|
||||
* });
|
||||
*
|
||||
* var formattedParent = client.sessionPath('[PROJECT]', '[SESSION]');
|
||||
* client.listContextsStream({parent: formattedParent})
|
||||
* .on('data', element => {
|
||||
* // doThingsWith(element)
|
||||
* }).on('error', err => {
|
||||
* console.log(err);
|
||||
* });
|
||||
*/
|
||||
listContextsStream(request, options) {
|
||||
options = options || {};
|
||||
|
||||
return this._descriptors.page.listContexts.createStream(
|
||||
this._innerApiCalls.listContexts,
|
||||
request,
|
||||
options
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves the specified context.
|
||||
*
|
||||
* @param {Object} request
|
||||
* The request object that will be sent.
|
||||
* @param {string} request.name
|
||||
* Required. The name of the context. Format:
|
||||
* `projects/<Project ID>/agent/sessions/<Session ID>/contexts/<Context ID>`.
|
||||
* @param {Object} [options]
|
||||
* Optional parameters. You can override the default settings for this call, e.g, timeout,
|
||||
* retries, paginations, etc. See [gax.CallOptions]{@link https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the details.
|
||||
* @param {function(?Error, ?Object)} [callback]
|
||||
* The function which will be called with the result of the API call.
|
||||
*
|
||||
* The second parameter to the callback is an object representing [Context]{@link google.cloud.dialogflow.v2.Context}.
|
||||
* @returns {Promise} - The promise which resolves to an array.
|
||||
* The first element of the array is an object representing [Context]{@link google.cloud.dialogflow.v2.Context}.
|
||||
* The promise has a method named "cancel" which cancels the ongoing API call.
|
||||
*
|
||||
* @example
|
||||
*
|
||||
* const dialogflow = require('dialogflow.v2');
|
||||
*
|
||||
* var client = new dialogflow.v2.ContextsClient({
|
||||
* // optional auth parameters.
|
||||
* });
|
||||
*
|
||||
* var formattedName = client.contextPath('[PROJECT]', '[SESSION]', '[CONTEXT]');
|
||||
* client.getContext({name: formattedName})
|
||||
* .then(responses => {
|
||||
* var response = responses[0];
|
||||
* // doThingsWith(response)
|
||||
* })
|
||||
* .catch(err => {
|
||||
* console.error(err);
|
||||
* });
|
||||
*/
|
||||
getContext(request, options, callback) {
|
||||
if (options instanceof Function && callback === undefined) {
|
||||
callback = options;
|
||||
options = {};
|
||||
}
|
||||
options = options || {};
|
||||
|
||||
return this._innerApiCalls.getContext(request, options, callback);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a context.
|
||||
*
|
||||
* @param {Object} request
|
||||
* The request object that will be sent.
|
||||
* @param {string} request.parent
|
||||
* Required. The session to create a context for.
|
||||
* Format: `projects/<Project ID>/agent/sessions/<Session ID>`.
|
||||
* @param {Object} request.context
|
||||
* Required. The context to create.
|
||||
*
|
||||
* This object should have the same structure as [Context]{@link google.cloud.dialogflow.v2.Context}
|
||||
* @param {Object} [options]
|
||||
* Optional parameters. You can override the default settings for this call, e.g, timeout,
|
||||
* retries, paginations, etc. See [gax.CallOptions]{@link https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the details.
|
||||
* @param {function(?Error, ?Object)} [callback]
|
||||
* The function which will be called with the result of the API call.
|
||||
*
|
||||
* The second parameter to the callback is an object representing [Context]{@link google.cloud.dialogflow.v2.Context}.
|
||||
* @returns {Promise} - The promise which resolves to an array.
|
||||
* The first element of the array is an object representing [Context]{@link google.cloud.dialogflow.v2.Context}.
|
||||
* The promise has a method named "cancel" which cancels the ongoing API call.
|
||||
*
|
||||
* @example
|
||||
*
|
||||
* const dialogflow = require('dialogflow.v2');
|
||||
*
|
||||
* var client = new dialogflow.v2.ContextsClient({
|
||||
* // optional auth parameters.
|
||||
* });
|
||||
*
|
||||
* var formattedParent = client.sessionPath('[PROJECT]', '[SESSION]');
|
||||
* var context = {};
|
||||
* var request = {
|
||||
* parent: formattedParent,
|
||||
* context: context,
|
||||
* };
|
||||
* client.createContext(request)
|
||||
* .then(responses => {
|
||||
* var response = responses[0];
|
||||
* // doThingsWith(response)
|
||||
* })
|
||||
* .catch(err => {
|
||||
* console.error(err);
|
||||
* });
|
||||
*/
|
||||
createContext(request, options, callback) {
|
||||
if (options instanceof Function && callback === undefined) {
|
||||
callback = options;
|
||||
options = {};
|
||||
}
|
||||
options = options || {};
|
||||
|
||||
return this._innerApiCalls.createContext(request, options, callback);
|
||||
}
|
||||
|
||||
/**
|
||||
* Updates the specified context.
|
||||
*
|
||||
* @param {Object} request
|
||||
* The request object that will be sent.
|
||||
* @param {Object} request.context
|
||||
* Required. The context to update.
|
||||
*
|
||||
* This object should have the same structure as [Context]{@link google.cloud.dialogflow.v2.Context}
|
||||
* @param {Object} [request.updateMask]
|
||||
* Optional. The mask to control which fields get updated.
|
||||
*
|
||||
* This object should have the same structure as [FieldMask]{@link google.protobuf.FieldMask}
|
||||
* @param {Object} [options]
|
||||
* Optional parameters. You can override the default settings for this call, e.g, timeout,
|
||||
* retries, paginations, etc. See [gax.CallOptions]{@link https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the details.
|
||||
* @param {function(?Error, ?Object)} [callback]
|
||||
* The function which will be called with the result of the API call.
|
||||
*
|
||||
* The second parameter to the callback is an object representing [Context]{@link google.cloud.dialogflow.v2.Context}.
|
||||
* @returns {Promise} - The promise which resolves to an array.
|
||||
* The first element of the array is an object representing [Context]{@link google.cloud.dialogflow.v2.Context}.
|
||||
* The promise has a method named "cancel" which cancels the ongoing API call.
|
||||
*
|
||||
* @example
|
||||
*
|
||||
* const dialogflow = require('dialogflow.v2');
|
||||
*
|
||||
* var client = new dialogflow.v2.ContextsClient({
|
||||
* // optional auth parameters.
|
||||
* });
|
||||
*
|
||||
* var context = {};
|
||||
* client.updateContext({context: context})
|
||||
* .then(responses => {
|
||||
* var response = responses[0];
|
||||
* // doThingsWith(response)
|
||||
* })
|
||||
* .catch(err => {
|
||||
* console.error(err);
|
||||
* });
|
||||
*/
|
||||
updateContext(request, options, callback) {
|
||||
if (options instanceof Function && callback === undefined) {
|
||||
callback = options;
|
||||
options = {};
|
||||
}
|
||||
options = options || {};
|
||||
|
||||
return this._innerApiCalls.updateContext(request, options, callback);
|
||||
}
|
||||
|
||||
/**
|
||||
* Deletes the specified context.
|
||||
*
|
||||
* @param {Object} request
|
||||
* The request object that will be sent.
|
||||
* @param {string} request.name
|
||||
* Required. The name of the context to delete. Format:
|
||||
* `projects/<Project ID>/agent/sessions/<Session ID>/contexts/<Context ID>`.
|
||||
* @param {Object} [options]
|
||||
* Optional parameters. You can override the default settings for this call, e.g, timeout,
|
||||
* retries, paginations, etc. See [gax.CallOptions]{@link https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the details.
|
||||
* @param {function(?Error)} [callback]
|
||||
* 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.v2');
|
||||
*
|
||||
* var client = new dialogflow.v2.ContextsClient({
|
||||
* // optional auth parameters.
|
||||
* });
|
||||
*
|
||||
* var formattedName = client.contextPath('[PROJECT]', '[SESSION]', '[CONTEXT]');
|
||||
* client.deleteContext({name: formattedName}).catch(err => {
|
||||
* console.error(err);
|
||||
* });
|
||||
*/
|
||||
deleteContext(request, options, callback) {
|
||||
if (options instanceof Function && callback === undefined) {
|
||||
callback = options;
|
||||
options = {};
|
||||
}
|
||||
options = options || {};
|
||||
|
||||
return this._innerApiCalls.deleteContext(request, options, callback);
|
||||
}
|
||||
|
||||
/**
|
||||
* Deletes all active contexts in the specified session.
|
||||
*
|
||||
* @param {Object} request
|
||||
* The request object that will be sent.
|
||||
* @param {string} request.parent
|
||||
* Required. The name of the session to delete all contexts from. Format:
|
||||
* `projects/<Project ID>/agent/sessions/<Session ID>`.
|
||||
* @param {Object} [options]
|
||||
* Optional parameters. You can override the default settings for this call, e.g, timeout,
|
||||
* retries, paginations, etc. See [gax.CallOptions]{@link https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the details.
|
||||
* @param {function(?Error)} [callback]
|
||||
* 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.v2');
|
||||
*
|
||||
* var client = new dialogflow.v2.ContextsClient({
|
||||
* // optional auth parameters.
|
||||
* });
|
||||
*
|
||||
* var formattedParent = client.sessionPath('[PROJECT]', '[SESSION]');
|
||||
* client.deleteAllContexts({parent: formattedParent}).catch(err => {
|
||||
* console.error(err);
|
||||
* });
|
||||
*/
|
||||
deleteAllContexts(request, options, callback) {
|
||||
if (options instanceof Function && callback === undefined) {
|
||||
callback = options;
|
||||
options = {};
|
||||
}
|
||||
options = options || {};
|
||||
|
||||
return this._innerApiCalls.deleteAllContexts(request, options, callback);
|
||||
}
|
||||
|
||||
// --------------------
|
||||
// -- Path templates --
|
||||
// --------------------
|
||||
|
||||
/**
|
||||
* Return a fully-qualified session resource name string.
|
||||
*
|
||||
* @param {String} project
|
||||
* @param {String} session
|
||||
* @returns {String}
|
||||
*/
|
||||
sessionPath(project, session) {
|
||||
return this._pathTemplates.sessionPathTemplate.render({
|
||||
project: project,
|
||||
session: session,
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Return a fully-qualified context resource name string.
|
||||
*
|
||||
* @param {String} project
|
||||
* @param {String} session
|
||||
* @param {String} context
|
||||
* @returns {String}
|
||||
*/
|
||||
contextPath(project, session, context) {
|
||||
return this._pathTemplates.contextPathTemplate.render({
|
||||
project: project,
|
||||
session: session,
|
||||
context: context,
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Parse the sessionName from a session resource.
|
||||
*
|
||||
* @param {String} sessionName
|
||||
* A fully-qualified path representing a session resources.
|
||||
* @returns {String} - A string representing the project.
|
||||
*/
|
||||
matchProjectFromSessionName(sessionName) {
|
||||
return this._pathTemplates.sessionPathTemplate.match(sessionName).project;
|
||||
}
|
||||
|
||||
/**
|
||||
* Parse the sessionName from a session resource.
|
||||
*
|
||||
* @param {String} sessionName
|
||||
* A fully-qualified path representing a session resources.
|
||||
* @returns {String} - A string representing the session.
|
||||
*/
|
||||
matchSessionFromSessionName(sessionName) {
|
||||
return this._pathTemplates.sessionPathTemplate.match(sessionName).session;
|
||||
}
|
||||
|
||||
/**
|
||||
* Parse the contextName from a context resource.
|
||||
*
|
||||
* @param {String} contextName
|
||||
* A fully-qualified path representing a context resources.
|
||||
* @returns {String} - A string representing the project.
|
||||
*/
|
||||
matchProjectFromContextName(contextName) {
|
||||
return this._pathTemplates.contextPathTemplate.match(contextName).project;
|
||||
}
|
||||
|
||||
/**
|
||||
* Parse the contextName from a context resource.
|
||||
*
|
||||
* @param {String} contextName
|
||||
* A fully-qualified path representing a context resources.
|
||||
* @returns {String} - A string representing the session.
|
||||
*/
|
||||
matchSessionFromContextName(contextName) {
|
||||
return this._pathTemplates.contextPathTemplate.match(contextName).session;
|
||||
}
|
||||
|
||||
/**
|
||||
* Parse the contextName from a context resource.
|
||||
*
|
||||
* @param {String} contextName
|
||||
* A fully-qualified path representing a context resources.
|
||||
* @returns {String} - A string representing the context.
|
||||
*/
|
||||
matchContextFromContextName(contextName) {
|
||||
return this._pathTemplates.contextPathTemplate.match(contextName).context;
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = ContextsClient;
|
||||
56
node_modules/dialogflow/src/v2/contexts_client_config.json
generated
vendored
Normal file
56
node_modules/dialogflow/src/v2/contexts_client_config.json
generated
vendored
Normal file
@@ -0,0 +1,56 @@
|
||||
{
|
||||
"interfaces": {
|
||||
"google.cloud.dialogflow.v2.Contexts": {
|
||||
"retry_codes": {
|
||||
"idempotent": [
|
||||
"DEADLINE_EXCEEDED",
|
||||
"UNAVAILABLE"
|
||||
],
|
||||
"non_idempotent": []
|
||||
},
|
||||
"retry_params": {
|
||||
"default": {
|
||||
"initial_retry_delay_millis": 100,
|
||||
"retry_delay_multiplier": 1.3,
|
||||
"max_retry_delay_millis": 60000,
|
||||
"initial_rpc_timeout_millis": 20000,
|
||||
"rpc_timeout_multiplier": 1.0,
|
||||
"max_rpc_timeout_millis": 20000,
|
||||
"total_timeout_millis": 600000
|
||||
}
|
||||
},
|
||||
"methods": {
|
||||
"ListContexts": {
|
||||
"timeout_millis": 60000,
|
||||
"retry_codes_name": "idempotent",
|
||||
"retry_params_name": "default"
|
||||
},
|
||||
"GetContext": {
|
||||
"timeout_millis": 60000,
|
||||
"retry_codes_name": "idempotent",
|
||||
"retry_params_name": "default"
|
||||
},
|
||||
"CreateContext": {
|
||||
"timeout_millis": 60000,
|
||||
"retry_codes_name": "non_idempotent",
|
||||
"retry_params_name": "default"
|
||||
},
|
||||
"UpdateContext": {
|
||||
"timeout_millis": 60000,
|
||||
"retry_codes_name": "non_idempotent",
|
||||
"retry_params_name": "default"
|
||||
},
|
||||
"DeleteContext": {
|
||||
"timeout_millis": 60000,
|
||||
"retry_codes_name": "idempotent",
|
||||
"retry_params_name": "default"
|
||||
},
|
||||
"DeleteAllContexts": {
|
||||
"timeout_millis": 60000,
|
||||
"retry_codes_name": "idempotent",
|
||||
"retry_params_name": "default"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
1338
node_modules/dialogflow/src/v2/entity_types_client.js
generated
vendored
Normal file
1338
node_modules/dialogflow/src/v2/entity_types_client.js
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
76
node_modules/dialogflow/src/v2/entity_types_client_config.json
generated
vendored
Normal file
76
node_modules/dialogflow/src/v2/entity_types_client_config.json
generated
vendored
Normal file
@@ -0,0 +1,76 @@
|
||||
{
|
||||
"interfaces": {
|
||||
"google.cloud.dialogflow.v2.EntityTypes": {
|
||||
"retry_codes": {
|
||||
"idempotent": [
|
||||
"DEADLINE_EXCEEDED",
|
||||
"UNAVAILABLE"
|
||||
],
|
||||
"non_idempotent": []
|
||||
},
|
||||
"retry_params": {
|
||||
"default": {
|
||||
"initial_retry_delay_millis": 100,
|
||||
"retry_delay_multiplier": 1.3,
|
||||
"max_retry_delay_millis": 60000,
|
||||
"initial_rpc_timeout_millis": 20000,
|
||||
"rpc_timeout_multiplier": 1.0,
|
||||
"max_rpc_timeout_millis": 20000,
|
||||
"total_timeout_millis": 600000
|
||||
}
|
||||
},
|
||||
"methods": {
|
||||
"ListEntityTypes": {
|
||||
"timeout_millis": 60000,
|
||||
"retry_codes_name": "idempotent",
|
||||
"retry_params_name": "default"
|
||||
},
|
||||
"GetEntityType": {
|
||||
"timeout_millis": 60000,
|
||||
"retry_codes_name": "idempotent",
|
||||
"retry_params_name": "default"
|
||||
},
|
||||
"CreateEntityType": {
|
||||
"timeout_millis": 60000,
|
||||
"retry_codes_name": "non_idempotent",
|
||||
"retry_params_name": "default"
|
||||
},
|
||||
"UpdateEntityType": {
|
||||
"timeout_millis": 60000,
|
||||
"retry_codes_name": "non_idempotent",
|
||||
"retry_params_name": "default"
|
||||
},
|
||||
"DeleteEntityType": {
|
||||
"timeout_millis": 60000,
|
||||
"retry_codes_name": "idempotent",
|
||||
"retry_params_name": "default"
|
||||
},
|
||||
"BatchUpdateEntityTypes": {
|
||||
"timeout_millis": 60000,
|
||||
"retry_codes_name": "non_idempotent",
|
||||
"retry_params_name": "default"
|
||||
},
|
||||
"BatchDeleteEntityTypes": {
|
||||
"timeout_millis": 60000,
|
||||
"retry_codes_name": "idempotent",
|
||||
"retry_params_name": "default"
|
||||
},
|
||||
"BatchCreateEntities": {
|
||||
"timeout_millis": 60000,
|
||||
"retry_codes_name": "non_idempotent",
|
||||
"retry_params_name": "default"
|
||||
},
|
||||
"BatchUpdateEntities": {
|
||||
"timeout_millis": 60000,
|
||||
"retry_codes_name": "non_idempotent",
|
||||
"retry_params_name": "default"
|
||||
},
|
||||
"BatchDeleteEntities": {
|
||||
"timeout_millis": 60000,
|
||||
"retry_codes_name": "idempotent",
|
||||
"retry_params_name": "default"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
29
node_modules/dialogflow/src/v2/index.js
generated
vendored
Normal file
29
node_modules/dialogflow/src/v2/index.js
generated
vendored
Normal file
@@ -0,0 +1,29 @@
|
||||
// Copyright 2018 Google LLC
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// https://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
'use strict';
|
||||
|
||||
const AgentsClient = require('./agents_client');
|
||||
const ContextsClient = require('./contexts_client');
|
||||
const EntityTypesClient = require('./entity_types_client');
|
||||
const IntentsClient = require('./intents_client');
|
||||
const SessionEntityTypesClient = require('./session_entity_types_client');
|
||||
const SessionsClient = require('./sessions_client');
|
||||
|
||||
module.exports.AgentsClient = AgentsClient;
|
||||
module.exports.ContextsClient = ContextsClient;
|
||||
module.exports.EntityTypesClient = EntityTypesClient;
|
||||
module.exports.IntentsClient = IntentsClient;
|
||||
module.exports.SessionEntityTypesClient = SessionEntityTypesClient;
|
||||
module.exports.SessionsClient = SessionsClient;
|
||||
1018
node_modules/dialogflow/src/v2/intents_client.js
generated
vendored
Normal file
1018
node_modules/dialogflow/src/v2/intents_client.js
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
61
node_modules/dialogflow/src/v2/intents_client_config.json
generated
vendored
Normal file
61
node_modules/dialogflow/src/v2/intents_client_config.json
generated
vendored
Normal file
@@ -0,0 +1,61 @@
|
||||
{
|
||||
"interfaces": {
|
||||
"google.cloud.dialogflow.v2.Intents": {
|
||||
"retry_codes": {
|
||||
"idempotent": [
|
||||
"DEADLINE_EXCEEDED",
|
||||
"UNAVAILABLE"
|
||||
],
|
||||
"non_idempotent": []
|
||||
},
|
||||
"retry_params": {
|
||||
"default": {
|
||||
"initial_retry_delay_millis": 100,
|
||||
"retry_delay_multiplier": 1.3,
|
||||
"max_retry_delay_millis": 60000,
|
||||
"initial_rpc_timeout_millis": 20000,
|
||||
"rpc_timeout_multiplier": 1.0,
|
||||
"max_rpc_timeout_millis": 20000,
|
||||
"total_timeout_millis": 600000
|
||||
}
|
||||
},
|
||||
"methods": {
|
||||
"ListIntents": {
|
||||
"timeout_millis": 60000,
|
||||
"retry_codes_name": "idempotent",
|
||||
"retry_params_name": "default"
|
||||
},
|
||||
"GetIntent": {
|
||||
"timeout_millis": 60000,
|
||||
"retry_codes_name": "idempotent",
|
||||
"retry_params_name": "default"
|
||||
},
|
||||
"CreateIntent": {
|
||||
"timeout_millis": 60000,
|
||||
"retry_codes_name": "non_idempotent",
|
||||
"retry_params_name": "default"
|
||||
},
|
||||
"UpdateIntent": {
|
||||
"timeout_millis": 60000,
|
||||
"retry_codes_name": "non_idempotent",
|
||||
"retry_params_name": "default"
|
||||
},
|
||||
"DeleteIntent": {
|
||||
"timeout_millis": 60000,
|
||||
"retry_codes_name": "idempotent",
|
||||
"retry_params_name": "default"
|
||||
},
|
||||
"BatchUpdateIntents": {
|
||||
"timeout_millis": 60000,
|
||||
"retry_codes_name": "non_idempotent",
|
||||
"retry_params_name": "default"
|
||||
},
|
||||
"BatchDeleteIntents": {
|
||||
"timeout_millis": 60000,
|
||||
"retry_codes_name": "idempotent",
|
||||
"retry_params_name": "default"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
673
node_modules/dialogflow/src/v2/session_entity_types_client.js
generated
vendored
Normal file
673
node_modules/dialogflow/src/v2/session_entity_types_client.js
generated
vendored
Normal file
@@ -0,0 +1,673 @@
|
||||
// Copyright 2018 Google LLC
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// https://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
'use strict';
|
||||
|
||||
const gapicConfig = require('./session_entity_types_client_config');
|
||||
const gax = require('google-gax');
|
||||
const merge = require('lodash.merge');
|
||||
const path = require('path');
|
||||
|
||||
const VERSION = require('../../package.json').version;
|
||||
|
||||
/**
|
||||
* Entities are extracted from user input and represent parameters that are
|
||||
* meaningful to your application. For example, a date range, a proper name
|
||||
* such as a geographic location or landmark, and so on. Entities represent
|
||||
* actionable data for your application.
|
||||
*
|
||||
* Session entity types are referred to as **User** entity types and are
|
||||
* entities that are built for an individual user such as
|
||||
* favorites, preferences, playlists, and so on. You can redefine a session
|
||||
* entity type at the session level.
|
||||
*
|
||||
* For more information about entity types, see the
|
||||
* [Dialogflow documentation](https://dialogflow.com/docs/entities).
|
||||
*
|
||||
* @class
|
||||
* @memberof v2
|
||||
*/
|
||||
class SessionEntityTypesClient {
|
||||
/**
|
||||
* Construct an instance of SessionEntityTypesClient.
|
||||
*
|
||||
* @param {object} [options] - The configuration object. See the subsequent
|
||||
* parameters for more details.
|
||||
* @param {object} [options.credentials] - Credentials object.
|
||||
* @param {string} [options.credentials.client_email]
|
||||
* @param {string} [options.credentials.private_key]
|
||||
* @param {string} [options.email] - Account email address. Required when
|
||||
* using a .pem or .p12 keyFilename.
|
||||
* @param {string} [options.keyFilename] - 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.
|
||||
* @param {number} [options.port] - The port on which to connect to
|
||||
* the remote host.
|
||||
* @param {string} [options.projectId] - 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
|
||||
* {@link https://developers.google.com/identity/protocols/application-default-credentials Application Default Credentials},
|
||||
* your project ID will be detected automatically.
|
||||
* @param {function} [options.promise] - Custom promise module to use instead
|
||||
* of native Promises.
|
||||
* @param {string} [options.servicePath] - The domain name of the
|
||||
* API remote host.
|
||||
*/
|
||||
constructor(opts) {
|
||||
this._descriptors = {};
|
||||
|
||||
// Ensure that options include the service address and port.
|
||||
opts = Object.assign(
|
||||
{
|
||||
clientConfig: {},
|
||||
port: this.constructor.port,
|
||||
servicePath: this.constructor.servicePath,
|
||||
},
|
||||
opts
|
||||
);
|
||||
|
||||
// Create a `gaxGrpc` object, with any grpc-specific options
|
||||
// sent to the client.
|
||||
opts.scopes = this.constructor.scopes;
|
||||
var gaxGrpc = gax.grpc(opts);
|
||||
|
||||
// Save the auth object to the client, for use by other methods.
|
||||
this.auth = gaxGrpc.auth;
|
||||
|
||||
// Determine the client header string.
|
||||
var clientHeader = [
|
||||
`gl-node/${process.version.node}`,
|
||||
`grpc/${gaxGrpc.grpcVersion}`,
|
||||
`gax/${gax.version}`,
|
||||
`gapic/${VERSION}`,
|
||||
];
|
||||
if (opts.libName && opts.libVersion) {
|
||||
clientHeader.push(`${opts.libName}/${opts.libVersion}`);
|
||||
}
|
||||
|
||||
// Load the applicable protos.
|
||||
var protos = merge(
|
||||
{},
|
||||
gaxGrpc.loadProto(
|
||||
path.join(__dirname, '..', '..', 'protos'),
|
||||
'google/cloud/dialogflow/v2/session_entity_type.proto'
|
||||
)
|
||||
);
|
||||
|
||||
// This API contains "path templates"; forward-slash-separated
|
||||
// identifiers to uniquely identify resources within the API.
|
||||
// Create useful helper objects for these.
|
||||
this._pathTemplates = {
|
||||
sessionPathTemplate: new gax.PathTemplate(
|
||||
'projects/{project}/agent/sessions/{session}'
|
||||
),
|
||||
sessionEntityTypePathTemplate: new gax.PathTemplate(
|
||||
'projects/{project}/agent/sessions/{session}/entityTypes/{entity_type}'
|
||||
),
|
||||
};
|
||||
|
||||
// Some of the methods on this service return "paged" results,
|
||||
// (e.g. 50 results at a time, with tokens to get subsequent
|
||||
// pages). Denote the keys used for pagination and results.
|
||||
this._descriptors.page = {
|
||||
listSessionEntityTypes: new gax.PageDescriptor(
|
||||
'pageToken',
|
||||
'nextPageToken',
|
||||
'sessionEntityTypes'
|
||||
),
|
||||
};
|
||||
|
||||
// Put together the default options sent with requests.
|
||||
var defaults = gaxGrpc.constructSettings(
|
||||
'google.cloud.dialogflow.v2.SessionEntityTypes',
|
||||
gapicConfig,
|
||||
opts.clientConfig,
|
||||
{'x-goog-api-client': clientHeader.join(' ')}
|
||||
);
|
||||
|
||||
// Set up a dictionary of "inner API calls"; the core implementation
|
||||
// of calling the API is handled in `google-gax`, with this code
|
||||
// merely providing the destination and request information.
|
||||
this._innerApiCalls = {};
|
||||
|
||||
// Put together the "service stub" for
|
||||
// google.cloud.dialogflow.v2.SessionEntityTypes.
|
||||
var sessionEntityTypesStub = gaxGrpc.createStub(
|
||||
protos.google.cloud.dialogflow.v2.SessionEntityTypes,
|
||||
opts
|
||||
);
|
||||
|
||||
// Iterate over each of the methods that the service provides
|
||||
// and create an API call method for each.
|
||||
var sessionEntityTypesStubMethods = [
|
||||
'listSessionEntityTypes',
|
||||
'getSessionEntityType',
|
||||
'createSessionEntityType',
|
||||
'updateSessionEntityType',
|
||||
'deleteSessionEntityType',
|
||||
];
|
||||
for (let methodName of sessionEntityTypesStubMethods) {
|
||||
this._innerApiCalls[methodName] = gax.createApiCall(
|
||||
sessionEntityTypesStub.then(
|
||||
stub =>
|
||||
function() {
|
||||
var args = Array.prototype.slice.call(arguments, 0);
|
||||
return stub[methodName].apply(stub, args);
|
||||
}
|
||||
),
|
||||
defaults[methodName],
|
||||
this._descriptors.page[methodName]
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* The DNS address for this API service.
|
||||
*/
|
||||
static get servicePath() {
|
||||
return 'dialogflow.googleapis.com';
|
||||
}
|
||||
|
||||
/**
|
||||
* The port for this API service.
|
||||
*/
|
||||
static get port() {
|
||||
return 443;
|
||||
}
|
||||
|
||||
/**
|
||||
* The scopes needed to make gRPC calls for every method defined
|
||||
* in this service.
|
||||
*/
|
||||
static get scopes() {
|
||||
return ['https://www.googleapis.com/auth/cloud-platform'];
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the project ID used by this class.
|
||||
* @param {function(Error, string)} callback - the callback to
|
||||
* be called with the current project Id.
|
||||
*/
|
||||
getProjectId(callback) {
|
||||
return this.auth.getProjectId(callback);
|
||||
}
|
||||
|
||||
// -------------------
|
||||
// -- Service calls --
|
||||
// -------------------
|
||||
|
||||
/**
|
||||
* Returns the list of all session entity types in the specified session.
|
||||
*
|
||||
* @param {Object} request
|
||||
* The request object that will be sent.
|
||||
* @param {string} request.parent
|
||||
* Required. The session to list all session entity types from.
|
||||
* Format: `projects/<Project ID>/agent/sessions/<Session ID>`.
|
||||
* @param {number} [request.pageSize]
|
||||
* 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.
|
||||
* @param {Object} [options]
|
||||
* Optional parameters. You can override the default settings for this call, e.g, timeout,
|
||||
* retries, paginations, etc. See [gax.CallOptions]{@link https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the details.
|
||||
* @param {function(?Error, ?Array, ?Object, ?Object)} [callback]
|
||||
* The function which will be called with the result of the API call.
|
||||
*
|
||||
* The second parameter to the callback is Array of [SessionEntityType]{@link google.cloud.dialogflow.v2.SessionEntityType}.
|
||||
*
|
||||
* 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 [ListSessionEntityTypesResponse]{@link google.cloud.dialogflow.v2.ListSessionEntityTypesResponse}.
|
||||
* @returns {Promise} - The promise which resolves to an array.
|
||||
* The first element of the array is Array of [SessionEntityType]{@link google.cloud.dialogflow.v2.SessionEntityType}.
|
||||
*
|
||||
* When autoPaginate: false is specified through options, the array has three elements.
|
||||
* The first element is Array of [SessionEntityType]{@link google.cloud.dialogflow.v2.SessionEntityType} 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 [ListSessionEntityTypesResponse]{@link google.cloud.dialogflow.v2.ListSessionEntityTypesResponse}.
|
||||
*
|
||||
* The promise has a method named "cancel" which cancels the ongoing API call.
|
||||
*
|
||||
* @example
|
||||
*
|
||||
* const dialogflow = require('dialogflow.v2');
|
||||
*
|
||||
* var client = new dialogflow.v2.SessionEntityTypesClient({
|
||||
* // optional auth parameters.
|
||||
* });
|
||||
*
|
||||
* // Iterate over all elements.
|
||||
* var formattedParent = client.sessionPath('[PROJECT]', '[SESSION]');
|
||||
*
|
||||
* client.listSessionEntityTypes({parent: formattedParent})
|
||||
* .then(responses => {
|
||||
* var resources = responses[0];
|
||||
* for (let i = 0; i < resources.length; i += 1) {
|
||||
* // doThingsWith(resources[i])
|
||||
* }
|
||||
* })
|
||||
* .catch(err => {
|
||||
* console.error(err);
|
||||
* });
|
||||
*
|
||||
* // Or obtain the paged response.
|
||||
* var formattedParent = client.sessionPath('[PROJECT]', '[SESSION]');
|
||||
*
|
||||
*
|
||||
* var options = {autoPaginate: false};
|
||||
* var callback = responses => {
|
||||
* // The actual resources in a response.
|
||||
* var resources = responses[0];
|
||||
* // The next request if the response shows that there are more responses.
|
||||
* var nextRequest = responses[1];
|
||||
* // The actual response object, if necessary.
|
||||
* // var rawResponse = responses[2];
|
||||
* for (let i = 0; i < resources.length; i += 1) {
|
||||
* // doThingsWith(resources[i]);
|
||||
* }
|
||||
* if (nextRequest) {
|
||||
* // Fetch the next page.
|
||||
* return client.listSessionEntityTypes(nextRequest, options).then(callback);
|
||||
* }
|
||||
* }
|
||||
* client.listSessionEntityTypes({parent: formattedParent}, options)
|
||||
* .then(callback)
|
||||
* .catch(err => {
|
||||
* console.error(err);
|
||||
* });
|
||||
*/
|
||||
listSessionEntityTypes(request, options, callback) {
|
||||
if (options instanceof Function && callback === undefined) {
|
||||
callback = options;
|
||||
options = {};
|
||||
}
|
||||
options = options || {};
|
||||
|
||||
return this._innerApiCalls.listSessionEntityTypes(
|
||||
request,
|
||||
options,
|
||||
callback
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Equivalent to {@link listSessionEntityTypes}, but returns a NodeJS Stream object.
|
||||
*
|
||||
* This fetches the paged responses for {@link listSessionEntityTypes} 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.
|
||||
*
|
||||
* @see {@link https://nodejs.org/api/stream.html}
|
||||
*
|
||||
* @param {Object} request
|
||||
* The request object that will be sent.
|
||||
* @param {string} request.parent
|
||||
* Required. The session to list all session entity types from.
|
||||
* Format: `projects/<Project ID>/agent/sessions/<Session ID>`.
|
||||
* @param {number} [request.pageSize]
|
||||
* 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.
|
||||
* @param {Object} [options]
|
||||
* Optional parameters. You can override the default settings for this call, e.g, timeout,
|
||||
* retries, paginations, etc. See [gax.CallOptions]{@link https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the details.
|
||||
* @returns {Stream}
|
||||
* An object stream which emits an object representing [SessionEntityType]{@link google.cloud.dialogflow.v2.SessionEntityType} on 'data' event.
|
||||
*
|
||||
* @example
|
||||
*
|
||||
* const dialogflow = require('dialogflow.v2');
|
||||
*
|
||||
* var client = new dialogflow.v2.SessionEntityTypesClient({
|
||||
* // optional auth parameters.
|
||||
* });
|
||||
*
|
||||
* var formattedParent = client.sessionPath('[PROJECT]', '[SESSION]');
|
||||
* client.listSessionEntityTypesStream({parent: formattedParent})
|
||||
* .on('data', element => {
|
||||
* // doThingsWith(element)
|
||||
* }).on('error', err => {
|
||||
* console.log(err);
|
||||
* });
|
||||
*/
|
||||
listSessionEntityTypesStream(request, options) {
|
||||
options = options || {};
|
||||
|
||||
return this._descriptors.page.listSessionEntityTypes.createStream(
|
||||
this._innerApiCalls.listSessionEntityTypes,
|
||||
request,
|
||||
options
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves the specified session entity type.
|
||||
*
|
||||
* @param {Object} request
|
||||
* The request object that will be sent.
|
||||
* @param {string} request.name
|
||||
* Required. The name of the session entity type. Format:
|
||||
* `projects/<Project ID>/agent/sessions/<Session ID>/entityTypes/<Entity Type
|
||||
* Display Name>`.
|
||||
* @param {Object} [options]
|
||||
* Optional parameters. You can override the default settings for this call, e.g, timeout,
|
||||
* retries, paginations, etc. See [gax.CallOptions]{@link https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the details.
|
||||
* @param {function(?Error, ?Object)} [callback]
|
||||
* The function which will be called with the result of the API call.
|
||||
*
|
||||
* The second parameter to the callback is an object representing [SessionEntityType]{@link google.cloud.dialogflow.v2.SessionEntityType}.
|
||||
* @returns {Promise} - The promise which resolves to an array.
|
||||
* The first element of the array is an object representing [SessionEntityType]{@link google.cloud.dialogflow.v2.SessionEntityType}.
|
||||
* The promise has a method named "cancel" which cancels the ongoing API call.
|
||||
*
|
||||
* @example
|
||||
*
|
||||
* const dialogflow = require('dialogflow.v2');
|
||||
*
|
||||
* var client = new dialogflow.v2.SessionEntityTypesClient({
|
||||
* // optional auth parameters.
|
||||
* });
|
||||
*
|
||||
* var formattedName = client.sessionEntityTypePath('[PROJECT]', '[SESSION]', '[ENTITY_TYPE]');
|
||||
* client.getSessionEntityType({name: formattedName})
|
||||
* .then(responses => {
|
||||
* var response = responses[0];
|
||||
* // doThingsWith(response)
|
||||
* })
|
||||
* .catch(err => {
|
||||
* console.error(err);
|
||||
* });
|
||||
*/
|
||||
getSessionEntityType(request, options, callback) {
|
||||
if (options instanceof Function && callback === undefined) {
|
||||
callback = options;
|
||||
options = {};
|
||||
}
|
||||
options = options || {};
|
||||
|
||||
return this._innerApiCalls.getSessionEntityType(request, options, callback);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a session entity type.
|
||||
*
|
||||
* @param {Object} request
|
||||
* The request object that will be sent.
|
||||
* @param {string} request.parent
|
||||
* Required. The session to create a session entity type for.
|
||||
* Format: `projects/<Project ID>/agent/sessions/<Session ID>`.
|
||||
* @param {Object} request.sessionEntityType
|
||||
* Required. The session entity type to create.
|
||||
*
|
||||
* This object should have the same structure as [SessionEntityType]{@link google.cloud.dialogflow.v2.SessionEntityType}
|
||||
* @param {Object} [options]
|
||||
* Optional parameters. You can override the default settings for this call, e.g, timeout,
|
||||
* retries, paginations, etc. See [gax.CallOptions]{@link https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the details.
|
||||
* @param {function(?Error, ?Object)} [callback]
|
||||
* The function which will be called with the result of the API call.
|
||||
*
|
||||
* The second parameter to the callback is an object representing [SessionEntityType]{@link google.cloud.dialogflow.v2.SessionEntityType}.
|
||||
* @returns {Promise} - The promise which resolves to an array.
|
||||
* The first element of the array is an object representing [SessionEntityType]{@link google.cloud.dialogflow.v2.SessionEntityType}.
|
||||
* The promise has a method named "cancel" which cancels the ongoing API call.
|
||||
*
|
||||
* @example
|
||||
*
|
||||
* const dialogflow = require('dialogflow.v2');
|
||||
*
|
||||
* var client = new dialogflow.v2.SessionEntityTypesClient({
|
||||
* // optional auth parameters.
|
||||
* });
|
||||
*
|
||||
* var formattedParent = client.sessionPath('[PROJECT]', '[SESSION]');
|
||||
* var sessionEntityType = {};
|
||||
* var request = {
|
||||
* parent: formattedParent,
|
||||
* sessionEntityType: sessionEntityType,
|
||||
* };
|
||||
* client.createSessionEntityType(request)
|
||||
* .then(responses => {
|
||||
* var response = responses[0];
|
||||
* // doThingsWith(response)
|
||||
* })
|
||||
* .catch(err => {
|
||||
* console.error(err);
|
||||
* });
|
||||
*/
|
||||
createSessionEntityType(request, options, callback) {
|
||||
if (options instanceof Function && callback === undefined) {
|
||||
callback = options;
|
||||
options = {};
|
||||
}
|
||||
options = options || {};
|
||||
|
||||
return this._innerApiCalls.createSessionEntityType(
|
||||
request,
|
||||
options,
|
||||
callback
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Updates the specified session entity type.
|
||||
*
|
||||
* @param {Object} request
|
||||
* The request object that will be sent.
|
||||
* @param {Object} request.sessionEntityType
|
||||
* Required. The entity type to update. Format:
|
||||
* `projects/<Project ID>/agent/sessions/<Session ID>/entityTypes/<Entity Type
|
||||
* Display Name>`.
|
||||
*
|
||||
* This object should have the same structure as [SessionEntityType]{@link google.cloud.dialogflow.v2.SessionEntityType}
|
||||
* @param {Object} [request.updateMask]
|
||||
* Optional. The mask to control which fields get updated.
|
||||
*
|
||||
* This object should have the same structure as [FieldMask]{@link google.protobuf.FieldMask}
|
||||
* @param {Object} [options]
|
||||
* Optional parameters. You can override the default settings for this call, e.g, timeout,
|
||||
* retries, paginations, etc. See [gax.CallOptions]{@link https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the details.
|
||||
* @param {function(?Error, ?Object)} [callback]
|
||||
* The function which will be called with the result of the API call.
|
||||
*
|
||||
* The second parameter to the callback is an object representing [SessionEntityType]{@link google.cloud.dialogflow.v2.SessionEntityType}.
|
||||
* @returns {Promise} - The promise which resolves to an array.
|
||||
* The first element of the array is an object representing [SessionEntityType]{@link google.cloud.dialogflow.v2.SessionEntityType}.
|
||||
* The promise has a method named "cancel" which cancels the ongoing API call.
|
||||
*
|
||||
* @example
|
||||
*
|
||||
* const dialogflow = require('dialogflow.v2');
|
||||
*
|
||||
* var client = new dialogflow.v2.SessionEntityTypesClient({
|
||||
* // optional auth parameters.
|
||||
* });
|
||||
*
|
||||
* var sessionEntityType = {};
|
||||
* client.updateSessionEntityType({sessionEntityType: sessionEntityType})
|
||||
* .then(responses => {
|
||||
* var response = responses[0];
|
||||
* // doThingsWith(response)
|
||||
* })
|
||||
* .catch(err => {
|
||||
* console.error(err);
|
||||
* });
|
||||
*/
|
||||
updateSessionEntityType(request, options, callback) {
|
||||
if (options instanceof Function && callback === undefined) {
|
||||
callback = options;
|
||||
options = {};
|
||||
}
|
||||
options = options || {};
|
||||
|
||||
return this._innerApiCalls.updateSessionEntityType(
|
||||
request,
|
||||
options,
|
||||
callback
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Deletes the specified session entity type.
|
||||
*
|
||||
* @param {Object} request
|
||||
* The request object that will be sent.
|
||||
* @param {string} request.name
|
||||
* Required. The name of the entity type to delete. Format:
|
||||
* `projects/<Project ID>/agent/sessions/<Session ID>/entityTypes/<Entity Type
|
||||
* Display Name>`.
|
||||
* @param {Object} [options]
|
||||
* Optional parameters. You can override the default settings for this call, e.g, timeout,
|
||||
* retries, paginations, etc. See [gax.CallOptions]{@link https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the details.
|
||||
* @param {function(?Error)} [callback]
|
||||
* 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.v2');
|
||||
*
|
||||
* var client = new dialogflow.v2.SessionEntityTypesClient({
|
||||
* // optional auth parameters.
|
||||
* });
|
||||
*
|
||||
* var formattedName = client.sessionEntityTypePath('[PROJECT]', '[SESSION]', '[ENTITY_TYPE]');
|
||||
* client.deleteSessionEntityType({name: formattedName}).catch(err => {
|
||||
* console.error(err);
|
||||
* });
|
||||
*/
|
||||
deleteSessionEntityType(request, options, callback) {
|
||||
if (options instanceof Function && callback === undefined) {
|
||||
callback = options;
|
||||
options = {};
|
||||
}
|
||||
options = options || {};
|
||||
|
||||
return this._innerApiCalls.deleteSessionEntityType(
|
||||
request,
|
||||
options,
|
||||
callback
|
||||
);
|
||||
}
|
||||
|
||||
// --------------------
|
||||
// -- Path templates --
|
||||
// --------------------
|
||||
|
||||
/**
|
||||
* Return a fully-qualified session resource name string.
|
||||
*
|
||||
* @param {String} project
|
||||
* @param {String} session
|
||||
* @returns {String}
|
||||
*/
|
||||
sessionPath(project, session) {
|
||||
return this._pathTemplates.sessionPathTemplate.render({
|
||||
project: project,
|
||||
session: session,
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Return a fully-qualified session_entity_type resource name string.
|
||||
*
|
||||
* @param {String} project
|
||||
* @param {String} session
|
||||
* @param {String} entityType
|
||||
* @returns {String}
|
||||
*/
|
||||
sessionEntityTypePath(project, session, entityType) {
|
||||
return this._pathTemplates.sessionEntityTypePathTemplate.render({
|
||||
project: project,
|
||||
session: session,
|
||||
entity_type: entityType,
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Parse the sessionName from a session resource.
|
||||
*
|
||||
* @param {String} sessionName
|
||||
* A fully-qualified path representing a session resources.
|
||||
* @returns {String} - A string representing the project.
|
||||
*/
|
||||
matchProjectFromSessionName(sessionName) {
|
||||
return this._pathTemplates.sessionPathTemplate.match(sessionName).project;
|
||||
}
|
||||
|
||||
/**
|
||||
* Parse the sessionName from a session resource.
|
||||
*
|
||||
* @param {String} sessionName
|
||||
* A fully-qualified path representing a session resources.
|
||||
* @returns {String} - A string representing the session.
|
||||
*/
|
||||
matchSessionFromSessionName(sessionName) {
|
||||
return this._pathTemplates.sessionPathTemplate.match(sessionName).session;
|
||||
}
|
||||
|
||||
/**
|
||||
* Parse the sessionEntityTypeName from a session_entity_type resource.
|
||||
*
|
||||
* @param {String} sessionEntityTypeName
|
||||
* A fully-qualified path representing a session_entity_type resources.
|
||||
* @returns {String} - A string representing the project.
|
||||
*/
|
||||
matchProjectFromSessionEntityTypeName(sessionEntityTypeName) {
|
||||
return this._pathTemplates.sessionEntityTypePathTemplate.match(
|
||||
sessionEntityTypeName
|
||||
).project;
|
||||
}
|
||||
|
||||
/**
|
||||
* Parse the sessionEntityTypeName from a session_entity_type resource.
|
||||
*
|
||||
* @param {String} sessionEntityTypeName
|
||||
* A fully-qualified path representing a session_entity_type resources.
|
||||
* @returns {String} - A string representing the session.
|
||||
*/
|
||||
matchSessionFromSessionEntityTypeName(sessionEntityTypeName) {
|
||||
return this._pathTemplates.sessionEntityTypePathTemplate.match(
|
||||
sessionEntityTypeName
|
||||
).session;
|
||||
}
|
||||
|
||||
/**
|
||||
* Parse the sessionEntityTypeName from a session_entity_type resource.
|
||||
*
|
||||
* @param {String} sessionEntityTypeName
|
||||
* A fully-qualified path representing a session_entity_type resources.
|
||||
* @returns {String} - A string representing the entity_type.
|
||||
*/
|
||||
matchEntityTypeFromSessionEntityTypeName(sessionEntityTypeName) {
|
||||
return this._pathTemplates.sessionEntityTypePathTemplate.match(
|
||||
sessionEntityTypeName
|
||||
).entity_type;
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = SessionEntityTypesClient;
|
||||
51
node_modules/dialogflow/src/v2/session_entity_types_client_config.json
generated
vendored
Normal file
51
node_modules/dialogflow/src/v2/session_entity_types_client_config.json
generated
vendored
Normal file
@@ -0,0 +1,51 @@
|
||||
{
|
||||
"interfaces": {
|
||||
"google.cloud.dialogflow.v2.SessionEntityTypes": {
|
||||
"retry_codes": {
|
||||
"idempotent": [
|
||||
"DEADLINE_EXCEEDED",
|
||||
"UNAVAILABLE"
|
||||
],
|
||||
"non_idempotent": []
|
||||
},
|
||||
"retry_params": {
|
||||
"default": {
|
||||
"initial_retry_delay_millis": 100,
|
||||
"retry_delay_multiplier": 1.3,
|
||||
"max_retry_delay_millis": 60000,
|
||||
"initial_rpc_timeout_millis": 20000,
|
||||
"rpc_timeout_multiplier": 1.0,
|
||||
"max_rpc_timeout_millis": 20000,
|
||||
"total_timeout_millis": 600000
|
||||
}
|
||||
},
|
||||
"methods": {
|
||||
"ListSessionEntityTypes": {
|
||||
"timeout_millis": 60000,
|
||||
"retry_codes_name": "idempotent",
|
||||
"retry_params_name": "default"
|
||||
},
|
||||
"GetSessionEntityType": {
|
||||
"timeout_millis": 60000,
|
||||
"retry_codes_name": "idempotent",
|
||||
"retry_params_name": "default"
|
||||
},
|
||||
"CreateSessionEntityType": {
|
||||
"timeout_millis": 60000,
|
||||
"retry_codes_name": "non_idempotent",
|
||||
"retry_params_name": "default"
|
||||
},
|
||||
"UpdateSessionEntityType": {
|
||||
"timeout_millis": 60000,
|
||||
"retry_codes_name": "non_idempotent",
|
||||
"retry_params_name": "default"
|
||||
},
|
||||
"DeleteSessionEntityType": {
|
||||
"timeout_millis": 60000,
|
||||
"retry_codes_name": "idempotent",
|
||||
"retry_params_name": "default"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
349
node_modules/dialogflow/src/v2/sessions_client.js
generated
vendored
Normal file
349
node_modules/dialogflow/src/v2/sessions_client.js
generated
vendored
Normal file
@@ -0,0 +1,349 @@
|
||||
// Copyright 2018 Google LLC
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// https://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
'use strict';
|
||||
|
||||
const gapicConfig = require('./sessions_client_config');
|
||||
const gax = require('google-gax');
|
||||
const merge = require('lodash.merge');
|
||||
const path = require('path');
|
||||
|
||||
const VERSION = require('../../package.json').version;
|
||||
|
||||
/**
|
||||
* A session represents an interaction with a user. You retrieve user input
|
||||
* and pass it to the DetectIntent (or
|
||||
* StreamingDetectIntent) method to determine
|
||||
* user intent and respond.
|
||||
*
|
||||
* @class
|
||||
* @memberof v2
|
||||
*/
|
||||
class SessionsClient {
|
||||
/**
|
||||
* Construct an instance of SessionsClient.
|
||||
*
|
||||
* @param {object} [options] - The configuration object. See the subsequent
|
||||
* parameters for more details.
|
||||
* @param {object} [options.credentials] - Credentials object.
|
||||
* @param {string} [options.credentials.client_email]
|
||||
* @param {string} [options.credentials.private_key]
|
||||
* @param {string} [options.email] - Account email address. Required when
|
||||
* using a .pem or .p12 keyFilename.
|
||||
* @param {string} [options.keyFilename] - 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.
|
||||
* @param {number} [options.port] - The port on which to connect to
|
||||
* the remote host.
|
||||
* @param {string} [options.projectId] - 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
|
||||
* {@link https://developers.google.com/identity/protocols/application-default-credentials Application Default Credentials},
|
||||
* your project ID will be detected automatically.
|
||||
* @param {function} [options.promise] - Custom promise module to use instead
|
||||
* of native Promises.
|
||||
* @param {string} [options.servicePath] - The domain name of the
|
||||
* API remote host.
|
||||
*/
|
||||
constructor(opts) {
|
||||
this._descriptors = {};
|
||||
|
||||
// Ensure that options include the service address and port.
|
||||
opts = Object.assign(
|
||||
{
|
||||
clientConfig: {},
|
||||
port: this.constructor.port,
|
||||
servicePath: this.constructor.servicePath,
|
||||
},
|
||||
opts
|
||||
);
|
||||
|
||||
// Create a `gaxGrpc` object, with any grpc-specific options
|
||||
// sent to the client.
|
||||
opts.scopes = this.constructor.scopes;
|
||||
var gaxGrpc = gax.grpc(opts);
|
||||
|
||||
// Save the auth object to the client, for use by other methods.
|
||||
this.auth = gaxGrpc.auth;
|
||||
|
||||
// Determine the client header string.
|
||||
var clientHeader = [
|
||||
`gl-node/${process.version.node}`,
|
||||
`grpc/${gaxGrpc.grpcVersion}`,
|
||||
`gax/${gax.version}`,
|
||||
`gapic/${VERSION}`,
|
||||
];
|
||||
if (opts.libName && opts.libVersion) {
|
||||
clientHeader.push(`${opts.libName}/${opts.libVersion}`);
|
||||
}
|
||||
|
||||
// Load the applicable protos.
|
||||
var protos = merge(
|
||||
{},
|
||||
gaxGrpc.loadProto(
|
||||
path.join(__dirname, '..', '..', 'protos'),
|
||||
'google/cloud/dialogflow/v2/session.proto'
|
||||
)
|
||||
);
|
||||
|
||||
// This API contains "path templates"; forward-slash-separated
|
||||
// identifiers to uniquely identify resources within the API.
|
||||
// Create useful helper objects for these.
|
||||
this._pathTemplates = {
|
||||
sessionPathTemplate: new gax.PathTemplate(
|
||||
'projects/{project}/agent/sessions/{session}'
|
||||
),
|
||||
};
|
||||
|
||||
// Some of the methods on this service provide streaming responses.
|
||||
// Provide descriptors for these.
|
||||
this._descriptors.stream = {
|
||||
streamingDetectIntent: new gax.StreamDescriptor(
|
||||
gax.StreamType.BIDI_STREAMING
|
||||
),
|
||||
};
|
||||
|
||||
// Put together the default options sent with requests.
|
||||
var defaults = gaxGrpc.constructSettings(
|
||||
'google.cloud.dialogflow.v2.Sessions',
|
||||
gapicConfig,
|
||||
opts.clientConfig,
|
||||
{'x-goog-api-client': clientHeader.join(' ')}
|
||||
);
|
||||
|
||||
// Set up a dictionary of "inner API calls"; the core implementation
|
||||
// of calling the API is handled in `google-gax`, with this code
|
||||
// merely providing the destination and request information.
|
||||
this._innerApiCalls = {};
|
||||
|
||||
// Put together the "service stub" for
|
||||
// google.cloud.dialogflow.v2.Sessions.
|
||||
var sessionsStub = gaxGrpc.createStub(
|
||||
protos.google.cloud.dialogflow.v2.Sessions,
|
||||
opts
|
||||
);
|
||||
|
||||
// Iterate over each of the methods that the service provides
|
||||
// and create an API call method for each.
|
||||
var sessionsStubMethods = ['detectIntent', 'streamingDetectIntent'];
|
||||
for (let methodName of sessionsStubMethods) {
|
||||
this._innerApiCalls[methodName] = gax.createApiCall(
|
||||
sessionsStub.then(
|
||||
stub =>
|
||||
function() {
|
||||
var args = Array.prototype.slice.call(arguments, 0);
|
||||
return stub[methodName].apply(stub, args);
|
||||
}
|
||||
),
|
||||
defaults[methodName],
|
||||
this._descriptors.stream[methodName]
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* The DNS address for this API service.
|
||||
*/
|
||||
static get servicePath() {
|
||||
return 'dialogflow.googleapis.com';
|
||||
}
|
||||
|
||||
/**
|
||||
* The port for this API service.
|
||||
*/
|
||||
static get port() {
|
||||
return 443;
|
||||
}
|
||||
|
||||
/**
|
||||
* The scopes needed to make gRPC calls for every method defined
|
||||
* in this service.
|
||||
*/
|
||||
static get scopes() {
|
||||
return ['https://www.googleapis.com/auth/cloud-platform'];
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the project ID used by this class.
|
||||
* @param {function(Error, string)} callback - the callback to
|
||||
* be called with the current project Id.
|
||||
*/
|
||||
getProjectId(callback) {
|
||||
return this.auth.getProjectId(callback);
|
||||
}
|
||||
|
||||
// -------------------
|
||||
// -- Service calls --
|
||||
// -------------------
|
||||
|
||||
/**
|
||||
* Processes a natural language query and returns structured, actionable data
|
||||
* as a result. This method is not idempotent, because it may cause contexts
|
||||
* and session entity types to be updated, which in turn might affect
|
||||
* results of future queries.
|
||||
*
|
||||
* @param {Object} request
|
||||
* The request object that will be sent.
|
||||
* @param {string} request.session
|
||||
* Required. The name of the session this query is sent to. Format:
|
||||
* `projects/<Project ID>/agent/sessions/<Session ID>`. It's up to the API
|
||||
* caller to choose an appropriate session ID. It can be a random number or
|
||||
* some type of user identifier (preferably hashed). The length of the session
|
||||
* ID must not exceed 36 bytes.
|
||||
* @param {Object} request.queryInput
|
||||
* Required. The input specification. It can be set to:
|
||||
*
|
||||
* 1. an audio config
|
||||
* which instructs the speech recognizer how to process the speech audio,
|
||||
*
|
||||
* 2. a conversational query in the form of text, or
|
||||
*
|
||||
* 3. an event that specifies which intent to trigger.
|
||||
*
|
||||
* This object should have the same structure as [QueryInput]{@link google.cloud.dialogflow.v2.QueryInput}
|
||||
* @param {Object} [request.queryParams]
|
||||
* Optional. The parameters of this query.
|
||||
*
|
||||
* This object should have the same structure as [QueryParameters]{@link google.cloud.dialogflow.v2.QueryParameters}
|
||||
* @param {string} [request.inputAudio]
|
||||
* Optional. The natural language speech audio to be processed. This field
|
||||
* should be populated iff `query_input` is set to an input audio config.
|
||||
* A single request can contain up to 1 minute of speech audio data.
|
||||
* @param {Object} [options]
|
||||
* Optional parameters. You can override the default settings for this call, e.g, timeout,
|
||||
* retries, paginations, etc. See [gax.CallOptions]{@link https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the details.
|
||||
* @param {function(?Error, ?Object)} [callback]
|
||||
* The function which will be called with the result of the API call.
|
||||
*
|
||||
* The second parameter to the callback is an object representing [DetectIntentResponse]{@link google.cloud.dialogflow.v2.DetectIntentResponse}.
|
||||
* @returns {Promise} - The promise which resolves to an array.
|
||||
* The first element of the array is an object representing [DetectIntentResponse]{@link google.cloud.dialogflow.v2.DetectIntentResponse}.
|
||||
* The promise has a method named "cancel" which cancels the ongoing API call.
|
||||
*
|
||||
* @example
|
||||
*
|
||||
* const dialogflow = require('dialogflow.v2');
|
||||
*
|
||||
* var client = new dialogflow.v2.SessionsClient({
|
||||
* // optional auth parameters.
|
||||
* });
|
||||
*
|
||||
* var formattedSession = client.sessionPath('[PROJECT]', '[SESSION]');
|
||||
* var queryInput = {};
|
||||
* var request = {
|
||||
* session: formattedSession,
|
||||
* queryInput: queryInput,
|
||||
* };
|
||||
* client.detectIntent(request)
|
||||
* .then(responses => {
|
||||
* var response = responses[0];
|
||||
* // doThingsWith(response)
|
||||
* })
|
||||
* .catch(err => {
|
||||
* console.error(err);
|
||||
* });
|
||||
*/
|
||||
detectIntent(request, options, callback) {
|
||||
if (options instanceof Function && callback === undefined) {
|
||||
callback = options;
|
||||
options = {};
|
||||
}
|
||||
options = options || {};
|
||||
|
||||
return this._innerApiCalls.detectIntent(request, options, callback);
|
||||
}
|
||||
|
||||
/**
|
||||
* Processes a natural language query in audio format in a streaming fashion
|
||||
* and returns structured, actionable data as a result. This method is only
|
||||
* available via the gRPC API (not REST).
|
||||
*
|
||||
* @param {Object} [options]
|
||||
* Optional parameters. You can override the default settings for this call, e.g, timeout,
|
||||
* retries, paginations, etc. See [gax.CallOptions]{@link https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the details.
|
||||
* @returns {Stream}
|
||||
* An object stream which is both readable and writable. It accepts objects
|
||||
* representing [StreamingDetectIntentRequest]{@link google.cloud.dialogflow.v2.StreamingDetectIntentRequest} for write() method, and
|
||||
* will emit objects representing [StreamingDetectIntentResponse]{@link google.cloud.dialogflow.v2.StreamingDetectIntentResponse} on 'data' event asynchronously.
|
||||
*
|
||||
* @example
|
||||
*
|
||||
* const dialogflow = require('dialogflow.v2');
|
||||
*
|
||||
* var client = new dialogflow.v2.SessionsClient({
|
||||
* // optional auth parameters.
|
||||
* });
|
||||
*
|
||||
* var stream = client.streamingDetectIntent().on('data', response => {
|
||||
* // doThingsWith(response)
|
||||
* });
|
||||
* var session = '';
|
||||
* var queryInput = {};
|
||||
* var request = {
|
||||
* session: session,
|
||||
* queryInput: queryInput,
|
||||
* };
|
||||
* // Write request objects.
|
||||
* stream.write(request);
|
||||
*/
|
||||
streamingDetectIntent(options) {
|
||||
options = options || {};
|
||||
|
||||
return this._innerApiCalls.streamingDetectIntent(options);
|
||||
}
|
||||
|
||||
// --------------------
|
||||
// -- Path templates --
|
||||
// --------------------
|
||||
|
||||
/**
|
||||
* Return a fully-qualified session resource name string.
|
||||
*
|
||||
* @param {String} project
|
||||
* @param {String} session
|
||||
* @returns {String}
|
||||
*/
|
||||
sessionPath(project, session) {
|
||||
return this._pathTemplates.sessionPathTemplate.render({
|
||||
project: project,
|
||||
session: session,
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Parse the sessionName from a session resource.
|
||||
*
|
||||
* @param {String} sessionName
|
||||
* A fully-qualified path representing a session resources.
|
||||
* @returns {String} - A string representing the project.
|
||||
*/
|
||||
matchProjectFromSessionName(sessionName) {
|
||||
return this._pathTemplates.sessionPathTemplate.match(sessionName).project;
|
||||
}
|
||||
|
||||
/**
|
||||
* Parse the sessionName from a session resource.
|
||||
*
|
||||
* @param {String} sessionName
|
||||
* A fully-qualified path representing a session resources.
|
||||
* @returns {String} - A string representing the session.
|
||||
*/
|
||||
matchSessionFromSessionName(sessionName) {
|
||||
return this._pathTemplates.sessionPathTemplate.match(sessionName).session;
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = SessionsClient;
|
||||
36
node_modules/dialogflow/src/v2/sessions_client_config.json
generated
vendored
Normal file
36
node_modules/dialogflow/src/v2/sessions_client_config.json
generated
vendored
Normal file
@@ -0,0 +1,36 @@
|
||||
{
|
||||
"interfaces": {
|
||||
"google.cloud.dialogflow.v2.Sessions": {
|
||||
"retry_codes": {
|
||||
"idempotent": [
|
||||
"DEADLINE_EXCEEDED",
|
||||
"UNAVAILABLE"
|
||||
],
|
||||
"non_idempotent": []
|
||||
},
|
||||
"retry_params": {
|
||||
"default": {
|
||||
"initial_retry_delay_millis": 100,
|
||||
"retry_delay_multiplier": 1.3,
|
||||
"max_retry_delay_millis": 60000,
|
||||
"initial_rpc_timeout_millis": 20000,
|
||||
"rpc_timeout_multiplier": 1.0,
|
||||
"max_rpc_timeout_millis": 20000,
|
||||
"total_timeout_millis": 600000
|
||||
}
|
||||
},
|
||||
"methods": {
|
||||
"DetectIntent": {
|
||||
"timeout_millis": 220000,
|
||||
"retry_codes_name": "non_idempotent",
|
||||
"retry_params_name": "default"
|
||||
},
|
||||
"StreamingDetectIntent": {
|
||||
"timeout_millis": 220000,
|
||||
"retry_codes_name": "non_idempotent",
|
||||
"retry_params_name": "default"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
935
node_modules/dialogflow/src/v2beta1/agents_client.js
generated
vendored
Normal file
935
node_modules/dialogflow/src/v2beta1/agents_client.js
generated
vendored
Normal file
@@ -0,0 +1,935 @@
|
||||
// Copyright 2018 Google LLC
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// https://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
'use strict';
|
||||
|
||||
const gapicConfig = require('./agents_client_config');
|
||||
const gax = require('google-gax');
|
||||
const merge = require('lodash.merge');
|
||||
const path = require('path');
|
||||
const protobuf = require('protobufjs');
|
||||
|
||||
const VERSION = require('../../package.json').version;
|
||||
|
||||
/**
|
||||
* Agents are best described as Natural Language Understanding (NLU) modules
|
||||
* that transform user requests into actionable data. You can include agents
|
||||
* in your app, product, or service to determine user intent and respond to the
|
||||
* user in a natural way.
|
||||
*
|
||||
* After you create an agent, you can add Intents, Contexts,
|
||||
* Entity Types, Webhooks, and so on to
|
||||
* manage the flow of a conversation and match user input to predefined intents
|
||||
* and actions.
|
||||
*
|
||||
* You can create an agent using both Dialogflow Standard Edition and
|
||||
* Dialogflow Enterprise Edition. For details, see
|
||||
* [Dialogflow Editions](https://cloud.google.com/dialogflow-enterprise/docs/editions).
|
||||
*
|
||||
* You can save your agent for backup or versioning by exporting the agent by
|
||||
* using the ExportAgent method. You can import a saved
|
||||
* agent by using the ImportAgent method.
|
||||
*
|
||||
* Dialogflow provides several
|
||||
* [prebuilt agents](https://dialogflow.com/docs/prebuilt-agents) for common
|
||||
* conversation scenarios such as determining a date and time, converting
|
||||
* currency, and so on.
|
||||
*
|
||||
* For more information about agents, see the
|
||||
* [Dialogflow documentation](https://dialogflow.com/docs/agents).
|
||||
*
|
||||
* @class
|
||||
* @memberof v2beta1
|
||||
*/
|
||||
class AgentsClient {
|
||||
/**
|
||||
* Construct an instance of AgentsClient.
|
||||
*
|
||||
* @param {object} [options] - The configuration object. See the subsequent
|
||||
* parameters for more details.
|
||||
* @param {object} [options.credentials] - Credentials object.
|
||||
* @param {string} [options.credentials.client_email]
|
||||
* @param {string} [options.credentials.private_key]
|
||||
* @param {string} [options.email] - Account email address. Required when
|
||||
* using a .pem or .p12 keyFilename.
|
||||
* @param {string} [options.keyFilename] - 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.
|
||||
* @param {number} [options.port] - The port on which to connect to
|
||||
* the remote host.
|
||||
* @param {string} [options.projectId] - 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
|
||||
* {@link https://developers.google.com/identity/protocols/application-default-credentials Application Default Credentials},
|
||||
* your project ID will be detected automatically.
|
||||
* @param {function} [options.promise] - Custom promise module to use instead
|
||||
* of native Promises.
|
||||
* @param {string} [options.servicePath] - The domain name of the
|
||||
* API remote host.
|
||||
*/
|
||||
constructor(opts) {
|
||||
this._descriptors = {};
|
||||
|
||||
// Ensure that options include the service address and port.
|
||||
opts = Object.assign(
|
||||
{
|
||||
clientConfig: {},
|
||||
port: this.constructor.port,
|
||||
servicePath: this.constructor.servicePath,
|
||||
},
|
||||
opts
|
||||
);
|
||||
|
||||
// Create a `gaxGrpc` object, with any grpc-specific options
|
||||
// sent to the client.
|
||||
opts.scopes = this.constructor.scopes;
|
||||
var gaxGrpc = gax.grpc(opts);
|
||||
|
||||
// Save the auth object to the client, for use by other methods.
|
||||
this.auth = gaxGrpc.auth;
|
||||
|
||||
// Determine the client header string.
|
||||
var clientHeader = [
|
||||
`gl-node/${process.version.node}`,
|
||||
`grpc/${gaxGrpc.grpcVersion}`,
|
||||
`gax/${gax.version}`,
|
||||
`gapic/${VERSION}`,
|
||||
];
|
||||
if (opts.libName && opts.libVersion) {
|
||||
clientHeader.push(`${opts.libName}/${opts.libVersion}`);
|
||||
}
|
||||
|
||||
// Load the applicable protos.
|
||||
var protos = merge(
|
||||
{},
|
||||
gaxGrpc.loadProto(
|
||||
path.join(__dirname, '..', '..', 'protos'),
|
||||
'google/cloud/dialogflow/v2beta1/agent.proto'
|
||||
)
|
||||
);
|
||||
|
||||
// This API contains "path templates"; forward-slash-separated
|
||||
// identifiers to uniquely identify resources within the API.
|
||||
// Create useful helper objects for these.
|
||||
this._pathTemplates = {
|
||||
projectPathTemplate: new gax.PathTemplate('projects/{project}'),
|
||||
};
|
||||
|
||||
// Some of the methods on this service return "paged" results,
|
||||
// (e.g. 50 results at a time, with tokens to get subsequent
|
||||
// pages). Denote the keys used for pagination and results.
|
||||
this._descriptors.page = {
|
||||
searchAgents: new gax.PageDescriptor(
|
||||
'pageToken',
|
||||
'nextPageToken',
|
||||
'agents'
|
||||
),
|
||||
};
|
||||
var protoFilesRoot = new gax.grpc.GoogleProtoFilesRoot();
|
||||
protoFilesRoot = protobuf.loadSync(
|
||||
path.join(
|
||||
__dirname,
|
||||
'..',
|
||||
'..',
|
||||
'protos',
|
||||
'google/cloud/dialogflow/v2beta1/agent.proto'
|
||||
),
|
||||
protoFilesRoot
|
||||
);
|
||||
|
||||
// This API contains "long-running operations", which return a
|
||||
// an Operation object that allows for tracking of the operation,
|
||||
// rather than holding a request open.
|
||||
this.operationsClient = new gax.lro({
|
||||
auth: gaxGrpc.auth,
|
||||
grpc: gaxGrpc.grpc,
|
||||
}).operationsClient(opts);
|
||||
|
||||
var trainAgentResponse = protoFilesRoot.lookup('google.protobuf.Empty');
|
||||
var trainAgentMetadata = protoFilesRoot.lookup('google.protobuf.Struct');
|
||||
var exportAgentResponse = protoFilesRoot.lookup(
|
||||
'google.cloud.dialogflow.v2beta1.ExportAgentResponse'
|
||||
);
|
||||
var exportAgentMetadata = protoFilesRoot.lookup('google.protobuf.Struct');
|
||||
var importAgentResponse = protoFilesRoot.lookup('google.protobuf.Empty');
|
||||
var importAgentMetadata = protoFilesRoot.lookup('google.protobuf.Struct');
|
||||
var restoreAgentResponse = protoFilesRoot.lookup('google.protobuf.Empty');
|
||||
var restoreAgentMetadata = protoFilesRoot.lookup('google.protobuf.Struct');
|
||||
|
||||
this._descriptors.longrunning = {
|
||||
trainAgent: new gax.LongrunningDescriptor(
|
||||
this.operationsClient,
|
||||
trainAgentResponse.decode.bind(trainAgentResponse),
|
||||
trainAgentMetadata.decode.bind(trainAgentMetadata)
|
||||
),
|
||||
exportAgent: new gax.LongrunningDescriptor(
|
||||
this.operationsClient,
|
||||
exportAgentResponse.decode.bind(exportAgentResponse),
|
||||
exportAgentMetadata.decode.bind(exportAgentMetadata)
|
||||
),
|
||||
importAgent: new gax.LongrunningDescriptor(
|
||||
this.operationsClient,
|
||||
importAgentResponse.decode.bind(importAgentResponse),
|
||||
importAgentMetadata.decode.bind(importAgentMetadata)
|
||||
),
|
||||
restoreAgent: new gax.LongrunningDescriptor(
|
||||
this.operationsClient,
|
||||
restoreAgentResponse.decode.bind(restoreAgentResponse),
|
||||
restoreAgentMetadata.decode.bind(restoreAgentMetadata)
|
||||
),
|
||||
};
|
||||
|
||||
// Put together the default options sent with requests.
|
||||
var defaults = gaxGrpc.constructSettings(
|
||||
'google.cloud.dialogflow.v2beta1.Agents',
|
||||
gapicConfig,
|
||||
opts.clientConfig,
|
||||
{'x-goog-api-client': clientHeader.join(' ')}
|
||||
);
|
||||
|
||||
// Set up a dictionary of "inner API calls"; the core implementation
|
||||
// of calling the API is handled in `google-gax`, with this code
|
||||
// merely providing the destination and request information.
|
||||
this._innerApiCalls = {};
|
||||
|
||||
// Put together the "service stub" for
|
||||
// google.cloud.dialogflow.v2beta1.Agents.
|
||||
var agentsStub = gaxGrpc.createStub(
|
||||
protos.google.cloud.dialogflow.v2beta1.Agents,
|
||||
opts
|
||||
);
|
||||
|
||||
// Iterate over each of the methods that the service provides
|
||||
// and create an API call method for each.
|
||||
var agentsStubMethods = [
|
||||
'getAgent',
|
||||
'searchAgents',
|
||||
'trainAgent',
|
||||
'exportAgent',
|
||||
'importAgent',
|
||||
'restoreAgent',
|
||||
];
|
||||
for (let methodName of agentsStubMethods) {
|
||||
this._innerApiCalls[methodName] = gax.createApiCall(
|
||||
agentsStub.then(
|
||||
stub =>
|
||||
function() {
|
||||
var args = Array.prototype.slice.call(arguments, 0);
|
||||
return stub[methodName].apply(stub, args);
|
||||
}
|
||||
),
|
||||
defaults[methodName],
|
||||
this._descriptors.page[methodName] ||
|
||||
this._descriptors.longrunning[methodName]
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* The DNS address for this API service.
|
||||
*/
|
||||
static get servicePath() {
|
||||
return 'dialogflow.googleapis.com';
|
||||
}
|
||||
|
||||
/**
|
||||
* The port for this API service.
|
||||
*/
|
||||
static get port() {
|
||||
return 443;
|
||||
}
|
||||
|
||||
/**
|
||||
* The scopes needed to make gRPC calls for every method defined
|
||||
* in this service.
|
||||
*/
|
||||
static get scopes() {
|
||||
return ['https://www.googleapis.com/auth/cloud-platform'];
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the project ID used by this class.
|
||||
* @param {function(Error, string)} callback - the callback to
|
||||
* be called with the current project Id.
|
||||
*/
|
||||
getProjectId(callback) {
|
||||
return this.auth.getProjectId(callback);
|
||||
}
|
||||
|
||||
// -------------------
|
||||
// -- Service calls --
|
||||
// -------------------
|
||||
|
||||
/**
|
||||
* Retrieves the specified agent.
|
||||
*
|
||||
* @param {Object} request
|
||||
* The request object that will be sent.
|
||||
* @param {string} request.parent
|
||||
* Required. The project that the agent to fetch is associated with.
|
||||
* Format: `projects/<Project ID>`.
|
||||
* @param {Object} [options]
|
||||
* Optional parameters. You can override the default settings for this call, e.g, timeout,
|
||||
* retries, paginations, etc. See [gax.CallOptions]{@link https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the details.
|
||||
* @param {function(?Error, ?Object)} [callback]
|
||||
* The function which will be called with the result of the API call.
|
||||
*
|
||||
* The second parameter to the callback is an object representing [Agent]{@link google.cloud.dialogflow.v2beta1.Agent}.
|
||||
* @returns {Promise} - The promise which resolves to an array.
|
||||
* The first element of the array is an object representing [Agent]{@link google.cloud.dialogflow.v2beta1.Agent}.
|
||||
* The promise has a method named "cancel" which cancels the ongoing API call.
|
||||
*
|
||||
* @example
|
||||
*
|
||||
* const dialogflow = require('dialogflow.v2beta1');
|
||||
*
|
||||
* var client = new dialogflow.v2beta1.AgentsClient({
|
||||
* // optional auth parameters.
|
||||
* });
|
||||
*
|
||||
* var formattedParent = client.projectPath('[PROJECT]');
|
||||
* client.getAgent({parent: formattedParent})
|
||||
* .then(responses => {
|
||||
* var response = responses[0];
|
||||
* // doThingsWith(response)
|
||||
* })
|
||||
* .catch(err => {
|
||||
* console.error(err);
|
||||
* });
|
||||
*/
|
||||
getAgent(request, options, callback) {
|
||||
if (options instanceof Function && callback === undefined) {
|
||||
callback = options;
|
||||
options = {};
|
||||
}
|
||||
options = options || {};
|
||||
|
||||
return this._innerApiCalls.getAgent(request, options, callback);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the list of agents.
|
||||
*
|
||||
* Since there is at most one conversational agent per project, this method is
|
||||
* useful primarily for listing all agents across projects the caller has
|
||||
* access to. One can achieve that with a wildcard project collection id "-".
|
||||
* Refer to [List
|
||||
* Sub-Collections](https://cloud.google.com/apis/design/design_patterns#list_sub-collections).
|
||||
*
|
||||
* @param {Object} request
|
||||
* The request object that will be sent.
|
||||
* @param {string} request.parent
|
||||
* Required. The project to list agents from.
|
||||
* Format: `projects/<Project ID or '-'>`.
|
||||
* @param {number} [request.pageSize]
|
||||
* 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.
|
||||
* @param {Object} [options]
|
||||
* Optional parameters. You can override the default settings for this call, e.g, timeout,
|
||||
* retries, paginations, etc. See [gax.CallOptions]{@link https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the details.
|
||||
* @param {function(?Error, ?Array, ?Object, ?Object)} [callback]
|
||||
* The function which will be called with the result of the API call.
|
||||
*
|
||||
* The second parameter to the callback is Array of [Agent]{@link google.cloud.dialogflow.v2beta1.Agent}.
|
||||
*
|
||||
* 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 [SearchAgentsResponse]{@link google.cloud.dialogflow.v2beta1.SearchAgentsResponse}.
|
||||
* @returns {Promise} - The promise which resolves to an array.
|
||||
* The first element of the array is Array of [Agent]{@link google.cloud.dialogflow.v2beta1.Agent}.
|
||||
*
|
||||
* When autoPaginate: false is specified through options, the array has three elements.
|
||||
* The first element is Array of [Agent]{@link google.cloud.dialogflow.v2beta1.Agent} 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 [SearchAgentsResponse]{@link google.cloud.dialogflow.v2beta1.SearchAgentsResponse}.
|
||||
*
|
||||
* The promise has a method named "cancel" which cancels the ongoing API call.
|
||||
*
|
||||
* @example
|
||||
*
|
||||
* const dialogflow = require('dialogflow.v2beta1');
|
||||
*
|
||||
* var client = new dialogflow.v2beta1.AgentsClient({
|
||||
* // optional auth parameters.
|
||||
* });
|
||||
*
|
||||
* // Iterate over all elements.
|
||||
* var formattedParent = client.projectPath('[PROJECT]');
|
||||
*
|
||||
* client.searchAgents({parent: formattedParent})
|
||||
* .then(responses => {
|
||||
* var resources = responses[0];
|
||||
* for (let i = 0; i < resources.length; i += 1) {
|
||||
* // doThingsWith(resources[i])
|
||||
* }
|
||||
* })
|
||||
* .catch(err => {
|
||||
* console.error(err);
|
||||
* });
|
||||
*
|
||||
* // Or obtain the paged response.
|
||||
* var formattedParent = client.projectPath('[PROJECT]');
|
||||
*
|
||||
*
|
||||
* var options = {autoPaginate: false};
|
||||
* var callback = responses => {
|
||||
* // The actual resources in a response.
|
||||
* var resources = responses[0];
|
||||
* // The next request if the response shows that there are more responses.
|
||||
* var nextRequest = responses[1];
|
||||
* // The actual response object, if necessary.
|
||||
* // var rawResponse = responses[2];
|
||||
* for (let i = 0; i < resources.length; i += 1) {
|
||||
* // doThingsWith(resources[i]);
|
||||
* }
|
||||
* if (nextRequest) {
|
||||
* // Fetch the next page.
|
||||
* return client.searchAgents(nextRequest, options).then(callback);
|
||||
* }
|
||||
* }
|
||||
* client.searchAgents({parent: formattedParent}, options)
|
||||
* .then(callback)
|
||||
* .catch(err => {
|
||||
* console.error(err);
|
||||
* });
|
||||
*/
|
||||
searchAgents(request, options, callback) {
|
||||
if (options instanceof Function && callback === undefined) {
|
||||
callback = options;
|
||||
options = {};
|
||||
}
|
||||
options = options || {};
|
||||
|
||||
return this._innerApiCalls.searchAgents(request, options, callback);
|
||||
}
|
||||
|
||||
/**
|
||||
* Equivalent to {@link searchAgents}, but returns a NodeJS Stream object.
|
||||
*
|
||||
* This fetches the paged responses for {@link searchAgents} 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.
|
||||
*
|
||||
* @see {@link https://nodejs.org/api/stream.html}
|
||||
*
|
||||
* @param {Object} request
|
||||
* The request object that will be sent.
|
||||
* @param {string} request.parent
|
||||
* Required. The project to list agents from.
|
||||
* Format: `projects/<Project ID or '-'>`.
|
||||
* @param {number} [request.pageSize]
|
||||
* 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.
|
||||
* @param {Object} [options]
|
||||
* Optional parameters. You can override the default settings for this call, e.g, timeout,
|
||||
* retries, paginations, etc. See [gax.CallOptions]{@link https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the details.
|
||||
* @returns {Stream}
|
||||
* An object stream which emits an object representing [Agent]{@link google.cloud.dialogflow.v2beta1.Agent} on 'data' event.
|
||||
*
|
||||
* @example
|
||||
*
|
||||
* const dialogflow = require('dialogflow.v2beta1');
|
||||
*
|
||||
* var client = new dialogflow.v2beta1.AgentsClient({
|
||||
* // optional auth parameters.
|
||||
* });
|
||||
*
|
||||
* var formattedParent = client.projectPath('[PROJECT]');
|
||||
* client.searchAgentsStream({parent: formattedParent})
|
||||
* .on('data', element => {
|
||||
* // doThingsWith(element)
|
||||
* }).on('error', err => {
|
||||
* console.log(err);
|
||||
* });
|
||||
*/
|
||||
searchAgentsStream(request, options) {
|
||||
options = options || {};
|
||||
|
||||
return this._descriptors.page.searchAgents.createStream(
|
||||
this._innerApiCalls.searchAgents,
|
||||
request,
|
||||
options
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Trains the specified agent.
|
||||
*
|
||||
*
|
||||
* Operation <response: google.protobuf.Empty,
|
||||
* metadata: google.protobuf.Struct>
|
||||
*
|
||||
* @param {Object} request
|
||||
* The request object that will be sent.
|
||||
* @param {string} request.parent
|
||||
* Required. The project that the agent to train is associated with.
|
||||
* Format: `projects/<Project ID>`.
|
||||
* @param {Object} [options]
|
||||
* Optional parameters. You can override the default settings for this call, e.g, timeout,
|
||||
* retries, paginations, etc. See [gax.CallOptions]{@link https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the details.
|
||||
* @param {function(?Error, ?Object)} [callback]
|
||||
* The function which will be called with the result of the API call.
|
||||
*
|
||||
* The second parameter to the callback is a [gax.Operation]{@link https://googleapis.github.io/gax-nodejs/Operation} object.
|
||||
* @returns {Promise} - The promise which resolves to an array.
|
||||
* The first element of the array is a [gax.Operation]{@link https://googleapis.github.io/gax-nodejs/Operation} object.
|
||||
* The promise has a method named "cancel" which cancels the ongoing API call.
|
||||
*
|
||||
* @example
|
||||
*
|
||||
* const dialogflow = require('dialogflow.v2beta1');
|
||||
*
|
||||
* var client = new dialogflow.v2beta1.AgentsClient({
|
||||
* // optional auth parameters.
|
||||
* });
|
||||
*
|
||||
* var formattedParent = client.projectPath('[PROJECT]');
|
||||
*
|
||||
* // Handle the operation using the promise pattern.
|
||||
* client.trainAgent({parent: formattedParent})
|
||||
* .then(responses => {
|
||||
* var operation = responses[0];
|
||||
* var initialApiResponse = responses[1];
|
||||
*
|
||||
* // Operation#promise starts polling for the completion of the LRO.
|
||||
* return operation.promise();
|
||||
* })
|
||||
* .then(responses => {
|
||||
* // The final result of the operation.
|
||||
* var result = responses[0];
|
||||
*
|
||||
* // The metadata value of the completed operation.
|
||||
* var metadata = responses[1];
|
||||
*
|
||||
* // The response of the api call returning the complete operation.
|
||||
* var finalApiResponse = responses[2];
|
||||
* })
|
||||
* .catch(err => {
|
||||
* console.error(err);
|
||||
* });
|
||||
*
|
||||
* var formattedParent = client.projectPath('[PROJECT]');
|
||||
*
|
||||
* // Handle the operation using the event emitter pattern.
|
||||
* client.trainAgent({parent: formattedParent})
|
||||
* .then(responses => {
|
||||
* var operation = responses[0];
|
||||
* var initialApiResponse = responses[1];
|
||||
*
|
||||
* // 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);
|
||||
* });
|
||||
*/
|
||||
trainAgent(request, options, callback) {
|
||||
if (options instanceof Function && callback === undefined) {
|
||||
callback = options;
|
||||
options = {};
|
||||
}
|
||||
options = options || {};
|
||||
|
||||
return this._innerApiCalls.trainAgent(request, options, callback);
|
||||
}
|
||||
|
||||
/**
|
||||
* Exports the specified agent to a ZIP file.
|
||||
*
|
||||
*
|
||||
* Operation <response: ExportAgentResponse,
|
||||
* metadata: google.protobuf.Struct>
|
||||
*
|
||||
* @param {Object} request
|
||||
* The request object that will be sent.
|
||||
* @param {string} request.parent
|
||||
* Required. The project that the agent to export is associated with.
|
||||
* Format: `projects/<Project ID>`.
|
||||
* @param {string} [request.agentUri]
|
||||
* Optional. The Google Cloud Storage URI to export the agent to.
|
||||
* Note: The URI must start with
|
||||
* "gs://". If left unspecified, the serialized agent is returned inline.
|
||||
* @param {Object} [options]
|
||||
* Optional parameters. You can override the default settings for this call, e.g, timeout,
|
||||
* retries, paginations, etc. See [gax.CallOptions]{@link https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the details.
|
||||
* @param {function(?Error, ?Object)} [callback]
|
||||
* The function which will be called with the result of the API call.
|
||||
*
|
||||
* The second parameter to the callback is a [gax.Operation]{@link https://googleapis.github.io/gax-nodejs/Operation} object.
|
||||
* @returns {Promise} - The promise which resolves to an array.
|
||||
* The first element of the array is a [gax.Operation]{@link https://googleapis.github.io/gax-nodejs/Operation} object.
|
||||
* The promise has a method named "cancel" which cancels the ongoing API call.
|
||||
*
|
||||
* @example
|
||||
*
|
||||
* const dialogflow = require('dialogflow.v2beta1');
|
||||
*
|
||||
* var client = new dialogflow.v2beta1.AgentsClient({
|
||||
* // optional auth parameters.
|
||||
* });
|
||||
*
|
||||
* var formattedParent = client.projectPath('[PROJECT]');
|
||||
*
|
||||
* // Handle the operation using the promise pattern.
|
||||
* client.exportAgent({parent: formattedParent})
|
||||
* .then(responses => {
|
||||
* var operation = responses[0];
|
||||
* var initialApiResponse = responses[1];
|
||||
*
|
||||
* // Operation#promise starts polling for the completion of the LRO.
|
||||
* return operation.promise();
|
||||
* })
|
||||
* .then(responses => {
|
||||
* // The final result of the operation.
|
||||
* var result = responses[0];
|
||||
*
|
||||
* // The metadata value of the completed operation.
|
||||
* var metadata = responses[1];
|
||||
*
|
||||
* // The response of the api call returning the complete operation.
|
||||
* var finalApiResponse = responses[2];
|
||||
* })
|
||||
* .catch(err => {
|
||||
* console.error(err);
|
||||
* });
|
||||
*
|
||||
* var formattedParent = client.projectPath('[PROJECT]');
|
||||
*
|
||||
* // Handle the operation using the event emitter pattern.
|
||||
* client.exportAgent({parent: formattedParent})
|
||||
* .then(responses => {
|
||||
* var operation = responses[0];
|
||||
* var initialApiResponse = responses[1];
|
||||
*
|
||||
* // 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);
|
||||
* });
|
||||
*/
|
||||
exportAgent(request, options, callback) {
|
||||
if (options instanceof Function && callback === undefined) {
|
||||
callback = options;
|
||||
options = {};
|
||||
}
|
||||
options = options || {};
|
||||
|
||||
return this._innerApiCalls.exportAgent(request, options, callback);
|
||||
}
|
||||
|
||||
/**
|
||||
* Imports the specified agent from a ZIP file.
|
||||
*
|
||||
* Uploads new intents and entity types without deleting the existing ones.
|
||||
* Intents and entity types with the same name are replaced with the new
|
||||
* versions from ImportAgentRequest.
|
||||
*
|
||||
*
|
||||
* Operation <response: google.protobuf.Empty,
|
||||
* metadata: google.protobuf.Struct>
|
||||
*
|
||||
* @param {Object} request
|
||||
* The request object that will be sent.
|
||||
* @param {string} request.parent
|
||||
* Required. The project that the agent to import is associated with.
|
||||
* Format: `projects/<Project ID>`.
|
||||
* @param {string} [request.agentUri]
|
||||
* The URI to a Google Cloud Storage file containing the agent to import.
|
||||
* Note: The URI must start with "gs://".
|
||||
* @param {string} [request.agentContent]
|
||||
* The agent to import.
|
||||
*
|
||||
* Example for how to import an agent via the command line:
|
||||
*
|
||||
* curl \
|
||||
* 'https://dialogflow.googleapis.com/v2beta1/projects/<project_name>/agent:import\
|
||||
* -X POST \
|
||||
* -H 'Authorization: Bearer '$(gcloud auth print-access-token) \
|
||||
* -H 'Accept: application/json' \
|
||||
* -H 'Content-Type: application/json' \
|
||||
* --compressed \
|
||||
* --data-binary "{
|
||||
* 'agentContent': '$(cat <agent zip file> | base64 -w 0)'
|
||||
* }"
|
||||
* @param {Object} [options]
|
||||
* Optional parameters. You can override the default settings for this call, e.g, timeout,
|
||||
* retries, paginations, etc. See [gax.CallOptions]{@link https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the details.
|
||||
* @param {function(?Error, ?Object)} [callback]
|
||||
* The function which will be called with the result of the API call.
|
||||
*
|
||||
* The second parameter to the callback is a [gax.Operation]{@link https://googleapis.github.io/gax-nodejs/Operation} object.
|
||||
* @returns {Promise} - The promise which resolves to an array.
|
||||
* The first element of the array is a [gax.Operation]{@link https://googleapis.github.io/gax-nodejs/Operation} object.
|
||||
* The promise has a method named "cancel" which cancels the ongoing API call.
|
||||
*
|
||||
* @example
|
||||
*
|
||||
* const dialogflow = require('dialogflow.v2beta1');
|
||||
*
|
||||
* var client = new dialogflow.v2beta1.AgentsClient({
|
||||
* // optional auth parameters.
|
||||
* });
|
||||
*
|
||||
* var formattedParent = client.projectPath('[PROJECT]');
|
||||
*
|
||||
* // Handle the operation using the promise pattern.
|
||||
* client.importAgent({parent: formattedParent})
|
||||
* .then(responses => {
|
||||
* var operation = responses[0];
|
||||
* var initialApiResponse = responses[1];
|
||||
*
|
||||
* // Operation#promise starts polling for the completion of the LRO.
|
||||
* return operation.promise();
|
||||
* })
|
||||
* .then(responses => {
|
||||
* // The final result of the operation.
|
||||
* var result = responses[0];
|
||||
*
|
||||
* // The metadata value of the completed operation.
|
||||
* var metadata = responses[1];
|
||||
*
|
||||
* // The response of the api call returning the complete operation.
|
||||
* var finalApiResponse = responses[2];
|
||||
* })
|
||||
* .catch(err => {
|
||||
* console.error(err);
|
||||
* });
|
||||
*
|
||||
* var formattedParent = client.projectPath('[PROJECT]');
|
||||
*
|
||||
* // Handle the operation using the event emitter pattern.
|
||||
* client.importAgent({parent: formattedParent})
|
||||
* .then(responses => {
|
||||
* var operation = responses[0];
|
||||
* var initialApiResponse = responses[1];
|
||||
*
|
||||
* // 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);
|
||||
* });
|
||||
*/
|
||||
importAgent(request, options, callback) {
|
||||
if (options instanceof Function && callback === undefined) {
|
||||
callback = options;
|
||||
options = {};
|
||||
}
|
||||
options = options || {};
|
||||
|
||||
return this._innerApiCalls.importAgent(request, options, callback);
|
||||
}
|
||||
|
||||
/**
|
||||
* Restores the specified agent from a ZIP file.
|
||||
*
|
||||
* Replaces the current agent version with a new one. All the intents and
|
||||
* entity types in the older version are deleted.
|
||||
*
|
||||
*
|
||||
* Operation <response: google.protobuf.Empty,
|
||||
* metadata: google.protobuf.Struct>
|
||||
*
|
||||
* @param {Object} request
|
||||
* The request object that will be sent.
|
||||
* @param {string} request.parent
|
||||
* Required. The project that the agent to restore is associated with.
|
||||
* Format: `projects/<Project ID>`.
|
||||
* @param {string} [request.agentUri]
|
||||
* The URI to a Google Cloud Storage file containing the agent to restore.
|
||||
* Note: The URI must start with "gs://".
|
||||
* @param {string} [request.agentContent]
|
||||
* The agent to restore.
|
||||
*
|
||||
* Example for how to restore an agent via the command line:
|
||||
*
|
||||
* curl \
|
||||
* 'https://dialogflow.googleapis.com/v2beta1/projects/<project_name>/agent:restore\
|
||||
* -X POST \
|
||||
* -H 'Authorization: Bearer '$(gcloud auth print-access-token) \
|
||||
* -H 'Accept: application/json' \
|
||||
* -H 'Content-Type: application/json' \
|
||||
* --compressed \
|
||||
* --data-binary "{
|
||||
* 'agentContent': '$(cat <agent zip file> | base64 -w 0)'
|
||||
* }" \
|
||||
* @param {Object} [options]
|
||||
* Optional parameters. You can override the default settings for this call, e.g, timeout,
|
||||
* retries, paginations, etc. See [gax.CallOptions]{@link https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the details.
|
||||
* @param {function(?Error, ?Object)} [callback]
|
||||
* The function which will be called with the result of the API call.
|
||||
*
|
||||
* The second parameter to the callback is a [gax.Operation]{@link https://googleapis.github.io/gax-nodejs/Operation} object.
|
||||
* @returns {Promise} - The promise which resolves to an array.
|
||||
* The first element of the array is a [gax.Operation]{@link https://googleapis.github.io/gax-nodejs/Operation} object.
|
||||
* The promise has a method named "cancel" which cancels the ongoing API call.
|
||||
*
|
||||
* @example
|
||||
*
|
||||
* const dialogflow = require('dialogflow.v2beta1');
|
||||
*
|
||||
* var client = new dialogflow.v2beta1.AgentsClient({
|
||||
* // optional auth parameters.
|
||||
* });
|
||||
*
|
||||
* var formattedParent = client.projectPath('[PROJECT]');
|
||||
*
|
||||
* // Handle the operation using the promise pattern.
|
||||
* client.restoreAgent({parent: formattedParent})
|
||||
* .then(responses => {
|
||||
* var operation = responses[0];
|
||||
* var initialApiResponse = responses[1];
|
||||
*
|
||||
* // Operation#promise starts polling for the completion of the LRO.
|
||||
* return operation.promise();
|
||||
* })
|
||||
* .then(responses => {
|
||||
* // The final result of the operation.
|
||||
* var result = responses[0];
|
||||
*
|
||||
* // The metadata value of the completed operation.
|
||||
* var metadata = responses[1];
|
||||
*
|
||||
* // The response of the api call returning the complete operation.
|
||||
* var finalApiResponse = responses[2];
|
||||
* })
|
||||
* .catch(err => {
|
||||
* console.error(err);
|
||||
* });
|
||||
*
|
||||
* var formattedParent = client.projectPath('[PROJECT]');
|
||||
*
|
||||
* // Handle the operation using the event emitter pattern.
|
||||
* client.restoreAgent({parent: formattedParent})
|
||||
* .then(responses => {
|
||||
* var operation = responses[0];
|
||||
* var initialApiResponse = responses[1];
|
||||
*
|
||||
* // 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);
|
||||
* });
|
||||
*/
|
||||
restoreAgent(request, options, callback) {
|
||||
if (options instanceof Function && callback === undefined) {
|
||||
callback = options;
|
||||
options = {};
|
||||
}
|
||||
options = options || {};
|
||||
|
||||
return this._innerApiCalls.restoreAgent(request, options, callback);
|
||||
}
|
||||
|
||||
// --------------------
|
||||
// -- Path templates --
|
||||
// --------------------
|
||||
|
||||
/**
|
||||
* Return a fully-qualified project resource name string.
|
||||
*
|
||||
* @param {String} project
|
||||
* @returns {String}
|
||||
*/
|
||||
projectPath(project) {
|
||||
return this._pathTemplates.projectPathTemplate.render({
|
||||
project: project,
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Parse the projectName from a project resource.
|
||||
*
|
||||
* @param {String} projectName
|
||||
* A fully-qualified path representing a project resources.
|
||||
* @returns {String} - A string representing the project.
|
||||
*/
|
||||
matchProjectFromProjectName(projectName) {
|
||||
return this._pathTemplates.projectPathTemplate.match(projectName).project;
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = AgentsClient;
|
||||
56
node_modules/dialogflow/src/v2beta1/agents_client_config.json
generated
vendored
Normal file
56
node_modules/dialogflow/src/v2beta1/agents_client_config.json
generated
vendored
Normal file
@@ -0,0 +1,56 @@
|
||||
{
|
||||
"interfaces": {
|
||||
"google.cloud.dialogflow.v2beta1.Agents": {
|
||||
"retry_codes": {
|
||||
"idempotent": [
|
||||
"DEADLINE_EXCEEDED",
|
||||
"UNAVAILABLE"
|
||||
],
|
||||
"non_idempotent": []
|
||||
},
|
||||
"retry_params": {
|
||||
"default": {
|
||||
"initial_retry_delay_millis": 100,
|
||||
"retry_delay_multiplier": 1.3,
|
||||
"max_retry_delay_millis": 60000,
|
||||
"initial_rpc_timeout_millis": 20000,
|
||||
"rpc_timeout_multiplier": 1.0,
|
||||
"max_rpc_timeout_millis": 20000,
|
||||
"total_timeout_millis": 600000
|
||||
}
|
||||
},
|
||||
"methods": {
|
||||
"GetAgent": {
|
||||
"timeout_millis": 60000,
|
||||
"retry_codes_name": "idempotent",
|
||||
"retry_params_name": "default"
|
||||
},
|
||||
"SearchAgents": {
|
||||
"timeout_millis": 60000,
|
||||
"retry_codes_name": "idempotent",
|
||||
"retry_params_name": "default"
|
||||
},
|
||||
"TrainAgent": {
|
||||
"timeout_millis": 60000,
|
||||
"retry_codes_name": "idempotent",
|
||||
"retry_params_name": "default"
|
||||
},
|
||||
"ExportAgent": {
|
||||
"timeout_millis": 60000,
|
||||
"retry_codes_name": "idempotent",
|
||||
"retry_params_name": "default"
|
||||
},
|
||||
"ImportAgent": {
|
||||
"timeout_millis": 60000,
|
||||
"retry_codes_name": "non_idempotent",
|
||||
"retry_params_name": "default"
|
||||
},
|
||||
"RestoreAgent": {
|
||||
"timeout_millis": 60000,
|
||||
"retry_codes_name": "idempotent",
|
||||
"retry_params_name": "default"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
884
node_modules/dialogflow/src/v2beta1/contexts_client.js
generated
vendored
Normal file
884
node_modules/dialogflow/src/v2beta1/contexts_client.js
generated
vendored
Normal file
@@ -0,0 +1,884 @@
|
||||
// Copyright 2018 Google LLC
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// https://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
'use strict';
|
||||
|
||||
const gapicConfig = require('./contexts_client_config');
|
||||
const gax = require('google-gax');
|
||||
const merge = require('lodash.merge');
|
||||
const path = require('path');
|
||||
|
||||
const VERSION = require('../../package.json').version;
|
||||
|
||||
/**
|
||||
* A context represents additional information included with user input or with
|
||||
* an intent returned by the Dialogflow API. Contexts are helpful for
|
||||
* differentiating user input which may be vague or have a different meaning
|
||||
* depending on additional details from your application such as user setting
|
||||
* and preferences, previous user input, where the user is in your application,
|
||||
* geographic location, and so on.
|
||||
*
|
||||
* You can include contexts as input parameters of a
|
||||
* DetectIntent (or
|
||||
* StreamingDetectIntent) request,
|
||||
* or as output contexts included in the returned intent.
|
||||
* Contexts expire when an intent is matched, after the number of `DetectIntent`
|
||||
* requests specified by the `lifespan_count` parameter, or after 10 minutes
|
||||
* if no intents are matched for a `DetectIntent` request.
|
||||
*
|
||||
* For more information about contexts, see the
|
||||
* [Dialogflow documentation](https://dialogflow.com/docs/contexts).
|
||||
*
|
||||
* @class
|
||||
* @memberof v2beta1
|
||||
*/
|
||||
class ContextsClient {
|
||||
/**
|
||||
* Construct an instance of ContextsClient.
|
||||
*
|
||||
* @param {object} [options] - The configuration object. See the subsequent
|
||||
* parameters for more details.
|
||||
* @param {object} [options.credentials] - Credentials object.
|
||||
* @param {string} [options.credentials.client_email]
|
||||
* @param {string} [options.credentials.private_key]
|
||||
* @param {string} [options.email] - Account email address. Required when
|
||||
* using a .pem or .p12 keyFilename.
|
||||
* @param {string} [options.keyFilename] - 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.
|
||||
* @param {number} [options.port] - The port on which to connect to
|
||||
* the remote host.
|
||||
* @param {string} [options.projectId] - 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
|
||||
* {@link https://developers.google.com/identity/protocols/application-default-credentials Application Default Credentials},
|
||||
* your project ID will be detected automatically.
|
||||
* @param {function} [options.promise] - Custom promise module to use instead
|
||||
* of native Promises.
|
||||
* @param {string} [options.servicePath] - The domain name of the
|
||||
* API remote host.
|
||||
*/
|
||||
constructor(opts) {
|
||||
this._descriptors = {};
|
||||
|
||||
// Ensure that options include the service address and port.
|
||||
opts = Object.assign(
|
||||
{
|
||||
clientConfig: {},
|
||||
port: this.constructor.port,
|
||||
servicePath: this.constructor.servicePath,
|
||||
},
|
||||
opts
|
||||
);
|
||||
|
||||
// Create a `gaxGrpc` object, with any grpc-specific options
|
||||
// sent to the client.
|
||||
opts.scopes = this.constructor.scopes;
|
||||
var gaxGrpc = gax.grpc(opts);
|
||||
|
||||
// Save the auth object to the client, for use by other methods.
|
||||
this.auth = gaxGrpc.auth;
|
||||
|
||||
// Determine the client header string.
|
||||
var clientHeader = [
|
||||
`gl-node/${process.version.node}`,
|
||||
`grpc/${gaxGrpc.grpcVersion}`,
|
||||
`gax/${gax.version}`,
|
||||
`gapic/${VERSION}`,
|
||||
];
|
||||
if (opts.libName && opts.libVersion) {
|
||||
clientHeader.push(`${opts.libName}/${opts.libVersion}`);
|
||||
}
|
||||
|
||||
// Load the applicable protos.
|
||||
var protos = merge(
|
||||
{},
|
||||
gaxGrpc.loadProto(
|
||||
path.join(__dirname, '..', '..', 'protos'),
|
||||
'google/cloud/dialogflow/v2beta1/context.proto'
|
||||
)
|
||||
);
|
||||
|
||||
// This API contains "path templates"; forward-slash-separated
|
||||
// identifiers to uniquely identify resources within the API.
|
||||
// Create useful helper objects for these.
|
||||
this._pathTemplates = {
|
||||
sessionPathTemplate: new gax.PathTemplate(
|
||||
'projects/{project}/agent/sessions/{session}'
|
||||
),
|
||||
environmentSessionPathTemplate: new gax.PathTemplate(
|
||||
'projects/{project}/agent/environments/{environment}/users/{user}/sessions/{session}'
|
||||
),
|
||||
contextPathTemplate: new gax.PathTemplate(
|
||||
'projects/{project}/agent/sessions/{session}/contexts/{context}'
|
||||
),
|
||||
environmentContextPathTemplate: new gax.PathTemplate(
|
||||
'projects/{project}/agent/environments/{environment}/users/{user}/sessions/{session}/contexts/{context}'
|
||||
),
|
||||
};
|
||||
|
||||
// Some of the methods on this service return "paged" results,
|
||||
// (e.g. 50 results at a time, with tokens to get subsequent
|
||||
// pages). Denote the keys used for pagination and results.
|
||||
this._descriptors.page = {
|
||||
listContexts: new gax.PageDescriptor(
|
||||
'pageToken',
|
||||
'nextPageToken',
|
||||
'contexts'
|
||||
),
|
||||
};
|
||||
|
||||
// Put together the default options sent with requests.
|
||||
var defaults = gaxGrpc.constructSettings(
|
||||
'google.cloud.dialogflow.v2beta1.Contexts',
|
||||
gapicConfig,
|
||||
opts.clientConfig,
|
||||
{'x-goog-api-client': clientHeader.join(' ')}
|
||||
);
|
||||
|
||||
// Set up a dictionary of "inner API calls"; the core implementation
|
||||
// of calling the API is handled in `google-gax`, with this code
|
||||
// merely providing the destination and request information.
|
||||
this._innerApiCalls = {};
|
||||
|
||||
// Put together the "service stub" for
|
||||
// google.cloud.dialogflow.v2beta1.Contexts.
|
||||
var contextsStub = gaxGrpc.createStub(
|
||||
protos.google.cloud.dialogflow.v2beta1.Contexts,
|
||||
opts
|
||||
);
|
||||
|
||||
// Iterate over each of the methods that the service provides
|
||||
// and create an API call method for each.
|
||||
var contextsStubMethods = [
|
||||
'listContexts',
|
||||
'getContext',
|
||||
'createContext',
|
||||
'updateContext',
|
||||
'deleteContext',
|
||||
'deleteAllContexts',
|
||||
];
|
||||
for (let methodName of contextsStubMethods) {
|
||||
this._innerApiCalls[methodName] = gax.createApiCall(
|
||||
contextsStub.then(
|
||||
stub =>
|
||||
function() {
|
||||
var args = Array.prototype.slice.call(arguments, 0);
|
||||
return stub[methodName].apply(stub, args);
|
||||
}
|
||||
),
|
||||
defaults[methodName],
|
||||
this._descriptors.page[methodName]
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* The DNS address for this API service.
|
||||
*/
|
||||
static get servicePath() {
|
||||
return 'dialogflow.googleapis.com';
|
||||
}
|
||||
|
||||
/**
|
||||
* The port for this API service.
|
||||
*/
|
||||
static get port() {
|
||||
return 443;
|
||||
}
|
||||
|
||||
/**
|
||||
* The scopes needed to make gRPC calls for every method defined
|
||||
* in this service.
|
||||
*/
|
||||
static get scopes() {
|
||||
return ['https://www.googleapis.com/auth/cloud-platform'];
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the project ID used by this class.
|
||||
* @param {function(Error, string)} callback - the callback to
|
||||
* be called with the current project Id.
|
||||
*/
|
||||
getProjectId(callback) {
|
||||
return this.auth.getProjectId(callback);
|
||||
}
|
||||
|
||||
// -------------------
|
||||
// -- Service calls --
|
||||
// -------------------
|
||||
|
||||
/**
|
||||
* Returns the list of all contexts in the specified session.
|
||||
*
|
||||
* @param {Object} request
|
||||
* The request object that will be sent.
|
||||
* @param {string} request.parent
|
||||
* Required. The session to list all contexts from.
|
||||
* Format: `projects/<Project ID>/agent/sessions/<Session ID>` or
|
||||
* `projects/<Project ID>/agent/environments/<Environment ID>/users/<User
|
||||
* ID>/sessions/<Session ID>`. Note: Environments and users are under
|
||||
* construction and will be available soon. If <Environment ID> is not
|
||||
* specified, we assume default 'draft' environment. If <User ID> is not
|
||||
* specified, we assume default '-' user.
|
||||
* @param {number} [request.pageSize]
|
||||
* 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.
|
||||
* @param {Object} [options]
|
||||
* Optional parameters. You can override the default settings for this call, e.g, timeout,
|
||||
* retries, paginations, etc. See [gax.CallOptions]{@link https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the details.
|
||||
* @param {function(?Error, ?Array, ?Object, ?Object)} [callback]
|
||||
* The function which will be called with the result of the API call.
|
||||
*
|
||||
* The second parameter to the callback is Array of [Context]{@link google.cloud.dialogflow.v2beta1.Context}.
|
||||
*
|
||||
* 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 [ListContextsResponse]{@link google.cloud.dialogflow.v2beta1.ListContextsResponse}.
|
||||
* @returns {Promise} - The promise which resolves to an array.
|
||||
* The first element of the array is Array of [Context]{@link google.cloud.dialogflow.v2beta1.Context}.
|
||||
*
|
||||
* When autoPaginate: false is specified through options, the array has three elements.
|
||||
* The first element is Array of [Context]{@link google.cloud.dialogflow.v2beta1.Context} 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 [ListContextsResponse]{@link google.cloud.dialogflow.v2beta1.ListContextsResponse}.
|
||||
*
|
||||
* The promise has a method named "cancel" which cancels the ongoing API call.
|
||||
*
|
||||
* @example
|
||||
*
|
||||
* const dialogflow = require('dialogflow.v2beta1');
|
||||
*
|
||||
* var client = new dialogflow.v2beta1.ContextsClient({
|
||||
* // optional auth parameters.
|
||||
* });
|
||||
*
|
||||
* // Iterate over all elements.
|
||||
* var formattedParent = client.sessionPath('[PROJECT]', '[SESSION]');
|
||||
*
|
||||
* client.listContexts({parent: formattedParent})
|
||||
* .then(responses => {
|
||||
* var resources = responses[0];
|
||||
* for (let i = 0; i < resources.length; i += 1) {
|
||||
* // doThingsWith(resources[i])
|
||||
* }
|
||||
* })
|
||||
* .catch(err => {
|
||||
* console.error(err);
|
||||
* });
|
||||
*
|
||||
* // Or obtain the paged response.
|
||||
* var formattedParent = client.sessionPath('[PROJECT]', '[SESSION]');
|
||||
*
|
||||
*
|
||||
* var options = {autoPaginate: false};
|
||||
* var callback = responses => {
|
||||
* // The actual resources in a response.
|
||||
* var resources = responses[0];
|
||||
* // The next request if the response shows that there are more responses.
|
||||
* var nextRequest = responses[1];
|
||||
* // The actual response object, if necessary.
|
||||
* // var rawResponse = responses[2];
|
||||
* for (let i = 0; i < resources.length; i += 1) {
|
||||
* // doThingsWith(resources[i]);
|
||||
* }
|
||||
* if (nextRequest) {
|
||||
* // Fetch the next page.
|
||||
* return client.listContexts(nextRequest, options).then(callback);
|
||||
* }
|
||||
* }
|
||||
* client.listContexts({parent: formattedParent}, options)
|
||||
* .then(callback)
|
||||
* .catch(err => {
|
||||
* console.error(err);
|
||||
* });
|
||||
*/
|
||||
listContexts(request, options, callback) {
|
||||
if (options instanceof Function && callback === undefined) {
|
||||
callback = options;
|
||||
options = {};
|
||||
}
|
||||
options = options || {};
|
||||
|
||||
return this._innerApiCalls.listContexts(request, options, callback);
|
||||
}
|
||||
|
||||
/**
|
||||
* Equivalent to {@link listContexts}, but returns a NodeJS Stream object.
|
||||
*
|
||||
* This fetches the paged responses for {@link listContexts} 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.
|
||||
*
|
||||
* @see {@link https://nodejs.org/api/stream.html}
|
||||
*
|
||||
* @param {Object} request
|
||||
* The request object that will be sent.
|
||||
* @param {string} request.parent
|
||||
* Required. The session to list all contexts from.
|
||||
* Format: `projects/<Project ID>/agent/sessions/<Session ID>` or
|
||||
* `projects/<Project ID>/agent/environments/<Environment ID>/users/<User
|
||||
* ID>/sessions/<Session ID>`. Note: Environments and users are under
|
||||
* construction and will be available soon. If <Environment ID> is not
|
||||
* specified, we assume default 'draft' environment. If <User ID> is not
|
||||
* specified, we assume default '-' user.
|
||||
* @param {number} [request.pageSize]
|
||||
* 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.
|
||||
* @param {Object} [options]
|
||||
* Optional parameters. You can override the default settings for this call, e.g, timeout,
|
||||
* retries, paginations, etc. See [gax.CallOptions]{@link https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the details.
|
||||
* @returns {Stream}
|
||||
* An object stream which emits an object representing [Context]{@link google.cloud.dialogflow.v2beta1.Context} on 'data' event.
|
||||
*
|
||||
* @example
|
||||
*
|
||||
* const dialogflow = require('dialogflow.v2beta1');
|
||||
*
|
||||
* var client = new dialogflow.v2beta1.ContextsClient({
|
||||
* // optional auth parameters.
|
||||
* });
|
||||
*
|
||||
* var formattedParent = client.sessionPath('[PROJECT]', '[SESSION]');
|
||||
* client.listContextsStream({parent: formattedParent})
|
||||
* .on('data', element => {
|
||||
* // doThingsWith(element)
|
||||
* }).on('error', err => {
|
||||
* console.log(err);
|
||||
* });
|
||||
*/
|
||||
listContextsStream(request, options) {
|
||||
options = options || {};
|
||||
|
||||
return this._descriptors.page.listContexts.createStream(
|
||||
this._innerApiCalls.listContexts,
|
||||
request,
|
||||
options
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves the specified context.
|
||||
*
|
||||
* @param {Object} request
|
||||
* The request object that will be sent.
|
||||
* @param {string} request.name
|
||||
* Required. The name of the context. Format:
|
||||
* `projects/<Project ID>/agent/sessions/<Session ID>/contexts/<Context ID>`
|
||||
* or `projects/<Project ID>/agent/environments/<Environment ID>/users/<User
|
||||
* ID>/sessions/<Session ID>/contexts/<Context ID>`. Note: Environments and
|
||||
* users are under construction and will be available soon. If <Environment
|
||||
* ID> is not specified, we assume default 'draft' environment. If <User ID>
|
||||
* is not specified, we assume default '-' user.
|
||||
* @param {Object} [options]
|
||||
* Optional parameters. You can override the default settings for this call, e.g, timeout,
|
||||
* retries, paginations, etc. See [gax.CallOptions]{@link https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the details.
|
||||
* @param {function(?Error, ?Object)} [callback]
|
||||
* The function which will be called with the result of the API call.
|
||||
*
|
||||
* The second parameter to the callback is an object representing [Context]{@link google.cloud.dialogflow.v2beta1.Context}.
|
||||
* @returns {Promise} - The promise which resolves to an array.
|
||||
* The first element of the array is an object representing [Context]{@link google.cloud.dialogflow.v2beta1.Context}.
|
||||
* The promise has a method named "cancel" which cancels the ongoing API call.
|
||||
*
|
||||
* @example
|
||||
*
|
||||
* const dialogflow = require('dialogflow.v2beta1');
|
||||
*
|
||||
* var client = new dialogflow.v2beta1.ContextsClient({
|
||||
* // optional auth parameters.
|
||||
* });
|
||||
*
|
||||
* var formattedName = client.contextPath('[PROJECT]', '[SESSION]', '[CONTEXT]');
|
||||
* client.getContext({name: formattedName})
|
||||
* .then(responses => {
|
||||
* var response = responses[0];
|
||||
* // doThingsWith(response)
|
||||
* })
|
||||
* .catch(err => {
|
||||
* console.error(err);
|
||||
* });
|
||||
*/
|
||||
getContext(request, options, callback) {
|
||||
if (options instanceof Function && callback === undefined) {
|
||||
callback = options;
|
||||
options = {};
|
||||
}
|
||||
options = options || {};
|
||||
|
||||
return this._innerApiCalls.getContext(request, options, callback);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a context.
|
||||
*
|
||||
* @param {Object} request
|
||||
* The request object that will be sent.
|
||||
* @param {string} request.parent
|
||||
* Required. The session to create a context for.
|
||||
* Format: `projects/<Project ID>/agent/sessions/<Session ID>` or
|
||||
* `projects/<Project ID>/agent/environments/<Environment ID>/users/<User
|
||||
* ID>/sessions/<Session ID>`. Note: Environments and users are under
|
||||
* construction and will be available soon. If <Environment ID> is not
|
||||
* specified, we assume default 'draft' environment. If <User ID> is not
|
||||
* specified, we assume default '-' user.
|
||||
* @param {Object} request.context
|
||||
* Required. The context to create.
|
||||
*
|
||||
* This object should have the same structure as [Context]{@link google.cloud.dialogflow.v2beta1.Context}
|
||||
* @param {Object} [options]
|
||||
* Optional parameters. You can override the default settings for this call, e.g, timeout,
|
||||
* retries, paginations, etc. See [gax.CallOptions]{@link https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the details.
|
||||
* @param {function(?Error, ?Object)} [callback]
|
||||
* The function which will be called with the result of the API call.
|
||||
*
|
||||
* The second parameter to the callback is an object representing [Context]{@link google.cloud.dialogflow.v2beta1.Context}.
|
||||
* @returns {Promise} - The promise which resolves to an array.
|
||||
* The first element of the array is an object representing [Context]{@link google.cloud.dialogflow.v2beta1.Context}.
|
||||
* The promise has a method named "cancel" which cancels the ongoing API call.
|
||||
*
|
||||
* @example
|
||||
*
|
||||
* const dialogflow = require('dialogflow.v2beta1');
|
||||
*
|
||||
* var client = new dialogflow.v2beta1.ContextsClient({
|
||||
* // optional auth parameters.
|
||||
* });
|
||||
*
|
||||
* var formattedParent = client.sessionPath('[PROJECT]', '[SESSION]');
|
||||
* var context = {};
|
||||
* var request = {
|
||||
* parent: formattedParent,
|
||||
* context: context,
|
||||
* };
|
||||
* client.createContext(request)
|
||||
* .then(responses => {
|
||||
* var response = responses[0];
|
||||
* // doThingsWith(response)
|
||||
* })
|
||||
* .catch(err => {
|
||||
* console.error(err);
|
||||
* });
|
||||
*/
|
||||
createContext(request, options, callback) {
|
||||
if (options instanceof Function && callback === undefined) {
|
||||
callback = options;
|
||||
options = {};
|
||||
}
|
||||
options = options || {};
|
||||
|
||||
return this._innerApiCalls.createContext(request, options, callback);
|
||||
}
|
||||
|
||||
/**
|
||||
* Updates the specified context.
|
||||
*
|
||||
* @param {Object} request
|
||||
* The request object that will be sent.
|
||||
* @param {Object} request.context
|
||||
* Required. The context to update.
|
||||
*
|
||||
* This object should have the same structure as [Context]{@link google.cloud.dialogflow.v2beta1.Context}
|
||||
* @param {Object} [request.updateMask]
|
||||
* Optional. The mask to control which fields get updated.
|
||||
*
|
||||
* This object should have the same structure as [FieldMask]{@link google.protobuf.FieldMask}
|
||||
* @param {Object} [options]
|
||||
* Optional parameters. You can override the default settings for this call, e.g, timeout,
|
||||
* retries, paginations, etc. See [gax.CallOptions]{@link https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the details.
|
||||
* @param {function(?Error, ?Object)} [callback]
|
||||
* The function which will be called with the result of the API call.
|
||||
*
|
||||
* The second parameter to the callback is an object representing [Context]{@link google.cloud.dialogflow.v2beta1.Context}.
|
||||
* @returns {Promise} - The promise which resolves to an array.
|
||||
* The first element of the array is an object representing [Context]{@link google.cloud.dialogflow.v2beta1.Context}.
|
||||
* The promise has a method named "cancel" which cancels the ongoing API call.
|
||||
*
|
||||
* @example
|
||||
*
|
||||
* const dialogflow = require('dialogflow.v2beta1');
|
||||
*
|
||||
* var client = new dialogflow.v2beta1.ContextsClient({
|
||||
* // optional auth parameters.
|
||||
* });
|
||||
*
|
||||
* var context = {};
|
||||
* client.updateContext({context: context})
|
||||
* .then(responses => {
|
||||
* var response = responses[0];
|
||||
* // doThingsWith(response)
|
||||
* })
|
||||
* .catch(err => {
|
||||
* console.error(err);
|
||||
* });
|
||||
*/
|
||||
updateContext(request, options, callback) {
|
||||
if (options instanceof Function && callback === undefined) {
|
||||
callback = options;
|
||||
options = {};
|
||||
}
|
||||
options = options || {};
|
||||
|
||||
return this._innerApiCalls.updateContext(request, options, callback);
|
||||
}
|
||||
|
||||
/**
|
||||
* Deletes the specified context.
|
||||
*
|
||||
* @param {Object} request
|
||||
* The request object that will be sent.
|
||||
* @param {string} request.name
|
||||
* Required. The name of the context to delete. Format:
|
||||
* `projects/<Project ID>/agent/sessions/<Session ID>/contexts/<Context ID>`
|
||||
* or `projects/<Project ID>/agent/environments/<Environment ID>/users/<User
|
||||
* ID>/sessions/<Session ID>/contexts/<Context ID>`. Note: Environments and
|
||||
* users are under construction and will be available soon. If <Environment
|
||||
* ID> is not specified, we assume default 'draft' environment. If <User ID>
|
||||
* is not specified, we assume default
|
||||
* '-' user.
|
||||
* @param {Object} [options]
|
||||
* Optional parameters. You can override the default settings for this call, e.g, timeout,
|
||||
* retries, paginations, etc. See [gax.CallOptions]{@link https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the details.
|
||||
* @param {function(?Error)} [callback]
|
||||
* 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.v2beta1');
|
||||
*
|
||||
* var client = new dialogflow.v2beta1.ContextsClient({
|
||||
* // optional auth parameters.
|
||||
* });
|
||||
*
|
||||
* var formattedName = client.contextPath('[PROJECT]', '[SESSION]', '[CONTEXT]');
|
||||
* client.deleteContext({name: formattedName}).catch(err => {
|
||||
* console.error(err);
|
||||
* });
|
||||
*/
|
||||
deleteContext(request, options, callback) {
|
||||
if (options instanceof Function && callback === undefined) {
|
||||
callback = options;
|
||||
options = {};
|
||||
}
|
||||
options = options || {};
|
||||
|
||||
return this._innerApiCalls.deleteContext(request, options, callback);
|
||||
}
|
||||
|
||||
/**
|
||||
* Deletes all active contexts in the specified session.
|
||||
*
|
||||
* @param {Object} request
|
||||
* The request object that will be sent.
|
||||
* @param {string} request.parent
|
||||
* Required. The name of the session to delete all contexts from. Format:
|
||||
* `projects/<Project ID>/agent/sessions/<Session ID>` or `projects/<Project
|
||||
* ID>/agent/environments/<Environment ID>/users/<User ID>/sessions/<Session
|
||||
* ID>`. Note: Environments and users are under construction and will be
|
||||
* available soon. If <Environment ID> is not specified we assume default
|
||||
* 'draft' environment. If <User ID> is not specified, we assume default
|
||||
* '-' user.
|
||||
* @param {Object} [options]
|
||||
* Optional parameters. You can override the default settings for this call, e.g, timeout,
|
||||
* retries, paginations, etc. See [gax.CallOptions]{@link https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the details.
|
||||
* @param {function(?Error)} [callback]
|
||||
* 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.v2beta1');
|
||||
*
|
||||
* var client = new dialogflow.v2beta1.ContextsClient({
|
||||
* // optional auth parameters.
|
||||
* });
|
||||
*
|
||||
* var formattedParent = client.sessionPath('[PROJECT]', '[SESSION]');
|
||||
* client.deleteAllContexts({parent: formattedParent}).catch(err => {
|
||||
* console.error(err);
|
||||
* });
|
||||
*/
|
||||
deleteAllContexts(request, options, callback) {
|
||||
if (options instanceof Function && callback === undefined) {
|
||||
callback = options;
|
||||
options = {};
|
||||
}
|
||||
options = options || {};
|
||||
|
||||
return this._innerApiCalls.deleteAllContexts(request, options, callback);
|
||||
}
|
||||
|
||||
// --------------------
|
||||
// -- Path templates --
|
||||
// --------------------
|
||||
|
||||
/**
|
||||
* Return a fully-qualified session resource name string.
|
||||
*
|
||||
* @param {String} project
|
||||
* @param {String} session
|
||||
* @returns {String}
|
||||
*/
|
||||
sessionPath(project, session) {
|
||||
return this._pathTemplates.sessionPathTemplate.render({
|
||||
project: project,
|
||||
session: session,
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Return a fully-qualified environment_session resource name string.
|
||||
*
|
||||
* @param {String} project
|
||||
* @param {String} environment
|
||||
* @param {String} user
|
||||
* @param {String} session
|
||||
* @returns {String}
|
||||
*/
|
||||
environmentSessionPath(project, environment, user, session) {
|
||||
return this._pathTemplates.environmentSessionPathTemplate.render({
|
||||
project: project,
|
||||
environment: environment,
|
||||
user: user,
|
||||
session: session,
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Return a fully-qualified context resource name string.
|
||||
*
|
||||
* @param {String} project
|
||||
* @param {String} session
|
||||
* @param {String} context
|
||||
* @returns {String}
|
||||
*/
|
||||
contextPath(project, session, context) {
|
||||
return this._pathTemplates.contextPathTemplate.render({
|
||||
project: project,
|
||||
session: session,
|
||||
context: context,
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Return a fully-qualified environment_context resource name string.
|
||||
*
|
||||
* @param {String} project
|
||||
* @param {String} environment
|
||||
* @param {String} user
|
||||
* @param {String} session
|
||||
* @param {String} context
|
||||
* @returns {String}
|
||||
*/
|
||||
environmentContextPath(project, environment, user, session, context) {
|
||||
return this._pathTemplates.environmentContextPathTemplate.render({
|
||||
project: project,
|
||||
environment: environment,
|
||||
user: user,
|
||||
session: session,
|
||||
context: context,
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Parse the sessionName from a session resource.
|
||||
*
|
||||
* @param {String} sessionName
|
||||
* A fully-qualified path representing a session resources.
|
||||
* @returns {String} - A string representing the project.
|
||||
*/
|
||||
matchProjectFromSessionName(sessionName) {
|
||||
return this._pathTemplates.sessionPathTemplate.match(sessionName).project;
|
||||
}
|
||||
|
||||
/**
|
||||
* Parse the sessionName from a session resource.
|
||||
*
|
||||
* @param {String} sessionName
|
||||
* A fully-qualified path representing a session resources.
|
||||
* @returns {String} - A string representing the session.
|
||||
*/
|
||||
matchSessionFromSessionName(sessionName) {
|
||||
return this._pathTemplates.sessionPathTemplate.match(sessionName).session;
|
||||
}
|
||||
|
||||
/**
|
||||
* Parse the environmentSessionName from a environment_session resource.
|
||||
*
|
||||
* @param {String} environmentSessionName
|
||||
* A fully-qualified path representing a environment_session resources.
|
||||
* @returns {String} - A string representing the project.
|
||||
*/
|
||||
matchProjectFromEnvironmentSessionName(environmentSessionName) {
|
||||
return this._pathTemplates.environmentSessionPathTemplate.match(
|
||||
environmentSessionName
|
||||
).project;
|
||||
}
|
||||
|
||||
/**
|
||||
* Parse the environmentSessionName from a environment_session resource.
|
||||
*
|
||||
* @param {String} environmentSessionName
|
||||
* A fully-qualified path representing a environment_session resources.
|
||||
* @returns {String} - A string representing the environment.
|
||||
*/
|
||||
matchEnvironmentFromEnvironmentSessionName(environmentSessionName) {
|
||||
return this._pathTemplates.environmentSessionPathTemplate.match(
|
||||
environmentSessionName
|
||||
).environment;
|
||||
}
|
||||
|
||||
/**
|
||||
* Parse the environmentSessionName from a environment_session resource.
|
||||
*
|
||||
* @param {String} environmentSessionName
|
||||
* A fully-qualified path representing a environment_session resources.
|
||||
* @returns {String} - A string representing the user.
|
||||
*/
|
||||
matchUserFromEnvironmentSessionName(environmentSessionName) {
|
||||
return this._pathTemplates.environmentSessionPathTemplate.match(
|
||||
environmentSessionName
|
||||
).user;
|
||||
}
|
||||
|
||||
/**
|
||||
* Parse the environmentSessionName from a environment_session resource.
|
||||
*
|
||||
* @param {String} environmentSessionName
|
||||
* A fully-qualified path representing a environment_session resources.
|
||||
* @returns {String} - A string representing the session.
|
||||
*/
|
||||
matchSessionFromEnvironmentSessionName(environmentSessionName) {
|
||||
return this._pathTemplates.environmentSessionPathTemplate.match(
|
||||
environmentSessionName
|
||||
).session;
|
||||
}
|
||||
|
||||
/**
|
||||
* Parse the contextName from a context resource.
|
||||
*
|
||||
* @param {String} contextName
|
||||
* A fully-qualified path representing a context resources.
|
||||
* @returns {String} - A string representing the project.
|
||||
*/
|
||||
matchProjectFromContextName(contextName) {
|
||||
return this._pathTemplates.contextPathTemplate.match(contextName).project;
|
||||
}
|
||||
|
||||
/**
|
||||
* Parse the contextName from a context resource.
|
||||
*
|
||||
* @param {String} contextName
|
||||
* A fully-qualified path representing a context resources.
|
||||
* @returns {String} - A string representing the session.
|
||||
*/
|
||||
matchSessionFromContextName(contextName) {
|
||||
return this._pathTemplates.contextPathTemplate.match(contextName).session;
|
||||
}
|
||||
|
||||
/**
|
||||
* Parse the contextName from a context resource.
|
||||
*
|
||||
* @param {String} contextName
|
||||
* A fully-qualified path representing a context resources.
|
||||
* @returns {String} - A string representing the context.
|
||||
*/
|
||||
matchContextFromContextName(contextName) {
|
||||
return this._pathTemplates.contextPathTemplate.match(contextName).context;
|
||||
}
|
||||
|
||||
/**
|
||||
* Parse the environmentContextName from a environment_context resource.
|
||||
*
|
||||
* @param {String} environmentContextName
|
||||
* A fully-qualified path representing a environment_context resources.
|
||||
* @returns {String} - A string representing the project.
|
||||
*/
|
||||
matchProjectFromEnvironmentContextName(environmentContextName) {
|
||||
return this._pathTemplates.environmentContextPathTemplate.match(
|
||||
environmentContextName
|
||||
).project;
|
||||
}
|
||||
|
||||
/**
|
||||
* Parse the environmentContextName from a environment_context resource.
|
||||
*
|
||||
* @param {String} environmentContextName
|
||||
* A fully-qualified path representing a environment_context resources.
|
||||
* @returns {String} - A string representing the environment.
|
||||
*/
|
||||
matchEnvironmentFromEnvironmentContextName(environmentContextName) {
|
||||
return this._pathTemplates.environmentContextPathTemplate.match(
|
||||
environmentContextName
|
||||
).environment;
|
||||
}
|
||||
|
||||
/**
|
||||
* Parse the environmentContextName from a environment_context resource.
|
||||
*
|
||||
* @param {String} environmentContextName
|
||||
* A fully-qualified path representing a environment_context resources.
|
||||
* @returns {String} - A string representing the user.
|
||||
*/
|
||||
matchUserFromEnvironmentContextName(environmentContextName) {
|
||||
return this._pathTemplates.environmentContextPathTemplate.match(
|
||||
environmentContextName
|
||||
).user;
|
||||
}
|
||||
|
||||
/**
|
||||
* Parse the environmentContextName from a environment_context resource.
|
||||
*
|
||||
* @param {String} environmentContextName
|
||||
* A fully-qualified path representing a environment_context resources.
|
||||
* @returns {String} - A string representing the session.
|
||||
*/
|
||||
matchSessionFromEnvironmentContextName(environmentContextName) {
|
||||
return this._pathTemplates.environmentContextPathTemplate.match(
|
||||
environmentContextName
|
||||
).session;
|
||||
}
|
||||
|
||||
/**
|
||||
* Parse the environmentContextName from a environment_context resource.
|
||||
*
|
||||
* @param {String} environmentContextName
|
||||
* A fully-qualified path representing a environment_context resources.
|
||||
* @returns {String} - A string representing the context.
|
||||
*/
|
||||
matchContextFromEnvironmentContextName(environmentContextName) {
|
||||
return this._pathTemplates.environmentContextPathTemplate.match(
|
||||
environmentContextName
|
||||
).context;
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = ContextsClient;
|
||||
56
node_modules/dialogflow/src/v2beta1/contexts_client_config.json
generated
vendored
Normal file
56
node_modules/dialogflow/src/v2beta1/contexts_client_config.json
generated
vendored
Normal file
@@ -0,0 +1,56 @@
|
||||
{
|
||||
"interfaces": {
|
||||
"google.cloud.dialogflow.v2beta1.Contexts": {
|
||||
"retry_codes": {
|
||||
"idempotent": [
|
||||
"DEADLINE_EXCEEDED",
|
||||
"UNAVAILABLE"
|
||||
],
|
||||
"non_idempotent": []
|
||||
},
|
||||
"retry_params": {
|
||||
"default": {
|
||||
"initial_retry_delay_millis": 100,
|
||||
"retry_delay_multiplier": 1.3,
|
||||
"max_retry_delay_millis": 60000,
|
||||
"initial_rpc_timeout_millis": 20000,
|
||||
"rpc_timeout_multiplier": 1.0,
|
||||
"max_rpc_timeout_millis": 20000,
|
||||
"total_timeout_millis": 600000
|
||||
}
|
||||
},
|
||||
"methods": {
|
||||
"ListContexts": {
|
||||
"timeout_millis": 60000,
|
||||
"retry_codes_name": "idempotent",
|
||||
"retry_params_name": "default"
|
||||
},
|
||||
"GetContext": {
|
||||
"timeout_millis": 60000,
|
||||
"retry_codes_name": "idempotent",
|
||||
"retry_params_name": "default"
|
||||
},
|
||||
"CreateContext": {
|
||||
"timeout_millis": 60000,
|
||||
"retry_codes_name": "non_idempotent",
|
||||
"retry_params_name": "default"
|
||||
},
|
||||
"UpdateContext": {
|
||||
"timeout_millis": 60000,
|
||||
"retry_codes_name": "non_idempotent",
|
||||
"retry_params_name": "default"
|
||||
},
|
||||
"DeleteContext": {
|
||||
"timeout_millis": 60000,
|
||||
"retry_codes_name": "idempotent",
|
||||
"retry_params_name": "default"
|
||||
},
|
||||
"DeleteAllContexts": {
|
||||
"timeout_millis": 60000,
|
||||
"retry_codes_name": "idempotent",
|
||||
"retry_params_name": "default"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
1338
node_modules/dialogflow/src/v2beta1/entity_types_client.js
generated
vendored
Normal file
1338
node_modules/dialogflow/src/v2beta1/entity_types_client.js
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
76
node_modules/dialogflow/src/v2beta1/entity_types_client_config.json
generated
vendored
Normal file
76
node_modules/dialogflow/src/v2beta1/entity_types_client_config.json
generated
vendored
Normal file
@@ -0,0 +1,76 @@
|
||||
{
|
||||
"interfaces": {
|
||||
"google.cloud.dialogflow.v2beta1.EntityTypes": {
|
||||
"retry_codes": {
|
||||
"idempotent": [
|
||||
"DEADLINE_EXCEEDED",
|
||||
"UNAVAILABLE"
|
||||
],
|
||||
"non_idempotent": []
|
||||
},
|
||||
"retry_params": {
|
||||
"default": {
|
||||
"initial_retry_delay_millis": 100,
|
||||
"retry_delay_multiplier": 1.3,
|
||||
"max_retry_delay_millis": 60000,
|
||||
"initial_rpc_timeout_millis": 20000,
|
||||
"rpc_timeout_multiplier": 1.0,
|
||||
"max_rpc_timeout_millis": 20000,
|
||||
"total_timeout_millis": 600000
|
||||
}
|
||||
},
|
||||
"methods": {
|
||||
"ListEntityTypes": {
|
||||
"timeout_millis": 60000,
|
||||
"retry_codes_name": "idempotent",
|
||||
"retry_params_name": "default"
|
||||
},
|
||||
"GetEntityType": {
|
||||
"timeout_millis": 60000,
|
||||
"retry_codes_name": "idempotent",
|
||||
"retry_params_name": "default"
|
||||
},
|
||||
"CreateEntityType": {
|
||||
"timeout_millis": 60000,
|
||||
"retry_codes_name": "non_idempotent",
|
||||
"retry_params_name": "default"
|
||||
},
|
||||
"UpdateEntityType": {
|
||||
"timeout_millis": 60000,
|
||||
"retry_codes_name": "non_idempotent",
|
||||
"retry_params_name": "default"
|
||||
},
|
||||
"DeleteEntityType": {
|
||||
"timeout_millis": 60000,
|
||||
"retry_codes_name": "idempotent",
|
||||
"retry_params_name": "default"
|
||||
},
|
||||
"BatchUpdateEntityTypes": {
|
||||
"timeout_millis": 60000,
|
||||
"retry_codes_name": "non_idempotent",
|
||||
"retry_params_name": "default"
|
||||
},
|
||||
"BatchDeleteEntityTypes": {
|
||||
"timeout_millis": 60000,
|
||||
"retry_codes_name": "idempotent",
|
||||
"retry_params_name": "default"
|
||||
},
|
||||
"BatchCreateEntities": {
|
||||
"timeout_millis": 60000,
|
||||
"retry_codes_name": "non_idempotent",
|
||||
"retry_params_name": "default"
|
||||
},
|
||||
"BatchUpdateEntities": {
|
||||
"timeout_millis": 60000,
|
||||
"retry_codes_name": "non_idempotent",
|
||||
"retry_params_name": "default"
|
||||
},
|
||||
"BatchDeleteEntities": {
|
||||
"timeout_millis": 60000,
|
||||
"retry_codes_name": "idempotent",
|
||||
"retry_params_name": "default"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
29
node_modules/dialogflow/src/v2beta1/index.js
generated
vendored
Normal file
29
node_modules/dialogflow/src/v2beta1/index.js
generated
vendored
Normal file
@@ -0,0 +1,29 @@
|
||||
// Copyright 2018 Google LLC
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// https://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
'use strict';
|
||||
|
||||
const AgentsClient = require('./agents_client');
|
||||
const ContextsClient = require('./contexts_client');
|
||||
const EntityTypesClient = require('./entity_types_client');
|
||||
const IntentsClient = require('./intents_client');
|
||||
const SessionEntityTypesClient = require('./session_entity_types_client');
|
||||
const SessionsClient = require('./sessions_client');
|
||||
|
||||
module.exports.AgentsClient = AgentsClient;
|
||||
module.exports.ContextsClient = ContextsClient;
|
||||
module.exports.EntityTypesClient = EntityTypesClient;
|
||||
module.exports.IntentsClient = IntentsClient;
|
||||
module.exports.SessionEntityTypesClient = SessionEntityTypesClient;
|
||||
module.exports.SessionsClient = SessionsClient;
|
||||
1042
node_modules/dialogflow/src/v2beta1/intents_client.js
generated
vendored
Normal file
1042
node_modules/dialogflow/src/v2beta1/intents_client.js
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
61
node_modules/dialogflow/src/v2beta1/intents_client_config.json
generated
vendored
Normal file
61
node_modules/dialogflow/src/v2beta1/intents_client_config.json
generated
vendored
Normal file
@@ -0,0 +1,61 @@
|
||||
{
|
||||
"interfaces": {
|
||||
"google.cloud.dialogflow.v2beta1.Intents": {
|
||||
"retry_codes": {
|
||||
"idempotent": [
|
||||
"DEADLINE_EXCEEDED",
|
||||
"UNAVAILABLE"
|
||||
],
|
||||
"non_idempotent": []
|
||||
},
|
||||
"retry_params": {
|
||||
"default": {
|
||||
"initial_retry_delay_millis": 100,
|
||||
"retry_delay_multiplier": 1.3,
|
||||
"max_retry_delay_millis": 60000,
|
||||
"initial_rpc_timeout_millis": 20000,
|
||||
"rpc_timeout_multiplier": 1.0,
|
||||
"max_rpc_timeout_millis": 20000,
|
||||
"total_timeout_millis": 600000
|
||||
}
|
||||
},
|
||||
"methods": {
|
||||
"ListIntents": {
|
||||
"timeout_millis": 60000,
|
||||
"retry_codes_name": "idempotent",
|
||||
"retry_params_name": "default"
|
||||
},
|
||||
"GetIntent": {
|
||||
"timeout_millis": 60000,
|
||||
"retry_codes_name": "idempotent",
|
||||
"retry_params_name": "default"
|
||||
},
|
||||
"CreateIntent": {
|
||||
"timeout_millis": 60000,
|
||||
"retry_codes_name": "non_idempotent",
|
||||
"retry_params_name": "default"
|
||||
},
|
||||
"UpdateIntent": {
|
||||
"timeout_millis": 60000,
|
||||
"retry_codes_name": "non_idempotent",
|
||||
"retry_params_name": "default"
|
||||
},
|
||||
"DeleteIntent": {
|
||||
"timeout_millis": 60000,
|
||||
"retry_codes_name": "idempotent",
|
||||
"retry_params_name": "default"
|
||||
},
|
||||
"BatchUpdateIntents": {
|
||||
"timeout_millis": 60000,
|
||||
"retry_codes_name": "non_idempotent",
|
||||
"retry_params_name": "default"
|
||||
},
|
||||
"BatchDeleteIntents": {
|
||||
"timeout_millis": 60000,
|
||||
"retry_codes_name": "idempotent",
|
||||
"retry_params_name": "default"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
880
node_modules/dialogflow/src/v2beta1/session_entity_types_client.js
generated
vendored
Normal file
880
node_modules/dialogflow/src/v2beta1/session_entity_types_client.js
generated
vendored
Normal file
@@ -0,0 +1,880 @@
|
||||
// Copyright 2018 Google LLC
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// https://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
'use strict';
|
||||
|
||||
const gapicConfig = require('./session_entity_types_client_config');
|
||||
const gax = require('google-gax');
|
||||
const merge = require('lodash.merge');
|
||||
const path = require('path');
|
||||
|
||||
const VERSION = require('../../package.json').version;
|
||||
|
||||
/**
|
||||
* Entities are extracted from user input and represent parameters that are
|
||||
* meaningful to your application. For example, a date range, a proper name
|
||||
* such as a geographic location or landmark, and so on. Entities represent
|
||||
* actionable data for your application.
|
||||
*
|
||||
* Session entity types are referred to as **User** entity types and are
|
||||
* entities that are built for an individual user such as
|
||||
* favorites, preferences, playlists, and so on. You can redefine a session
|
||||
* entity type at the session level.
|
||||
*
|
||||
* For more information about entity types, see the
|
||||
* [Dialogflow documentation](https://dialogflow.com/docs/entities).
|
||||
*
|
||||
* @class
|
||||
* @memberof v2beta1
|
||||
*/
|
||||
class SessionEntityTypesClient {
|
||||
/**
|
||||
* Construct an instance of SessionEntityTypesClient.
|
||||
*
|
||||
* @param {object} [options] - The configuration object. See the subsequent
|
||||
* parameters for more details.
|
||||
* @param {object} [options.credentials] - Credentials object.
|
||||
* @param {string} [options.credentials.client_email]
|
||||
* @param {string} [options.credentials.private_key]
|
||||
* @param {string} [options.email] - Account email address. Required when
|
||||
* using a .pem or .p12 keyFilename.
|
||||
* @param {string} [options.keyFilename] - 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.
|
||||
* @param {number} [options.port] - The port on which to connect to
|
||||
* the remote host.
|
||||
* @param {string} [options.projectId] - 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
|
||||
* {@link https://developers.google.com/identity/protocols/application-default-credentials Application Default Credentials},
|
||||
* your project ID will be detected automatically.
|
||||
* @param {function} [options.promise] - Custom promise module to use instead
|
||||
* of native Promises.
|
||||
* @param {string} [options.servicePath] - The domain name of the
|
||||
* API remote host.
|
||||
*/
|
||||
constructor(opts) {
|
||||
this._descriptors = {};
|
||||
|
||||
// Ensure that options include the service address and port.
|
||||
opts = Object.assign(
|
||||
{
|
||||
clientConfig: {},
|
||||
port: this.constructor.port,
|
||||
servicePath: this.constructor.servicePath,
|
||||
},
|
||||
opts
|
||||
);
|
||||
|
||||
// Create a `gaxGrpc` object, with any grpc-specific options
|
||||
// sent to the client.
|
||||
opts.scopes = this.constructor.scopes;
|
||||
var gaxGrpc = gax.grpc(opts);
|
||||
|
||||
// Save the auth object to the client, for use by other methods.
|
||||
this.auth = gaxGrpc.auth;
|
||||
|
||||
// Determine the client header string.
|
||||
var clientHeader = [
|
||||
`gl-node/${process.version.node}`,
|
||||
`grpc/${gaxGrpc.grpcVersion}`,
|
||||
`gax/${gax.version}`,
|
||||
`gapic/${VERSION}`,
|
||||
];
|
||||
if (opts.libName && opts.libVersion) {
|
||||
clientHeader.push(`${opts.libName}/${opts.libVersion}`);
|
||||
}
|
||||
|
||||
// Load the applicable protos.
|
||||
var protos = merge(
|
||||
{},
|
||||
gaxGrpc.loadProto(
|
||||
path.join(__dirname, '..', '..', 'protos'),
|
||||
'google/cloud/dialogflow/v2beta1/session_entity_type.proto'
|
||||
)
|
||||
);
|
||||
|
||||
// This API contains "path templates"; forward-slash-separated
|
||||
// identifiers to uniquely identify resources within the API.
|
||||
// Create useful helper objects for these.
|
||||
this._pathTemplates = {
|
||||
sessionPathTemplate: new gax.PathTemplate(
|
||||
'projects/{project}/agent/sessions/{session}'
|
||||
),
|
||||
environmentSessionPathTemplate: new gax.PathTemplate(
|
||||
'projects/{project}/agent/environments/{environment}/users/{user}/sessions/{session}'
|
||||
),
|
||||
sessionEntityTypePathTemplate: new gax.PathTemplate(
|
||||
'projects/{project}/agent/sessions/{session}/entityTypes/{entity_type}'
|
||||
),
|
||||
environmentSessionEntityTypePathTemplate: new gax.PathTemplate(
|
||||
'projects/{project}/agent/environments/{environment}/users/{user}/sessions/{session}/entityTypes/{entity_type}'
|
||||
),
|
||||
};
|
||||
|
||||
// Some of the methods on this service return "paged" results,
|
||||
// (e.g. 50 results at a time, with tokens to get subsequent
|
||||
// pages). Denote the keys used for pagination and results.
|
||||
this._descriptors.page = {
|
||||
listSessionEntityTypes: new gax.PageDescriptor(
|
||||
'pageToken',
|
||||
'nextPageToken',
|
||||
'sessionEntityTypes'
|
||||
),
|
||||
};
|
||||
|
||||
// Put together the default options sent with requests.
|
||||
var defaults = gaxGrpc.constructSettings(
|
||||
'google.cloud.dialogflow.v2beta1.SessionEntityTypes',
|
||||
gapicConfig,
|
||||
opts.clientConfig,
|
||||
{'x-goog-api-client': clientHeader.join(' ')}
|
||||
);
|
||||
|
||||
// Set up a dictionary of "inner API calls"; the core implementation
|
||||
// of calling the API is handled in `google-gax`, with this code
|
||||
// merely providing the destination and request information.
|
||||
this._innerApiCalls = {};
|
||||
|
||||
// Put together the "service stub" for
|
||||
// google.cloud.dialogflow.v2beta1.SessionEntityTypes.
|
||||
var sessionEntityTypesStub = gaxGrpc.createStub(
|
||||
protos.google.cloud.dialogflow.v2beta1.SessionEntityTypes,
|
||||
opts
|
||||
);
|
||||
|
||||
// Iterate over each of the methods that the service provides
|
||||
// and create an API call method for each.
|
||||
var sessionEntityTypesStubMethods = [
|
||||
'listSessionEntityTypes',
|
||||
'getSessionEntityType',
|
||||
'createSessionEntityType',
|
||||
'updateSessionEntityType',
|
||||
'deleteSessionEntityType',
|
||||
];
|
||||
for (let methodName of sessionEntityTypesStubMethods) {
|
||||
this._innerApiCalls[methodName] = gax.createApiCall(
|
||||
sessionEntityTypesStub.then(
|
||||
stub =>
|
||||
function() {
|
||||
var args = Array.prototype.slice.call(arguments, 0);
|
||||
return stub[methodName].apply(stub, args);
|
||||
}
|
||||
),
|
||||
defaults[methodName],
|
||||
this._descriptors.page[methodName]
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* The DNS address for this API service.
|
||||
*/
|
||||
static get servicePath() {
|
||||
return 'dialogflow.googleapis.com';
|
||||
}
|
||||
|
||||
/**
|
||||
* The port for this API service.
|
||||
*/
|
||||
static get port() {
|
||||
return 443;
|
||||
}
|
||||
|
||||
/**
|
||||
* The scopes needed to make gRPC calls for every method defined
|
||||
* in this service.
|
||||
*/
|
||||
static get scopes() {
|
||||
return ['https://www.googleapis.com/auth/cloud-platform'];
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the project ID used by this class.
|
||||
* @param {function(Error, string)} callback - the callback to
|
||||
* be called with the current project Id.
|
||||
*/
|
||||
getProjectId(callback) {
|
||||
return this.auth.getProjectId(callback);
|
||||
}
|
||||
|
||||
// -------------------
|
||||
// -- Service calls --
|
||||
// -------------------
|
||||
|
||||
/**
|
||||
* Returns the list of all session entity types in the specified session.
|
||||
*
|
||||
* @param {Object} request
|
||||
* The request object that will be sent.
|
||||
* @param {string} request.parent
|
||||
* Required. The session to list all session entity types from.
|
||||
* Format: `projects/<Project ID>/agent/sessions/<Session ID>` or
|
||||
* `projects/<Project ID>/agent/environments/<Environment ID>/users/<User ID>/
|
||||
* sessions/<Session ID>`.
|
||||
* Note: Environments and users are under construction and will be available
|
||||
* soon. If <Environment ID> is not specified, we assume default 'draft'
|
||||
* environment. If <User ID> is not specified, we assume default '-' user.
|
||||
* @param {number} [request.pageSize]
|
||||
* 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.
|
||||
* @param {Object} [options]
|
||||
* Optional parameters. You can override the default settings for this call, e.g, timeout,
|
||||
* retries, paginations, etc. See [gax.CallOptions]{@link https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the details.
|
||||
* @param {function(?Error, ?Array, ?Object, ?Object)} [callback]
|
||||
* The function which will be called with the result of the API call.
|
||||
*
|
||||
* The second parameter to the callback is Array of [SessionEntityType]{@link google.cloud.dialogflow.v2beta1.SessionEntityType}.
|
||||
*
|
||||
* 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 [ListSessionEntityTypesResponse]{@link google.cloud.dialogflow.v2beta1.ListSessionEntityTypesResponse}.
|
||||
* @returns {Promise} - The promise which resolves to an array.
|
||||
* The first element of the array is Array of [SessionEntityType]{@link google.cloud.dialogflow.v2beta1.SessionEntityType}.
|
||||
*
|
||||
* When autoPaginate: false is specified through options, the array has three elements.
|
||||
* The first element is Array of [SessionEntityType]{@link google.cloud.dialogflow.v2beta1.SessionEntityType} 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 [ListSessionEntityTypesResponse]{@link google.cloud.dialogflow.v2beta1.ListSessionEntityTypesResponse}.
|
||||
*
|
||||
* The promise has a method named "cancel" which cancels the ongoing API call.
|
||||
*
|
||||
* @example
|
||||
*
|
||||
* const dialogflow = require('dialogflow.v2beta1');
|
||||
*
|
||||
* var client = new dialogflow.v2beta1.SessionEntityTypesClient({
|
||||
* // optional auth parameters.
|
||||
* });
|
||||
*
|
||||
* // Iterate over all elements.
|
||||
* var formattedParent = client.sessionPath('[PROJECT]', '[SESSION]');
|
||||
*
|
||||
* client.listSessionEntityTypes({parent: formattedParent})
|
||||
* .then(responses => {
|
||||
* var resources = responses[0];
|
||||
* for (let i = 0; i < resources.length; i += 1) {
|
||||
* // doThingsWith(resources[i])
|
||||
* }
|
||||
* })
|
||||
* .catch(err => {
|
||||
* console.error(err);
|
||||
* });
|
||||
*
|
||||
* // Or obtain the paged response.
|
||||
* var formattedParent = client.sessionPath('[PROJECT]', '[SESSION]');
|
||||
*
|
||||
*
|
||||
* var options = {autoPaginate: false};
|
||||
* var callback = responses => {
|
||||
* // The actual resources in a response.
|
||||
* var resources = responses[0];
|
||||
* // The next request if the response shows that there are more responses.
|
||||
* var nextRequest = responses[1];
|
||||
* // The actual response object, if necessary.
|
||||
* // var rawResponse = responses[2];
|
||||
* for (let i = 0; i < resources.length; i += 1) {
|
||||
* // doThingsWith(resources[i]);
|
||||
* }
|
||||
* if (nextRequest) {
|
||||
* // Fetch the next page.
|
||||
* return client.listSessionEntityTypes(nextRequest, options).then(callback);
|
||||
* }
|
||||
* }
|
||||
* client.listSessionEntityTypes({parent: formattedParent}, options)
|
||||
* .then(callback)
|
||||
* .catch(err => {
|
||||
* console.error(err);
|
||||
* });
|
||||
*/
|
||||
listSessionEntityTypes(request, options, callback) {
|
||||
if (options instanceof Function && callback === undefined) {
|
||||
callback = options;
|
||||
options = {};
|
||||
}
|
||||
options = options || {};
|
||||
|
||||
return this._innerApiCalls.listSessionEntityTypes(
|
||||
request,
|
||||
options,
|
||||
callback
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Equivalent to {@link listSessionEntityTypes}, but returns a NodeJS Stream object.
|
||||
*
|
||||
* This fetches the paged responses for {@link listSessionEntityTypes} 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.
|
||||
*
|
||||
* @see {@link https://nodejs.org/api/stream.html}
|
||||
*
|
||||
* @param {Object} request
|
||||
* The request object that will be sent.
|
||||
* @param {string} request.parent
|
||||
* Required. The session to list all session entity types from.
|
||||
* Format: `projects/<Project ID>/agent/sessions/<Session ID>` or
|
||||
* `projects/<Project ID>/agent/environments/<Environment ID>/users/<User ID>/
|
||||
* sessions/<Session ID>`.
|
||||
* Note: Environments and users are under construction and will be available
|
||||
* soon. If <Environment ID> is not specified, we assume default 'draft'
|
||||
* environment. If <User ID> is not specified, we assume default '-' user.
|
||||
* @param {number} [request.pageSize]
|
||||
* 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.
|
||||
* @param {Object} [options]
|
||||
* Optional parameters. You can override the default settings for this call, e.g, timeout,
|
||||
* retries, paginations, etc. See [gax.CallOptions]{@link https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the details.
|
||||
* @returns {Stream}
|
||||
* An object stream which emits an object representing [SessionEntityType]{@link google.cloud.dialogflow.v2beta1.SessionEntityType} on 'data' event.
|
||||
*
|
||||
* @example
|
||||
*
|
||||
* const dialogflow = require('dialogflow.v2beta1');
|
||||
*
|
||||
* var client = new dialogflow.v2beta1.SessionEntityTypesClient({
|
||||
* // optional auth parameters.
|
||||
* });
|
||||
*
|
||||
* var formattedParent = client.sessionPath('[PROJECT]', '[SESSION]');
|
||||
* client.listSessionEntityTypesStream({parent: formattedParent})
|
||||
* .on('data', element => {
|
||||
* // doThingsWith(element)
|
||||
* }).on('error', err => {
|
||||
* console.log(err);
|
||||
* });
|
||||
*/
|
||||
listSessionEntityTypesStream(request, options) {
|
||||
options = options || {};
|
||||
|
||||
return this._descriptors.page.listSessionEntityTypes.createStream(
|
||||
this._innerApiCalls.listSessionEntityTypes,
|
||||
request,
|
||||
options
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves the specified session entity type.
|
||||
*
|
||||
* @param {Object} request
|
||||
* The request object that will be sent.
|
||||
* @param {string} request.name
|
||||
* Required. The name of the session entity type. Format:
|
||||
* `projects/<Project ID>/agent/sessions/<Session ID>/entityTypes/<Entity Type
|
||||
* Display Name>` or `projects/<Project ID>/agent/environments/<Environment
|
||||
* ID>/users/<User ID>/sessions/<Session ID>/
|
||||
* entityTypes/<Entity Type Display Name>`.
|
||||
* Note: Environments and users re under construction and will be available
|
||||
* soon. If <Environment ID> is not specified, we assume default 'draft'
|
||||
* environment. If <User ID> is not specified, we assume default '-' user.
|
||||
* @param {Object} [options]
|
||||
* Optional parameters. You can override the default settings for this call, e.g, timeout,
|
||||
* retries, paginations, etc. See [gax.CallOptions]{@link https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the details.
|
||||
* @param {function(?Error, ?Object)} [callback]
|
||||
* The function which will be called with the result of the API call.
|
||||
*
|
||||
* The second parameter to the callback is an object representing [SessionEntityType]{@link google.cloud.dialogflow.v2beta1.SessionEntityType}.
|
||||
* @returns {Promise} - The promise which resolves to an array.
|
||||
* The first element of the array is an object representing [SessionEntityType]{@link google.cloud.dialogflow.v2beta1.SessionEntityType}.
|
||||
* The promise has a method named "cancel" which cancels the ongoing API call.
|
||||
*
|
||||
* @example
|
||||
*
|
||||
* const dialogflow = require('dialogflow.v2beta1');
|
||||
*
|
||||
* var client = new dialogflow.v2beta1.SessionEntityTypesClient({
|
||||
* // optional auth parameters.
|
||||
* });
|
||||
*
|
||||
* var formattedName = client.sessionEntityTypePath('[PROJECT]', '[SESSION]', '[ENTITY_TYPE]');
|
||||
* client.getSessionEntityType({name: formattedName})
|
||||
* .then(responses => {
|
||||
* var response = responses[0];
|
||||
* // doThingsWith(response)
|
||||
* })
|
||||
* .catch(err => {
|
||||
* console.error(err);
|
||||
* });
|
||||
*/
|
||||
getSessionEntityType(request, options, callback) {
|
||||
if (options instanceof Function && callback === undefined) {
|
||||
callback = options;
|
||||
options = {};
|
||||
}
|
||||
options = options || {};
|
||||
|
||||
return this._innerApiCalls.getSessionEntityType(request, options, callback);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a session entity type.
|
||||
*
|
||||
* @param {Object} request
|
||||
* The request object that will be sent.
|
||||
* @param {string} request.parent
|
||||
* Required. The session to create a session entity type for.
|
||||
* Format: `projects/<Project ID>/agent/sessions/<Session ID>` or
|
||||
* `projects/<Project ID>/agent/environments/<Environment ID>/users/<User ID>/
|
||||
* sessions/<Session ID>`.
|
||||
* Note: Environments and users are under construction and will be available
|
||||
* soon. If <Environment ID> is not specified, we assume default 'draft'
|
||||
* environment. If <User ID> is not specified, we assume default '-' user.
|
||||
* @param {Object} request.sessionEntityType
|
||||
* Required. The session entity type to create.
|
||||
*
|
||||
* This object should have the same structure as [SessionEntityType]{@link google.cloud.dialogflow.v2beta1.SessionEntityType}
|
||||
* @param {Object} [options]
|
||||
* Optional parameters. You can override the default settings for this call, e.g, timeout,
|
||||
* retries, paginations, etc. See [gax.CallOptions]{@link https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the details.
|
||||
* @param {function(?Error, ?Object)} [callback]
|
||||
* The function which will be called with the result of the API call.
|
||||
*
|
||||
* The second parameter to the callback is an object representing [SessionEntityType]{@link google.cloud.dialogflow.v2beta1.SessionEntityType}.
|
||||
* @returns {Promise} - The promise which resolves to an array.
|
||||
* The first element of the array is an object representing [SessionEntityType]{@link google.cloud.dialogflow.v2beta1.SessionEntityType}.
|
||||
* The promise has a method named "cancel" which cancels the ongoing API call.
|
||||
*
|
||||
* @example
|
||||
*
|
||||
* const dialogflow = require('dialogflow.v2beta1');
|
||||
*
|
||||
* var client = new dialogflow.v2beta1.SessionEntityTypesClient({
|
||||
* // optional auth parameters.
|
||||
* });
|
||||
*
|
||||
* var formattedParent = client.sessionPath('[PROJECT]', '[SESSION]');
|
||||
* var sessionEntityType = {};
|
||||
* var request = {
|
||||
* parent: formattedParent,
|
||||
* sessionEntityType: sessionEntityType,
|
||||
* };
|
||||
* client.createSessionEntityType(request)
|
||||
* .then(responses => {
|
||||
* var response = responses[0];
|
||||
* // doThingsWith(response)
|
||||
* })
|
||||
* .catch(err => {
|
||||
* console.error(err);
|
||||
* });
|
||||
*/
|
||||
createSessionEntityType(request, options, callback) {
|
||||
if (options instanceof Function && callback === undefined) {
|
||||
callback = options;
|
||||
options = {};
|
||||
}
|
||||
options = options || {};
|
||||
|
||||
return this._innerApiCalls.createSessionEntityType(
|
||||
request,
|
||||
options,
|
||||
callback
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Updates the specified session entity type.
|
||||
*
|
||||
* @param {Object} request
|
||||
* The request object that will be sent.
|
||||
* @param {Object} request.sessionEntityType
|
||||
* Required. The entity type to update. Format:
|
||||
* `projects/<Project ID>/agent/sessions/<Session ID>/entityTypes/<Entity Type
|
||||
* Display Name>` or `projects/<Project ID>/agent/environments/<Environment
|
||||
* ID>/users/<User ID>/sessions/<Session ID>/entityTypes/<Entity Type Display
|
||||
* Name>`.
|
||||
* Note: Environments and users are under construction and will be available
|
||||
* soon. If <Environment ID> is not specified, we assume default 'draft'
|
||||
* environment. If <User ID> is not specified, we assume default '-' user.
|
||||
*
|
||||
* This object should have the same structure as [SessionEntityType]{@link google.cloud.dialogflow.v2beta1.SessionEntityType}
|
||||
* @param {Object} [request.updateMask]
|
||||
* Optional. The mask to control which fields get updated.
|
||||
*
|
||||
* This object should have the same structure as [FieldMask]{@link google.protobuf.FieldMask}
|
||||
* @param {Object} [options]
|
||||
* Optional parameters. You can override the default settings for this call, e.g, timeout,
|
||||
* retries, paginations, etc. See [gax.CallOptions]{@link https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the details.
|
||||
* @param {function(?Error, ?Object)} [callback]
|
||||
* The function which will be called with the result of the API call.
|
||||
*
|
||||
* The second parameter to the callback is an object representing [SessionEntityType]{@link google.cloud.dialogflow.v2beta1.SessionEntityType}.
|
||||
* @returns {Promise} - The promise which resolves to an array.
|
||||
* The first element of the array is an object representing [SessionEntityType]{@link google.cloud.dialogflow.v2beta1.SessionEntityType}.
|
||||
* The promise has a method named "cancel" which cancels the ongoing API call.
|
||||
*
|
||||
* @example
|
||||
*
|
||||
* const dialogflow = require('dialogflow.v2beta1');
|
||||
*
|
||||
* var client = new dialogflow.v2beta1.SessionEntityTypesClient({
|
||||
* // optional auth parameters.
|
||||
* });
|
||||
*
|
||||
* var sessionEntityType = {};
|
||||
* client.updateSessionEntityType({sessionEntityType: sessionEntityType})
|
||||
* .then(responses => {
|
||||
* var response = responses[0];
|
||||
* // doThingsWith(response)
|
||||
* })
|
||||
* .catch(err => {
|
||||
* console.error(err);
|
||||
* });
|
||||
*/
|
||||
updateSessionEntityType(request, options, callback) {
|
||||
if (options instanceof Function && callback === undefined) {
|
||||
callback = options;
|
||||
options = {};
|
||||
}
|
||||
options = options || {};
|
||||
|
||||
return this._innerApiCalls.updateSessionEntityType(
|
||||
request,
|
||||
options,
|
||||
callback
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Deletes the specified session entity type.
|
||||
*
|
||||
* @param {Object} request
|
||||
* The request object that will be sent.
|
||||
* @param {string} request.name
|
||||
* Required. The name of the entity type to delete. Format:
|
||||
* `projects/<Project ID>/agent/sessions/<Session ID>/entityTypes/<Entity Type
|
||||
* Display Name>` or `projects/<Project ID>/agent/environments/<Environment
|
||||
* ID>/users/<User ID>/sessions/<Session ID>/entityTypes/<Entity Type Display
|
||||
* Name>`.
|
||||
* Note: Environments and users are under construction and will be available
|
||||
* soon. If <Environment ID> is not specified, we assume default 'draft'
|
||||
* environment. If <User ID> is not specified, we assume default '-' user.
|
||||
* @param {Object} [options]
|
||||
* Optional parameters. You can override the default settings for this call, e.g, timeout,
|
||||
* retries, paginations, etc. See [gax.CallOptions]{@link https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the details.
|
||||
* @param {function(?Error)} [callback]
|
||||
* 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.v2beta1');
|
||||
*
|
||||
* var client = new dialogflow.v2beta1.SessionEntityTypesClient({
|
||||
* // optional auth parameters.
|
||||
* });
|
||||
*
|
||||
* var formattedName = client.sessionEntityTypePath('[PROJECT]', '[SESSION]', '[ENTITY_TYPE]');
|
||||
* client.deleteSessionEntityType({name: formattedName}).catch(err => {
|
||||
* console.error(err);
|
||||
* });
|
||||
*/
|
||||
deleteSessionEntityType(request, options, callback) {
|
||||
if (options instanceof Function && callback === undefined) {
|
||||
callback = options;
|
||||
options = {};
|
||||
}
|
||||
options = options || {};
|
||||
|
||||
return this._innerApiCalls.deleteSessionEntityType(
|
||||
request,
|
||||
options,
|
||||
callback
|
||||
);
|
||||
}
|
||||
|
||||
// --------------------
|
||||
// -- Path templates --
|
||||
// --------------------
|
||||
|
||||
/**
|
||||
* Return a fully-qualified session resource name string.
|
||||
*
|
||||
* @param {String} project
|
||||
* @param {String} session
|
||||
* @returns {String}
|
||||
*/
|
||||
sessionPath(project, session) {
|
||||
return this._pathTemplates.sessionPathTemplate.render({
|
||||
project: project,
|
||||
session: session,
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Return a fully-qualified environment_session resource name string.
|
||||
*
|
||||
* @param {String} project
|
||||
* @param {String} environment
|
||||
* @param {String} user
|
||||
* @param {String} session
|
||||
* @returns {String}
|
||||
*/
|
||||
environmentSessionPath(project, environment, user, session) {
|
||||
return this._pathTemplates.environmentSessionPathTemplate.render({
|
||||
project: project,
|
||||
environment: environment,
|
||||
user: user,
|
||||
session: session,
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Return a fully-qualified session_entity_type resource name string.
|
||||
*
|
||||
* @param {String} project
|
||||
* @param {String} session
|
||||
* @param {String} entityType
|
||||
* @returns {String}
|
||||
*/
|
||||
sessionEntityTypePath(project, session, entityType) {
|
||||
return this._pathTemplates.sessionEntityTypePathTemplate.render({
|
||||
project: project,
|
||||
session: session,
|
||||
entity_type: entityType,
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Return a fully-qualified environment_session_entity_type resource name string.
|
||||
*
|
||||
* @param {String} project
|
||||
* @param {String} environment
|
||||
* @param {String} user
|
||||
* @param {String} session
|
||||
* @param {String} entityType
|
||||
* @returns {String}
|
||||
*/
|
||||
environmentSessionEntityTypePath(
|
||||
project,
|
||||
environment,
|
||||
user,
|
||||
session,
|
||||
entityType
|
||||
) {
|
||||
return this._pathTemplates.environmentSessionEntityTypePathTemplate.render({
|
||||
project: project,
|
||||
environment: environment,
|
||||
user: user,
|
||||
session: session,
|
||||
entity_type: entityType,
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Parse the sessionName from a session resource.
|
||||
*
|
||||
* @param {String} sessionName
|
||||
* A fully-qualified path representing a session resources.
|
||||
* @returns {String} - A string representing the project.
|
||||
*/
|
||||
matchProjectFromSessionName(sessionName) {
|
||||
return this._pathTemplates.sessionPathTemplate.match(sessionName).project;
|
||||
}
|
||||
|
||||
/**
|
||||
* Parse the sessionName from a session resource.
|
||||
*
|
||||
* @param {String} sessionName
|
||||
* A fully-qualified path representing a session resources.
|
||||
* @returns {String} - A string representing the session.
|
||||
*/
|
||||
matchSessionFromSessionName(sessionName) {
|
||||
return this._pathTemplates.sessionPathTemplate.match(sessionName).session;
|
||||
}
|
||||
|
||||
/**
|
||||
* Parse the environmentSessionName from a environment_session resource.
|
||||
*
|
||||
* @param {String} environmentSessionName
|
||||
* A fully-qualified path representing a environment_session resources.
|
||||
* @returns {String} - A string representing the project.
|
||||
*/
|
||||
matchProjectFromEnvironmentSessionName(environmentSessionName) {
|
||||
return this._pathTemplates.environmentSessionPathTemplate.match(
|
||||
environmentSessionName
|
||||
).project;
|
||||
}
|
||||
|
||||
/**
|
||||
* Parse the environmentSessionName from a environment_session resource.
|
||||
*
|
||||
* @param {String} environmentSessionName
|
||||
* A fully-qualified path representing a environment_session resources.
|
||||
* @returns {String} - A string representing the environment.
|
||||
*/
|
||||
matchEnvironmentFromEnvironmentSessionName(environmentSessionName) {
|
||||
return this._pathTemplates.environmentSessionPathTemplate.match(
|
||||
environmentSessionName
|
||||
).environment;
|
||||
}
|
||||
|
||||
/**
|
||||
* Parse the environmentSessionName from a environment_session resource.
|
||||
*
|
||||
* @param {String} environmentSessionName
|
||||
* A fully-qualified path representing a environment_session resources.
|
||||
* @returns {String} - A string representing the user.
|
||||
*/
|
||||
matchUserFromEnvironmentSessionName(environmentSessionName) {
|
||||
return this._pathTemplates.environmentSessionPathTemplate.match(
|
||||
environmentSessionName
|
||||
).user;
|
||||
}
|
||||
|
||||
/**
|
||||
* Parse the environmentSessionName from a environment_session resource.
|
||||
*
|
||||
* @param {String} environmentSessionName
|
||||
* A fully-qualified path representing a environment_session resources.
|
||||
* @returns {String} - A string representing the session.
|
||||
*/
|
||||
matchSessionFromEnvironmentSessionName(environmentSessionName) {
|
||||
return this._pathTemplates.environmentSessionPathTemplate.match(
|
||||
environmentSessionName
|
||||
).session;
|
||||
}
|
||||
|
||||
/**
|
||||
* Parse the sessionEntityTypeName from a session_entity_type resource.
|
||||
*
|
||||
* @param {String} sessionEntityTypeName
|
||||
* A fully-qualified path representing a session_entity_type resources.
|
||||
* @returns {String} - A string representing the project.
|
||||
*/
|
||||
matchProjectFromSessionEntityTypeName(sessionEntityTypeName) {
|
||||
return this._pathTemplates.sessionEntityTypePathTemplate.match(
|
||||
sessionEntityTypeName
|
||||
).project;
|
||||
}
|
||||
|
||||
/**
|
||||
* Parse the sessionEntityTypeName from a session_entity_type resource.
|
||||
*
|
||||
* @param {String} sessionEntityTypeName
|
||||
* A fully-qualified path representing a session_entity_type resources.
|
||||
* @returns {String} - A string representing the session.
|
||||
*/
|
||||
matchSessionFromSessionEntityTypeName(sessionEntityTypeName) {
|
||||
return this._pathTemplates.sessionEntityTypePathTemplate.match(
|
||||
sessionEntityTypeName
|
||||
).session;
|
||||
}
|
||||
|
||||
/**
|
||||
* Parse the sessionEntityTypeName from a session_entity_type resource.
|
||||
*
|
||||
* @param {String} sessionEntityTypeName
|
||||
* A fully-qualified path representing a session_entity_type resources.
|
||||
* @returns {String} - A string representing the entity_type.
|
||||
*/
|
||||
matchEntityTypeFromSessionEntityTypeName(sessionEntityTypeName) {
|
||||
return this._pathTemplates.sessionEntityTypePathTemplate.match(
|
||||
sessionEntityTypeName
|
||||
).entity_type;
|
||||
}
|
||||
|
||||
/**
|
||||
* Parse the environmentSessionEntityTypeName from a environment_session_entity_type resource.
|
||||
*
|
||||
* @param {String} environmentSessionEntityTypeName
|
||||
* A fully-qualified path representing a environment_session_entity_type resources.
|
||||
* @returns {String} - A string representing the project.
|
||||
*/
|
||||
matchProjectFromEnvironmentSessionEntityTypeName(
|
||||
environmentSessionEntityTypeName
|
||||
) {
|
||||
return this._pathTemplates.environmentSessionEntityTypePathTemplate.match(
|
||||
environmentSessionEntityTypeName
|
||||
).project;
|
||||
}
|
||||
|
||||
/**
|
||||
* Parse the environmentSessionEntityTypeName from a environment_session_entity_type resource.
|
||||
*
|
||||
* @param {String} environmentSessionEntityTypeName
|
||||
* A fully-qualified path representing a environment_session_entity_type resources.
|
||||
* @returns {String} - A string representing the environment.
|
||||
*/
|
||||
matchEnvironmentFromEnvironmentSessionEntityTypeName(
|
||||
environmentSessionEntityTypeName
|
||||
) {
|
||||
return this._pathTemplates.environmentSessionEntityTypePathTemplate.match(
|
||||
environmentSessionEntityTypeName
|
||||
).environment;
|
||||
}
|
||||
|
||||
/**
|
||||
* Parse the environmentSessionEntityTypeName from a environment_session_entity_type resource.
|
||||
*
|
||||
* @param {String} environmentSessionEntityTypeName
|
||||
* A fully-qualified path representing a environment_session_entity_type resources.
|
||||
* @returns {String} - A string representing the user.
|
||||
*/
|
||||
matchUserFromEnvironmentSessionEntityTypeName(
|
||||
environmentSessionEntityTypeName
|
||||
) {
|
||||
return this._pathTemplates.environmentSessionEntityTypePathTemplate.match(
|
||||
environmentSessionEntityTypeName
|
||||
).user;
|
||||
}
|
||||
|
||||
/**
|
||||
* Parse the environmentSessionEntityTypeName from a environment_session_entity_type resource.
|
||||
*
|
||||
* @param {String} environmentSessionEntityTypeName
|
||||
* A fully-qualified path representing a environment_session_entity_type resources.
|
||||
* @returns {String} - A string representing the session.
|
||||
*/
|
||||
matchSessionFromEnvironmentSessionEntityTypeName(
|
||||
environmentSessionEntityTypeName
|
||||
) {
|
||||
return this._pathTemplates.environmentSessionEntityTypePathTemplate.match(
|
||||
environmentSessionEntityTypeName
|
||||
).session;
|
||||
}
|
||||
|
||||
/**
|
||||
* Parse the environmentSessionEntityTypeName from a environment_session_entity_type resource.
|
||||
*
|
||||
* @param {String} environmentSessionEntityTypeName
|
||||
* A fully-qualified path representing a environment_session_entity_type resources.
|
||||
* @returns {String} - A string representing the entity_type.
|
||||
*/
|
||||
matchEntityTypeFromEnvironmentSessionEntityTypeName(
|
||||
environmentSessionEntityTypeName
|
||||
) {
|
||||
return this._pathTemplates.environmentSessionEntityTypePathTemplate.match(
|
||||
environmentSessionEntityTypeName
|
||||
).entity_type;
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = SessionEntityTypesClient;
|
||||
51
node_modules/dialogflow/src/v2beta1/session_entity_types_client_config.json
generated
vendored
Normal file
51
node_modules/dialogflow/src/v2beta1/session_entity_types_client_config.json
generated
vendored
Normal file
@@ -0,0 +1,51 @@
|
||||
{
|
||||
"interfaces": {
|
||||
"google.cloud.dialogflow.v2beta1.SessionEntityTypes": {
|
||||
"retry_codes": {
|
||||
"idempotent": [
|
||||
"DEADLINE_EXCEEDED",
|
||||
"UNAVAILABLE"
|
||||
],
|
||||
"non_idempotent": []
|
||||
},
|
||||
"retry_params": {
|
||||
"default": {
|
||||
"initial_retry_delay_millis": 100,
|
||||
"retry_delay_multiplier": 1.3,
|
||||
"max_retry_delay_millis": 60000,
|
||||
"initial_rpc_timeout_millis": 20000,
|
||||
"rpc_timeout_multiplier": 1.0,
|
||||
"max_rpc_timeout_millis": 20000,
|
||||
"total_timeout_millis": 600000
|
||||
}
|
||||
},
|
||||
"methods": {
|
||||
"ListSessionEntityTypes": {
|
||||
"timeout_millis": 60000,
|
||||
"retry_codes_name": "idempotent",
|
||||
"retry_params_name": "default"
|
||||
},
|
||||
"GetSessionEntityType": {
|
||||
"timeout_millis": 60000,
|
||||
"retry_codes_name": "idempotent",
|
||||
"retry_params_name": "default"
|
||||
},
|
||||
"CreateSessionEntityType": {
|
||||
"timeout_millis": 60000,
|
||||
"retry_codes_name": "non_idempotent",
|
||||
"retry_params_name": "default"
|
||||
},
|
||||
"UpdateSessionEntityType": {
|
||||
"timeout_millis": 60000,
|
||||
"retry_codes_name": "non_idempotent",
|
||||
"retry_params_name": "default"
|
||||
},
|
||||
"DeleteSessionEntityType": {
|
||||
"timeout_millis": 60000,
|
||||
"retry_codes_name": "idempotent",
|
||||
"retry_params_name": "default"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
427
node_modules/dialogflow/src/v2beta1/sessions_client.js
generated
vendored
Normal file
427
node_modules/dialogflow/src/v2beta1/sessions_client.js
generated
vendored
Normal file
@@ -0,0 +1,427 @@
|
||||
// Copyright 2018 Google LLC
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// https://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
'use strict';
|
||||
|
||||
const gapicConfig = require('./sessions_client_config');
|
||||
const gax = require('google-gax');
|
||||
const merge = require('lodash.merge');
|
||||
const path = require('path');
|
||||
|
||||
const VERSION = require('../../package.json').version;
|
||||
|
||||
/**
|
||||
* A session represents an interaction with a user. You retrieve user input
|
||||
* and pass it to the DetectIntent (or
|
||||
* StreamingDetectIntent) method to determine
|
||||
* user intent and respond.
|
||||
*
|
||||
* @class
|
||||
* @memberof v2beta1
|
||||
*/
|
||||
class SessionsClient {
|
||||
/**
|
||||
* Construct an instance of SessionsClient.
|
||||
*
|
||||
* @param {object} [options] - The configuration object. See the subsequent
|
||||
* parameters for more details.
|
||||
* @param {object} [options.credentials] - Credentials object.
|
||||
* @param {string} [options.credentials.client_email]
|
||||
* @param {string} [options.credentials.private_key]
|
||||
* @param {string} [options.email] - Account email address. Required when
|
||||
* using a .pem or .p12 keyFilename.
|
||||
* @param {string} [options.keyFilename] - 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.
|
||||
* @param {number} [options.port] - The port on which to connect to
|
||||
* the remote host.
|
||||
* @param {string} [options.projectId] - 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
|
||||
* {@link https://developers.google.com/identity/protocols/application-default-credentials Application Default Credentials},
|
||||
* your project ID will be detected automatically.
|
||||
* @param {function} [options.promise] - Custom promise module to use instead
|
||||
* of native Promises.
|
||||
* @param {string} [options.servicePath] - The domain name of the
|
||||
* API remote host.
|
||||
*/
|
||||
constructor(opts) {
|
||||
this._descriptors = {};
|
||||
|
||||
// Ensure that options include the service address and port.
|
||||
opts = Object.assign(
|
||||
{
|
||||
clientConfig: {},
|
||||
port: this.constructor.port,
|
||||
servicePath: this.constructor.servicePath,
|
||||
},
|
||||
opts
|
||||
);
|
||||
|
||||
// Create a `gaxGrpc` object, with any grpc-specific options
|
||||
// sent to the client.
|
||||
opts.scopes = this.constructor.scopes;
|
||||
var gaxGrpc = gax.grpc(opts);
|
||||
|
||||
// Save the auth object to the client, for use by other methods.
|
||||
this.auth = gaxGrpc.auth;
|
||||
|
||||
// Determine the client header string.
|
||||
var clientHeader = [
|
||||
`gl-node/${process.version.node}`,
|
||||
`grpc/${gaxGrpc.grpcVersion}`,
|
||||
`gax/${gax.version}`,
|
||||
`gapic/${VERSION}`,
|
||||
];
|
||||
if (opts.libName && opts.libVersion) {
|
||||
clientHeader.push(`${opts.libName}/${opts.libVersion}`);
|
||||
}
|
||||
|
||||
// Load the applicable protos.
|
||||
var protos = merge(
|
||||
{},
|
||||
gaxGrpc.loadProto(
|
||||
path.join(__dirname, '..', '..', 'protos'),
|
||||
'google/cloud/dialogflow/v2beta1/session.proto'
|
||||
)
|
||||
);
|
||||
|
||||
// This API contains "path templates"; forward-slash-separated
|
||||
// identifiers to uniquely identify resources within the API.
|
||||
// Create useful helper objects for these.
|
||||
this._pathTemplates = {
|
||||
sessionPathTemplate: new gax.PathTemplate(
|
||||
'projects/{project}/agent/sessions/{session}'
|
||||
),
|
||||
environmentSessionPathTemplate: new gax.PathTemplate(
|
||||
'projects/{project}/agent/environments/{environment}/users/{user}/sessions/{session}'
|
||||
),
|
||||
};
|
||||
|
||||
// Some of the methods on this service provide streaming responses.
|
||||
// Provide descriptors for these.
|
||||
this._descriptors.stream = {
|
||||
streamingDetectIntent: new gax.StreamDescriptor(
|
||||
gax.StreamType.BIDI_STREAMING
|
||||
),
|
||||
};
|
||||
|
||||
// Put together the default options sent with requests.
|
||||
var defaults = gaxGrpc.constructSettings(
|
||||
'google.cloud.dialogflow.v2beta1.Sessions',
|
||||
gapicConfig,
|
||||
opts.clientConfig,
|
||||
{'x-goog-api-client': clientHeader.join(' ')}
|
||||
);
|
||||
|
||||
// Set up a dictionary of "inner API calls"; the core implementation
|
||||
// of calling the API is handled in `google-gax`, with this code
|
||||
// merely providing the destination and request information.
|
||||
this._innerApiCalls = {};
|
||||
|
||||
// Put together the "service stub" for
|
||||
// google.cloud.dialogflow.v2beta1.Sessions.
|
||||
var sessionsStub = gaxGrpc.createStub(
|
||||
protos.google.cloud.dialogflow.v2beta1.Sessions,
|
||||
opts
|
||||
);
|
||||
|
||||
// Iterate over each of the methods that the service provides
|
||||
// and create an API call method for each.
|
||||
var sessionsStubMethods = ['detectIntent', 'streamingDetectIntent'];
|
||||
for (let methodName of sessionsStubMethods) {
|
||||
this._innerApiCalls[methodName] = gax.createApiCall(
|
||||
sessionsStub.then(
|
||||
stub =>
|
||||
function() {
|
||||
var args = Array.prototype.slice.call(arguments, 0);
|
||||
return stub[methodName].apply(stub, args);
|
||||
}
|
||||
),
|
||||
defaults[methodName],
|
||||
this._descriptors.stream[methodName]
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* The DNS address for this API service.
|
||||
*/
|
||||
static get servicePath() {
|
||||
return 'dialogflow.googleapis.com';
|
||||
}
|
||||
|
||||
/**
|
||||
* The port for this API service.
|
||||
*/
|
||||
static get port() {
|
||||
return 443;
|
||||
}
|
||||
|
||||
/**
|
||||
* The scopes needed to make gRPC calls for every method defined
|
||||
* in this service.
|
||||
*/
|
||||
static get scopes() {
|
||||
return ['https://www.googleapis.com/auth/cloud-platform'];
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the project ID used by this class.
|
||||
* @param {function(Error, string)} callback - the callback to
|
||||
* be called with the current project Id.
|
||||
*/
|
||||
getProjectId(callback) {
|
||||
return this.auth.getProjectId(callback);
|
||||
}
|
||||
|
||||
// -------------------
|
||||
// -- Service calls --
|
||||
// -------------------
|
||||
|
||||
/**
|
||||
* Processes a natural language query and returns structured, actionable data
|
||||
* as a result. This method is not idempotent, because it may cause contexts
|
||||
* and session entity types to be updated, which in turn might affect
|
||||
* results of future queries.
|
||||
*
|
||||
* @param {Object} request
|
||||
* The request object that will be sent.
|
||||
* @param {string} request.session
|
||||
* Required. The name of the session this query is sent to. Format:
|
||||
* `projects/<Project ID>/agent/sessions/<Session ID>`, or
|
||||
* `projects/<Project ID>/agent/environments/<Environment ID>/users/<User
|
||||
* ID>/sessions/<Session ID>`. Note: Environments and users are under
|
||||
* construction and will be available soon. If <Environment ID> is not
|
||||
* specified, we assume default 'draft' environment. If <User ID> is not
|
||||
* specified, we are using "-". It’s up to the API caller to choose an
|
||||
* appropriate <Session ID>. and <User Id>. They can be a random numbers or
|
||||
* some type of user and session identifiers (preferably hashed). The length
|
||||
* of the <Session ID> and <User ID> must not exceed 36 characters.
|
||||
* @param {Object} request.queryInput
|
||||
* Required. The input specification. It can be set to:
|
||||
*
|
||||
* 1. an audio config
|
||||
* which instructs the speech recognizer how to process the speech audio,
|
||||
*
|
||||
* 2. a conversational query in the form of text, or
|
||||
*
|
||||
* 3. an event that specifies which intent to trigger.
|
||||
*
|
||||
* This object should have the same structure as [QueryInput]{@link google.cloud.dialogflow.v2beta1.QueryInput}
|
||||
* @param {Object} [request.queryParams]
|
||||
* Optional. The parameters of this query.
|
||||
*
|
||||
* This object should have the same structure as [QueryParameters]{@link google.cloud.dialogflow.v2beta1.QueryParameters}
|
||||
* @param {string} [request.inputAudio]
|
||||
* Optional. The natural language speech audio to be processed. This field
|
||||
* should be populated iff `query_input` is set to an input audio config.
|
||||
* A single request can contain up to 1 minute of speech audio data.
|
||||
* @param {Object} [options]
|
||||
* Optional parameters. You can override the default settings for this call, e.g, timeout,
|
||||
* retries, paginations, etc. See [gax.CallOptions]{@link https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the details.
|
||||
* @param {function(?Error, ?Object)} [callback]
|
||||
* The function which will be called with the result of the API call.
|
||||
*
|
||||
* The second parameter to the callback is an object representing [DetectIntentResponse]{@link google.cloud.dialogflow.v2beta1.DetectIntentResponse}.
|
||||
* @returns {Promise} - The promise which resolves to an array.
|
||||
* The first element of the array is an object representing [DetectIntentResponse]{@link google.cloud.dialogflow.v2beta1.DetectIntentResponse}.
|
||||
* The promise has a method named "cancel" which cancels the ongoing API call.
|
||||
*
|
||||
* @example
|
||||
*
|
||||
* const dialogflow = require('dialogflow.v2beta1');
|
||||
*
|
||||
* var client = new dialogflow.v2beta1.SessionsClient({
|
||||
* // optional auth parameters.
|
||||
* });
|
||||
*
|
||||
* var formattedSession = client.sessionPath('[PROJECT]', '[SESSION]');
|
||||
* var queryInput = {};
|
||||
* var request = {
|
||||
* session: formattedSession,
|
||||
* queryInput: queryInput,
|
||||
* };
|
||||
* client.detectIntent(request)
|
||||
* .then(responses => {
|
||||
* var response = responses[0];
|
||||
* // doThingsWith(response)
|
||||
* })
|
||||
* .catch(err => {
|
||||
* console.error(err);
|
||||
* });
|
||||
*/
|
||||
detectIntent(request, options, callback) {
|
||||
if (options instanceof Function && callback === undefined) {
|
||||
callback = options;
|
||||
options = {};
|
||||
}
|
||||
options = options || {};
|
||||
|
||||
return this._innerApiCalls.detectIntent(request, options, callback);
|
||||
}
|
||||
|
||||
/**
|
||||
* Processes a natural language query in audio format in a streaming fashion
|
||||
* and returns structured, actionable data as a result. This method is only
|
||||
* available via the gRPC API (not REST).
|
||||
*
|
||||
* @param {Object} [options]
|
||||
* Optional parameters. You can override the default settings for this call, e.g, timeout,
|
||||
* retries, paginations, etc. See [gax.CallOptions]{@link https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the details.
|
||||
* @returns {Stream}
|
||||
* An object stream which is both readable and writable. It accepts objects
|
||||
* representing [StreamingDetectIntentRequest]{@link google.cloud.dialogflow.v2beta1.StreamingDetectIntentRequest} for write() method, and
|
||||
* will emit objects representing [StreamingDetectIntentResponse]{@link google.cloud.dialogflow.v2beta1.StreamingDetectIntentResponse} on 'data' event asynchronously.
|
||||
*
|
||||
* @example
|
||||
*
|
||||
* const dialogflow = require('dialogflow.v2beta1');
|
||||
*
|
||||
* var client = new dialogflow.v2beta1.SessionsClient({
|
||||
* // optional auth parameters.
|
||||
* });
|
||||
*
|
||||
* var stream = client.streamingDetectIntent().on('data', response => {
|
||||
* // doThingsWith(response)
|
||||
* });
|
||||
* var session = '';
|
||||
* var queryInput = {};
|
||||
* var request = {
|
||||
* session: session,
|
||||
* queryInput: queryInput,
|
||||
* };
|
||||
* // Write request objects.
|
||||
* stream.write(request);
|
||||
*/
|
||||
streamingDetectIntent(options) {
|
||||
options = options || {};
|
||||
|
||||
return this._innerApiCalls.streamingDetectIntent(options);
|
||||
}
|
||||
|
||||
// --------------------
|
||||
// -- Path templates --
|
||||
// --------------------
|
||||
|
||||
/**
|
||||
* Return a fully-qualified session resource name string.
|
||||
*
|
||||
* @param {String} project
|
||||
* @param {String} session
|
||||
* @returns {String}
|
||||
*/
|
||||
sessionPath(project, session) {
|
||||
return this._pathTemplates.sessionPathTemplate.render({
|
||||
project: project,
|
||||
session: session,
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Return a fully-qualified environment_session resource name string.
|
||||
*
|
||||
* @param {String} project
|
||||
* @param {String} environment
|
||||
* @param {String} user
|
||||
* @param {String} session
|
||||
* @returns {String}
|
||||
*/
|
||||
environmentSessionPath(project, environment, user, session) {
|
||||
return this._pathTemplates.environmentSessionPathTemplate.render({
|
||||
project: project,
|
||||
environment: environment,
|
||||
user: user,
|
||||
session: session,
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Parse the sessionName from a session resource.
|
||||
*
|
||||
* @param {String} sessionName
|
||||
* A fully-qualified path representing a session resources.
|
||||
* @returns {String} - A string representing the project.
|
||||
*/
|
||||
matchProjectFromSessionName(sessionName) {
|
||||
return this._pathTemplates.sessionPathTemplate.match(sessionName).project;
|
||||
}
|
||||
|
||||
/**
|
||||
* Parse the sessionName from a session resource.
|
||||
*
|
||||
* @param {String} sessionName
|
||||
* A fully-qualified path representing a session resources.
|
||||
* @returns {String} - A string representing the session.
|
||||
*/
|
||||
matchSessionFromSessionName(sessionName) {
|
||||
return this._pathTemplates.sessionPathTemplate.match(sessionName).session;
|
||||
}
|
||||
|
||||
/**
|
||||
* Parse the environmentSessionName from a environment_session resource.
|
||||
*
|
||||
* @param {String} environmentSessionName
|
||||
* A fully-qualified path representing a environment_session resources.
|
||||
* @returns {String} - A string representing the project.
|
||||
*/
|
||||
matchProjectFromEnvironmentSessionName(environmentSessionName) {
|
||||
return this._pathTemplates.environmentSessionPathTemplate.match(
|
||||
environmentSessionName
|
||||
).project;
|
||||
}
|
||||
|
||||
/**
|
||||
* Parse the environmentSessionName from a environment_session resource.
|
||||
*
|
||||
* @param {String} environmentSessionName
|
||||
* A fully-qualified path representing a environment_session resources.
|
||||
* @returns {String} - A string representing the environment.
|
||||
*/
|
||||
matchEnvironmentFromEnvironmentSessionName(environmentSessionName) {
|
||||
return this._pathTemplates.environmentSessionPathTemplate.match(
|
||||
environmentSessionName
|
||||
).environment;
|
||||
}
|
||||
|
||||
/**
|
||||
* Parse the environmentSessionName from a environment_session resource.
|
||||
*
|
||||
* @param {String} environmentSessionName
|
||||
* A fully-qualified path representing a environment_session resources.
|
||||
* @returns {String} - A string representing the user.
|
||||
*/
|
||||
matchUserFromEnvironmentSessionName(environmentSessionName) {
|
||||
return this._pathTemplates.environmentSessionPathTemplate.match(
|
||||
environmentSessionName
|
||||
).user;
|
||||
}
|
||||
|
||||
/**
|
||||
* Parse the environmentSessionName from a environment_session resource.
|
||||
*
|
||||
* @param {String} environmentSessionName
|
||||
* A fully-qualified path representing a environment_session resources.
|
||||
* @returns {String} - A string representing the session.
|
||||
*/
|
||||
matchSessionFromEnvironmentSessionName(environmentSessionName) {
|
||||
return this._pathTemplates.environmentSessionPathTemplate.match(
|
||||
environmentSessionName
|
||||
).session;
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = SessionsClient;
|
||||
36
node_modules/dialogflow/src/v2beta1/sessions_client_config.json
generated
vendored
Normal file
36
node_modules/dialogflow/src/v2beta1/sessions_client_config.json
generated
vendored
Normal file
@@ -0,0 +1,36 @@
|
||||
{
|
||||
"interfaces": {
|
||||
"google.cloud.dialogflow.v2beta1.Sessions": {
|
||||
"retry_codes": {
|
||||
"idempotent": [
|
||||
"DEADLINE_EXCEEDED",
|
||||
"UNAVAILABLE"
|
||||
],
|
||||
"non_idempotent": []
|
||||
},
|
||||
"retry_params": {
|
||||
"default": {
|
||||
"initial_retry_delay_millis": 100,
|
||||
"retry_delay_multiplier": 1.3,
|
||||
"max_retry_delay_millis": 60000,
|
||||
"initial_rpc_timeout_millis": 20000,
|
||||
"rpc_timeout_multiplier": 1.0,
|
||||
"max_rpc_timeout_millis": 20000,
|
||||
"total_timeout_millis": 600000
|
||||
}
|
||||
},
|
||||
"methods": {
|
||||
"DetectIntent": {
|
||||
"timeout_millis": 220000,
|
||||
"retry_codes_name": "non_idempotent",
|
||||
"retry_params_name": "default"
|
||||
},
|
||||
"StreamingDetectIntent": {
|
||||
"timeout_millis": 220000,
|
||||
"retry_codes_name": "non_idempotent",
|
||||
"retry_params_name": "default"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user