From ce6eb87d9f732c0b60bf106acc788bb9e9629a4e Mon Sep 17 00:00:00 2001 From: Yoshi Automation Bot Date: Tue, 8 Dec 2020 13:05:30 -0800 Subject: [PATCH] feat: added support for regionalization for document API (#722) * feat: added support for regionalization for document API docs: suggested to always use version for production traffic when calling DetectIntent.marked match_mode in Agent message as deprecated PiperOrigin-RevId: 345544333 Source-Author: Google APIs Source-Date: Thu Dec 3 15:08:48 2020 -0800 Source-Repo: googleapis/googleapis Source-Sha: a6cbc5fabe30ffce1a46885e80ec552fd2ea6b8d Source-Link: https://github.com/googleapis/googleapis/commit/a6cbc5fabe30ffce1a46885e80ec552fd2ea6b8d * chore: generate GAPIC metadata JSON file PiperOrigin-RevId: 345596855 Source-Author: Google APIs Source-Date: Thu Dec 3 21:00:34 2020 -0800 Source-Repo: googleapis/googleapis Source-Sha: d189e871205fea665a9648f7c4676f027495ccaf Source-Link: https://github.com/googleapis/googleapis/commit/d189e871205fea665a9648f7c4676f027495ccaf --- .../cloud/dialogflow/v2beta1/agent.proto | 2 +- .../dialogflow/v2beta1/audio_config.proto | 60 +-- .../cloud/dialogflow/v2beta1/document.proto | 52 ++- .../dialogflow/v2beta1/knowledge_base.proto | 31 +- .../cloud/dialogflow/v2beta1/session.proto | 18 +- .../protos/protos.d.ts | 36 +- .../google-cloud-dialogflow/protos/protos.js | 99 ++-- .../protos/protos.json | 177 +++++--- .../src/v2/gapic_metadata.json | 284 ++++++++++++ .../src/v2beta1/agents_client.ts | 363 +++++++++++---- .../src/v2beta1/contexts_client.ts | 363 +++++++++++---- .../src/v2beta1/documents_client.ts | 393 +++++++++++----- .../src/v2beta1/entity_types_client.ts | 363 +++++++++++---- .../src/v2beta1/environments_client.ts | 363 +++++++++++---- .../src/v2beta1/gapic_metadata.json | 364 +++++++++++++++ .../src/v2beta1/intents_client.ts | 363 +++++++++++---- .../src/v2beta1/knowledge_bases_client.ts | 377 +++++++++++----- .../v2beta1/session_entity_types_client.ts | 363 +++++++++++---- .../src/v2beta1/sessions_client.ts | 375 ++++++++++++---- .../google-cloud-dialogflow/synth.metadata | 6 +- .../test/gapic_agents_v2beta1.ts | 412 ++++++++++++----- .../test/gapic_contexts_v2beta1.ts | 412 ++++++++++++----- .../test/gapic_documents_v2beta1.ts | 412 ++++++++++++----- .../test/gapic_entity_types_v2beta1.ts | 412 ++++++++++++----- .../test/gapic_environments_v2beta1.ts | 412 ++++++++++++----- .../test/gapic_intents_v2beta1.ts | 412 ++++++++++++----- .../test/gapic_knowledge_bases_v2beta1.ts | 412 ++++++++++++----- .../gapic_session_entity_types_v2beta1.ts | 424 +++++++++++++----- .../test/gapic_sessions_v2beta1.ts | 412 ++++++++++++----- 29 files changed, 6120 insertions(+), 2052 deletions(-) create mode 100644 packages/google-cloud-dialogflow/src/v2/gapic_metadata.json create mode 100644 packages/google-cloud-dialogflow/src/v2beta1/gapic_metadata.json diff --git a/packages/google-cloud-dialogflow/protos/google/cloud/dialogflow/v2beta1/agent.proto b/packages/google-cloud-dialogflow/protos/google/cloud/dialogflow/v2beta1/agent.proto index 4358410279b..bb413e8458b 100644 --- a/packages/google-cloud-dialogflow/protos/google/cloud/dialogflow/v2beta1/agent.proto +++ b/packages/google-cloud-dialogflow/protos/google/cloud/dialogflow/v2beta1/agent.proto @@ -305,7 +305,7 @@ message Agent { bool enable_logging = 8; // Optional. Determines how intents are detected from user queries. - MatchMode match_mode = 9; + MatchMode match_mode = 9 [deprecated = true]; // Optional. To filter out false positive results and still get variety in // matched natural language inputs for your agent, you can tune the machine diff --git a/packages/google-cloud-dialogflow/protos/google/cloud/dialogflow/v2beta1/audio_config.proto b/packages/google-cloud-dialogflow/protos/google/cloud/dialogflow/v2beta1/audio_config.proto index f9a9d53e7c4..7afa9bbc6e9 100644 --- a/packages/google-cloud-dialogflow/protos/google/cloud/dialogflow/v2beta1/audio_config.proto +++ b/packages/google-cloud-dialogflow/protos/google/cloud/dialogflow/v2beta1/audio_config.proto @@ -30,36 +30,6 @@ option java_outer_classname = "AudioConfigProto"; option java_package = "com.google.cloud.dialogflow.v2beta1"; option objc_class_prefix = "DF"; -// Hints for the speech recognizer to help with recognition in a specific -// conversation state. -message SpeechContext { - // Optional. A list of strings containing words and phrases that the speech - // recognizer should recognize with higher likelihood. - // - // This list can be used to: - // - // * improve accuracy for words and phrases you expect the user to say, - // e.g. typical commands for your Dialogflow agent - // * add additional words to the speech recognizer vocabulary - // * ... - // - // See the [Cloud Speech - // documentation](https://cloud.google.com/speech-to-text/quotas) for usage - // limits. - repeated string phrases = 1; - - // Optional. Boost for this context compared to other contexts: - // - // * If the boost is positive, Dialogflow will increase the probability that - // the phrases in this context are recognized over similar sounding phrases. - // * If the boost is unspecified or non-positive, Dialogflow will not apply - // any boost. - // - // Dialogflow recommends that you use boosts in the range (0, 20] and that you - // find a value that fits your use case with binary search. - float boost = 2; -} - // Audio encoding of the audio content sent in the conversational query request. // Refer to the // [Cloud Speech API @@ -109,6 +79,36 @@ enum AudioEncoding { AUDIO_ENCODING_SPEEX_WITH_HEADER_BYTE = 7; } +// Hints for the speech recognizer to help with recognition in a specific +// conversation state. +message SpeechContext { + // Optional. A list of strings containing words and phrases that the speech + // recognizer should recognize with higher likelihood. + // + // This list can be used to: + // + // * improve accuracy for words and phrases you expect the user to say, + // e.g. typical commands for your Dialogflow agent + // * add additional words to the speech recognizer vocabulary + // * ... + // + // See the [Cloud Speech + // documentation](https://cloud.google.com/speech-to-text/quotas) for usage + // limits. + repeated string phrases = 1; + + // Optional. Boost for this context compared to other contexts: + // + // * If the boost is positive, Dialogflow will increase the probability that + // the phrases in this context are recognized over similar sounding phrases. + // * If the boost is unspecified or non-positive, Dialogflow will not apply + // any boost. + // + // Dialogflow recommends that you use boosts in the range (0, 20] and that you + // find a value that fits your use case with binary search. + float boost = 2; +} + // Information for a word recognized by the speech recognizer. message SpeechWordInfo { // The word this info is for. diff --git a/packages/google-cloud-dialogflow/protos/google/cloud/dialogflow/v2beta1/document.proto b/packages/google-cloud-dialogflow/protos/google/cloud/dialogflow/v2beta1/document.proto index 94d7055a779..a0bc4812af7 100644 --- a/packages/google-cloud-dialogflow/protos/google/cloud/dialogflow/v2beta1/document.proto +++ b/packages/google-cloud-dialogflow/protos/google/cloud/dialogflow/v2beta1/document.proto @@ -49,6 +49,9 @@ service Documents { rpc ListDocuments(ListDocumentsRequest) returns (ListDocumentsResponse) { option (google.api.http) = { get: "/v2beta1/{parent=projects/*/knowledgeBases/*}/documents" + additional_bindings { + get: "/v2beta1/{parent=projects/*/locations/*/knowledgeBases/*}/documents" + } additional_bindings { get: "/v2beta1/{parent=projects/*/agent/knowledgeBases/*}/documents" } @@ -63,6 +66,9 @@ service Documents { rpc GetDocument(GetDocumentRequest) returns (Document) { option (google.api.http) = { get: "/v2beta1/{name=projects/*/knowledgeBases/*/documents/*}" + additional_bindings { + get: "/v2beta1/{name=projects/*/locations/*/knowledgeBases/*/documents/*}" + } additional_bindings { get: "/v2beta1/{name=projects/*/agent/knowledgeBases/*/documents/*}" } @@ -78,6 +84,10 @@ service Documents { option (google.api.http) = { post: "/v2beta1/{parent=projects/*/knowledgeBases/*}/documents" body: "document" + additional_bindings { + post: "/v2beta1/{parent=projects/*/locations/*/knowledgeBases/*}/documents" + body: "document" + } additional_bindings { post: "/v2beta1/{parent=projects/*/agent/knowledgeBases/*}/documents" body: "document" @@ -97,6 +107,9 @@ service Documents { rpc DeleteDocument(DeleteDocumentRequest) returns (google.longrunning.Operation) { option (google.api.http) = { delete: "/v2beta1/{name=projects/*/knowledgeBases/*/documents/*}" + additional_bindings { + delete: "/v2beta1/{name=projects/*/locations/*/knowledgeBases/*/documents/*}" + } additional_bindings { delete: "/v2beta1/{name=projects/*/agent/knowledgeBases/*/documents/*}" } @@ -116,6 +129,10 @@ service Documents { option (google.api.http) = { patch: "/v2beta1/{document.name=projects/*/knowledgeBases/*/documents/*}" body: "document" + additional_bindings { + patch: "/v2beta1/{document.name=projects/*/locations/*/knowledgeBases/*/documents/*}" + body: "document" + } additional_bindings { patch: "/v2beta1/{document.name=projects/*/agent/knowledgeBases/*/documents/*}" body: "document" @@ -143,6 +160,10 @@ service Documents { option (google.api.http) = { post: "/v2beta1/{name=projects/*/knowledgeBases/*/documents/*}:reload" body: "*" + additional_bindings { + post: "/v2beta1/{name=projects/*/locations/*/knowledgeBases/*/documents/*}:reload" + body: "*" + } additional_bindings { post: "/v2beta1/{name=projects/*/agent/knowledgeBases/*/documents/*}:reload" body: "*" @@ -167,6 +188,7 @@ message Document { option (google.api.resource) = { type: "dialogflow.googleapis.com/Document" pattern: "projects/{project}/knowledgeBases/{knowledge_base}/documents/{document}" + pattern: "projects/{project}/locations/{location}/knowledgeBases/{knowledge_base}/documents/{document}" }; // The status of a reload attempt. @@ -201,8 +223,8 @@ message Document { // Optional. The document resource name. // The name must be empty when creating a document. - // Format: `projects//knowledgeBases//documents/`. + // Format: `projects//locations//knowledgeBases//documents/`. string name = 1 [(google.api.field_behavior) = OPTIONAL]; // Required. The display name of the document. The name must be 1024 bytes or @@ -266,8 +288,8 @@ message Document { // Request message for [Documents.GetDocument][google.cloud.dialogflow.v2beta1.Documents.GetDocument]. message GetDocumentRequest { // Required. The name of the document to retrieve. - // Format `projects//knowledgeBases//documents/`. + // Format `projects//locations//knowledgeBases//documents/`. string name = 1 [ (google.api.field_behavior) = REQUIRED, (google.api.resource_reference) = { @@ -279,7 +301,8 @@ message GetDocumentRequest { // Request message for [Documents.ListDocuments][google.cloud.dialogflow.v2beta1.Documents.ListDocuments]. message ListDocumentsRequest { // Required. The knowledge base to list all documents for. - // Format: `projects//knowledgeBases/`. + // Format: `projects//locations//knowledgeBases/`. string parent = 1 [ (google.api.field_behavior) = REQUIRED, (google.api.resource_reference) = { @@ -331,7 +354,8 @@ message ListDocumentsResponse { // Request message for [Documents.CreateDocument][google.cloud.dialogflow.v2beta1.Documents.CreateDocument]. message CreateDocumentRequest { // Required. The knowledge base to create a document for. - // Format: `projects//knowledgeBases/`. + // Format: `projects//locations//knowledgeBases/`. string parent = 1 [ (google.api.field_behavior) = REQUIRED, (google.api.resource_reference) = { @@ -341,13 +365,17 @@ message CreateDocumentRequest { // Required. The document to create. Document document = 2 [(google.api.field_behavior) = REQUIRED]; + + // Whether to import custom metadata from Google Cloud Storage. + // Only valid when the document source is Google Cloud Storage URI. + bool import_gcs_custom_metadata = 3; } // Request message for [Documents.DeleteDocument][google.cloud.dialogflow.v2beta1.Documents.DeleteDocument]. message DeleteDocumentRequest { // Required. The name of the document to delete. - // Format: `projects//knowledgeBases//documents/`. + // Format: `projects//locations//knowledgeBases//documents/`. string name = 1 [ (google.api.field_behavior) = REQUIRED, (google.api.resource_reference) = { @@ -391,8 +419,8 @@ message KnowledgeOperationMetadata { // Request message for [Documents.ReloadDocument][google.cloud.dialogflow.v2beta1.Documents.ReloadDocument]. message ReloadDocumentRequest { // Required. The name of the document to reload. - // Format: `projects//knowledgeBases//documents/` + // Format: `projects//locations//knowledgeBases//documents/` string name = 1 [ (google.api.field_behavior) = REQUIRED, (google.api.resource_reference) = { @@ -408,4 +436,8 @@ message ReloadDocumentRequest { // If not provided, the Document's existing source will be reloaded. GcsSource gcs_source = 3; } + + // Whether to import custom metadata from Google Cloud Storage. + // Only valid when the document source is Google Cloud Storage URI. + bool import_gcs_custom_metadata = 4; } diff --git a/packages/google-cloud-dialogflow/protos/google/cloud/dialogflow/v2beta1/knowledge_base.proto b/packages/google-cloud-dialogflow/protos/google/cloud/dialogflow/v2beta1/knowledge_base.proto index 48f1be62643..997b2bea089 100644 --- a/packages/google-cloud-dialogflow/protos/google/cloud/dialogflow/v2beta1/knowledge_base.proto +++ b/packages/google-cloud-dialogflow/protos/google/cloud/dialogflow/v2beta1/knowledge_base.proto @@ -45,6 +45,9 @@ service KnowledgeBases { rpc ListKnowledgeBases(ListKnowledgeBasesRequest) returns (ListKnowledgeBasesResponse) { option (google.api.http) = { get: "/v2beta1/{parent=projects/*}/knowledgeBases" + additional_bindings { + get: "/v2beta1/{parent=projects/*/locations/*}/knowledgeBases" + } additional_bindings { get: "/v2beta1/{parent=projects/*/agent}/knowledgeBases" } @@ -59,6 +62,9 @@ service KnowledgeBases { rpc GetKnowledgeBase(GetKnowledgeBaseRequest) returns (KnowledgeBase) { option (google.api.http) = { get: "/v2beta1/{name=projects/*/knowledgeBases/*}" + additional_bindings { + get: "/v2beta1/{name=projects/*/locations/*/knowledgeBases/*}" + } additional_bindings { get: "/v2beta1/{name=projects/*/agent/knowledgeBases/*}" } @@ -74,6 +80,10 @@ service KnowledgeBases { option (google.api.http) = { post: "/v2beta1/{parent=projects/*}/knowledgeBases" body: "knowledge_base" + additional_bindings { + post: "/v2beta1/{parent=projects/*/locations/*}/knowledgeBases" + body: "knowledge_base" + } additional_bindings { post: "/v2beta1/{parent=projects/*/agent}/knowledgeBases" body: "knowledge_base" @@ -89,6 +99,9 @@ service KnowledgeBases { rpc DeleteKnowledgeBase(DeleteKnowledgeBaseRequest) returns (google.protobuf.Empty) { option (google.api.http) = { delete: "/v2beta1/{name=projects/*/knowledgeBases/*}" + additional_bindings { + delete: "/v2beta1/{name=projects/*/locations/*/knowledgeBases/*}" + } additional_bindings { delete: "/v2beta1/{name=projects/*/agent/knowledgeBases/*}" } @@ -104,6 +117,10 @@ service KnowledgeBases { option (google.api.http) = { patch: "/v2beta1/{knowledge_base.name=projects/*/knowledgeBases/*}" body: "knowledge_base" + additional_bindings { + patch: "/v2beta1/{knowledge_base.name=projects/*/locations/*/knowledgeBases/*}" + body: "knowledge_base" + } additional_bindings { patch: "/v2beta1/{knowledge_base.name=projects/*/agent/knowledgeBases/*}" body: "knowledge_base" @@ -128,11 +145,13 @@ message KnowledgeBase { option (google.api.resource) = { type: "dialogflow.googleapis.com/KnowledgeBase" pattern: "projects/{project}/knowledgeBases/{knowledge_base}" + pattern: "projects/{project}/locations/{location}/knowledgeBases/{knowledge_base}" }; // The knowledge base resource name. // The name must be empty when creating a knowledge base. - // Format: `projects//knowledgeBases/`. + // Format: `projects//locations//knowledgeBases/`. string name = 1; // Required. The display name of the knowledge base. The name must be 1024 @@ -148,7 +167,7 @@ message KnowledgeBase { // Request message for [KnowledgeBases.ListKnowledgeBases][google.cloud.dialogflow.v2beta1.KnowledgeBases.ListKnowledgeBases]. message ListKnowledgeBasesRequest { // Required. The project to list of knowledge bases for. - // Format: `projects/`. + // Format: `projects//locations/`. string parent = 1 [ (google.api.field_behavior) = REQUIRED, (google.api.resource_reference) = { @@ -205,7 +224,8 @@ message ListKnowledgeBasesResponse { // Request message for [KnowledgeBases.GetKnowledgeBase][google.cloud.dialogflow.v2beta1.KnowledgeBases.GetKnowledgeBase]. message GetKnowledgeBaseRequest { // Required. The name of the knowledge base to retrieve. - // Format `projects//knowledgeBases/`. + // Format `projects//locations//knowledgeBases/`. string name = 1 [ (google.api.field_behavior) = REQUIRED, (google.api.resource_reference) = { @@ -217,7 +237,7 @@ message GetKnowledgeBaseRequest { // Request message for [KnowledgeBases.CreateKnowledgeBase][google.cloud.dialogflow.v2beta1.KnowledgeBases.CreateKnowledgeBase]. message CreateKnowledgeBaseRequest { // Required. The project to create a knowledge base for. - // Format: `projects/`. + // Format: `projects//locations/`. string parent = 1 [ (google.api.field_behavior) = REQUIRED, (google.api.resource_reference) = { @@ -232,7 +252,8 @@ message CreateKnowledgeBaseRequest { // Request message for [KnowledgeBases.DeleteKnowledgeBase][google.cloud.dialogflow.v2beta1.KnowledgeBases.DeleteKnowledgeBase]. message DeleteKnowledgeBaseRequest { // Required. The name of the knowledge base to delete. - // Format: `projects//knowledgeBases/`. + // Format: `projects//locations//knowledgeBases/`. string name = 1 [ (google.api.field_behavior) = REQUIRED, (google.api.resource_reference) = { diff --git a/packages/google-cloud-dialogflow/protos/google/cloud/dialogflow/v2beta1/session.proto b/packages/google-cloud-dialogflow/protos/google/cloud/dialogflow/v2beta1/session.proto index 340051c131d..566824d5b03 100644 --- a/packages/google-cloud-dialogflow/protos/google/cloud/dialogflow/v2beta1/session.proto +++ b/packages/google-cloud-dialogflow/protos/google/cloud/dialogflow/v2beta1/session.proto @@ -60,6 +60,10 @@ service Sessions { // 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. + // + // Note: Always use agent versions for production traffic. + // See [Versions and + // environments](https://cloud.google.com/dialogflow/es/docs/agents-versions). rpc DetectIntent(DetectIntentRequest) returns (DetectIntentResponse) { option (google.api.http) = { post: "/v2beta1/{session=projects/*/agent/sessions/*}:detectIntent" @@ -83,6 +87,10 @@ service Sessions { // 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). + // + // Note: Always use agent versions for production traffic. + // See [Versions and + // environments](https://cloud.google.com/dialogflow/es/docs/agents-versions). rpc StreamingDetectIntent(stream StreamingDetectIntentRequest) returns (stream StreamingDetectIntentResponse) { } } @@ -107,6 +115,10 @@ message DetectIntentRequest { // The length of the `Session ID` and `User ID` must not exceed 36 characters. // For more information, see the [API interactions // guide](https://cloud.google.com/dialogflow/docs/api-overview). + // + // Note: Always use agent versions for production traffic. + // See [Versions and + // environments](https://cloud.google.com/dialogflow/es/docs/agents-versions). string session = 1 [ (google.api.field_behavior) = REQUIRED, (google.api.resource_reference) = { @@ -234,7 +246,7 @@ message QueryParameters { repeated SubAgent sub_agents = 13; // This field can be used to pass HTTP headers for a webhook - // call. These headers will be sent to webhook alone with the headers that + // call. These headers will be sent to webhook along with the headers that // have been configured through Dialogflow web console. The headers defined // within this field will overwrite the headers configured through Dialogflow // console if there is a conflict. Header names are case-insensitive. @@ -487,6 +499,10 @@ message StreamingDetectIntentRequest { // // For more information, see the [API interactions // guide](https://cloud.google.com/dialogflow/docs/api-overview). + // + // Note: Always use agent versions for production traffic. + // See [Versions and + // environments](https://cloud.google.com/dialogflow/es/docs/agents-versions). string session = 1 [ (google.api.field_behavior) = REQUIRED, (google.api.resource_reference) = { diff --git a/packages/google-cloud-dialogflow/protos/protos.d.ts b/packages/google-cloud-dialogflow/protos/protos.d.ts index 81424f239a6..d231deecb8e 100644 --- a/packages/google-cloud-dialogflow/protos/protos.d.ts +++ b/packages/google-cloud-dialogflow/protos/protos.d.ts @@ -14839,6 +14839,18 @@ export namespace google { public toJSON(): { [k: string]: any }; } + /** AudioEncoding enum. */ + enum AudioEncoding { + AUDIO_ENCODING_UNSPECIFIED = 0, + AUDIO_ENCODING_LINEAR_16 = 1, + AUDIO_ENCODING_FLAC = 2, + AUDIO_ENCODING_MULAW = 3, + AUDIO_ENCODING_AMR = 4, + AUDIO_ENCODING_AMR_WB = 5, + AUDIO_ENCODING_OGG_OPUS = 6, + AUDIO_ENCODING_SPEEX_WITH_HEADER_BYTE = 7 + } + /** Properties of a SpeechContext. */ interface ISpeechContext { @@ -14935,18 +14947,6 @@ export namespace google { public toJSON(): { [k: string]: any }; } - /** AudioEncoding enum. */ - enum AudioEncoding { - AUDIO_ENCODING_UNSPECIFIED = 0, - AUDIO_ENCODING_LINEAR_16 = 1, - AUDIO_ENCODING_FLAC = 2, - AUDIO_ENCODING_MULAW = 3, - AUDIO_ENCODING_AMR = 4, - AUDIO_ENCODING_AMR_WB = 5, - AUDIO_ENCODING_OGG_OPUS = 6, - AUDIO_ENCODING_SPEEX_WITH_HEADER_BYTE = 7 - } - /** Properties of a SpeechWordInfo. */ interface ISpeechWordInfo { @@ -17455,6 +17455,9 @@ export namespace google { /** CreateDocumentRequest document */ document?: (google.cloud.dialogflow.v2beta1.IDocument|null); + + /** CreateDocumentRequest importGcsCustomMetadata */ + importGcsCustomMetadata?: (boolean|null); } /** Represents a CreateDocumentRequest. */ @@ -17472,6 +17475,9 @@ export namespace google { /** CreateDocumentRequest document. */ public document?: (google.cloud.dialogflow.v2beta1.IDocument|null); + /** CreateDocumentRequest importGcsCustomMetadata. */ + public importGcsCustomMetadata: boolean; + /** * Creates a new CreateDocumentRequest instance using the specified properties. * @param [properties] Properties to set @@ -17838,6 +17844,9 @@ export namespace google { /** ReloadDocumentRequest gcsSource */ gcsSource?: (google.cloud.dialogflow.v2beta1.IGcsSource|null); + + /** ReloadDocumentRequest importGcsCustomMetadata */ + importGcsCustomMetadata?: (boolean|null); } /** Represents a ReloadDocumentRequest. */ @@ -17855,6 +17864,9 @@ export namespace google { /** ReloadDocumentRequest gcsSource. */ public gcsSource?: (google.cloud.dialogflow.v2beta1.IGcsSource|null); + /** ReloadDocumentRequest importGcsCustomMetadata. */ + public importGcsCustomMetadata: boolean; + /** ReloadDocumentRequest source. */ public source?: "gcsSource"; diff --git a/packages/google-cloud-dialogflow/protos/protos.js b/packages/google-cloud-dialogflow/protos/protos.js index a925eb2e0ad..41459afb7d3 100644 --- a/packages/google-cloud-dialogflow/protos/protos.js +++ b/packages/google-cloud-dialogflow/protos/protos.js @@ -35629,6 +35629,32 @@ return ListEnvironmentsResponse; })(); + /** + * AudioEncoding enum. + * @name google.cloud.dialogflow.v2beta1.AudioEncoding + * @enum {number} + * @property {number} AUDIO_ENCODING_UNSPECIFIED=0 AUDIO_ENCODING_UNSPECIFIED value + * @property {number} AUDIO_ENCODING_LINEAR_16=1 AUDIO_ENCODING_LINEAR_16 value + * @property {number} AUDIO_ENCODING_FLAC=2 AUDIO_ENCODING_FLAC value + * @property {number} AUDIO_ENCODING_MULAW=3 AUDIO_ENCODING_MULAW value + * @property {number} AUDIO_ENCODING_AMR=4 AUDIO_ENCODING_AMR value + * @property {number} AUDIO_ENCODING_AMR_WB=5 AUDIO_ENCODING_AMR_WB value + * @property {number} AUDIO_ENCODING_OGG_OPUS=6 AUDIO_ENCODING_OGG_OPUS value + * @property {number} AUDIO_ENCODING_SPEEX_WITH_HEADER_BYTE=7 AUDIO_ENCODING_SPEEX_WITH_HEADER_BYTE value + */ + v2beta1.AudioEncoding = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "AUDIO_ENCODING_UNSPECIFIED"] = 0; + values[valuesById[1] = "AUDIO_ENCODING_LINEAR_16"] = 1; + values[valuesById[2] = "AUDIO_ENCODING_FLAC"] = 2; + values[valuesById[3] = "AUDIO_ENCODING_MULAW"] = 3; + values[valuesById[4] = "AUDIO_ENCODING_AMR"] = 4; + values[valuesById[5] = "AUDIO_ENCODING_AMR_WB"] = 5; + values[valuesById[6] = "AUDIO_ENCODING_OGG_OPUS"] = 6; + values[valuesById[7] = "AUDIO_ENCODING_SPEEX_WITH_HEADER_BYTE"] = 7; + return values; + })(); + v2beta1.SpeechContext = (function() { /** @@ -35855,32 +35881,6 @@ return SpeechContext; })(); - /** - * AudioEncoding enum. - * @name google.cloud.dialogflow.v2beta1.AudioEncoding - * @enum {number} - * @property {number} AUDIO_ENCODING_UNSPECIFIED=0 AUDIO_ENCODING_UNSPECIFIED value - * @property {number} AUDIO_ENCODING_LINEAR_16=1 AUDIO_ENCODING_LINEAR_16 value - * @property {number} AUDIO_ENCODING_FLAC=2 AUDIO_ENCODING_FLAC value - * @property {number} AUDIO_ENCODING_MULAW=3 AUDIO_ENCODING_MULAW value - * @property {number} AUDIO_ENCODING_AMR=4 AUDIO_ENCODING_AMR value - * @property {number} AUDIO_ENCODING_AMR_WB=5 AUDIO_ENCODING_AMR_WB value - * @property {number} AUDIO_ENCODING_OGG_OPUS=6 AUDIO_ENCODING_OGG_OPUS value - * @property {number} AUDIO_ENCODING_SPEEX_WITH_HEADER_BYTE=7 AUDIO_ENCODING_SPEEX_WITH_HEADER_BYTE value - */ - v2beta1.AudioEncoding = (function() { - var valuesById = {}, values = Object.create(valuesById); - values[valuesById[0] = "AUDIO_ENCODING_UNSPECIFIED"] = 0; - values[valuesById[1] = "AUDIO_ENCODING_LINEAR_16"] = 1; - values[valuesById[2] = "AUDIO_ENCODING_FLAC"] = 2; - values[valuesById[3] = "AUDIO_ENCODING_MULAW"] = 3; - values[valuesById[4] = "AUDIO_ENCODING_AMR"] = 4; - values[valuesById[5] = "AUDIO_ENCODING_AMR_WB"] = 5; - values[valuesById[6] = "AUDIO_ENCODING_OGG_OPUS"] = 6; - values[valuesById[7] = "AUDIO_ENCODING_SPEEX_WITH_HEADER_BYTE"] = 7; - return values; - })(); - v2beta1.SpeechWordInfo = (function() { /** @@ -41835,6 +41835,7 @@ * @interface ICreateDocumentRequest * @property {string|null} [parent] CreateDocumentRequest parent * @property {google.cloud.dialogflow.v2beta1.IDocument|null} [document] CreateDocumentRequest document + * @property {boolean|null} [importGcsCustomMetadata] CreateDocumentRequest importGcsCustomMetadata */ /** @@ -41868,6 +41869,14 @@ */ CreateDocumentRequest.prototype.document = null; + /** + * CreateDocumentRequest importGcsCustomMetadata. + * @member {boolean} importGcsCustomMetadata + * @memberof google.cloud.dialogflow.v2beta1.CreateDocumentRequest + * @instance + */ + CreateDocumentRequest.prototype.importGcsCustomMetadata = false; + /** * Creates a new CreateDocumentRequest instance using the specified properties. * @function create @@ -41896,6 +41905,8 @@ writer.uint32(/* id 1, wireType 2 =*/10).string(message.parent); if (message.document != null && Object.hasOwnProperty.call(message, "document")) $root.google.cloud.dialogflow.v2beta1.Document.encode(message.document, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.importGcsCustomMetadata != null && Object.hasOwnProperty.call(message, "importGcsCustomMetadata")) + writer.uint32(/* id 3, wireType 0 =*/24).bool(message.importGcsCustomMetadata); return writer; }; @@ -41936,6 +41947,9 @@ case 2: message.document = $root.google.cloud.dialogflow.v2beta1.Document.decode(reader, reader.uint32()); break; + case 3: + message.importGcsCustomMetadata = reader.bool(); + break; default: reader.skipType(tag & 7); break; @@ -41979,6 +41993,9 @@ if (error) return "document." + error; } + if (message.importGcsCustomMetadata != null && message.hasOwnProperty("importGcsCustomMetadata")) + if (typeof message.importGcsCustomMetadata !== "boolean") + return "importGcsCustomMetadata: boolean expected"; return null; }; @@ -42001,6 +42018,8 @@ throw TypeError(".google.cloud.dialogflow.v2beta1.CreateDocumentRequest.document: object expected"); message.document = $root.google.cloud.dialogflow.v2beta1.Document.fromObject(object.document); } + if (object.importGcsCustomMetadata != null) + message.importGcsCustomMetadata = Boolean(object.importGcsCustomMetadata); return message; }; @@ -42020,11 +42039,14 @@ if (options.defaults) { object.parent = ""; object.document = null; + object.importGcsCustomMetadata = false; } if (message.parent != null && message.hasOwnProperty("parent")) object.parent = message.parent; if (message.document != null && message.hasOwnProperty("document")) object.document = $root.google.cloud.dialogflow.v2beta1.Document.toObject(message.document, options); + if (message.importGcsCustomMetadata != null && message.hasOwnProperty("importGcsCustomMetadata")) + object.importGcsCustomMetadata = message.importGcsCustomMetadata; return object; }; @@ -42685,6 +42707,7 @@ * @interface IReloadDocumentRequest * @property {string|null} [name] ReloadDocumentRequest name * @property {google.cloud.dialogflow.v2beta1.IGcsSource|null} [gcsSource] ReloadDocumentRequest gcsSource + * @property {boolean|null} [importGcsCustomMetadata] ReloadDocumentRequest importGcsCustomMetadata */ /** @@ -42718,6 +42741,14 @@ */ ReloadDocumentRequest.prototype.gcsSource = null; + /** + * ReloadDocumentRequest importGcsCustomMetadata. + * @member {boolean} importGcsCustomMetadata + * @memberof google.cloud.dialogflow.v2beta1.ReloadDocumentRequest + * @instance + */ + ReloadDocumentRequest.prototype.importGcsCustomMetadata = false; + // OneOf field names bound to virtual getters and setters var $oneOfFields; @@ -42760,6 +42791,8 @@ writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); if (message.gcsSource != null && Object.hasOwnProperty.call(message, "gcsSource")) $root.google.cloud.dialogflow.v2beta1.GcsSource.encode(message.gcsSource, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + if (message.importGcsCustomMetadata != null && Object.hasOwnProperty.call(message, "importGcsCustomMetadata")) + writer.uint32(/* id 4, wireType 0 =*/32).bool(message.importGcsCustomMetadata); return writer; }; @@ -42800,6 +42833,9 @@ case 3: message.gcsSource = $root.google.cloud.dialogflow.v2beta1.GcsSource.decode(reader, reader.uint32()); break; + case 4: + message.importGcsCustomMetadata = reader.bool(); + break; default: reader.skipType(tag & 7); break; @@ -42847,6 +42883,9 @@ return "gcsSource." + error; } } + if (message.importGcsCustomMetadata != null && message.hasOwnProperty("importGcsCustomMetadata")) + if (typeof message.importGcsCustomMetadata !== "boolean") + return "importGcsCustomMetadata: boolean expected"; return null; }; @@ -42869,6 +42908,8 @@ throw TypeError(".google.cloud.dialogflow.v2beta1.ReloadDocumentRequest.gcsSource: object expected"); message.gcsSource = $root.google.cloud.dialogflow.v2beta1.GcsSource.fromObject(object.gcsSource); } + if (object.importGcsCustomMetadata != null) + message.importGcsCustomMetadata = Boolean(object.importGcsCustomMetadata); return message; }; @@ -42885,8 +42926,10 @@ if (!options) options = {}; var object = {}; - if (options.defaults) + if (options.defaults) { object.name = ""; + object.importGcsCustomMetadata = false; + } if (message.name != null && message.hasOwnProperty("name")) object.name = message.name; if (message.gcsSource != null && message.hasOwnProperty("gcsSource")) { @@ -42894,6 +42937,8 @@ if (options.oneofs) object.source = "gcsSource"; } + if (message.importGcsCustomMetadata != null && message.hasOwnProperty("importGcsCustomMetadata")) + object.importGcsCustomMetadata = message.importGcsCustomMetadata; return object; }; diff --git a/packages/google-cloud-dialogflow/protos/protos.json b/packages/google-cloud-dialogflow/protos/protos.json index 620b5aab9c3..4f7de168466 100644 --- a/packages/google-cloud-dialogflow/protos/protos.json +++ b/packages/google-cloud-dialogflow/protos/protos.json @@ -4249,7 +4249,10 @@ }, "matchMode": { "type": "MatchMode", - "id": 9 + "id": 9, + "options": { + "deprecated": true + } }, "classificationThreshold": { "type": "float", @@ -4619,6 +4622,18 @@ } } }, + "AudioEncoding": { + "values": { + "AUDIO_ENCODING_UNSPECIFIED": 0, + "AUDIO_ENCODING_LINEAR_16": 1, + "AUDIO_ENCODING_FLAC": 2, + "AUDIO_ENCODING_MULAW": 3, + "AUDIO_ENCODING_AMR": 4, + "AUDIO_ENCODING_AMR_WB": 5, + "AUDIO_ENCODING_OGG_OPUS": 6, + "AUDIO_ENCODING_SPEEX_WITH_HEADER_BYTE": 7 + } + }, "SpeechContext": { "fields": { "phrases": { @@ -4632,18 +4647,6 @@ } } }, - "AudioEncoding": { - "values": { - "AUDIO_ENCODING_UNSPECIFIED": 0, - "AUDIO_ENCODING_LINEAR_16": 1, - "AUDIO_ENCODING_FLAC": 2, - "AUDIO_ENCODING_MULAW": 3, - "AUDIO_ENCODING_AMR": 4, - "AUDIO_ENCODING_AMR_WB": 5, - "AUDIO_ENCODING_OGG_OPUS": 6, - "AUDIO_ENCODING_SPEEX_WITH_HEADER_BYTE": 7 - } - }, "SpeechWordInfo": { "fields": { "word": { @@ -5203,9 +5206,14 @@ { "(google.api.http)": { "get": "/v2beta1/{parent=projects/*/knowledgeBases/*}/documents", - "additional_bindings": { - "get": "/v2beta1/{parent=projects/*/agent/knowledgeBases/*}/documents" - } + "additional_bindings": [ + { + "get": "/v2beta1/{parent=projects/*/locations/*/knowledgeBases/*}/documents" + }, + { + "get": "/v2beta1/{parent=projects/*/agent/knowledgeBases/*}/documents" + } + ] } }, { @@ -5225,9 +5233,14 @@ { "(google.api.http)": { "get": "/v2beta1/{name=projects/*/knowledgeBases/*/documents/*}", - "additional_bindings": { - "get": "/v2beta1/{name=projects/*/agent/knowledgeBases/*/documents/*}" - } + "additional_bindings": [ + { + "get": "/v2beta1/{name=projects/*/locations/*/knowledgeBases/*/documents/*}" + }, + { + "get": "/v2beta1/{name=projects/*/agent/knowledgeBases/*/documents/*}" + } + ] } }, { @@ -5252,10 +5265,16 @@ "(google.api.http)": { "post": "/v2beta1/{parent=projects/*/knowledgeBases/*}/documents", "body": "document", - "additional_bindings": { - "post": "/v2beta1/{parent=projects/*/agent/knowledgeBases/*}/documents", - "body": "document" - } + "additional_bindings": [ + { + "post": "/v2beta1/{parent=projects/*/locations/*/knowledgeBases/*}/documents", + "body": "document" + }, + { + "post": "/v2beta1/{parent=projects/*/agent/knowledgeBases/*}/documents", + "body": "document" + } + ] } }, { @@ -5283,9 +5302,14 @@ { "(google.api.http)": { "delete": "/v2beta1/{name=projects/*/knowledgeBases/*/documents/*}", - "additional_bindings": { - "delete": "/v2beta1/{name=projects/*/agent/knowledgeBases/*/documents/*}" - } + "additional_bindings": [ + { + "delete": "/v2beta1/{name=projects/*/locations/*/knowledgeBases/*/documents/*}" + }, + { + "delete": "/v2beta1/{name=projects/*/agent/knowledgeBases/*/documents/*}" + } + ] } }, { @@ -5316,10 +5340,16 @@ "(google.api.http)": { "patch": "/v2beta1/{document.name=projects/*/knowledgeBases/*/documents/*}", "body": "document", - "additional_bindings": { - "patch": "/v2beta1/{document.name=projects/*/agent/knowledgeBases/*/documents/*}", - "body": "document" - } + "additional_bindings": [ + { + "patch": "/v2beta1/{document.name=projects/*/locations/*/knowledgeBases/*/documents/*}", + "body": "document" + }, + { + "patch": "/v2beta1/{document.name=projects/*/agent/knowledgeBases/*/documents/*}", + "body": "document" + } + ] } }, { @@ -5353,10 +5383,16 @@ "(google.api.http)": { "post": "/v2beta1/{name=projects/*/knowledgeBases/*/documents/*}:reload", "body": "*", - "additional_bindings": { - "post": "/v2beta1/{name=projects/*/agent/knowledgeBases/*/documents/*}:reload", - "body": "*" - } + "additional_bindings": [ + { + "post": "/v2beta1/{name=projects/*/locations/*/knowledgeBases/*/documents/*}:reload", + "body": "*" + }, + { + "post": "/v2beta1/{name=projects/*/agent/knowledgeBases/*/documents/*}:reload", + "body": "*" + } + ] } }, { @@ -5375,7 +5411,7 @@ "Document": { "options": { "(google.api.resource).type": "dialogflow.googleapis.com/Document", - "(google.api.resource).pattern": "projects/{project}/knowledgeBases/{knowledge_base}/documents/{document}" + "(google.api.resource).pattern": "projects/{project}/locations/{location}/knowledgeBases/{knowledge_base}/documents/{document}" }, "oneofs": { "source": { @@ -5533,6 +5569,10 @@ "options": { "(google.api.field_behavior)": "REQUIRED" } + }, + "importGcsCustomMetadata": { + "type": "bool", + "id": 3 } } }, @@ -5607,6 +5647,10 @@ "gcsSource": { "type": "GcsSource", "id": 3 + }, + "importGcsCustomMetadata": { + "type": "bool", + "id": 4 } } }, @@ -7861,9 +7905,14 @@ { "(google.api.http)": { "get": "/v2beta1/{parent=projects/*}/knowledgeBases", - "additional_bindings": { - "get": "/v2beta1/{parent=projects/*/agent}/knowledgeBases" - } + "additional_bindings": [ + { + "get": "/v2beta1/{parent=projects/*/locations/*}/knowledgeBases" + }, + { + "get": "/v2beta1/{parent=projects/*/agent}/knowledgeBases" + } + ] } }, { @@ -7883,9 +7932,14 @@ { "(google.api.http)": { "get": "/v2beta1/{name=projects/*/knowledgeBases/*}", - "additional_bindings": { - "get": "/v2beta1/{name=projects/*/agent/knowledgeBases/*}" - } + "additional_bindings": [ + { + "get": "/v2beta1/{name=projects/*/locations/*/knowledgeBases/*}" + }, + { + "get": "/v2beta1/{name=projects/*/agent/knowledgeBases/*}" + } + ] } }, { @@ -7908,10 +7962,16 @@ "(google.api.http)": { "post": "/v2beta1/{parent=projects/*}/knowledgeBases", "body": "knowledge_base", - "additional_bindings": { - "post": "/v2beta1/{parent=projects/*/agent}/knowledgeBases", - "body": "knowledge_base" - } + "additional_bindings": [ + { + "post": "/v2beta1/{parent=projects/*/locations/*}/knowledgeBases", + "body": "knowledge_base" + }, + { + "post": "/v2beta1/{parent=projects/*/agent}/knowledgeBases", + "body": "knowledge_base" + } + ] } }, { @@ -7931,9 +7991,14 @@ { "(google.api.http)": { "delete": "/v2beta1/{name=projects/*/knowledgeBases/*}", - "additional_bindings": { - "delete": "/v2beta1/{name=projects/*/agent/knowledgeBases/*}" - } + "additional_bindings": [ + { + "delete": "/v2beta1/{name=projects/*/locations/*/knowledgeBases/*}" + }, + { + "delete": "/v2beta1/{name=projects/*/agent/knowledgeBases/*}" + } + ] } }, { @@ -7956,10 +8021,16 @@ "(google.api.http)": { "patch": "/v2beta1/{knowledge_base.name=projects/*/knowledgeBases/*}", "body": "knowledge_base", - "additional_bindings": { - "patch": "/v2beta1/{knowledge_base.name=projects/*/agent/knowledgeBases/*}", - "body": "knowledge_base" - } + "additional_bindings": [ + { + "patch": "/v2beta1/{knowledge_base.name=projects/*/locations/*/knowledgeBases/*}", + "body": "knowledge_base" + }, + { + "patch": "/v2beta1/{knowledge_base.name=projects/*/agent/knowledgeBases/*}", + "body": "knowledge_base" + } + ] } }, { @@ -7975,7 +8046,7 @@ "KnowledgeBase": { "options": { "(google.api.resource).type": "dialogflow.googleapis.com/KnowledgeBase", - "(google.api.resource).pattern": "projects/{project}/knowledgeBases/{knowledge_base}" + "(google.api.resource).pattern": "projects/{project}/locations/{location}/knowledgeBases/{knowledge_base}" }, "fields": { "name": { diff --git a/packages/google-cloud-dialogflow/src/v2/gapic_metadata.json b/packages/google-cloud-dialogflow/src/v2/gapic_metadata.json new file mode 100644 index 00000000000..a460c3c7430 --- /dev/null +++ b/packages/google-cloud-dialogflow/src/v2/gapic_metadata.json @@ -0,0 +1,284 @@ +{ + "schema": "1.0", + "comment": "This file maps proto services/RPCs to the corresponding library clients/methods", + "language": "typescript", + "protoPackage": "google.cloud.dialogflow.v2", + "libraryPackage": "@google-cloud/dialogflow", + "services": {"Agents": {"clients": { + "grpc": { + "libraryClient": "AgentsClient", + "rpcs": {"GetAgent": { + "methods": ["getAgent"] + },"SetAgent": { + "methods": ["setAgent"] + },"DeleteAgent": { + "methods": ["deleteAgent"] + },"GetValidationResult": { + "methods": ["getValidationResult"] + },"TrainAgent": { + "methods": ["trainAgent"] + },"ExportAgent": { + "methods": ["exportAgent"] + },"ImportAgent": { + "methods": ["importAgent"] + },"RestoreAgent": { + "methods": ["restoreAgent"] + },"SearchAgents": { + "methods": [ + "searchAgents", + "searchAgentsStream", + "searchAgentsAsync" + ] + }} + }, + "grpc-fallback": { + "libraryClient": "AgentsClient", + "rpcs": {"GetAgent": { + "methods": ["getAgent"] + },"SetAgent": { + "methods": ["setAgent"] + },"DeleteAgent": { + "methods": ["deleteAgent"] + },"GetValidationResult": { + "methods": ["getValidationResult"] + },"TrainAgent": { + "methods": ["trainAgent"] + },"ExportAgent": { + "methods": ["exportAgent"] + },"ImportAgent": { + "methods": ["importAgent"] + },"RestoreAgent": { + "methods": ["restoreAgent"] + },"SearchAgents": { + "methods": [ + "searchAgents", + "searchAgentsStream", + "searchAgentsAsync" + ] + }} + } + } + },"Contexts": {"clients": { + "grpc": { + "libraryClient": "ContextsClient", + "rpcs": {"GetContext": { + "methods": ["getContext"] + },"CreateContext": { + "methods": ["createContext"] + },"UpdateContext": { + "methods": ["updateContext"] + },"DeleteContext": { + "methods": ["deleteContext"] + },"DeleteAllContexts": { + "methods": ["deleteAllContexts"] + },"ListContexts": { + "methods": [ + "listContexts", + "listContextsStream", + "listContextsAsync" + ] + }} + }, + "grpc-fallback": { + "libraryClient": "ContextsClient", + "rpcs": {"GetContext": { + "methods": ["getContext"] + },"CreateContext": { + "methods": ["createContext"] + },"UpdateContext": { + "methods": ["updateContext"] + },"DeleteContext": { + "methods": ["deleteContext"] + },"DeleteAllContexts": { + "methods": ["deleteAllContexts"] + },"ListContexts": { + "methods": [ + "listContexts", + "listContextsStream", + "listContextsAsync" + ] + }} + } + } + },"EntityTypes": {"clients": { + "grpc": { + "libraryClient": "EntityTypesClient", + "rpcs": {"GetEntityType": { + "methods": ["getEntityType"] + },"CreateEntityType": { + "methods": ["createEntityType"] + },"UpdateEntityType": { + "methods": ["updateEntityType"] + },"DeleteEntityType": { + "methods": ["deleteEntityType"] + },"BatchUpdateEntityTypes": { + "methods": ["batchUpdateEntityTypes"] + },"BatchDeleteEntityTypes": { + "methods": ["batchDeleteEntityTypes"] + },"BatchCreateEntities": { + "methods": ["batchCreateEntities"] + },"BatchUpdateEntities": { + "methods": ["batchUpdateEntities"] + },"BatchDeleteEntities": { + "methods": ["batchDeleteEntities"] + },"ListEntityTypes": { + "methods": [ + "listEntityTypes", + "listEntityTypesStream", + "listEntityTypesAsync" + ] + }} + }, + "grpc-fallback": { + "libraryClient": "EntityTypesClient", + "rpcs": {"GetEntityType": { + "methods": ["getEntityType"] + },"CreateEntityType": { + "methods": ["createEntityType"] + },"UpdateEntityType": { + "methods": ["updateEntityType"] + },"DeleteEntityType": { + "methods": ["deleteEntityType"] + },"BatchUpdateEntityTypes": { + "methods": ["batchUpdateEntityTypes"] + },"BatchDeleteEntityTypes": { + "methods": ["batchDeleteEntityTypes"] + },"BatchCreateEntities": { + "methods": ["batchCreateEntities"] + },"BatchUpdateEntities": { + "methods": ["batchUpdateEntities"] + },"BatchDeleteEntities": { + "methods": ["batchDeleteEntities"] + },"ListEntityTypes": { + "methods": [ + "listEntityTypes", + "listEntityTypesStream", + "listEntityTypesAsync" + ] + }} + } + } + },"Environments": {"clients": { + "grpc": { + "libraryClient": "EnvironmentsClient", + "rpcs": {"ListEnvironments": { + "methods": [ + "listEnvironments", + "listEnvironmentsStream", + "listEnvironmentsAsync" + ] + }} + }, + "grpc-fallback": { + "libraryClient": "EnvironmentsClient", + "rpcs": {,"ListEnvironments": { + "methods": [ + "listEnvironments", + "listEnvironmentsStream", + "listEnvironmentsAsync" + ] + }} + } + } + },"Intents": {"clients": { + "grpc": { + "libraryClient": "IntentsClient", + "rpcs": {"GetIntent": { + "methods": ["getIntent"] + },"CreateIntent": { + "methods": ["createIntent"] + },"UpdateIntent": { + "methods": ["updateIntent"] + },"DeleteIntent": { + "methods": ["deleteIntent"] + },"BatchUpdateIntents": { + "methods": ["batchUpdateIntents"] + },"BatchDeleteIntents": { + "methods": ["batchDeleteIntents"] + },"ListIntents": { + "methods": [ + "listIntents", + "listIntentsStream", + "listIntentsAsync" + ] + }} + }, + "grpc-fallback": { + "libraryClient": "IntentsClient", + "rpcs": {"GetIntent": { + "methods": ["getIntent"] + },"CreateIntent": { + "methods": ["createIntent"] + },"UpdateIntent": { + "methods": ["updateIntent"] + },"DeleteIntent": { + "methods": ["deleteIntent"] + },"BatchUpdateIntents": { + "methods": ["batchUpdateIntents"] + },"BatchDeleteIntents": { + "methods": ["batchDeleteIntents"] + },"ListIntents": { + "methods": [ + "listIntents", + "listIntentsStream", + "listIntentsAsync" + ] + }} + } + } + },"SessionEntityTypes": {"clients": { + "grpc": { + "libraryClient": "SessionEntityTypesClient", + "rpcs": {"GetSessionEntityType": { + "methods": ["getSessionEntityType"] + },"CreateSessionEntityType": { + "methods": ["createSessionEntityType"] + },"UpdateSessionEntityType": { + "methods": ["updateSessionEntityType"] + },"DeleteSessionEntityType": { + "methods": ["deleteSessionEntityType"] + },"ListSessionEntityTypes": { + "methods": [ + "listSessionEntityTypes", + "listSessionEntityTypesStream", + "listSessionEntityTypesAsync" + ] + }} + }, + "grpc-fallback": { + "libraryClient": "SessionEntityTypesClient", + "rpcs": {"GetSessionEntityType": { + "methods": ["getSessionEntityType"] + },"CreateSessionEntityType": { + "methods": ["createSessionEntityType"] + },"UpdateSessionEntityType": { + "methods": ["updateSessionEntityType"] + },"DeleteSessionEntityType": { + "methods": ["deleteSessionEntityType"] + },"ListSessionEntityTypes": { + "methods": [ + "listSessionEntityTypes", + "listSessionEntityTypesStream", + "listSessionEntityTypesAsync" + ] + }} + } + } + },"Sessions": {"clients": { + "grpc": { + "libraryClient": "SessionsClient", + "rpcs": {"DetectIntent": { + "methods": ["detectIntent"] + },"StreamingDetectIntent": { + "methods": ["streamingDetectIntent"] + }} + }, + "grpc-fallback": { + "libraryClient": "SessionsClient", + "rpcs": {"DetectIntent": { + "methods": ["detectIntent"] + }} + } + } + }} +} diff --git a/packages/google-cloud-dialogflow/src/v2beta1/agents_client.ts b/packages/google-cloud-dialogflow/src/v2beta1/agents_client.ts index 8e24dedd7de..99f2e3f20a8 100644 --- a/packages/google-cloud-dialogflow/src/v2beta1/agents_client.ts +++ b/packages/google-cloud-dialogflow/src/v2beta1/agents_client.ts @@ -168,12 +168,6 @@ export class AgentsClient { // identifiers to uniquely identify resources within the API. // Create useful helper objects for these. this.pathTemplates = { - documentPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/knowledgeBases/{knowledge_base}/documents/{document}' - ), - knowledgeBasePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/knowledgeBases/{knowledge_base}' - ), projectPathTemplate: new this._gaxModule.PathTemplate( 'projects/{project}' ), @@ -201,6 +195,12 @@ export class AgentsClient { projectAgentSessionEntityTypePathTemplate: new this._gaxModule.PathTemplate( 'projects/{project}/agent/sessions/{session}/entityTypes/{entity_type}' ), + projectKnowledgeBasePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/knowledgeBases/{knowledge_base}' + ), + projectKnowledgeBaseDocumentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/knowledgeBases/{knowledge_base}/documents/{document}' + ), projectLocationAgentPathTemplate: new this._gaxModule.PathTemplate( 'projects/{project}/locations/{location}/agent' ), @@ -219,6 +219,12 @@ export class AgentsClient { projectLocationAgentSessionEntityTypePathTemplate: new this._gaxModule.PathTemplate( 'projects/{project}/locations/{location}/agent/sessions/{session}/entityTypes/{entity_type}' ), + projectLocationKnowledgeBasePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/knowledgeBases/{knowledge_base}' + ), + projectLocationKnowledgeBaseDocumentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/knowledgeBases/{knowledge_base}/documents/{document}' + ), }; // Some of the methods on this service return "paged" results, @@ -1654,94 +1660,6 @@ export class AgentsClient { // -- Path templates -- // -------------------- - /** - * Return a fully-qualified document resource name string. - * - * @param {string} project - * @param {string} knowledge_base - * @param {string} document - * @returns {string} Resource name string. - */ - documentPath(project: string, knowledgeBase: string, document: string) { - return this.pathTemplates.documentPathTemplate.render({ - project: project, - knowledge_base: knowledgeBase, - document: document, - }); - } - - /** - * Parse the project from Document resource. - * - * @param {string} documentName - * A fully-qualified path representing Document resource. - * @returns {string} A string representing the project. - */ - matchProjectFromDocumentName(documentName: string) { - return this.pathTemplates.documentPathTemplate.match(documentName).project; - } - - /** - * Parse the knowledge_base from Document resource. - * - * @param {string} documentName - * A fully-qualified path representing Document resource. - * @returns {string} A string representing the knowledge_base. - */ - matchKnowledgeBaseFromDocumentName(documentName: string) { - return this.pathTemplates.documentPathTemplate.match(documentName) - .knowledge_base; - } - - /** - * Parse the document from Document resource. - * - * @param {string} documentName - * A fully-qualified path representing Document resource. - * @returns {string} A string representing the document. - */ - matchDocumentFromDocumentName(documentName: string) { - return this.pathTemplates.documentPathTemplate.match(documentName).document; - } - - /** - * Return a fully-qualified knowledgeBase resource name string. - * - * @param {string} project - * @param {string} knowledge_base - * @returns {string} Resource name string. - */ - knowledgeBasePath(project: string, knowledgeBase: string) { - return this.pathTemplates.knowledgeBasePathTemplate.render({ - project: project, - knowledge_base: knowledgeBase, - }); - } - - /** - * Parse the project from KnowledgeBase resource. - * - * @param {string} knowledgeBaseName - * A fully-qualified path representing KnowledgeBase resource. - * @returns {string} A string representing the project. - */ - matchProjectFromKnowledgeBaseName(knowledgeBaseName: string) { - return this.pathTemplates.knowledgeBasePathTemplate.match(knowledgeBaseName) - .project; - } - - /** - * Parse the knowledge_base from KnowledgeBase resource. - * - * @param {string} knowledgeBaseName - * A fully-qualified path representing KnowledgeBase resource. - * @returns {string} A string representing the knowledge_base. - */ - matchKnowledgeBaseFromKnowledgeBaseName(knowledgeBaseName: string) { - return this.pathTemplates.knowledgeBasePathTemplate.match(knowledgeBaseName) - .knowledge_base; - } - /** * Return a fully-qualified project resource name string. * @@ -2253,6 +2171,113 @@ export class AgentsClient { ).entity_type; } + /** + * Return a fully-qualified projectKnowledgeBase resource name string. + * + * @param {string} project + * @param {string} knowledge_base + * @returns {string} Resource name string. + */ + projectKnowledgeBasePath(project: string, knowledgeBase: string) { + return this.pathTemplates.projectKnowledgeBasePathTemplate.render({ + project: project, + knowledge_base: knowledgeBase, + }); + } + + /** + * Parse the project from ProjectKnowledgeBase resource. + * + * @param {string} projectKnowledgeBaseName + * A fully-qualified path representing project_knowledge_base resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectKnowledgeBaseName(projectKnowledgeBaseName: string) { + return this.pathTemplates.projectKnowledgeBasePathTemplate.match( + projectKnowledgeBaseName + ).project; + } + + /** + * Parse the knowledge_base from ProjectKnowledgeBase resource. + * + * @param {string} projectKnowledgeBaseName + * A fully-qualified path representing project_knowledge_base resource. + * @returns {string} A string representing the knowledge_base. + */ + matchKnowledgeBaseFromProjectKnowledgeBaseName( + projectKnowledgeBaseName: string + ) { + return this.pathTemplates.projectKnowledgeBasePathTemplate.match( + projectKnowledgeBaseName + ).knowledge_base; + } + + /** + * Return a fully-qualified projectKnowledgeBaseDocument resource name string. + * + * @param {string} project + * @param {string} knowledge_base + * @param {string} document + * @returns {string} Resource name string. + */ + projectKnowledgeBaseDocumentPath( + project: string, + knowledgeBase: string, + document: string + ) { + return this.pathTemplates.projectKnowledgeBaseDocumentPathTemplate.render({ + project: project, + knowledge_base: knowledgeBase, + document: document, + }); + } + + /** + * Parse the project from ProjectKnowledgeBaseDocument resource. + * + * @param {string} projectKnowledgeBaseDocumentName + * A fully-qualified path representing project_knowledge_base_document resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectKnowledgeBaseDocumentName( + projectKnowledgeBaseDocumentName: string + ) { + return this.pathTemplates.projectKnowledgeBaseDocumentPathTemplate.match( + projectKnowledgeBaseDocumentName + ).project; + } + + /** + * Parse the knowledge_base from ProjectKnowledgeBaseDocument resource. + * + * @param {string} projectKnowledgeBaseDocumentName + * A fully-qualified path representing project_knowledge_base_document resource. + * @returns {string} A string representing the knowledge_base. + */ + matchKnowledgeBaseFromProjectKnowledgeBaseDocumentName( + projectKnowledgeBaseDocumentName: string + ) { + return this.pathTemplates.projectKnowledgeBaseDocumentPathTemplate.match( + projectKnowledgeBaseDocumentName + ).knowledge_base; + } + + /** + * Parse the document from ProjectKnowledgeBaseDocument resource. + * + * @param {string} projectKnowledgeBaseDocumentName + * A fully-qualified path representing project_knowledge_base_document resource. + * @returns {string} A string representing the document. + */ + matchDocumentFromProjectKnowledgeBaseDocumentName( + projectKnowledgeBaseDocumentName: string + ) { + return this.pathTemplates.projectKnowledgeBaseDocumentPathTemplate.match( + projectKnowledgeBaseDocumentName + ).document; + } + /** * Return a fully-qualified projectLocationAgent resource name string. * @@ -2662,6 +2687,156 @@ export class AgentsClient { ).entity_type; } + /** + * Return a fully-qualified projectLocationKnowledgeBase resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} knowledge_base + * @returns {string} Resource name string. + */ + projectLocationKnowledgeBasePath( + project: string, + location: string, + knowledgeBase: string + ) { + return this.pathTemplates.projectLocationKnowledgeBasePathTemplate.render({ + project: project, + location: location, + knowledge_base: knowledgeBase, + }); + } + + /** + * Parse the project from ProjectLocationKnowledgeBase resource. + * + * @param {string} projectLocationKnowledgeBaseName + * A fully-qualified path representing project_location_knowledge_base resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationKnowledgeBaseName( + projectLocationKnowledgeBaseName: string + ) { + return this.pathTemplates.projectLocationKnowledgeBasePathTemplate.match( + projectLocationKnowledgeBaseName + ).project; + } + + /** + * Parse the location from ProjectLocationKnowledgeBase resource. + * + * @param {string} projectLocationKnowledgeBaseName + * A fully-qualified path representing project_location_knowledge_base resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationKnowledgeBaseName( + projectLocationKnowledgeBaseName: string + ) { + return this.pathTemplates.projectLocationKnowledgeBasePathTemplate.match( + projectLocationKnowledgeBaseName + ).location; + } + + /** + * Parse the knowledge_base from ProjectLocationKnowledgeBase resource. + * + * @param {string} projectLocationKnowledgeBaseName + * A fully-qualified path representing project_location_knowledge_base resource. + * @returns {string} A string representing the knowledge_base. + */ + matchKnowledgeBaseFromProjectLocationKnowledgeBaseName( + projectLocationKnowledgeBaseName: string + ) { + return this.pathTemplates.projectLocationKnowledgeBasePathTemplate.match( + projectLocationKnowledgeBaseName + ).knowledge_base; + } + + /** + * Return a fully-qualified projectLocationKnowledgeBaseDocument resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} knowledge_base + * @param {string} document + * @returns {string} Resource name string. + */ + projectLocationKnowledgeBaseDocumentPath( + project: string, + location: string, + knowledgeBase: string, + document: string + ) { + return this.pathTemplates.projectLocationKnowledgeBaseDocumentPathTemplate.render( + { + project: project, + location: location, + knowledge_base: knowledgeBase, + document: document, + } + ); + } + + /** + * Parse the project from ProjectLocationKnowledgeBaseDocument resource. + * + * @param {string} projectLocationKnowledgeBaseDocumentName + * A fully-qualified path representing project_location_knowledge_base_document resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationKnowledgeBaseDocumentName( + projectLocationKnowledgeBaseDocumentName: string + ) { + return this.pathTemplates.projectLocationKnowledgeBaseDocumentPathTemplate.match( + projectLocationKnowledgeBaseDocumentName + ).project; + } + + /** + * Parse the location from ProjectLocationKnowledgeBaseDocument resource. + * + * @param {string} projectLocationKnowledgeBaseDocumentName + * A fully-qualified path representing project_location_knowledge_base_document resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationKnowledgeBaseDocumentName( + projectLocationKnowledgeBaseDocumentName: string + ) { + return this.pathTemplates.projectLocationKnowledgeBaseDocumentPathTemplate.match( + projectLocationKnowledgeBaseDocumentName + ).location; + } + + /** + * Parse the knowledge_base from ProjectLocationKnowledgeBaseDocument resource. + * + * @param {string} projectLocationKnowledgeBaseDocumentName + * A fully-qualified path representing project_location_knowledge_base_document resource. + * @returns {string} A string representing the knowledge_base. + */ + matchKnowledgeBaseFromProjectLocationKnowledgeBaseDocumentName( + projectLocationKnowledgeBaseDocumentName: string + ) { + return this.pathTemplates.projectLocationKnowledgeBaseDocumentPathTemplate.match( + projectLocationKnowledgeBaseDocumentName + ).knowledge_base; + } + + /** + * Parse the document from ProjectLocationKnowledgeBaseDocument resource. + * + * @param {string} projectLocationKnowledgeBaseDocumentName + * A fully-qualified path representing project_location_knowledge_base_document resource. + * @returns {string} A string representing the document. + */ + matchDocumentFromProjectLocationKnowledgeBaseDocumentName( + projectLocationKnowledgeBaseDocumentName: string + ) { + return this.pathTemplates.projectLocationKnowledgeBaseDocumentPathTemplate.match( + projectLocationKnowledgeBaseDocumentName + ).document; + } + /** * Terminate the gRPC channel and close the client. * diff --git a/packages/google-cloud-dialogflow/src/v2beta1/contexts_client.ts b/packages/google-cloud-dialogflow/src/v2beta1/contexts_client.ts index 5b267ba55ee..70bb9fccf7d 100644 --- a/packages/google-cloud-dialogflow/src/v2beta1/contexts_client.ts +++ b/packages/google-cloud-dialogflow/src/v2beta1/contexts_client.ts @@ -166,12 +166,6 @@ export class ContextsClient { // identifiers to uniquely identify resources within the API. // Create useful helper objects for these. this.pathTemplates = { - documentPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/knowledgeBases/{knowledge_base}/documents/{document}' - ), - knowledgeBasePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/knowledgeBases/{knowledge_base}' - ), projectPathTemplate: new this._gaxModule.PathTemplate( 'projects/{project}' ), @@ -202,6 +196,12 @@ export class ContextsClient { projectAgentSessionEntityTypePathTemplate: new this._gaxModule.PathTemplate( 'projects/{project}/agent/sessions/{session}/entityTypes/{entity_type}' ), + projectKnowledgeBasePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/knowledgeBases/{knowledge_base}' + ), + projectKnowledgeBaseDocumentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/knowledgeBases/{knowledge_base}/documents/{document}' + ), projectLocationAgentPathTemplate: new this._gaxModule.PathTemplate( 'projects/{project}/locations/{location}/agent' ), @@ -220,6 +220,12 @@ export class ContextsClient { projectLocationAgentSessionEntityTypePathTemplate: new this._gaxModule.PathTemplate( 'projects/{project}/locations/{location}/agent/sessions/{session}/entityTypes/{entity_type}' ), + projectLocationKnowledgeBasePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/knowledgeBases/{knowledge_base}' + ), + projectLocationKnowledgeBaseDocumentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/knowledgeBases/{knowledge_base}/documents/{document}' + ), }; // Some of the methods on this service return "paged" results, @@ -1129,94 +1135,6 @@ export class ContextsClient { // -- Path templates -- // -------------------- - /** - * Return a fully-qualified document resource name string. - * - * @param {string} project - * @param {string} knowledge_base - * @param {string} document - * @returns {string} Resource name string. - */ - documentPath(project: string, knowledgeBase: string, document: string) { - return this.pathTemplates.documentPathTemplate.render({ - project: project, - knowledge_base: knowledgeBase, - document: document, - }); - } - - /** - * Parse the project from Document resource. - * - * @param {string} documentName - * A fully-qualified path representing Document resource. - * @returns {string} A string representing the project. - */ - matchProjectFromDocumentName(documentName: string) { - return this.pathTemplates.documentPathTemplate.match(documentName).project; - } - - /** - * Parse the knowledge_base from Document resource. - * - * @param {string} documentName - * A fully-qualified path representing Document resource. - * @returns {string} A string representing the knowledge_base. - */ - matchKnowledgeBaseFromDocumentName(documentName: string) { - return this.pathTemplates.documentPathTemplate.match(documentName) - .knowledge_base; - } - - /** - * Parse the document from Document resource. - * - * @param {string} documentName - * A fully-qualified path representing Document resource. - * @returns {string} A string representing the document. - */ - matchDocumentFromDocumentName(documentName: string) { - return this.pathTemplates.documentPathTemplate.match(documentName).document; - } - - /** - * Return a fully-qualified knowledgeBase resource name string. - * - * @param {string} project - * @param {string} knowledge_base - * @returns {string} Resource name string. - */ - knowledgeBasePath(project: string, knowledgeBase: string) { - return this.pathTemplates.knowledgeBasePathTemplate.render({ - project: project, - knowledge_base: knowledgeBase, - }); - } - - /** - * Parse the project from KnowledgeBase resource. - * - * @param {string} knowledgeBaseName - * A fully-qualified path representing KnowledgeBase resource. - * @returns {string} A string representing the project. - */ - matchProjectFromKnowledgeBaseName(knowledgeBaseName: string) { - return this.pathTemplates.knowledgeBasePathTemplate.match(knowledgeBaseName) - .project; - } - - /** - * Parse the knowledge_base from KnowledgeBase resource. - * - * @param {string} knowledgeBaseName - * A fully-qualified path representing KnowledgeBase resource. - * @returns {string} A string representing the knowledge_base. - */ - matchKnowledgeBaseFromKnowledgeBaseName(knowledgeBaseName: string) { - return this.pathTemplates.knowledgeBasePathTemplate.match(knowledgeBaseName) - .knowledge_base; - } - /** * Return a fully-qualified project resource name string. * @@ -1768,6 +1686,113 @@ export class ContextsClient { ).entity_type; } + /** + * Return a fully-qualified projectKnowledgeBase resource name string. + * + * @param {string} project + * @param {string} knowledge_base + * @returns {string} Resource name string. + */ + projectKnowledgeBasePath(project: string, knowledgeBase: string) { + return this.pathTemplates.projectKnowledgeBasePathTemplate.render({ + project: project, + knowledge_base: knowledgeBase, + }); + } + + /** + * Parse the project from ProjectKnowledgeBase resource. + * + * @param {string} projectKnowledgeBaseName + * A fully-qualified path representing project_knowledge_base resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectKnowledgeBaseName(projectKnowledgeBaseName: string) { + return this.pathTemplates.projectKnowledgeBasePathTemplate.match( + projectKnowledgeBaseName + ).project; + } + + /** + * Parse the knowledge_base from ProjectKnowledgeBase resource. + * + * @param {string} projectKnowledgeBaseName + * A fully-qualified path representing project_knowledge_base resource. + * @returns {string} A string representing the knowledge_base. + */ + matchKnowledgeBaseFromProjectKnowledgeBaseName( + projectKnowledgeBaseName: string + ) { + return this.pathTemplates.projectKnowledgeBasePathTemplate.match( + projectKnowledgeBaseName + ).knowledge_base; + } + + /** + * Return a fully-qualified projectKnowledgeBaseDocument resource name string. + * + * @param {string} project + * @param {string} knowledge_base + * @param {string} document + * @returns {string} Resource name string. + */ + projectKnowledgeBaseDocumentPath( + project: string, + knowledgeBase: string, + document: string + ) { + return this.pathTemplates.projectKnowledgeBaseDocumentPathTemplate.render({ + project: project, + knowledge_base: knowledgeBase, + document: document, + }); + } + + /** + * Parse the project from ProjectKnowledgeBaseDocument resource. + * + * @param {string} projectKnowledgeBaseDocumentName + * A fully-qualified path representing project_knowledge_base_document resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectKnowledgeBaseDocumentName( + projectKnowledgeBaseDocumentName: string + ) { + return this.pathTemplates.projectKnowledgeBaseDocumentPathTemplate.match( + projectKnowledgeBaseDocumentName + ).project; + } + + /** + * Parse the knowledge_base from ProjectKnowledgeBaseDocument resource. + * + * @param {string} projectKnowledgeBaseDocumentName + * A fully-qualified path representing project_knowledge_base_document resource. + * @returns {string} A string representing the knowledge_base. + */ + matchKnowledgeBaseFromProjectKnowledgeBaseDocumentName( + projectKnowledgeBaseDocumentName: string + ) { + return this.pathTemplates.projectKnowledgeBaseDocumentPathTemplate.match( + projectKnowledgeBaseDocumentName + ).knowledge_base; + } + + /** + * Parse the document from ProjectKnowledgeBaseDocument resource. + * + * @param {string} projectKnowledgeBaseDocumentName + * A fully-qualified path representing project_knowledge_base_document resource. + * @returns {string} A string representing the document. + */ + matchDocumentFromProjectKnowledgeBaseDocumentName( + projectKnowledgeBaseDocumentName: string + ) { + return this.pathTemplates.projectKnowledgeBaseDocumentPathTemplate.match( + projectKnowledgeBaseDocumentName + ).document; + } + /** * Return a fully-qualified projectLocationAgent resource name string. * @@ -2177,6 +2202,156 @@ export class ContextsClient { ).entity_type; } + /** + * Return a fully-qualified projectLocationKnowledgeBase resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} knowledge_base + * @returns {string} Resource name string. + */ + projectLocationKnowledgeBasePath( + project: string, + location: string, + knowledgeBase: string + ) { + return this.pathTemplates.projectLocationKnowledgeBasePathTemplate.render({ + project: project, + location: location, + knowledge_base: knowledgeBase, + }); + } + + /** + * Parse the project from ProjectLocationKnowledgeBase resource. + * + * @param {string} projectLocationKnowledgeBaseName + * A fully-qualified path representing project_location_knowledge_base resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationKnowledgeBaseName( + projectLocationKnowledgeBaseName: string + ) { + return this.pathTemplates.projectLocationKnowledgeBasePathTemplate.match( + projectLocationKnowledgeBaseName + ).project; + } + + /** + * Parse the location from ProjectLocationKnowledgeBase resource. + * + * @param {string} projectLocationKnowledgeBaseName + * A fully-qualified path representing project_location_knowledge_base resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationKnowledgeBaseName( + projectLocationKnowledgeBaseName: string + ) { + return this.pathTemplates.projectLocationKnowledgeBasePathTemplate.match( + projectLocationKnowledgeBaseName + ).location; + } + + /** + * Parse the knowledge_base from ProjectLocationKnowledgeBase resource. + * + * @param {string} projectLocationKnowledgeBaseName + * A fully-qualified path representing project_location_knowledge_base resource. + * @returns {string} A string representing the knowledge_base. + */ + matchKnowledgeBaseFromProjectLocationKnowledgeBaseName( + projectLocationKnowledgeBaseName: string + ) { + return this.pathTemplates.projectLocationKnowledgeBasePathTemplate.match( + projectLocationKnowledgeBaseName + ).knowledge_base; + } + + /** + * Return a fully-qualified projectLocationKnowledgeBaseDocument resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} knowledge_base + * @param {string} document + * @returns {string} Resource name string. + */ + projectLocationKnowledgeBaseDocumentPath( + project: string, + location: string, + knowledgeBase: string, + document: string + ) { + return this.pathTemplates.projectLocationKnowledgeBaseDocumentPathTemplate.render( + { + project: project, + location: location, + knowledge_base: knowledgeBase, + document: document, + } + ); + } + + /** + * Parse the project from ProjectLocationKnowledgeBaseDocument resource. + * + * @param {string} projectLocationKnowledgeBaseDocumentName + * A fully-qualified path representing project_location_knowledge_base_document resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationKnowledgeBaseDocumentName( + projectLocationKnowledgeBaseDocumentName: string + ) { + return this.pathTemplates.projectLocationKnowledgeBaseDocumentPathTemplate.match( + projectLocationKnowledgeBaseDocumentName + ).project; + } + + /** + * Parse the location from ProjectLocationKnowledgeBaseDocument resource. + * + * @param {string} projectLocationKnowledgeBaseDocumentName + * A fully-qualified path representing project_location_knowledge_base_document resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationKnowledgeBaseDocumentName( + projectLocationKnowledgeBaseDocumentName: string + ) { + return this.pathTemplates.projectLocationKnowledgeBaseDocumentPathTemplate.match( + projectLocationKnowledgeBaseDocumentName + ).location; + } + + /** + * Parse the knowledge_base from ProjectLocationKnowledgeBaseDocument resource. + * + * @param {string} projectLocationKnowledgeBaseDocumentName + * A fully-qualified path representing project_location_knowledge_base_document resource. + * @returns {string} A string representing the knowledge_base. + */ + matchKnowledgeBaseFromProjectLocationKnowledgeBaseDocumentName( + projectLocationKnowledgeBaseDocumentName: string + ) { + return this.pathTemplates.projectLocationKnowledgeBaseDocumentPathTemplate.match( + projectLocationKnowledgeBaseDocumentName + ).knowledge_base; + } + + /** + * Parse the document from ProjectLocationKnowledgeBaseDocument resource. + * + * @param {string} projectLocationKnowledgeBaseDocumentName + * A fully-qualified path representing project_location_knowledge_base_document resource. + * @returns {string} A string representing the document. + */ + matchDocumentFromProjectLocationKnowledgeBaseDocumentName( + projectLocationKnowledgeBaseDocumentName: string + ) { + return this.pathTemplates.projectLocationKnowledgeBaseDocumentPathTemplate.match( + projectLocationKnowledgeBaseDocumentName + ).document; + } + /** * Terminate the gRPC channel and close the client. * diff --git a/packages/google-cloud-dialogflow/src/v2beta1/documents_client.ts b/packages/google-cloud-dialogflow/src/v2beta1/documents_client.ts index 1d7b7fccc10..f3711fd76f3 100644 --- a/packages/google-cloud-dialogflow/src/v2beta1/documents_client.ts +++ b/packages/google-cloud-dialogflow/src/v2beta1/documents_client.ts @@ -168,12 +168,6 @@ export class DocumentsClient { // identifiers to uniquely identify resources within the API. // Create useful helper objects for these. this.pathTemplates = { - documentPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/knowledgeBases/{knowledge_base}/documents/{document}' - ), - knowledgeBasePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/knowledgeBases/{knowledge_base}' - ), projectPathTemplate: new this._gaxModule.PathTemplate( 'projects/{project}' ), @@ -201,6 +195,12 @@ export class DocumentsClient { projectAgentSessionEntityTypePathTemplate: new this._gaxModule.PathTemplate( 'projects/{project}/agent/sessions/{session}/entityTypes/{entity_type}' ), + projectKnowledgeBasePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/knowledgeBases/{knowledge_base}' + ), + projectKnowledgeBaseDocumentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/knowledgeBases/{knowledge_base}/documents/{document}' + ), projectLocationAgentPathTemplate: new this._gaxModule.PathTemplate( 'projects/{project}/locations/{location}/agent' ), @@ -219,6 +219,12 @@ export class DocumentsClient { projectLocationAgentSessionEntityTypePathTemplate: new this._gaxModule.PathTemplate( 'projects/{project}/locations/{location}/agent/sessions/{session}/entityTypes/{entity_type}' ), + projectLocationKnowledgeBasePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/knowledgeBases/{knowledge_base}' + ), + projectLocationKnowledgeBaseDocumentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/knowledgeBases/{knowledge_base}/documents/{document}' + ), }; // Some of the methods on this service return "paged" results, @@ -476,8 +482,8 @@ export class DocumentsClient { * The request object that will be sent. * @param {string} request.name * Required. The name of the document to retrieve. - * Format `projects//knowledgeBases//documents/`. + * Format `projects//locations//knowledgeBases//documents/`. * @param {object} [options] * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. * @returns {Promise} - The promise which resolves to an array. @@ -579,9 +585,13 @@ export class DocumentsClient { * The request object that will be sent. * @param {string} request.parent * Required. The knowledge base to create a document for. - * Format: `projects//knowledgeBases/`. + * Format: `projects//locations//knowledgeBases/`. * @param {google.cloud.dialogflow.v2beta1.Document} request.document * Required. The document to create. + * @param {boolean} request.importGcsCustomMetadata + * Whether to import custom metadata from Google Cloud Storage. + * Only valid when the document source is Google Cloud Storage URI. * @param {object} [options] * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. * @returns {Promise} - The promise which resolves to an array. @@ -727,8 +737,8 @@ export class DocumentsClient { * The request object that will be sent. * @param {string} request.name * Required. The name of the document to delete. - * Format: `projects//knowledgeBases//documents/`. + * Format: `projects//locations//knowledgeBases//documents/`. * @param {object} [options] * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. * @returns {Promise} - The promise which resolves to an array. @@ -1029,11 +1039,14 @@ export class DocumentsClient { * The request object that will be sent. * @param {string} request.name * Required. The name of the document to reload. - * Format: `projects//knowledgeBases//documents/` + * Format: `projects//locations//knowledgeBases//documents/` * @param {google.cloud.dialogflow.v2beta1.GcsSource} request.gcsSource * The path for a Cloud Storage source file for reloading document content. * If not provided, the Document's existing source will be reloaded. + * @param {boolean} request.importGcsCustomMetadata + * Whether to import custom metadata from Google Cloud Storage. + * Only valid when the document source is Google Cloud Storage URI. * @param {object} [options] * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. * @returns {Promise} - The promise which resolves to an array. @@ -1174,7 +1187,8 @@ export class DocumentsClient { * The request object that will be sent. * @param {string} request.parent * Required. The knowledge base to list all documents for. - * Format: `projects//knowledgeBases/`. + * Format: `projects//locations//knowledgeBases/`. * @param {number} request.pageSize * The maximum number of items to return in a single page. By * default 10 and at most 100. @@ -1266,7 +1280,8 @@ export class DocumentsClient { * The request object that will be sent. * @param {string} request.parent * Required. The knowledge base to list all documents for. - * Format: `projects//knowledgeBases/`. + * Format: `projects//locations//knowledgeBases/`. * @param {number} request.pageSize * The maximum number of items to return in a single page. By * default 10 and at most 100. @@ -1336,7 +1351,8 @@ export class DocumentsClient { * The request object that will be sent. * @param {string} request.parent * Required. The knowledge base to list all documents for. - * Format: `projects//knowledgeBases/`. + * Format: `projects//locations//knowledgeBases/`. * @param {number} request.pageSize * The maximum number of items to return in a single page. By * default 10 and at most 100. @@ -1406,94 +1422,6 @@ export class DocumentsClient { // -- Path templates -- // -------------------- - /** - * Return a fully-qualified document resource name string. - * - * @param {string} project - * @param {string} knowledge_base - * @param {string} document - * @returns {string} Resource name string. - */ - documentPath(project: string, knowledgeBase: string, document: string) { - return this.pathTemplates.documentPathTemplate.render({ - project: project, - knowledge_base: knowledgeBase, - document: document, - }); - } - - /** - * Parse the project from Document resource. - * - * @param {string} documentName - * A fully-qualified path representing Document resource. - * @returns {string} A string representing the project. - */ - matchProjectFromDocumentName(documentName: string) { - return this.pathTemplates.documentPathTemplate.match(documentName).project; - } - - /** - * Parse the knowledge_base from Document resource. - * - * @param {string} documentName - * A fully-qualified path representing Document resource. - * @returns {string} A string representing the knowledge_base. - */ - matchKnowledgeBaseFromDocumentName(documentName: string) { - return this.pathTemplates.documentPathTemplate.match(documentName) - .knowledge_base; - } - - /** - * Parse the document from Document resource. - * - * @param {string} documentName - * A fully-qualified path representing Document resource. - * @returns {string} A string representing the document. - */ - matchDocumentFromDocumentName(documentName: string) { - return this.pathTemplates.documentPathTemplate.match(documentName).document; - } - - /** - * Return a fully-qualified knowledgeBase resource name string. - * - * @param {string} project - * @param {string} knowledge_base - * @returns {string} Resource name string. - */ - knowledgeBasePath(project: string, knowledgeBase: string) { - return this.pathTemplates.knowledgeBasePathTemplate.render({ - project: project, - knowledge_base: knowledgeBase, - }); - } - - /** - * Parse the project from KnowledgeBase resource. - * - * @param {string} knowledgeBaseName - * A fully-qualified path representing KnowledgeBase resource. - * @returns {string} A string representing the project. - */ - matchProjectFromKnowledgeBaseName(knowledgeBaseName: string) { - return this.pathTemplates.knowledgeBasePathTemplate.match(knowledgeBaseName) - .project; - } - - /** - * Parse the knowledge_base from KnowledgeBase resource. - * - * @param {string} knowledgeBaseName - * A fully-qualified path representing KnowledgeBase resource. - * @returns {string} A string representing the knowledge_base. - */ - matchKnowledgeBaseFromKnowledgeBaseName(knowledgeBaseName: string) { - return this.pathTemplates.knowledgeBasePathTemplate.match(knowledgeBaseName) - .knowledge_base; - } - /** * Return a fully-qualified project resource name string. * @@ -2005,6 +1933,113 @@ export class DocumentsClient { ).entity_type; } + /** + * Return a fully-qualified projectKnowledgeBase resource name string. + * + * @param {string} project + * @param {string} knowledge_base + * @returns {string} Resource name string. + */ + projectKnowledgeBasePath(project: string, knowledgeBase: string) { + return this.pathTemplates.projectKnowledgeBasePathTemplate.render({ + project: project, + knowledge_base: knowledgeBase, + }); + } + + /** + * Parse the project from ProjectKnowledgeBase resource. + * + * @param {string} projectKnowledgeBaseName + * A fully-qualified path representing project_knowledge_base resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectKnowledgeBaseName(projectKnowledgeBaseName: string) { + return this.pathTemplates.projectKnowledgeBasePathTemplate.match( + projectKnowledgeBaseName + ).project; + } + + /** + * Parse the knowledge_base from ProjectKnowledgeBase resource. + * + * @param {string} projectKnowledgeBaseName + * A fully-qualified path representing project_knowledge_base resource. + * @returns {string} A string representing the knowledge_base. + */ + matchKnowledgeBaseFromProjectKnowledgeBaseName( + projectKnowledgeBaseName: string + ) { + return this.pathTemplates.projectKnowledgeBasePathTemplate.match( + projectKnowledgeBaseName + ).knowledge_base; + } + + /** + * Return a fully-qualified projectKnowledgeBaseDocument resource name string. + * + * @param {string} project + * @param {string} knowledge_base + * @param {string} document + * @returns {string} Resource name string. + */ + projectKnowledgeBaseDocumentPath( + project: string, + knowledgeBase: string, + document: string + ) { + return this.pathTemplates.projectKnowledgeBaseDocumentPathTemplate.render({ + project: project, + knowledge_base: knowledgeBase, + document: document, + }); + } + + /** + * Parse the project from ProjectKnowledgeBaseDocument resource. + * + * @param {string} projectKnowledgeBaseDocumentName + * A fully-qualified path representing project_knowledge_base_document resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectKnowledgeBaseDocumentName( + projectKnowledgeBaseDocumentName: string + ) { + return this.pathTemplates.projectKnowledgeBaseDocumentPathTemplate.match( + projectKnowledgeBaseDocumentName + ).project; + } + + /** + * Parse the knowledge_base from ProjectKnowledgeBaseDocument resource. + * + * @param {string} projectKnowledgeBaseDocumentName + * A fully-qualified path representing project_knowledge_base_document resource. + * @returns {string} A string representing the knowledge_base. + */ + matchKnowledgeBaseFromProjectKnowledgeBaseDocumentName( + projectKnowledgeBaseDocumentName: string + ) { + return this.pathTemplates.projectKnowledgeBaseDocumentPathTemplate.match( + projectKnowledgeBaseDocumentName + ).knowledge_base; + } + + /** + * Parse the document from ProjectKnowledgeBaseDocument resource. + * + * @param {string} projectKnowledgeBaseDocumentName + * A fully-qualified path representing project_knowledge_base_document resource. + * @returns {string} A string representing the document. + */ + matchDocumentFromProjectKnowledgeBaseDocumentName( + projectKnowledgeBaseDocumentName: string + ) { + return this.pathTemplates.projectKnowledgeBaseDocumentPathTemplate.match( + projectKnowledgeBaseDocumentName + ).document; + } + /** * Return a fully-qualified projectLocationAgent resource name string. * @@ -2414,6 +2449,156 @@ export class DocumentsClient { ).entity_type; } + /** + * Return a fully-qualified projectLocationKnowledgeBase resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} knowledge_base + * @returns {string} Resource name string. + */ + projectLocationKnowledgeBasePath( + project: string, + location: string, + knowledgeBase: string + ) { + return this.pathTemplates.projectLocationKnowledgeBasePathTemplate.render({ + project: project, + location: location, + knowledge_base: knowledgeBase, + }); + } + + /** + * Parse the project from ProjectLocationKnowledgeBase resource. + * + * @param {string} projectLocationKnowledgeBaseName + * A fully-qualified path representing project_location_knowledge_base resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationKnowledgeBaseName( + projectLocationKnowledgeBaseName: string + ) { + return this.pathTemplates.projectLocationKnowledgeBasePathTemplate.match( + projectLocationKnowledgeBaseName + ).project; + } + + /** + * Parse the location from ProjectLocationKnowledgeBase resource. + * + * @param {string} projectLocationKnowledgeBaseName + * A fully-qualified path representing project_location_knowledge_base resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationKnowledgeBaseName( + projectLocationKnowledgeBaseName: string + ) { + return this.pathTemplates.projectLocationKnowledgeBasePathTemplate.match( + projectLocationKnowledgeBaseName + ).location; + } + + /** + * Parse the knowledge_base from ProjectLocationKnowledgeBase resource. + * + * @param {string} projectLocationKnowledgeBaseName + * A fully-qualified path representing project_location_knowledge_base resource. + * @returns {string} A string representing the knowledge_base. + */ + matchKnowledgeBaseFromProjectLocationKnowledgeBaseName( + projectLocationKnowledgeBaseName: string + ) { + return this.pathTemplates.projectLocationKnowledgeBasePathTemplate.match( + projectLocationKnowledgeBaseName + ).knowledge_base; + } + + /** + * Return a fully-qualified projectLocationKnowledgeBaseDocument resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} knowledge_base + * @param {string} document + * @returns {string} Resource name string. + */ + projectLocationKnowledgeBaseDocumentPath( + project: string, + location: string, + knowledgeBase: string, + document: string + ) { + return this.pathTemplates.projectLocationKnowledgeBaseDocumentPathTemplate.render( + { + project: project, + location: location, + knowledge_base: knowledgeBase, + document: document, + } + ); + } + + /** + * Parse the project from ProjectLocationKnowledgeBaseDocument resource. + * + * @param {string} projectLocationKnowledgeBaseDocumentName + * A fully-qualified path representing project_location_knowledge_base_document resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationKnowledgeBaseDocumentName( + projectLocationKnowledgeBaseDocumentName: string + ) { + return this.pathTemplates.projectLocationKnowledgeBaseDocumentPathTemplate.match( + projectLocationKnowledgeBaseDocumentName + ).project; + } + + /** + * Parse the location from ProjectLocationKnowledgeBaseDocument resource. + * + * @param {string} projectLocationKnowledgeBaseDocumentName + * A fully-qualified path representing project_location_knowledge_base_document resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationKnowledgeBaseDocumentName( + projectLocationKnowledgeBaseDocumentName: string + ) { + return this.pathTemplates.projectLocationKnowledgeBaseDocumentPathTemplate.match( + projectLocationKnowledgeBaseDocumentName + ).location; + } + + /** + * Parse the knowledge_base from ProjectLocationKnowledgeBaseDocument resource. + * + * @param {string} projectLocationKnowledgeBaseDocumentName + * A fully-qualified path representing project_location_knowledge_base_document resource. + * @returns {string} A string representing the knowledge_base. + */ + matchKnowledgeBaseFromProjectLocationKnowledgeBaseDocumentName( + projectLocationKnowledgeBaseDocumentName: string + ) { + return this.pathTemplates.projectLocationKnowledgeBaseDocumentPathTemplate.match( + projectLocationKnowledgeBaseDocumentName + ).knowledge_base; + } + + /** + * Parse the document from ProjectLocationKnowledgeBaseDocument resource. + * + * @param {string} projectLocationKnowledgeBaseDocumentName + * A fully-qualified path representing project_location_knowledge_base_document resource. + * @returns {string} A string representing the document. + */ + matchDocumentFromProjectLocationKnowledgeBaseDocumentName( + projectLocationKnowledgeBaseDocumentName: string + ) { + return this.pathTemplates.projectLocationKnowledgeBaseDocumentPathTemplate.match( + projectLocationKnowledgeBaseDocumentName + ).document; + } + /** * Terminate the gRPC channel and close the client. * diff --git a/packages/google-cloud-dialogflow/src/v2beta1/entity_types_client.ts b/packages/google-cloud-dialogflow/src/v2beta1/entity_types_client.ts index 62a2fb60147..81d42f069f2 100644 --- a/packages/google-cloud-dialogflow/src/v2beta1/entity_types_client.ts +++ b/packages/google-cloud-dialogflow/src/v2beta1/entity_types_client.ts @@ -168,12 +168,6 @@ export class EntityTypesClient { // identifiers to uniquely identify resources within the API. // Create useful helper objects for these. this.pathTemplates = { - documentPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/knowledgeBases/{knowledge_base}/documents/{document}' - ), - knowledgeBasePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/knowledgeBases/{knowledge_base}' - ), projectPathTemplate: new this._gaxModule.PathTemplate( 'projects/{project}' ), @@ -201,6 +195,12 @@ export class EntityTypesClient { projectAgentSessionEntityTypePathTemplate: new this._gaxModule.PathTemplate( 'projects/{project}/agent/sessions/{session}/entityTypes/{entity_type}' ), + projectKnowledgeBasePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/knowledgeBases/{knowledge_base}' + ), + projectKnowledgeBaseDocumentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/knowledgeBases/{knowledge_base}/documents/{document}' + ), projectLocationAgentPathTemplate: new this._gaxModule.PathTemplate( 'projects/{project}/locations/{location}/agent' ), @@ -219,6 +219,12 @@ export class EntityTypesClient { projectLocationAgentSessionEntityTypePathTemplate: new this._gaxModule.PathTemplate( 'projects/{project}/locations/{location}/agent/sessions/{session}/entityTypes/{entity_type}' ), + projectLocationKnowledgeBasePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/knowledgeBases/{knowledge_base}' + ), + projectLocationKnowledgeBaseDocumentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/knowledgeBases/{knowledge_base}/documents/{document}' + ), }; // Some of the methods on this service return "paged" results, @@ -1886,94 +1892,6 @@ export class EntityTypesClient { // -- Path templates -- // -------------------- - /** - * Return a fully-qualified document resource name string. - * - * @param {string} project - * @param {string} knowledge_base - * @param {string} document - * @returns {string} Resource name string. - */ - documentPath(project: string, knowledgeBase: string, document: string) { - return this.pathTemplates.documentPathTemplate.render({ - project: project, - knowledge_base: knowledgeBase, - document: document, - }); - } - - /** - * Parse the project from Document resource. - * - * @param {string} documentName - * A fully-qualified path representing Document resource. - * @returns {string} A string representing the project. - */ - matchProjectFromDocumentName(documentName: string) { - return this.pathTemplates.documentPathTemplate.match(documentName).project; - } - - /** - * Parse the knowledge_base from Document resource. - * - * @param {string} documentName - * A fully-qualified path representing Document resource. - * @returns {string} A string representing the knowledge_base. - */ - matchKnowledgeBaseFromDocumentName(documentName: string) { - return this.pathTemplates.documentPathTemplate.match(documentName) - .knowledge_base; - } - - /** - * Parse the document from Document resource. - * - * @param {string} documentName - * A fully-qualified path representing Document resource. - * @returns {string} A string representing the document. - */ - matchDocumentFromDocumentName(documentName: string) { - return this.pathTemplates.documentPathTemplate.match(documentName).document; - } - - /** - * Return a fully-qualified knowledgeBase resource name string. - * - * @param {string} project - * @param {string} knowledge_base - * @returns {string} Resource name string. - */ - knowledgeBasePath(project: string, knowledgeBase: string) { - return this.pathTemplates.knowledgeBasePathTemplate.render({ - project: project, - knowledge_base: knowledgeBase, - }); - } - - /** - * Parse the project from KnowledgeBase resource. - * - * @param {string} knowledgeBaseName - * A fully-qualified path representing KnowledgeBase resource. - * @returns {string} A string representing the project. - */ - matchProjectFromKnowledgeBaseName(knowledgeBaseName: string) { - return this.pathTemplates.knowledgeBasePathTemplate.match(knowledgeBaseName) - .project; - } - - /** - * Parse the knowledge_base from KnowledgeBase resource. - * - * @param {string} knowledgeBaseName - * A fully-qualified path representing KnowledgeBase resource. - * @returns {string} A string representing the knowledge_base. - */ - matchKnowledgeBaseFromKnowledgeBaseName(knowledgeBaseName: string) { - return this.pathTemplates.knowledgeBasePathTemplate.match(knowledgeBaseName) - .knowledge_base; - } - /** * Return a fully-qualified project resource name string. * @@ -2485,6 +2403,113 @@ export class EntityTypesClient { ).entity_type; } + /** + * Return a fully-qualified projectKnowledgeBase resource name string. + * + * @param {string} project + * @param {string} knowledge_base + * @returns {string} Resource name string. + */ + projectKnowledgeBasePath(project: string, knowledgeBase: string) { + return this.pathTemplates.projectKnowledgeBasePathTemplate.render({ + project: project, + knowledge_base: knowledgeBase, + }); + } + + /** + * Parse the project from ProjectKnowledgeBase resource. + * + * @param {string} projectKnowledgeBaseName + * A fully-qualified path representing project_knowledge_base resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectKnowledgeBaseName(projectKnowledgeBaseName: string) { + return this.pathTemplates.projectKnowledgeBasePathTemplate.match( + projectKnowledgeBaseName + ).project; + } + + /** + * Parse the knowledge_base from ProjectKnowledgeBase resource. + * + * @param {string} projectKnowledgeBaseName + * A fully-qualified path representing project_knowledge_base resource. + * @returns {string} A string representing the knowledge_base. + */ + matchKnowledgeBaseFromProjectKnowledgeBaseName( + projectKnowledgeBaseName: string + ) { + return this.pathTemplates.projectKnowledgeBasePathTemplate.match( + projectKnowledgeBaseName + ).knowledge_base; + } + + /** + * Return a fully-qualified projectKnowledgeBaseDocument resource name string. + * + * @param {string} project + * @param {string} knowledge_base + * @param {string} document + * @returns {string} Resource name string. + */ + projectKnowledgeBaseDocumentPath( + project: string, + knowledgeBase: string, + document: string + ) { + return this.pathTemplates.projectKnowledgeBaseDocumentPathTemplate.render({ + project: project, + knowledge_base: knowledgeBase, + document: document, + }); + } + + /** + * Parse the project from ProjectKnowledgeBaseDocument resource. + * + * @param {string} projectKnowledgeBaseDocumentName + * A fully-qualified path representing project_knowledge_base_document resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectKnowledgeBaseDocumentName( + projectKnowledgeBaseDocumentName: string + ) { + return this.pathTemplates.projectKnowledgeBaseDocumentPathTemplate.match( + projectKnowledgeBaseDocumentName + ).project; + } + + /** + * Parse the knowledge_base from ProjectKnowledgeBaseDocument resource. + * + * @param {string} projectKnowledgeBaseDocumentName + * A fully-qualified path representing project_knowledge_base_document resource. + * @returns {string} A string representing the knowledge_base. + */ + matchKnowledgeBaseFromProjectKnowledgeBaseDocumentName( + projectKnowledgeBaseDocumentName: string + ) { + return this.pathTemplates.projectKnowledgeBaseDocumentPathTemplate.match( + projectKnowledgeBaseDocumentName + ).knowledge_base; + } + + /** + * Parse the document from ProjectKnowledgeBaseDocument resource. + * + * @param {string} projectKnowledgeBaseDocumentName + * A fully-qualified path representing project_knowledge_base_document resource. + * @returns {string} A string representing the document. + */ + matchDocumentFromProjectKnowledgeBaseDocumentName( + projectKnowledgeBaseDocumentName: string + ) { + return this.pathTemplates.projectKnowledgeBaseDocumentPathTemplate.match( + projectKnowledgeBaseDocumentName + ).document; + } + /** * Return a fully-qualified projectLocationAgent resource name string. * @@ -2894,6 +2919,156 @@ export class EntityTypesClient { ).entity_type; } + /** + * Return a fully-qualified projectLocationKnowledgeBase resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} knowledge_base + * @returns {string} Resource name string. + */ + projectLocationKnowledgeBasePath( + project: string, + location: string, + knowledgeBase: string + ) { + return this.pathTemplates.projectLocationKnowledgeBasePathTemplate.render({ + project: project, + location: location, + knowledge_base: knowledgeBase, + }); + } + + /** + * Parse the project from ProjectLocationKnowledgeBase resource. + * + * @param {string} projectLocationKnowledgeBaseName + * A fully-qualified path representing project_location_knowledge_base resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationKnowledgeBaseName( + projectLocationKnowledgeBaseName: string + ) { + return this.pathTemplates.projectLocationKnowledgeBasePathTemplate.match( + projectLocationKnowledgeBaseName + ).project; + } + + /** + * Parse the location from ProjectLocationKnowledgeBase resource. + * + * @param {string} projectLocationKnowledgeBaseName + * A fully-qualified path representing project_location_knowledge_base resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationKnowledgeBaseName( + projectLocationKnowledgeBaseName: string + ) { + return this.pathTemplates.projectLocationKnowledgeBasePathTemplate.match( + projectLocationKnowledgeBaseName + ).location; + } + + /** + * Parse the knowledge_base from ProjectLocationKnowledgeBase resource. + * + * @param {string} projectLocationKnowledgeBaseName + * A fully-qualified path representing project_location_knowledge_base resource. + * @returns {string} A string representing the knowledge_base. + */ + matchKnowledgeBaseFromProjectLocationKnowledgeBaseName( + projectLocationKnowledgeBaseName: string + ) { + return this.pathTemplates.projectLocationKnowledgeBasePathTemplate.match( + projectLocationKnowledgeBaseName + ).knowledge_base; + } + + /** + * Return a fully-qualified projectLocationKnowledgeBaseDocument resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} knowledge_base + * @param {string} document + * @returns {string} Resource name string. + */ + projectLocationKnowledgeBaseDocumentPath( + project: string, + location: string, + knowledgeBase: string, + document: string + ) { + return this.pathTemplates.projectLocationKnowledgeBaseDocumentPathTemplate.render( + { + project: project, + location: location, + knowledge_base: knowledgeBase, + document: document, + } + ); + } + + /** + * Parse the project from ProjectLocationKnowledgeBaseDocument resource. + * + * @param {string} projectLocationKnowledgeBaseDocumentName + * A fully-qualified path representing project_location_knowledge_base_document resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationKnowledgeBaseDocumentName( + projectLocationKnowledgeBaseDocumentName: string + ) { + return this.pathTemplates.projectLocationKnowledgeBaseDocumentPathTemplate.match( + projectLocationKnowledgeBaseDocumentName + ).project; + } + + /** + * Parse the location from ProjectLocationKnowledgeBaseDocument resource. + * + * @param {string} projectLocationKnowledgeBaseDocumentName + * A fully-qualified path representing project_location_knowledge_base_document resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationKnowledgeBaseDocumentName( + projectLocationKnowledgeBaseDocumentName: string + ) { + return this.pathTemplates.projectLocationKnowledgeBaseDocumentPathTemplate.match( + projectLocationKnowledgeBaseDocumentName + ).location; + } + + /** + * Parse the knowledge_base from ProjectLocationKnowledgeBaseDocument resource. + * + * @param {string} projectLocationKnowledgeBaseDocumentName + * A fully-qualified path representing project_location_knowledge_base_document resource. + * @returns {string} A string representing the knowledge_base. + */ + matchKnowledgeBaseFromProjectLocationKnowledgeBaseDocumentName( + projectLocationKnowledgeBaseDocumentName: string + ) { + return this.pathTemplates.projectLocationKnowledgeBaseDocumentPathTemplate.match( + projectLocationKnowledgeBaseDocumentName + ).knowledge_base; + } + + /** + * Parse the document from ProjectLocationKnowledgeBaseDocument resource. + * + * @param {string} projectLocationKnowledgeBaseDocumentName + * A fully-qualified path representing project_location_knowledge_base_document resource. + * @returns {string} A string representing the document. + */ + matchDocumentFromProjectLocationKnowledgeBaseDocumentName( + projectLocationKnowledgeBaseDocumentName: string + ) { + return this.pathTemplates.projectLocationKnowledgeBaseDocumentPathTemplate.match( + projectLocationKnowledgeBaseDocumentName + ).document; + } + /** * Terminate the gRPC channel and close the client. * diff --git a/packages/google-cloud-dialogflow/src/v2beta1/environments_client.ts b/packages/google-cloud-dialogflow/src/v2beta1/environments_client.ts index 623ae165476..aae94d9999b 100644 --- a/packages/google-cloud-dialogflow/src/v2beta1/environments_client.ts +++ b/packages/google-cloud-dialogflow/src/v2beta1/environments_client.ts @@ -166,12 +166,6 @@ export class EnvironmentsClient { // identifiers to uniquely identify resources within the API. // Create useful helper objects for these. this.pathTemplates = { - documentPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/knowledgeBases/{knowledge_base}/documents/{document}' - ), - knowledgeBasePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/knowledgeBases/{knowledge_base}' - ), projectPathTemplate: new this._gaxModule.PathTemplate( 'projects/{project}' ), @@ -199,6 +193,12 @@ export class EnvironmentsClient { projectAgentSessionEntityTypePathTemplate: new this._gaxModule.PathTemplate( 'projects/{project}/agent/sessions/{session}/entityTypes/{entity_type}' ), + projectKnowledgeBasePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/knowledgeBases/{knowledge_base}' + ), + projectKnowledgeBaseDocumentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/knowledgeBases/{knowledge_base}/documents/{document}' + ), projectLocationAgentPathTemplate: new this._gaxModule.PathTemplate( 'projects/{project}/locations/{location}/agent' ), @@ -217,6 +217,12 @@ export class EnvironmentsClient { projectLocationAgentSessionEntityTypePathTemplate: new this._gaxModule.PathTemplate( 'projects/{project}/locations/{location}/agent/sessions/{session}/entityTypes/{entity_type}' ), + projectLocationKnowledgeBasePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/knowledgeBases/{knowledge_base}' + ), + projectLocationKnowledgeBaseDocumentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/knowledgeBases/{knowledge_base}/documents/{document}' + ), }; // Some of the methods on this service return "paged" results, @@ -570,94 +576,6 @@ export class EnvironmentsClient { // -- Path templates -- // -------------------- - /** - * Return a fully-qualified document resource name string. - * - * @param {string} project - * @param {string} knowledge_base - * @param {string} document - * @returns {string} Resource name string. - */ - documentPath(project: string, knowledgeBase: string, document: string) { - return this.pathTemplates.documentPathTemplate.render({ - project: project, - knowledge_base: knowledgeBase, - document: document, - }); - } - - /** - * Parse the project from Document resource. - * - * @param {string} documentName - * A fully-qualified path representing Document resource. - * @returns {string} A string representing the project. - */ - matchProjectFromDocumentName(documentName: string) { - return this.pathTemplates.documentPathTemplate.match(documentName).project; - } - - /** - * Parse the knowledge_base from Document resource. - * - * @param {string} documentName - * A fully-qualified path representing Document resource. - * @returns {string} A string representing the knowledge_base. - */ - matchKnowledgeBaseFromDocumentName(documentName: string) { - return this.pathTemplates.documentPathTemplate.match(documentName) - .knowledge_base; - } - - /** - * Parse the document from Document resource. - * - * @param {string} documentName - * A fully-qualified path representing Document resource. - * @returns {string} A string representing the document. - */ - matchDocumentFromDocumentName(documentName: string) { - return this.pathTemplates.documentPathTemplate.match(documentName).document; - } - - /** - * Return a fully-qualified knowledgeBase resource name string. - * - * @param {string} project - * @param {string} knowledge_base - * @returns {string} Resource name string. - */ - knowledgeBasePath(project: string, knowledgeBase: string) { - return this.pathTemplates.knowledgeBasePathTemplate.render({ - project: project, - knowledge_base: knowledgeBase, - }); - } - - /** - * Parse the project from KnowledgeBase resource. - * - * @param {string} knowledgeBaseName - * A fully-qualified path representing KnowledgeBase resource. - * @returns {string} A string representing the project. - */ - matchProjectFromKnowledgeBaseName(knowledgeBaseName: string) { - return this.pathTemplates.knowledgeBasePathTemplate.match(knowledgeBaseName) - .project; - } - - /** - * Parse the knowledge_base from KnowledgeBase resource. - * - * @param {string} knowledgeBaseName - * A fully-qualified path representing KnowledgeBase resource. - * @returns {string} A string representing the knowledge_base. - */ - matchKnowledgeBaseFromKnowledgeBaseName(knowledgeBaseName: string) { - return this.pathTemplates.knowledgeBasePathTemplate.match(knowledgeBaseName) - .knowledge_base; - } - /** * Return a fully-qualified project resource name string. * @@ -1169,6 +1087,113 @@ export class EnvironmentsClient { ).entity_type; } + /** + * Return a fully-qualified projectKnowledgeBase resource name string. + * + * @param {string} project + * @param {string} knowledge_base + * @returns {string} Resource name string. + */ + projectKnowledgeBasePath(project: string, knowledgeBase: string) { + return this.pathTemplates.projectKnowledgeBasePathTemplate.render({ + project: project, + knowledge_base: knowledgeBase, + }); + } + + /** + * Parse the project from ProjectKnowledgeBase resource. + * + * @param {string} projectKnowledgeBaseName + * A fully-qualified path representing project_knowledge_base resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectKnowledgeBaseName(projectKnowledgeBaseName: string) { + return this.pathTemplates.projectKnowledgeBasePathTemplate.match( + projectKnowledgeBaseName + ).project; + } + + /** + * Parse the knowledge_base from ProjectKnowledgeBase resource. + * + * @param {string} projectKnowledgeBaseName + * A fully-qualified path representing project_knowledge_base resource. + * @returns {string} A string representing the knowledge_base. + */ + matchKnowledgeBaseFromProjectKnowledgeBaseName( + projectKnowledgeBaseName: string + ) { + return this.pathTemplates.projectKnowledgeBasePathTemplate.match( + projectKnowledgeBaseName + ).knowledge_base; + } + + /** + * Return a fully-qualified projectKnowledgeBaseDocument resource name string. + * + * @param {string} project + * @param {string} knowledge_base + * @param {string} document + * @returns {string} Resource name string. + */ + projectKnowledgeBaseDocumentPath( + project: string, + knowledgeBase: string, + document: string + ) { + return this.pathTemplates.projectKnowledgeBaseDocumentPathTemplate.render({ + project: project, + knowledge_base: knowledgeBase, + document: document, + }); + } + + /** + * Parse the project from ProjectKnowledgeBaseDocument resource. + * + * @param {string} projectKnowledgeBaseDocumentName + * A fully-qualified path representing project_knowledge_base_document resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectKnowledgeBaseDocumentName( + projectKnowledgeBaseDocumentName: string + ) { + return this.pathTemplates.projectKnowledgeBaseDocumentPathTemplate.match( + projectKnowledgeBaseDocumentName + ).project; + } + + /** + * Parse the knowledge_base from ProjectKnowledgeBaseDocument resource. + * + * @param {string} projectKnowledgeBaseDocumentName + * A fully-qualified path representing project_knowledge_base_document resource. + * @returns {string} A string representing the knowledge_base. + */ + matchKnowledgeBaseFromProjectKnowledgeBaseDocumentName( + projectKnowledgeBaseDocumentName: string + ) { + return this.pathTemplates.projectKnowledgeBaseDocumentPathTemplate.match( + projectKnowledgeBaseDocumentName + ).knowledge_base; + } + + /** + * Parse the document from ProjectKnowledgeBaseDocument resource. + * + * @param {string} projectKnowledgeBaseDocumentName + * A fully-qualified path representing project_knowledge_base_document resource. + * @returns {string} A string representing the document. + */ + matchDocumentFromProjectKnowledgeBaseDocumentName( + projectKnowledgeBaseDocumentName: string + ) { + return this.pathTemplates.projectKnowledgeBaseDocumentPathTemplate.match( + projectKnowledgeBaseDocumentName + ).document; + } + /** * Return a fully-qualified projectLocationAgent resource name string. * @@ -1578,6 +1603,156 @@ export class EnvironmentsClient { ).entity_type; } + /** + * Return a fully-qualified projectLocationKnowledgeBase resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} knowledge_base + * @returns {string} Resource name string. + */ + projectLocationKnowledgeBasePath( + project: string, + location: string, + knowledgeBase: string + ) { + return this.pathTemplates.projectLocationKnowledgeBasePathTemplate.render({ + project: project, + location: location, + knowledge_base: knowledgeBase, + }); + } + + /** + * Parse the project from ProjectLocationKnowledgeBase resource. + * + * @param {string} projectLocationKnowledgeBaseName + * A fully-qualified path representing project_location_knowledge_base resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationKnowledgeBaseName( + projectLocationKnowledgeBaseName: string + ) { + return this.pathTemplates.projectLocationKnowledgeBasePathTemplate.match( + projectLocationKnowledgeBaseName + ).project; + } + + /** + * Parse the location from ProjectLocationKnowledgeBase resource. + * + * @param {string} projectLocationKnowledgeBaseName + * A fully-qualified path representing project_location_knowledge_base resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationKnowledgeBaseName( + projectLocationKnowledgeBaseName: string + ) { + return this.pathTemplates.projectLocationKnowledgeBasePathTemplate.match( + projectLocationKnowledgeBaseName + ).location; + } + + /** + * Parse the knowledge_base from ProjectLocationKnowledgeBase resource. + * + * @param {string} projectLocationKnowledgeBaseName + * A fully-qualified path representing project_location_knowledge_base resource. + * @returns {string} A string representing the knowledge_base. + */ + matchKnowledgeBaseFromProjectLocationKnowledgeBaseName( + projectLocationKnowledgeBaseName: string + ) { + return this.pathTemplates.projectLocationKnowledgeBasePathTemplate.match( + projectLocationKnowledgeBaseName + ).knowledge_base; + } + + /** + * Return a fully-qualified projectLocationKnowledgeBaseDocument resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} knowledge_base + * @param {string} document + * @returns {string} Resource name string. + */ + projectLocationKnowledgeBaseDocumentPath( + project: string, + location: string, + knowledgeBase: string, + document: string + ) { + return this.pathTemplates.projectLocationKnowledgeBaseDocumentPathTemplate.render( + { + project: project, + location: location, + knowledge_base: knowledgeBase, + document: document, + } + ); + } + + /** + * Parse the project from ProjectLocationKnowledgeBaseDocument resource. + * + * @param {string} projectLocationKnowledgeBaseDocumentName + * A fully-qualified path representing project_location_knowledge_base_document resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationKnowledgeBaseDocumentName( + projectLocationKnowledgeBaseDocumentName: string + ) { + return this.pathTemplates.projectLocationKnowledgeBaseDocumentPathTemplate.match( + projectLocationKnowledgeBaseDocumentName + ).project; + } + + /** + * Parse the location from ProjectLocationKnowledgeBaseDocument resource. + * + * @param {string} projectLocationKnowledgeBaseDocumentName + * A fully-qualified path representing project_location_knowledge_base_document resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationKnowledgeBaseDocumentName( + projectLocationKnowledgeBaseDocumentName: string + ) { + return this.pathTemplates.projectLocationKnowledgeBaseDocumentPathTemplate.match( + projectLocationKnowledgeBaseDocumentName + ).location; + } + + /** + * Parse the knowledge_base from ProjectLocationKnowledgeBaseDocument resource. + * + * @param {string} projectLocationKnowledgeBaseDocumentName + * A fully-qualified path representing project_location_knowledge_base_document resource. + * @returns {string} A string representing the knowledge_base. + */ + matchKnowledgeBaseFromProjectLocationKnowledgeBaseDocumentName( + projectLocationKnowledgeBaseDocumentName: string + ) { + return this.pathTemplates.projectLocationKnowledgeBaseDocumentPathTemplate.match( + projectLocationKnowledgeBaseDocumentName + ).knowledge_base; + } + + /** + * Parse the document from ProjectLocationKnowledgeBaseDocument resource. + * + * @param {string} projectLocationKnowledgeBaseDocumentName + * A fully-qualified path representing project_location_knowledge_base_document resource. + * @returns {string} A string representing the document. + */ + matchDocumentFromProjectLocationKnowledgeBaseDocumentName( + projectLocationKnowledgeBaseDocumentName: string + ) { + return this.pathTemplates.projectLocationKnowledgeBaseDocumentPathTemplate.match( + projectLocationKnowledgeBaseDocumentName + ).document; + } + /** * Terminate the gRPC channel and close the client. * diff --git a/packages/google-cloud-dialogflow/src/v2beta1/gapic_metadata.json b/packages/google-cloud-dialogflow/src/v2beta1/gapic_metadata.json new file mode 100644 index 00000000000..b791847979b --- /dev/null +++ b/packages/google-cloud-dialogflow/src/v2beta1/gapic_metadata.json @@ -0,0 +1,364 @@ +{ + "schema": "1.0", + "comment": "This file maps proto services/RPCs to the corresponding library clients/methods", + "language": "typescript", + "protoPackage": "google.cloud.dialogflow.v2beta1", + "libraryPackage": "@google-cloud/dialogflow", + "services": {"Agents": {"clients": { + "grpc": { + "libraryClient": "AgentsClient", + "rpcs": {"GetAgent": { + "methods": ["getAgent"] + },"SetAgent": { + "methods": ["setAgent"] + },"DeleteAgent": { + "methods": ["deleteAgent"] + },"GetValidationResult": { + "methods": ["getValidationResult"] + },"TrainAgent": { + "methods": ["trainAgent"] + },"ExportAgent": { + "methods": ["exportAgent"] + },"ImportAgent": { + "methods": ["importAgent"] + },"RestoreAgent": { + "methods": ["restoreAgent"] + },"SearchAgents": { + "methods": [ + "searchAgents", + "searchAgentsStream", + "searchAgentsAsync" + ] + }} + }, + "grpc-fallback": { + "libraryClient": "AgentsClient", + "rpcs": {"GetAgent": { + "methods": ["getAgent"] + },"SetAgent": { + "methods": ["setAgent"] + },"DeleteAgent": { + "methods": ["deleteAgent"] + },"GetValidationResult": { + "methods": ["getValidationResult"] + },"TrainAgent": { + "methods": ["trainAgent"] + },"ExportAgent": { + "methods": ["exportAgent"] + },"ImportAgent": { + "methods": ["importAgent"] + },"RestoreAgent": { + "methods": ["restoreAgent"] + },"SearchAgents": { + "methods": [ + "searchAgents", + "searchAgentsStream", + "searchAgentsAsync" + ] + }} + } + } + },"Contexts": {"clients": { + "grpc": { + "libraryClient": "ContextsClient", + "rpcs": {"GetContext": { + "methods": ["getContext"] + },"CreateContext": { + "methods": ["createContext"] + },"UpdateContext": { + "methods": ["updateContext"] + },"DeleteContext": { + "methods": ["deleteContext"] + },"DeleteAllContexts": { + "methods": ["deleteAllContexts"] + },"ListContexts": { + "methods": [ + "listContexts", + "listContextsStream", + "listContextsAsync" + ] + }} + }, + "grpc-fallback": { + "libraryClient": "ContextsClient", + "rpcs": {"GetContext": { + "methods": ["getContext"] + },"CreateContext": { + "methods": ["createContext"] + },"UpdateContext": { + "methods": ["updateContext"] + },"DeleteContext": { + "methods": ["deleteContext"] + },"DeleteAllContexts": { + "methods": ["deleteAllContexts"] + },"ListContexts": { + "methods": [ + "listContexts", + "listContextsStream", + "listContextsAsync" + ] + }} + } + } + },"Documents": {"clients": { + "grpc": { + "libraryClient": "DocumentsClient", + "rpcs": {"GetDocument": { + "methods": ["getDocument"] + },"CreateDocument": { + "methods": ["createDocument"] + },"DeleteDocument": { + "methods": ["deleteDocument"] + },"UpdateDocument": { + "methods": ["updateDocument"] + },"ReloadDocument": { + "methods": ["reloadDocument"] + },"ListDocuments": { + "methods": [ + "listDocuments", + "listDocumentsStream", + "listDocumentsAsync" + ] + }} + }, + "grpc-fallback": { + "libraryClient": "DocumentsClient", + "rpcs": {"GetDocument": { + "methods": ["getDocument"] + },"CreateDocument": { + "methods": ["createDocument"] + },"DeleteDocument": { + "methods": ["deleteDocument"] + },"UpdateDocument": { + "methods": ["updateDocument"] + },"ReloadDocument": { + "methods": ["reloadDocument"] + },"ListDocuments": { + "methods": [ + "listDocuments", + "listDocumentsStream", + "listDocumentsAsync" + ] + }} + } + } + },"EntityTypes": {"clients": { + "grpc": { + "libraryClient": "EntityTypesClient", + "rpcs": {"GetEntityType": { + "methods": ["getEntityType"] + },"CreateEntityType": { + "methods": ["createEntityType"] + },"UpdateEntityType": { + "methods": ["updateEntityType"] + },"DeleteEntityType": { + "methods": ["deleteEntityType"] + },"BatchUpdateEntityTypes": { + "methods": ["batchUpdateEntityTypes"] + },"BatchDeleteEntityTypes": { + "methods": ["batchDeleteEntityTypes"] + },"BatchCreateEntities": { + "methods": ["batchCreateEntities"] + },"BatchUpdateEntities": { + "methods": ["batchUpdateEntities"] + },"BatchDeleteEntities": { + "methods": ["batchDeleteEntities"] + },"ListEntityTypes": { + "methods": [ + "listEntityTypes", + "listEntityTypesStream", + "listEntityTypesAsync" + ] + }} + }, + "grpc-fallback": { + "libraryClient": "EntityTypesClient", + "rpcs": {"GetEntityType": { + "methods": ["getEntityType"] + },"CreateEntityType": { + "methods": ["createEntityType"] + },"UpdateEntityType": { + "methods": ["updateEntityType"] + },"DeleteEntityType": { + "methods": ["deleteEntityType"] + },"BatchUpdateEntityTypes": { + "methods": ["batchUpdateEntityTypes"] + },"BatchDeleteEntityTypes": { + "methods": ["batchDeleteEntityTypes"] + },"BatchCreateEntities": { + "methods": ["batchCreateEntities"] + },"BatchUpdateEntities": { + "methods": ["batchUpdateEntities"] + },"BatchDeleteEntities": { + "methods": ["batchDeleteEntities"] + },"ListEntityTypes": { + "methods": [ + "listEntityTypes", + "listEntityTypesStream", + "listEntityTypesAsync" + ] + }} + } + } + },"Environments": {"clients": { + "grpc": { + "libraryClient": "EnvironmentsClient", + "rpcs": {"ListEnvironments": { + "methods": [ + "listEnvironments", + "listEnvironmentsStream", + "listEnvironmentsAsync" + ] + }} + }, + "grpc-fallback": { + "libraryClient": "EnvironmentsClient", + "rpcs": {,"ListEnvironments": { + "methods": [ + "listEnvironments", + "listEnvironmentsStream", + "listEnvironmentsAsync" + ] + }} + } + } + },"Intents": {"clients": { + "grpc": { + "libraryClient": "IntentsClient", + "rpcs": {"GetIntent": { + "methods": ["getIntent"] + },"CreateIntent": { + "methods": ["createIntent"] + },"UpdateIntent": { + "methods": ["updateIntent"] + },"DeleteIntent": { + "methods": ["deleteIntent"] + },"BatchUpdateIntents": { + "methods": ["batchUpdateIntents"] + },"BatchDeleteIntents": { + "methods": ["batchDeleteIntents"] + },"ListIntents": { + "methods": [ + "listIntents", + "listIntentsStream", + "listIntentsAsync" + ] + }} + }, + "grpc-fallback": { + "libraryClient": "IntentsClient", + "rpcs": {"GetIntent": { + "methods": ["getIntent"] + },"CreateIntent": { + "methods": ["createIntent"] + },"UpdateIntent": { + "methods": ["updateIntent"] + },"DeleteIntent": { + "methods": ["deleteIntent"] + },"BatchUpdateIntents": { + "methods": ["batchUpdateIntents"] + },"BatchDeleteIntents": { + "methods": ["batchDeleteIntents"] + },"ListIntents": { + "methods": [ + "listIntents", + "listIntentsStream", + "listIntentsAsync" + ] + }} + } + } + },"KnowledgeBases": {"clients": { + "grpc": { + "libraryClient": "KnowledgeBasesClient", + "rpcs": {"GetKnowledgeBase": { + "methods": ["getKnowledgeBase"] + },"CreateKnowledgeBase": { + "methods": ["createKnowledgeBase"] + },"DeleteKnowledgeBase": { + "methods": ["deleteKnowledgeBase"] + },"UpdateKnowledgeBase": { + "methods": ["updateKnowledgeBase"] + },"ListKnowledgeBases": { + "methods": [ + "listKnowledgeBases", + "listKnowledgeBasesStream", + "listKnowledgeBasesAsync" + ] + }} + }, + "grpc-fallback": { + "libraryClient": "KnowledgeBasesClient", + "rpcs": {"GetKnowledgeBase": { + "methods": ["getKnowledgeBase"] + },"CreateKnowledgeBase": { + "methods": ["createKnowledgeBase"] + },"DeleteKnowledgeBase": { + "methods": ["deleteKnowledgeBase"] + },"UpdateKnowledgeBase": { + "methods": ["updateKnowledgeBase"] + },"ListKnowledgeBases": { + "methods": [ + "listKnowledgeBases", + "listKnowledgeBasesStream", + "listKnowledgeBasesAsync" + ] + }} + } + } + },"SessionEntityTypes": {"clients": { + "grpc": { + "libraryClient": "SessionEntityTypesClient", + "rpcs": {"GetSessionEntityType": { + "methods": ["getSessionEntityType"] + },"CreateSessionEntityType": { + "methods": ["createSessionEntityType"] + },"UpdateSessionEntityType": { + "methods": ["updateSessionEntityType"] + },"DeleteSessionEntityType": { + "methods": ["deleteSessionEntityType"] + },"ListSessionEntityTypes": { + "methods": [ + "listSessionEntityTypes", + "listSessionEntityTypesStream", + "listSessionEntityTypesAsync" + ] + }} + }, + "grpc-fallback": { + "libraryClient": "SessionEntityTypesClient", + "rpcs": {"GetSessionEntityType": { + "methods": ["getSessionEntityType"] + },"CreateSessionEntityType": { + "methods": ["createSessionEntityType"] + },"UpdateSessionEntityType": { + "methods": ["updateSessionEntityType"] + },"DeleteSessionEntityType": { + "methods": ["deleteSessionEntityType"] + },"ListSessionEntityTypes": { + "methods": [ + "listSessionEntityTypes", + "listSessionEntityTypesStream", + "listSessionEntityTypesAsync" + ] + }} + } + } + },"Sessions": {"clients": { + "grpc": { + "libraryClient": "SessionsClient", + "rpcs": {"DetectIntent": { + "methods": ["detectIntent"] + },"StreamingDetectIntent": { + "methods": ["streamingDetectIntent"] + }} + }, + "grpc-fallback": { + "libraryClient": "SessionsClient", + "rpcs": {"DetectIntent": { + "methods": ["detectIntent"] + }} + } + } + }} +} diff --git a/packages/google-cloud-dialogflow/src/v2beta1/intents_client.ts b/packages/google-cloud-dialogflow/src/v2beta1/intents_client.ts index eeb47d351c9..6d249aa1233 100644 --- a/packages/google-cloud-dialogflow/src/v2beta1/intents_client.ts +++ b/packages/google-cloud-dialogflow/src/v2beta1/intents_client.ts @@ -168,12 +168,6 @@ export class IntentsClient { // identifiers to uniquely identify resources within the API. // Create useful helper objects for these. this.pathTemplates = { - documentPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/knowledgeBases/{knowledge_base}/documents/{document}' - ), - knowledgeBasePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/knowledgeBases/{knowledge_base}' - ), projectPathTemplate: new this._gaxModule.PathTemplate( 'projects/{project}' ), @@ -201,6 +195,12 @@ export class IntentsClient { projectAgentSessionEntityTypePathTemplate: new this._gaxModule.PathTemplate( 'projects/{project}/agent/sessions/{session}/entityTypes/{entity_type}' ), + projectKnowledgeBasePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/knowledgeBases/{knowledge_base}' + ), + projectKnowledgeBaseDocumentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/knowledgeBases/{knowledge_base}/documents/{document}' + ), projectLocationAgentPathTemplate: new this._gaxModule.PathTemplate( 'projects/{project}/locations/{location}/agent' ), @@ -219,6 +219,12 @@ export class IntentsClient { projectLocationAgentSessionEntityTypePathTemplate: new this._gaxModule.PathTemplate( 'projects/{project}/locations/{location}/agent/sessions/{session}/entityTypes/{entity_type}' ), + projectLocationKnowledgeBasePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/knowledgeBases/{knowledge_base}' + ), + projectLocationKnowledgeBaseDocumentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/knowledgeBases/{knowledge_base}/documents/{document}' + ), }; // Some of the methods on this service return "paged" results, @@ -1365,94 +1371,6 @@ export class IntentsClient { // -- Path templates -- // -------------------- - /** - * Return a fully-qualified document resource name string. - * - * @param {string} project - * @param {string} knowledge_base - * @param {string} document - * @returns {string} Resource name string. - */ - documentPath(project: string, knowledgeBase: string, document: string) { - return this.pathTemplates.documentPathTemplate.render({ - project: project, - knowledge_base: knowledgeBase, - document: document, - }); - } - - /** - * Parse the project from Document resource. - * - * @param {string} documentName - * A fully-qualified path representing Document resource. - * @returns {string} A string representing the project. - */ - matchProjectFromDocumentName(documentName: string) { - return this.pathTemplates.documentPathTemplate.match(documentName).project; - } - - /** - * Parse the knowledge_base from Document resource. - * - * @param {string} documentName - * A fully-qualified path representing Document resource. - * @returns {string} A string representing the knowledge_base. - */ - matchKnowledgeBaseFromDocumentName(documentName: string) { - return this.pathTemplates.documentPathTemplate.match(documentName) - .knowledge_base; - } - - /** - * Parse the document from Document resource. - * - * @param {string} documentName - * A fully-qualified path representing Document resource. - * @returns {string} A string representing the document. - */ - matchDocumentFromDocumentName(documentName: string) { - return this.pathTemplates.documentPathTemplate.match(documentName).document; - } - - /** - * Return a fully-qualified knowledgeBase resource name string. - * - * @param {string} project - * @param {string} knowledge_base - * @returns {string} Resource name string. - */ - knowledgeBasePath(project: string, knowledgeBase: string) { - return this.pathTemplates.knowledgeBasePathTemplate.render({ - project: project, - knowledge_base: knowledgeBase, - }); - } - - /** - * Parse the project from KnowledgeBase resource. - * - * @param {string} knowledgeBaseName - * A fully-qualified path representing KnowledgeBase resource. - * @returns {string} A string representing the project. - */ - matchProjectFromKnowledgeBaseName(knowledgeBaseName: string) { - return this.pathTemplates.knowledgeBasePathTemplate.match(knowledgeBaseName) - .project; - } - - /** - * Parse the knowledge_base from KnowledgeBase resource. - * - * @param {string} knowledgeBaseName - * A fully-qualified path representing KnowledgeBase resource. - * @returns {string} A string representing the knowledge_base. - */ - matchKnowledgeBaseFromKnowledgeBaseName(knowledgeBaseName: string) { - return this.pathTemplates.knowledgeBasePathTemplate.match(knowledgeBaseName) - .knowledge_base; - } - /** * Return a fully-qualified project resource name string. * @@ -1964,6 +1882,113 @@ export class IntentsClient { ).entity_type; } + /** + * Return a fully-qualified projectKnowledgeBase resource name string. + * + * @param {string} project + * @param {string} knowledge_base + * @returns {string} Resource name string. + */ + projectKnowledgeBasePath(project: string, knowledgeBase: string) { + return this.pathTemplates.projectKnowledgeBasePathTemplate.render({ + project: project, + knowledge_base: knowledgeBase, + }); + } + + /** + * Parse the project from ProjectKnowledgeBase resource. + * + * @param {string} projectKnowledgeBaseName + * A fully-qualified path representing project_knowledge_base resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectKnowledgeBaseName(projectKnowledgeBaseName: string) { + return this.pathTemplates.projectKnowledgeBasePathTemplate.match( + projectKnowledgeBaseName + ).project; + } + + /** + * Parse the knowledge_base from ProjectKnowledgeBase resource. + * + * @param {string} projectKnowledgeBaseName + * A fully-qualified path representing project_knowledge_base resource. + * @returns {string} A string representing the knowledge_base. + */ + matchKnowledgeBaseFromProjectKnowledgeBaseName( + projectKnowledgeBaseName: string + ) { + return this.pathTemplates.projectKnowledgeBasePathTemplate.match( + projectKnowledgeBaseName + ).knowledge_base; + } + + /** + * Return a fully-qualified projectKnowledgeBaseDocument resource name string. + * + * @param {string} project + * @param {string} knowledge_base + * @param {string} document + * @returns {string} Resource name string. + */ + projectKnowledgeBaseDocumentPath( + project: string, + knowledgeBase: string, + document: string + ) { + return this.pathTemplates.projectKnowledgeBaseDocumentPathTemplate.render({ + project: project, + knowledge_base: knowledgeBase, + document: document, + }); + } + + /** + * Parse the project from ProjectKnowledgeBaseDocument resource. + * + * @param {string} projectKnowledgeBaseDocumentName + * A fully-qualified path representing project_knowledge_base_document resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectKnowledgeBaseDocumentName( + projectKnowledgeBaseDocumentName: string + ) { + return this.pathTemplates.projectKnowledgeBaseDocumentPathTemplate.match( + projectKnowledgeBaseDocumentName + ).project; + } + + /** + * Parse the knowledge_base from ProjectKnowledgeBaseDocument resource. + * + * @param {string} projectKnowledgeBaseDocumentName + * A fully-qualified path representing project_knowledge_base_document resource. + * @returns {string} A string representing the knowledge_base. + */ + matchKnowledgeBaseFromProjectKnowledgeBaseDocumentName( + projectKnowledgeBaseDocumentName: string + ) { + return this.pathTemplates.projectKnowledgeBaseDocumentPathTemplate.match( + projectKnowledgeBaseDocumentName + ).knowledge_base; + } + + /** + * Parse the document from ProjectKnowledgeBaseDocument resource. + * + * @param {string} projectKnowledgeBaseDocumentName + * A fully-qualified path representing project_knowledge_base_document resource. + * @returns {string} A string representing the document. + */ + matchDocumentFromProjectKnowledgeBaseDocumentName( + projectKnowledgeBaseDocumentName: string + ) { + return this.pathTemplates.projectKnowledgeBaseDocumentPathTemplate.match( + projectKnowledgeBaseDocumentName + ).document; + } + /** * Return a fully-qualified projectLocationAgent resource name string. * @@ -2373,6 +2398,156 @@ export class IntentsClient { ).entity_type; } + /** + * Return a fully-qualified projectLocationKnowledgeBase resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} knowledge_base + * @returns {string} Resource name string. + */ + projectLocationKnowledgeBasePath( + project: string, + location: string, + knowledgeBase: string + ) { + return this.pathTemplates.projectLocationKnowledgeBasePathTemplate.render({ + project: project, + location: location, + knowledge_base: knowledgeBase, + }); + } + + /** + * Parse the project from ProjectLocationKnowledgeBase resource. + * + * @param {string} projectLocationKnowledgeBaseName + * A fully-qualified path representing project_location_knowledge_base resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationKnowledgeBaseName( + projectLocationKnowledgeBaseName: string + ) { + return this.pathTemplates.projectLocationKnowledgeBasePathTemplate.match( + projectLocationKnowledgeBaseName + ).project; + } + + /** + * Parse the location from ProjectLocationKnowledgeBase resource. + * + * @param {string} projectLocationKnowledgeBaseName + * A fully-qualified path representing project_location_knowledge_base resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationKnowledgeBaseName( + projectLocationKnowledgeBaseName: string + ) { + return this.pathTemplates.projectLocationKnowledgeBasePathTemplate.match( + projectLocationKnowledgeBaseName + ).location; + } + + /** + * Parse the knowledge_base from ProjectLocationKnowledgeBase resource. + * + * @param {string} projectLocationKnowledgeBaseName + * A fully-qualified path representing project_location_knowledge_base resource. + * @returns {string} A string representing the knowledge_base. + */ + matchKnowledgeBaseFromProjectLocationKnowledgeBaseName( + projectLocationKnowledgeBaseName: string + ) { + return this.pathTemplates.projectLocationKnowledgeBasePathTemplate.match( + projectLocationKnowledgeBaseName + ).knowledge_base; + } + + /** + * Return a fully-qualified projectLocationKnowledgeBaseDocument resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} knowledge_base + * @param {string} document + * @returns {string} Resource name string. + */ + projectLocationKnowledgeBaseDocumentPath( + project: string, + location: string, + knowledgeBase: string, + document: string + ) { + return this.pathTemplates.projectLocationKnowledgeBaseDocumentPathTemplate.render( + { + project: project, + location: location, + knowledge_base: knowledgeBase, + document: document, + } + ); + } + + /** + * Parse the project from ProjectLocationKnowledgeBaseDocument resource. + * + * @param {string} projectLocationKnowledgeBaseDocumentName + * A fully-qualified path representing project_location_knowledge_base_document resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationKnowledgeBaseDocumentName( + projectLocationKnowledgeBaseDocumentName: string + ) { + return this.pathTemplates.projectLocationKnowledgeBaseDocumentPathTemplate.match( + projectLocationKnowledgeBaseDocumentName + ).project; + } + + /** + * Parse the location from ProjectLocationKnowledgeBaseDocument resource. + * + * @param {string} projectLocationKnowledgeBaseDocumentName + * A fully-qualified path representing project_location_knowledge_base_document resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationKnowledgeBaseDocumentName( + projectLocationKnowledgeBaseDocumentName: string + ) { + return this.pathTemplates.projectLocationKnowledgeBaseDocumentPathTemplate.match( + projectLocationKnowledgeBaseDocumentName + ).location; + } + + /** + * Parse the knowledge_base from ProjectLocationKnowledgeBaseDocument resource. + * + * @param {string} projectLocationKnowledgeBaseDocumentName + * A fully-qualified path representing project_location_knowledge_base_document resource. + * @returns {string} A string representing the knowledge_base. + */ + matchKnowledgeBaseFromProjectLocationKnowledgeBaseDocumentName( + projectLocationKnowledgeBaseDocumentName: string + ) { + return this.pathTemplates.projectLocationKnowledgeBaseDocumentPathTemplate.match( + projectLocationKnowledgeBaseDocumentName + ).knowledge_base; + } + + /** + * Parse the document from ProjectLocationKnowledgeBaseDocument resource. + * + * @param {string} projectLocationKnowledgeBaseDocumentName + * A fully-qualified path representing project_location_knowledge_base_document resource. + * @returns {string} A string representing the document. + */ + matchDocumentFromProjectLocationKnowledgeBaseDocumentName( + projectLocationKnowledgeBaseDocumentName: string + ) { + return this.pathTemplates.projectLocationKnowledgeBaseDocumentPathTemplate.match( + projectLocationKnowledgeBaseDocumentName + ).document; + } + /** * Terminate the gRPC channel and close the client. * diff --git a/packages/google-cloud-dialogflow/src/v2beta1/knowledge_bases_client.ts b/packages/google-cloud-dialogflow/src/v2beta1/knowledge_bases_client.ts index 010139821ba..178de349ffe 100644 --- a/packages/google-cloud-dialogflow/src/v2beta1/knowledge_bases_client.ts +++ b/packages/google-cloud-dialogflow/src/v2beta1/knowledge_bases_client.ts @@ -166,12 +166,6 @@ export class KnowledgeBasesClient { // identifiers to uniquely identify resources within the API. // Create useful helper objects for these. this.pathTemplates = { - documentPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/knowledgeBases/{knowledge_base}/documents/{document}' - ), - knowledgeBasePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/knowledgeBases/{knowledge_base}' - ), projectPathTemplate: new this._gaxModule.PathTemplate( 'projects/{project}' ), @@ -199,6 +193,12 @@ export class KnowledgeBasesClient { projectAgentSessionEntityTypePathTemplate: new this._gaxModule.PathTemplate( 'projects/{project}/agent/sessions/{session}/entityTypes/{entity_type}' ), + projectKnowledgeBasePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/knowledgeBases/{knowledge_base}' + ), + projectKnowledgeBaseDocumentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/knowledgeBases/{knowledge_base}/documents/{document}' + ), projectLocationAgentPathTemplate: new this._gaxModule.PathTemplate( 'projects/{project}/locations/{location}/agent' ), @@ -217,6 +217,12 @@ export class KnowledgeBasesClient { projectLocationAgentSessionEntityTypePathTemplate: new this._gaxModule.PathTemplate( 'projects/{project}/locations/{location}/agent/sessions/{session}/entityTypes/{entity_type}' ), + projectLocationKnowledgeBasePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/knowledgeBases/{knowledge_base}' + ), + projectLocationKnowledgeBaseDocumentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/knowledgeBases/{knowledge_base}/documents/{document}' + ), }; // Some of the methods on this service return "paged" results, @@ -409,7 +415,8 @@ export class KnowledgeBasesClient { * The request object that will be sent. * @param {string} request.name * Required. The name of the knowledge base to retrieve. - * Format `projects//knowledgeBases/`. + * Format `projects//locations//knowledgeBases/`. * @param {object} [options] * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. * @returns {Promise} - The promise which resolves to an array. @@ -511,7 +518,7 @@ export class KnowledgeBasesClient { * The request object that will be sent. * @param {string} request.parent * Required. The project to create a knowledge base for. - * Format: `projects/`. + * Format: `projects//locations/`. * @param {google.cloud.dialogflow.v2beta1.KnowledgeBase} request.knowledgeBase * Required. The knowledge base to create. * @param {object} [options] @@ -615,7 +622,8 @@ export class KnowledgeBasesClient { * The request object that will be sent. * @param {string} request.name * Required. The name of the knowledge base to delete. - * Format: `projects//knowledgeBases/`. + * Format: `projects//locations//knowledgeBases/`. * @param {boolean} [request.force] * Optional. Force deletes the knowledge base. When set to true, any documents * in the knowledge base are also deleted. @@ -823,7 +831,7 @@ export class KnowledgeBasesClient { * The request object that will be sent. * @param {string} request.parent * Required. The project to list of knowledge bases for. - * Format: `projects/`. + * Format: `projects//locations/`. * @param {number} request.pageSize * The maximum number of items to return in a single page. By * default 10 and at most 100. @@ -920,7 +928,7 @@ export class KnowledgeBasesClient { * The request object that will be sent. * @param {string} request.parent * Required. The project to list of knowledge bases for. - * Format: `projects/`. + * Format: `projects//locations/`. * @param {number} request.pageSize * The maximum number of items to return in a single page. By * default 10 and at most 100. @@ -995,7 +1003,7 @@ export class KnowledgeBasesClient { * The request object that will be sent. * @param {string} request.parent * Required. The project to list of knowledge bases for. - * Format: `projects/`. + * Format: `projects//locations/`. * @param {number} request.pageSize * The maximum number of items to return in a single page. By * default 10 and at most 100. @@ -1070,94 +1078,6 @@ export class KnowledgeBasesClient { // -- Path templates -- // -------------------- - /** - * Return a fully-qualified document resource name string. - * - * @param {string} project - * @param {string} knowledge_base - * @param {string} document - * @returns {string} Resource name string. - */ - documentPath(project: string, knowledgeBase: string, document: string) { - return this.pathTemplates.documentPathTemplate.render({ - project: project, - knowledge_base: knowledgeBase, - document: document, - }); - } - - /** - * Parse the project from Document resource. - * - * @param {string} documentName - * A fully-qualified path representing Document resource. - * @returns {string} A string representing the project. - */ - matchProjectFromDocumentName(documentName: string) { - return this.pathTemplates.documentPathTemplate.match(documentName).project; - } - - /** - * Parse the knowledge_base from Document resource. - * - * @param {string} documentName - * A fully-qualified path representing Document resource. - * @returns {string} A string representing the knowledge_base. - */ - matchKnowledgeBaseFromDocumentName(documentName: string) { - return this.pathTemplates.documentPathTemplate.match(documentName) - .knowledge_base; - } - - /** - * Parse the document from Document resource. - * - * @param {string} documentName - * A fully-qualified path representing Document resource. - * @returns {string} A string representing the document. - */ - matchDocumentFromDocumentName(documentName: string) { - return this.pathTemplates.documentPathTemplate.match(documentName).document; - } - - /** - * Return a fully-qualified knowledgeBase resource name string. - * - * @param {string} project - * @param {string} knowledge_base - * @returns {string} Resource name string. - */ - knowledgeBasePath(project: string, knowledgeBase: string) { - return this.pathTemplates.knowledgeBasePathTemplate.render({ - project: project, - knowledge_base: knowledgeBase, - }); - } - - /** - * Parse the project from KnowledgeBase resource. - * - * @param {string} knowledgeBaseName - * A fully-qualified path representing KnowledgeBase resource. - * @returns {string} A string representing the project. - */ - matchProjectFromKnowledgeBaseName(knowledgeBaseName: string) { - return this.pathTemplates.knowledgeBasePathTemplate.match(knowledgeBaseName) - .project; - } - - /** - * Parse the knowledge_base from KnowledgeBase resource. - * - * @param {string} knowledgeBaseName - * A fully-qualified path representing KnowledgeBase resource. - * @returns {string} A string representing the knowledge_base. - */ - matchKnowledgeBaseFromKnowledgeBaseName(knowledgeBaseName: string) { - return this.pathTemplates.knowledgeBasePathTemplate.match(knowledgeBaseName) - .knowledge_base; - } - /** * Return a fully-qualified project resource name string. * @@ -1669,6 +1589,113 @@ export class KnowledgeBasesClient { ).entity_type; } + /** + * Return a fully-qualified projectKnowledgeBase resource name string. + * + * @param {string} project + * @param {string} knowledge_base + * @returns {string} Resource name string. + */ + projectKnowledgeBasePath(project: string, knowledgeBase: string) { + return this.pathTemplates.projectKnowledgeBasePathTemplate.render({ + project: project, + knowledge_base: knowledgeBase, + }); + } + + /** + * Parse the project from ProjectKnowledgeBase resource. + * + * @param {string} projectKnowledgeBaseName + * A fully-qualified path representing project_knowledge_base resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectKnowledgeBaseName(projectKnowledgeBaseName: string) { + return this.pathTemplates.projectKnowledgeBasePathTemplate.match( + projectKnowledgeBaseName + ).project; + } + + /** + * Parse the knowledge_base from ProjectKnowledgeBase resource. + * + * @param {string} projectKnowledgeBaseName + * A fully-qualified path representing project_knowledge_base resource. + * @returns {string} A string representing the knowledge_base. + */ + matchKnowledgeBaseFromProjectKnowledgeBaseName( + projectKnowledgeBaseName: string + ) { + return this.pathTemplates.projectKnowledgeBasePathTemplate.match( + projectKnowledgeBaseName + ).knowledge_base; + } + + /** + * Return a fully-qualified projectKnowledgeBaseDocument resource name string. + * + * @param {string} project + * @param {string} knowledge_base + * @param {string} document + * @returns {string} Resource name string. + */ + projectKnowledgeBaseDocumentPath( + project: string, + knowledgeBase: string, + document: string + ) { + return this.pathTemplates.projectKnowledgeBaseDocumentPathTemplate.render({ + project: project, + knowledge_base: knowledgeBase, + document: document, + }); + } + + /** + * Parse the project from ProjectKnowledgeBaseDocument resource. + * + * @param {string} projectKnowledgeBaseDocumentName + * A fully-qualified path representing project_knowledge_base_document resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectKnowledgeBaseDocumentName( + projectKnowledgeBaseDocumentName: string + ) { + return this.pathTemplates.projectKnowledgeBaseDocumentPathTemplate.match( + projectKnowledgeBaseDocumentName + ).project; + } + + /** + * Parse the knowledge_base from ProjectKnowledgeBaseDocument resource. + * + * @param {string} projectKnowledgeBaseDocumentName + * A fully-qualified path representing project_knowledge_base_document resource. + * @returns {string} A string representing the knowledge_base. + */ + matchKnowledgeBaseFromProjectKnowledgeBaseDocumentName( + projectKnowledgeBaseDocumentName: string + ) { + return this.pathTemplates.projectKnowledgeBaseDocumentPathTemplate.match( + projectKnowledgeBaseDocumentName + ).knowledge_base; + } + + /** + * Parse the document from ProjectKnowledgeBaseDocument resource. + * + * @param {string} projectKnowledgeBaseDocumentName + * A fully-qualified path representing project_knowledge_base_document resource. + * @returns {string} A string representing the document. + */ + matchDocumentFromProjectKnowledgeBaseDocumentName( + projectKnowledgeBaseDocumentName: string + ) { + return this.pathTemplates.projectKnowledgeBaseDocumentPathTemplate.match( + projectKnowledgeBaseDocumentName + ).document; + } + /** * Return a fully-qualified projectLocationAgent resource name string. * @@ -2078,6 +2105,156 @@ export class KnowledgeBasesClient { ).entity_type; } + /** + * Return a fully-qualified projectLocationKnowledgeBase resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} knowledge_base + * @returns {string} Resource name string. + */ + projectLocationKnowledgeBasePath( + project: string, + location: string, + knowledgeBase: string + ) { + return this.pathTemplates.projectLocationKnowledgeBasePathTemplate.render({ + project: project, + location: location, + knowledge_base: knowledgeBase, + }); + } + + /** + * Parse the project from ProjectLocationKnowledgeBase resource. + * + * @param {string} projectLocationKnowledgeBaseName + * A fully-qualified path representing project_location_knowledge_base resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationKnowledgeBaseName( + projectLocationKnowledgeBaseName: string + ) { + return this.pathTemplates.projectLocationKnowledgeBasePathTemplate.match( + projectLocationKnowledgeBaseName + ).project; + } + + /** + * Parse the location from ProjectLocationKnowledgeBase resource. + * + * @param {string} projectLocationKnowledgeBaseName + * A fully-qualified path representing project_location_knowledge_base resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationKnowledgeBaseName( + projectLocationKnowledgeBaseName: string + ) { + return this.pathTemplates.projectLocationKnowledgeBasePathTemplate.match( + projectLocationKnowledgeBaseName + ).location; + } + + /** + * Parse the knowledge_base from ProjectLocationKnowledgeBase resource. + * + * @param {string} projectLocationKnowledgeBaseName + * A fully-qualified path representing project_location_knowledge_base resource. + * @returns {string} A string representing the knowledge_base. + */ + matchKnowledgeBaseFromProjectLocationKnowledgeBaseName( + projectLocationKnowledgeBaseName: string + ) { + return this.pathTemplates.projectLocationKnowledgeBasePathTemplate.match( + projectLocationKnowledgeBaseName + ).knowledge_base; + } + + /** + * Return a fully-qualified projectLocationKnowledgeBaseDocument resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} knowledge_base + * @param {string} document + * @returns {string} Resource name string. + */ + projectLocationKnowledgeBaseDocumentPath( + project: string, + location: string, + knowledgeBase: string, + document: string + ) { + return this.pathTemplates.projectLocationKnowledgeBaseDocumentPathTemplate.render( + { + project: project, + location: location, + knowledge_base: knowledgeBase, + document: document, + } + ); + } + + /** + * Parse the project from ProjectLocationKnowledgeBaseDocument resource. + * + * @param {string} projectLocationKnowledgeBaseDocumentName + * A fully-qualified path representing project_location_knowledge_base_document resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationKnowledgeBaseDocumentName( + projectLocationKnowledgeBaseDocumentName: string + ) { + return this.pathTemplates.projectLocationKnowledgeBaseDocumentPathTemplate.match( + projectLocationKnowledgeBaseDocumentName + ).project; + } + + /** + * Parse the location from ProjectLocationKnowledgeBaseDocument resource. + * + * @param {string} projectLocationKnowledgeBaseDocumentName + * A fully-qualified path representing project_location_knowledge_base_document resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationKnowledgeBaseDocumentName( + projectLocationKnowledgeBaseDocumentName: string + ) { + return this.pathTemplates.projectLocationKnowledgeBaseDocumentPathTemplate.match( + projectLocationKnowledgeBaseDocumentName + ).location; + } + + /** + * Parse the knowledge_base from ProjectLocationKnowledgeBaseDocument resource. + * + * @param {string} projectLocationKnowledgeBaseDocumentName + * A fully-qualified path representing project_location_knowledge_base_document resource. + * @returns {string} A string representing the knowledge_base. + */ + matchKnowledgeBaseFromProjectLocationKnowledgeBaseDocumentName( + projectLocationKnowledgeBaseDocumentName: string + ) { + return this.pathTemplates.projectLocationKnowledgeBaseDocumentPathTemplate.match( + projectLocationKnowledgeBaseDocumentName + ).knowledge_base; + } + + /** + * Parse the document from ProjectLocationKnowledgeBaseDocument resource. + * + * @param {string} projectLocationKnowledgeBaseDocumentName + * A fully-qualified path representing project_location_knowledge_base_document resource. + * @returns {string} A string representing the document. + */ + matchDocumentFromProjectLocationKnowledgeBaseDocumentName( + projectLocationKnowledgeBaseDocumentName: string + ) { + return this.pathTemplates.projectLocationKnowledgeBaseDocumentPathTemplate.match( + projectLocationKnowledgeBaseDocumentName + ).document; + } + /** * Terminate the gRPC channel and close the client. * diff --git a/packages/google-cloud-dialogflow/src/v2beta1/session_entity_types_client.ts b/packages/google-cloud-dialogflow/src/v2beta1/session_entity_types_client.ts index 2b749d5cc18..1256775b53b 100644 --- a/packages/google-cloud-dialogflow/src/v2beta1/session_entity_types_client.ts +++ b/packages/google-cloud-dialogflow/src/v2beta1/session_entity_types_client.ts @@ -166,12 +166,6 @@ export class SessionEntityTypesClient { // identifiers to uniquely identify resources within the API. // Create useful helper objects for these. this.pathTemplates = { - documentPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/knowledgeBases/{knowledge_base}/documents/{document}' - ), - knowledgeBasePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/knowledgeBases/{knowledge_base}' - ), projectPathTemplate: new this._gaxModule.PathTemplate( 'projects/{project}' ), @@ -202,6 +196,12 @@ export class SessionEntityTypesClient { projectAgentSessionEntityTypePathTemplate: new this._gaxModule.PathTemplate( 'projects/{project}/agent/sessions/{session}/entityTypes/{entity_type}' ), + projectKnowledgeBasePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/knowledgeBases/{knowledge_base}' + ), + projectKnowledgeBaseDocumentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/knowledgeBases/{knowledge_base}/documents/{document}' + ), projectLocationAgentPathTemplate: new this._gaxModule.PathTemplate( 'projects/{project}/locations/{location}/agent' ), @@ -220,6 +220,12 @@ export class SessionEntityTypesClient { projectLocationAgentSessionEntityTypePathTemplate: new this._gaxModule.PathTemplate( 'projects/{project}/locations/{location}/agent/sessions/{session}/entityTypes/{entity_type}' ), + projectLocationKnowledgeBasePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/knowledgeBases/{knowledge_base}' + ), + projectLocationKnowledgeBaseDocumentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/knowledgeBases/{knowledge_base}/documents/{document}' + ), }; // Some of the methods on this service return "paged" results, @@ -1085,94 +1091,6 @@ export class SessionEntityTypesClient { // -- Path templates -- // -------------------- - /** - * Return a fully-qualified document resource name string. - * - * @param {string} project - * @param {string} knowledge_base - * @param {string} document - * @returns {string} Resource name string. - */ - documentPath(project: string, knowledgeBase: string, document: string) { - return this.pathTemplates.documentPathTemplate.render({ - project: project, - knowledge_base: knowledgeBase, - document: document, - }); - } - - /** - * Parse the project from Document resource. - * - * @param {string} documentName - * A fully-qualified path representing Document resource. - * @returns {string} A string representing the project. - */ - matchProjectFromDocumentName(documentName: string) { - return this.pathTemplates.documentPathTemplate.match(documentName).project; - } - - /** - * Parse the knowledge_base from Document resource. - * - * @param {string} documentName - * A fully-qualified path representing Document resource. - * @returns {string} A string representing the knowledge_base. - */ - matchKnowledgeBaseFromDocumentName(documentName: string) { - return this.pathTemplates.documentPathTemplate.match(documentName) - .knowledge_base; - } - - /** - * Parse the document from Document resource. - * - * @param {string} documentName - * A fully-qualified path representing Document resource. - * @returns {string} A string representing the document. - */ - matchDocumentFromDocumentName(documentName: string) { - return this.pathTemplates.documentPathTemplate.match(documentName).document; - } - - /** - * Return a fully-qualified knowledgeBase resource name string. - * - * @param {string} project - * @param {string} knowledge_base - * @returns {string} Resource name string. - */ - knowledgeBasePath(project: string, knowledgeBase: string) { - return this.pathTemplates.knowledgeBasePathTemplate.render({ - project: project, - knowledge_base: knowledgeBase, - }); - } - - /** - * Parse the project from KnowledgeBase resource. - * - * @param {string} knowledgeBaseName - * A fully-qualified path representing KnowledgeBase resource. - * @returns {string} A string representing the project. - */ - matchProjectFromKnowledgeBaseName(knowledgeBaseName: string) { - return this.pathTemplates.knowledgeBasePathTemplate.match(knowledgeBaseName) - .project; - } - - /** - * Parse the knowledge_base from KnowledgeBase resource. - * - * @param {string} knowledgeBaseName - * A fully-qualified path representing KnowledgeBase resource. - * @returns {string} A string representing the knowledge_base. - */ - matchKnowledgeBaseFromKnowledgeBaseName(knowledgeBaseName: string) { - return this.pathTemplates.knowledgeBasePathTemplate.match(knowledgeBaseName) - .knowledge_base; - } - /** * Return a fully-qualified project resource name string. * @@ -1724,6 +1642,113 @@ export class SessionEntityTypesClient { ).entity_type; } + /** + * Return a fully-qualified projectKnowledgeBase resource name string. + * + * @param {string} project + * @param {string} knowledge_base + * @returns {string} Resource name string. + */ + projectKnowledgeBasePath(project: string, knowledgeBase: string) { + return this.pathTemplates.projectKnowledgeBasePathTemplate.render({ + project: project, + knowledge_base: knowledgeBase, + }); + } + + /** + * Parse the project from ProjectKnowledgeBase resource. + * + * @param {string} projectKnowledgeBaseName + * A fully-qualified path representing project_knowledge_base resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectKnowledgeBaseName(projectKnowledgeBaseName: string) { + return this.pathTemplates.projectKnowledgeBasePathTemplate.match( + projectKnowledgeBaseName + ).project; + } + + /** + * Parse the knowledge_base from ProjectKnowledgeBase resource. + * + * @param {string} projectKnowledgeBaseName + * A fully-qualified path representing project_knowledge_base resource. + * @returns {string} A string representing the knowledge_base. + */ + matchKnowledgeBaseFromProjectKnowledgeBaseName( + projectKnowledgeBaseName: string + ) { + return this.pathTemplates.projectKnowledgeBasePathTemplate.match( + projectKnowledgeBaseName + ).knowledge_base; + } + + /** + * Return a fully-qualified projectKnowledgeBaseDocument resource name string. + * + * @param {string} project + * @param {string} knowledge_base + * @param {string} document + * @returns {string} Resource name string. + */ + projectKnowledgeBaseDocumentPath( + project: string, + knowledgeBase: string, + document: string + ) { + return this.pathTemplates.projectKnowledgeBaseDocumentPathTemplate.render({ + project: project, + knowledge_base: knowledgeBase, + document: document, + }); + } + + /** + * Parse the project from ProjectKnowledgeBaseDocument resource. + * + * @param {string} projectKnowledgeBaseDocumentName + * A fully-qualified path representing project_knowledge_base_document resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectKnowledgeBaseDocumentName( + projectKnowledgeBaseDocumentName: string + ) { + return this.pathTemplates.projectKnowledgeBaseDocumentPathTemplate.match( + projectKnowledgeBaseDocumentName + ).project; + } + + /** + * Parse the knowledge_base from ProjectKnowledgeBaseDocument resource. + * + * @param {string} projectKnowledgeBaseDocumentName + * A fully-qualified path representing project_knowledge_base_document resource. + * @returns {string} A string representing the knowledge_base. + */ + matchKnowledgeBaseFromProjectKnowledgeBaseDocumentName( + projectKnowledgeBaseDocumentName: string + ) { + return this.pathTemplates.projectKnowledgeBaseDocumentPathTemplate.match( + projectKnowledgeBaseDocumentName + ).knowledge_base; + } + + /** + * Parse the document from ProjectKnowledgeBaseDocument resource. + * + * @param {string} projectKnowledgeBaseDocumentName + * A fully-qualified path representing project_knowledge_base_document resource. + * @returns {string} A string representing the document. + */ + matchDocumentFromProjectKnowledgeBaseDocumentName( + projectKnowledgeBaseDocumentName: string + ) { + return this.pathTemplates.projectKnowledgeBaseDocumentPathTemplate.match( + projectKnowledgeBaseDocumentName + ).document; + } + /** * Return a fully-qualified projectLocationAgent resource name string. * @@ -2133,6 +2158,156 @@ export class SessionEntityTypesClient { ).entity_type; } + /** + * Return a fully-qualified projectLocationKnowledgeBase resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} knowledge_base + * @returns {string} Resource name string. + */ + projectLocationKnowledgeBasePath( + project: string, + location: string, + knowledgeBase: string + ) { + return this.pathTemplates.projectLocationKnowledgeBasePathTemplate.render({ + project: project, + location: location, + knowledge_base: knowledgeBase, + }); + } + + /** + * Parse the project from ProjectLocationKnowledgeBase resource. + * + * @param {string} projectLocationKnowledgeBaseName + * A fully-qualified path representing project_location_knowledge_base resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationKnowledgeBaseName( + projectLocationKnowledgeBaseName: string + ) { + return this.pathTemplates.projectLocationKnowledgeBasePathTemplate.match( + projectLocationKnowledgeBaseName + ).project; + } + + /** + * Parse the location from ProjectLocationKnowledgeBase resource. + * + * @param {string} projectLocationKnowledgeBaseName + * A fully-qualified path representing project_location_knowledge_base resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationKnowledgeBaseName( + projectLocationKnowledgeBaseName: string + ) { + return this.pathTemplates.projectLocationKnowledgeBasePathTemplate.match( + projectLocationKnowledgeBaseName + ).location; + } + + /** + * Parse the knowledge_base from ProjectLocationKnowledgeBase resource. + * + * @param {string} projectLocationKnowledgeBaseName + * A fully-qualified path representing project_location_knowledge_base resource. + * @returns {string} A string representing the knowledge_base. + */ + matchKnowledgeBaseFromProjectLocationKnowledgeBaseName( + projectLocationKnowledgeBaseName: string + ) { + return this.pathTemplates.projectLocationKnowledgeBasePathTemplate.match( + projectLocationKnowledgeBaseName + ).knowledge_base; + } + + /** + * Return a fully-qualified projectLocationKnowledgeBaseDocument resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} knowledge_base + * @param {string} document + * @returns {string} Resource name string. + */ + projectLocationKnowledgeBaseDocumentPath( + project: string, + location: string, + knowledgeBase: string, + document: string + ) { + return this.pathTemplates.projectLocationKnowledgeBaseDocumentPathTemplate.render( + { + project: project, + location: location, + knowledge_base: knowledgeBase, + document: document, + } + ); + } + + /** + * Parse the project from ProjectLocationKnowledgeBaseDocument resource. + * + * @param {string} projectLocationKnowledgeBaseDocumentName + * A fully-qualified path representing project_location_knowledge_base_document resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationKnowledgeBaseDocumentName( + projectLocationKnowledgeBaseDocumentName: string + ) { + return this.pathTemplates.projectLocationKnowledgeBaseDocumentPathTemplate.match( + projectLocationKnowledgeBaseDocumentName + ).project; + } + + /** + * Parse the location from ProjectLocationKnowledgeBaseDocument resource. + * + * @param {string} projectLocationKnowledgeBaseDocumentName + * A fully-qualified path representing project_location_knowledge_base_document resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationKnowledgeBaseDocumentName( + projectLocationKnowledgeBaseDocumentName: string + ) { + return this.pathTemplates.projectLocationKnowledgeBaseDocumentPathTemplate.match( + projectLocationKnowledgeBaseDocumentName + ).location; + } + + /** + * Parse the knowledge_base from ProjectLocationKnowledgeBaseDocument resource. + * + * @param {string} projectLocationKnowledgeBaseDocumentName + * A fully-qualified path representing project_location_knowledge_base_document resource. + * @returns {string} A string representing the knowledge_base. + */ + matchKnowledgeBaseFromProjectLocationKnowledgeBaseDocumentName( + projectLocationKnowledgeBaseDocumentName: string + ) { + return this.pathTemplates.projectLocationKnowledgeBaseDocumentPathTemplate.match( + projectLocationKnowledgeBaseDocumentName + ).knowledge_base; + } + + /** + * Parse the document from ProjectLocationKnowledgeBaseDocument resource. + * + * @param {string} projectLocationKnowledgeBaseDocumentName + * A fully-qualified path representing project_location_knowledge_base_document resource. + * @returns {string} A string representing the document. + */ + matchDocumentFromProjectLocationKnowledgeBaseDocumentName( + projectLocationKnowledgeBaseDocumentName: string + ) { + return this.pathTemplates.projectLocationKnowledgeBaseDocumentPathTemplate.match( + projectLocationKnowledgeBaseDocumentName + ).document; + } + /** * Terminate the gRPC channel and close the client. * diff --git a/packages/google-cloud-dialogflow/src/v2beta1/sessions_client.ts b/packages/google-cloud-dialogflow/src/v2beta1/sessions_client.ts index 52bd8a2f399..6f57cffe9cf 100644 --- a/packages/google-cloud-dialogflow/src/v2beta1/sessions_client.ts +++ b/packages/google-cloud-dialogflow/src/v2beta1/sessions_client.ts @@ -160,12 +160,6 @@ export class SessionsClient { // identifiers to uniquely identify resources within the API. // Create useful helper objects for these. this.pathTemplates = { - documentPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/knowledgeBases/{knowledge_base}/documents/{document}' - ), - knowledgeBasePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/knowledgeBases/{knowledge_base}' - ), projectAgentPathTemplate: new this._gaxModule.PathTemplate( 'projects/{project}/agent' ), @@ -196,6 +190,12 @@ export class SessionsClient { projectAgentSessionEntityTypePathTemplate: new this._gaxModule.PathTemplate( 'projects/{project}/agent/sessions/{session}/entityTypes/{entity_type}' ), + projectKnowledgeBasePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/knowledgeBases/{knowledge_base}' + ), + projectKnowledgeBaseDocumentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/knowledgeBases/{knowledge_base}/documents/{document}' + ), projectLocationAgentPathTemplate: new this._gaxModule.PathTemplate( 'projects/{project}/locations/{location}/agent' ), @@ -217,6 +217,12 @@ export class SessionsClient { projectLocationAgentSessionEntityTypePathTemplate: new this._gaxModule.PathTemplate( 'projects/{project}/locations/{location}/agent/sessions/{session}/entityTypes/{entity_type}' ), + projectLocationKnowledgeBasePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/knowledgeBases/{knowledge_base}' + ), + projectLocationKnowledgeBaseDocumentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/knowledgeBases/{knowledge_base}/documents/{document}' + ), }; // Some of the methods on this service provide streaming responses. @@ -393,6 +399,10 @@ export class SessionsClient { * and session entity types to be updated, which in turn might affect * results of future queries. * + * Note: Always use agent versions for production traffic. + * See [Versions and + * environments](https://cloud.google.com/dialogflow/es/docs/agents-versions). + * * @param {Object} request * The request object that will be sent. * @param {string} request.session @@ -414,6 +424,10 @@ export class SessionsClient { * The length of the `Session ID` and `User ID` must not exceed 36 characters. * For more information, see the [API interactions * guide](https://cloud.google.com/dialogflow/docs/api-overview). + * + * Note: Always use agent versions for production traffic. + * See [Versions and + * environments](https://cloud.google.com/dialogflow/es/docs/agents-versions). * @param {google.cloud.dialogflow.v2beta1.QueryParameters} request.queryParams * The parameters of this query. * @param {google.cloud.dialogflow.v2beta1.QueryInput} request.queryInput @@ -500,6 +514,10 @@ export class SessionsClient { * and returns structured, actionable data as a result. This method is only * available via the gRPC API (not REST). * + * Note: Always use agent versions for production traffic. + * See [Versions and + * environments](https://cloud.google.com/dialogflow/es/docs/agents-versions). + * * @param {object} [options] * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. * @returns {Stream} @@ -525,94 +543,6 @@ export class SessionsClient { // -- Path templates -- // -------------------- - /** - * Return a fully-qualified document resource name string. - * - * @param {string} project - * @param {string} knowledge_base - * @param {string} document - * @returns {string} Resource name string. - */ - documentPath(project: string, knowledgeBase: string, document: string) { - return this.pathTemplates.documentPathTemplate.render({ - project: project, - knowledge_base: knowledgeBase, - document: document, - }); - } - - /** - * Parse the project from Document resource. - * - * @param {string} documentName - * A fully-qualified path representing Document resource. - * @returns {string} A string representing the project. - */ - matchProjectFromDocumentName(documentName: string) { - return this.pathTemplates.documentPathTemplate.match(documentName).project; - } - - /** - * Parse the knowledge_base from Document resource. - * - * @param {string} documentName - * A fully-qualified path representing Document resource. - * @returns {string} A string representing the knowledge_base. - */ - matchKnowledgeBaseFromDocumentName(documentName: string) { - return this.pathTemplates.documentPathTemplate.match(documentName) - .knowledge_base; - } - - /** - * Parse the document from Document resource. - * - * @param {string} documentName - * A fully-qualified path representing Document resource. - * @returns {string} A string representing the document. - */ - matchDocumentFromDocumentName(documentName: string) { - return this.pathTemplates.documentPathTemplate.match(documentName).document; - } - - /** - * Return a fully-qualified knowledgeBase resource name string. - * - * @param {string} project - * @param {string} knowledge_base - * @returns {string} Resource name string. - */ - knowledgeBasePath(project: string, knowledgeBase: string) { - return this.pathTemplates.knowledgeBasePathTemplate.render({ - project: project, - knowledge_base: knowledgeBase, - }); - } - - /** - * Parse the project from KnowledgeBase resource. - * - * @param {string} knowledgeBaseName - * A fully-qualified path representing KnowledgeBase resource. - * @returns {string} A string representing the project. - */ - matchProjectFromKnowledgeBaseName(knowledgeBaseName: string) { - return this.pathTemplates.knowledgeBasePathTemplate.match(knowledgeBaseName) - .project; - } - - /** - * Parse the knowledge_base from KnowledgeBase resource. - * - * @param {string} knowledgeBaseName - * A fully-qualified path representing KnowledgeBase resource. - * @returns {string} A string representing the knowledge_base. - */ - matchKnowledgeBaseFromKnowledgeBaseName(knowledgeBaseName: string) { - return this.pathTemplates.knowledgeBasePathTemplate.match(knowledgeBaseName) - .knowledge_base; - } - /** * Return a fully-qualified projectAgent resource name string. * @@ -1226,6 +1156,113 @@ export class SessionsClient { ).entity_type; } + /** + * Return a fully-qualified projectKnowledgeBase resource name string. + * + * @param {string} project + * @param {string} knowledge_base + * @returns {string} Resource name string. + */ + projectKnowledgeBasePath(project: string, knowledgeBase: string) { + return this.pathTemplates.projectKnowledgeBasePathTemplate.render({ + project: project, + knowledge_base: knowledgeBase, + }); + } + + /** + * Parse the project from ProjectKnowledgeBase resource. + * + * @param {string} projectKnowledgeBaseName + * A fully-qualified path representing project_knowledge_base resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectKnowledgeBaseName(projectKnowledgeBaseName: string) { + return this.pathTemplates.projectKnowledgeBasePathTemplate.match( + projectKnowledgeBaseName + ).project; + } + + /** + * Parse the knowledge_base from ProjectKnowledgeBase resource. + * + * @param {string} projectKnowledgeBaseName + * A fully-qualified path representing project_knowledge_base resource. + * @returns {string} A string representing the knowledge_base. + */ + matchKnowledgeBaseFromProjectKnowledgeBaseName( + projectKnowledgeBaseName: string + ) { + return this.pathTemplates.projectKnowledgeBasePathTemplate.match( + projectKnowledgeBaseName + ).knowledge_base; + } + + /** + * Return a fully-qualified projectKnowledgeBaseDocument resource name string. + * + * @param {string} project + * @param {string} knowledge_base + * @param {string} document + * @returns {string} Resource name string. + */ + projectKnowledgeBaseDocumentPath( + project: string, + knowledgeBase: string, + document: string + ) { + return this.pathTemplates.projectKnowledgeBaseDocumentPathTemplate.render({ + project: project, + knowledge_base: knowledgeBase, + document: document, + }); + } + + /** + * Parse the project from ProjectKnowledgeBaseDocument resource. + * + * @param {string} projectKnowledgeBaseDocumentName + * A fully-qualified path representing project_knowledge_base_document resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectKnowledgeBaseDocumentName( + projectKnowledgeBaseDocumentName: string + ) { + return this.pathTemplates.projectKnowledgeBaseDocumentPathTemplate.match( + projectKnowledgeBaseDocumentName + ).project; + } + + /** + * Parse the knowledge_base from ProjectKnowledgeBaseDocument resource. + * + * @param {string} projectKnowledgeBaseDocumentName + * A fully-qualified path representing project_knowledge_base_document resource. + * @returns {string} A string representing the knowledge_base. + */ + matchKnowledgeBaseFromProjectKnowledgeBaseDocumentName( + projectKnowledgeBaseDocumentName: string + ) { + return this.pathTemplates.projectKnowledgeBaseDocumentPathTemplate.match( + projectKnowledgeBaseDocumentName + ).knowledge_base; + } + + /** + * Parse the document from ProjectKnowledgeBaseDocument resource. + * + * @param {string} projectKnowledgeBaseDocumentName + * A fully-qualified path representing project_knowledge_base_document resource. + * @returns {string} A string representing the document. + */ + matchDocumentFromProjectKnowledgeBaseDocumentName( + projectKnowledgeBaseDocumentName: string + ) { + return this.pathTemplates.projectKnowledgeBaseDocumentPathTemplate.match( + projectKnowledgeBaseDocumentName + ).document; + } + /** * Return a fully-qualified projectLocationAgent resource name string. * @@ -1700,6 +1737,156 @@ export class SessionsClient { ).entity_type; } + /** + * Return a fully-qualified projectLocationKnowledgeBase resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} knowledge_base + * @returns {string} Resource name string. + */ + projectLocationKnowledgeBasePath( + project: string, + location: string, + knowledgeBase: string + ) { + return this.pathTemplates.projectLocationKnowledgeBasePathTemplate.render({ + project: project, + location: location, + knowledge_base: knowledgeBase, + }); + } + + /** + * Parse the project from ProjectLocationKnowledgeBase resource. + * + * @param {string} projectLocationKnowledgeBaseName + * A fully-qualified path representing project_location_knowledge_base resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationKnowledgeBaseName( + projectLocationKnowledgeBaseName: string + ) { + return this.pathTemplates.projectLocationKnowledgeBasePathTemplate.match( + projectLocationKnowledgeBaseName + ).project; + } + + /** + * Parse the location from ProjectLocationKnowledgeBase resource. + * + * @param {string} projectLocationKnowledgeBaseName + * A fully-qualified path representing project_location_knowledge_base resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationKnowledgeBaseName( + projectLocationKnowledgeBaseName: string + ) { + return this.pathTemplates.projectLocationKnowledgeBasePathTemplate.match( + projectLocationKnowledgeBaseName + ).location; + } + + /** + * Parse the knowledge_base from ProjectLocationKnowledgeBase resource. + * + * @param {string} projectLocationKnowledgeBaseName + * A fully-qualified path representing project_location_knowledge_base resource. + * @returns {string} A string representing the knowledge_base. + */ + matchKnowledgeBaseFromProjectLocationKnowledgeBaseName( + projectLocationKnowledgeBaseName: string + ) { + return this.pathTemplates.projectLocationKnowledgeBasePathTemplate.match( + projectLocationKnowledgeBaseName + ).knowledge_base; + } + + /** + * Return a fully-qualified projectLocationKnowledgeBaseDocument resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} knowledge_base + * @param {string} document + * @returns {string} Resource name string. + */ + projectLocationKnowledgeBaseDocumentPath( + project: string, + location: string, + knowledgeBase: string, + document: string + ) { + return this.pathTemplates.projectLocationKnowledgeBaseDocumentPathTemplate.render( + { + project: project, + location: location, + knowledge_base: knowledgeBase, + document: document, + } + ); + } + + /** + * Parse the project from ProjectLocationKnowledgeBaseDocument resource. + * + * @param {string} projectLocationKnowledgeBaseDocumentName + * A fully-qualified path representing project_location_knowledge_base_document resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationKnowledgeBaseDocumentName( + projectLocationKnowledgeBaseDocumentName: string + ) { + return this.pathTemplates.projectLocationKnowledgeBaseDocumentPathTemplate.match( + projectLocationKnowledgeBaseDocumentName + ).project; + } + + /** + * Parse the location from ProjectLocationKnowledgeBaseDocument resource. + * + * @param {string} projectLocationKnowledgeBaseDocumentName + * A fully-qualified path representing project_location_knowledge_base_document resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationKnowledgeBaseDocumentName( + projectLocationKnowledgeBaseDocumentName: string + ) { + return this.pathTemplates.projectLocationKnowledgeBaseDocumentPathTemplate.match( + projectLocationKnowledgeBaseDocumentName + ).location; + } + + /** + * Parse the knowledge_base from ProjectLocationKnowledgeBaseDocument resource. + * + * @param {string} projectLocationKnowledgeBaseDocumentName + * A fully-qualified path representing project_location_knowledge_base_document resource. + * @returns {string} A string representing the knowledge_base. + */ + matchKnowledgeBaseFromProjectLocationKnowledgeBaseDocumentName( + projectLocationKnowledgeBaseDocumentName: string + ) { + return this.pathTemplates.projectLocationKnowledgeBaseDocumentPathTemplate.match( + projectLocationKnowledgeBaseDocumentName + ).knowledge_base; + } + + /** + * Parse the document from ProjectLocationKnowledgeBaseDocument resource. + * + * @param {string} projectLocationKnowledgeBaseDocumentName + * A fully-qualified path representing project_location_knowledge_base_document resource. + * @returns {string} A string representing the document. + */ + matchDocumentFromProjectLocationKnowledgeBaseDocumentName( + projectLocationKnowledgeBaseDocumentName: string + ) { + return this.pathTemplates.projectLocationKnowledgeBaseDocumentPathTemplate.match( + projectLocationKnowledgeBaseDocumentName + ).document; + } + /** * Terminate the gRPC channel and close the client. * diff --git a/packages/google-cloud-dialogflow/synth.metadata b/packages/google-cloud-dialogflow/synth.metadata index c4e81687830..929ec5ed652 100644 --- a/packages/google-cloud-dialogflow/synth.metadata +++ b/packages/google-cloud-dialogflow/synth.metadata @@ -4,15 +4,15 @@ "git": { "name": ".", "remote": "https://github.com/googleapis/nodejs-dialogflow.git", - "sha": "fb28879443c27688d1923d6675ea97c3c5d4d0e7" + "sha": "be20d3df79b8b0dca4c5993943df157601343764" } }, { "git": { "name": "googleapis", "remote": "https://github.com/googleapis/googleapis.git", - "sha": "2f019bf70bfe06f1e2af1b04011b0a2405190e43", - "internalRef": "343202295" + "sha": "d189e871205fea665a9648f7c4676f027495ccaf", + "internalRef": "345596855" } }, { diff --git a/packages/google-cloud-dialogflow/test/gapic_agents_v2beta1.ts b/packages/google-cloud-dialogflow/test/gapic_agents_v2beta1.ts index 418b47ee0d1..adf6cb2a931 100644 --- a/packages/google-cloud-dialogflow/test/gapic_agents_v2beta1.ts +++ b/packages/google-cloud-dialogflow/test/gapic_agents_v2beta1.ts @@ -1752,122 +1752,6 @@ describe('v2beta1.AgentsClient', () => { }); describe('Path templates', () => { - describe('document', () => { - const fakePath = '/rendered/path/document'; - const expectedParameters = { - project: 'projectValue', - knowledge_base: 'knowledgeBaseValue', - document: 'documentValue', - }; - const client = new agentsModule.v2beta1.AgentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.documentPathTemplate.render = sinon - .stub() - .returns(fakePath); - client.pathTemplates.documentPathTemplate.match = sinon - .stub() - .returns(expectedParameters); - - it('documentPath', () => { - const result = client.documentPath( - 'projectValue', - 'knowledgeBaseValue', - 'documentValue' - ); - assert.strictEqual(result, fakePath); - assert( - (client.pathTemplates.documentPathTemplate.render as SinonStub) - .getCall(-1) - .calledWith(expectedParameters) - ); - }); - - it('matchProjectFromDocumentName', () => { - const result = client.matchProjectFromDocumentName(fakePath); - assert.strictEqual(result, 'projectValue'); - assert( - (client.pathTemplates.documentPathTemplate.match as SinonStub) - .getCall(-1) - .calledWith(fakePath) - ); - }); - - it('matchKnowledgeBaseFromDocumentName', () => { - const result = client.matchKnowledgeBaseFromDocumentName(fakePath); - assert.strictEqual(result, 'knowledgeBaseValue'); - assert( - (client.pathTemplates.documentPathTemplate.match as SinonStub) - .getCall(-1) - .calledWith(fakePath) - ); - }); - - it('matchDocumentFromDocumentName', () => { - const result = client.matchDocumentFromDocumentName(fakePath); - assert.strictEqual(result, 'documentValue'); - assert( - (client.pathTemplates.documentPathTemplate.match as SinonStub) - .getCall(-1) - .calledWith(fakePath) - ); - }); - }); - - describe('knowledgeBase', () => { - const fakePath = '/rendered/path/knowledgeBase'; - const expectedParameters = { - project: 'projectValue', - knowledge_base: 'knowledgeBaseValue', - }; - const client = new agentsModule.v2beta1.AgentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.knowledgeBasePathTemplate.render = sinon - .stub() - .returns(fakePath); - client.pathTemplates.knowledgeBasePathTemplate.match = sinon - .stub() - .returns(expectedParameters); - - it('knowledgeBasePath', () => { - const result = client.knowledgeBasePath( - 'projectValue', - 'knowledgeBaseValue' - ); - assert.strictEqual(result, fakePath); - assert( - (client.pathTemplates.knowledgeBasePathTemplate.render as SinonStub) - .getCall(-1) - .calledWith(expectedParameters) - ); - }); - - it('matchProjectFromKnowledgeBaseName', () => { - const result = client.matchProjectFromKnowledgeBaseName(fakePath); - assert.strictEqual(result, 'projectValue'); - assert( - (client.pathTemplates.knowledgeBasePathTemplate.match as SinonStub) - .getCall(-1) - .calledWith(fakePath) - ); - }); - - it('matchKnowledgeBaseFromKnowledgeBaseName', () => { - const result = client.matchKnowledgeBaseFromKnowledgeBaseName(fakePath); - assert.strictEqual(result, 'knowledgeBaseValue'); - assert( - (client.pathTemplates.knowledgeBasePathTemplate.match as SinonStub) - .getCall(-1) - .calledWith(fakePath) - ); - }); - }); - describe('project', () => { const fakePath = '/rendered/path/project'; const expectedParameters = { @@ -2487,6 +2371,139 @@ describe('v2beta1.AgentsClient', () => { }); }); + describe('projectKnowledgeBase', () => { + const fakePath = '/rendered/path/projectKnowledgeBase'; + const expectedParameters = { + project: 'projectValue', + knowledge_base: 'knowledgeBaseValue', + }; + const client = new agentsModule.v2beta1.AgentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectKnowledgeBasePathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectKnowledgeBasePathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectKnowledgeBasePath', () => { + const result = client.projectKnowledgeBasePath( + 'projectValue', + 'knowledgeBaseValue' + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.projectKnowledgeBasePathTemplate + .render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectKnowledgeBaseName', () => { + const result = client.matchProjectFromProjectKnowledgeBaseName( + fakePath + ); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.projectKnowledgeBasePathTemplate + .match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchKnowledgeBaseFromProjectKnowledgeBaseName', () => { + const result = client.matchKnowledgeBaseFromProjectKnowledgeBaseName( + fakePath + ); + assert.strictEqual(result, 'knowledgeBaseValue'); + assert( + (client.pathTemplates.projectKnowledgeBasePathTemplate + .match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectKnowledgeBaseDocument', () => { + const fakePath = '/rendered/path/projectKnowledgeBaseDocument'; + const expectedParameters = { + project: 'projectValue', + knowledge_base: 'knowledgeBaseValue', + document: 'documentValue', + }; + const client = new agentsModule.v2beta1.AgentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectKnowledgeBaseDocumentPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectKnowledgeBaseDocumentPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectKnowledgeBaseDocumentPath', () => { + const result = client.projectKnowledgeBaseDocumentPath( + 'projectValue', + 'knowledgeBaseValue', + 'documentValue' + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.projectKnowledgeBaseDocumentPathTemplate + .render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectKnowledgeBaseDocumentName', () => { + const result = client.matchProjectFromProjectKnowledgeBaseDocumentName( + fakePath + ); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.projectKnowledgeBaseDocumentPathTemplate + .match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchKnowledgeBaseFromProjectKnowledgeBaseDocumentName', () => { + const result = client.matchKnowledgeBaseFromProjectKnowledgeBaseDocumentName( + fakePath + ); + assert.strictEqual(result, 'knowledgeBaseValue'); + assert( + (client.pathTemplates.projectKnowledgeBaseDocumentPathTemplate + .match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchDocumentFromProjectKnowledgeBaseDocumentName', () => { + const result = client.matchDocumentFromProjectKnowledgeBaseDocumentName( + fakePath + ); + assert.strictEqual(result, 'documentValue'); + assert( + (client.pathTemplates.projectKnowledgeBaseDocumentPathTemplate + .match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + describe('projectLocationAgent', () => { const fakePath = '/rendered/path/projectLocationAgent'; const expectedParameters = { @@ -2950,5 +2967,168 @@ describe('v2beta1.AgentsClient', () => { ); }); }); + + describe('projectLocationKnowledgeBase', () => { + const fakePath = '/rendered/path/projectLocationKnowledgeBase'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + knowledge_base: 'knowledgeBaseValue', + }; + const client = new agentsModule.v2beta1.AgentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationKnowledgeBasePathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectLocationKnowledgeBasePathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectLocationKnowledgeBasePath', () => { + const result = client.projectLocationKnowledgeBasePath( + 'projectValue', + 'locationValue', + 'knowledgeBaseValue' + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.projectLocationKnowledgeBasePathTemplate + .render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationKnowledgeBaseName', () => { + const result = client.matchProjectFromProjectLocationKnowledgeBaseName( + fakePath + ); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.projectLocationKnowledgeBasePathTemplate + .match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationKnowledgeBaseName', () => { + const result = client.matchLocationFromProjectLocationKnowledgeBaseName( + fakePath + ); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.projectLocationKnowledgeBasePathTemplate + .match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchKnowledgeBaseFromProjectLocationKnowledgeBaseName', () => { + const result = client.matchKnowledgeBaseFromProjectLocationKnowledgeBaseName( + fakePath + ); + assert.strictEqual(result, 'knowledgeBaseValue'); + assert( + (client.pathTemplates.projectLocationKnowledgeBasePathTemplate + .match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationKnowledgeBaseDocument', () => { + const fakePath = '/rendered/path/projectLocationKnowledgeBaseDocument'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + knowledge_base: 'knowledgeBaseValue', + document: 'documentValue', + }; + const client = new agentsModule.v2beta1.AgentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationKnowledgeBaseDocumentPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectLocationKnowledgeBaseDocumentPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectLocationKnowledgeBaseDocumentPath', () => { + const result = client.projectLocationKnowledgeBaseDocumentPath( + 'projectValue', + 'locationValue', + 'knowledgeBaseValue', + 'documentValue' + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.projectLocationKnowledgeBaseDocumentPathTemplate + .render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationKnowledgeBaseDocumentName', () => { + const result = client.matchProjectFromProjectLocationKnowledgeBaseDocumentName( + fakePath + ); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.projectLocationKnowledgeBaseDocumentPathTemplate + .match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationKnowledgeBaseDocumentName', () => { + const result = client.matchLocationFromProjectLocationKnowledgeBaseDocumentName( + fakePath + ); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.projectLocationKnowledgeBaseDocumentPathTemplate + .match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchKnowledgeBaseFromProjectLocationKnowledgeBaseDocumentName', () => { + const result = client.matchKnowledgeBaseFromProjectLocationKnowledgeBaseDocumentName( + fakePath + ); + assert.strictEqual(result, 'knowledgeBaseValue'); + assert( + (client.pathTemplates.projectLocationKnowledgeBaseDocumentPathTemplate + .match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchDocumentFromProjectLocationKnowledgeBaseDocumentName', () => { + const result = client.matchDocumentFromProjectLocationKnowledgeBaseDocumentName( + fakePath + ); + assert.strictEqual(result, 'documentValue'); + assert( + (client.pathTemplates.projectLocationKnowledgeBaseDocumentPathTemplate + .match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); }); }); diff --git a/packages/google-cloud-dialogflow/test/gapic_contexts_v2beta1.ts b/packages/google-cloud-dialogflow/test/gapic_contexts_v2beta1.ts index 35ae17c1cc8..0469227242a 100644 --- a/packages/google-cloud-dialogflow/test/gapic_contexts_v2beta1.ts +++ b/packages/google-cloud-dialogflow/test/gapic_contexts_v2beta1.ts @@ -1072,122 +1072,6 @@ describe('v2beta1.ContextsClient', () => { }); describe('Path templates', () => { - describe('document', () => { - const fakePath = '/rendered/path/document'; - const expectedParameters = { - project: 'projectValue', - knowledge_base: 'knowledgeBaseValue', - document: 'documentValue', - }; - const client = new contextsModule.v2beta1.ContextsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.documentPathTemplate.render = sinon - .stub() - .returns(fakePath); - client.pathTemplates.documentPathTemplate.match = sinon - .stub() - .returns(expectedParameters); - - it('documentPath', () => { - const result = client.documentPath( - 'projectValue', - 'knowledgeBaseValue', - 'documentValue' - ); - assert.strictEqual(result, fakePath); - assert( - (client.pathTemplates.documentPathTemplate.render as SinonStub) - .getCall(-1) - .calledWith(expectedParameters) - ); - }); - - it('matchProjectFromDocumentName', () => { - const result = client.matchProjectFromDocumentName(fakePath); - assert.strictEqual(result, 'projectValue'); - assert( - (client.pathTemplates.documentPathTemplate.match as SinonStub) - .getCall(-1) - .calledWith(fakePath) - ); - }); - - it('matchKnowledgeBaseFromDocumentName', () => { - const result = client.matchKnowledgeBaseFromDocumentName(fakePath); - assert.strictEqual(result, 'knowledgeBaseValue'); - assert( - (client.pathTemplates.documentPathTemplate.match as SinonStub) - .getCall(-1) - .calledWith(fakePath) - ); - }); - - it('matchDocumentFromDocumentName', () => { - const result = client.matchDocumentFromDocumentName(fakePath); - assert.strictEqual(result, 'documentValue'); - assert( - (client.pathTemplates.documentPathTemplate.match as SinonStub) - .getCall(-1) - .calledWith(fakePath) - ); - }); - }); - - describe('knowledgeBase', () => { - const fakePath = '/rendered/path/knowledgeBase'; - const expectedParameters = { - project: 'projectValue', - knowledge_base: 'knowledgeBaseValue', - }; - const client = new contextsModule.v2beta1.ContextsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.knowledgeBasePathTemplate.render = sinon - .stub() - .returns(fakePath); - client.pathTemplates.knowledgeBasePathTemplate.match = sinon - .stub() - .returns(expectedParameters); - - it('knowledgeBasePath', () => { - const result = client.knowledgeBasePath( - 'projectValue', - 'knowledgeBaseValue' - ); - assert.strictEqual(result, fakePath); - assert( - (client.pathTemplates.knowledgeBasePathTemplate.render as SinonStub) - .getCall(-1) - .calledWith(expectedParameters) - ); - }); - - it('matchProjectFromKnowledgeBaseName', () => { - const result = client.matchProjectFromKnowledgeBaseName(fakePath); - assert.strictEqual(result, 'projectValue'); - assert( - (client.pathTemplates.knowledgeBasePathTemplate.match as SinonStub) - .getCall(-1) - .calledWith(fakePath) - ); - }); - - it('matchKnowledgeBaseFromKnowledgeBaseName', () => { - const result = client.matchKnowledgeBaseFromKnowledgeBaseName(fakePath); - assert.strictEqual(result, 'knowledgeBaseValue'); - assert( - (client.pathTemplates.knowledgeBasePathTemplate.match as SinonStub) - .getCall(-1) - .calledWith(fakePath) - ); - }); - }); - describe('project', () => { const fakePath = '/rendered/path/project'; const expectedParameters = { @@ -1862,6 +1746,139 @@ describe('v2beta1.ContextsClient', () => { }); }); + describe('projectKnowledgeBase', () => { + const fakePath = '/rendered/path/projectKnowledgeBase'; + const expectedParameters = { + project: 'projectValue', + knowledge_base: 'knowledgeBaseValue', + }; + const client = new contextsModule.v2beta1.ContextsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectKnowledgeBasePathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectKnowledgeBasePathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectKnowledgeBasePath', () => { + const result = client.projectKnowledgeBasePath( + 'projectValue', + 'knowledgeBaseValue' + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.projectKnowledgeBasePathTemplate + .render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectKnowledgeBaseName', () => { + const result = client.matchProjectFromProjectKnowledgeBaseName( + fakePath + ); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.projectKnowledgeBasePathTemplate + .match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchKnowledgeBaseFromProjectKnowledgeBaseName', () => { + const result = client.matchKnowledgeBaseFromProjectKnowledgeBaseName( + fakePath + ); + assert.strictEqual(result, 'knowledgeBaseValue'); + assert( + (client.pathTemplates.projectKnowledgeBasePathTemplate + .match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectKnowledgeBaseDocument', () => { + const fakePath = '/rendered/path/projectKnowledgeBaseDocument'; + const expectedParameters = { + project: 'projectValue', + knowledge_base: 'knowledgeBaseValue', + document: 'documentValue', + }; + const client = new contextsModule.v2beta1.ContextsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectKnowledgeBaseDocumentPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectKnowledgeBaseDocumentPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectKnowledgeBaseDocumentPath', () => { + const result = client.projectKnowledgeBaseDocumentPath( + 'projectValue', + 'knowledgeBaseValue', + 'documentValue' + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.projectKnowledgeBaseDocumentPathTemplate + .render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectKnowledgeBaseDocumentName', () => { + const result = client.matchProjectFromProjectKnowledgeBaseDocumentName( + fakePath + ); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.projectKnowledgeBaseDocumentPathTemplate + .match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchKnowledgeBaseFromProjectKnowledgeBaseDocumentName', () => { + const result = client.matchKnowledgeBaseFromProjectKnowledgeBaseDocumentName( + fakePath + ); + assert.strictEqual(result, 'knowledgeBaseValue'); + assert( + (client.pathTemplates.projectKnowledgeBaseDocumentPathTemplate + .match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchDocumentFromProjectKnowledgeBaseDocumentName', () => { + const result = client.matchDocumentFromProjectKnowledgeBaseDocumentName( + fakePath + ); + assert.strictEqual(result, 'documentValue'); + assert( + (client.pathTemplates.projectKnowledgeBaseDocumentPathTemplate + .match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + describe('projectLocationAgent', () => { const fakePath = '/rendered/path/projectLocationAgent'; const expectedParameters = { @@ -2325,5 +2342,168 @@ describe('v2beta1.ContextsClient', () => { ); }); }); + + describe('projectLocationKnowledgeBase', () => { + const fakePath = '/rendered/path/projectLocationKnowledgeBase'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + knowledge_base: 'knowledgeBaseValue', + }; + const client = new contextsModule.v2beta1.ContextsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationKnowledgeBasePathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectLocationKnowledgeBasePathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectLocationKnowledgeBasePath', () => { + const result = client.projectLocationKnowledgeBasePath( + 'projectValue', + 'locationValue', + 'knowledgeBaseValue' + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.projectLocationKnowledgeBasePathTemplate + .render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationKnowledgeBaseName', () => { + const result = client.matchProjectFromProjectLocationKnowledgeBaseName( + fakePath + ); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.projectLocationKnowledgeBasePathTemplate + .match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationKnowledgeBaseName', () => { + const result = client.matchLocationFromProjectLocationKnowledgeBaseName( + fakePath + ); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.projectLocationKnowledgeBasePathTemplate + .match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchKnowledgeBaseFromProjectLocationKnowledgeBaseName', () => { + const result = client.matchKnowledgeBaseFromProjectLocationKnowledgeBaseName( + fakePath + ); + assert.strictEqual(result, 'knowledgeBaseValue'); + assert( + (client.pathTemplates.projectLocationKnowledgeBasePathTemplate + .match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationKnowledgeBaseDocument', () => { + const fakePath = '/rendered/path/projectLocationKnowledgeBaseDocument'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + knowledge_base: 'knowledgeBaseValue', + document: 'documentValue', + }; + const client = new contextsModule.v2beta1.ContextsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationKnowledgeBaseDocumentPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectLocationKnowledgeBaseDocumentPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectLocationKnowledgeBaseDocumentPath', () => { + const result = client.projectLocationKnowledgeBaseDocumentPath( + 'projectValue', + 'locationValue', + 'knowledgeBaseValue', + 'documentValue' + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.projectLocationKnowledgeBaseDocumentPathTemplate + .render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationKnowledgeBaseDocumentName', () => { + const result = client.matchProjectFromProjectLocationKnowledgeBaseDocumentName( + fakePath + ); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.projectLocationKnowledgeBaseDocumentPathTemplate + .match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationKnowledgeBaseDocumentName', () => { + const result = client.matchLocationFromProjectLocationKnowledgeBaseDocumentName( + fakePath + ); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.projectLocationKnowledgeBaseDocumentPathTemplate + .match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchKnowledgeBaseFromProjectLocationKnowledgeBaseDocumentName', () => { + const result = client.matchKnowledgeBaseFromProjectLocationKnowledgeBaseDocumentName( + fakePath + ); + assert.strictEqual(result, 'knowledgeBaseValue'); + assert( + (client.pathTemplates.projectLocationKnowledgeBaseDocumentPathTemplate + .match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchDocumentFromProjectLocationKnowledgeBaseDocumentName', () => { + const result = client.matchDocumentFromProjectLocationKnowledgeBaseDocumentName( + fakePath + ); + assert.strictEqual(result, 'documentValue'); + assert( + (client.pathTemplates.projectLocationKnowledgeBaseDocumentPathTemplate + .match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); }); }); diff --git a/packages/google-cloud-dialogflow/test/gapic_documents_v2beta1.ts b/packages/google-cloud-dialogflow/test/gapic_documents_v2beta1.ts index f4349c1fe87..416fb3b762c 100644 --- a/packages/google-cloud-dialogflow/test/gapic_documents_v2beta1.ts +++ b/packages/google-cloud-dialogflow/test/gapic_documents_v2beta1.ts @@ -1441,122 +1441,6 @@ describe('v2beta1.DocumentsClient', () => { }); describe('Path templates', () => { - describe('document', () => { - const fakePath = '/rendered/path/document'; - const expectedParameters = { - project: 'projectValue', - knowledge_base: 'knowledgeBaseValue', - document: 'documentValue', - }; - const client = new documentsModule.v2beta1.DocumentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.documentPathTemplate.render = sinon - .stub() - .returns(fakePath); - client.pathTemplates.documentPathTemplate.match = sinon - .stub() - .returns(expectedParameters); - - it('documentPath', () => { - const result = client.documentPath( - 'projectValue', - 'knowledgeBaseValue', - 'documentValue' - ); - assert.strictEqual(result, fakePath); - assert( - (client.pathTemplates.documentPathTemplate.render as SinonStub) - .getCall(-1) - .calledWith(expectedParameters) - ); - }); - - it('matchProjectFromDocumentName', () => { - const result = client.matchProjectFromDocumentName(fakePath); - assert.strictEqual(result, 'projectValue'); - assert( - (client.pathTemplates.documentPathTemplate.match as SinonStub) - .getCall(-1) - .calledWith(fakePath) - ); - }); - - it('matchKnowledgeBaseFromDocumentName', () => { - const result = client.matchKnowledgeBaseFromDocumentName(fakePath); - assert.strictEqual(result, 'knowledgeBaseValue'); - assert( - (client.pathTemplates.documentPathTemplate.match as SinonStub) - .getCall(-1) - .calledWith(fakePath) - ); - }); - - it('matchDocumentFromDocumentName', () => { - const result = client.matchDocumentFromDocumentName(fakePath); - assert.strictEqual(result, 'documentValue'); - assert( - (client.pathTemplates.documentPathTemplate.match as SinonStub) - .getCall(-1) - .calledWith(fakePath) - ); - }); - }); - - describe('knowledgeBase', () => { - const fakePath = '/rendered/path/knowledgeBase'; - const expectedParameters = { - project: 'projectValue', - knowledge_base: 'knowledgeBaseValue', - }; - const client = new documentsModule.v2beta1.DocumentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.knowledgeBasePathTemplate.render = sinon - .stub() - .returns(fakePath); - client.pathTemplates.knowledgeBasePathTemplate.match = sinon - .stub() - .returns(expectedParameters); - - it('knowledgeBasePath', () => { - const result = client.knowledgeBasePath( - 'projectValue', - 'knowledgeBaseValue' - ); - assert.strictEqual(result, fakePath); - assert( - (client.pathTemplates.knowledgeBasePathTemplate.render as SinonStub) - .getCall(-1) - .calledWith(expectedParameters) - ); - }); - - it('matchProjectFromKnowledgeBaseName', () => { - const result = client.matchProjectFromKnowledgeBaseName(fakePath); - assert.strictEqual(result, 'projectValue'); - assert( - (client.pathTemplates.knowledgeBasePathTemplate.match as SinonStub) - .getCall(-1) - .calledWith(fakePath) - ); - }); - - it('matchKnowledgeBaseFromKnowledgeBaseName', () => { - const result = client.matchKnowledgeBaseFromKnowledgeBaseName(fakePath); - assert.strictEqual(result, 'knowledgeBaseValue'); - assert( - (client.pathTemplates.knowledgeBasePathTemplate.match as SinonStub) - .getCall(-1) - .calledWith(fakePath) - ); - }); - }); - describe('project', () => { const fakePath = '/rendered/path/project'; const expectedParameters = { @@ -2176,6 +2060,139 @@ describe('v2beta1.DocumentsClient', () => { }); }); + describe('projectKnowledgeBase', () => { + const fakePath = '/rendered/path/projectKnowledgeBase'; + const expectedParameters = { + project: 'projectValue', + knowledge_base: 'knowledgeBaseValue', + }; + const client = new documentsModule.v2beta1.DocumentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectKnowledgeBasePathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectKnowledgeBasePathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectKnowledgeBasePath', () => { + const result = client.projectKnowledgeBasePath( + 'projectValue', + 'knowledgeBaseValue' + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.projectKnowledgeBasePathTemplate + .render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectKnowledgeBaseName', () => { + const result = client.matchProjectFromProjectKnowledgeBaseName( + fakePath + ); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.projectKnowledgeBasePathTemplate + .match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchKnowledgeBaseFromProjectKnowledgeBaseName', () => { + const result = client.matchKnowledgeBaseFromProjectKnowledgeBaseName( + fakePath + ); + assert.strictEqual(result, 'knowledgeBaseValue'); + assert( + (client.pathTemplates.projectKnowledgeBasePathTemplate + .match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectKnowledgeBaseDocument', () => { + const fakePath = '/rendered/path/projectKnowledgeBaseDocument'; + const expectedParameters = { + project: 'projectValue', + knowledge_base: 'knowledgeBaseValue', + document: 'documentValue', + }; + const client = new documentsModule.v2beta1.DocumentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectKnowledgeBaseDocumentPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectKnowledgeBaseDocumentPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectKnowledgeBaseDocumentPath', () => { + const result = client.projectKnowledgeBaseDocumentPath( + 'projectValue', + 'knowledgeBaseValue', + 'documentValue' + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.projectKnowledgeBaseDocumentPathTemplate + .render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectKnowledgeBaseDocumentName', () => { + const result = client.matchProjectFromProjectKnowledgeBaseDocumentName( + fakePath + ); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.projectKnowledgeBaseDocumentPathTemplate + .match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchKnowledgeBaseFromProjectKnowledgeBaseDocumentName', () => { + const result = client.matchKnowledgeBaseFromProjectKnowledgeBaseDocumentName( + fakePath + ); + assert.strictEqual(result, 'knowledgeBaseValue'); + assert( + (client.pathTemplates.projectKnowledgeBaseDocumentPathTemplate + .match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchDocumentFromProjectKnowledgeBaseDocumentName', () => { + const result = client.matchDocumentFromProjectKnowledgeBaseDocumentName( + fakePath + ); + assert.strictEqual(result, 'documentValue'); + assert( + (client.pathTemplates.projectKnowledgeBaseDocumentPathTemplate + .match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + describe('projectLocationAgent', () => { const fakePath = '/rendered/path/projectLocationAgent'; const expectedParameters = { @@ -2639,5 +2656,168 @@ describe('v2beta1.DocumentsClient', () => { ); }); }); + + describe('projectLocationKnowledgeBase', () => { + const fakePath = '/rendered/path/projectLocationKnowledgeBase'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + knowledge_base: 'knowledgeBaseValue', + }; + const client = new documentsModule.v2beta1.DocumentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationKnowledgeBasePathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectLocationKnowledgeBasePathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectLocationKnowledgeBasePath', () => { + const result = client.projectLocationKnowledgeBasePath( + 'projectValue', + 'locationValue', + 'knowledgeBaseValue' + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.projectLocationKnowledgeBasePathTemplate + .render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationKnowledgeBaseName', () => { + const result = client.matchProjectFromProjectLocationKnowledgeBaseName( + fakePath + ); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.projectLocationKnowledgeBasePathTemplate + .match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationKnowledgeBaseName', () => { + const result = client.matchLocationFromProjectLocationKnowledgeBaseName( + fakePath + ); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.projectLocationKnowledgeBasePathTemplate + .match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchKnowledgeBaseFromProjectLocationKnowledgeBaseName', () => { + const result = client.matchKnowledgeBaseFromProjectLocationKnowledgeBaseName( + fakePath + ); + assert.strictEqual(result, 'knowledgeBaseValue'); + assert( + (client.pathTemplates.projectLocationKnowledgeBasePathTemplate + .match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationKnowledgeBaseDocument', () => { + const fakePath = '/rendered/path/projectLocationKnowledgeBaseDocument'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + knowledge_base: 'knowledgeBaseValue', + document: 'documentValue', + }; + const client = new documentsModule.v2beta1.DocumentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationKnowledgeBaseDocumentPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectLocationKnowledgeBaseDocumentPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectLocationKnowledgeBaseDocumentPath', () => { + const result = client.projectLocationKnowledgeBaseDocumentPath( + 'projectValue', + 'locationValue', + 'knowledgeBaseValue', + 'documentValue' + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.projectLocationKnowledgeBaseDocumentPathTemplate + .render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationKnowledgeBaseDocumentName', () => { + const result = client.matchProjectFromProjectLocationKnowledgeBaseDocumentName( + fakePath + ); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.projectLocationKnowledgeBaseDocumentPathTemplate + .match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationKnowledgeBaseDocumentName', () => { + const result = client.matchLocationFromProjectLocationKnowledgeBaseDocumentName( + fakePath + ); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.projectLocationKnowledgeBaseDocumentPathTemplate + .match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchKnowledgeBaseFromProjectLocationKnowledgeBaseDocumentName', () => { + const result = client.matchKnowledgeBaseFromProjectLocationKnowledgeBaseDocumentName( + fakePath + ); + assert.strictEqual(result, 'knowledgeBaseValue'); + assert( + (client.pathTemplates.projectLocationKnowledgeBaseDocumentPathTemplate + .match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchDocumentFromProjectLocationKnowledgeBaseDocumentName', () => { + const result = client.matchDocumentFromProjectLocationKnowledgeBaseDocumentName( + fakePath + ); + assert.strictEqual(result, 'documentValue'); + assert( + (client.pathTemplates.projectLocationKnowledgeBaseDocumentPathTemplate + .match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); }); }); diff --git a/packages/google-cloud-dialogflow/test/gapic_entity_types_v2beta1.ts b/packages/google-cloud-dialogflow/test/gapic_entity_types_v2beta1.ts index 62c2086b737..3bca681b502 100644 --- a/packages/google-cloud-dialogflow/test/gapic_entity_types_v2beta1.ts +++ b/packages/google-cloud-dialogflow/test/gapic_entity_types_v2beta1.ts @@ -1978,122 +1978,6 @@ describe('v2beta1.EntityTypesClient', () => { }); describe('Path templates', () => { - describe('document', () => { - const fakePath = '/rendered/path/document'; - const expectedParameters = { - project: 'projectValue', - knowledge_base: 'knowledgeBaseValue', - document: 'documentValue', - }; - const client = new entitytypesModule.v2beta1.EntityTypesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.documentPathTemplate.render = sinon - .stub() - .returns(fakePath); - client.pathTemplates.documentPathTemplate.match = sinon - .stub() - .returns(expectedParameters); - - it('documentPath', () => { - const result = client.documentPath( - 'projectValue', - 'knowledgeBaseValue', - 'documentValue' - ); - assert.strictEqual(result, fakePath); - assert( - (client.pathTemplates.documentPathTemplate.render as SinonStub) - .getCall(-1) - .calledWith(expectedParameters) - ); - }); - - it('matchProjectFromDocumentName', () => { - const result = client.matchProjectFromDocumentName(fakePath); - assert.strictEqual(result, 'projectValue'); - assert( - (client.pathTemplates.documentPathTemplate.match as SinonStub) - .getCall(-1) - .calledWith(fakePath) - ); - }); - - it('matchKnowledgeBaseFromDocumentName', () => { - const result = client.matchKnowledgeBaseFromDocumentName(fakePath); - assert.strictEqual(result, 'knowledgeBaseValue'); - assert( - (client.pathTemplates.documentPathTemplate.match as SinonStub) - .getCall(-1) - .calledWith(fakePath) - ); - }); - - it('matchDocumentFromDocumentName', () => { - const result = client.matchDocumentFromDocumentName(fakePath); - assert.strictEqual(result, 'documentValue'); - assert( - (client.pathTemplates.documentPathTemplate.match as SinonStub) - .getCall(-1) - .calledWith(fakePath) - ); - }); - }); - - describe('knowledgeBase', () => { - const fakePath = '/rendered/path/knowledgeBase'; - const expectedParameters = { - project: 'projectValue', - knowledge_base: 'knowledgeBaseValue', - }; - const client = new entitytypesModule.v2beta1.EntityTypesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.knowledgeBasePathTemplate.render = sinon - .stub() - .returns(fakePath); - client.pathTemplates.knowledgeBasePathTemplate.match = sinon - .stub() - .returns(expectedParameters); - - it('knowledgeBasePath', () => { - const result = client.knowledgeBasePath( - 'projectValue', - 'knowledgeBaseValue' - ); - assert.strictEqual(result, fakePath); - assert( - (client.pathTemplates.knowledgeBasePathTemplate.render as SinonStub) - .getCall(-1) - .calledWith(expectedParameters) - ); - }); - - it('matchProjectFromKnowledgeBaseName', () => { - const result = client.matchProjectFromKnowledgeBaseName(fakePath); - assert.strictEqual(result, 'projectValue'); - assert( - (client.pathTemplates.knowledgeBasePathTemplate.match as SinonStub) - .getCall(-1) - .calledWith(fakePath) - ); - }); - - it('matchKnowledgeBaseFromKnowledgeBaseName', () => { - const result = client.matchKnowledgeBaseFromKnowledgeBaseName(fakePath); - assert.strictEqual(result, 'knowledgeBaseValue'); - assert( - (client.pathTemplates.knowledgeBasePathTemplate.match as SinonStub) - .getCall(-1) - .calledWith(fakePath) - ); - }); - }); - describe('project', () => { const fakePath = '/rendered/path/project'; const expectedParameters = { @@ -2713,6 +2597,139 @@ describe('v2beta1.EntityTypesClient', () => { }); }); + describe('projectKnowledgeBase', () => { + const fakePath = '/rendered/path/projectKnowledgeBase'; + const expectedParameters = { + project: 'projectValue', + knowledge_base: 'knowledgeBaseValue', + }; + const client = new entitytypesModule.v2beta1.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectKnowledgeBasePathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectKnowledgeBasePathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectKnowledgeBasePath', () => { + const result = client.projectKnowledgeBasePath( + 'projectValue', + 'knowledgeBaseValue' + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.projectKnowledgeBasePathTemplate + .render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectKnowledgeBaseName', () => { + const result = client.matchProjectFromProjectKnowledgeBaseName( + fakePath + ); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.projectKnowledgeBasePathTemplate + .match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchKnowledgeBaseFromProjectKnowledgeBaseName', () => { + const result = client.matchKnowledgeBaseFromProjectKnowledgeBaseName( + fakePath + ); + assert.strictEqual(result, 'knowledgeBaseValue'); + assert( + (client.pathTemplates.projectKnowledgeBasePathTemplate + .match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectKnowledgeBaseDocument', () => { + const fakePath = '/rendered/path/projectKnowledgeBaseDocument'; + const expectedParameters = { + project: 'projectValue', + knowledge_base: 'knowledgeBaseValue', + document: 'documentValue', + }; + const client = new entitytypesModule.v2beta1.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectKnowledgeBaseDocumentPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectKnowledgeBaseDocumentPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectKnowledgeBaseDocumentPath', () => { + const result = client.projectKnowledgeBaseDocumentPath( + 'projectValue', + 'knowledgeBaseValue', + 'documentValue' + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.projectKnowledgeBaseDocumentPathTemplate + .render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectKnowledgeBaseDocumentName', () => { + const result = client.matchProjectFromProjectKnowledgeBaseDocumentName( + fakePath + ); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.projectKnowledgeBaseDocumentPathTemplate + .match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchKnowledgeBaseFromProjectKnowledgeBaseDocumentName', () => { + const result = client.matchKnowledgeBaseFromProjectKnowledgeBaseDocumentName( + fakePath + ); + assert.strictEqual(result, 'knowledgeBaseValue'); + assert( + (client.pathTemplates.projectKnowledgeBaseDocumentPathTemplate + .match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchDocumentFromProjectKnowledgeBaseDocumentName', () => { + const result = client.matchDocumentFromProjectKnowledgeBaseDocumentName( + fakePath + ); + assert.strictEqual(result, 'documentValue'); + assert( + (client.pathTemplates.projectKnowledgeBaseDocumentPathTemplate + .match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + describe('projectLocationAgent', () => { const fakePath = '/rendered/path/projectLocationAgent'; const expectedParameters = { @@ -3176,5 +3193,168 @@ describe('v2beta1.EntityTypesClient', () => { ); }); }); + + describe('projectLocationKnowledgeBase', () => { + const fakePath = '/rendered/path/projectLocationKnowledgeBase'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + knowledge_base: 'knowledgeBaseValue', + }; + const client = new entitytypesModule.v2beta1.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationKnowledgeBasePathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectLocationKnowledgeBasePathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectLocationKnowledgeBasePath', () => { + const result = client.projectLocationKnowledgeBasePath( + 'projectValue', + 'locationValue', + 'knowledgeBaseValue' + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.projectLocationKnowledgeBasePathTemplate + .render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationKnowledgeBaseName', () => { + const result = client.matchProjectFromProjectLocationKnowledgeBaseName( + fakePath + ); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.projectLocationKnowledgeBasePathTemplate + .match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationKnowledgeBaseName', () => { + const result = client.matchLocationFromProjectLocationKnowledgeBaseName( + fakePath + ); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.projectLocationKnowledgeBasePathTemplate + .match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchKnowledgeBaseFromProjectLocationKnowledgeBaseName', () => { + const result = client.matchKnowledgeBaseFromProjectLocationKnowledgeBaseName( + fakePath + ); + assert.strictEqual(result, 'knowledgeBaseValue'); + assert( + (client.pathTemplates.projectLocationKnowledgeBasePathTemplate + .match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationKnowledgeBaseDocument', () => { + const fakePath = '/rendered/path/projectLocationKnowledgeBaseDocument'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + knowledge_base: 'knowledgeBaseValue', + document: 'documentValue', + }; + const client = new entitytypesModule.v2beta1.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationKnowledgeBaseDocumentPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectLocationKnowledgeBaseDocumentPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectLocationKnowledgeBaseDocumentPath', () => { + const result = client.projectLocationKnowledgeBaseDocumentPath( + 'projectValue', + 'locationValue', + 'knowledgeBaseValue', + 'documentValue' + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.projectLocationKnowledgeBaseDocumentPathTemplate + .render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationKnowledgeBaseDocumentName', () => { + const result = client.matchProjectFromProjectLocationKnowledgeBaseDocumentName( + fakePath + ); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.projectLocationKnowledgeBaseDocumentPathTemplate + .match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationKnowledgeBaseDocumentName', () => { + const result = client.matchLocationFromProjectLocationKnowledgeBaseDocumentName( + fakePath + ); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.projectLocationKnowledgeBaseDocumentPathTemplate + .match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchKnowledgeBaseFromProjectLocationKnowledgeBaseDocumentName', () => { + const result = client.matchKnowledgeBaseFromProjectLocationKnowledgeBaseDocumentName( + fakePath + ); + assert.strictEqual(result, 'knowledgeBaseValue'); + assert( + (client.pathTemplates.projectLocationKnowledgeBaseDocumentPathTemplate + .match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchDocumentFromProjectLocationKnowledgeBaseDocumentName', () => { + const result = client.matchDocumentFromProjectLocationKnowledgeBaseDocumentName( + fakePath + ); + assert.strictEqual(result, 'documentValue'); + assert( + (client.pathTemplates.projectLocationKnowledgeBaseDocumentPathTemplate + .match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); }); }); diff --git a/packages/google-cloud-dialogflow/test/gapic_environments_v2beta1.ts b/packages/google-cloud-dialogflow/test/gapic_environments_v2beta1.ts index b40d1af589a..f6c5b21dbdf 100644 --- a/packages/google-cloud-dialogflow/test/gapic_environments_v2beta1.ts +++ b/packages/google-cloud-dialogflow/test/gapic_environments_v2beta1.ts @@ -513,122 +513,6 @@ describe('v2beta1.EnvironmentsClient', () => { }); describe('Path templates', () => { - describe('document', () => { - const fakePath = '/rendered/path/document'; - const expectedParameters = { - project: 'projectValue', - knowledge_base: 'knowledgeBaseValue', - document: 'documentValue', - }; - const client = new environmentsModule.v2beta1.EnvironmentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.documentPathTemplate.render = sinon - .stub() - .returns(fakePath); - client.pathTemplates.documentPathTemplate.match = sinon - .stub() - .returns(expectedParameters); - - it('documentPath', () => { - const result = client.documentPath( - 'projectValue', - 'knowledgeBaseValue', - 'documentValue' - ); - assert.strictEqual(result, fakePath); - assert( - (client.pathTemplates.documentPathTemplate.render as SinonStub) - .getCall(-1) - .calledWith(expectedParameters) - ); - }); - - it('matchProjectFromDocumentName', () => { - const result = client.matchProjectFromDocumentName(fakePath); - assert.strictEqual(result, 'projectValue'); - assert( - (client.pathTemplates.documentPathTemplate.match as SinonStub) - .getCall(-1) - .calledWith(fakePath) - ); - }); - - it('matchKnowledgeBaseFromDocumentName', () => { - const result = client.matchKnowledgeBaseFromDocumentName(fakePath); - assert.strictEqual(result, 'knowledgeBaseValue'); - assert( - (client.pathTemplates.documentPathTemplate.match as SinonStub) - .getCall(-1) - .calledWith(fakePath) - ); - }); - - it('matchDocumentFromDocumentName', () => { - const result = client.matchDocumentFromDocumentName(fakePath); - assert.strictEqual(result, 'documentValue'); - assert( - (client.pathTemplates.documentPathTemplate.match as SinonStub) - .getCall(-1) - .calledWith(fakePath) - ); - }); - }); - - describe('knowledgeBase', () => { - const fakePath = '/rendered/path/knowledgeBase'; - const expectedParameters = { - project: 'projectValue', - knowledge_base: 'knowledgeBaseValue', - }; - const client = new environmentsModule.v2beta1.EnvironmentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.knowledgeBasePathTemplate.render = sinon - .stub() - .returns(fakePath); - client.pathTemplates.knowledgeBasePathTemplate.match = sinon - .stub() - .returns(expectedParameters); - - it('knowledgeBasePath', () => { - const result = client.knowledgeBasePath( - 'projectValue', - 'knowledgeBaseValue' - ); - assert.strictEqual(result, fakePath); - assert( - (client.pathTemplates.knowledgeBasePathTemplate.render as SinonStub) - .getCall(-1) - .calledWith(expectedParameters) - ); - }); - - it('matchProjectFromKnowledgeBaseName', () => { - const result = client.matchProjectFromKnowledgeBaseName(fakePath); - assert.strictEqual(result, 'projectValue'); - assert( - (client.pathTemplates.knowledgeBasePathTemplate.match as SinonStub) - .getCall(-1) - .calledWith(fakePath) - ); - }); - - it('matchKnowledgeBaseFromKnowledgeBaseName', () => { - const result = client.matchKnowledgeBaseFromKnowledgeBaseName(fakePath); - assert.strictEqual(result, 'knowledgeBaseValue'); - assert( - (client.pathTemplates.knowledgeBasePathTemplate.match as SinonStub) - .getCall(-1) - .calledWith(fakePath) - ); - }); - }); - describe('project', () => { const fakePath = '/rendered/path/project'; const expectedParameters = { @@ -1248,6 +1132,139 @@ describe('v2beta1.EnvironmentsClient', () => { }); }); + describe('projectKnowledgeBase', () => { + const fakePath = '/rendered/path/projectKnowledgeBase'; + const expectedParameters = { + project: 'projectValue', + knowledge_base: 'knowledgeBaseValue', + }; + const client = new environmentsModule.v2beta1.EnvironmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectKnowledgeBasePathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectKnowledgeBasePathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectKnowledgeBasePath', () => { + const result = client.projectKnowledgeBasePath( + 'projectValue', + 'knowledgeBaseValue' + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.projectKnowledgeBasePathTemplate + .render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectKnowledgeBaseName', () => { + const result = client.matchProjectFromProjectKnowledgeBaseName( + fakePath + ); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.projectKnowledgeBasePathTemplate + .match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchKnowledgeBaseFromProjectKnowledgeBaseName', () => { + const result = client.matchKnowledgeBaseFromProjectKnowledgeBaseName( + fakePath + ); + assert.strictEqual(result, 'knowledgeBaseValue'); + assert( + (client.pathTemplates.projectKnowledgeBasePathTemplate + .match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectKnowledgeBaseDocument', () => { + const fakePath = '/rendered/path/projectKnowledgeBaseDocument'; + const expectedParameters = { + project: 'projectValue', + knowledge_base: 'knowledgeBaseValue', + document: 'documentValue', + }; + const client = new environmentsModule.v2beta1.EnvironmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectKnowledgeBaseDocumentPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectKnowledgeBaseDocumentPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectKnowledgeBaseDocumentPath', () => { + const result = client.projectKnowledgeBaseDocumentPath( + 'projectValue', + 'knowledgeBaseValue', + 'documentValue' + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.projectKnowledgeBaseDocumentPathTemplate + .render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectKnowledgeBaseDocumentName', () => { + const result = client.matchProjectFromProjectKnowledgeBaseDocumentName( + fakePath + ); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.projectKnowledgeBaseDocumentPathTemplate + .match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchKnowledgeBaseFromProjectKnowledgeBaseDocumentName', () => { + const result = client.matchKnowledgeBaseFromProjectKnowledgeBaseDocumentName( + fakePath + ); + assert.strictEqual(result, 'knowledgeBaseValue'); + assert( + (client.pathTemplates.projectKnowledgeBaseDocumentPathTemplate + .match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchDocumentFromProjectKnowledgeBaseDocumentName', () => { + const result = client.matchDocumentFromProjectKnowledgeBaseDocumentName( + fakePath + ); + assert.strictEqual(result, 'documentValue'); + assert( + (client.pathTemplates.projectKnowledgeBaseDocumentPathTemplate + .match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + describe('projectLocationAgent', () => { const fakePath = '/rendered/path/projectLocationAgent'; const expectedParameters = { @@ -1711,5 +1728,168 @@ describe('v2beta1.EnvironmentsClient', () => { ); }); }); + + describe('projectLocationKnowledgeBase', () => { + const fakePath = '/rendered/path/projectLocationKnowledgeBase'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + knowledge_base: 'knowledgeBaseValue', + }; + const client = new environmentsModule.v2beta1.EnvironmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationKnowledgeBasePathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectLocationKnowledgeBasePathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectLocationKnowledgeBasePath', () => { + const result = client.projectLocationKnowledgeBasePath( + 'projectValue', + 'locationValue', + 'knowledgeBaseValue' + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.projectLocationKnowledgeBasePathTemplate + .render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationKnowledgeBaseName', () => { + const result = client.matchProjectFromProjectLocationKnowledgeBaseName( + fakePath + ); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.projectLocationKnowledgeBasePathTemplate + .match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationKnowledgeBaseName', () => { + const result = client.matchLocationFromProjectLocationKnowledgeBaseName( + fakePath + ); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.projectLocationKnowledgeBasePathTemplate + .match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchKnowledgeBaseFromProjectLocationKnowledgeBaseName', () => { + const result = client.matchKnowledgeBaseFromProjectLocationKnowledgeBaseName( + fakePath + ); + assert.strictEqual(result, 'knowledgeBaseValue'); + assert( + (client.pathTemplates.projectLocationKnowledgeBasePathTemplate + .match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationKnowledgeBaseDocument', () => { + const fakePath = '/rendered/path/projectLocationKnowledgeBaseDocument'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + knowledge_base: 'knowledgeBaseValue', + document: 'documentValue', + }; + const client = new environmentsModule.v2beta1.EnvironmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationKnowledgeBaseDocumentPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectLocationKnowledgeBaseDocumentPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectLocationKnowledgeBaseDocumentPath', () => { + const result = client.projectLocationKnowledgeBaseDocumentPath( + 'projectValue', + 'locationValue', + 'knowledgeBaseValue', + 'documentValue' + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.projectLocationKnowledgeBaseDocumentPathTemplate + .render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationKnowledgeBaseDocumentName', () => { + const result = client.matchProjectFromProjectLocationKnowledgeBaseDocumentName( + fakePath + ); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.projectLocationKnowledgeBaseDocumentPathTemplate + .match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationKnowledgeBaseDocumentName', () => { + const result = client.matchLocationFromProjectLocationKnowledgeBaseDocumentName( + fakePath + ); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.projectLocationKnowledgeBaseDocumentPathTemplate + .match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchKnowledgeBaseFromProjectLocationKnowledgeBaseDocumentName', () => { + const result = client.matchKnowledgeBaseFromProjectLocationKnowledgeBaseDocumentName( + fakePath + ); + assert.strictEqual(result, 'knowledgeBaseValue'); + assert( + (client.pathTemplates.projectLocationKnowledgeBaseDocumentPathTemplate + .match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchDocumentFromProjectLocationKnowledgeBaseDocumentName', () => { + const result = client.matchDocumentFromProjectLocationKnowledgeBaseDocumentName( + fakePath + ); + assert.strictEqual(result, 'documentValue'); + assert( + (client.pathTemplates.projectLocationKnowledgeBaseDocumentPathTemplate + .match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); }); }); diff --git a/packages/google-cloud-dialogflow/test/gapic_intents_v2beta1.ts b/packages/google-cloud-dialogflow/test/gapic_intents_v2beta1.ts index 8e960b3d96d..c1b85c3b5c0 100644 --- a/packages/google-cloud-dialogflow/test/gapic_intents_v2beta1.ts +++ b/packages/google-cloud-dialogflow/test/gapic_intents_v2beta1.ts @@ -1379,122 +1379,6 @@ describe('v2beta1.IntentsClient', () => { }); describe('Path templates', () => { - describe('document', () => { - const fakePath = '/rendered/path/document'; - const expectedParameters = { - project: 'projectValue', - knowledge_base: 'knowledgeBaseValue', - document: 'documentValue', - }; - const client = new intentsModule.v2beta1.IntentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.documentPathTemplate.render = sinon - .stub() - .returns(fakePath); - client.pathTemplates.documentPathTemplate.match = sinon - .stub() - .returns(expectedParameters); - - it('documentPath', () => { - const result = client.documentPath( - 'projectValue', - 'knowledgeBaseValue', - 'documentValue' - ); - assert.strictEqual(result, fakePath); - assert( - (client.pathTemplates.documentPathTemplate.render as SinonStub) - .getCall(-1) - .calledWith(expectedParameters) - ); - }); - - it('matchProjectFromDocumentName', () => { - const result = client.matchProjectFromDocumentName(fakePath); - assert.strictEqual(result, 'projectValue'); - assert( - (client.pathTemplates.documentPathTemplate.match as SinonStub) - .getCall(-1) - .calledWith(fakePath) - ); - }); - - it('matchKnowledgeBaseFromDocumentName', () => { - const result = client.matchKnowledgeBaseFromDocumentName(fakePath); - assert.strictEqual(result, 'knowledgeBaseValue'); - assert( - (client.pathTemplates.documentPathTemplate.match as SinonStub) - .getCall(-1) - .calledWith(fakePath) - ); - }); - - it('matchDocumentFromDocumentName', () => { - const result = client.matchDocumentFromDocumentName(fakePath); - assert.strictEqual(result, 'documentValue'); - assert( - (client.pathTemplates.documentPathTemplate.match as SinonStub) - .getCall(-1) - .calledWith(fakePath) - ); - }); - }); - - describe('knowledgeBase', () => { - const fakePath = '/rendered/path/knowledgeBase'; - const expectedParameters = { - project: 'projectValue', - knowledge_base: 'knowledgeBaseValue', - }; - const client = new intentsModule.v2beta1.IntentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.knowledgeBasePathTemplate.render = sinon - .stub() - .returns(fakePath); - client.pathTemplates.knowledgeBasePathTemplate.match = sinon - .stub() - .returns(expectedParameters); - - it('knowledgeBasePath', () => { - const result = client.knowledgeBasePath( - 'projectValue', - 'knowledgeBaseValue' - ); - assert.strictEqual(result, fakePath); - assert( - (client.pathTemplates.knowledgeBasePathTemplate.render as SinonStub) - .getCall(-1) - .calledWith(expectedParameters) - ); - }); - - it('matchProjectFromKnowledgeBaseName', () => { - const result = client.matchProjectFromKnowledgeBaseName(fakePath); - assert.strictEqual(result, 'projectValue'); - assert( - (client.pathTemplates.knowledgeBasePathTemplate.match as SinonStub) - .getCall(-1) - .calledWith(fakePath) - ); - }); - - it('matchKnowledgeBaseFromKnowledgeBaseName', () => { - const result = client.matchKnowledgeBaseFromKnowledgeBaseName(fakePath); - assert.strictEqual(result, 'knowledgeBaseValue'); - assert( - (client.pathTemplates.knowledgeBasePathTemplate.match as SinonStub) - .getCall(-1) - .calledWith(fakePath) - ); - }); - }); - describe('project', () => { const fakePath = '/rendered/path/project'; const expectedParameters = { @@ -2114,6 +1998,139 @@ describe('v2beta1.IntentsClient', () => { }); }); + describe('projectKnowledgeBase', () => { + const fakePath = '/rendered/path/projectKnowledgeBase'; + const expectedParameters = { + project: 'projectValue', + knowledge_base: 'knowledgeBaseValue', + }; + const client = new intentsModule.v2beta1.IntentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectKnowledgeBasePathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectKnowledgeBasePathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectKnowledgeBasePath', () => { + const result = client.projectKnowledgeBasePath( + 'projectValue', + 'knowledgeBaseValue' + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.projectKnowledgeBasePathTemplate + .render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectKnowledgeBaseName', () => { + const result = client.matchProjectFromProjectKnowledgeBaseName( + fakePath + ); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.projectKnowledgeBasePathTemplate + .match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchKnowledgeBaseFromProjectKnowledgeBaseName', () => { + const result = client.matchKnowledgeBaseFromProjectKnowledgeBaseName( + fakePath + ); + assert.strictEqual(result, 'knowledgeBaseValue'); + assert( + (client.pathTemplates.projectKnowledgeBasePathTemplate + .match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectKnowledgeBaseDocument', () => { + const fakePath = '/rendered/path/projectKnowledgeBaseDocument'; + const expectedParameters = { + project: 'projectValue', + knowledge_base: 'knowledgeBaseValue', + document: 'documentValue', + }; + const client = new intentsModule.v2beta1.IntentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectKnowledgeBaseDocumentPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectKnowledgeBaseDocumentPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectKnowledgeBaseDocumentPath', () => { + const result = client.projectKnowledgeBaseDocumentPath( + 'projectValue', + 'knowledgeBaseValue', + 'documentValue' + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.projectKnowledgeBaseDocumentPathTemplate + .render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectKnowledgeBaseDocumentName', () => { + const result = client.matchProjectFromProjectKnowledgeBaseDocumentName( + fakePath + ); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.projectKnowledgeBaseDocumentPathTemplate + .match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchKnowledgeBaseFromProjectKnowledgeBaseDocumentName', () => { + const result = client.matchKnowledgeBaseFromProjectKnowledgeBaseDocumentName( + fakePath + ); + assert.strictEqual(result, 'knowledgeBaseValue'); + assert( + (client.pathTemplates.projectKnowledgeBaseDocumentPathTemplate + .match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchDocumentFromProjectKnowledgeBaseDocumentName', () => { + const result = client.matchDocumentFromProjectKnowledgeBaseDocumentName( + fakePath + ); + assert.strictEqual(result, 'documentValue'); + assert( + (client.pathTemplates.projectKnowledgeBaseDocumentPathTemplate + .match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + describe('projectLocationAgent', () => { const fakePath = '/rendered/path/projectLocationAgent'; const expectedParameters = { @@ -2577,5 +2594,168 @@ describe('v2beta1.IntentsClient', () => { ); }); }); + + describe('projectLocationKnowledgeBase', () => { + const fakePath = '/rendered/path/projectLocationKnowledgeBase'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + knowledge_base: 'knowledgeBaseValue', + }; + const client = new intentsModule.v2beta1.IntentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationKnowledgeBasePathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectLocationKnowledgeBasePathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectLocationKnowledgeBasePath', () => { + const result = client.projectLocationKnowledgeBasePath( + 'projectValue', + 'locationValue', + 'knowledgeBaseValue' + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.projectLocationKnowledgeBasePathTemplate + .render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationKnowledgeBaseName', () => { + const result = client.matchProjectFromProjectLocationKnowledgeBaseName( + fakePath + ); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.projectLocationKnowledgeBasePathTemplate + .match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationKnowledgeBaseName', () => { + const result = client.matchLocationFromProjectLocationKnowledgeBaseName( + fakePath + ); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.projectLocationKnowledgeBasePathTemplate + .match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchKnowledgeBaseFromProjectLocationKnowledgeBaseName', () => { + const result = client.matchKnowledgeBaseFromProjectLocationKnowledgeBaseName( + fakePath + ); + assert.strictEqual(result, 'knowledgeBaseValue'); + assert( + (client.pathTemplates.projectLocationKnowledgeBasePathTemplate + .match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationKnowledgeBaseDocument', () => { + const fakePath = '/rendered/path/projectLocationKnowledgeBaseDocument'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + knowledge_base: 'knowledgeBaseValue', + document: 'documentValue', + }; + const client = new intentsModule.v2beta1.IntentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationKnowledgeBaseDocumentPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectLocationKnowledgeBaseDocumentPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectLocationKnowledgeBaseDocumentPath', () => { + const result = client.projectLocationKnowledgeBaseDocumentPath( + 'projectValue', + 'locationValue', + 'knowledgeBaseValue', + 'documentValue' + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.projectLocationKnowledgeBaseDocumentPathTemplate + .render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationKnowledgeBaseDocumentName', () => { + const result = client.matchProjectFromProjectLocationKnowledgeBaseDocumentName( + fakePath + ); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.projectLocationKnowledgeBaseDocumentPathTemplate + .match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationKnowledgeBaseDocumentName', () => { + const result = client.matchLocationFromProjectLocationKnowledgeBaseDocumentName( + fakePath + ); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.projectLocationKnowledgeBaseDocumentPathTemplate + .match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchKnowledgeBaseFromProjectLocationKnowledgeBaseDocumentName', () => { + const result = client.matchKnowledgeBaseFromProjectLocationKnowledgeBaseDocumentName( + fakePath + ); + assert.strictEqual(result, 'knowledgeBaseValue'); + assert( + (client.pathTemplates.projectLocationKnowledgeBaseDocumentPathTemplate + .match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchDocumentFromProjectLocationKnowledgeBaseDocumentName', () => { + const result = client.matchDocumentFromProjectLocationKnowledgeBaseDocumentName( + fakePath + ); + assert.strictEqual(result, 'documentValue'); + assert( + (client.pathTemplates.projectLocationKnowledgeBaseDocumentPathTemplate + .match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); }); }); diff --git a/packages/google-cloud-dialogflow/test/gapic_knowledge_bases_v2beta1.ts b/packages/google-cloud-dialogflow/test/gapic_knowledge_bases_v2beta1.ts index 858785ded4c..48782f65b3d 100644 --- a/packages/google-cloud-dialogflow/test/gapic_knowledge_bases_v2beta1.ts +++ b/packages/google-cloud-dialogflow/test/gapic_knowledge_bases_v2beta1.ts @@ -972,122 +972,6 @@ describe('v2beta1.KnowledgeBasesClient', () => { }); describe('Path templates', () => { - describe('document', () => { - const fakePath = '/rendered/path/document'; - const expectedParameters = { - project: 'projectValue', - knowledge_base: 'knowledgeBaseValue', - document: 'documentValue', - }; - const client = new knowledgebasesModule.v2beta1.KnowledgeBasesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.documentPathTemplate.render = sinon - .stub() - .returns(fakePath); - client.pathTemplates.documentPathTemplate.match = sinon - .stub() - .returns(expectedParameters); - - it('documentPath', () => { - const result = client.documentPath( - 'projectValue', - 'knowledgeBaseValue', - 'documentValue' - ); - assert.strictEqual(result, fakePath); - assert( - (client.pathTemplates.documentPathTemplate.render as SinonStub) - .getCall(-1) - .calledWith(expectedParameters) - ); - }); - - it('matchProjectFromDocumentName', () => { - const result = client.matchProjectFromDocumentName(fakePath); - assert.strictEqual(result, 'projectValue'); - assert( - (client.pathTemplates.documentPathTemplate.match as SinonStub) - .getCall(-1) - .calledWith(fakePath) - ); - }); - - it('matchKnowledgeBaseFromDocumentName', () => { - const result = client.matchKnowledgeBaseFromDocumentName(fakePath); - assert.strictEqual(result, 'knowledgeBaseValue'); - assert( - (client.pathTemplates.documentPathTemplate.match as SinonStub) - .getCall(-1) - .calledWith(fakePath) - ); - }); - - it('matchDocumentFromDocumentName', () => { - const result = client.matchDocumentFromDocumentName(fakePath); - assert.strictEqual(result, 'documentValue'); - assert( - (client.pathTemplates.documentPathTemplate.match as SinonStub) - .getCall(-1) - .calledWith(fakePath) - ); - }); - }); - - describe('knowledgeBase', () => { - const fakePath = '/rendered/path/knowledgeBase'; - const expectedParameters = { - project: 'projectValue', - knowledge_base: 'knowledgeBaseValue', - }; - const client = new knowledgebasesModule.v2beta1.KnowledgeBasesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.knowledgeBasePathTemplate.render = sinon - .stub() - .returns(fakePath); - client.pathTemplates.knowledgeBasePathTemplate.match = sinon - .stub() - .returns(expectedParameters); - - it('knowledgeBasePath', () => { - const result = client.knowledgeBasePath( - 'projectValue', - 'knowledgeBaseValue' - ); - assert.strictEqual(result, fakePath); - assert( - (client.pathTemplates.knowledgeBasePathTemplate.render as SinonStub) - .getCall(-1) - .calledWith(expectedParameters) - ); - }); - - it('matchProjectFromKnowledgeBaseName', () => { - const result = client.matchProjectFromKnowledgeBaseName(fakePath); - assert.strictEqual(result, 'projectValue'); - assert( - (client.pathTemplates.knowledgeBasePathTemplate.match as SinonStub) - .getCall(-1) - .calledWith(fakePath) - ); - }); - - it('matchKnowledgeBaseFromKnowledgeBaseName', () => { - const result = client.matchKnowledgeBaseFromKnowledgeBaseName(fakePath); - assert.strictEqual(result, 'knowledgeBaseValue'); - assert( - (client.pathTemplates.knowledgeBasePathTemplate.match as SinonStub) - .getCall(-1) - .calledWith(fakePath) - ); - }); - }); - describe('project', () => { const fakePath = '/rendered/path/project'; const expectedParameters = { @@ -1707,6 +1591,139 @@ describe('v2beta1.KnowledgeBasesClient', () => { }); }); + describe('projectKnowledgeBase', () => { + const fakePath = '/rendered/path/projectKnowledgeBase'; + const expectedParameters = { + project: 'projectValue', + knowledge_base: 'knowledgeBaseValue', + }; + const client = new knowledgebasesModule.v2beta1.KnowledgeBasesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectKnowledgeBasePathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectKnowledgeBasePathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectKnowledgeBasePath', () => { + const result = client.projectKnowledgeBasePath( + 'projectValue', + 'knowledgeBaseValue' + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.projectKnowledgeBasePathTemplate + .render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectKnowledgeBaseName', () => { + const result = client.matchProjectFromProjectKnowledgeBaseName( + fakePath + ); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.projectKnowledgeBasePathTemplate + .match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchKnowledgeBaseFromProjectKnowledgeBaseName', () => { + const result = client.matchKnowledgeBaseFromProjectKnowledgeBaseName( + fakePath + ); + assert.strictEqual(result, 'knowledgeBaseValue'); + assert( + (client.pathTemplates.projectKnowledgeBasePathTemplate + .match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectKnowledgeBaseDocument', () => { + const fakePath = '/rendered/path/projectKnowledgeBaseDocument'; + const expectedParameters = { + project: 'projectValue', + knowledge_base: 'knowledgeBaseValue', + document: 'documentValue', + }; + const client = new knowledgebasesModule.v2beta1.KnowledgeBasesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectKnowledgeBaseDocumentPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectKnowledgeBaseDocumentPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectKnowledgeBaseDocumentPath', () => { + const result = client.projectKnowledgeBaseDocumentPath( + 'projectValue', + 'knowledgeBaseValue', + 'documentValue' + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.projectKnowledgeBaseDocumentPathTemplate + .render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectKnowledgeBaseDocumentName', () => { + const result = client.matchProjectFromProjectKnowledgeBaseDocumentName( + fakePath + ); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.projectKnowledgeBaseDocumentPathTemplate + .match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchKnowledgeBaseFromProjectKnowledgeBaseDocumentName', () => { + const result = client.matchKnowledgeBaseFromProjectKnowledgeBaseDocumentName( + fakePath + ); + assert.strictEqual(result, 'knowledgeBaseValue'); + assert( + (client.pathTemplates.projectKnowledgeBaseDocumentPathTemplate + .match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchDocumentFromProjectKnowledgeBaseDocumentName', () => { + const result = client.matchDocumentFromProjectKnowledgeBaseDocumentName( + fakePath + ); + assert.strictEqual(result, 'documentValue'); + assert( + (client.pathTemplates.projectKnowledgeBaseDocumentPathTemplate + .match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + describe('projectLocationAgent', () => { const fakePath = '/rendered/path/projectLocationAgent'; const expectedParameters = { @@ -2170,5 +2187,168 @@ describe('v2beta1.KnowledgeBasesClient', () => { ); }); }); + + describe('projectLocationKnowledgeBase', () => { + const fakePath = '/rendered/path/projectLocationKnowledgeBase'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + knowledge_base: 'knowledgeBaseValue', + }; + const client = new knowledgebasesModule.v2beta1.KnowledgeBasesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationKnowledgeBasePathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectLocationKnowledgeBasePathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectLocationKnowledgeBasePath', () => { + const result = client.projectLocationKnowledgeBasePath( + 'projectValue', + 'locationValue', + 'knowledgeBaseValue' + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.projectLocationKnowledgeBasePathTemplate + .render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationKnowledgeBaseName', () => { + const result = client.matchProjectFromProjectLocationKnowledgeBaseName( + fakePath + ); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.projectLocationKnowledgeBasePathTemplate + .match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationKnowledgeBaseName', () => { + const result = client.matchLocationFromProjectLocationKnowledgeBaseName( + fakePath + ); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.projectLocationKnowledgeBasePathTemplate + .match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchKnowledgeBaseFromProjectLocationKnowledgeBaseName', () => { + const result = client.matchKnowledgeBaseFromProjectLocationKnowledgeBaseName( + fakePath + ); + assert.strictEqual(result, 'knowledgeBaseValue'); + assert( + (client.pathTemplates.projectLocationKnowledgeBasePathTemplate + .match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationKnowledgeBaseDocument', () => { + const fakePath = '/rendered/path/projectLocationKnowledgeBaseDocument'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + knowledge_base: 'knowledgeBaseValue', + document: 'documentValue', + }; + const client = new knowledgebasesModule.v2beta1.KnowledgeBasesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationKnowledgeBaseDocumentPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectLocationKnowledgeBaseDocumentPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectLocationKnowledgeBaseDocumentPath', () => { + const result = client.projectLocationKnowledgeBaseDocumentPath( + 'projectValue', + 'locationValue', + 'knowledgeBaseValue', + 'documentValue' + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.projectLocationKnowledgeBaseDocumentPathTemplate + .render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationKnowledgeBaseDocumentName', () => { + const result = client.matchProjectFromProjectLocationKnowledgeBaseDocumentName( + fakePath + ); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.projectLocationKnowledgeBaseDocumentPathTemplate + .match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationKnowledgeBaseDocumentName', () => { + const result = client.matchLocationFromProjectLocationKnowledgeBaseDocumentName( + fakePath + ); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.projectLocationKnowledgeBaseDocumentPathTemplate + .match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchKnowledgeBaseFromProjectLocationKnowledgeBaseDocumentName', () => { + const result = client.matchKnowledgeBaseFromProjectLocationKnowledgeBaseDocumentName( + fakePath + ); + assert.strictEqual(result, 'knowledgeBaseValue'); + assert( + (client.pathTemplates.projectLocationKnowledgeBaseDocumentPathTemplate + .match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchDocumentFromProjectLocationKnowledgeBaseDocumentName', () => { + const result = client.matchDocumentFromProjectLocationKnowledgeBaseDocumentName( + fakePath + ); + assert.strictEqual(result, 'documentValue'); + assert( + (client.pathTemplates.projectLocationKnowledgeBaseDocumentPathTemplate + .match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); }); }); diff --git a/packages/google-cloud-dialogflow/test/gapic_session_entity_types_v2beta1.ts b/packages/google-cloud-dialogflow/test/gapic_session_entity_types_v2beta1.ts index 171d9f6700b..79aec2d68b4 100644 --- a/packages/google-cloud-dialogflow/test/gapic_session_entity_types_v2beta1.ts +++ b/packages/google-cloud-dialogflow/test/gapic_session_entity_types_v2beta1.ts @@ -1040,126 +1040,6 @@ describe('v2beta1.SessionEntityTypesClient', () => { }); describe('Path templates', () => { - describe('document', () => { - const fakePath = '/rendered/path/document'; - const expectedParameters = { - project: 'projectValue', - knowledge_base: 'knowledgeBaseValue', - document: 'documentValue', - }; - const client = new sessionentitytypesModule.v2beta1.SessionEntityTypesClient( - { - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - } - ); - client.initialize(); - client.pathTemplates.documentPathTemplate.render = sinon - .stub() - .returns(fakePath); - client.pathTemplates.documentPathTemplate.match = sinon - .stub() - .returns(expectedParameters); - - it('documentPath', () => { - const result = client.documentPath( - 'projectValue', - 'knowledgeBaseValue', - 'documentValue' - ); - assert.strictEqual(result, fakePath); - assert( - (client.pathTemplates.documentPathTemplate.render as SinonStub) - .getCall(-1) - .calledWith(expectedParameters) - ); - }); - - it('matchProjectFromDocumentName', () => { - const result = client.matchProjectFromDocumentName(fakePath); - assert.strictEqual(result, 'projectValue'); - assert( - (client.pathTemplates.documentPathTemplate.match as SinonStub) - .getCall(-1) - .calledWith(fakePath) - ); - }); - - it('matchKnowledgeBaseFromDocumentName', () => { - const result = client.matchKnowledgeBaseFromDocumentName(fakePath); - assert.strictEqual(result, 'knowledgeBaseValue'); - assert( - (client.pathTemplates.documentPathTemplate.match as SinonStub) - .getCall(-1) - .calledWith(fakePath) - ); - }); - - it('matchDocumentFromDocumentName', () => { - const result = client.matchDocumentFromDocumentName(fakePath); - assert.strictEqual(result, 'documentValue'); - assert( - (client.pathTemplates.documentPathTemplate.match as SinonStub) - .getCall(-1) - .calledWith(fakePath) - ); - }); - }); - - describe('knowledgeBase', () => { - const fakePath = '/rendered/path/knowledgeBase'; - const expectedParameters = { - project: 'projectValue', - knowledge_base: 'knowledgeBaseValue', - }; - const client = new sessionentitytypesModule.v2beta1.SessionEntityTypesClient( - { - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - } - ); - client.initialize(); - client.pathTemplates.knowledgeBasePathTemplate.render = sinon - .stub() - .returns(fakePath); - client.pathTemplates.knowledgeBasePathTemplate.match = sinon - .stub() - .returns(expectedParameters); - - it('knowledgeBasePath', () => { - const result = client.knowledgeBasePath( - 'projectValue', - 'knowledgeBaseValue' - ); - assert.strictEqual(result, fakePath); - assert( - (client.pathTemplates.knowledgeBasePathTemplate.render as SinonStub) - .getCall(-1) - .calledWith(expectedParameters) - ); - }); - - it('matchProjectFromKnowledgeBaseName', () => { - const result = client.matchProjectFromKnowledgeBaseName(fakePath); - assert.strictEqual(result, 'projectValue'); - assert( - (client.pathTemplates.knowledgeBasePathTemplate.match as SinonStub) - .getCall(-1) - .calledWith(fakePath) - ); - }); - - it('matchKnowledgeBaseFromKnowledgeBaseName', () => { - const result = client.matchKnowledgeBaseFromKnowledgeBaseName(fakePath); - assert.strictEqual(result, 'knowledgeBaseValue'); - assert( - (client.pathTemplates.knowledgeBasePathTemplate.match as SinonStub) - .getCall(-1) - .calledWith(fakePath) - ); - }); - }); - describe('project', () => { const fakePath = '/rendered/path/project'; const expectedParameters = { @@ -1854,6 +1734,143 @@ describe('v2beta1.SessionEntityTypesClient', () => { }); }); + describe('projectKnowledgeBase', () => { + const fakePath = '/rendered/path/projectKnowledgeBase'; + const expectedParameters = { + project: 'projectValue', + knowledge_base: 'knowledgeBaseValue', + }; + const client = new sessionentitytypesModule.v2beta1.SessionEntityTypesClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + client.pathTemplates.projectKnowledgeBasePathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectKnowledgeBasePathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectKnowledgeBasePath', () => { + const result = client.projectKnowledgeBasePath( + 'projectValue', + 'knowledgeBaseValue' + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.projectKnowledgeBasePathTemplate + .render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectKnowledgeBaseName', () => { + const result = client.matchProjectFromProjectKnowledgeBaseName( + fakePath + ); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.projectKnowledgeBasePathTemplate + .match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchKnowledgeBaseFromProjectKnowledgeBaseName', () => { + const result = client.matchKnowledgeBaseFromProjectKnowledgeBaseName( + fakePath + ); + assert.strictEqual(result, 'knowledgeBaseValue'); + assert( + (client.pathTemplates.projectKnowledgeBasePathTemplate + .match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectKnowledgeBaseDocument', () => { + const fakePath = '/rendered/path/projectKnowledgeBaseDocument'; + const expectedParameters = { + project: 'projectValue', + knowledge_base: 'knowledgeBaseValue', + document: 'documentValue', + }; + const client = new sessionentitytypesModule.v2beta1.SessionEntityTypesClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + client.pathTemplates.projectKnowledgeBaseDocumentPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectKnowledgeBaseDocumentPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectKnowledgeBaseDocumentPath', () => { + const result = client.projectKnowledgeBaseDocumentPath( + 'projectValue', + 'knowledgeBaseValue', + 'documentValue' + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.projectKnowledgeBaseDocumentPathTemplate + .render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectKnowledgeBaseDocumentName', () => { + const result = client.matchProjectFromProjectKnowledgeBaseDocumentName( + fakePath + ); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.projectKnowledgeBaseDocumentPathTemplate + .match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchKnowledgeBaseFromProjectKnowledgeBaseDocumentName', () => { + const result = client.matchKnowledgeBaseFromProjectKnowledgeBaseDocumentName( + fakePath + ); + assert.strictEqual(result, 'knowledgeBaseValue'); + assert( + (client.pathTemplates.projectKnowledgeBaseDocumentPathTemplate + .match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchDocumentFromProjectKnowledgeBaseDocumentName', () => { + const result = client.matchDocumentFromProjectKnowledgeBaseDocumentName( + fakePath + ); + assert.strictEqual(result, 'documentValue'); + assert( + (client.pathTemplates.projectKnowledgeBaseDocumentPathTemplate + .match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + describe('projectLocationAgent', () => { const fakePath = '/rendered/path/projectLocationAgent'; const expectedParameters = { @@ -2329,5 +2346,172 @@ describe('v2beta1.SessionEntityTypesClient', () => { ); }); }); + + describe('projectLocationKnowledgeBase', () => { + const fakePath = '/rendered/path/projectLocationKnowledgeBase'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + knowledge_base: 'knowledgeBaseValue', + }; + const client = new sessionentitytypesModule.v2beta1.SessionEntityTypesClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + client.pathTemplates.projectLocationKnowledgeBasePathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectLocationKnowledgeBasePathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectLocationKnowledgeBasePath', () => { + const result = client.projectLocationKnowledgeBasePath( + 'projectValue', + 'locationValue', + 'knowledgeBaseValue' + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.projectLocationKnowledgeBasePathTemplate + .render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationKnowledgeBaseName', () => { + const result = client.matchProjectFromProjectLocationKnowledgeBaseName( + fakePath + ); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.projectLocationKnowledgeBasePathTemplate + .match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationKnowledgeBaseName', () => { + const result = client.matchLocationFromProjectLocationKnowledgeBaseName( + fakePath + ); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.projectLocationKnowledgeBasePathTemplate + .match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchKnowledgeBaseFromProjectLocationKnowledgeBaseName', () => { + const result = client.matchKnowledgeBaseFromProjectLocationKnowledgeBaseName( + fakePath + ); + assert.strictEqual(result, 'knowledgeBaseValue'); + assert( + (client.pathTemplates.projectLocationKnowledgeBasePathTemplate + .match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationKnowledgeBaseDocument', () => { + const fakePath = '/rendered/path/projectLocationKnowledgeBaseDocument'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + knowledge_base: 'knowledgeBaseValue', + document: 'documentValue', + }; + const client = new sessionentitytypesModule.v2beta1.SessionEntityTypesClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + client.pathTemplates.projectLocationKnowledgeBaseDocumentPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectLocationKnowledgeBaseDocumentPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectLocationKnowledgeBaseDocumentPath', () => { + const result = client.projectLocationKnowledgeBaseDocumentPath( + 'projectValue', + 'locationValue', + 'knowledgeBaseValue', + 'documentValue' + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.projectLocationKnowledgeBaseDocumentPathTemplate + .render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationKnowledgeBaseDocumentName', () => { + const result = client.matchProjectFromProjectLocationKnowledgeBaseDocumentName( + fakePath + ); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.projectLocationKnowledgeBaseDocumentPathTemplate + .match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationKnowledgeBaseDocumentName', () => { + const result = client.matchLocationFromProjectLocationKnowledgeBaseDocumentName( + fakePath + ); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.projectLocationKnowledgeBaseDocumentPathTemplate + .match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchKnowledgeBaseFromProjectLocationKnowledgeBaseDocumentName', () => { + const result = client.matchKnowledgeBaseFromProjectLocationKnowledgeBaseDocumentName( + fakePath + ); + assert.strictEqual(result, 'knowledgeBaseValue'); + assert( + (client.pathTemplates.projectLocationKnowledgeBaseDocumentPathTemplate + .match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchDocumentFromProjectLocationKnowledgeBaseDocumentName', () => { + const result = client.matchDocumentFromProjectLocationKnowledgeBaseDocumentName( + fakePath + ); + assert.strictEqual(result, 'documentValue'); + assert( + (client.pathTemplates.projectLocationKnowledgeBaseDocumentPathTemplate + .match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); }); }); diff --git a/packages/google-cloud-dialogflow/test/gapic_sessions_v2beta1.ts b/packages/google-cloud-dialogflow/test/gapic_sessions_v2beta1.ts index 6676317226b..667d37ea264 100644 --- a/packages/google-cloud-dialogflow/test/gapic_sessions_v2beta1.ts +++ b/packages/google-cloud-dialogflow/test/gapic_sessions_v2beta1.ts @@ -352,122 +352,6 @@ describe('v2beta1.SessionsClient', () => { }); describe('Path templates', () => { - describe('document', () => { - const fakePath = '/rendered/path/document'; - const expectedParameters = { - project: 'projectValue', - knowledge_base: 'knowledgeBaseValue', - document: 'documentValue', - }; - const client = new sessionsModule.v2beta1.SessionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.documentPathTemplate.render = sinon - .stub() - .returns(fakePath); - client.pathTemplates.documentPathTemplate.match = sinon - .stub() - .returns(expectedParameters); - - it('documentPath', () => { - const result = client.documentPath( - 'projectValue', - 'knowledgeBaseValue', - 'documentValue' - ); - assert.strictEqual(result, fakePath); - assert( - (client.pathTemplates.documentPathTemplate.render as SinonStub) - .getCall(-1) - .calledWith(expectedParameters) - ); - }); - - it('matchProjectFromDocumentName', () => { - const result = client.matchProjectFromDocumentName(fakePath); - assert.strictEqual(result, 'projectValue'); - assert( - (client.pathTemplates.documentPathTemplate.match as SinonStub) - .getCall(-1) - .calledWith(fakePath) - ); - }); - - it('matchKnowledgeBaseFromDocumentName', () => { - const result = client.matchKnowledgeBaseFromDocumentName(fakePath); - assert.strictEqual(result, 'knowledgeBaseValue'); - assert( - (client.pathTemplates.documentPathTemplate.match as SinonStub) - .getCall(-1) - .calledWith(fakePath) - ); - }); - - it('matchDocumentFromDocumentName', () => { - const result = client.matchDocumentFromDocumentName(fakePath); - assert.strictEqual(result, 'documentValue'); - assert( - (client.pathTemplates.documentPathTemplate.match as SinonStub) - .getCall(-1) - .calledWith(fakePath) - ); - }); - }); - - describe('knowledgeBase', () => { - const fakePath = '/rendered/path/knowledgeBase'; - const expectedParameters = { - project: 'projectValue', - knowledge_base: 'knowledgeBaseValue', - }; - const client = new sessionsModule.v2beta1.SessionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.knowledgeBasePathTemplate.render = sinon - .stub() - .returns(fakePath); - client.pathTemplates.knowledgeBasePathTemplate.match = sinon - .stub() - .returns(expectedParameters); - - it('knowledgeBasePath', () => { - const result = client.knowledgeBasePath( - 'projectValue', - 'knowledgeBaseValue' - ); - assert.strictEqual(result, fakePath); - assert( - (client.pathTemplates.knowledgeBasePathTemplate.render as SinonStub) - .getCall(-1) - .calledWith(expectedParameters) - ); - }); - - it('matchProjectFromKnowledgeBaseName', () => { - const result = client.matchProjectFromKnowledgeBaseName(fakePath); - assert.strictEqual(result, 'projectValue'); - assert( - (client.pathTemplates.knowledgeBasePathTemplate.match as SinonStub) - .getCall(-1) - .calledWith(fakePath) - ); - }); - - it('matchKnowledgeBaseFromKnowledgeBaseName', () => { - const result = client.matchKnowledgeBaseFromKnowledgeBaseName(fakePath); - assert.strictEqual(result, 'knowledgeBaseValue'); - assert( - (client.pathTemplates.knowledgeBasePathTemplate.match as SinonStub) - .getCall(-1) - .calledWith(fakePath) - ); - }); - }); - describe('projectAgent', () => { const fakePath = '/rendered/path/projectAgent'; const expectedParameters = { @@ -1193,6 +1077,139 @@ describe('v2beta1.SessionsClient', () => { }); }); + describe('projectKnowledgeBase', () => { + const fakePath = '/rendered/path/projectKnowledgeBase'; + const expectedParameters = { + project: 'projectValue', + knowledge_base: 'knowledgeBaseValue', + }; + const client = new sessionsModule.v2beta1.SessionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectKnowledgeBasePathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectKnowledgeBasePathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectKnowledgeBasePath', () => { + const result = client.projectKnowledgeBasePath( + 'projectValue', + 'knowledgeBaseValue' + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.projectKnowledgeBasePathTemplate + .render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectKnowledgeBaseName', () => { + const result = client.matchProjectFromProjectKnowledgeBaseName( + fakePath + ); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.projectKnowledgeBasePathTemplate + .match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchKnowledgeBaseFromProjectKnowledgeBaseName', () => { + const result = client.matchKnowledgeBaseFromProjectKnowledgeBaseName( + fakePath + ); + assert.strictEqual(result, 'knowledgeBaseValue'); + assert( + (client.pathTemplates.projectKnowledgeBasePathTemplate + .match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectKnowledgeBaseDocument', () => { + const fakePath = '/rendered/path/projectKnowledgeBaseDocument'; + const expectedParameters = { + project: 'projectValue', + knowledge_base: 'knowledgeBaseValue', + document: 'documentValue', + }; + const client = new sessionsModule.v2beta1.SessionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectKnowledgeBaseDocumentPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectKnowledgeBaseDocumentPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectKnowledgeBaseDocumentPath', () => { + const result = client.projectKnowledgeBaseDocumentPath( + 'projectValue', + 'knowledgeBaseValue', + 'documentValue' + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.projectKnowledgeBaseDocumentPathTemplate + .render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectKnowledgeBaseDocumentName', () => { + const result = client.matchProjectFromProjectKnowledgeBaseDocumentName( + fakePath + ); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.projectKnowledgeBaseDocumentPathTemplate + .match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchKnowledgeBaseFromProjectKnowledgeBaseDocumentName', () => { + const result = client.matchKnowledgeBaseFromProjectKnowledgeBaseDocumentName( + fakePath + ); + assert.strictEqual(result, 'knowledgeBaseValue'); + assert( + (client.pathTemplates.projectKnowledgeBaseDocumentPathTemplate + .match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchDocumentFromProjectKnowledgeBaseDocumentName', () => { + const result = client.matchDocumentFromProjectKnowledgeBaseDocumentName( + fakePath + ); + assert.strictEqual(result, 'documentValue'); + assert( + (client.pathTemplates.projectKnowledgeBaseDocumentPathTemplate + .match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + describe('projectLocationAgent', () => { const fakePath = '/rendered/path/projectLocationAgent'; const expectedParameters = { @@ -1730,5 +1747,168 @@ describe('v2beta1.SessionsClient', () => { ); }); }); + + describe('projectLocationKnowledgeBase', () => { + const fakePath = '/rendered/path/projectLocationKnowledgeBase'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + knowledge_base: 'knowledgeBaseValue', + }; + const client = new sessionsModule.v2beta1.SessionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationKnowledgeBasePathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectLocationKnowledgeBasePathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectLocationKnowledgeBasePath', () => { + const result = client.projectLocationKnowledgeBasePath( + 'projectValue', + 'locationValue', + 'knowledgeBaseValue' + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.projectLocationKnowledgeBasePathTemplate + .render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationKnowledgeBaseName', () => { + const result = client.matchProjectFromProjectLocationKnowledgeBaseName( + fakePath + ); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.projectLocationKnowledgeBasePathTemplate + .match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationKnowledgeBaseName', () => { + const result = client.matchLocationFromProjectLocationKnowledgeBaseName( + fakePath + ); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.projectLocationKnowledgeBasePathTemplate + .match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchKnowledgeBaseFromProjectLocationKnowledgeBaseName', () => { + const result = client.matchKnowledgeBaseFromProjectLocationKnowledgeBaseName( + fakePath + ); + assert.strictEqual(result, 'knowledgeBaseValue'); + assert( + (client.pathTemplates.projectLocationKnowledgeBasePathTemplate + .match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationKnowledgeBaseDocument', () => { + const fakePath = '/rendered/path/projectLocationKnowledgeBaseDocument'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + knowledge_base: 'knowledgeBaseValue', + document: 'documentValue', + }; + const client = new sessionsModule.v2beta1.SessionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationKnowledgeBaseDocumentPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectLocationKnowledgeBaseDocumentPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectLocationKnowledgeBaseDocumentPath', () => { + const result = client.projectLocationKnowledgeBaseDocumentPath( + 'projectValue', + 'locationValue', + 'knowledgeBaseValue', + 'documentValue' + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.projectLocationKnowledgeBaseDocumentPathTemplate + .render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationKnowledgeBaseDocumentName', () => { + const result = client.matchProjectFromProjectLocationKnowledgeBaseDocumentName( + fakePath + ); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.projectLocationKnowledgeBaseDocumentPathTemplate + .match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationKnowledgeBaseDocumentName', () => { + const result = client.matchLocationFromProjectLocationKnowledgeBaseDocumentName( + fakePath + ); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.projectLocationKnowledgeBaseDocumentPathTemplate + .match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchKnowledgeBaseFromProjectLocationKnowledgeBaseDocumentName', () => { + const result = client.matchKnowledgeBaseFromProjectLocationKnowledgeBaseDocumentName( + fakePath + ); + assert.strictEqual(result, 'knowledgeBaseValue'); + assert( + (client.pathTemplates.projectLocationKnowledgeBaseDocumentPathTemplate + .match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchDocumentFromProjectLocationKnowledgeBaseDocumentName', () => { + const result = client.matchDocumentFromProjectLocationKnowledgeBaseDocumentName( + fakePath + ); + assert.strictEqual(result, 'documentValue'); + assert( + (client.pathTemplates.projectLocationKnowledgeBaseDocumentPathTemplate + .match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); }); });